> For the complete documentation index, see [llms.txt](https://andrewkimjoseph.gitbook.io/celina-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://andrewkimjoseph.gitbook.io/celina-sdk/services/uniswapservice.md).

# UniswapService

[**@andrewkimjoseph/celina-sdk**](/celina-sdk/api-reference/api-reference.md)

***

[@andrewkimjoseph/celina-sdk](/celina-sdk/api-reference/api-reference.md) / [services/uniswap.service](https://github.com/andrewkimjoseph/celina-sdk/blob/main/docs/api-reference/services/uniswap.service/README.md) / UniswapService

## Class: UniswapService

Defined in: [src/services/uniswap.service.ts:95](https://github.com/andrewkimjoseph/celina-sdk/blob/970ab720c805303ead8b20406c6579ecdcf2193a/src/services/uniswap.service.ts#L95)

Uniswap v4 quotes, gas estimates, and `prepareSwap` flows on Celo mainnet.

### Constructors

#### Constructor

> **new UniswapService**(`clientFactory`): `UniswapService`

Defined in: [src/services/uniswap.service.ts:98](https://github.com/andrewkimjoseph/celina-sdk/blob/970ab720c805303ead8b20406c6579ecdcf2193a/src/services/uniswap.service.ts#L98)

**Parameters**

**clientFactory**

`CeloClientFactory`

**Returns**

`UniswapService`

### Methods

#### estimateSwap()

> **estimateSwap**(`from`, `tokenIn`, `tokenOut`, `amount`, `params?`): `Promise`<{ `amountIn`: `string`; `amountOutMin`: `string`; `approvalGas`: `string`\[]; `approvalStepsNeeded`: `number`; `deadline`: `string`; `deadlineMinutes`: `number`; `expectedOut`: `string`; `from`: `` `0x${string}` ``; `indexSource`: `string` | `undefined`; `network`: `"mainnet"`; `protocol`: `"uniswap_v4"`; `recipient`: `` `0x${string}` ``; `routeHops`: `number`; `slippageTolerance`: `number`; `swapGas`: `string` | `undefined`; `swapGasEstimated`: `boolean`; `tokenIn`: `string`; `tokenOut`: `string`; }>

Defined in: [src/services/uniswap.service.ts:428](https://github.com/andrewkimjoseph/celina-sdk/blob/970ab720c805303ead8b20406c6579ecdcf2193a/src/services/uniswap.service.ts#L428)

Simulate gas for a Uniswap v4 swap from `from`, including Permit2 approvals when needed.

**Parameters**

**from**

`` `0x${string}` ``

Sender wallet address

**tokenIn**

`string`

Input token symbol or address

**tokenOut**

`string`

Output token symbol or address

**amount**

`string`

Human-readable input amount

**params?**

[`UniswapSwapParams`](/celina-sdk/types/uniswapswapparams.md)

Optional slippage, deadline, and recipient

**Returns**

`Promise`<{ `amountIn`: `string`; `amountOutMin`: `string`; `approvalGas`: `string`\[]; `approvalStepsNeeded`: `number`; `deadline`: `string`; `deadlineMinutes`: `number`; `expectedOut`: `string`; `from`: `` `0x${string}` ``; `indexSource`: `string` | `undefined`; `network`: `"mainnet"`; `protocol`: `"uniswap_v4"`; `recipient`: `` `0x${string}` ``; `routeHops`: `number`; `slippageTolerance`: `number`; `swapGas`: `string` | `undefined`; `swapGasEstimated`: `boolean`; `tokenIn`: `string`; `tokenOut`: `string`; }>

***

#### getSwapQuote()

> **getSwapQuote**(`tokenIn`, `tokenOut`, `amount`, `_from?`): `Promise`<{ `amountIn`: `string`; `expectedOut`: `string`; `indexSource`: `string` | `undefined`; `network`: `"mainnet"`; `protocol`: `"uniswap_v4"`; `route`: { `pools`: `UniswapPoolKey`\[]; }; `routeHops`: `number`; `tokenIn`: `string`; `tokenOut`: `string`; }>

Defined in: [src/services/uniswap.service.ts:394](https://github.com/andrewkimjoseph/celina-sdk/blob/970ab720c805303ead8b20406c6579ecdcf2193a/src/services/uniswap.service.ts#L394)

Expected Uniswap v4 output for a token pair — no wallet required.

**Parameters**

**tokenIn**

`string`

Input token symbol or address

**tokenOut**

`string`

Output token symbol or address

**amount**

`string`

Human-readable input amount

**\_from?**

`` `0x${string}` ``

Deprecated; ignored. Balance checks run on prepare/estimate only.

**Returns**

`Promise`<{ `amountIn`: `string`; `expectedOut`: `string`; `indexSource`: `string` | `undefined`; `network`: `"mainnet"`; `protocol`: `"uniswap_v4"`; `route`: { `pools`: `UniswapPoolKey`\[]; }; `routeHops`: `number`; `tokenIn`: `string`; `tokenOut`: `string`; }>

***

#### prepareSwap()

> **prepareSwap**(`from`, `tokenIn`, `tokenOut`, `amount`, `params?`): `Promise`<[`SerializedPreparedFlow`](/celina-sdk/types/serializedpreparedflow.md)>

Defined in: [src/services/uniswap.service.ts:520](https://github.com/andrewkimjoseph/celina-sdk/blob/970ab720c805303ead8b20406c6579ecdcf2193a/src/services/uniswap.service.ts#L520)

Build unsigned Uniswap v4 steps (ERC-20 approve → Permit2 approve → swap when needed).

**Parameters**

**from**

`` `0x${string}` ``

Sender wallet address

**tokenIn**

`string`

Input token symbol or address

**tokenOut**

`string`

Output token symbol or address

**amount**

`string`

Human-readable input amount

**params?**

[`UniswapSwapParams`](/celina-sdk/types/uniswapswapparams.md)

Optional slippage, deadline, and recipient

**Returns**

`Promise`<[`SerializedPreparedFlow`](/celina-sdk/types/serializedpreparedflow.md)>

1–3 step `SerializedPreparedFlow` for sequential wallet signing


---

# 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 dynamically by asking a question.

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

```
GET https://andrewkimjoseph.gitbook.io/celina-sdk/services/uniswapservice.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.
