Authentication
Pass your API key when initializing the client:Pools
client.pools.list()
Returns all pools with token reserves, fee, and LP token supply.
client.pools.get(poolId)
Returns pool details including swapAddress and lpAddress.
client.pools.getStats(poolId)
Returns apr, apy, volume24h, fees24h, tvl, swapCount24h.
Tokens
client.tokens.list()
Returns available tokens with name and admin fields.
Quotes
client.quotes.get({ from, to, amount })
Returns inputAmount, outputAmount, rate, priceImpact, fee, poolId, expiresIn.
Quotes expire in 30 seconds.
Wallets
client.wallets.create({ userId })
Creates a custodial Canton wallet for the given user ID.
client.wallets.list()
Returns all wallets for the authenticated developer.
client.wallets.get(userId)
Returns wallet details by user ID.
client.wallets.getBalances(userId)
Returns token balances for the custodial wallet.
Swaps
client.swaps.create(params)
Creates a swap intent. Returns a SwapIntent object (extends EventEmitter).
| Param | Required | Description |
|---|---|---|
fromToken | Yes | Input token symbol |
toToken | Yes | Output token symbol |
amount | Yes | Input amount |
slippageTolerance | No | 0.001–0.5, default 0.01 (1%) |
userId | No | Use custodial wallet |
senderParty | No | Custom sender party address |
outputAddress | No | Receive output at different address |
depositAddress, expectedOutput, minOutput, expiresAt, and instructions.
client.swaps.getStatus(intentId)
Status values: pending → matched → completed | slippage_failed | expired
client.swaps.list(params?)
Optional params: status, limit, offset.
Liquidity
client.liquidity.create(params)
Creates an LP intent. Returns an LpIntent object (extends EventEmitter).
| Param | Required | Description |
|---|---|---|
poolId | Yes | Target pool |
amountA | Yes | Token A amount |
amountB | Yes | Token B amount |
userId | No | Use custodial wallet |
senderParty | No | Custom sender party |
depositAddress, lpAddress, expiresAt, and instructions.
client.liquidity.getStatus(intentId)
Status values: pending → partial → completed | expired
client.liquidity.list(params?)
Optional params: status, limit, offset.
Positions and earnings
client.positions.list(userId)
Returns LP positions with sharePercent, valueTokenA, valueTokenB.
client.positions.getEarnings(userId, poolId)
Returns apr, apy, estimated daily/monthly/yearly earnings.
History and tracking
client.history.list(params?)
Returns all swaps and LP intents for the authenticated developer. Optional params: limit, offset.