Add Liq

Please note that access to this API requires the API key to have brc20-swap permissions enabled.

quote swap

GEThttps://open-api.unisat.io/v1/brc20-swap/quote_swap
Query parameters
Response

Default Response

Body
code*number
msg*string
data*object
Request
const response = await fetch('https://open-api.unisat.io/v1/brc20-swap/quote_swap', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "code": 0,
  "msg": "text",
  "data": {
    "amountUSD": "text",
    "expectUSD": "text",
    "expect": "text"
  }
}

/add_liq interface pre-load, get the signature content, gas and byte information.

GEThttps://open-api.unisat.io/v1/brc20-swap/pre_add_liq
Query parameters
Response

Default Response

Body
code*number
msg*string
data*object
Request
const response = await fetch('https://open-api.unisat.io/v1/brc20-swap/pre_add_liq', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "code": 0,
  "msg": "text",
  "data": {
    "signMsg": "text",
    "bytesL1": 0,
    "bytesL2": 0,
    "feeRate": "text",
    "gasPrice": "text",
    "serviceFeeL1": "text",
    "serviceFeeL2": "text",
    "unitUsdPriceL1": "text",
    "unitUsdPriceL2": "text",
    "serviceTickBalance": "text"
  }
}

Add the liquidity operation.

POSThttps://open-api.unisat.io/v1/brc20-swap/add_liq
Body
address*string
tick0*string
tick1*string
amount0*string

Input amount of tick0

amount1*string

Input amount of tick1

lp*string
slippage*string
ts*number

Timestamp (seconds)

sig*string

User signature

Response

Default Response

Body
code*number
msg*string
data*object
Request
const response = await fetch('https://open-api.unisat.io/v1/brc20-swap/add_liq', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "address": "text",
      "tick0": "text",
      "tick1": "text",
      "amount0": "text",
      "amount1": "text",
      "lp": "text",
      "slippage": "text",
      "ts": 0,
      "sig": "text"
    }),
});
const data = await response.json();
Response
{
  "code": 0,
  "msg": "text",
  "data": {
    "id": "text",
    "rollupInscriptionId": "text",
    "address": "text",
    "type": "text",
    "tick0": "text",
    "tick1": "text",
    "amount0": "text",
    "amount1": "text",
    "lp": "text",
    "ts": 0
  }
}

Last updated