> For the complete documentation index, see [llms.txt](https://docs.peach.ag/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.peach.ag/documentation/bsc/aggregator/editor/validation-approvals-and-expiry.md).

# 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](https://docs.peach.ag/documentation/bsc/aggregator/editor/delegated-execution-with-permit2-witness) 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](https://docs.peach.ag/documentation/bsc/aggregator/editor/configuration-and-error-handling#timeouts-and-retries) 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](https://docs.peach.ag/documentation/bsc/aggregator/editor/configuration-and-error-handling#timeouts-and-retries) before retrying an uncertain send.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.peach.ag/documentation/bsc/aggregator/editor/validation-approvals-and-expiry.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
