RUNES
dotswap V3 交易请求流程

dotswap V3 交易接口
Header parameters
AuthorizationstringRequired
User-IdstringRequired
User-AgentstringRequiredExample:
Apifox/1.0.0 (https://apifox.com)Content-TypestringRequiredExample:
application/jsonBody
fee_rateintegerRequired
最小为1,用于过滤无可用UTXO的池子
Responses
200Success
application/json
post
/dotswap/api/swap/quotePOST /dotswap/api/swap/quote HTTP/1.1
Host: test-api-proxy.ddpurse.com
Authorization: text
User-Id: text
User-Agent: text
Content-Type: application/json
Accept: */*
Content-Length: 2
{}200Success
{
"code": 1,
"msg": "text",
"data": {
"quote_id": "text",
"from_amount": "text",
"to_amount": "text",
"swap_method": "text",
"pool_infos": [
{
"service_fee": 1,
"name": "text",
"third_party_id": 1,
"third_party_address": "text",
"pool_id": 1,
"third_pool_id": 1,
"pool_url": "text",
"icon": "text",
"from_tick": {
"coin_type": "text",
"tick": "text",
"token_id": "text"
},
"to_tick": {
"coin_type": "text",
"tick": "text",
"token_id": "text"
},
"from_tick_address": "text",
"to_tick_address": "text",
"from_balance": "text",
"to_balance": "text",
"from_margin": "text",
"to_margin": "text",
"from_to_fee_ratio": "text",
"to_from_fee_ratio": "text",
"dex_margin_percent": "text",
"pool_type": "text",
"sqrt_price": "text",
"liquidity": null,
"ServiceFeeRatio": 1,
"deltaAmount": "text"
}
]
},
"req_id": "text"
}通过这个接口获取可兑换的数量。
例如:你想查询,
0.1btc可获得多少YKO•KKK•KKK•KKK•KKK。那么from_token则为btc,to_token为runes,输入from_token.amount的值,接口返回的to_amount就是YKO•KKK•KKK•KKK•KKK的数量。
Header parameters
AuthorizationstringRequired
User-IdstringRequired
User-AgentstringRequiredExample:
Apifox/1.0.0 (https://apifox.com)Content-TypestringRequiredExample:
application/jsonBody
quote_idstringRequired
从计算接口获取
fee_rateintegerRequired
最小为1,用于构建交易
btc_addressstringRequired
ord_addressstringRequired
pubkeystringRequired
slippageintegerRequired
use_bitcoin_channelbooleanRequired
inscriptionstring[]Required
仅brc20需要
Responses
200Success
application/json
post
/dotswap/api/swap/create_psbtPOST /dotswap/api/swap/create_psbt HTTP/1.1
Host: test-api-proxy.ddpurse.com
Authorization: text
User-Id: text
User-Agent: text
Content-Type: application/json
Accept: */*
Content-Length: 372
"{\n \"Address\":\n \"from_token\": {\n \"coin_type\": \"btc\",\n \"tick\": \"btc\",\n \"token_id\": \"72\",\n \"amount\": \"10000000\"\n },\n \"to_token\": {\n \"coin_type\": \"runes\",\n \"tick\": \"BITCOIN•TESTNET\",\n \"token_id\": \"35\",\n \"amount\": \"4944080\"\n },\n \"fee_rate\": 1\n}"200Success
{
"code": 1,
"msg": "text",
"data": {
"request_id": "text",
"psbts": [
"text"
]
},
"req_id": "text"
}1、这个接口的
quote_id就是从报价接口中获取到的返回值。2、
use_bitcoin_channel请默认传false,inscription默认传[]
Header parameters
AuthorizationstringRequired
User-IdstringRequired
User-AgentstringRequiredExample:
Apifox/1.0.0 (https://apifox.com)Content-TypestringRequiredExample:
application/jsonBody
request_idstringRequired
从创建psbt获取
psbtsstring[]Required
psbt_is_base64booleanOptional
false:hex true:base64
Responses
200Success
application/json
post
/dotswap/api/swap/submit_psbtPOST /dotswap/api/swap/submit_psbt HTTP/1.1
Host: test-api-proxy.ddpurse.com
Authorization: text
User-Id: text
User-Agent: text
Content-Type: application/json
Accept: */*
Content-Length: 372
"{\n \"Address\":\n \"from_token\": {\n \"coin_type\": \"btc\",\n \"tick\": \"btc\",\n \"token_id\": \"72\",\n \"amount\": \"10000000\"\n },\n \"to_token\": {\n \"coin_type\": \"runes\",\n \"tick\": \"BITCOIN•TESTNET\",\n \"token_id\": \"35\",\n \"amount\": \"4944080\"\n },\n \"fee_rate\": 1\n}"200Success
{
"code": 1,
"msg": "text",
"data": {
"order_id": "text",
"tx_id": "text"
},
"req_id": "text"
}1、
request_id是你从create_psbt获取到的2、
psbt_is_base64请和你的签名结果对应。默认一般是false
Last updated