Binance Web3 Connector JS
    Preparing search index...

    DefiTransactionApi - object-oriented interface DefiTransactionApi

    Implements

    Index
    • Build the unsigned transaction calldata for a DeFi redeem / withdraw. Returns an ordered dataList (typically [REDEEM] or [APPROVE, REDEEM]). Redeem amount is decided by exactly one of ratio or token* (mutually exclusive): - ratio omitted / blank → exact-amount redeem: the amount comes from token (tokenAddress + amount); the position is not queried. token is required in this mode (omitting token, or leaving amount blank, is rejected with 40001, Parameter error; both ratio and token absent is also rejected with 40001).

      • ratio present → proportional redeem: must parse as a decimal in (0, 1]. The service queries the user's on-chain position under investmentId and scales each token's amount by ratio (floored to the token's decimals). ratio="1" is a full (max) redeem. In this mode token is ignored — the output tokens and amounts are derived from the position.

      slippageBps is the slippage tolerance in basis points (e.g. 300 = 3%). The caller does NOT pass binanceChainId — resolved from investmentId. Set simulate=true to also receive preview. The response also carries redeemDelayDays — the redeem waiting period as a [min, max] day pair (e.g. ["7","10"] = 7–10 days, [] = instant). The wait starts after the redeem tx is confirmed on-chain. See the redeemDelayDays field on DefiTxResponse.

      Parameters

      Returns Promise<RestApiResponse<BuildDeFiRedeemTransactionResponse>>

      DefiTransactionApi

    • Build the unsigned transaction calldata for adding liquidity. tokenList supports multiple tokens. Returns an ordered dataList (typically [APPROVE, LP_ADD]). *Tick range source (provide exactly one group)**:

      1. nftId — append to an existing LP position (reuses its range).
      2. priceRange — percentage band (e.g. "5" = ±5%) for a new position.
      3. tickLower + tickUpper — explicit raw int24 pair for a new position. Rules*:
      • If more than one group is supplied, only the highest-priority one above is used and the others are silently ignored (priority: nftId > priceRange > explicit tick pair).

      • If none is supplied, the request is rejected (40453).

      • tickLower / tickUpper are raw int24 values and MUST be aligned to the pool's tickSpacing, otherwise the request is rejected (40453).

      • The caller does NOT pass binanceChainId — resolved from investmentId.

      Parameters

      Returns Promise<RestApiResponse<BuildLpAddTransactionResponse>>

      DefiTransactionApi