Binance Web3 Connector JS
    Preparing search index...
    Index
    • Build the unsigned claim calldata for one of four claim types — see DefiClaimType for which companion fields each type requires and which protocol constraints apply (e.g. REWARD_PROTOCOL is not supported for LP protocols; PancakeSwap V3 farming uses LP_FEE, not REWARD_INVESTMENT). Returns an ordered dataList (typically [CLAIM]). binanceChainId resolution rules*:

      • Normally resolved from investmentId; the call always executes on that chain.

      • For claim types other than REWARD_PROTOCOL, any client-supplied binanceChainId is silently ignored* — passing a different chainId will not redirect the claim.

      • Exception: REWARD_PROTOCOL with no investmentId — the client MUST pass binanceChainId (it is the only chain signal).

      tokenAddressList optionally narrows the claim scope. Set simulate=true to also receive preview.

      Parameters

      Returns Promise<RestApiResponse<BuildDeFiClaimTransactionResponse>>

    • 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>>

    • 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>>

    • Solana-only counterpart to /swap. Shares the full quote → route → vendor buildSwapTx → priceImpact → minReceive → instruction-assembly pipeline; the only difference is the response: instead of returning a signed-and-serialized base64 transaction, this endpoint returns the uncompiled instruction list plus the address-lookup-table (ALT) address list, leaving v0-transaction compilation, signing, and submission to the caller.

      Use this when the caller needs to:

      • prepend / append their own instructions (e.g. fee splitting, custom logging) before signing;

      • reuse the platform-curated route, slippage, PS-variant rewriting, ALT injection, ComputeBudget overwrite, and ATA batching while still controlling the final wire format.

      Only supports binanceChainId=CT_501 (Solana). Other chains return CHAIN_NOT_SUPPORTED (40411). Parameters mirror the Solana subset of /swap (no EVM-only approveTransaction / approveAmount / gasLimit). Supports the custom-fee (Add Fee / referral fee) parameters (feePercent + fromTokenReferrerWalletAddress / toTokenReferrerWalletAddress), with the same semantics as /swap — the fee instructions are injected into the returned uncompiled instruction list.

      Parameters

      Returns Promise<RestApiResponse<BuildSolanaSwapInstructionsResponse>>

    • Given a single input token, calculate the paired token amount needed for an LP add. This is a pure computation endpoint — it does not touch the chain and does not deduct any fee. Use it before /transaction/lp-add to size the paired token when only one side is supplied. Tick range source rules are the same as /lp-add — provide exactly one group: nftId (existing position), priceRange, or tickLower+tickUpper.

      • If more than one group is supplied, only the highest-priority one is used and the others are silently ignored (priority: nftId > priceRange > explicit tick pair).

      • If none is supplied, the request is rejected.

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

      Parameters

      Returns Promise<RestApiResponse<CalculateLpAddPairedAmountsResponse>>

    • Query the current network gas price for the specified chain. The response shape varies by chain family:

      • EVM chains return both evmLegacyGasPrice (legacy gasPrice) and eip1559GasPrice (baseFee + priority/max fees) when EIP-1559 is supported.
      • Solana returns solanaGasPrice (compute-unit prices and Jito tips). - Tron ("CT_195") returns an empty data object because Tron has no on-chain gas-price concept; use the gas-limit endpoint instead.

      Fields not applicable to the chain family are returned as null.

      Parameters

      Returns Promise<RestApiResponse<GetGasPriceResponse>>

    • Generic function to send a request.

      Type Parameters

      • T

      Parameters

      • endpoint: string

        The API endpoint to call.

      • method: "GET" | "POST" | "DELETE" | "PUT" | "PATCH"

        HTTP method to use (GET, POST, DELETE, etc.).

      • queryParams: Record<string, unknown> = {}

        Query parameters for the request.

      • bodyParams: Record<string, unknown> = {}

        Body parameters for the request.

      Returns Promise<RestApiResponse<T>>

      A promise resolving to the response data object.

    • Generic function to send a signed request.

      Type Parameters

      • T

      Parameters

      • endpoint: string

        The API endpoint to call.

      • method: "GET" | "POST" | "DELETE" | "PUT" | "PATCH"

        HTTP method to use (GET, POST, DELETE, etc.).

      • queryParams: Record<string, unknown> = {}

        Query parameters for the request.

      • bodyParams: Record<string, unknown> = {}

        Body parameters for the request.

      Returns Promise<RestApiResponse<T>>

      A promise resolving to the response data object.

    • Submit a signed RFQ order to the backend for on-chain settlement via the corresponding vendor relayer. Only used when executionMode=RFQ (equity / RWA tokens such as Ondo and BStock).

      Flow*: GET /quote → pick an RFQ route → GET /swap → sign rfq.typedDataToSign with EIP-712 (eth_signTypedData_v4) → call this endpoint → poll GET /order/{orderId} until FILLED or FAILED.

      Idempotency*: Submitting with the same requestId within 30 minutes returns the original result without re-calling the vendor. Use a new UUID for each distinct order; reuse the same UUID when retrying.

      Parameters

      Returns Promise<RestApiResponse<SubmitRfqOrderResponse>>