Wallet API

Prepare Transaction Parameters#

This is a required preparatory step before initiating a subscription transaction. Call this endpoint to obtain the "available input token list", "receipt token", "yield tokens", and other information. These are required inputs when subsequently calling /transaction/enter or /transaction/exit to construct calldata.

URL: POST /api/v6/defi/product/detail/prepare

Request Parameters#

FieldTypeRequiredExplanation
investmentIdStringYesInvestment product ID

Request Example#

Example 1: Subscription Initialization#

Json
{
    "investmentId": 12345
}

Response Parameters#

FieldTypeExplanation
investWithTokenListArrayAvailable input token list, used for the subscription enter endpoint
> tokenIdStringNFT TokenId
> tokenSymbolStringToken symbol
> tokenNameStringToken name
> tokenAddressStringContract address
> tokenPrecisionStringPrecision
> chainIndexStringChain ID
> networkStringNetwork
> coinAmountStringToken amount
> currencyAmountStringUSD value
receiveTokenInfoObjectReceived receipt token
> tokenIdStringNFT TokenId
> tokenSymbolStringToken symbol
> tokenNameStringToken name
> tokenAddressStringContract address
> tokenPrecisionStringPrecision
> chainIndexStringChain ID
> networkStringNetwork
> coinAmountStringToken amount
> currencyAmountStringUSD value
gainsTokenListArrayYield token list
> tokenIdStringNFT TokenId
> tokenSymbolStringToken symbol
> tokenNameStringToken name
> tokenAddressStringContract address
> tokenPrecisionStringPrecision
> chainIndexStringChain ID
> networkStringNetwork
> coinAmountStringToken amount
> currencyAmountStringUSD value
isAllowSubscribeBooleanWhether subscription is allowed (has value when type=1)
feeRateStringFee rate (dex_pool exclusive)
currentTickStringCurrent tick (corresponding to current price exchange rate) (dex_pool exclusive)
currentPriceStringtoken0 current price exchange rate (dex_pool exclusive)
lowerPriceStringLower price bound when entering the initial page for adding positions (dex_pool exclusive)
upperPriceStringUpper price bound when entering the initial page for adding positions (dex_pool exclusive)
tickSpacingStringTick spacing (dex_pool exclusive)
underlyingTokenListArrayUnderlying asset list, index0=token0, index1=token1 (dex_pool exclusive)
> tokenIdStringNFT Token ID (tokenId of the V3 position NFT)
> tokenSymbolStringToken symbol, e.g. USDC, ETH
> tokenNameStringToken full name
> tokenLogoStringToken logo image URL
> tokenAddressStringToken contract address
> networkStringNetwork identifier, e.g. eth, bsc
> chainIndexStringChain ID, e.g. 1 (ETH), 56 (BSC)
> tokenPrecisionStringToken precision (i.e. decimals), e.g. 18, 6
> isBaseTokenBooleanWhether it is the chain's native token (e.g. ETH, BNB)

Response Example#

Single Earn: Aave V3 USDC (Ethereum, investmentId=9502)

Json
{
    "code": 0,
    "msg": "",
    "data": {
        "investWithTokenList": [
            {
                "tokenSymbol": "USDC",
                "tokenName": "USD Coin",
                "tokenLogo": "https://static.coinall.ltd/cdn/wallet/logo/USDC.png",
                "tokenAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
                "network": "ETH",
                "chainIndex": "1",
                "tokenPrecision": "6",
                "isBaseToken": false,
                "coinAmount": "0",
                "currencyAmount": "0",
                "browserUrl": "https://web3.okx.com/explorer/eth/token/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
            }
        ],
        "receiveTokenInfo": {
            "tokenSymbol": "aEthUSDC",
            "tokenName": "Aave Ethereum USDC",
            "tokenLogo": "https://static.coinall.ltd/cdn/web3/currency/token/1-0x98c23e9d8f34fefb1b7bd6a91b7ff122f4e16f5c-97.png/type=png_350_0",
            "tokenAddress": "0x98c23e9d8f34fefb1b7bd6a91b7ff122f4e16f5c",
            "network": "ETH",
            "chainIndex": "1",
            "tokenPrecision": "6",
            "coinAmount": "0"
        },
        "gainsTokenList": [
            {
                "tokenSymbol": "USDC",
                "tokenName": "USD Coin",
                "tokenLogo": "https://static.coinall.ltd/cdn/wallet/logo/USDC.png",
                "tokenAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
                "network": "ETH",
                "tokenPrecision": "6",
                "coinAmount": "0",
                "dataType": "0"
            }
        ]
    }
}