diff --git a/app-developers/guides/configuring-actions.mdx b/app-developers/guides/configuring-actions.mdx
index 5284e0216..906942555 100644
--- a/app-developers/guides/configuring-actions.mdx
+++ b/app-developers/guides/configuring-actions.mdx
@@ -215,6 +215,31 @@ Actions SDK lets you choose which assets, markets, chains, protocols, and provid
};
```
+
+
+ Configure which swap protocols you want to support. You can enable one or multiple providers:
+
+ ```typescript title="actions.ts"
+ // Additional config from previous steps...
+
+ import type { SwapConfig } from "@eth-optimism/actions-sdk";
+
+ const swapConfig: SwapConfig = {
+ uniswap: {
+ // Uniswap V3 configuration
+ enabled: true,
+ },
+ aerodrome: {
+ // Aerodrome (Base L2 optimized)
+ enabled: true,
+ },
+ velodrome: {
+ // Velodrome (Optimism L2 optimized)
+ enabled: true,
+ },
+ };
+ ```
+
Configure supported chains:
@@ -259,6 +284,7 @@ Actions SDK lets you choose which assets, markets, chains, protocols, and provid
wallet: walletConfig,
assets: assetsConfig,
lend: lendConfig,
+ swap: swapConfig,
chains,
});
```
@@ -273,7 +299,8 @@ Actions SDK lets you choose which assets, markets, chains, protocols, and provid
// Use actions anywhere in your app
const market = await actions.lend.getMarket({ ... });
const wallet = await actions.wallet.createSmartWallet({ ... });
- const receipt = await wallet.lend.openPosition({ ... });
+ const lendReceipt = await wallet.lend.openPosition({ ... });
+ const swapReceipt = await wallet.swap.execute({ ... });
```
diff --git a/app-developers/quickstarts/actions.mdx b/app-developers/quickstarts/actions.mdx
index 5df2bcf62..212c8cc48 100644
--- a/app-developers/quickstarts/actions.mdx
+++ b/app-developers/quickstarts/actions.mdx
@@ -410,6 +410,13 @@ const lendPosition = await wallet.lend.getPosition(market);
// Fetch wallet balance
const balance = await wallet.getBalance();
+// Swap tokens using Uniswap
+const swapReceipt = await wallet.swap.execute({
+ amountIn: 1,
+ assetIn: USDC,
+ assetOut: ETH,
+});
+
// ⚠️ COMING SOON
const borrowReceipt = await wallet.borrow.openPosition({
amount: 1,
@@ -417,13 +424,6 @@ const borrowReceipt = await wallet.borrow.openPosition({
...market,
});
-// ⚠️ COMING SOON
-const swapReceipt = await wallet.swap.execute({
- amountIn: 1,
- assetIn: USDC,
- assetOut: ETH,
-});
-
// ⚠️ COMING SOON
const sendReceipt = await wallet.send({
amount: 1,
@@ -432,6 +432,35 @@ const sendReceipt = await wallet.send({
});
```
+## Swap Tokens
+
+Actions SDK supports token swaps through multiple providers:
+
+```typescript
+import { USDC, ETH } from "@eth-optimism/actions-sdk/assets";
+
+// Get swap quote
+const quote = await wallet.swap.getQuote({
+ amountIn: 100,
+ assetIn: USDC,
+ assetOut: ETH,
+});
+
+// Execute swap
+const receipt = await wallet.swap.execute({
+ amountIn: 100,
+ assetIn: USDC,
+ assetOut: ETH,
+});
+```
+
+Supported swap providers:
+- **Uniswap V3**: Available on Ethereum mainnet and most L2s
+- **Aerodrome**: Optimized for Optimism (Base)
+- **Velodrome**: Optimized for Optimism
+
+See [Swap Documentation](/app-developers/reference/actions/swap-documentation) for full API reference.
+
## Next Steps
- [Configure Actions](/app-developers/guides/configuring-actions) to customize protocols, chains, and assets
diff --git a/app-developers/reference/actions/swap-documentation.mdx b/app-developers/reference/actions/swap-documentation.mdx
new file mode 100644
index 000000000..de1d72f43
--- /dev/null
+++ b/app-developers/reference/actions/swap-documentation.mdx
@@ -0,0 +1,9 @@
+---
+title: Swap Documentation
+description: API reference for Actions SDK swap operations, functions, and parameters.
+---
+
+import WalletSwapNamespace from "/snippets/actions/wallet-swap-namespace.mdx";
+
+{/* This component is generated by script: scripts/generate-actions-components.ts */}
+
diff --git a/docs.json b/docs.json
index c7ac1520b..cdd3bda5b 100644
--- a/docs.json
+++ b/docs.json
@@ -2204,7 +2204,8 @@
"pages": [
"app-developers/reference/actions/integrating-wallets",
"app-developers/reference/actions/wallet-definitions",
- "app-developers/reference/actions/lend-documentation"
+ "app-developers/reference/actions/lend-documentation",
+ "app-developers/reference/actions/swap-documentation"
]
},
{
diff --git a/scripts/generate-actions-components.ts b/scripts/generate-actions-components.ts
index 45a019692..79313f9f5 100644
--- a/scripts/generate-actions-components.ts
+++ b/scripts/generate-actions-components.ts
@@ -14,6 +14,7 @@ const ACTIONS_COMPONENTS: Record = {
WalletNamespace: "src/wallet/core/namespace/WalletNamespace.ts",
Wallet: "src/wallet/core/wallets/abstract/Wallet.ts",
WalletLendNamespace: "src/lend/namespaces/WalletLendNamespace.ts",
+ WalletSwapNamespace: "src/swap/namespaces/WalletSwapNamespace.ts",
};
// SDK metadata