Skip to content
Docs
Actions
Making Orders

Making Orders

aori_makeOrder

You can make orders using the aori_makeOrder method. This method allows users to create and place an order on the orderbook. Once an order is made, it's broadcasted to orderbook subscribers.

ParametersTypeRequiredDescription
orderLimit OrderYesLimit order to make. See Limit Order format
signaturestringYesA signature by the user of the limit order.
isPublicbooleanNoA boolean representing if the order is public
apiKeystringNoAPI key
{
  "id": <request_id>,
  "jsonrpc": "2.0",
  "method": "aori_makeOrder",
  "params": [{
    "order": {
      // Order details
        "offerer": "0x...",
        "inputToken": "0x...",
        "inputAmount": "10000...",
        "inputChainId": 1,
        "inputZone": "0x...",
        "outputToken": "0x...",
        "outputAmount": "10000...",
        "outputChainId": 1,
        "outputZone": "0x...",
        "startTime": "0",
        "endTime": "10000...",
        "salt": "12345678",
        "counter": 0,
        "toWithdraw": true,
    },
    "signature": <signed typed signature of order>,
    "isPublic": <true_or_false>,
    "apiKey": "<api_key>"
  }]
}

Response

{
  "id": <request_id>,
  "result": "Ok"
}

Related Streaming Events

{
    "id": null,
    "result": {
        "type": "OrderCreated",
        "data": <order> // See Limit Order object
    }
}

When your limit order is taken, the OrderToExecute event is emitted. This event contains the details of the matching order and the taker order for you to execute the trade on-chain.

{
    "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>
        }
    }
}

Notes:

  • The method checks if the provided chain ID is supported.
  • Once validated, the order is added to the database and broadcasted to orderbook subscribers.