Skip to main content
POST
/
orders
/
cancel
/
event
JavaScript
import { Wallet, hexlify, randomBytes } from "ethers";

const wallet = new Wallet(process.env.SX_PRIVATE_KEY);

const sportXeventId = "L1233231";
const salt = hexlify(randomBytes(32));
const timestamp = Math.floor(Date.now() / 1000);
const chainId = 4162; // Mainnet — use 79479957 for testnet

const domain = {
  name: "CancelOrderEventsSportX",
  version: "1.0",
  chainId,
  salt,
};

const types = {
  Details: [
    { name: "sportXeventId", type: "string" },
    { name: "timestamp", type: "uint256" },
  ],
};

const signature = await wallet.signTypedData(domain, types, { sportXeventId, timestamp });

const apiPayload = {
  signature,
  sportXeventId,
  salt,
  maker: wallet.address,
  timestamp,
};

const result = await fetch("https://api.sx.bet/orders/cancel/event", { // Mainnet — use https://api.toronto.sx.bet for testnet
  method: "POST",
  body: JSON.stringify(apiPayload),
  headers: { "Content-Type": "application/json" },
});
{
  "status": "success",
  "data": {
    "cancelledCount": 1,
    "orders": [
      {
        "orderHash": "0xc4fad4181eac3d72a7d4166df05534edd5479ec7053076244986ec68336ef45",
        "pendingFills": [
          {
            "fillHash": "0xf691c9dfb100d12550c3cb4dad944f15d711eaf22108c6dacc5077a274b3582l",
            "pendingFillAmount": "1806995918"
          }
        ]
      }
    ]
  }
}
Rate limit: All POST /orders/* endpoints share a combined limit of 5,500 requests/min. See Rate Limits.

Body

application/json
sportXeventId
string
required

The event for which orders should be cancelled

signature
string
required

Your wallet signature over the cancel payload. See the Order Signing reference for details on how to compute this.

salt
string
required

A random 32 bytes hex string to protect against replay

maker
string
required

The account from which you are cancelling orders

timestamp
integer
required

The current timestamp in UNIX seconds to protect against replay

Response

status
string

success or failure if the request succeeded or not

data
object