Skip to content

SteelSwapV2Client

Client for the SteelSwap v2 API — order tracking and partner address management.

The v2 API uses Bearer token authentication and snake_case field names.

Constructor

typescript
import { SteelSwapV2Client } from '@steelswap/steelswap-sdk'

const client = new SteelSwapV2Client({
  bearerToken: 'your-v2-bearer-token',
})

See Configuration for all options.

Order Methods

getOpenOrders(params?)

Get open orders, optionally filtered by DEX and/or wallet addresses.

typescript
const orders = await client.getOpenOrders({
  addresses: ['addr1...'],
  dex: 'minswap', // optional
})

Parameters:

NameTypeRequiredDescription
addressesstring[]NoFilter by wallet addresses
dexstringNoFilter by DEX name

Returns: Promise<OrderOutput[]>


getOrderHistory(params)

Get order history for the given wallet addresses.

typescript
const history = await client.getOrderHistory({
  addresses: ['addr1...'],
})

Parameters:

NameTypeRequiredDescription
addressesstring[]YesWallet addresses to query

Returns: Promise<OrderOutput[]>


getOrderDetails(txHash)

Get order details by transaction hash.

typescript
const details = await client.getOrderDetails('abc123...')

Parameters:

NameTypeRequiredDescription
txHashstringYesTransaction hash

Returns: Promise<OrderOutput[]>

Partner Management

getPartnerAddresses()

Get the list of addresses registered for the authenticated partner.

typescript
const result = await client.getPartnerAddresses()
console.log(result.partner_id)
console.log(result.addresses)

Returns: Promise<AddressListResponse>{ partner_id: string, addresses: string[] }


addPartnerAddress(address)

Add an address to the authenticated partner's address list.

typescript
const result = await client.addPartnerAddress('addr1...')

Parameters:

NameTypeRequiredDescription
addressstringYesCardano address to add

Returns: Promise<AddressListResponse>


removePartnerAddress(address)

Remove an address from the authenticated partner's address list.

typescript
const result = await client.removePartnerAddress('addr1...')

Parameters:

NameTypeRequiredDescription
addressstringYesCardano address to remove

Returns: Promise<AddressListResponse>

OrderOutput Type

All order methods return OrderOutput[] with the following fields:

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: 'MEMPOOL' | 'OPEN' | 'FILLED' | 'CANCELLED'
  datum_cbor: string
  execution_pool_state_id?: string | null
  execution_tx_hash?: string | null
  amount_received?: number | null
}

Error Handling

The v2 client throws the same error types as the v1 client:

typescript
import { SteelSwapError, SteelSwapValidationError } from '@steelswap/steelswap-sdk'

try {
  await client.getOpenOrders()
} catch (error) {
  if (error instanceof SteelSwapValidationError) {
    console.log('Validation failed:', error.endpoint)
  } else if (error instanceof SteelSwapError) {
    console.log('API error:', error.statusCode)
  }
}

Cardano's DEX aggregator.