Taking Orders
aori_takeOrder
You can take orders using the aori_takeOrder method
.
Parameters | Type | Required | Description |
---|---|---|---|
orderHash | string | Yes | Maker's limit order identifier to take |
order | Limit Order | Yes | Taker's matching order to take with. See Limit Order format |
signature | string | Yes | A signature by the user of the order. |
seatId | string | No | Seat identifier. See Seats for more information. |
{
"id": <request_id>,
"jsonrpc": "2.0",
"method": "aori_takeOrder",
"params": [{
"data": {
"orderHash": <string of maker order hash to take>,
"order": {
// ... See Limit Order object
},
"signature": <signed typed signature of taker order>,
"seatId": <string>
}
}]
}
Response
{
"id": <request_id>,
"result": "Ok"
}
Related Subscription Events
{
"id": null,
"result": {
"type": "OrderTaken",
"data": <order>, // See Limit Order object
}
}
When the maker's limit order is taken, the OrderToExecute
event is emitted. This event contains the details of the matched orders for you to execute the trade on-chain, though generally, the maker will do this.
{
"id": null,
"result": {
"type": "OrderToExecute",
"data": {
"matchingHash": <string>,
"matching": {
"makerOrder": <order>, // See Limit Order object
"takerOrder": <order>, // See Limit Order object
"makerSignature": <string>,
"takerSignature": <string>,
"blockDeadline": <number>,
"seatNumber": <number>,
"seatHolder": <string>,
"seatPercentOfFees": <number>,
},
"matchingSignature": <string>,
"makerOrderHash": <string>,
"makerChainId": <number>,
"makerZone": <string>,
"takerOrderHash": <string>,
"takerChainId": <number>,
"takerZone": <string>,
"chainId": <number>,
"to": <string>,
"value": <number>,
"data": <string>,
"maker": <string>,
"taker": <string>,
"inputToken": <string>,
"inputAmount": <string>,
"outputToken": <string>,
"outputAmount": <string>
}
}
}
When your limit order is fulfilled, the OrderFulfilled
event is emitted as confirmation that the trade has been executed on-chain.
{
"id": null,
"result": {
"type": "OrderFulfilled",
"data": {
"makerOrderHash": <string>,
"takerOrderHash": <string>,
"maker": <string>,
"taker": <string>,
"inputChainId": <number>,
"outputChainId": <number>,
"inputZone": <string>,
"outputZone": <string>,
"inputToken": <string>,
"outputToken": <string>,
"inputAmount": <string>,
"outputAmount": <string>,
"matchingHash": <string>,
"transactionHash": <string>,
"blockNumber": <number>,
"timestamp": <number>
}
}
}
If the order is not fulfilled or the maker chooses to fail the order, the OrderFailed
event is emitted.
{
"id": null,
"result": {
"type": "OrderFailed",
"data": {
"makerOrderHash": <string>,
"takerOrderHash": <string>,
"maker": <string>,
"taker": <string>,
"inputChainId": <number>,
"outputChainId": <number>,
"inputZone": <string>,
"outputZone": <string>,
"inputToken": <string>,
"outputToken": <string>,
"inputAmount": <string>,
"outputAmount": <string>,
"matchingHash": <string>
}
}
}