API Reference

Methods

swapQuote


Get a quote for swapping tokens with simplified parameters.

async swapQuote(params: SwapV2QuoteParams): Promise<SwapV2QuoteResponse>

Parameters:

  • amount (string): Amount to swap (e.g., "0.00008")

  • fromToken (string): Source token (e.g., "BTC")

  • toToken (string): Destination token (e.g., "GOLD DUST")

  • address (string): User's Bitcoin address

  • params (Record<string, object>): Additional parameters

  • protocol (string): Protocol to use (e.g., "alkanes", "runes")

  • marketplaces (list): Marketplaces to include (e.g. ["MagicEden", "Dotswap])

Example:

const quote = await satsTerminal.swapQuote({
  amount: "0.00008",
  fromToken: "BTC",
  toToken: "GOLD DUST",
  address: "bc1p4mffk7l9a040dgqrl8spunwkguxn68ldwx848urafar9sj85nnrq9rcvyj",
  params: {},
  protocol: "alkanes"
});

Example Response:

swapPSBT


Get PSBT (Partially Signed Bitcoin Transaction) for the swap.

Parameters:

  • marketplace (string): Marketplace to use (e.g., "Unisat", "IdClub")

  • swapId (string): Swap ID from quote response

  • address (string): User's Bitcoin address

  • publicKey (string): User's public key

  • paymentAddress (string): Payment address

  • paymentPublicKey (string): Payment public key

  • feeRate (number): Fee rate (e.g., 3)

  • slippage (number): Slippage tolerance (e.g., 9)

  • themeID? (string | null): Theme ID (optional)

  • protocol (string): Protocol to use

Example:

Example Response:

swapSubmit

Submit signed PSBT to complete the swap.

Parameters:

  • marketplace (string): Marketplace to use

  • swapId (string): Swap ID from PSBT response

  • address (string): User's Bitcoin address

  • publicKey (string): User's public key

  • paymentAddress (string): Payment address

  • paymentPublicKey (string): Payment public key

  • protocol (string): Protocol to use

  • signedPsbts (string[]): Array of signed PSBT hex strings

Example:

Example Response:

signIn


Register and authenticate a user with their Bitcoin and Ordinals addresses.

Parameters:

  • ord_address (string): Ordinals address

  • btc_address (string): Bitcoin address

  • ord_public_key (string): Ordinals public key

  • btc_public_key (string): Bitcoin public key

  • provider (string): Wallet provider (e.g., 'xverse', 'unisat')

Example:

bind


Bind a user's wallet to Unisat and DotSwap. This is required only once before performing transactions.

Parameters:

  • btcAddress (string): Bitcoin address

  • nftAddress (string): Ordinals address

  • sign (string): User's signature of the bind message

Example:

points


Get the user's accumulated Amber points balance.

Parameters:

  • ord_address (string): Ordinals address

Example:


Search for runes by name.

Parameters:

  • rune_name (string): The name of the rune to search for

  • sell (boolean, optional): Whether to search for sell orders

Example:

popularCollections


Fetch popular rune collections.

Example:

Last updated