Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c6080de
Add wallet integration doc
its-everdred Nov 6, 2025
12698f3
coming soon guides
its-everdred Nov 6, 2025
5d24e10
Add wallet provider images and details
its-everdred Nov 7, 2025
9c2fe06
Add actions-sdk docs generation script
its-everdred Nov 7, 2025
f3660c8
include class description in generated docs
its-everdred Nov 7, 2025
eaf51d5
fix multi-line param descriptions
its-everdred Nov 7, 2025
9b18a73
add methods table with links
its-everdred Nov 7, 2025
362895c
remove dash prefix from param descriptions
its-everdred Nov 7, 2025
5cd8886
use bold links in methods table
its-everdred Nov 7, 2025
51cc6e7
Add wallet class docs generation
its-everdred Nov 7, 2025
9d880ba
Separate namespaces and properties sections
its-everdred Nov 7, 2025
bd3f5a6
Add wallet definitions reference page
its-everdred Nov 7, 2025
2ab882f
Fix frontmatter in wallet definitions
its-everdred Nov 7, 2025
e16485c
Add Lend Documentation and rename to Wallet Documentation
its-everdred Nov 7, 2025
05beaa6
Add WalletLendNamespace to lend documentation
its-everdred Nov 7, 2025
7943a9e
Add more details to wallet docs
its-everdred Nov 7, 2025
2eb074e
Add GitHub source links to function docs
its-everdred Nov 7, 2025
652f5f0
Use version tags for GitHub source links
its-everdred Nov 7, 2025
d29ac49
Use empty string instead of unknown for types
its-everdred Nov 7, 2025
faa1819
Reorder Actions SDK navigation pages
its-everdred Nov 7, 2025
eaeb779
Add wallet provider tabs
its-everdred Nov 8, 2025
ac1c377
Add lend provider tabs
its-everdred Nov 8, 2025
d2f01b4
Add asset configuration step
its-everdred Nov 8, 2025
61568d1
Add chain configuration step
its-everdred Nov 8, 2025
de38081
Add market configuration step
its-everdred Nov 8, 2025
b8a67e3
Reorder steps and add initialization
its-everdred Nov 8, 2025
e0de38c
Add filenames to code blocks
its-everdred Nov 8, 2025
5871427
Add details to config.
its-everdred Nov 8, 2025
1c35388
Replace config examples with link to guide
its-everdred Nov 8, 2025
5691036
Remove supporting assets and chains pages
its-everdred Nov 8, 2025
83d6b7e
Remove empty backticks from type columns
its-everdred Nov 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 19 additions & 120 deletions app-developers/quickstarts/actions.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
title: Integrating DeFi with Actions SDK
description: Perform DeFi actions with lightweight, composable, and type-safe modules.

Check warning on line 3 in app-developers/quickstarts/actions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (optimism-373f39ad) - vale-spellcheck

app-developers/quickstarts/actions.mdx#L3

Did you really mean 'composable'?
---

<Warning>
Actions SDK is still under construction and not ready for production use! This guide is meant for early testing purposes only.
Actions SDK is still under construction and not ready for production use! This
guide is meant for early testing purposes only.
</Warning>

The [Actions SDK](https://actions.money/) is an open source Typescript development toolkit that simplifies the act of integrating DeFi into your application.
Expand All @@ -21,18 +22,17 @@

- **Customize assets & chains**: Allow and block assets, markets, chains, and protocols from your application from a single config.


## Installation

Install the Actions SDK in your project:

<CodeGroup>
```bash npm
npm install @eth-optimism/actions-sdk

Check warning on line 31 in app-developers/quickstarts/actions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (optimism-373f39ad) - vale-spellcheck

app-developers/quickstarts/actions.mdx#L31

Did you really mean 'npm'?
```

```bash pnpm
pnpm add @eth-optimism/actions-sdk

Check warning on line 35 in app-developers/quickstarts/actions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (optimism-373f39ad) - vale-spellcheck

app-developers/quickstarts/actions.mdx#L35

Did you really mean 'npm'?
```

```bash yarn
Expand All @@ -46,6 +46,7 @@
```bash deno
deno add @eth-optimism/actions-sdk
```

</CodeGroup>

## Choose a Wallet Provider
Expand Down Expand Up @@ -225,6 +226,7 @@
```
</Tab>
</Tabs>

</Tab>

<Tab title="Backend">
Expand Down Expand Up @@ -369,162 +371,59 @@
```
</Tab>
</Tabs>

</Tab>
</Tabs>

## Create your ActionsConfig

Create your Actions configuration to define which protocols, chains, and assets to support.

Configure a wallet provider:

```typescript
import type { WalletConfig } from '@eth-optimism/actions-sdk'

const walletConfig: WalletConfig = {
hostedWalletConfig: {
provider: {
type: 'privy', // your provider chosen in previous step
},
},
smartWalletConfig: {
provider: {
type: 'default',
attributionSuffix: 'actions',
},
},
}
```

Configure a lend provider with `LendConfig`:

```typescript
import type { LendConfig } from '@eth-optimism/actions-sdk'
import { USDC, ETH, WBTC } from '@eth-optimism/actions-sdk/assets'
import { USDCMorphoMarket } from './actions/markets'

const lendConfig: LendConfig = {
type: 'morpho',
assetAllowlist: [USDC, ETH, WBTC],
assetBlocklist: [],
marketAllowlist: [USDCMorphoMarket],
marketBlocklist: [],
}
```

Configure a borrow provider with `BorrowConfig`:

```typescript
import type { BorrowConfig } from '@eth-optimism/actions-sdk'
import { USDC, ETH, WBTC } from '@eth-optimism/actions-sdk/assets'
import { USDCMorphoMarket } from './actions/markets'

const borrowConfig: BorrowConfig = {
type: 'morpho',
assetAllowlist: [USDC, ETH, WBTC],
assetBlocklist: [],
marketAllowlist: [USDCMorphoMarket],
marketBlocklist: [],
}
```

Configure a swap provider with `SwapConfig`:

```typescript
import type { SwapConfig } from '@eth-optimism/actions-sdk'
import { USDC, ETH, WBTC } from '@eth-optimism/actions-sdk/assets'

const swapConfig: SwapConfig = {
type: 'uniswap',
defaultSlippage: 100, // 100 bips or 1%
assetAllowList: [USDC, ETH, WBTC],
assetBlocklist: [],
}
```

Configure supported chains:

```typescript
import { optimism, base } from 'viem/chains'

// Define any EVM chain
const OPTIMISM = {
chainId: optimism.id,
rpcUrls: env.OPTIMISM_RPC_URL,
bundler: { // Bundle and sponsor txs with a gas paymaster
type: 'simple' as const,
url: env.OPTIMISM_BUNDLER_URL,
},
}

const BASE = {
chainId: base.id,
rpcUrls: env.BASE_RPC_URL,
bundler: { // Bundle and sponsor txs with a gas paymaster
type: 'simple' as const,
url: env.BASE_BUNDLER_URL,
},
}

const chains = [OPTIMISM, BASE]
```

Finally, bring it all together and initialize Actions:

```typescript
export const actions = createActions({
wallet: walletConfig,
lend: lendConfig,
borrow: borrowConfig,
swap: swapConfig,
chains,
})
```
Follow the [Configuring Actions](/app-developers/reference/actions/configuring-actions) guide to define which protocols, chains, and assets to support.

## Using Actions
## Take Action

Once configured, you can use Actions to perform DeFi operations:

```typescript
import { USDC, ETH, USDT } from '@eth-optimism/actions-sdk/assets'
import { ExampleMarket } from '@/actions/markets'
import { USDC, ETH, USDT } from "@eth-optimism/actions-sdk/assets";
import { ExampleMarket } from "@/actions/markets";

// Enable asset lending in DeFi
const lendReceipt = await wallet.lend.openPosition({
amount: 1,
asset: USDC,
...ExampleMarket
})
...ExampleMarket,
});

// Manage user market positions
const lendPosition = await wallet.lend.getPosition(market)
const lendPosition = await wallet.lend.getPosition(market);

// Fetch wallet balance
const balance = await wallet.getBalance()
const balance = await wallet.getBalance();

// ⚠️ COMING SOON
const borrowReceipt = await wallet.borrow.openPosition({
amount: 1,
asset: USDT,
...market
})
...market,
});

// ⚠️ COMING SOON
const swapReceipt = await wallet.swap.execute({
amountIn: 1,
assetIn: USDC,
assetOut: ETH,
})
});

// ⚠️ COMING SOON
const sendReceipt = await wallet.send({
amount: 1,
asset: USDC,
to: 'vitalik.eth',
})
to: "vitalik.eth",
});
```

## Next Steps

- [Continue reading](/app-developers/reference/actions/configuring-actions) the Actions SDK documentation.
- Check out the [Actions demo](https://actions.money/earn) for a complete example application
- Join the [Optimism Discord](https://discord.optimism.io) for support and updates
Loading