Swap

quote swap

get
/v1/brc20-swap/quote_swap
Authorizations
Query parameters
addressstringRequired
tickInstringRequired

Input tick

tickOutstringRequired

Output tick

amountstringRequired

The amount of input tick

exactTypestring · enumRequiredExample: exactInPossible values:
Responses
200

Default Response

application/json
get
/v1/brc20-swap/quote_swap
GET /v1/brc20-swap/quote_swap?address=text&tickIn=text&tickOut=text&amount=text&exactType=exactIn HTTP/1.1
Host: open-api.unisat.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

Default Response

{
  "code": 1,
  "msg": "text",
  "data": {
    "amountUSD": "text",
    "expectUSD": "text",
    "expect": "text"
  }
}

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

get
/v1/brc20-swap/pre_swap
Authorizations
Query parameters
addressstringRequired
tickInstringRequired

Input tick

tickOutstringRequired

Output tick

amountInstringRequired

The amount of input tick

amountOutstringRequired

The amount of output tick

slippagestringRequired
exactTypestring · enumRequiredExample: exactInPossible values:
tsnumberRequired
Responses
200

Default Response

application/json
get
/v1/brc20-swap/pre_swap
GET /v1/brc20-swap/pre_swap?address=text&tickIn=text&tickOut=text&amountIn=text&amountOut=text&slippage=text&exactType=exactIn&ts=1 HTTP/1.1
Host: open-api.unisat.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

Default Response

{
  "code": 1,
  "msg": "text",
  "data": {
    "signMsg": "text",
    "bytesL1": 1,
    "bytesL2": 1,
    "feeRate": "text",
    "gasPrice": "text",
    "serviceFeeL1": "text",
    "serviceFeeL2": "text",
    "unitUsdPriceL1": "text",
    "unitUsdPriceL2": "text",
    "serviceTickBalance": "text"
  }
}

The swap operation.

post
/v1/brc20-swap/swap
Authorizations
Body
addressstringRequired
tickInstringRequired

Input tick

tickOutstringRequired

Output tick

amountInstringRequired

The amount of input tick

amountOutstringRequired

The amount of output tick

slippagestringRequired
exactTypestring · enumRequiredPossible values:
tsnumberRequired

Timestamp (seconds)

sigstringRequired

User signature

Responses
200

Default Response

application/json
post
/v1/brc20-swap/swap
POST /v1/brc20-swap/swap HTTP/1.1
Host: open-api.unisat.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 148

{
  "address": "text",
  "tickIn": "text",
  "tickOut": "text",
  "amountIn": "text",
  "amountOut": "text",
  "slippage": "text",
  "exactType": "exactIn",
  "ts": 1,
  "sig": "text"
}
200

Default Response

{
  "code": 1,
  "msg": "text",
  "data": {
    "id": "text",
    "rollupInscriptionId": "text",
    "address": "text",
    "tickIn": "text",
    "tickOut": "text",
    "amountIn": "text",
    "amountOut": "text",
    "exactType": "text",
    "ts": 1
  }
}

Last updated