DeFi API

查询赎回的预估计算信息#

描述: 该 API 将给你特定投资品的预估赎回详情。内容包括:

  • 超级节点名、预估网络费相关;
  • 接收代币列表、兑换代币详情列表、代币授权状态列表 (包括是否需要授权);
  • 可赎回金额、最小赎回数额、最大赎回数额等。

请求地址#

POST https://www.okx.com/api/v5/defi/calculator/redeem-info

请求参数#

参数名称相关描述参数类型必传数据类型
address用户钱包地址请求体String
inputTokenAmount认购代币数量请求体String
investmentCategory认购类型:(例如,0:默认类型;1:BRC-20) 获取请求体String
investmentId投资品 ID (这里获取)请求体String
isSingle判断是否为单币投资品:是:单币;否:多币请求体Boolean
outputTokenAddress代币智能合约地址 (这里)请求体String
slippage滑点请求体String

响应参数#

参数名称相关描述数据类型
isAllowRedeem是否允许赎回Boolean
estimateGasFee预估网络费用上限String
isSwapInvest是否是兑换投资Boolean
inputCurrencyAmount输入币种美元价值String
receiveTokenList获得的币种信息列表Array[Struct]
>coinAmount币种数量String
>currencyAmount币种美元价值String
>tokenSymbol币种标识String
>tokenName币种名称String
>tokenAddress币种的智能合约地址String
>tokenPrecision币种精确小数位String
>isBaseToken质押代币是否为主网基准代币Boolean
>network币种网络String
>chainId币种的链 IDString
>dataType0:利息收益 1:矿币收益 2:手续费 3:奖励金String
swapFromTokenList赎回过程代币列表:结构同 investWithTokenListArray[Struct]
mySupply可赎回额度:结构同 investWithTokenListStruct
approveStatusList币种授权状态列表Array[Struct]
>tokenSymbol币种标识String
>tokenAddress币种的智能合约地址String
>tokenPrecision币种精确小数位String
>isNeedApprove是否需要授权Boolean
>approveAddress需要授权的合约地址String
>network币种网络String
>chainId币种的链 IDString
>orderType类型透传给 Call data 的参数 (3:买入授权;4:赎回授权;8:进入 Farm;9:离开 Farm)String

请求示例#

shell
curl --location 'https://www.okx.com/api/v5/defi/calculator/redeem-info' \
--header 'OK-ACCESS-KEY: 9c****77' \
--header 'OK-ACCESS-PASSPHRASE: p****d' \
--header 'Content-Type: application/json' \
--data '{
  "address": "0x7f****da",
  "inputTokenAmount": "1.000000146425127036",
  "investmentCategory": "0",
  "investmentId": "21033",
  "isSingle": false,
  "outputTokenAddress": "0x6b175474e89094c44da98b954eedeac495271d0f",
  "outputTokenDecimal": "18",
  "redeemId": "",
  "slippage": ""
}'

响应示例#

200
{
    "code": 0,
    "msg": "",
    "data": {
        "receiveTokenList": [
            {
                "tokenSymbol": "DAI",
                "tokenName": "Dai Stablecoin",
                "tokenAddress": "0x6b****0f",
                "network": "ETH",
                "chainId": "1",
                "tokenPrecision": "18",
                "isBaseToken": false,
                "coinAmount": "1.000000146425127036",
                "currencyAmount": "0.9993097704396316094231068522159962",
                "dataType": "0"
            }
        ],
        "swapFromTokenList": [
            {
                "tokenSymbol": "DAI",
                "tokenName": "Dai Stablecoin",
                "tokenAddress": "0x6b****0f",
                "network": "ETH",
                "chainId": "1",
                "tokenPrecision": "18",
                "isBaseToken": false,
                "coinAmount": "1.000000146425127036",
                "currencyAmount": "0.9993097704396316094231068522159962"
            }
        ],
        "isSwapInvest": false,
        "estimateGasFee": "276614",
        "isAllowRedeem": true,
        "mySupply": {
            "tokenSymbol": "DAI",
            "tokenName": "Dai Stablecoin",
            "tokenAddress": "0x6b****0f",
            "network": "ETH",
            "chainId": "1",
            "tokenPrecision": "18",
            "isBaseToken": false,
            "coinAmount": "0",
            "currencyAmount": "0"
        },
        "inputCurrencyAmount": "0.9993097704396316094231068522159962"
    }
}