Binance Web3 Connector JS
    Preparing search index...

    Interface QuoteAndBuildSwapTransactionRequest

    Request parameters for quoteAndBuildSwapTransaction operation in TradingApi. QuoteAndBuildSwapTransactionRequest

    interface QuoteAndBuildSwapTransactionRequest {
        amount: string;
        approveAmount?: string;
        approveTransaction?: QuoteAndBuildSwapTransactionApproveTransactionEnum;
        autoSlippage?: QuoteAndBuildSwapTransactionAutoSlippageEnum;
        binanceChainId: string;
        computeUnitLimit?: string;
        computeUnitPrice?: string;
        enableRFQ?: QuoteAndBuildSwapTransactionEnableRFQEnum;
        excludeDexes?: string;
        excludePools?: string;
        feePercent?: string;
        fromTokenAddress: string;
        fromTokenReferrerWalletAddress?: string;
        gasLevel?: QuoteAndBuildSwapTransactionGasLevelEnum;
        gasLimit?: string;
        maxAutoSlippagePercent?: string;
        nonce?: string;
        priceImpactProtectionPercent?: string;
        recvWindow?: number | bigint;
        slippagePercent?: string;
        tips?: string;
        toTokenAddress: string;
        toTokenReferrerWalletAddress?: string;
        userWalletAddress: string;
        vendor: LiquidMesh;
    }
    Index
    amount: string

    Sell-token amount in the token's smallest unit (positive integer string, no decimals).

    TradingApiQuoteAndBuildSwapTransaction

    approveAmount?: string

    Override approve amount (smallest unit, positive integer string). Defaults to the swap amount.

    TradingApiQuoteAndBuildSwapTransaction

    When "true", signatureData includes the spender address and approve calldata so the client can submit it before the swap. Defaults to false.

    TradingApiQuoteAndBuildSwapTransaction

    When "true", slippage is auto-derived from market data and overrides slippagePercent. Either slippagePercent or autoSlippage=true must be provided — omitting both returns a parameter error. Defaults to "false".

    TradingApiQuoteAndBuildSwapTransaction

    binanceChainId: string

    Unique chain identifier (e.g. "56"=BSC, "1"=Ethereum, "CT_501"=Solana).

    TradingApiQuoteAndBuildSwapTransaction

    computeUnitLimit?: string

    Solana only — maximum compute units the transaction may consume (analogous to EVM gasLimit). Applies only when binanceChainId=CT_501.

    TradingApiQuoteAndBuildSwapTransaction

    computeUnitPrice?: string

    Solana only — priority fee per compute unit (micro-lamports), analogous to EVM gasPrice. When omitted, the platform computes a value dynamically. Applies only when binanceChainId=CT_501.

    TradingApiQuoteAndBuildSwapTransaction

    Whether to enable RFQ liquidity sources for routing. Default depends on the token pair: BStock pairs default to "true" (RFQ enabled); all other tokens default to "false" (RFQ disabled, AMM-only routing). An explicit value always overrides the default. "true" may return better pricing, but the returned calldata may embed RFQ settlements with a short (~30s) deadline.

    TradingApiQuoteAndBuildSwapTransaction

    excludeDexes?: string

    Comma-separated list of DEXes to exclude from routing. Pass the dexName values returned in the response routerResult.dexRouterList as-is (e.g. "Pancakeswap V4,Pancakeswap V3"). On EVM/Sui/Tron chains they are normalized automatically; on Solana the value is case-sensitive and must match the response exactly. Omit or leave empty to exclude nothing.

    TradingApiQuoteAndBuildSwapTransaction

    excludePools?: string

    Comma-separated list of liquidity pool identifiers to exclude from routing (block specific pools). Only effective when vendor=LiquidMesh — passed through to the LiquidMesh Flash API excludePools parameter. Pool identifier format: V2/V3 pools use the 0x + 40-hex contract address, V4/Infinity pools use the 0x + 64-hex poolId (0x prefix optional, case-insensitive). Values are trimmed, deduped and passed through as-is; the server only enforces a length cap (2000 chars), invalid values are rejected by the gateway. Omit or leave empty to exclude nothing (behavior unchanged).

    TradingApiQuoteAndBuildSwapTransaction

    feePercent?: string

    Custom fee (referral fee / Add Fee) percentage as a decimal string. Must be paired with exactly one of fromTokenReferrerWalletAddress or toTokenReferrerWalletAddress (the two referrer addresses are mutually exclusive).

    Range by chain:* (0, 5] for EVM chains (BSC, Ethereum, Base, etc.) and (0, 10] for Solana (CT_501) — greater than 0, up to the chain-specific maximum inclusive, max 2 decimal places. "1.5" means 1.5%. Values exceeding 2 decimal places are rejected with INVALID_FEE_PERCENT (40466).

    four.meme tokens are not supported* — do not pass fee parameters when either side of the pair is a four.meme token.

    TradingApiQuoteAndBuildSwapTransaction

    fromTokenAddress: string

    Sell-token contract address.

    TradingApiQuoteAndBuildSwapTransaction

    fromTokenReferrerWalletAddress?: string

    Wallet address that receives the fee deducted from the sell token (FROM_TOKEN direction). Mutually exclusive with toTokenReferrerWalletAddress — providing both returns CONFLICT_REFERRER_PARAMS (40468). Address format depends on the chain: EVM chains require 0x + 40 hex chars; Solana (CT_501) requires a Base58 pubkey. An invalid format returns INVALID_REFERRER_ADDRESS (40467). Must be paired with feePercent.

    TradingApiQuoteAndBuildSwapTransaction

    Gas price tier. Defaults to "average".

    TradingApiQuoteAndBuildSwapTransaction

    gasLimit?: string

    Gas limit override (positive integer string). EVM only.

    TradingApiQuoteAndBuildSwapTransaction

    maxAutoSlippagePercent?: string

    Cap on auto-derived slippage (only applies when autoSlippage=true).

    TradingApiQuoteAndBuildSwapTransaction

    nonce?: string

    Unique request identifier for anti-replay; falls back to X-OC-SIGN if omitted.

    TradingApiQuoteAndBuildSwapTransaction

    priceImpactProtectionPercent?: string

    Maximum allowed price impact percentage (0–100). Defaults to 90; set to 100 to disable.

    TradingApiQuoteAndBuildSwapTransaction

    recvWindow?: number | bigint

    Allowed time deviation in milliseconds (default: 5000, max: 60000).

    TradingApiQuoteAndBuildSwapTransaction

    slippagePercent?: string

    Maximum slippage tolerance as a percentage string. Required unless autoSlippage=true.

    Range by chain:*

    • EVM chains (BSC, Ethereum, Base, etc.): 0 to 100 (inclusive)
    • Solana (CT_501): 0 to less than 100 (i.e. < 100)

    "0.5" means 0.5% maximum slippage. When autoSlippage=true this field is overridden by the auto-computed value.

    TradingApiQuoteAndBuildSwapTransaction

    tips?: string

    Solana only — Jito tips in SOL for MEV protection. Valid range [0.000000001, 2] (minimum 1 lamport). When specified, it is recommended to set computeUnitPrice=0. Applies only when binanceChainId=CT_501.

    TradingApiQuoteAndBuildSwapTransaction

    toTokenAddress: string

    Buy-token contract address.

    TradingApiQuoteAndBuildSwapTransaction

    toTokenReferrerWalletAddress?: string

    Wallet address that receives the fee deducted from the buy-token output (TO_TOKEN direction). Mutually exclusive with fromTokenReferrerWalletAddress — providing both returns CONFLICT_REFERRER_PARAMS (40468). Address format depends on the chain: EVM chains require 0x + 40 hex chars; Solana (CT_501) requires a Base58 pubkey. An invalid format returns INVALID_REFERRER_ADDRESS (40467). Must be paired with feePercent. On Solana, the referrer must already be activated (funded with some SOL) or the request returns REFERRER_NOT_ACTIVATED (40469).

    TradingApiQuoteAndBuildSwapTransaction

    userWalletAddress: string

    User wallet address (transaction sender). For Solana, a Base58 system-account address with sufficient SOL for gas.

    TradingApiQuoteAndBuildSwapTransaction

    vendor: LiquidMesh

    Swap vendor to use for this request. Required — case-sensitive; must match one of the enum values. Any other value returns PARAM_ERROR (40001). For multi-vendor aggregation, use /swap with a quoteId instead.

    TradingApiQuoteAndBuildSwapTransaction