Wallet API

Subscription#

Call this endpoint when a user wants to deposit assets into a DeFi protocol (subscribe) or borrow assets (borrow). Key parameters: investmentId (investment product ID), address (user wallet address), userInputList (input token address, chain ID, and amount). The returned dataList contains transaction steps to be executed in order (e.g., APPROVE followed by DEPOSIT), each of which must be signed and broadcast on-chain sequentially. For V3 Pool operations, additional parameters such as tickLower and tickUpper are required.

URL: POST /api/v6/defi/transaction/enter

Request Parameters#

Enter and exit share the same request model, and some fields are only valid under specific operations.

FieldTypeRequiredDefaultExplanation
investmentIdStringYesInvestment product ID
addressStringYesUser wallet address
tickLowerStringNoV3 tick lower bound. Only required when creating a new position for Dex Pool type investments
tickUpperStringNoV3 tick upper bound. Only required when creating a new position for Dex Pool type investments
tokenIdStringNoV3 Pool NFT position token ID. When isV3Pool=true: required for adding liquidity (appending to an existing position); required for redemption
userInputListArrayNoInput tokens and amounts. For subscription, this is the token or token list information to invest
> tokenAddressStringNoRequired when userInputList is provided; Token contract address
> chainIndexStringNoRequired when userInputList is provided; Chain ID
> coinAmountStringNoRequired when userInputList is provided; Amount (human-readable, e.g., "0.2")
> tokenSymbolStringNoToken symbol
> tokenPrecisionIntegerNoPrecision
slippageStringNo"0.01"Transaction slippage (effective for adapter/Zap routing). "0.01"=1%, "0.1"=10%

Request Examples#

Example 1: BSC V3 Pool subscription#

Investment product: PancakeSwapV3 USDT-RIVER (id=1589649169, chainIndex=56)

Json
{
    "investmentId": "1589649169",
    "address": "0x1ae68a40b9f903a469aed01574f3a9ab6d45c563",
    "tickLower": "-32150",
    "tickUpper": "-31350",
    "userInputList": [
        {
            "tokenAddress": "0x55d398326f99059fF775485246999027B3197955",
            "chainIndex": "56",
            "coinAmount": "0.2"
        }
    ],
    "slippage": "0.1"
}

Example 2: Avalanche Aave V3 deposit (Single Earn)#

Investment product: Aave V3 USDC (id=124, chainIndex=43114)

Json
{
    "investmentId": "124",
    "address": "0x1ae68a40b9f903a469aed01574f3a9ab6d45c563",
    "userInputList": [
        {
            "tokenAddress": "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
            "chainIndex": "43114",
            "coinAmount": "0.05"
        }
    ]
}

Example 3: Avalanche Aave V3 borrow#

Investment product: Aave V3 USDC Borrow (id=33901, chainIndex=43114)

Json
{
    "investmentId": "33901",
    "address": "0x1ae68a40b9f903a469aed01574f3a9ab6d45c563",
    "userInputList": [
        {
            "tokenAddress": "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
            "chainIndex": "43114",
            "coinAmount": "0.01"
        }
    ]
}

Example 4: Sui NAVI borrow#

Investment product: NAVI SUI Borrow (id=40047, chainIndex=784)

Json
{
    "investmentId": "40047",
    "address": "0x2791c11545a2fef7d8b3188002c80343bf6dc64130a603914238d8660b3bddde",
    "userInputList": [
        {
            "tokenAddress": "0x2::sui::SUI",
            "chainIndex": "784",
            "coinAmount": "0.02"
        }
    ]
}

Example 5: Solana Kamino borrow#

Investment product: Kamino USDC Borrow (id=29130, chainIndex=501)

Json
{
    "investmentId": "29130",
    "address": "4GK2VMnznuPpg8gG9vqD5MM6889pjJ8WS2HqzktaBfSo",
    "userInputList": [
        {
            "tokenAddress": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
            "chainIndex": "501",
            "coinAmount": "0.05"
        }
    ]
}

Response Parameters#

FieldTypeExplanation
codeString"0"=success, non-"0"=failure
msgStringError message
data.dataListArrayCalldata result list (execute in order, e.g., APPROVE → DEPOSIT)
> callDataTypeStringOperation type (approve, subscribe, redeem, claim), see enum table below
> fromStringFrom address (user wallet address)
> toStringTo address (target contract address). Depending on product type and operation, this may be a Zap contract or a direct protocol contract
> valueStringTransfer amount (native token quantity). Empty string or "0x0" when no native token transfer is needed
> serializedDataStringSerialized transaction data. EVM: hex calldata (0x prefix); Solana: base58 encoded; Sui: base64 encoded BCS bytes
> originalDataStringAuxiliary metadata (JSON string). EVM chains include function ABI (methodId/methodDefine/methodParams); Aptos chains include module ABI JSON
> transactionPayloadStringTransaction template, only returned for Aptos chains. Contains payload JSON; the client needs to supplement the sequence_number and build the complete transaction via SDK
> signatureDataStringSignature data. EVM chains: Zap contract permit signature; non-EVM chains: server-side signature credential
> gasStringGas limit, only returned for non-EVM chains such as Aptos. EVM chains require client-side estimation or a fixed value

callDataType Enum Values#

ValueExplanation
APPROVEERC20 authorization (approve spender)
DEPOSITDeposit into protocol
SWAP,DEPOSITSwap then deposit (V3 Pool scenario, single token into dual-token pool)
WITHDRAWWithdraw from protocol
WITHDRAW,SWAPWithdraw then swap back to target token (V3 Pool scenario)

Note: Aave Borrow returns callDataType=WITHDRAW, and Aave Repay returns callDataType=DEPOSIT. This follows Aave's internal method semantics (borrow=withdraw assets from the pool, repay=deposit assets into the pool) and does not affect actual business operations.

serializedData Processing by Chain#

ChainEncodingClient Processing Flow
EVM (BSC/AVAX/ETH)Hex (0x prefix)Use directly as tx.data, with to as the target address
SuiBase64 BCSbase64 decode → prepend intent [0,0,0] → blake2b-256 hash → Ed25519 sign → submit sui_executeTransactionBlock
SolanaBase58bs58 decode → skip first 65 bytes (signature placeholder) → VersionedMessage.deserialize() → sign → send immediately (blockhash expires in ~60s)
AptosUse the payload JSON from the transactionPayload field, build transaction via SDK build.simple() → sign → submit

Response Examples#

EVM chain (BSC V3 Enter, APPROVE + SWAP,DEPOSIT two steps):

Json
{
    "code": 0,
    "msg": "",
    "data": {
        "dataList": [
            {
                "callDataType": "APPROVE",
                "from": "0x1ae68a40b9f903a469aed01574f3a9ab6d45c563",
                "to": "0xda7ad9dea9397cffddae2f8a052b82f1484252b3",
                "value": "0x0",
                "serializedData": "0x095ea7b3000000000000000000000000...ffffffff",
                "originalData": "{\"callDataType\":\"APPROVE\",\"methodId\":\"0x095ea7b3\",\"methodDefine\":\"approve(address,uint256)\",...}",
                "signatureData": "..."
            },
            {
                "callDataType": "SWAP,DEPOSIT",
                "from": "0x1ae68a40b9f903a469aed01574f3a9ab6d45c563",
                "to": "0x7251FEbEABB01eC9dE53ECe7a96f1C951F886Dd2",
                "value": "0x0",
                "serializedData": "0xec5b999d000000000000000000000000...",
                "originalData": "{\"callDataType\":\"SWAP,DEPOSIT\",\"methodDefine\":\"{...executeWithPermit...}\",...}",
                "signatureData": "..."
            }
        ]
    }
}

Sui chain (NAVI Deposit, single step):

Json
{
    "code": 0,
    "msg": "",
    "data": {
        "dataList": [
            {
                "serializedData": "<base64 encoded Sui transaction bytes>",
                "from": "0x2791c11545a2fef7d8b3188002c80343bf6dc64130a603914238d8660b3bddde",
                "to": "...",
                "value": "0"
            }
        ]
    }
}

Solana chain (Kamino Deposit, single step):

Json
{
    "code": 0,
    "msg": "",
    "data": {
        "dataList": [
            {
                "serializedData": "<base58 encoded Solana VersionedTransaction>",
                "from": "4GK2VMnznuPpg8gG9vqD5MM6889pjJ8WS2HqzktaBfSo",
                "to": "...",
                "value": "0"
            }
        ]
    }
}

V3 Pool Dual-Token Position Ratio Calculator#

Note: This endpoint only needs to be called when investing in V3 Pool related products. Before subscribing to a V3 Pool, call this endpoint to calculate the required dual-token input ratio — the user only needs to provide a single token amount, and the endpoint intelligently computes how much of each token is needed based on the current pool price and selected price range. The returned investWithTokenList can be passed directly as userInputList to the subscription endpoint above.

URL: POST /api/v6/defi/calculator/enter/info

Request Parameters#

FieldTypeRequiredExplanation
inputAmountStringYesSingle-token amount entered by the user (human-readable format, e.g. "0.05")
inputTokenAddressStringYesContract address of the token entered by the user. Can be token0 or token1 of the V3 Pool
tokenDecimalStringYesDecimals of the input token (e.g. "18", "6")
investmentIdStringYesInvestment product ID (investmentId corresponding to the V3 Pool)
addressStringYesUser wallet address
tickLowerStringYesLower tick bound of the V3 position (e.g. "-33500")
tickUpperStringYesUpper tick bound of the V3 position (e.g. "-30450")

Request Example#

Example: BSC V3 Pool (USDT → Dual-Token Allocation)

Investment product: PancakeSwapV3 USDT-RIVER (id=1589649169, chainIndex=56)

Json
{
    "inputAmount": "0.05",
    "inputTokenAddress": "0x55d398326f99059fF775485246999027B3197955",
    "tokenDecimal": "18",
    "investmentId": 1589649169,
    "address": "0x1ae68a40b9f903a469aed01574f3a9ab6d45c563",
    "tickLower": "-33500",
    "tickUpper": "-30450"
}

Response Parameters#

data Object

FieldTypeExplanation
investWithTokenListArrayDual-token allocation result list, typically containing 2 elements (token0 and token1)
> tokenAddressStringToken contract address (lowercase format)
> chainIndexStringChain ID (e.g. "56" = BSC)
> coinAmountStringAllocated amount (human-readable format, e.g. "0.05"). High-precision decimal, can be used directly as userInputList in transaction/enter

Response Example#

Success: USDT Input → USDT + RIVER Dual-Token Allocation

Json
{
    "code": 0,
    "data": {
        "investWithTokenList": [
            {
                "tokenAddress": "0x55d398326f99059ff775485246999027b3197955",
                "chainIndex": "56",
                "coinAmount": "0.05"
            },
            {
                "tokenAddress": "0xda7ad9dea9397cffddae2f8a052b82f1484252b3",
                "chainIndex": "56",
                "coinAmount": "0.000275606738038671"
            }
        ]
    }
}

Explanation: The user invests 0.05 USDT. Based on the current tick ≈ -32932 price ratio, 0.05 USDT + 0.000275 RIVER are needed to form the dual-token entry.

Complete Invocation Flow#

  1. POST /api/v6/defi/calculator/enter/info (current endpoint) — Input: single-token amount + tick range → Output: investWithTokenList
  2. Verify wallet balance — Ensure both token balances meet the coinAmount specified in investWithTokenList
  3. POST /api/v6/defi/transaction/enter — Pass in userInputList (= investWithTokenList) + tickLower + tickUpper + slippage → Output: calldata (DEPOSIT)
  4. Sign & send on-chain transaction — Dual-token entry is a pure DEPOSIT (no on-chain swap)