> For the complete documentation index, see [llms.txt](https://docs.enzyme.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.enzyme.finance/enzyme-blue-sdk/examples/uniswap-trade.md).

# Swap Tokens on Uniswap

{% hint style="info" %}
Swapping tokens on Uniswap likely requires some interaction with the [Uniswap SDK](https://uniswap.org/docs/v2/javascript-SDK/quick-start/) in order to generate the `path` and `assetAmount`parameters shown below.&#x20;
{% endhint %}

```typescript
import {  
		callOnIntegrationArgs, 
		uniswapV2TakeOrderArgs, 
		IntegrationManagerActionId,
		takeOrderSelector, 
		ComptrollerLib 
} from '@enzymefinance/protocol';

// create a local signer connected to your chosen Ethereum node
const provider = providers.StaticJsonRpcProvider(ethNodeAddress, ethNetwork); 
const signer = new Wallet(managerEthPrivateKey, provider);

// the address of the adapter for the extension you wish to use
const uniswapV2Adapter = '0x23sdfsn...'; // for example only

// the address of the protocol release's integration manager contract
const integrationManagerAddress = '0x32sdf...'; // for example only

// the address of your vault's comptroller
const comptrollerAddress = '0x8syweo...'; // for example only

// assemble the arguments for the integration
const takeOrderArgs = uniswapV2TakeOrderArgs({
      path: aPath, // for example only
      minIncomingAssetAmount: aMinIncomingAssetAmount, // for example only
      outgoingAssetAmount: anOutgoingAssetAmount, // for example only
});

// assemble and encode the arguments for callOnExtension()
const callArgs = callOnIntegrationArgs({
      adapter: uniswapV2Adapter,
      selector: takeOrderSelector,
      encodedCallArgs: takeOrderArgs,
});

// instantiate your comptroller
const vaultComptroller = new ComptrollerLib(comptrollerAddress, signer);

const swapTx = vaultComptroller.callOnExtension.args(
		integrationManagerAddress, 
		IntegrationManagerActionId.CallOnIntegration, 
		callArgs
);

const swapTxReceipt = await swapTx.send();

console.log('Pending transaction:', swapTxReceipt.transactionHash);
console.log('Transaction included in block number:', swapTxReceipt.blockNumber);

```


---

# 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.enzyme.finance/enzyme-blue-sdk/examples/uniswap-trade.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.
