描述: 该 API 将给你指定投资品的预估认购收益详情。内容包括:
POST https://www.okx.com/api/v5/defi/calculator/subscribe-info
参数名称 | 相关描述 | 数据类型 | 必传 | 数据类型 |
---|---|---|---|---|
address | 用户钱包地址 | 请求体 | 否 | String |
inputAmount | 认购代币数量 | 请求体 | 是 | String |
investmentCategory | 认购类型:(0:默认类型;1:BRC-20) | 请求体 | 否 | String |
investmentId | 投资品 ID (这里获取) | 请求体 | 是 | String |
inputTokenAddress | 认购代币的智能合约地址 (这里获取) | 请求体 | 是 | String |
isSingle | 判断是否为单币投资品:是:单币;否:多币 | 请求体 | 否 | Boolean |
slippage | 滑点:默认为 1% | 请求体 | 否 | String |
参数名称 | 相关描述 | 数据类型 |
---|---|---|
validatorName | 超级节点名称 | String |
isAllowSubscribe | 是否允许申购 | Boolean |
estimateGasFee | 收益率计算类型:0:APY;1:APR | String |
isSwapInvest | 是否是兑换投资 | Boolean |
exchangeRate | 币种汇率 | String |
investWithTokenList | 质押代币 | Array[Struct] |
>coinAmount | 币种数量 | String |
>currencyAmount | 币种美元价值 | String |
>tokenSymbol | 币种标识 | String |
>tokenName | 币种名称 | String |
>tokenAddress | 币种的智能合约地址 | String |
>tokenPrecision | 币种精确小数位 | String |
>isBaseToken | 质押代币是否为主网基准代币 | Boolean |
>network | 币种网络 | String |
>chainId | 币种的链 ID | String |
>dataType | 0:利息收益;1:矿币收益;2:手续费;3:奖励金 | String |
gainsTokenList | 收益代币列表:结构同 investWithTokenList | Array[Struct] |
receiveTokenInfo | 投资收到的凭证代币:结构同 investWithTokenList | Array[Struct] |
approveStatusList | 币种授权状态列表 | Array[Struct] |
>tokenSymbol | 币种标识 | String |
>tokenAddress | 币种的智能合约地址 | String |
>tokenPrecision | 币种精确小数位 | String |
>isNeedApprove | 是否需要授权 | Boolean |
>approveAddress | 需要授权的合约地址 | String |
>network | 币种网络 | String |
>chainId | 币种的链 ID | String |
>orderType | 类型透传给 Call data 的参数 (3:买入授权;4:赎回授权;8:进入 Farm;9:离开 Farm) | String |
curl --location 'https://www.okx.com/api/v5/defi/calculator/subscribe-info' \
--header 'OK-ACCESS-KEY: 9c****77' \
--header 'OK-ACCESS-PASSPHRASE: p****d' \
--header 'Content-Type: application/json' \
--data '{
"inputAmount": "1",
"inputTokenAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"isSingle": false,
"tokenDecimal": "18",
"investmentId": "21915",
"address": "0x7f****da",
"investmentType": 0
}'
{
"code": 0,
"msg": "",
"data": {
"investWithTokenList": [
{
"tokenSymbol": "CORE",
"tokenName": "Core",
"tokenAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"network": "CORE",
"chainId": "1116",
"tokenPrecision": "18",
"isBaseToken": true,
"coinAmount": "1",
"currencyAmount": "0.5035"
}
],
"gainsTokenList": [
{
"tokenSymbol": "CORE",
"tokenName": "Core",
"tokenAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"network": "CORE",
"tokenPrecision": "18",
"coinAmount": "0.000742226856350101",
"dataType": "0"
}
],
"approveStatusList": [
{
"tokenSymbol": "CORE",
"tokenAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"network": "CORE",
"chainId": "1116",
"tokenPrecision": "18",
"isNeedApprove": false,
"approveAddress": "0x0000000000000000000000000000000000001007",
"orderType": "3"
}
],
"isSwapInvest": false,
"estimateGasFee": "99343",
"isAllowSubscribe": true,
"validatorName": "OKXEarn"
}
}