Query estimated calculation information for subscription#
Description: This API provides you with estimated subscription earnings details for a specific investment. The content includes:
- Super node name and estimated gas fees.
- List of received tokens, details of voucher tokens, details of earnings tokens, and token authorization status (including whether authorization is required).
- Subscribable amount, minimum subscription amount, maximum subscription amount, currency exchange rates, etc.
Request URl#
POST https://web3.okx.com/api/v5/defi/calculator/subscribe-info
Request parameter#
| Parameter name | Description | Data type | Required | Data type |
|---|---|---|---|---|
| address | User wallet address | Request body | No | String |
| inputAmount | Subscription token quantity | Request body | Yes | String |
| investmentCategory | Subscription category: 0: Default category; 1: BRC-20 | Request body | No | String |
| investmentId | Investment ID (refer to here) | Request body | Yes | String |
| inputTokenAddress | Smart contract address of the subscription token (refer to here) | Request body | Yes | String |
| isSingle | Determine if it’s a single token investment: Yes: Single token; No: Multiple | Request body | No | Boolean |
| slippage | Slippage: default is 1% | Request body | No | String |
Response parameters#
| Parameter name | Description | Data type |
|---|---|---|
| validatorName | Super node name | String |
| isAllowSubscribe | Whether subscription is allowed | Boolean |
| estimateGasFee | Type of earnings calculation: 0: APY; 1: APR | String |
| isSwapInvest | Whether it is a swap investment | Boolean |
| exchangeRate | Currency exchange rate | String |
| investWithTokenList | Pledged tokens | Array[Struct] |
| > coinAmount | Token quantity | String |
| > currencyAmount | Token value in USD | String |
| > tokenSymbol | Token symbol | String |
| > tokenName | Token name | String |
| > tokenAddress | Token smart contract address | String |
| > tokenPrecision | Token decimal precision | String |
| > isBaseToken | Whether the pledging token is the mainnet base token | Boolean |
| > network | Token network | String |
| > chainId | Token chain ID | String |
| > dataType | 0: Interest earnings; 1: Mining earnings; 2: Transaction fees; 3: Bonus | String |
| gainsTokenList | List of earning tokens: same structure as investWithTokenList | Array[Struct] |
| receiveTokenInfo | Voucher tokens received from the investment: same structure as investWithTokenList | Array[Struct] |
| approveStatusList | List of token authorization status | Array[Struct] |
| > tokenSymbol | Token symbol | String |
| > tokenAddress | Token smart contract address | String |
| > tokenPrecision | Token decimal precision | String |
| > isNeedApprove | Whether authorization is required | Boolean |
| > approveAddress | Contract address requiring authorization | String |
| > network | Token network | String |
| > chainId | Token chain ID | String |
| > orderType | Parameter passed to call data (3: buy authorization, 4: redemption authorization, 8: enter farm, 9: leave farm) | String |
Request example#
shell
curl --location 'https://web3.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
}'
Response example#
200
{
"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"
}
}
