Swap APIs & SDKs

Submit a PancakeSwap X candidate as a signed order

Execute a PancakeSwap X candidate through typed-data signing, order submission and status tracking rather than a normal router transaction.

A pcsx winner is a signable order. Its first external action after permission checks is a wallet signature over the documented typed data, followed by submission to the order service.

PancakeSwap's TypeScript example maps permitData into signTypedData and submits the candidate with its signature. The payload reference identifies encodedOrder and orderHash as distinct order artifacts.

Check before signing

Validate the chain, signing account, verifying contract, input amount, outputs and deadlines against the reviewed trade. Confirm the required token approval to the selected Permit2 deployment. A valid EIP-712 signature cannot compensate for missing token permission.

Retain the exact payload presented to the wallet. If a refreshed quote arrives during signing, the resulting signature remains attached to the older order. Do not copy it onto the replacement candidate.

Acceptance is not settlement

Submit the signed candidate using the documented interface and save its order hash. The response establishes an order handle, not a completed swap. Poll the corresponding status path and reconcile the settlement transaction once available.

Keep orderHash and transactionHash in separate fields. Using one generic hash property encourages the UI to create an explorer link for an off-chain order identifier that is not a blockchain transaction.

Failure fixtures

Test a rejected signature, expired candidate, missing Permit2 allowance, lost submission response and a terminal unfilled order. Each should retain enough state for its proper recovery. Never fall back from a failed order submission by sending encodedOrder as ordinary transaction calldata; that changes the execution model and is not a supported retry.

Sources & verification (2)

Source-check date is recorded in the article details. URLs are provided for manual verification. Use Copy to keep this page open.

  1. TypeScript examples

    Different approval and execution paths for agg and pcsx candidates

    https://developer.pancakeswap.finance/contracts/unified-swap-api/typescript
  2. Response payloads

    Candidate response shapes

    https://developer.pancakeswap.finance/contracts/unified-swap-api/payloads

Continue reading

Swap API integration: quote, approve, simulate, submit