BRC20 Swap API provides a set of interfaces for BRC20 Swap and PizzaSwap services. It allows users to interact with the BRC20 Swap ecosystem, including balance checks, pool information, liquidity management, and token transfers.
👉 View Swagger UI
Route | Summary |
---|---|
GET /v1/brc20-swap/config | Swap’s global configuration information. |
GET /v1/brc20-swap/balance | Gets the balance for the specified address and tick. |
GET /v1/brc20-swap/pool_info | Get Pool information based on trade pair. |
GET /v1/brc20-swap/select | Select the tick information that you can use based on the address. |
GET /v1/brc20-swap/pre_deploy_pool | Prepare deploy pool operation |
POST /v1/brc20-swap/deploy_pool | Deploy the pool operation. |
GET /v1/brc20-swap/pre_add_liq | Prepare add liquidity operation |
POST /v1/brc20-swap/add_liq | Add the liquidity operation |
GET /v1/brc20-swap/pre_remove_liq | Prepare remove liquidity operation |
POST /v1/brc20-swap/remove_liq | Remove the liquidity operation |
GET /v1/brc20-swap/pre_send | Prepare send operation |
POST /v1/brc20-swap/pre_batch_send | Prepare batch send operation |
GET /v1/brc20-swap/pre_swap | Prepare swap operation |
POST /v1/brc20-swap/send | The send operation. |
POST /v1/brc20-swap/batch_send | The batch send operation. |
POST /v1/brc20-swap/swap | The swap operation. |
GET /v1/brc20-swap/pool_list | Gets the pool list information. |
GET /v1/brc20-swap/my_pool_list | Gets the user’s pool list information. |
GET /v1/brc20-swap/my_pool | Gets the user pool information for the specified pair. |
GET /v1/brc20-swap/overview | An overview of swap information |
GET /v1/brc20-swap/gas_history | Gets the gas consumption records for a user aggregation operation. |
GET /v1/brc20-swap/send_history | Gets the history of send transaction. |
GET /v1/brc20-swap/liq_history | Gets the history of a pair addition pool. |
GET /v1/brc20-swap/swap_history | Gets the history of swap. |
GET /v1/brc20-swap/rollup_history | Get chain history of rollup inscription. |
GET /v1/brc20-swap/deposit_list | Gets the deposit list for a user. |
GET /v1/brc20-swap/create_deposit | Create a deposit psbt to be signed by the user. |
POST /v1/brc20-swap/confirm_deposit | User signature deposit psbt, submit confirmation. |
GET /v1/brc20-swap/system_status | Gets the current system state. |
GET /v1/brc20-swap/withdraw_history | Gets the user withdrawal history. |
GET /v1/brc20-swap/create_retry_withdraw | Retry create a withdraw psbt to be signed by the user. |
POST /v1/brc20-swap/confirm_retry_withdraw | User signature withdraw psbt, submit confirmation. |
GET /v1/brc20-swap/create_withdraw | Create a withdraw psbt to be signed by the user. |
POST /v1/brc20-swap/confirm_withdraw | User signature withdraw psbt, submit confirmation. |
GET /v1/brc20-swap/withdraw_process | Gets the withdrawal progress for the specified ID. |
Method: GET
Path: /v1/brc20-swap/config
Swagger Link: View in Swagger UI
This interface provides the global configuration information for the BRC20 Swap service. It includes details such as the module ID, service gas tick, and pending deposit confirmation numbers.
code
(number):msg
(string):data
(object):
moduleId
(string):serviceGasTick
(string): The tick used for the second layer gas.pendingDepositDirectNum
(number): Number of confirmations required for direct deposit.pendingDepositMatchingNum
(number): Number of confirmations required for matching deposit.Method: GET
Path: /v1/brc20-swap/balance
Swagger Link: View in Swagger UI
This interface retrieves the balance for a specific address and tick in the BRC20 Swap service. It returns the confirmed module balance, swap balance, pending swap balance, and pending available balance.
address
(query) (required):tick
(query) (required):code
(number):msg
(string):data
(object):
balance
(object):
module
(string): Confirmed module balance.swap
(string): Confirmed swap balance.pendingSwap
(string): The balance converted from pending to swap.pendingAvailable
(string): The balance converted from pending to module.decimal
(string):Method: GET
Path: /v1/brc20-swap/pool_info
Swagger Link: View in Swagger UI
This interface retrieves the pool information for a specific trade pair in the BRC20 Swap service. It includes details such as whether the pool exists, if liquidity has been added, tick prices, LP quantity, TVL, volume, and rewards.
tick0
(query) :tick1
(query) :code
(number):msg
(string):data
(object):
existed
(boolean): Is the pool existedaddLiq
(boolean): Has LP been added to the pooltick0
(string):tick1
(string):lp
(string): Quantity of pool lptvl
(string):volume24h
(string):volume7d
(string):reward0
(string):reward1
(string):Method: GET
Path: /v1/brc20-swap/select
Swagger Link: View in Swagger UI
This interface retrieves the tick information that can be used for swapping based on the provided address. It returns the tick, decimal, BRC20 balance, and swap balance for each available tick.
address
(query) (required):search
(query) : Fuzzy matchingcode
(number):msg
(string):data
(array):
tick
(string):decimal
(string):brc20Balance
(string): Module balance (not participate in swap calculations)swapBalance
(string): Swap balanceMethod: GET
Path: /v1/brc20-swap/pre_deploy_pool
Swagger Link: View in Swagger UI
This interface pre-loads the /deploy_pool operation, providing the signature content, gas, and byte information required for deploying a pool in the BRC20 Swap service.
address
(query) (required):tick0
(query) (required):tick1
(query) (required):ts
(query) (required): Timestamp (seconds)feeTick
(query) (required): Tick used as feepayType
(query) : Pay Type: tick, freeQuotacode
(number):msg
(string):data
(object):
ids
(array):
signMsgs
(array):
feeAmount
(string): The fee that the user needs to payfeeTickPrice
(string): The price of fee tickfeeBalance
(string): The user’s fee tick balanceusdPrice
(string): The dollar value of the feeMethod: POST
Path: /v1/brc20-swap/deploy_pool
Swagger Link: View in Swagger UI
This interface deploys a pool in the BRC20 Swap service. It requires the address, tick0, tick1, timestamp, fee tick, and user signatures to complete the operation.
code
(number):msg
(string):data
(object):Method: GET
Path: /v1/brc20-swap/pre_add_liq
Swagger Link: View in Swagger UI
This interface pre-loads the /add_liq operation, providing the signature content, gas, and byte information required for adding liquidity in the BRC20 Swap service.
address
(query) (required):tick0
(query) (required):tick1
(query) (required):amount0
(query) (required): Input amount of tick0amount1
(query) (required): Input amount of tick1lp
(query) (required): Expect amount of lpslippage
(query) (required):ts
(query) (required): Timestamp (seconds)feeTick
(query) (required): Tick used as feepayType
(query) : Pay Type: tick, freeQuotacode
(number):msg
(string):data
(object):
ids
(array):
signMsgs
(array):
feeAmount
(string): The fee that the user needs to payfeeTickPrice
(string): The price of fee tickfeeBalance
(string): The user’s fee tick balanceMethod: POST
Path: /v1/brc20-swap/add_liq
Swagger Link: View in Swagger UI
This interface adds liquidity to a pool in the BRC20 Swap service. It requires the address, tick0, tick1, amounts, LP, slippage, timestamp, fee tick, and user signatures to complete the operation.
code
(number):msg
(string):data
(object):
id
(string): Function idrollupInscriptionId
(string): The rollup inscription id where the function is locatedaddress
(string):type
(string):tick0
(string):tick1
(string):amount0
(string): Input amount of tick0amount1
(string): Input amount of tick1lp
(string):ts
(number):Method: GET
Path: /v1/brc20-swap/pre_remove_liq
Swagger Link: View in Swagger UI
This interface pre-loads the /remove_liq operation, providing the signature content, gas, and byte information required for removing liquidity in the BRC20 Swap service.
address
(query) (required):tick0
(query) (required):tick1
(query) (required):amount0
(query) (required): Input amount of tick0amount1
(query) (required): Input amount of tick1lp
(query) (required):slippage
(query) (required):ts
(query) (required):feeTick
(query) (required): Tick used as feepayType
(query) : Pay Type: tick, freeQuotacode
(number):msg
(string):data
(object):
ids
(array):
signMsgs
(array):
feeAmount
(string): The fee that the user needs to payfeeTickPrice
(string): The price of fee tickfeeBalance
(string): The user’s fee tick balanceusdPrice
(string): The dollar value of the feeMethod: POST
Path: /v1/brc20-swap/remove_liq
Swagger Link: View in Swagger UI
This interface removes liquidity from a pool in the BRC20 Swap service. It requires the address, tick0, tick1, amounts, LP, slippage, timestamp, fee tick, and user signatures to complete the operation.
code
(number):msg
(string):data
(object):
id
(string): Function idrollupInscriptionId
(string): The rollup inscription id where the function is locatedaddress
(string):type
(string):tick0
(string):tick1
(string):amount0
(string): Input amount of tick0amount1
(string): Input amount of tick1lp
(string):ts
(number):Method: GET
Path: /v1/brc20-swap/pre_send
Swagger Link: View in Swagger UI
This interface pre-loads the /send operation, providing the signature content, gas, and byte information required for sending a tick in the BRC20 Swap service.
address
(query) (required):tick
(query) (required): Send tickamount
(query) (required): The amount of send tickto
(query) (required): The receiver of send tickts
(query) (required): Timestamp (seconds)feeTick
(query) (required): Tick used as feepayType
(query) : Pay Type: tick, freeQuotacode
(number):msg
(string):data
(object):
ids
(array):
signMsgs
(array):
feeAmount
(string): The fee that the user needs to payfeeTickPrice
(string): The price of fee tickfeeBalance
(string): The user’s fee tick balanceusdPrice
(string): The dollar value of the feeMethod: POST
Path: /v1/brc20-swap/pre_batch_send
Swagger Link: View in Swagger UI
This interface pre-loads the /batch_send operation, providing the signature content, gas, and byte information required for sending multiple ticks in the BRC20 Swap service.
code
(number):msg
(string):data
(object):
ids
(array):
signMsgs
(array):
feeAmount
(string): The fee that the user needs to payfeeTickPrice
(string): The price of fee tickfeeBalance
(string): The user’s fee tick balanceusdPrice
(string): The dollar value of the feeMethod: GET
Path: /v1/brc20-swap/pre_swap
Swagger Link: View in Swagger UI
This interface pre-loads the /swap operation, providing the signature content, gas, and byte information required for swapping ticks in the BRC20 Swap service.
address
(query) (required):tickIn
(query) (required): Input ticktickOut
(query) (required): Output tickamountIn
(query) (required): The amount of input tickamountOut
(query) (required): The amount of output tickslippage
(query) (required):exactType
(query) (required):ts
(query) (required): Timestamp(seconds)feeTick
(query) (required): Tick used as feepayType
(query) : Pay Type: tick, freeQuotacode
(number):msg
(string):data
(object):
ids
(array):
signMsgs
(array):
feeAmount
(string): The fee that the user needs to payfeeTickPrice
(string): The price of fee tickfeeBalance
(string): The user’s fee tick balanceusdPrice
(string): The dollar value of the feeMethod: POST
Path: /v1/brc20-swap/send
Swagger Link: View in Swagger UI
This interface sends a tick in the BRC20 Swap service. It requires the address, tick, amount, receiver, timestamp, fee tick, and user signatures to complete the operation.
code
(number):msg
(string):data
(object):Method: POST
Path: /v1/brc20-swap/batch_send
Swagger Link: View in Swagger UI
This interface sends multiple ticks in the BRC20 Swap service. It requires the address, tick, amount, receivers, timestamp, fee tick, and user signatures to complete the operation.
code
(number):msg
(string):data
(object):Method: POST
Path: /v1/brc20-swap/swap
Swagger Link: View in Swagger UI
This interface swaps ticks in the BRC20 Swap service. It requires the address, input tick, output tick, input amount, output amount, slippage, exact type, timestamp, fee tick, and user signatures to complete the operation.
code
(number):msg
(string):data
(object):
id
(string): Function idrollupInscriptionId
(string): The rollup inscription id where the function is locatedaddress
(string):tickIn
(string):tickOut
(string):amountIn
(string):amountOut
(string):exactType
(string):ts
(number):Method: GET
Path: /v1/brc20-swap/pool_list
Swagger Link: View in Swagger UI
This interface retrieves the pool list information in the BRC20 Swap service. It supports filtering by address, tick, and fuzzy matching, and allows pagination through start and limit parameters.
search
(query) : Fuzzy matchingstart
(query) (required):limit
(query) (required):code
(number):msg
(string):data
(object):
total
(number):list
(array):
tick0
(string):tick1
(string):lp
(string):tvl
(string): Total pool valuevolume24h
(string):volume7d
(string):Method: GET
Path: /v1/brc20-swap/my_pool_list
Swagger Link: View in Swagger UI
This interface retrieves the user’s pool list information in the BRC20 Swap service. It supports filtering by address, tick, and pagination through start and limit parameters.
address
(query) (required):tick
(query) :start
(query) (required):limit
(query) (required):code
(number):msg
(string):data
(object):
total
(number):list
(array):
lp
(string):shareOfPool
(string):tick0
(string):tick1
(string):amount0
(string): Amount of tick0amount1
(string): Amount of tick1claimedReward0
(string):claimedReward1
(string):unclaimedReward0
(string):unclaimedReward1
(string):Method: GET
Path: /v1/brc20-swap/my_pool
Swagger Link: View in Swagger UI
This interface retrieves the user pool information for a specific pair in the BRC20 Swap service. It requires the address, tick0, and tick1 parameters to identify the pool.
address
(query) (required):tick0
(query) (required):tick1
(query) (required):code
(number):msg
(string):data
(object):
lp
(string):shareOfPool
(string):tick0
(string):tick1
(string):amount0
(string): Amount of tick0amount1
(string): Amount of tick1Method: GET
Path: /v1/brc20-swap/overview
Swagger Link: View in Swagger UI
This interface provides an overview of the swap information in the BRC20 Swap service, including total liquidity, 7-day volume, 24-hour volume, number of transactions, and number of pairs.
code
(number):msg
(string):data
(object):
liquidity
(string): Total value of all poolsvolume7d
(string): 7 days volumevolume24h
(string): 24 hours volumetransactions
(number): Number of transactions in 24 hourspairs
(number):Method: GET
Path: /v1/brc20-swap/gas_history
Swagger Link: View in Swagger UI
This interface retrieves the gas consumption records for a user aggregation operation in the BRC20 Swap service. It supports filtering by address and pagination through start and limit parameters.
address
(query) :start
(query) (required):limit
(query) (required):code
(number):msg
(string):data
(object):
total
(number):list
(array):
funcType
(string): Function type (example: swap
)tickA
(string):tickB
(string):gas
(string):ts
(number):Method: GET
Path: /v1/brc20-swap/send_history
Swagger Link: View in Swagger UI
This interface retrieves the history of send transactions in the BRC20 Swap service. It supports filtering by address, tick, and pagination through start and limit parameters.
address
(query) :tick
(query) :start
(query) (required):limit
(query) (required):code
(number):msg
(string):data
(object):
total
(number):list
(array):
tick
(string):amount
(string):to
(string):ts
(number):Method: GET
Path: /v1/brc20-swap/liq_history
Swagger Link: View in Swagger UI
This interface retrieves the history of pair addition pools in the BRC20 Swap service. It supports filtering by address, tick, type (add or remove), and pagination through start and limit parameters.
address
(query) :tick
(query) :type
(query) : Optional: add, removestart
(query) (required):limit
(query) (required):code
(number):msg
(string):data
(object):
total
(number):list
(array):
type
(string):tick0
(string):tick1
(string):amount0
(string):amount1
(string):lp
(string):ts
(number):Method: GET
Path: /v1/brc20-swap/swap_history
Swagger Link: View in Swagger UI
This interface retrieves the history of swap transactions in the BRC20 Swap service. It supports filtering by address, tick, and pagination through start and limit parameters.
address
(query) :tick
(query) :start
(query) (required):limit
(query) (required):code
(number):msg
(string):data
(object):
total
(number):list
(array):
tickIn
(string): Input ticktickOut
(string): Output tickamountIn
(string): The amount of input tickamountOut
(string): The amount of output tickexactType
(string):ts
(number):Method: GET
Path: /v1/brc20-swap/rollup_history
Swagger Link: View in Swagger UI
This interface retrieves the chain history of rollup inscriptions in the BRC20 Swap service. It supports filtering by inscription ID and pagination through start and limit parameters.
start
(query) (required):limit
(query) (required):code
(number):msg
(string):data
(object):
total
(number):list
(array):
txid
(string):height
(number):transactionNum
(number): Number of transactions in the inscriptioninscriptionId
(string): Rollup inscription idinscriptionNumber
(number): Rollup inscription numberts
(number):Method: GET
Path: /v1/brc20-swap/deposit_list
Swagger Link: View in Swagger UI
This interface retrieves the deposit list for a user in the BRC20 Swap service. It supports filtering by address, tick, and pagination through start and limit parameters.
address
(query) (required):tick
(query) :start
(query) (required):limit
(query) (required):code
(number):msg
(string):data
(object):
total
(number):list
(array):
tick
(string):amount
(string):cur
(number): Current number of confirmationssum
(number): Total number of confirmationsts
(number):txid
(string):type
(string):Method: GET
Path: /v1/brc20-swap/create_deposit
Swagger Link: View in Swagger UI
This interface creates a deposit PSBT to be signed by the user in the BRC20 Swap service. It requires the inscription ID, public key, and address parameters to generate the PSBT.
inscriptionId
(query) (required):pubkey
(query) (required):address
(query) (required):code
(number):msg
(string):data
(object):
psbt
(string):type
(string): Direct or matchingexpiredTimestamp
(number):recommendDeposit
(string):Method: POST
Path: /v1/brc20-swap/confirm_deposit
Swagger Link: View in Swagger UI
This interface allows the user to sign the deposit PSBT and submit the confirmation in the BRC20 Swap service. It requires the PSBT and inscription ID to complete the operation.
code
(number):msg
(string):data
(object):Method: GET
Path: /v1/brc20-swap/system_status
Swagger Link: View in Swagger UI
This interface retrieves the current system state of the BRC20 Swap service, including whether rollup inscription committing is enabled.
code
(number):msg
(string):data
(object):
committing
(boolean): Is rollup inscription committingMethod: GET
Path: /v1/brc20-swap/withdraw_history
Swagger Link: View in Swagger UI
This interface retrieves the user withdrawal history in the BRC20 Swap service. It supports filtering by address, pagination through start and limit parameters, and an optional tick parameter.
address
(query) (required):start
(query) (required):limit
(query) (required):tick
(query) :code
(number):msg
(string):data
(object):
total
(number):list
(array):
id
(string):tick
(string):totalAmount
(string): Total amount withdrawalcompletedAmount
(string): The number of withdrawal completedts
(number):totalConfirmedNum
(number): The current number of confirmationstotalNum
(number): The total number of confirmationsstatus
(string):type
(string):Method: GET
Path: /v1/brc20-swap/create_retry_withdraw
Swagger Link: View in Swagger UI
This interface retries to create a withdrawal PSBT to be signed by the user in the BRC20 Swap service. It requires the withdrawal order ID, public key, and address parameters to generate the PSBT.
id
(query) (required):pubkey
(query) (required):address
(query) (required):code
(number):msg
(string):data
(object):
paymentPsbt
(string): The user psbt with paymentapprovePsbt
(string): The user psbt with approve insctiptionnetworkFee
(number):Method: POST
Path: /v1/brc20-swap/confirm_retry_withdraw
Swagger Link: View in Swagger UI
This interface allows the user to sign the retry withdrawal PSBT and submit the confirmation in the BRC20 Swap service. It requires the withdrawal order ID, payment PSBT, and approve PSBT to complete the operation.
code
(number):msg
(string):data
(object):Method: GET
Path: /v1/brc20-swap/create_withdraw
Swagger Link: View in Swagger UI
This interface creates a withdrawal PSBT to be signed by the user in the BRC20 Swap service. It requires the public key, address, tick, amount, timestamp, and fee tick parameters to generate the PSBT.
pubkey
(query) (required):address
(query) (required):tick
(query) (required):amount
(query) (required):ts
(query) (required):feeTick
(query) (required):code
(number):msg
(string):data
(object):Method: POST
Path: /v1/brc20-swap/confirm_withdraw
Swagger Link: View in Swagger UI
This interface allows the user to sign the withdrawal PSBT and submit the confirmation in the BRC20 Swap service. It requires the withdrawal order ID, payment PSBT, approve PSBT, fee tick, and optional fee amount to complete the operation.
code
(number):msg
(string):data
(object):Method: GET
Path: /v1/brc20-swap/withdraw_process
Swagger Link: View in Swagger UI
This interface retrieves the withdrawal progress for a specific ID in the BRC20 Swap service. It requires the ID parameter to identify the withdrawal order.
id
(query) (required):code
(number):msg
(string):data
(object):
id
(string):tick
(string):amount
(string):ts
(number):status
(string):totalConfirmedNum
(number):totalNum
(number): Total number of confirmations (rollUp + approve)rollUpConfirmNum
(number):rollUpTotalNum
(number): Total number of rollUp confirmationsapproveConfirmNum
(number):approveTotalNum
(number): Total number of approve confirmationscancelConfirmedNum
(number):cancelTotalNum
(number):rollUpTxid
(string): Decrease operation is required to withdraw, which in rollup inscriptionpaymentTxid
(string):inscribeTxid
(string):approveTxid
(string):completedAmount
(string):matchHistory
(array):
approveInscriptionId
(string): Withdraw inscriptiontransferInscriptionId
(string): Deposit inscriptiontick
(string):consumeAmount
(string):remainAmount
(string): Residual cash withdrawalapproveAddress
(string): Withdraw user addresstransferAddress
(string): Deposit user addresstxid
(string): Matching txidts
(number):