CAT20
For testnet, use: https://test-api-proxy.ddpurse.com/
For mainet, use: https://api.swap.dotwallet.com/
Here are the CAT20 API curl examples, will update the docs later:
V1 deposit
POST
/brc20swap/create_deposit_cat20_psbtv2
Request a deposit transaction to be signed. Example
curl --location --request POST 'https://test-api-proxy.ddpurse.com/brc20swap/create_deposit_cat20_psbtv2' \
--header 'Pragma: no-cache' \
--header 'Wallet-Name: unisat' \
--header 'Wallet-Ver: 1.4.10' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'Content-Type: application/json' \
--header 'Accept: */*' \
--header 'Host: test-api-proxy.ddpurse.com' \
--header 'Connection: keep-alive' \
--data-raw '{
"tick": "loadrun5:e57683b12e71734a1877bb3d52e0f78aaf99344ee59c82308252a64185dd473e_0",
"payer_pub_key": "0334634a1d07f69123517540ec1d565fbd9b7775beacb93b41a7937374a06dd685",
"payer_btc_addr": "bc1pfr8rwpydqgrkv6apw0lsx0xa9e3d5kpgr6txagr3plkskp4z7xdsfqaqrs",
"payer_ord_addr": "bc1pfr8rwpydqgrkv6apw0lsx0xa9e3d5kpgr6txagr3plkskp4z7xdsfqaqrs",
"fee_rate": 2,
"coin_type": "cat20",
"value": "1",
"token_id": ""
}'
Returns PSBTs to be signed, example:
{
"code": 0,
"msg": "",
"data": {
"psbts": [
{
"psbt_base64": "cHNidP8BAIkCAAAAAfiYlFv9R8UyjDb6DXYApQZJZsAMSRVkra/JfCfa7HwKAQAAAAD/////AjYWAAAAAAAAIlEgSM43BI0CB2ZroXP/AzzdLmLaWCgelm6gcQ/tCwai8ZvqGgAAAAAAACJRIEjONwSNAgdma6Fz/wM83S5i2lgoHpZuoHEP7QsGovGbAAAAAAABAStVMgAAAAAAACJRIEjONwSNAgdma6Fz/wM83S5i2lgoHpZuoHEP7QsGovGbAQMEAQAAAAAAAA==",
"sighash": "",
"to_sign_inputs": [
{
"index": 0,
"leaf_hash": "",
"final_script_witness_length": 0,
"not_sign": false
}
]
},
{
"psbt_base64": "cHNidP8BAKwCAAAAAUZhu1a2vm+9c8EjHTxbeiN+ZUqBXky2q86x08wDPs6eAAAAAAD/////AwAAAAAAAAAAGmoYY2F0AYt2aKBXmE7mcCscWMc+mVc2XKegSgEAAAAAAAAiUSBS9ewkaBUSiJ92WjMTt0ag6SsB3z9OSEBCNpBqH/Ri/nETAAAAAAAAIlEgSM43BI0CB2ZroXP/AzzdLmLaWCgelm6gcQ/tCwai8ZsAAAAAAAEBKzYWAAAAAAAAIlEgSM43BI0CB2ZroXP/AzzdLmLaWCgelm6gcQ/tCwai8ZsBAwQBAAAAAAAAAA==",
"sighash": "",
"to_sign_inputs": [
{
"index": 0,
"leaf_hash": "",
"final_script_witness_length": 0,
"not_sign": false
}
]
},
{
"psbt_base64": "cHNidP8BANMCAAAAA506iWPzg8wsV5hxpLkmwD6jzINDC0X6pgbmhXNcW4x/AgAAAAD/////yK2+44akFV53+y2IjivXYFDKlWncKTO/ovY2ppq4OAIBAAAAAP/////Irb7jhqQVXnf7LYiOK9dgUMqVadwpM7+i9jammrg4AgIAAAAA/////wIAAAAAAAAAABpqGGNhdAEoY8xKbazTrYFbBRzxvwFHH5/Sg0oBAAAAAAAAIlEg/a07DGY4ilCMcatXFDriKZMBrPjavB1snu2DmTkrpmsHAAAAAAEBK0oBAAAAAAAAIlEg/a07DGY4ilCMcatXFDriKZMBrPjavB1snu2DmTkrpmsAAQErSgEAAAAAAAAiUSBS9ewkaBUSiJ92WjMTt0ag6SsB3z9OSEBCNpBqH/Ri/gABAStxEwAAAAAAACJRIEjONwSNAgdma6Fz/wM83S5i2lgoHpZuoHEP7QsGovGbAAAA",
"sighash": "",
"to_sign_inputs": [
{
"index": 0,
"leaf_hash": "cba48905c402c028a95be60fe3b6ff7c59502015e3081337c665c61bf4f1cc22",
"final_script_witness_length": 0,
"not_sign": false
},
{
"index": 1,
"leaf_hash": "",
"final_script_witness_length": 9500,
"not_sign": true
},
{
"index": 2,
"leaf_hash": "",
"final_script_witness_length": 0,
"not_sign": false
}
]
}
],
"leaf_script": "2079be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f817984c807bb52d7a9fef58323eb1bf7a407db382d2f3f2d81bb1224f49fe518f6d48d37c7bb52d7a9fef58323eb1bf7a407db382d2f3f2d81bb1224f49fe518f6d48d37c79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f8179879be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f8179842f40a48df4b2a70c8b4924bf2654661ed3d95fd66a313eb87237597c628e4a031f40a48df4b2a70c8b4924bf2654661ed3d95fd66a313eb87237597c628e4a0310000225120426b76bd26cef82af8a3d4438700e42f693e3e40231d42810082c883f97f9ca322512052f5ec24681512889f765a3313b746a0e92b01df3f4e48404236906a1ff462fe01227901227901227901227901227901227901227901227901227901227901227901227901227901227960795e797e5d797e5c797e5b797e5a797e59797e58797e57797e56797e55797e54797e53797ea8011279787ea85279017f9f695279009c6301006752796878557952797e8801157955797e54798b7e6b6d6d6d6d6d6d6d6d6c775579ad011479011479011479011479011479011479011479011479011479011479012a790125795b795b795b795b795b795b790056766b796c756e7e777755766b796c756e7e777754766b796c756e7e777753766b796c756e7e777752766b796c756e7e777751766b796c756e7e7b756b6d6d6d6c77a852798855796e760087630100776876030000007e527987777777695479537978760087630100776876030000007e527987777777695b795b795b795b795b795b79565c797600a26976569f69948c766b796c756b6d6d6d6c547954797e886d6d6d6d6d6d5a795a795a795a795a795a790124795679567956795679567956790056766b796c756e827752797e7e777755766b796c756e827752797e7e777754766b796c756e827752797e7e777753766b796c756e827752797e7e777752766b796c756e827752797e7e777751766b796c756e827752797e7e7b756b6d6d6d6c77a878886d6d6d75016c79016c79016c79016c79016c79016c7901747901747978827701149d6e7ea9777701487901487901487901487901487901487956007600a26976569f69948c766b796c756b6d6d6d6c0115795879066a1863617401787e77527988577957795779577957795d79007657766b796c75a97e7d7756766b796c75a97e7d7755766b796c75a97e7d7754766b796c75a97e7d7753766b796c75a97e7d77a95279876b6d6d6d6c77695279587958795879587958795557798c7600a26976559f69948c766b796c756b6d6d756c886d6d6d6d755a5f797600a26976569f6994766b796c755d790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790153790132790131790131790131790131790131790131790131790131790131790131790131790131790131790131790131790131790131790131790131790131790131790131790131790131790131790116790116797e7601167901167901167901167901167901167955766b796c756b6d6d6d6c7e7d7701167901167901167901167901167901167954766b796c756b6d6d6d6c7e7d7701167901167901167901167901167901167953766b796c756b6d6d6d6c7e7d7701167901167901167901167901167901167952766b796c756b6d6d6d6c7e7d7701167901167901167901167901167901167951766b796c756b6d6d6d6c7e7d7701167901167901167901167901167901167900766b796c756b6d6d6d6c7e7d775f797e775f795f79885d795d795d795d795d795d7955766b796c756b6d6d6d6c58795879587958795879587955766b796c756b6d6d6d6c768277000113799f637052797e53797e7e547a7572537a537975686d755d795d795d795d795d795d7954766b796c756b6d6d6d6c58795879587958795879587954766b796c756b6d6d6d6c768277510113799f637052797e53797e7e547a7572537a537975686d755d795d795d795d795d795d7953766b796c756b6d6d6d6c58795879587958795879587953766b796c756b6d6d6d6c768277520113799f637052797e53797e7e547a7572537a537975686d755d795d795d795d795d795d7952766b796c756b6d6d6d6c58795879587958795879587952766b796c756b6d6d6d6c768277530113799f637052797e53797e7e547a7572537a537975686d755d795d795d795d795d795d7951766b796c756b6d6d6d6c58795879587958795879587951766b796c756b6d6d6d6c768277540113799f637052797e53797e7e547a7572537a537975686d755d795d795d795d795d795d7900766b796c756b6d6d6d6c58795879587958795879587900766b796c756b6d6d6d6c768277550113799f637052797e53797e7e547a7572537a537975686d787752797eaa6b6d6d6d6d6d6d6d6d6d6d6d6d6c88011979011979011979011979707e01007e787e6b6d6d6c012f79012f79012f79012f79012f79012f7956011d797600a26976569f69948c766b796c756b6d6d6d6c8801177901197978760087630100776876030000007e52798777777769011479011479011479011479011479011479011479011479011479011479011479011479011479011479011479011479011479011479011479007601147901147901147901147953766b796c756b6d6d6c7e7d7701147901147901147901147952766b796c756b6d6d6c7e7d7701147901147901147901147951766b796c756b6d6d6c7e7d7701147901147901147901147900766b796c756b6d6d6c7e775f795f79885d795d795d795d795d795d7955766b796c756b6d6d6d6c58795879587958795879587955766b796c756b6d6d6d6c768277000113799f637052797e53797e7e547a7572537a537975686d755d795d795d795d795d795d7954766b796c756b6d6d6d6c58795879587958795879587954766b796c756b6d6d6d6c768277510113799f637052797e53797e7e547a7572537a537975686d755d795d795d795d795d795d7953766b796c756b6d6d6d6c58795879587958795879587953766b796c756b6d6d6d6c768277520113799f637052797e53797e7e547a7572537a537975686d755d795d795d795d795d795d7952766b796c756b6d6d6d6c58795879587958795879587952766b796c756b6d6d6d6c768277530113799f637052797e53797e7e547a7572537a537975686d755d795d795d795d795d795d7951766b796c756b6d6d6d6c58795879587958795879587951766b796c756b6d6d6d6c768277540113799f637052797e53797e7e547a7572537a537975686d755d795d795d795d795d795d7900766b796c756b6d6d6d6c58795879587958795879587900766b796c756b6d6d6d6c768277550113799f637052797e53797e7e547a7572537a537975686d787752797eaa6b6d6d6d6d6d6d6d6d6d6d6c011a798858795879587958795879587956011e797600a26976569f69948c766b796c756b6d6d6d6c7653798778537987786476675168696d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d750167790167790167790167790167790167790167790167790167790167790167790167790167790167790167790167790167790167790167790167790167790115790285007902850079012779012e79012e79012e79012e79012e79012e79012a79012a79012a79012a79012a79012a7901167901167901167901167901167901167901167956797657795779577957795779577955766b796c756b6d6d6d6c7e7d7757795779577957795779577954766b796c756b6d6d6d6c7e7d7757795779577957795779577953766b796c756b6d6d6d6c7e7d7757795779577957795779577952766b796c756b6d6d6d6c7e7d7757795779577957795779577951766b796c756b6d6d6d6c7e7d7757795779577957795779577900766b796c756b6d6d6d6c7e7d77a96b6d6d6d6d6c01177901117988765178a978557894000052799f637600a97e77685152799f637600a97e77685252799f637600a97e77685352799f637600a97e77685452799f637600a97e776877777ea9066a1863617401787e777777011f79011f79011f79011f7954007600a26976549f69948c766b796c756b6d6d6c885e7900a069011679011679011679011679011679011679560114797600a26976569f69948c766b796c756b6d6d6d6c5f799d0125790125790125790125790125790125790125790125790125790125790125790125795a795a798800597959795979597953766b796c756b6d6d6c567956795679567953766b796c756b6d6d6c768277005f799f637052797e53797e7e547a7572537a537975686d75597959795979597952766b796c756b6d6d6c567956795679567952766b796c756b6d6d6c768277515f799f637052797e53797e7e547a7572537a537975686d75597959795979597951766b796c756b6d6d6c567956795679567951766b796c756b6d6d6c768277525f799f637052797e53797e7e547a7572537a537975686d75597959795979597900766b796c756b6d6d6c567956795679567900766b796c756b6d6d6c768277535f799f637052797e53797e7e547a7572537a537975686d755c79787e52797eaa6b6d6d6d6d6d6d6c775d011b797600a26976569f6994766b796c7578011b797e8857011b797600a26976569f6994766b796c75012979886d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d75017479630173790173797ea901707988017179017379ad67016f795c0172797600a26976569f6994766b796c75a988686d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d7551",
"control_block": "c150929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0",
"leaf_version": 192,
"total_fee": 5960
},
"req_id": "1846823544388632576"
}
Then pass it to:
POST
/brc20swap/create_deposit_cat20_order_by_psbt
curl 'https://test-api-proxy.ddpurse.com/brc20swap/create_deposit_cat20_order_by_psbt' \
-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://test-fe.ddpurse.com:17510' \
-H 'Pragma: no-cache' \
-H 'Referer: http://test-fe.ddpurse.com:17510/' \
-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/128.0.0.0 Safari/537.36' \
-H 'Wallet-Name: unisat' \
-H 'Wallet-Ver: 1.4.10' \
-H 'sec-ch-ua: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
--data-raw '{"psbts":["cHNidP8BAIkCAAAAAegkU6zVAAxsviXSWb6mGNOwHVX2AySEAeJFIfkJ7p+MAwAAAAD/////AvQXAAAAAAAAIlEgSM43BI0CB2ZroXP/AzzdLmLaWCgelm6gcQ/tCwai8ZtSAwAAAAAAACJRIEjONwSNAgdma6Fz/wM83S5i2lgoHpZuoHEP7QsGovGbAAAAAAABASt7HAAAAAAAACJRIEjONwSNAgdma6Fz/wM83S5i2lgoHpZuoHEP7QsGovGbAQMEAQAAAAETQZaCmTEOtBd/Cl1EuujuEAWBmuN5AqGTmPmmSYZNe3usDmlXSRdEPtH8V87uS/TUz8CBAnLgMosgISnxQkBmxn4BARcgNGNKHQf2kSNRdUDsHVZfvZt3db6suTtBp5NzdKBt1oUAAAA=","cHNidP8BAKwCAAAAAUqbMl+TYPsV5aYyVFD7PKL43N0FRJRcX78XlAwdDK5VAAAAAAD/////AwAAAAAAAAAAGmoYY2F0AV5GtuJo1v+Z6hRLWgEoM5DiojMFSgEAAAAAAAAiUSBS9ewkaBUSiJ92WjMTt0ag6SsB3z9OSEBCNpBqH/Ri/i8VAAAAAAAAIlEgSM43BI0CB2ZroXP/AzzdLmLaWCgelm6gcQ/tCwai8ZsAAAAAAAEBK/QXAAAAAAAAIlEgSM43BI0CB2ZroXP/AzzdLmLaWCgelm6gcQ/tCwai8ZsBAwQBAAAAARNBoICjG8nV1t8da+n83HGtEO3xk4cnIAirZBln/t9mDNXepHXiujNnNXA1bQn4fBg4jQeKmaXFX2TH4rI3IDb4kwEBFyA0Y0odB/aRI1F1QOwdVl+9m3d1vqy5O0Gnk3N0oG3WhQAAAAA=","cHNidP8BAP3+AAIAAAADikqyRJ6tJk5SmiEqX/3nY2BhChnauKHQ0UkoXLnrhtoCAAAAAP////+1ggF3lm3F1+JADE/xRk/De5q9TWSvQTUYTLKXYEZHxwEAAAAA/////7WCAXeWbcXX4kAMT/FGT8N7mr1NZK9BNRhMspdgRkfHAgAAAAD/////AwAAAAAAAAAAGmoYY2F0AeSBe1SBu0pvZj53gpEYH++zs5EESgEAAAAAAAAiUSD9rTsMZjiKUIxxq1cUOuIpkwGs+Nq8HWye7YOZOSuma0oBAAAAAAAAIlEg/a07DGY4ilCMcatXFDriKZMBrPjavB1snu2DmTkrpmsAAAAAAAEBK0oBAAAAAAAAIlEg/a07DGY4ilCMcatXFDriKZMBrPjavB1snu2DmTkrpmtBFEjONwSNAgdma6Fz/wM83S5i2lgoHpZuoHEP7QsGovGby6SJBcQCwCipW+YP47b/fFlQIBXjCBM3xmXGG/TxzCJAqj5aMt65ZWQPidWrYZhmySZ7VuBkRJcnx7NO3P4JleCgZ4Ru8KG8sYVkCyA/m0jazO6+EbiZHrOUqvnEiT+kogABAStKAQAAAAAAACJRIFL17CRoFRKIn3ZaMxO3RqDpKwHfP05IQEI2kGof9GL+AAEBKy8VAAAAAAAAIlEgSM43BI0CB2ZroXP/AzzdLmLaWCgelm6gcQ/tCwai8ZsBE0CsvQw/OqO9posXId0RAw44CnenYwBRHCRF7IMK+1zkBmM1zEKuPecRGJqn13C0+SH10QiJ+iJgZ6H518729g6pARcgNGNKHQf2kSNRdUDsHVZfvZt3db6suTtBp5NzdKBt1oUAAAAA"],"tick":"loadrun5:e57683b12e71734a1877bb3d52e0f78aaf99344ee59c82308252a64185dd473e_0","pubkey":"0334634a1d07f69123517540ec1d565fbd9b7775beacb93b41a7937374a06dd685","payer_btc_addr":"bc1pfr8rwpydqgrkv6apw0lsx0xa9e3d5kpgr6txagr3plkskp4z7xdsfqaqrs","payer_ord_addr":"bc1pfr8rwpydqgrkv6apw0lsx0xa9e3d5kpgr6txagr3plkskp4z7xdsfqaqrs","amount":"1","fee_rate":2,"coin_type":"cat20"}'
V1 Liquidity Adding
Works when you already have V1 balance (FB/BTC and CAT20). Example:
curl --location --request POST 'https://test-api-proxy.ddpurse.com/brc20swap/add_liquid' \
--header 'Pragma: no-cache' \
--header 'Wallet-Name: unisat' \
--header 'Wallet-Ver: 1.4.10' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'Content-Type: application/json' \
--header 'Accept: */*' \
--header 'Host: test-api-proxy.ddpurse.com' \
--header 'Connection: keep-alive' \
--data-raw '{
"from_tick": "cat:ab308772bc00db30409bca72cec67bc708ea075455f4665fcfc91af03f52db87_0",
"from_amount": "1",
"to_amount": "5412597",
"to_tick": "FB",
"from_coin_type": "cat20",
"to_coin_type": "fractal",
"address": "bc1pfr8rwpydqgrkv6apw0lsx0xa9e3d5kpgr6txagr3plkskp4z7xdsfqaqrs",
"sig_info": {
"address": "bc1pfr8rwpydqgrkv6apw0lsx0xa9e3d5kpgr6txagr3plkskp4z7xdsfqaqrs",
"public_key": "0334634a1d07f69123517540ec1d565fbd9b7775beacb93b41a7937374a06dd685",
"sign_info": "Address: bc1pfr8rwpydqgrkv6apw0lsx0xa9e3d5kpgr6txagr3plkskp4z7xdsfqaqrs\n\n Add 1cat:ab308772bc00db30409bca72cec67bc708ea075455f4665fcfc91af03f52db87_0, 0.05412597 FB (estimated, actual amount may vary)into cat:ab308772bc00db30409bca72cec67bc708ea075455f4665fcfc91af03f52db87_0/ FB pool, estimated pool shares 50%, service fee income rate 0%(it will be added into the pool automatically)\n \nTime: 2024-10-17 15:42:53\n\n Timestamp: 1729150973",
"signature": "H9PStfpgo9hIaBWKmkhYGliLk6LV1SuCiCacTFFIxEB4Lw5uArHGzsmWIpu8yZNYN/LCRQDDZ0K6YGrUZ2vTjvo="
}
}'
Last updated