# OrderMatching

### type ContractPrice

#### constructor

```javascript
/**
* @param {number} pair_id
* @param {string} market_price
*/
ContractPrice(pair_id, market_price)
```

**input:**

* pair\_id: The contract pair id defined by zkLink.
* market\_price: The market price of the contract pair

### type SpotPriceInfo

#### constructor

```javascript
/**
* @param {number} token_id
* @param {string} price
*/
SpotPriceInfo(token_id, price)
```

**input:**

* token\_id: The token id defined by zkLink.
* price: The spot price of the token.

### type Order

The [Order](/developer/api-and-sdk/transaction/order_matching.md) struct of taker and maker.

#### constructor

```javascript
/**
* @param {number} account_id
* @param {number} sub_account_id
* @param {number} slot_id
* @param {number} nonce
* @param {number} base_token_id
* @param {number} quote_token_id
* @param {string} amount
* @param {string} price
* @param {boolean} is_sell
* @param {number} maker_fee_rate
* @param {number} taker_fee_rate
* @param {boolean} has_subsidy
*/
Order(account_id, sub_account_id, slot_id, nonce, base_token_id, quote_token_id, amount, price, is_sell, maker_fee_rate, taker_fee_rate, has_subsidy)
```

#### func sign

```javascript
/**
* @param {ZkLinkSigner} signer
* @returns {any}
*/
sign(signer)
```

Sign order with given [ZkLinkSigner](/developer/sdk/changelog-1/signer.md#type-zklinksigner)

### type OrderMatchingBuilder

#### constructor

```javascript
/**
* @param {number} account_id
* @param {number} sub_account_id
* @param {Order} taker
* @param {Order} maker
* @param {string} fee
* @param {number} fee_token
* @param {ContractPrice[]} contract_prices
* @param {SpotPriceInfo[]} margin_prices
* @param {string} expect_base_amount
* @param {string} expect_quote_amount
*/
OrderMatchingBuilder(account_id, sub_account_id, taker, maker, fee, fee_token, contract_prices, margin_prices, expect_base_amount, expect_quote_amount)
```

### type OrderMatching

[OrderMatching](/developer/api-and-sdk/transaction/order_matching.md) transaction type.

#### constructor

```javascript
/**
* @param {OrderMatchingBuilder} builder
*/
newOrderMatching(builder)
```

#### func sign

```javascript
/**
* @param {ZkLinkSigner} signer
* @returns {any}
*/
sign(signer)
```

Sign transaction with given [ZkLinkSigner](/developer/sdk/changelog-1/signer.md#type-zklinksigner)


---

# 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://docs.zk.link/developer/sdk/changelog-1/transactions/5-order-matching.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.
