Skip to content
Docs
Actions
Taking Orders

Taking Orders

aori_takeOrder

You can take orders using the aori_takeOrder method.

ParametersTypeRequiredDescription
orderHashstringYesMaker's limit order identifier to take
orderLimit OrderYesTaker's matching order to take with. See Limit Order format
signaturestringYesA signature by the user of the order.
seatIdstringNoSeat 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>
        }
    }
}