Skip to main content

DecibelConfig

  • network: Aptos network identifier
  • fullnodeUrl: Aptos fullnode HTTP endpoint
  • tradingHttpUrl: Decibel trading REST base URL
  • tradingWsUrl: Decibel trading WebSocket URL
  • gasStationUrl: Base URL override for the Gas Station API (only needed for custom networks)
  • gasStationApiKey: Geomi Gas Station API key for sponsored transactions
  • deployment: on-chain package and addresses (package, usdc, testc, perpEngineGlobal)
  • chainId: optional preconfigured chain id to accelerate build/sign

Custom config example

import { type DecibelConfig } from "@decibeltrade/sdk";
import { Network } from "@aptos-labs/ts-sdk";

const CUSTOM: DecibelConfig = {
  network: Network.CUSTOM,
  fullnodeUrl: "https://fullnode.example.com/v1",
  tradingHttpUrl: "https://api.example.com/decibel",
  tradingWsUrl: "wss://api.example.com/decibel/ws",
  gasStationUrl: "https://api.example.com/gs/v1", // optional: enables gas sponsorship
  gasStationApiKey: process.env.GAS_STATION_API_KEY, // optional: enables gas sponsorship
  deployment: {
    package: "0x...package",
    usdc: "0x...usdc",
    testc: "0x...testc",
    perpEngineGlobal: "0x...global",
  },
  chainId: 204, // optional
};

Gas Station (Sponsored Transactions)

To sponsor gas fees for your users via Geomi Gas Station, add gasStationApiKey to your config:
const config = {
  ...TESTNET_CONFIG,
  gasStationApiKey: process.env.GAS_STATION_API_KEY!,
};

const write = new DecibelWriteDex(config, account);
When gasStationApiKey is set, the SDK automatically submits all transactions through the Gas Station for fee sponsorship. Users don’t need APT for gas. To disable sponsorship, simply omit gasStationApiKey from the config.

Node API keys

Pass nodeApiKey to DecibelReadDex or DecibelWriteDex for fullnode rate limits and performance.
Under the hood, the SDK sends it as Authorization: Bearer <YOUR_NODE_API_KEY> on outbound HTTP requests:
const read = new DecibelReadDex(TESTNET_CONFIG, {
  nodeApiKey: process.env.APTOS_NODE_API_KEY!, // Required
});
const write = new DecibelWriteDex(TESTNET_CONFIG, account, {
  nodeApiKey: process.env.APTOS_NODE_API_KEY!, // Required
});