# Common Frontend Flows

#### Standard EVM Swap Flow

1. Call `swapClient.getQuote(...)` to display expected output, price impact, and route in the UI.
2. When the user confirms, call `swapClient.checkApprovals(...)` to determine whether an approval is required.
3. If allowance is insufficient, prompt approval using the payload from `getApproveTransaction(...)`.
4. Call `swapClient.buildSwap(...)` and forward the resulting transaction to the wallet for signing and broadcasting.

#### Managed One-Shot Flow

1. Implement an `executeTransaction` callback that wraps your wallet or relayer.
2. Call `swapClient.executeSwap(...)` with the trade parameters and callback.
3. The SDK handles approval lookup, stale-allowance revocation, swap building, and final execution, returning both `approveTxHash` (if any) and `swapTxHash`.

#### Solana Swap Flow

For Solana-based chains, swap execution passes through the `unsignedTx` field, with `jitoUnsignedTx` available as an optional MEV-protected variant. Your `executeTransaction` callback is responsible for signing and submitting the correct transaction variant based on the user's preference.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://city-protocol.gitbook.io/docs/software-development-kit/swap/common-frontend-flows.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
