Types
All TypeScript types exported by the SDK.
Numeric Types
NumericInput
Flexible numeric input type for quantities and amounts.
import type Big from 'big.js'
type NumericInput = string | number | bigint | BigNumericFormat
Output format options for numeric values.
type NumericFormat = 'string' | 'number' | 'bigint' | 'Big'NumericOutput<F>
Maps a NumericFormat to its corresponding TypeScript type.
type NumericOutput<F extends NumericFormat> =
F extends 'string' ? string :
F extends 'number' ? number :
F extends 'bigint' ? bigint :
F extends 'Big' ? Big :
stringEnums and Unions
Partner
Partner identifier for tracking swap sources. Contact SteelSwap to obtain your partner code.
type Partner = stringTxStatus
Transaction status values.
type TxStatus = 'txPending' | 'queued' | 'executed' | 'cancelled'OrderType
Order type enum.
type OrderType = 0 | 1 | 2Assets
Asset map — token identifier to quantity.
type Assets = Record<string, number>v1 Request Types
SwapEstimateRequest
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.
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
interface CancelSwapRequest {
utxos?: string[] | null
txList: TxListItem[]
collateralUtxo?: string | null
ttl: number
changeAddress?: string | null
}TxListItem
interface TxListItem {
txHash: string
txIndex: number // Note: "txIndex", not "index"
}TokenRequest
interface TokenRequest {
token: string
}PoolPairRequest
interface PoolPairRequest {
tokenA: string
tokenB: string
}PoolPairOrdersRequest
interface PoolPairOrdersRequest extends PoolPairRequest {
limit?: number
}SwapHistoryRequest
interface SwapHistoryRequest {
addresses: string[]
txType?: string[]
page?: number
pageSize?: number
}TxHashRequest
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
interface BuildSwapResponse {
tx: string
p: boolean
}TokenSummary
Token information returned by getTokens() and findTradingPairs(). Not generic — all fields are plain types.
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.
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.
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.
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.
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.
interface OrderStatus {
source: string
firstObserved: number
lastUpdated: number
totalSubmitted: Assets
totalRequested: Assets
totalReceived: Assets
swaps: SwapStatus[]
}OrderStatusResponse
Response wrapper for order lists.
interface OrderStatusResponse {
orders: OrderStatus[]
page: number
lastPage: number
}PoolSummary<F>
Pool summary for a DEX.
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().
type PoolSummaryResponse<F extends NumericFormat = 'string'> = Record<string, PoolSummary<F>>SteelSwapStatistics<F>
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>
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.
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.
class SteelSwapValidationError extends SteelSwapError {
endpoint: string
validationError: unknown
rawData: unknown
}v2 Types
SteelSwapV2Config
interface SteelSwapV2Config {
baseUrl?: string
timeout?: number
fetch?: typeof fetch
bearerToken: string
}V2OrderStatus
type V2OrderStatus = 'MEMPOOL' | 'OPEN' | 'FILLED' | 'CANCELLED'OrderOutput
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
interface OpenOrdersRequest {
dex?: string
addresses?: string[]
}OrderHistoryRequest
interface OrderHistoryRequest {
addresses: string[]
}AddressListResponse
interface AddressListResponse {
partner_id: string
addresses: string[]
}C3 Price Types
C3PriceConfig
interface C3PriceConfig {
baseUrl?: string
timeout?: number
fetch?: typeof fetch
bearerToken: string
}CurrentStats
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
type HistoryResolution = '1min' | '5min' | '15min' | '60min' | '1d'HistoryParams
interface HistoryParams {
symbol: string
resolution: HistoryResolution
from: number
to: number
include_tvl?: boolean
}HistoryResponse
Discriminated union on s. Only 'ok' responses include OHLCV arrays.
type HistoryResponse =
| {
s: 'ok'
t: number[]
o: number[]
h: number[]
l: number[]
c: number[]
v: number[]
tvl?: number[] | null
}
| {
s: 'no_data'
nextTime?: number
}
| DataErrorResponseSymbolInfoResponse
TradingView UDF format with hyphenated field names. Core fields are typed; additional UDF fields pass through via index signature.
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
interface GroupListResponse {
s: string
d: {
groups: { id: string }[]
}
}DataErrorResponse
interface DataErrorResponse {
s: 'error'
errmsg: string
}