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

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

```
GET https://docs.enzyme.finance/enzyme-blue-sdk/examples/uniswap-trade.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
