# 模块化端点 (Module Endpoints)

## POST 端点 (POST Endpoints)

The POST endpoints require a signed transaction (Tx). Here is an example using the cosmjs client:

POST 端点需要签名交易 (Tx)。这是使用 cosmjs 客户端的示例： <https://github.com/sei-protocol/sei-chain/blob/master/oracle/oracle.js>

### 下单 (PlaceOrders)

**Module: Dex**\
模块:Dex

This endpoint takes a bulk order placement request.\
此端点接受批量下单请求。

```
rpc PlaceOrders(MsgPlaceOrders) returns (MsgPlaceOrdersResponse);

message MsgPlaceOrders {
  string creator = 1;
  repeated OrderPlacement orders = 2;
  string contractAddr = 3;
  repeated cosmos.base.v1beta1.Coin funds = 5 [
    (gogoproto.nullable) = false,
    (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
  ];
}

message MsgPlaceOrdersResponse {
  repeated uint64 orderIds = 1;
}
```

### 取消订单 (CancelOrders)

**Module: Dex**\
模块:Dex

This endpoint takes a bulk order placement request.\
此端点接受批量取消订单请求。

```
rpc CancelOrders(MsgCancelOrders) returns (MsgCancelOrdersResponse);

message MsgCancelOrders {
  string creator = 1;
  repeated OrderCancellation orderCancellations = 2;
  string contractAddr = 3;
}

message MsgCancelOrdersResponse {}
```

### 清算 (Liquidate)

**Module: Dex**\
模块:Dex

This endpoint liquidates an account\
此端点清算一个帐户

```
message MsgLiquidation {
  string creator = 1;
  string accountToLiquidate = 2;
  string contractAddr = 3;
}

message MsgLiquidationResponse {}
```

### AggregateExchangeRatePrevote

**Module: Oracle**\
模块:预言机

This endpoint is to send an oracle prevote hash for the next voting window.\
此端点用于为下一个投票窗口发送预言机预选哈希。

```
message MsgAggregateExchangeRatePrevote {
  string hash = 1;
  string feeder = 2;
  string validator = 3;
}

message MsgAggregateExchangeRatePrevoteResponse {}
```

### AggregateExchangeRateVote

**Module: Oracle**\
模块:预言机

This endpoint is used to send an oracle pricing vote for the current voting window. The exchange rates provided must match the hashed prevote provided in the previous voting window (for the current voting window).

此端点用于为当前投票窗口发送预言机价格投票。提供的汇率必须与前一个投票窗口（针对当前投票窗口）中提供的哈希预投票相匹配。

```
message MsgAggregateExchangeRateVote {
  string salt = 1;
  string exchange_rates = 2;
  string feeder = 3;
  string validator = 4;
}

message MsgAggregateExchangeRateVoteResponse {}
```

## 获取端点 (GET Endpoints)

### GetSettledTrades (does not exist?)

**Module: Dex**\
模块:Dex

This endpoint takes a market id and returns the trades settled in the last block.

此端点提取一个市场 id 并返回在最后一个区块中结算的交易。

```
GetSettledTradesRequest {
  int market_id;
}

GetSettledTradesResponse {
  vector<Order> settled_trades;
}
```

### GetLongBook

**Module: Dex**\
模块:Dex

This endpoint will takes a market id and returns the latest (block) long orderbook.\
此端点将采用市场 id 并返回最新（块）长订单簿。

**Service** 服务: `codchen.matrixchain.dex.Query`

**Method** 方法: `LongBook`

**Message** **Format** 消息格式:

```
// Request
QueryGetLongBookRequest {
  uint64 id = 1;
}

// Response
QueryGetLongBookResponse {
  LongBook LongBook = 1 [(gogoproto.nullable) = false];
}

// Example (using grpc-client-cli)
> grpc-client-cli localhost:9090
? Choose a service: codchen.matrixchain.dex.Query
? Choose a method: LongBook
Message json (type ? to see defaults): {"id": 0}
```

### GetShortBook

**Module: Dex**\
模块:Dex

This endpoint will takes a market id and returns the latest (block) short orderbook.\
此端点将采用市场 id 并返回最新的（块）短订单簿。

**Service 服务:** `codchen.matrixchain.dex.Query`

**Method 方法:** `ShortBook`

**Message Format 消息格式:**

```
// Request
QueryGetShortBookRequest {
  uint64 id = 1;
}

// Response
QueryGetShortBookResponse {
  ShortBook ShortBook = 1 [(gogoproto.nullable) = false];
}

// Example (using grpc-client-cli)
> grpc-client-cli localhost:9090
? Choose a service: codchen.matrixchain.dex.Query
? Choose a method: ShortBook
Message json (type ? to see defaults): {"id": 0}
```

### GetExchangeRate

**Module: Oracle**\
模块:预言机

This endpoint will return the exchange rate for a specific denomination\
此端点将返回特定面额的汇率

**Service 服务:** `seiprotocol.seichain.oracle.Query`

**Method 方法:** `ExchangeRate`

**Message Format 消息格式:**

```
// Request
QueryExchangeRatesRequest {}

// Response
QueryExchangeRateResponse {
  OracleExchangeRate oracle_exchange_rate = 1 [(gogoproto.nullable) = false];
}

// Example (using grpc-client-cli)
> grpc-client-cli localhost:9090
? Choose a service: seiprotocol.seichain.oracle.Query
? Choose a method: ExchangeRate
Message json (type ? to see defaults): {"denom": "foo"}
```

### GetExchangeRates

**Module: Oracle**\
模块:预言机

This endpoint will return all active exchange rates\
此端点返回所有有效/活跃的汇率

**Service 服务:** `seiprotocol.seichain.oracle.Query`

**Method 方法:** `ExchangeRates`

**Message Format 消息格式:**

```
// Request
QueryExchangeRateRequest {
  string denom = 1;
}

DenomOracleExchangeRatePair {
  string denom = 1;
  OracleExchangeRate oracle_exchange_rate = 2 [(gogoproto.nullable) = false];
}

// Response
QueryExchangeRatesResponse {
  // exchange_rates defines a list of the exchange rate for all whitelisted denoms.
  repeated DenomOracleExchangeRatePair denom_oracle_exchange_rate_pairs = 1;
}

// Example (using grpc-client-cli)
> grpc-client-cli localhost:9090
? Choose a service: seiprotocol.seichain.oracle.Query
? Choose a method: ExchangeRates
Message json (type ? to see defaults): {}
```

### Get\*\*VoteTargets

**Module: Oracle**\
模块:预言机

This endpoint returns all the denoms that are voting targets for oracle pricing votes.

该端点返回所有作为预言机价格投票目标的面额。

**Service 服务:** `seiprotocol.seichain.oracle.Query`

**Method 方法**: `VoteTargets`

**Message Format 消息格式:**

```
// Request
QueryVoteTargetsRequest {}

// Response
QueryVoteTargetsResponse {
  repeated string vote_targets = 1;
}

// Example (using grpc-client-cli)
> grpc-client-cli localhost:9090
? Choose a service: seiprotocol.seichain.oracle.Query
? Choose a method: VoteTargets
Message json (type ? to see defaults): {}
```

### GetMissCounter

**Module: Oracle**\
模块:预言机

This endpoint returns the miss counter of a specific validator.

该端点返回一个特定验证器的失误计数器。

**Service:** `seiprotocol.seichain.oracle.Query`

**Method:** `MissCounter`

**Message Format:**

// Request

```
// Request
QueryMissCounterRequest {
  string validator_addr = 1;
}

// Response
QueryMissCounterResponse {
  uint64 miss_counter = 1;
}

// Example (using grpc-client-cli)
> grpc-client-cli localhost:9090
? Choose a service: seiprotocol.seichain.oracle.Query
? Choose a method: MissCounter
Message json (type ? to see defaults): {"validator_addr": "seivaloperADDR"}
```

There are other query endpoints available and the specifications can be found here:

还有其他可用的查询终端，内容可在这里找到。 <https://github.com/sei-protocol/sei-chain/blob/master/proto/oracle/query.proto>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://zenofchain.gitbook.io/sei-zhong-wen-wen-dang-sei-docs-chnby-chainguys/mo-kuai-hua-duan-dian-module-endpoints.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
