Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Proof-labs/trading-sdk/llms.txt

Use this file to discover all available pages before exploring further.

The Proof Trading SDK is available for TypeScript/Node.js, Python, and Rust. All three language bindings share the same wire protocol and devnet defaults, so you can freely mix them in a multi-service architecture. This page covers everything you need to get a working installation verified against the public devnet.

TypeScript / Node.js

Install the package

npm install @proof/trading-sdk
The package name on npm is @proof/trading-sdk. It ships as a pre-built ESM bundle (dist/index.js) with bundled TypeScript declarations (dist/index.d.ts).

Runtime requirements

RequirementMinimum versionNotes
Node.js18Required for native fetch, crypto.getRandomValues, and WebSocket.
TypeScript6.0tsconfig devDependency in the SDK’s own package.json.
Module systemESMSet "type": "module" in your package.json.
Because the package uses "type": "module", your project must also be an ESM module. Add the following to your package.json if it is not already present:
{
  "type": "module"
}
CommonJS (require()) is not supported. If you are working in a CJS codebase, use a dynamic import() at the call site, or migrate to ESM top-level imports.

Verify your installation

Import ExchangeClient, connect to the devnet, and call queryHealth(). This makes a single HTTP request to https://api.dev.proof.trade/health and confirms that your environment can reach the gateway:
import { ExchangeClient } from "@proof/trading-sdk";

const client = new ExchangeClient({ chainId: "exchange-devnet-1" });

const health = await client.queryHealth();
console.log(health);
// { status: "ok", height: 123456 }

client.disconnect();
Run this with tsx (no build step required):
npx tsx health-check.ts
A response of { status: "ok", height: <number> } confirms end-to-end connectivity.

Python

Install the Python package from PyPI:
pip install proof-trading-sdk
The Python package is backed by a compiled Rust core via PyO3. A pre-compiled wheel is published for common platforms, so no Rust toolchain is required to install it. The build configuration lives in python/pyproject.toml in the SDK repository.
If a pre-compiled wheel is not available for your platform, pip will attempt to build from source. In that case you need a Rust toolchain (rustup toolchain install stable) and the maturin build backend installed.

Rust

Add the crate to your Cargo.toml:
[dependencies]
proof-trading-sdk = "*"
The native Rust crate lives at crates/proof-trading-sdk in the SDK monorepo and is published to crates.io. It is the canonical implementation that both the TypeScript and Python bindings are built on top of.

Devnet configuration

The SDK ships with the following devnet defaults. No configuration is required to connect to the public devnet:
ParameterDefault valueEnvironment variable
Gateway URLhttps://api.dev.proof.tradePROOF_GATEWAY_URL
Chain IDexchange-devnet-1PROOF_CHAIN_ID
Faucet URLhttps://faucet.dev.proof.tradePROOF_FAUCET_URL
A minimal devnet client needs only a chainId:
import { ExchangeClient } from "@proof/trading-sdk";

const client = new ExchangeClient({ chainId: "exchange-devnet-1" });

Local stack configuration

When running a local development stack (CometBFT node + exchange API + gateway), point each URL at your local services:
import { ExchangeClient } from "@proof/trading-sdk";

const client = new ExchangeClient({
  rpcUrl:     "http://localhost:26657",  // CometBFT RPC
  apiUrl:     "http://localhost:8080",   // Exchange query API
  gatewayUrl: "http://localhost:9080",   // Gateway (tx submission)
  chainId:    "proof-dev",
});
All fields map directly to ExchangeClientOptions:
interface ExchangeClientOptions {
  rpcUrl?:     string;  // default: https://api.dev.proof.trade
  apiUrl?:     string;  // default: https://api.dev.proof.trade
  gatewayUrl?: string;  // default: https://api.dev.proof.trade
  chainId?:    string;  // default: "exchange-devnet-1"
  useGateway?: boolean; // default: true
  apiKey?:     string;  // gateway API key (optional)
}
Always pin chainId explicitly in production and CI environments. When chainId is omitted, the SDK auto-resolves it from the CometBFT /status endpoint at startup. Pinning it ensures signatures are deterministic across builds and prevents subtle cross-chain replay issues if the auto-resolved value changes.

ExchangeClientOptions reference

OptionTypeDefaultDescription
rpcUrlstringhttps://api.dev.proof.tradeCometBFT RPC endpoint for block queries.
apiUrlstringhttps://api.dev.proof.tradeExchange query API for orderbooks, accounts, tickers.
gatewayUrlstringhttps://api.dev.proof.tradeGateway endpoint for POST /exchange tx submission.
chainIdstring"exchange-devnet-1"Chain ID embedded in every transaction signature.
useGatewaybooleantrueRoute transactions through gateway rather than direct CometBFT broadcast.
apiKeystringBearer token for gateway endpoints that require auth.
Run the SDK’s included end-to-end example to confirm that all layers (key generation, query, and trading) work correctly in your environment:
npx tsx examples/connect-and-trade.ts
Set PROOF_FAUCET_TOKEN to run the full generate → fund → place order → cancel cycle.

Build docs developers (and LLMs) love