# How It Works

Applications request a quote, verify or submit approvals, build the final transaction, and execute it through a wallet callback. This separation ensures consistent pricing discovery before commitment and reduces integration complexity for developers building on City Protocol.

{% stepper %}
{% step %}

#### **Quote**

The application submits a quote request via `getQuote`. The call is read-only, returning expected output, price impact, and routing details without committing to any state change.
{% endstep %}

{% step %}

#### **Approval**

The SDK invokes `checkApprovals` to verify the token allowance. If insufficient, `getApproveTransaction` returns the ERC-20 approval calldata ready for signing.
{% endstep %}

{% step %}

#### **Build:**&#x20;

The SDK calls `buildSwap` to fetch the aggregator's swap transaction payload, applying the selected slippage tolerance and gas level.
{% endstep %}

{% step %}

#### **Execute**

The application triggers the final transaction through the `executeTransaction` callback, which signs and broadcasts via the user's wallet, relayer, or abstraction layer.
{% endstep %}
{% endstepper %}


---

# 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/neofinance-as-a-service/swap-module/how-it-works.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.
