V2 (recommended)
swapQuote(params: SwapV2QuoteParams)
Get a quote with normalized token direction.
| Param | Type | Notes |
|---|---|---|
amount | string | Amount in fromToken units |
fromToken | string | e.g., BTC |
toToken | string | e.g., USDC, GOLD DUST |
address | string | User BTC address |
protocol | string | runes, alkanes, … |
params | Record<string, any> | Protocol-specific extras |
marketplaces? | string[] | Optional allowlist |
bestMarketplace: stringswapId: stringfromTokenAmount/toTokenAmount: stringsmetrics: per-marketplace fulfillment and pricingmarketplaces: per-marketplace amounts + swapIds
swapPSBT(params: SwapV2PSBTParams)
Create PSBT(s) for the swap; returns an array because some swaps need multiple signatures.
| Param | Type | Notes |
|---|---|---|
marketplace | string | From the quote |
swapId | string | From the quote/previous step |
address | string | User BTC address |
publicKey | string | BTC pubkey matching address |
paymentAddress | string | Change/receive address |
paymentPublicKey | string | Pubkey for paymentAddress |
feeRate | number | sats/vByte |
slippage | number | percent |
protocol | string | e.g., runes |
themeID? | string | null | Optional widget theme |
swapSubmit(params: SwapV2SubmitParams)
Submit signed PSBTs to complete the swap.
| Param | Type | Notes |
|---|---|---|
marketplace | string | From quote/PSBT |
swapId | string | From PSBT step |
address | string | User BTC address |
publicKey | string | BTC pubkey |
paymentAddress | string | Change/receive address |
paymentPublicKey | string | Pubkey for change |
protocol | string | e.g., runes |
signedPsbts | string[] | Signed PSBT hex strings |
txid: stringmarketplace: stringrbfProtection?:{ fundsPreparationTxId, fulfillmentId }isRbfTxid: boolean
V1 (legacy rune trading)
These methods stay for existing integrations and RBF flows.signIn({ ord_address, btc_address, ord_public_key, btc_public_key, provider })bind({ btcAddress, nftAddress, sign })points({ ord_address })popularCollections()search({ rune_name, sell? })fetchQuote({ btcAmount, runeName, address, marketplaces?, themeID?, sell?, rbfProtection?, fill? })getPSBT({ orders, address, publicKey, paymentAddress, paymentPublicKey, runeName, utxos?, feeRate?, slippage?, themeID?, sell?, rbfProtection? })confirmPSBT({ orders, address, publicKey, paymentAddress, paymentPublicKey, signedPsbtBase64, signedRbfPsbtBase64?, swapId, runeName, sell?, marketplaces?, rbfProtection? })
V1 flow (short)
Errors
All methods throw descriptive errors. Wrap calls intry/catch and surface useful hints (slippage, insufficient balance, marketplace unsupported, swap expired). For network issues, check connectivity and API key validity.