Skip to content

Types

All TypeScript types exported by the SDK.

Config Types

HundredXConfig

Used with new HundredX() for read-only access.

typescript
interface HundredXConfig {
  brokerId: number;
  logLevel?: LogLevel;
}

CreateConfig

Used with HundredX.create() for full authenticated access.

typescript
interface CreateConfig {
  privateKey: string;
  brokerId: number;
  logLevel?: LogLevel;
  subaccountNumber?: number;  // default: 1
}

RegisterResult

Returned by HundredX.register() (called internally by create()).

typescript
interface RegisterResult {
  broker_key: string;
  broker_secret: string;
  party_id: string;
  signing_key: string;
  signing_address: string;
  subaccount_id: string;
}

Order Types

PlaceOrderRequest

typescript
interface PlaceOrderRequest {
  marketId: number;
  isBuy: boolean;
  orderType: OrderType;       // 'LIMIT' | 'MARKET'
  amount: string;             // Float string (e.g., "1.5")
  price: string;              // Float string (e.g., "2500.00")
  expiryTs?: number;          // Expiry timestamp in ms (default: 30 days)
  isReduce?: boolean;         // Reduce-only (default: false)
  triggerPrice?: string;      // For TP/SL orders
  triggerCondition?: TriggerCondition; // 'TP' | 'SL' | ''
}

PlaceOrderWithTPSLRequest

typescript
interface PlaceOrderWithTPSLRequest {
  marketId: number;
  isBuy: boolean;
  amount: string;             // Float string (e.g., "1.5")
  entryPrice: string;         // Float string — entry price ("0" for market)
  orderType?: OrderType;      // Default: 'MARKET'
  takeProfitPrice: string;    // TP trigger & limit price
  stopLossPrice: string;      // SL trigger & limit price
}

PlaceOrderWithTPSLResponse

typescript
interface PlaceOrderWithTPSLResponse {
  entry: OrderResponse;
  takeProfit: OrderResponse;
  stopLoss: OrderResponse;
}

OrderResponse

typescript
interface OrderResponse {
  id: number;
  subaccountId: string;
  brokerId: number;
  marketType: string;
  marketSymbol: string;
  type: OrderType;
  side: OrderSide;            // 'BUY' | 'SELL'
  amountx18: string;
  totalFilledx18: string;
  pricex18: string;
  expiryTs: number;
  status: OrderStatus;        // 'OPEN' | 'PARTIAL' | 'FILLED' | 'CANCELLED'
  createdAt: string;
  updatedAt: string;
  triggerPricex18?: string;
  triggerCondition?: TriggerCondition;
}

CancelOrderResponse

typescript
interface CancelOrderResponse {
  message: string;
}

CancelAllOrdersResponse

typescript
interface CancelAllOrdersResponse {
  cancelledOrderIds: number[];
  skippedOrdersWithReason: unknown[];
}

GetOrdersResponse

typescript
interface GetOrdersResponse {
  orders: OrderResponse[];
}

Enums

typescript
type OrderType = 'LIMIT' | 'MARKET';
type OrderSide = 'BUY' | 'SELL';
type OrderStatus = 'OPEN' | 'PARTIAL' | 'FILLED' | 'CANCELLED';
type TriggerCondition = '' | 'TP' | 'SL';

Position Types

Position

typescript
interface Position {
  productID: number;
  vQuoteBalance: string;               // x18 string
  vBalanceAmount: string;              // x18 string
  leverage: number;
  InitialMarginFraction: string;
  MaintenanceMarginFraction: string;
}

TradeHistoryEntry

typescript
interface TradeHistoryEntry {
  productId: number;
  type: string;
  amountx18: string;
  pricex18: string;
  timestamp: number;
  feex18: string;
  pnl: string;
  feebonusx18: string;
  isLiquidation: boolean;
}

PositionsResponse

typescript
interface PositionsResponse {
  positions: Position[];
  tradeHistory: TradeHistoryEntry[];
}

User Order Types

UserOrder

typescript
interface UserOrder {
  orderID: number;
  productID: number;
  pricex18: string;
  amountx18: string;
  operation: string;           // 'BUY' or 'SELL'
  OrderType: string;           // 'LIMIT', 'MARKET', 'TP', 'SL'
  filledAmountx18: string;
  isTPSL: boolean;
  isReduce: boolean;
}

UserOrdersResponse

typescript
interface UserOrdersResponse {
  orders: UserOrder[];
}

BuyingPowerResponse

typescript
interface BuyingPowerResponse {
  totalBuyingPower: string;
}

Deposit / Withdraw Types

DepositCollateralRequest

typescript
interface DepositCollateralRequest {
  subAccountId: string;
  sessionKey: string;
  productId: number;
  amount: string;               // Big int string (raw units)
  nonce: number;
  sender: string;               // ETH address
  destinationChainId?: number;  // default: 42161 (Arbitrum)
  chainId?: number;             // default: 1 (Ethereum mainnet)
}

WithdrawCollateralRequest

typescript
interface WithdrawCollateralRequest {
  subAccountId: string;
  sessionKey: string;
  productId: number;
  amount: string;
  nonce: number;
  receiver: string;             // ETH address
  destinationChainId?: number;
  chainId?: number;
}

DepositWithdrawResponse

typescript
interface DepositWithdrawResponse {
  success: boolean;
}

User Query Types

DepositRecord / WithdrawalRecord

typescript
interface DepositRecord {
  amount: string;
  productId: number;
  sourceChainId: number;
  destinationChainId: number;
  finalised: boolean;
  createdAt: string;
  txHash: string;
}
// WithdrawalRecord has the same shape

WithdrawableBalanceResponse

typescript
interface WithdrawableBalanceResponse {
  withdrawableBalance: Record<string, string>;  // productId → amount
}

NonceResponse

typescript
interface NonceResponse {
  nonce: number;
}

Market Types

Market

typescript
interface Market {
  id: number;
  Symbol: string;
  Type: MarketType;                    // 'SPOT' | 'PERPETUAL'
  BaseAsset: string;
  QuoteAsset: string;
  IsActive: boolean;
  MinAmountx18: string;
  MaxPositionValuex18: string;
  PriceToQtmConversionExpo: number;
  AmtToQtmConversionExpo: number;
  MakerFeeFractionx18: string;
  TakerFeeFractionx18: string;
  InitialMarginFractionx18: string;
  MaintenanceMarginFractionx18: string;
}

FundingRateData

typescript
interface FundingRateData {
  Symbol: string;
  Funding: {
    fundingRate: number;
    cumulativeFundingRate: string;
  };
}

WebSocket Types

WsOrderbookData

typescript
interface WsOrderbookData {
  bids?: WsOrderbookLevel[] | null;
  asks?: WsOrderbookLevel[] | null;
  timestamp?: number;
  marketId?: number;
}

interface WsOrderbookLevel {
  price: string;
  quantity: string;
}

WsTrade

typescript
interface WsTrade {
  price: string;
  size: string;
  side: string;
  timestamp: string;
}

WsMarketPrice

Alias for WsOrderbookData — market prices stream sends full orderbook data for each market.

API Response Wrapper

typescript
interface ApiResponseWrapper<T> {
  body: T;
  message: string;
  status: number;
}

100x Exchange Market Maker SDK