Swap flow
- Create a swap intent specifying input/output tokens, amount, and slippage tolerance.
- The SDK returns a
depositAddressandexpectedOutput. - Deposit the input token to the deposit address on Canton.
- OneSwap detects the deposit and executes the swap automatically.
- Output token is sent to the user’s wallet (or a specified
outputAddress).
Status lifecycle
pending → matched → completed | slippage_failed | expired
- pending: intent created, waiting for deposit
- matched: deposit detected on-chain
- completed: swap executed, output sent
- slippage_failed: output fell below
minOutput, tokens refunded - expired: no deposit within 30 minutes
Example
Slippage protection
0.001 (0.1%) to 0.5 (50%), default 0.01 (1%).
Liquidity flow
- Create an LP intent specifying the pool and amounts for both tokens.
- The SDK returns a
depositAddress. - Send both tokens to the deposit address (two separate deposits, any order).
- OneSwap pairs deposits by sender. Status moves to
partialafter one token arrives. - Once both are received, LP tokens are minted and credited.
Status lifecycle
pending → partial → completed | expired
- partial: one of two tokens received
- completed: both tokens received, LP tokens minted
- expired: deposits not completed within 30 minutes