Skip to main content

OneSwap SDK

OneSwap is an automated market maker (AMM) on Canton Network. The SDK lets you integrate token swaps and liquidity provision into your application with a few lines of TypeScript.

What you can do

  • Swap tokens (CC/Amulet, USDCx) using AMM pricing
  • Provide and manage liquidity in pools
  • Create custodial wallets for your end users
  • Get real-time quotes with slippage protection
  • Track swap and LP intent status via events or polling
  • View LP positions, earnings, APR/APY

How it works

OneSwap uses an intent-based execution model:
  1. Your app creates a swap or LP intent via the SDK.
  2. The intent returns a depositAddress where tokens should be sent.
  3. OneSwap detects the deposit on-chain and executes automatically.
  4. Your app polls or listens for completion.

Core model

  • Formula: x * y = k (constant product)
  • Fee: 0.3% per swap (80% to LPs, 20% to platform)
  • Intents expire 30 minutes after creation