代币兑换,获取代币兑换率接口与请求参数,实际上与注入流动池是相同的
通过以下接口可以获取到当前选择代币的兑换率以及当前流动池池子的总数。这个接口在兑换中的主要作用为:
POST
/brc20swap/swap_info
export interface SwapInfoBody {
receive_coin_type: string;
receive_tick: string;
send_coin_type: string;
send_tick: string;
address: string;
}
export interface SwapTickInfo {
tick1_volume: string; // 池子中 send_tick 的代币总量
tick2_volume: string; // 池子中 receive_tick 的代币总量
tick1_per_tick2: string; // 每1个 receive_tick 可兑换的 send_tick 数
tick2_per_tick1: string; // 每1个 send_tick 可兑换的receive_tick数
token: string; //用户身份凭证,原值传给get_swap_psbt2接口
platform_service_fee_percent?: string; //买 - 平台服务费
liquider_service_fee_percent?: string; //买 - LP收益
platform_service_fee_sell_percent?: string; //卖 - 平台服务费
liquider_service_sell_percent?: string; //卖 - LP收益
}
{
"send_coin_type": "btc",
"send_tick": "BTC",
"receive_coin_type": "runes",
"receive_tick": "BEVMRUNESTONET",
"address": "0"
}
curl 'https://test-api-proxy.ddpurse.com/brc20swap/swap_info' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: en' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'Origin: http://localhost:56651' \
-H 'Pragma: no-cache' \
-H 'Referer: http://localhost:56651/' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Site: cross-site' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36' \
-H 'sec-ch-ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
--data-raw '{"send_coin_type":"btc","send_tick":"BTC","receive_coin_type":"runes","receive_tick":"BEVMRUNESTONET","address":"0"}'
1、如果提示 LiquidPair no found,说明这个币对没有流动池。
2、RUNES, BRC20, ARC20 查询接口相同,send_coin_type
/ receive_coin_type
不同
【2024.04.23】
新增: address 必传参数,用户未登录, 默认传'0'
即可
Last updated