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 | 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 identifiers for tracking swap sources.

typescript
type Partner =
  | ''
  | 'eternl'
  | 'eternl-aggregator'
  | 'eternl-browser'
  | 'farmbot'
  | 'lace-aggregator'
  | 'yoroi-aggregator'

TxStatus

Transaction status values.

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

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
  feeAdjust?: boolean
  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
  index: number
}

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
}

Response Types

All response types are generic over NumericFormat. The type parameter F defaults to 'string'.

BuildSwapResponse

typescript
interface BuildSwapResponse {
  tx: string
  p: boolean
}

TokenSummary<F>

typescript
interface TokenSummary<F extends NumericFormat = 'string'> {
  ticker: string
  name: string
  policyId: string
  assetName: string
  decimals: number
  price?: NumericOutput<F> | null
}

SplitOutput<F>

Result for single-hop swaps.

typescript
interface SplitOutput<F extends NumericFormat = 'string'> {
  totalOutput: NumericOutput<F>
  minOutput: NumericOutput<F>
  pools: PoolOutput<F>[]
}

HopSplitOutput<F>

Result for multi-hop swaps.

typescript
interface HopSplitOutput<F extends NumericFormat = 'string'> {
  hop1: SplitOutput<F>
  hop2: SplitOutput<F>
  intermediateToken: string
  totalOutput: NumericOutput<F>
}

PoolOutput<F>

Individual DEX pool details.

typescript
interface PoolOutput<F extends NumericFormat = 'string'> {
  dex: string
  liquidityA: NumericOutput<F>
  liquidityB: NumericOutput<F>
  fee: NumericOutput<F>
  output: NumericOutput<F>
}

OrderStatus<F>

typescript
interface OrderStatus<F extends NumericFormat = 'string'> {
  txHash: string
  tokenA: string
  tokenB: string
  inputAmount: NumericOutput<F>
  outputAmount: NumericOutput<F>
  status: TxStatus
  swaps: SwapStatus<F>[]
  timestamp: number
}

SwapStatus<F>

typescript
interface SwapStatus<F extends NumericFormat = 'string'> {
  dex: string
  inputAmount: NumericOutput<F>
  outputAmount: NumericOutput<F>
  status: TxStatus
}

OrderStatusResponse<F>

typescript
interface OrderStatusResponse<F extends NumericFormat = 'string'> {
  orders: OrderStatus<F>[]
  total: number
}

PoolSummary<F>

typescript
interface PoolSummary<F extends NumericFormat = 'string'> {
  dex: string
  reserveA: NumericOutput<F>
  reserveB: NumericOutput<F>
  fee: NumericOutput<F>
  poolId: string
}

PoolSummaryResponse<F>

typescript
interface PoolSummaryResponse<F extends NumericFormat = 'string'> {
  pools: PoolSummary<F>[]
}

SteelSwapStatistics<F>

typescript
interface SteelSwapStatistics<F extends NumericFormat = '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>
}

Configuration Types

SteelSwapConfig<F>

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