Docs
Version 0 alpha (v0alpha)
Limit Order
Cancel

Cancelling Limit Orders

💡

This API is currently in alpha, and can be changed or removed without notice. Also, the maker needs to be whitelisted to use it. Please reach out to us via email for more information.

There can be multiple ways to cancel a limit order.

Implicit Cancellation

Order can be implicitly cancelled by calling our API endpoint. This removes the order from our database and prevents it from being filled.

Since this does not invalidate the order on the blockchain, it is technically possible for the order to be filled after it has been cancelled. However, our Navigator will not route any trades to the order after it has been implicitly cancelled.

This could be useful if you want to prevent the order from being filled, but do not want to pay the gas cost of explicitly cancelling the order on the blockchain. Especially when expiresAt you set on the order is not that far in the future.

If you want to prevent the order from being filled, you can explicitly cancel the order on the blockchain.

Endpoint

DELETE https://api.swapscanner.io/v0alpha/limit-orders?orderHashes=0x0,0x0&signatures=0x0,0x0

URL Parameters

  • orderHashes - The order hash of the limit order to cancel. Multiple order hashes can be provided as a comma separated list.
  • signatures - The signature of the order to cancel. Must be signed by the maker. Multiple signatures can be provided as a comma separated list.

When providing multiple orderHashes and signatures, they must be in the same order.

Schema for Signing

{
  "domain": {
    "name": "Swapscanner Limit Order Protocol",
    "version": "v0",
    "chainId": "8217",
    "verifyingContract": "TBD",
    "salt": "0xYourSaltHere"
  },
  "primaryType": "OrderCancellationRequest",
  "message": {
    "orderHash": "0x0"
  },
  "types": {
    "EIP712Domain": [
      { "name": "name", "type": "string" },
      { "name": "version", "type": "string" },
      { "name": "chainId", "type": "uint256" },
      { "name": "verifyingContract", "type": "address" },
      { "name": "salt", "type": "uint256" }
    ],
    "OrderCancellationRequest": [{ "name": "orderHash", "type": "bytes32" }]
  }
}

Explicit Cancellation

Order can be explicitly cancelled by calling the cancelOrder function on the LimitOrderProtocol contract.

ABI and contract address to be disclosed.

Bulk Explicit Cancellation

Multiple orders can be explicitly cancelled by calling the cancelAllOrders function on the LimitOrderProtocol contract.

This function will increment the nonce of the maker, which will invalidate all orders with a lower nonce value.

This action is permanent and irreversible as the nonce only increases and cannot be decreased.

ABI and contract address to be disclosed.