Private key signing example
Injected provider signing example
eth_signTypedData_v4 will work.
This signing scheme uses the EIP-712 typed data standard.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
The Ably Websocket API is being deprecated on July 1, 2026. See the migration guide →
How to sign order and fill payloads with your private key
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);
import os
from eth_account import Account
from eth_account.messages import encode_typed_data
structured_data = {
"types": {
"EIP712Domain": [
{"name": "name", "type": "string"},
{"name": "version", "type": "string"},
{"name": "chainId", "type": "uint256"},
],
"Details": [
{"name": "message", "type": "string"},
{"name": "orders", "type": "string[]"},
],
},
"primaryType": "Details",
"domain": {
"name": "CancelOrderSportX",
"version": "1.0",
"chainId": 4162, # Mainnet — use 79479957 for testnet
},
"message": {
"message": "Are you sure you want to cancel these orders",
"orders": [
"0x550128e997978495eeae503c13e2e30243d747e969c65e1a0b565c609e097506",
],
},
}
private_key = os.environ["PRIVATE_KEY"]
signable_message = encode_typed_data(full_message=structured_data)
signed = Account.sign_message(signable_message, private_key=private_key)
signature = signed.signature.hex()
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);
eth_signTypedData_v4 will work.
This signing scheme uses the EIP-712 typed data standard.
