Skip to content

Types

All TypeScript types exported by the SDK.

Numeric Types

NumericInput

Flexible numeric input type for quantities and amounts.

typescript
import type Big from 'big.js'

type NumericInput = string | number | bigint | Big

NumericFormat

Output format options for numeric values.

typescript
type NumericFormat = 'string' | 'number' | 'bigint' | 'Big'

NumericOutput<F>

Maps a NumericFormat to its corresponding TypeScript type.

typescript
type NumericOutput<F extends NumericFormat> =
  F extends 'string' ? string :
  F extends 'number' ? number :
  F extends 'bigint' ? bigint :
  F extends 'Big' ? Big :
  string

Enums and Unions

Partner

Partner identifier for tracking swap sources. Contact SteelSwap to obtain your partner code.

typescript
type Partner = string

TxStatus

Transaction status values.

typescript
type TxStatus = 'txPending' | 'queued' | 'executed' | 'cancelled'

OrderType

Order type enum.

typescript
type OrderType = 0 | 1 | 2

Assets

Asset map — token identifier to quantity.

typescript
type Assets = Record<string, number>

v1 Request Types

SwapEstimateRequest

typescript
interface SwapEstimateRequest {
  tokenA: string
  tokenB: string
  quantity: NumericInput
  predictFromOutputAmount?: boolean
  ignoreDexes?: string[]
  hop?: boolean
  da?: object[] | string | null
}

BuildSwapRequest

Extends SwapEstimateRequest with transaction building parameters.

typescript
interface BuildSwapRequest extends SwapEstimateRequest {
  address: string
  forwardAddress?: string | null
  utxos: string[]
  collateral?: string[] | null
  slippage: NumericInput
  changeAddress?: string | object | null
  pAddress?: string | null
  feeAdust?: boolean  // Note: API spells this "feeAdust"
  ttl?: number
}

CancelSwapRequest

typescript
interface CancelSwapRequest {
  utxos?: string[] | null
  txList: TxListItem[]
  collateralUtxo?: string | null
  ttl: number
  changeAddress?: string | null
}

TxListItem

typescript
interface TxListItem {
  txHash: string
  txIndex: number  // Note: "txIndex", not "index"
}

TokenRequest

typescript
interface TokenRequest {
  token: string
}

PoolPairRequest

typescript
interface PoolPairRequest {
  tokenA: string
  tokenB: string
}

PoolPairOrdersRequest

typescript
interface PoolPairOrdersRequest extends PoolPairRequest {
  limit?: number
}

SwapHistoryRequest

typescript
interface SwapHistoryRequest {
  addresses: string[]
  txType?: string[]
  page?: number
  pageSize?: number
}

TxHashRequest

typescript
interface TxHashRequest {
  txHash: string
  txCbor?: string | null
}

v1 Response Types

Response types with numeric fields are generic over NumericFormat. The type parameter F defaults to 'string'.

BuildSwapResponse

typescript
interface BuildSwapResponse {
  tx: string
  p: boolean
}

TokenSummary

Token information returned by getTokens() and findTradingPairs(). Not generic — all fields are plain types.

typescript
interface TokenSummary {
  ticker: string
  name: string
  policyId: string
  policyName: string
  decimals: number
  priceNumerator: number
  priceDenominator: number
  sources: string[]
}

SplitOutput<F>

Result for single-hop swap estimates.

typescript
interface SplitOutput<F extends NumericFormat = 'string'> {
  tokenA: string
  quantityA: NumericOutput<F>
  tokenB: string
  quantityB: NumericOutput<F>
  totalFee: NumericOutput<F>
  totalDeposit: NumericOutput<F>
  steelswapFee: NumericOutput<F>
  bonusOut: NumericOutput<F>
  price: NumericOutput<F>
  pools: PoolOutput<F>[]
}

HopSplitOutput<F>

Result for multi-hop swap estimates. Has the same top-level fields as SplitOutput plus split group details. The top-level pools field is omitted by the API for hop responses — pools only exist inside each splitGroup entry.

typescript
interface HopSplitOutput<F extends NumericFormat = 'string'> extends Omit<SplitOutput<F>, 'pools'> {
  splitGroup: SplitOutput<F>[][]
  pools?: PoolOutput<F>[]
}

PoolOutput<F>

Individual DEX pool details within a swap estimate.

typescript
interface PoolOutput<F extends NumericFormat = 'string'> {
  dex: string
  poolId: string
  quantityA: NumericOutput<F>
  quantityB: NumericOutput<F>
  batcherFee: NumericOutput<F>
  deposit: NumericOutput<F>
  volumeFee: NumericOutput<F>
}

SwapStatus

Individual swap status within an order. Not generic — asset values use Assets maps.

typescript
interface SwapStatus {
  dex: string
  orderType: OrderType
  txStatus: TxStatus
  submitTxHash: string
  submitTxIndex: number
  submitTime: number
  submitAssets: Assets[] | null
  requestAssets: Assets[] | null
  executeTxHash: string | null
  executeTxIndex: number | null
  executeTime: number | null
  receivedAssets: Assets[] | null
}

OrderStatus

Order status — represents a group of swaps from a single transaction. Not generic.

typescript
interface OrderStatus {
  source: string
  firstObserved: number
  lastUpdated: number
  totalSubmitted: Assets
  totalRequested: Assets
  totalReceived: Assets
  swaps: SwapStatus[]
}

OrderStatusResponse

Response wrapper for order lists.

typescript
interface OrderStatusResponse {
  orders: OrderStatus[]
  page: number
  lastPage: number
}

PoolSummary<F>

Pool summary for a DEX.

typescript
interface PoolSummary<F extends NumericFormat = 'string'> {
  liquidity: NumericOutput<F>
  priceNumerator: NumericOutput<F>
  priceDenominator: NumericOutput<F>
  poolCount: NumericOutput<F>
}

PoolSummaryResponse<F>

Pool summary response — a map from DEX name to pool summary. Returned by getPools().

typescript
type PoolSummaryResponse<F extends NumericFormat = 'string'> = Record<string, PoolSummary<F>>

SteelSwapStatistics<F>

typescript
interface SteelSwapStatistics<F extends NumericFormat = 'string'> {
  service: string
  totalWallets: NumericOutput<F>
  weeklyWallets: NumericOutput<F>
  dailyWallets: NumericOutput<F>
  hourlyWallets: NumericOutput<F>
  totalVolume: NumericOutput<F>
  weeklyVolume: NumericOutput<F>
  dailyVolume: NumericOutput<F>
  hourlyVolume: NumericOutput<F>
  totalTrades: NumericOutput<F>
  weeklyTrades: NumericOutput<F>
  dailyTrades: NumericOutput<F>
  hourlyTrades: NumericOutput<F>
}

v1 Configuration Types

SteelSwapConfig<F>

typescript
interface SteelSwapConfig<F extends NumericFormat = 'string'> {
  baseUrl?: string
  timeout?: number
  fetch?: typeof fetch
  token?: string
  partner?: Partner
  numericFormat?: F
}

v1 Error Classes

SteelSwapError

Thrown when the API returns an HTTP error.

typescript
class SteelSwapError extends Error {
  statusCode: number
  responseBody: string
}

SteelSwapValidationError

Thrown when the API returns data that doesn't match the expected Zod schema. Extends SteelSwapError.

typescript
class SteelSwapValidationError extends SteelSwapError {
  endpoint: string
  validationError: unknown
  rawData: unknown
}

v2 Types

SteelSwapV2Config

typescript
interface SteelSwapV2Config {
  baseUrl?: string
  timeout?: number
  fetch?: typeof fetch
  bearerToken: string
}

V2OrderStatus

typescript
type V2OrderStatus = 'MEMPOOL' | 'OPEN' | 'FILLED' | 'CANCELLED'

OrderOutput

typescript
interface OrderOutput {
  tx_hash: string
  tx_index: number
  block_slot: number
  clazz: string
  token_offer: string
  amount_offer: number
  token_ask: string
  amount_ask: number
  status: V2OrderStatus
  datum_cbor: string
  execution_pool_state_id?: string | null
  execution_tx_hash?: string | null
  amount_received?: number | null
}

OpenOrdersRequest

typescript
interface OpenOrdersRequest {
  dex?: string
  addresses?: string[]
}

OrderHistoryRequest

typescript
interface OrderHistoryRequest {
  addresses: string[]
}

AddressListResponse

typescript
interface AddressListResponse {
  partner_id: string
  addresses: string[]
}

C3 Price Types

C3PriceConfig

typescript
interface C3PriceConfig {
  baseUrl?: string
  timeout?: number
  fetch?: typeof fetch
  bearerToken: string
}

CurrentStats

typescript
interface CurrentStats {
  current_price: number
  current_tvl: number
  hourly_price_change: number
  hourly_tvl_change: number
  hourly_volume: number
  daily_price_change: number
  daily_tvl_change: number
  daily_volume: number
}

HistoryResolution

typescript
type HistoryResolution = '1min' | '5min' | '15min' | '60min' | '1d'

HistoryParams

typescript
interface HistoryParams {
  symbol: string
  resolution: HistoryResolution
  from: number
  to: number
  include_tvl?: boolean
}

HistoryResponse

Discriminated union on s. Only 'ok' responses include OHLCV arrays.

typescript
type HistoryResponse =
  | {
      s: 'ok'
      t: number[]
      o: number[]
      h: number[]
      l: number[]
      c: number[]
      v: number[]
      tvl?: number[] | null
    }
  | {
      s: 'no_data'
      nextTime?: number
    }
  | DataErrorResponse

SymbolInfoResponse

TradingView UDF format with hyphenated field names. Core fields are typed; additional UDF fields pass through via index signature.

typescript
interface SymbolInfoResponse {
  s: string
  symbol: string[]
  description: string[]
  'exchange-listed': string[]
  'exchange-traded': string[]
  type: string[]
  timezone: string[]
  'session-regular': string[]
  minmovement: number[]
  minmovement2?: number[]
  pricescale: number[]
  'has-intraday': boolean[] | null
  'has-daily': boolean[] | null
  'has-weekly-and-monthly': boolean[] | null
  ticker: string[]
  currency?: string[]
  'base-currency'?: string[]
  fractional?: boolean[]
  'has-no-volume'?: boolean[]
  typespecs?: string[][]
  [key: string]: unknown
}

GroupListResponse

typescript
interface GroupListResponse {
  s: string
  d: {
    groups: { id: string }[]
  }
}

DataErrorResponse

typescript
interface DataErrorResponse {
  s: 'error'
  errmsg: string
}

Cardano's DEX aggregator.