BRC20

When selecting the token pair and clicking to add liquidity, if it is a BRC20 token, you need to first request the pre-add/create interface.

Pre-add liquidity

post
/brc20swap/v2/pre_add_liquid
Body
tick1stringRequired
tick2stringRequired
amount_1stringRequired
amount_2stringRequired
tick_1_inscription_idsstring[]Required

Used when recharging BRC20

tick_2_inscription_idsstring[]Required
payer_ord_addrstringRequired
payer_btc_addrstringRequired
payer_pub_keystringRequired
fee_ratestringRequired
slipperstringRequired
Responses
200Success
application/json
post
/brc20swap/v2/pre_add_liquid

Important Notes

  1. The result returned from this interface should be passed as is to the create_add_liquid_psbt interface.

  2. Since liquidity is added based on a ratio and BRC20 needs to be inscribed first, creating BRC20-BRC20 token pair pools is not supported.

  3. For the tick_1_inscription_ids and tick_2_inscription_ids parameters:

    • If coin_type_1 is BRC20, put the BRC20 inscription ID in the tick_1_inscription_ids array and leave tick_2_inscription_ids empty.

    • If coin_type_2 is BRC20, put the BRC20 inscription ID in the tick_2_inscription_ids array and leave tick_1_inscription_ids empty.

    For the same token pair, BRC20-BTC and BTC-BRC20, the same pool is created or added to (e.g., ordi-BTC, BTC-ordi), just using different fields for the parameters.

Build the PSBT for adding BRC20 liquidity

post
/brc20swap/v2/create_add_liquid_psbt
Body
tick1stringRequired
tick2stringRequired
amount_1stringRequired
amount_2stringRequired
slipperstringRequired
tick_1_inscription_idsstring[]Required
tick_2_inscription_idsstring[]Required
payer_ord_addrstringRequired
fee_ratestringRequired
payer_btc_addrstringRequired
payer_pub_keystringRequired
check_sumstringRequired
vinsstring[]Required
Responses
200Success
application/json
post
/brc20swap/v2/create_add_liquid_psbt

Important Notes:

  1. Upon successful pre-add/create request, obtain the unsigned PSBT. Some of the request parameters will be from the pre-add/create request's return result.

  2. Use the same address for both payer_ord_addr and payer_btc_addr.

Add liquidity

post
/brc20swap/v2/add_liquid_by_psbt
Body
psbtstringRequired
tick1stringRequired
tick2stringRequired
amount_1stringRequired
amount_2stringRequired
slipperstringRequired
payer_ord_addrstringRequired
fee_ratestringRequired
payer_btc_addrstringRequired
payer_pub_keystringRequired
check_sumstringOptional
chlstringOptional
coin_type_1stringRequired
coin_type_2stringRequired
tokenstringRequired
Responses
200Success
application/json
post
/brc20swap/v2/add_liquid_by_psbt

Finally, send the signed PSBT. If the response indicates success, the liquidity has been added/created successfully.

Last updated