Swaps at a glance
- V2 (recommended): Simplified
swapQuote → swapPSBT → swapSubmitflow with automatic marketplace selection and cleaner parameters. Supports multiple PSBTs per swap and protocols likerunesandalkanes. - V1 (legacy): Granular rune trading with manual order handling (
fetchQuote → getPSBT → confirmPSBT) and optional RBF protection. Kept for backwards compatibility. - Packages: Use the standalone
@satsterminal-sdk/swapsor the suitesatsterminal-sdk(exports the sameSatsTerminalclient).
Install
Choose your flow
| Use case | Go with | Why |
|---|---|---|
| New integrations, fastest path | V2 | 3 calls, normalized data, auto marketplace routing |
| RBF protection or legacy rune flows | V1 | Explicit marketplace control and single-PSBT handling |
| Multiple products (swaps + borrow) | Aggregator | One createClient call yields both clients |
Protocols and tokens
protocol:runesfor rune trading,alkanesfor alkanes tokens, more coming.fromToken/toToken: clear directionality (e.g.,BTC → USDCorDOG•GO•TO•THE•MOON → BTC).- Marketplaces are selected automatically for V2; pass
marketplacewhen creating PSBTs or submitting.
Quick V2 shape
What changed from V1
- Direction is expressed via
fromToken/toTokeninstead ofsell. - Multiple PSBTs per swap (array) vs single PSBT.
- Automatic order management; you only sign and submit.
- Consistent response shapes and marketplace metrics.
- API reference:
swaps/api - Quickstart:
swaps/quickstart - Examples:
swaps/examples