SDK TypeScript
El mismo SDK que alimenta la UI web se exporta en src/sdk/nexus y es el cliente canónico. Gestiona el ciclo de vida de la sesión, la derivación de firmas, la reautenticación automática al expirar la sesión y la resolución de identificadores de activos.
import { SessionClient, PrivateKeyHashSigner, InfoClient,} from './sdk/nexus';
const baseUrl = 'https://api.bitnxs.com';
// 1. Build a signer from your API key (from "More → API Keys" page)const signer = new PrivateKeyHashSigner('0x...');
// 2. Bind the session to your MAIN wallet (different from the API key address)const session = new SessionClient({ signer, userAddress: '0xABC...', baseUrl,});
// 3. Trade — session is opened lazily on first callawait session.order({ asset: 'BTC', isBuy: true, limitPx: '65000', sz: '0.01', reduceOnly: false, orderType: { type: 'limit', tif: 'Gtc' },});
// 4. Public reads via InfoClientconst info = new InfoClient({ baseUrl });const fills = await info.userFills('0xABC...');