UTXOSwap
WebsiteTwitterTelegram
  • 🐦UTXOSwap 轻皮书:定义 Bitcoin Finance 交易新范式
  • 👨‍💻用户交互教程
    • 💎连接钱包
    • 🔁交换代币
    • ➕添加流动性
    • 💰创建资金池
    • ⛽如何将一层的 RGB++ 资产 Leap 到二层
  • 🗺️路线图
  • ❓常见问题解答
  • 🍟加入社群
  • 开发者文档
    • 🌊Liquidity Provider Token 介绍与解析
    • ⛽获取资金池和代币价格信息
    • 🎨UTXOSwap SDK
      • 🥤SDK 快速入门
      • 💱交易
      • ⛲创建资金池
  • language
    • English
Powered by GitBook
On this page
  1. 开发者文档

获取资金池和代币价格信息

API URL: [POST] https://utxoswap.xyz/utxo-swap/api/v1/sequencer/pools

Header:

x-api-key: UTXOSwap SDK Key

获取 apiKey:您可以通过联系 developer@utxoswap.xyz 来免费获取一个 apiKey,这是访问 UTXOSwap 后端服务的必需条件。

Input params

Parameters
Type
isRequired
Details

pageNo

number

true

返回分页数量

pageSize

number

true

单页返回数量

searchKey

string

false

代币的 typehash,查询此代币相关的资金池

sort

Enum

false

返回数据的排序方式: "aes"/"desc”

orderBy

Enum

false

排序字段: "tvl"/"dayTxsCount"/"dayVolume"/"dayApr”

poolTypeHashes

array

false

资金池的 typehash,查询指定资金池

Response

Parameters
Type
Details

code

number

code 0, success

message

string

message success

data

object

output data

  • output data

    Parameters
    Type
    Details

    totalCount

    number

    查询资金池列表总数

    list

    PoolList[]

    资金池列表

    • PoolList[]

      Parameters
      Type
      Details

      feeRate

      number

      资金池费率

      batchId

      number

      资金池交易队列的 nonce

      assetX

      TokenAsset[]

      资金池中 tokenX 对象

      assetY

      TokenAsset[]

      资金池中 tokenY 对象

      basedAsset

      Enum

      基础代币(目前将 CKB,BTC 作为基础代币) 0: tokenX 是基础代币 1: tokenY 是基础代币

      totalLpSupply

      string

      总 LP 代币数量

      protocolLpAmount

      string

      协议中的 LP 代币数量

      typeHash

      string

      资金池的 typehash

      tvl

      string

      当前 TVL

      tvlChangeRate

      string

      24H TVL 变化

      dayTxsCount

      string

      24H 交易笔数

      dayVolume

      string

      24H 交易量

      dayVolumeChangeRate

      string

      24H 交易量变化

      dayApr

      string

      资金池年化利率

      dayFees

      string

      24H 手续费

      • TokenAsset[]

        Parameters
        Type
        Details

        logo

        number

        -

        decimals

        string

        -

        name

        string

        -

        symbol

        symbol

        -

        typeHash

        string

        -

        typeScript

        TypeScript[]

        -

        typeCellDep

        TypeCellDep[]

        -

        isWhiteList

        boolean

        是否是认证的 token

        reserve

        string

        token 在资金池中的数量

        price

        string

        token 最新的 USD 价格

      • TypeScript[]

        Parameters
        Type
        Details

        args

        string

        -

        codeHash

        string

        -

        hashType

        string

        -

      • TypeCellDep[]

        Parameters
        Type
        Details

        outPoint

        OutPoint[]

        -

        depType

        string

        -

      • OutPoint[]

        Parameters
        Type
        Details

        txHash

        number

        -

        index

        string

        -

示例

查询所有资金池

// query all pools
curl --location 'https://utxoswap.xyz/utxo-swap/api/v1/sequencer/pools' \
--header 'x-api-key: {your api key}' \
--header 'Content-Type: application/json' \
--data '{
    "pageNo": 0,
    "pageSize": 10
}'

// response
{
    "code": 0,
    "message": "success",
    "data": {
        "totalCount": 36,
        "list": [
            {
                "feeRate": 30,
                "batchId": 330,
                "assetX": {
                    "logo": "https://storage.utxoswap.xyz/images/ckb.png",
                    "decimals": 8,
                    "name": "CKB",
                    "symbol": "CKB",
                    "typeHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
                    "typeScript": null,
                    "typeCellDep": null,
                    "isWhiteList": true,
                    "reserve": "1449661376047291",
                    "price": "0.0141799561893442" // token price
                },
                "assetY": {
                    "logo": "https://xudtlogos.cc/logos/rusd-logo.png",
                    "decimals": 8,
                    "name": "RUSD",
                    "symbol": "RUSD",
                    "typeHash": "0x71ff665b40ba044b1981ea9a8965189559c8e01e8cdfa34a3cc565e1f870a95c",
                    "typeScript": {
                        "args": "0x360c9d87b2824c357958c23e8878f686001e88e9527a08ea229e7d9ba7fe39a7",
                        "codeHash": "0x26a33e0815888a4a0614a0b7d09fa951e0993ff21e55905510104a0b1312032b",
                        "hashType": "type"
                    },
                    "typeCellDep": {
                        "outPoint": {
                            "txHash": "0xc07844ce21b38e4b071dd0e1ee3b0e27afd8d7532491327f39b786343f558ab7",
                            "index": 0
                        },
                        "depType": "code"
                    },
                    "isWhiteList": false,
                    "reserve": "20276414100987",
                    "price": "1.0137953732526303940680088183"  // token price
                },
                "basedAsset": 0,
                "totalLpSupply": "171351736326047",
                "protocolLpAmount": "20324714214",
                "typeHash": "0xf6808f0469c0834edf88744574c159d06ff1e1e7a3f39482799dc454952dda3b",
                "tvl": "411122.696034700",
                "tvlChangeRate": "-0.0033",
                "dayTxsCount": "45",
                "dayVolume": "5823.484166303",
                "dayVolumeChangeRate": "-0.3876",
                "dayApr": "0.010857344",
                "dayFees": "12.22931674923630"
            }
        ]
    }
}

查询 Seal 代币相关的资金池

// query seal pools info
curl --location 'https://utxoswap.xyz/utxo-swap/api/v1/sequencer/pools' \
--header 'x-api-key: {your api key}' \
--header 'Content-Type: application/json' \
--data '{
    "pageNo": 0,
    "pageSize": 10,
    "searchKey":  "0x178fb47b597a56d48b549226aff59f750b4784250c7f40f781b64ef090a8a0a7",
    "sort":"desc",
    "orderBy":"tvl" 
}'
 
// response
{
    "code": 0,
    "message": "success",
    "data": {
        "totalCount": 2,
        "list": [
            {
                "feeRate": 30,
                "batchId": 43125,
                "assetX": {
                    "logo": "https://storage.utxoswap.xyz/images/ckb.png",
                    "decimals": 8,
                    "name": "CKB",
                    "symbol": "CKB",
                    "typeHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
                    "typeScript": null,
                    "typeCellDep": null,
                    "isWhiteList": true,
                    "reserve": "297846773216181",
                    "price": "0.0141799561893442"  // price of ckb
                },
                "assetY": {
                    "logo": "https://xudtlogos.cc/logos/seal-logo.png",
                    "decimals": 8,
                    "name": "Seal",
                    "symbol": "Seal",
                    "typeHash": "0x178fb47b597a56d48b549226aff59f750b4784250c7f40f781b64ef090a8a0a7",
                    "typeScript": {
                        "args": "0x2ae639d6233f9b15545573b8e78f38ff7aa6c7bf8ef6460bf1f12d0a76c09c4e",
                        "codeHash": "0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95",
                        "hashType": "data1"
                    },
                    "typeCellDep": {
                        "outPoint": {
                            "txHash": "0xc07844ce21b38e4b071dd0e1ee3b0e27afd8d7532491327f39b786343f558ab7",
                            "index": 0
                        },
                        "depType": "code"
                    },
                    "isWhiteList": false,
                    "reserve": "13662757627398",
                    "price": "0.3091216510255344843736102511" // price of seal
                },
                "basedAsset": 0,
                "totalLpSupply": "60686495150999",
                "protocolLpAmount": "2365542832003",
                "typeHash": "0x29273406698f36e9bdf46db404176859b0ba3a6bdf7025833f7fd3b49150609a",
                "tvl": "84469.083906860",
                "tvlChangeRate": "-0.0339",
                "dayTxsCount": "342",
                "dayVolume": "22507.871302284",
                "dayVolumeChangeRate": "2.7289",
                "dayApr": "0.204243761",
                "dayFees": "47.26652973479640"
            },
            {
                "feeRate": 30,
                "batchId": 11,
                "assetX": {
                    "logo": "https://xudtlogos.cc/logos/seal-logo.png",
                    "decimals": 8,
                    "name": "Seal",
                    "symbol": "Seal",
                    "typeHash": "0x178fb47b597a56d48b549226aff59f750b4784250c7f40f781b64ef090a8a0a7",
                    "typeScript": {
                        "args": "0x2ae639d6233f9b15545573b8e78f38ff7aa6c7bf8ef6460bf1f12d0a76c09c4e",
                        "codeHash": "0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95",
                        "hashType": "data1"
                    },
                    "typeCellDep": {
                        "outPoint": {
                            "txHash": "0xc07844ce21b38e4b071dd0e1ee3b0e27afd8d7532491327f39b786343f558ab7",
                            "index": 0
                        },
                        "depType": "code"
                    },
                    "isWhiteList": false,
                    "reserve": "1381607763",
                    "price": "0.0069253393287326375568430871"  // price of seal
                },
                "assetY": {
                    "logo": "https://xudtlogos.cc/logos/ccbtc-logo.png",
                    "decimals": 8,
                    "name": "ccBTC",
                    "symbol": "BTC",
                    "typeHash": "0x3cd44aecea36e0a27e671f1fc79e65add7bf2f0e8b368389dc810ec81c63fa57",
                    "typeScript": {
                        "args": "0x68e64ba4b0daeeec45c1f983d6d574fca370442cafb805bc4265ef74870a4ac8",
                        "codeHash": "0x092c2c4a26ea475a8e860c29cf00502103add677705e2ccd8d6fe5af3caa5ae3",
                        "hashType": "type"
                    },
                    "typeCellDep": {
                        "outPoint": {
                            "txHash": "0xc07844ce21b38e4b071dd0e1ee3b0e27afd8d7532491327f39b786343f558ab7",
                            "index": 0
                        },
                        "depType": "code"
                    },
                    "isWhiteList": true,
                    "reserve": "142",
                    "price": "67381.0040703255" // price of btc
                },
                "basedAsset": 1,
                "totalLpSupply": "203882",
                "protocolLpAmount": "73",
                "typeHash": "0x4706eeef69b314d7681aa3c299c963d7e7fbb54681cd3171b5d678c63c45c05e",
                "tvl": "0.191362052",
                "tvlChangeRate": "0.0038",
                "dayTxsCount": "0",
                "dayVolume": "0.000000000",
                "dayVolumeChangeRate": null,
                "dayApr": "0.000000000",
                "dayFees": "0"
            }
        ]
    }
}
PreviousLiquidity Provider Token 介绍与解析NextUTXOSwap SDK

Last updated 6 months ago

⛽