预注入/创建流动池
创建/注入 pool
预注入/创建请求(BRC20)
选择完币对,点击注入时,如果是 BRC20,需要先请求预注入/创建接口
POST
/brc20swap/v2/pre_add_liquid
export interface PoolPsbtTxsizeBody {
tick1: string;
tick2: string;
coin_type_1: string;
coin_type_2: string;
amount_1: string;
amount_2: string;
tick_1_inscription_ids: string[];
tick_2_inscription_ids: string[];
payer_ord_addr: string;
fee_rate: string;
payer_btc_addr: string;
payer_pub_key: string;
}
// btc-brc20
{
"tick1": "BTC",
"coin_type_1": "btc",
"amount_1": "17999",
"tick_1_inscription_ids": [],
"tick2": "bqbq",
"coin_type_2": "brc20",
"amount_2": "1000",
"tick_2_inscription_ids": ["f34bf7166ce48a78b21f9b42746756b559bdab93f8e77509b505944b2efbfbe3i0"],
"fee_rate": "11",
"slipper": "12",
"payer_ord_addr": "tb1qge80xavle7c7k0tk7vceaavwcgpsr3jchl0w3e",
"payer_btc_addr": "tb1qge80xavle7c7k0tk7vceaavwcgpsr3jchl0w3e",
"payer_pub_key": "02d3ac7452920b1cc4653516dd4f4381a2df0a8c0aac6e3446e633a73ea63eee81:02d3ac7452920b1cc4653516dd4f4381a2df0a8c0aac6e3446e633a73ea63eee81"
}
// brc20-btc
{
"tick1": "bqbq",
"coin_type_1": "brc20",
"amount_1": "1000",
"tick_1_inscription_ids": [
"f34bf7166ce48a78b21f9b42746756b559bdab93f8e77509b505944b2efbfbe3i0"
],
"tick2": "BTC",
"coin_type_2": "btc",
"amount_2": "17999",
"tick_2_inscription_ids": [],
"fee_rate": "11",
"slipper": "12",
"payer_ord_addr": "tb1qge80xavle7c7k0tk7vceaavwcgpsr3jchl0w3e",
"payer_btc_addr": "tb1qge80xavle7c7k0tk7vceaavwcgpsr3jchl0w3e",
"payer_pub_key": "02d3ac7452920b1cc4653516dd4f4381a2df0a8c0aac6e3446e633a73ea63eee81:02d3ac7452920b1cc4653516dd4f4381a2df0a8c0aac6e3446e633a73ea63eee81"
}
# btc-brc20
curl 'https://test-api-proxy.ddpurse.com/brc20swap/v2/pre_add_liquid' \
-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://192.168.10.66:56651' \
-H 'Pragma: no-cache' \
-H 'Referer: http://192.168.10.66: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/121.0.0.0 Safari/537.36' \
-H 'sec-ch-ua: "Not A(Brand";v="99", "Google Chrome";v="121", "Chromium";v="121"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
--data-raw '{"tick2":"bqbq","coin_type_2":"brc20","amount_2":"1000","tick_2_inscription_ids":["f34bf7166ce48a78b21f9b42746756b559bdab93f8e77509b505944b2efbfbe3i0"],"tick1":"BTC","coin_type_1":"btc","amount_1":"17999","tick_1_inscription_ids":[],"fee_rate":"11","slipper":"12","payer_ord_addr":"tb1qge80xavle7c7k0tk7vceaavwcgpsr3jchl0w3e","payer_btc_addr":"tb1qge80xavle7c7k0tk7vceaavwcgpsr3jchl0w3e","payer_pub_key":"02d3ac7452920b1cc4653516dd4f4381a2df0a8c0aac6e3446e633a73ea63eee81:02d3ac7452920b1cc4653516dd4f4381a2df0a8c0aac6e3446e633a73ea63eee81"}' \
--compressed
# brc20-btc
curl 'https://test-api-proxy.ddpurse.com/brc20swap/v2/pre_add_liquid' \
-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://192.168.10.66:56651' \
-H 'Pragma: no-cache' \
-H 'Referer: http://192.168.10.66: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/121.0.0.0 Safari/537.36' \
-H 'sec-ch-ua: "Not A(Brand";v="99", "Google Chrome";v="121", "Chromium";v="121"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
--data-raw '{"tick1":"bqbq","coin_type_1":"brc20","amount_1":"1000","tick_1_inscription_ids":["f34bf7166ce48a78b21f9b42746756b559bdab93f8e77509b505944b2efbfbe3i0"],"tick2":"BTC","coin_type_2":"btc","amount_2":"17999","tick_2_inscription_ids":[],"fee_rate":"11","slipper":"12","payer_ord_addr":"tb1qge80xavle7c7k0tk7vceaavwcgpsr3jchl0w3e","payer_btc_addr":"tb1qge80xavle7c7k0tk7vceaavwcgpsr3jchl0w3e","payer_pub_key":"02d3ac7452920b1cc4653516dd4f4381a2df0a8c0aac6e3446e633a73ea63eee81:02d3ac7452920b1cc4653516dd4f4381a2df0a8c0aac6e3446e633a73ea63eee81"}' \
--compressed
1、这个接口返回的结果,原值传到 create_add_liquid_psbt 接口 2、因为要根据比例注入,由于 brc20 需要先铭刻,所以不支持创建 brc20-brc20 币对池3、关于 tick_1_inscription_ids
和tick_2_inscription_ids
两个参数的说明。其传值和 coin_type 对应。
如果 coin_type_1 是 brc20,则 brc20
inscription_id
放在tick_1_inscription_ids
数组,tick_2_inscription_ids
传空如果 coin_type_2 是 brc20,brc20
inscription_id
放在tick_2_inscription_ids
数组,tick_1_inscription_ids
传空
如果是同一种币对,brc20-btc 和 btc-brc20 创建或注入的是同一个池子(如:ordi-btc,btc-ordi),只是传参使用的字段不同
Last updated