Binance Web3 Connector JS
    Preparing search index...

    TradingApi - interface TradingApi

    interface TradingApiInterface {
        buildSolanaSwapInstructions(
            requestParameters: BuildSolanaSwapInstructionsRequest,
        ): Promise<RestApiResponse<BuildSolanaSwapInstructionsResponse>>;
        buildSwapTransaction(
            requestParameters: BuildSwapTransactionRequest,
        ): Promise<RestApiResponse<BuildSwapTransactionResponse>>;
        getAggregatedQuote(
            requestParameters: GetAggregatedQuoteRequest,
        ): Promise<RestApiResponse<GetAggregatedQuoteResponse>>;
        getAggregatorSupportedChains(
            requestParameters?: GetAggregatorSupportedChainsRequest,
        ): Promise<RestApiResponse<GetAggregatorSupportedChainsResponse>>;
        getErc20ApproveTransaction(
            requestParameters: GetErc20ApproveTransactionRequest,
        ): Promise<RestApiResponse<GetErc20ApproveTransactionResponse>>;
        getRfqOrderStatus(
            requestParameters: GetRfqOrderStatusRequest,
        ): Promise<RestApiResponse<GetRfqOrderStatusResponse>>;
        getTransactionStatus(
            requestParameters: GetTransactionStatusRequest,
        ): Promise<RestApiResponse<GetTransactionStatusResponse>>;
        quoteAndBuildSwapTransaction(
            requestParameters: QuoteAndBuildSwapTransactionRequest,
        ): Promise<RestApiResponse<QuoteAndBuildSwapTransactionResponse>>;
        submitRfqOrder(
            requestParameters: SubmitRfqOrderRequest,
        ): Promise<RestApiResponse<SubmitRfqOrderResponse>>;
    }

    Implemented by

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

      TradingApiInterface

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

      TradingApiInterface