Documentation Index
Fetch the complete documentation index at: https://docs.sx.bet/llms.txt
Use this file to discover all available pages before exploring further.
Some API operations require a cryptographic signature from your wallet. The examples below show how to generate one using a private key or an injected browser wallet (e.g. MetaMask).
Private key signing example
import { Wallet } from "ethers";
const wallet = new Wallet(process.env.SX_PRIVATE_KEY);
const domain = {
name: "CancelOrderSportX",
version: "1.0",
chainId: 4162, // Mainnet — use 79479957 for testnet
};
const types = {
Details: [
{ name: "message", type: "string" },
{ name: "orders", type: "string[]" },
],
};
const value = {
message: "Are you sure you want to cancel these orders",
orders: [
"0x550128e997978495eeae503c13e2e30243d747e969c65e1a0b565c609e097506",
],
};
const signature = await wallet.signTypedData(domain, types, value);
Here we use a private key directly which is the most straightforward way to sign data and does not require access to an authenticated node. It’s also the fastest.
Injected provider signing example
import { BrowserProvider } from "ethers";
const provider = new BrowserProvider(window.ethereum);
const signer = await provider.getSigner();
const domain = {
name: "CancelOrderSportX",
version: "1.0",
chainId: 4162, // Mainnet — use 79479957 for testnet
};
const types = {
Details: [
{ name: "message", type: "string" },
{ name: "orders", type: "string[]" },
],
};
const value = {
message: "Are you sure you want to cancel these orders",
orders: [
"0x550128e997978495eeae503c13e2e30243d747e969c65e1a0b565c609e097506",
],
};
const signature = await signer.signTypedData(domain, types, value);
Here we use ethers.js and show an example with MetaMask — any injected provider that exposes eth_signTypedData_v4 will work.
This signing scheme uses the EIP-712 typed data standard.