DeFi API

执行交易前参数准备#

这是发起申购交易前的必要准备步骤。调用此接口获取"可投币种列表"、"凭证代币"、"收益代币"等信息,这些信息是后续调用 /transaction/enter/transaction/exit 构建 Calldata 时的必要输入。

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

请求参数#

字段类型必填说明
investmentIdString投资品ID

请求示例#

示例 1: 申购初始化#

Json
{
    "investmentId": 12345
}

响应参数#

字段类型说明
investWithTokenListArray可投币种列表,用于申购的enter接口
> tokenIdStringNFT TokenId
> tokenSymbolString代币符号
> tokenNameString代币名称
> tokenAddressString合约地址
> tokenPrecisionString精度
> chainIndexString链ID
> networkString网络
> coinAmountString币种数量
> currencyAmountString美元价值
receiveTokenInfoObject收到的凭证代币
> tokenIdStringNFT TokenId
> tokenSymbolString代币符号
> tokenNameString代币名称
> tokenAddressString合约地址
> tokenPrecisionString精度
> chainIndexString链ID
> networkString网络
> coinAmountString币种数量
> currencyAmountString美元价值
gainsTokenListArray收益代币列表
> tokenIdStringNFT TokenId
> tokenSymbolString代币符号
> tokenNameString代币名称
> tokenAddressString合约地址
> tokenPrecisionString精度
> chainIndexString链ID
> networkString网络
> coinAmountString币种数量
> currencyAmountString美元价值
isAllowSubscribeBoolean是否允许申购(type=1 有值)
feeRateString手续费率(dex_pool专属)
currentTickString当前 tick(对应当前价格汇率)(dex_pool专属)
currentPriceStringtoken0 当前价格汇率(dex_pool专属)
lowerPriceString加仓时进入初始页面的下限价格(dex_pool专属)
upperPriceString加仓时进入初始页面的上限价格(dex_pool专属)
tickSpacingStringtick 间隔(dex_pool专属)
underlyingTokenListArray底层资产列表,index0=token0, index1=token1(dex_pool专属)
> tokenIdStringNFT Token ID(V3 仓位 NFT 的 tokenId)
> tokenSymbolStringToken 符号,如 USDC、ETH
> tokenNameStringToken 全称
> tokenLogoStringToken Logo 图片 URL
> tokenAddressStringToken 合约地址
> networkString所在网络标识,如 eth、bsc
> chainIndexString链 ID,如 1(ETH)、56(BSC)
> tokenPrecisionStringToken 精度(即 decimals),如 18、6
> isBaseTokenBoolean是否为链原生主币(如 ETH、BNB)

响应示例#

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"
            }
        ]
    }
}