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.
| Field | Type | Required | Default | Explanation |
|---|---|---|---|---|
| investmentId | String | Yes | — | Investment product ID |
| address | String | Yes | — | User wallet address |
| tickLower | String | No | — | V3 tick lower bound. Only required when creating a new position for Dex Pool type investments |
| tickUpper | String | No | — | V3 tick upper bound. Only required when creating a new position for Dex Pool type investments |
| tokenId | String | No | — | V3 Pool NFT position token ID. When isV3Pool=true: required for adding liquidity (appending to an existing position); required for redemption |
| userInputList | Array | No | — | Input tokens and amounts. For subscription, this is the token or token list information to invest |
| > tokenAddress | String | No | — | Required when userInputList is provided; Token contract address |
| > chainIndex | String | No | — | Required when userInputList is provided; Chain ID |
| > coinAmount | String | No | — | Required when userInputList is provided; Amount (human-readable, e.g., "0.2") |
| > tokenSymbol | String | No | — | Token symbol |
| > tokenPrecision | Integer | No | — | Precision |
| slippage | String | No | "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)
{
"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)
{
"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)
{
"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)
{
"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)
{
"investmentId": "29130",
"address": "4GK2VMnznuPpg8gG9vqD5MM6889pjJ8WS2HqzktaBfSo",
"userInputList": [
{
"tokenAddress": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"chainIndex": "501",
"coinAmount": "0.05"
}
]
}
Response Parameters#
| Field | Type | Explanation |
|---|---|---|
| code | String | "0"=success, non-"0"=failure |
| msg | String | Error message |
| data.dataList | Array | Calldata result list (execute in order, e.g., APPROVE → DEPOSIT) |
| > callDataType | String | Operation type (approve, subscribe, redeem, claim), see enum table below |
| > from | String | From address (user wallet address) |
| > to | String | To address (target contract address). Depending on product type and operation, this may be a Zap contract or a direct protocol contract |
| > value | String | Transfer amount (native token quantity). Empty string or "0x0" when no native token transfer is needed |
| > serializedData | String | Serialized transaction data. EVM: hex calldata (0x prefix); Solana: base58 encoded; Sui: base64 encoded BCS bytes |
| > originalData | String | Auxiliary metadata (JSON string). EVM chains include function ABI (methodId/methodDefine/methodParams); Aptos chains include module ABI JSON |
| > transactionPayload | String | Transaction template, only returned for Aptos chains. Contains payload JSON; the client needs to supplement the sequence_number and build the complete transaction via SDK |
| > signatureData | String | Signature data. EVM chains: Zap contract permit signature; non-EVM chains: server-side signature credential |
| > gas | String | Gas limit, only returned for non-EVM chains such as Aptos. EVM chains require client-side estimation or a fixed value |
callDataType Enum Values#
| Value | Explanation |
|---|---|
| APPROVE | ERC20 authorization (approve spender) |
| DEPOSIT | Deposit into protocol |
| SWAP,DEPOSIT | Swap then deposit (V3 Pool scenario, single token into dual-token pool) |
| WITHDRAW | Withdraw from protocol |
| WITHDRAW,SWAP | Withdraw 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#
| Chain | Encoding | Client Processing Flow |
|---|---|---|
| EVM (BSC/AVAX/ETH) | Hex (0x prefix) | Use directly as tx.data, with to as the target address |
| Sui | Base64 BCS | base64 decode → prepend intent [0,0,0] → blake2b-256 hash → Ed25519 sign → submit sui_executeTransactionBlock |
| Solana | Base58 | bs58 decode → skip first 65 bytes (signature placeholder) → VersionedMessage.deserialize() → sign → send immediately (blockhash expires in ~60s) |
| Aptos | — | Use 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):
{
"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):
{
"code": 0,
"msg": "",
"data": {
"dataList": [
{
"serializedData": "<base64 encoded Sui transaction bytes>",
"from": "0x2791c11545a2fef7d8b3188002c80343bf6dc64130a603914238d8660b3bddde",
"to": "...",
"value": "0"
}
]
}
}
Solana chain (Kamino Deposit, single step):
{
"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#
| Field | Type | Required | Explanation |
|---|---|---|---|
| inputAmount | String | Yes | Single-token amount entered by the user (human-readable format, e.g. "0.05") |
| inputTokenAddress | String | Yes | Contract address of the token entered by the user. Can be token0 or token1 of the V3 Pool |
| tokenDecimal | String | Yes | Decimals of the input token (e.g. "18", "6") |
| investmentId | String | Yes | Investment product ID (investmentId corresponding to the V3 Pool) |
| address | String | Yes | User wallet address |
| tickLower | String | Yes | Lower tick bound of the V3 position (e.g. "-33500") |
| tickUpper | String | Yes | Upper 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)
{
"inputAmount": "0.05",
"inputTokenAddress": "0x55d398326f99059fF775485246999027B3197955",
"tokenDecimal": "18",
"investmentId": 1589649169,
"address": "0x1ae68a40b9f903a469aed01574f3a9ab6d45c563",
"tickLower": "-33500",
"tickUpper": "-30450"
}
Response Parameters#
data Object
| Field | Type | Explanation |
|---|---|---|
| investWithTokenList | Array | Dual-token allocation result list, typically containing 2 elements (token0 and token1) |
| > tokenAddress | String | Token contract address (lowercase format) |
| > chainIndex | String | Chain ID (e.g. "56" = BSC) |
| > coinAmount | String | Allocated 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
{
"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#
- POST
/api/v6/defi/calculator/enter/info(current endpoint) — Input: single-token amount + tick range → Output: investWithTokenList - Verify wallet balance — Ensure both token balances meet the coinAmount specified in investWithTokenList
- POST
/api/v6/defi/transaction/enter— Pass in userInputList (= investWithTokenList) + tickLower + tickUpper + slippage → Output: calldata (DEPOSIT) - Sign & send on-chain transaction — Dual-token entry is a pure DEPOSIT (no on-chain swap)