> For the complete documentation index, see [llms.txt](https://docs.mento.org/mento-v3/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mento.org/mento-v3/build/mento-sdk/guides/getting-a-quote.md).

# Getting a Quote

This guide shows how to get a **swap quote** with the Mento SDK v3. Quotes use **FPMM pools** and the router (oracle-priced, fee-adjusted). You can quote “amount out” for a given “amount in,” or “amount in” for a desired “amount out.”

***

## Create the client

```typescript
import { Mento, ChainId } from '@mento-protocol/mento-sdk'
import { parseUnits, formatUnits } from 'viem'

const mento = await Mento.create(ChainId.CELO)
```

***

## Quote: amount out (given amount in)

You have an **amount in** and want to know how much of the other token you will receive:

```typescript
const USDm = '0x765DE816845861e75A25fCA122bb6898B8B1282a'
const CELO = '0x471EcE3750Da237f93B8E339c536989b8978a438'

const amountIn = parseUnits('100', 18)
const expectedOut = await mento.quotes.getAmountOut(USDm, CELO, amountIn)

console.log(`Expected out: ~${formatUnits(expectedOut, 18)} CELO for 100 USDm`)
```

Parameter order is **tokenIn, tokenOut, amountIn**. The SDK resolves the route (including multi-hop if needed) and returns the expected amount out.

***

## Quote: amount in (for exact amount out)

You want a specific **amount out** and need to know how much to send in:

```typescript
const amountOut = parseUnits('1', 18)
const amountInNeeded = await mento.quotes.getAmountIn(USDm, CELO, amountOut)

console.log(`Amount in needed: ~${formatUnits(amountInNeeded, 18)} USDm to get 1 CELO`)
```

Use this when the user specifies “I want exactly X of token B”; then use the returned amount (or a slightly higher value for slippage) as the input for building the swap.

***

## Trading status (optional)

Before quoting or swapping, you can check if the pair is tradable (circuit breaker and trading limits):

```typescript
const isTradable = await mento.trading.isPairTradable(USDm, CELO)
if (!isTradable) {
  console.log('Pair is not tradable (circuit breaker or limits)')
}
```

***

Runnable examples: [mento-sdk-examples](https://github.com/mento-protocol/mento-sdk-examples). Next: [Initiating a swap](/mento-v3/build/mento-sdk/guides/initiating-a-swap.md).


---

# 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.mento.org/mento-v3/build/mento-sdk/guides/getting-a-quote.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.
