Binance Connector JS
    Preparing search index...
    Index

    Constructors

    Methods

    • Move funds from the user's bound CeDeFi MPC wallet to their CEX account (SPOT/FUNDING) via a contract escrow + credit flow. The maker wallet is resolved server-side by userId; the caller does not pass wallet or signature.

      Weight(IP): 1

      Security Type: PREDICTION_TRADE

      Notes:

      • Restricted to authorized market makers. Requests from unauthorized accounts are rejected — contact BD to request access.
      • "Note on fromToken / toToken: typically the same symbol (e.g. both USDT). When they differ, the backend may attempt a swap, but cross-symbol conversion is not guaranteed for all pairs — prefer using the same symbol."

      Parameters

      Returns Promise<RestApiResponse<ApplyMmDepositResponse>>

    • Withdraw funds from the user's CEX account (SPOT/FUNDING) to their bound CeDeFi MPC wallet address. Unlike v1/capital/withdraw/apply, the caller does NOT pass address; the backend resolves the user's bound CeDeFi MPC wallet address by userId and reuses the existing capital withdraw flow with that address as the target.

      Weight(IP): 1

      Security Type: PREDICTION_TRADE

      Notes:

      • Restricted to authorized market makers. Requests from unauthorized accounts are rejected — contact BD to request access.
      • walletType Validation:
      Value Behavior
      null Allowed — defaults to SPOT
      0 Allowed — source = SPOT
      1 Allowed — source = FUNDING
      Other (e.g. 99) Rejected — returns validation error
      • "Note on field naming: this endpoint uses walletType (INT 0/1) for the source CEX account, while Apply MM Deposit uses accountType (STRING SPOT/FUNDING) for the target. The difference is intentional: withdraw reuses the existing v1/capital/withdraw/apply flow, which inherits that flow's integer walletType field."

      Parameters

      Returns Promise<RestApiResponse<ApplyMmWithdrawResponse>>

    • Cancel one or more active prediction orders in a single request. Requires SAS authorization.

      Known Issue — Bracket Encoding Incompatibility:* This endpoint uses indexed bracket notation (cancelInfoList[0].orderId). Binance SAPI signature verification runs over the raw, unencoded canonical string. However, mainstream HTTP libraries (Python requests, Java HttpURLConnection/URI, Go net/url, Node.js url) automatically percent-encode [ → %5B and ] → %5D, producing a signature mismatch with error -1022 Signature for this request is not valid. Postman is unaffected because it does not encode keys.

      Workarounds* (use low-level HTTP APIs that do not normalize URLs):

      • Python: use http.client (stdlib) and hand-build the body string.
      • Java: use HttpURLConnection and write the raw body bytes directly.
      • Go: use strings.NewReader with a hand-built body instead of url.Values.Encode().

      Weight(IP): 1

      Security Type: PREDICTION_TRADE

      Notes:

      • Use dot notation for nested list fields: cancelInfoList[0].orderId, cancelInfoList[1].orderId, etc.
      • vendor does not need to be supplied. The server automatically sets the correct vendor (predict_fun) for every item in the batch.

      Parameters

      Returns Promise<RestApiResponse<BatchCancelOrdersResponse>>

    • Create an OTC blocktrade as the maker (BID to buy outcome shares with USDT, or ASK to sell outcome shares for USDT). The maker wallet is resolved server-side by userId; signing is done server-side via SAS typedDataSign. Returns orderId and a one-time secretToken to share out-of-band with the intended taker.

      Weight(IP): 200

      Security Type: PREDICTION_TRADE

      Notes:

      • Restricted to authorized market makers. Requests from unauthorized accounts are rejected — contact BD to request access.
      • Side & Amount Rules:
      side makerAmount takerAmount
      BUY USDT (wei) shares (wei)
      SELL shares (wei) USDT (wei)
      • "Note on side encoding: this request uses a string enum (BUY/SELL). Responses from Get Blocktrade Detail / Preview / List return side as an integer and also include a quoteType string — both encode the same concept."
      Request side Response side (Integer) Response quoteType
      BUY 0 "Bid"
      SELL 1 "Ask"

      Parameters

      Returns Promise<RestApiResponse<CreateOtcBlocktradeResponse>>

    • Get full details for a specific prediction market topic, including variant data and timeline.

      Weight(IP): 1

      Response Notes:

      • status is a case-sensitive string. REGISTERED: registered and not yet resolved, this value alone does not guarantee that trading is available. RESOLVED: the outcome has been determined, it does not mean that the user has already claimed the payout. PAUSED: trading is temporarily suspended and may resume. CLOSED: closed for display, for example the end time has passed or the market was removed, it does not guarantee that trading is closed.
      • markets[].tradingStatus shows whether new orders may be attempted. OPEN: new orders may be attempted, this is the only value that allows new orders. MATCHING_NOT_ENABLED: order matching is not enabled. CANCEL_ONLY: only cancellation is allowed. CLOSED: trading has stopped. Use markets[].tradingStatus, not status, to decide whether to place an order, because a market whose status is CLOSED can still have tradingStatus OPEN. A topic can contain several markets and an order is placed on one market, so only the tradingStatus of that market matters. A successful quote does not guarantee that an order is accepted or filled.
      • outcomes[].winner is returned only after the market is resolved. There is no separate cancelled, invalid or refunded status. A resolved market can pay more than one outcome, in that case several outcomes have winner set to true and price is the settled value per share, for example 0.5 for each of two outcomes.

      Parameters

      Returns Promise<RestApiResponse<GetMarketDetailResponse>>

    • Query PredictFun reserved balances for the caller's bound wallet — these are funds locked by the caller's open OTC blocktrade orders (maker BID locks USDT, maker ASK locks shares). Not tied to a specific blocktrade id; the path nesting under otc/blocktrade reflects the cause of the lock, not a per-order query. Returns one entry per requested asset, aligned with the request order. Pass {type:"USDT"} for reserved USDT, or {type:"SHARE", tokenId:"..."} for a specific outcome token's reserved shares.

      Weight(IP): 200

      Security Type: PREDICTION_TRADE

      Notes:

      • Restricted to authorized market makers. Requests from unauthorized accounts are rejected — contact BD to request access.
      • AssetQuery:
      Name Type Mandatory Description
      type STRING YES Asset type. Enum: USDT, SHARE
      tokenId STRING NO Outcome token id (present for SHARE entries only)

      Parameters

      Returns Promise<RestApiResponse<GetOtcReservedBalancesResponse>>

    • Get a price quote for a prediction order. The returned quoteId must be used in the subsequent Place Order request.

      Weight(IP): 1

      Security Type: PREDICTION_TRADE

      Response Notes:

      • feeAmount is a string because it is denominated in wei (18 decimals) and may exceed JavaScript's safe integer range. feeDiscountBps is also a string to allow fractional basis-point values in the future. feeRateBps and slippageBps are integers and will never exceed safe integer bounds.
      • Minimum order amount: The minimum order amount is set by the server and the upstream market rules and may change, so no fixed value is documented. BUY orders are checked by amount (amountIn) and SELL orders by share quantity, for both MARKET and LIMIT orders. If the amountIn of a BUY order is below the minimum, the server returns -9000 with the message Your order amount is too small. A successful quote does not guarantee that the order is accepted or filled, so check the error message and the final order status.

      Parameters

      Returns Promise<RestApiResponse<GetQuoteResponse>>

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