For the complete documentation index, see llms.txt. This page is also available as Markdown.

Transaction Safety

Check prepared plans, approval spenders, deadlines and transaction outcomes.

Keep the complete prepared object and stop the workflow when validation fails. The checks below explain what each stage establishes and when a plan must be replaced.

What the SDK validates

Layer
What it establishes

Display quote

A route and estimated amounts from the service

PeachClient preparation and revalidation

Consistency of supported roles, addresses, chain, native/funding modes, calldata, hashes, deadlines and signatures across returned artifacts

Optional address pins

Response addresses match application configuration

Simulation

The exact transaction executes against the RPC state used for that call

On-chain execution

Contract-enforced authorization, validity, nonce and settlement rules

Successful mined receipt

The submitted transaction completed successfully

The SDK recovers the aggregator signature against the signer advertised in the response. This does not independently establish that the signer is authorized on-chain; the contract enforces signer authorization. For payer signatures, the SDK checks the supported length and matching bytes in calldata, not cryptographic ownership; Permit2 enforces signature validity on-chain.

In v0.5.0, the high-level SDK does not retain the original requested amount, slippage or relative deadline as independent request constraints for all later validations. Returned amounts and calldata are checked against response metadata. Review the available prepared terms and apply any stricter application limits. Direct preparation exposes signed transaction data immediately; Permit2 validates the built transaction against the prepared authorization and plan hash after payer signing. See Delegated Swaps for the signing boundary.

Approval spenders

Flow
ERC20 approval spender

Direct

prepared.approvalSpender, the Execution Router

Delegated

Canonical PERMIT2_ADDRESS

Native BNB input

No ERC20 approval

Send approve(spender, amount) to the input ERC20 contract, using the spender above. Never substitute the underlying router, an adapter, a pool or an earlier quote's address for that spender. Direct helper approvals are unlimited in this version. The delegated tutorial deliberately builds an exact-amount base approval.

An allowance read is not an approval transaction. A submitted approval hash is not a confirmed allowance. Await success and stop if confirmation fails. Tokens requiring an allowance reset need token-specific handling before retrying approval.

Deadlines and timeouts

Setting
Unit and behavior

deadlineSecs

Relative seconds requested from the service

execution.plan.deadline

Absolute Unix seconds

payerAuthorization.deadline

Absolute Unix seconds

Pass explicit deadlineSecs; the tutorials use 300. The exported DEFAULT_DEADLINE_SECONDS constant is not automatically applied by execution preparation serialization. Omitted execution settings are left to the service.

The SDK checks expiry during validation, including authorization and build. The short examples also check the signed deadline before final submission. A plan may still expire while a wallet prompt is open or before mining. Synchronize the client clock and prepare again when validity is insufficient.

HTTP and wallet-send timeouts have different effects. See Client Configuration for timeout settings and recovery after an uncertain send.

When to prepare again

Preserve raw, execution, the transaction and, for delegated builds, prepared. Do not mutate fields, rebuild calldata from a quote, or extend a deadline by editing JSON.

Reprepare after changes to amount, tokens, routing filters, payer, executor, recipient, fees, slippage, deadline or native mode. For delegated mode, obtain a new signature; discarding a plan or preparing another does not revoke an earlier signature. Confirmed allowance can be reused only if it still covers the new input and spender.

Ignore stale responses after an order change. Refreshing needs new confirmation and, for Permit2, a new payer signature. Disable duplicate submission and follow Client Configuration before retrying an uncertain send.

Last updated

Was this helpful?