RUNES

dotswap V3 Transaction request flow

dotswap V3 Swap interface

aggregate and calculate Swap quotes

post
/dotswap/api/swap/quote
Header parameters
AuthorizationstringRequired
User-IdstringRequired
User-AgentstringRequiredExample: Apifox/1.0.0 (https://apifox.com)
Content-TypestringRequiredExample: application/json
Body
fee_rateintegerRequired

with a minimum of 1, used to filter pools with no available UTXOs.

Responses
200Success
application/json
post
/dotswap/api/swap/quote
200Success

Use this interface to obtain the available swap amount.

For example, if you want to check how much YKO•KKK•KKK•KKK•KKK you can get for 0.1 BTC, then set from_token to btc and to_token to runes. Input the value of from_token.amount, and the interface will return to_amount, which represents the amount of YKO•KKK•KKK•KKK•KKK.

1、Please save the quote_id field from the current interface for use in subsequent requests.

2、Note that the quote_id is valid for 35 seconds. Please use it within the valid time; otherwise, you need to request a new one.

Aggregate and create Swap PSBT

post
/dotswap/api/swap/create_psbt
Header parameters
AuthorizationstringRequired
User-IdstringRequired
User-AgentstringRequiredExample: Apifox/1.0.0 (https://apifox.com)
Content-TypestringRequiredExample: application/json
Body
quote_idstringRequired

obtained from the calculation interface

fee_rateintegerRequired

with a minimum of 1, used for transaction construction.

btc_addressstringRequired
ord_addressstringRequired
pubkeystringRequired
slippageintegerRequired
use_bitcoin_channelbooleanRequired
inscriptionstring[]Required

required only for BRC20.

Responses
200Success
application/json
post
/dotswap/api/swap/create_psbt
200Success

1、The quote_id in this interface is the return value obtained from the quotation interface.

2、Please set use_bitcoin_channel to false by default, and set inscription to an empty array [].

Note: The current interface returns a psbts array. If the psbts array contains more than 0 items, you need to use signPsbts for signing. Otherwise, use signPsbt.

Aggregate and create a Swap order

post
/dotswap/api/swap/submit_psbt
Header parameters
AuthorizationstringRequired
User-IdstringRequired
User-AgentstringRequiredExample: Apifox/1.0.0 (https://apifox.com)
Content-TypestringRequiredExample: application/json
Body
request_idstringRequired

obtained from the PSBT creation

psbtsstring[]Required
psbt_is_base64booleanOptional

false:hex true:base64

Responses
200Success
application/json
post
/dotswap/api/swap/submit_psbt
200Success
  1. The request_id is obtained from the create_psbt response.

  2. Please set psbt_is_base64 according to your signing result; by default, it is usually false.

Last updated