Skip to main content
Actions SDK lets you choose which assets, markets, chains, protocols, and providers you want to support, and not support in your application via configuration file.
1

Install Actions SDK

Follow the quickstart guide to add Actions SDK as a dependency in your app.
2

Integrate an embedded wallet

Follow the integrating wallets guide, choose and install a Wallet Provider.
3

Create an config file

actions.ts - An accessible file that holds all of your configuration preference.
4

Configure a Wallet Provider

Let Actions SDK know which Wallet Provider you’ve chosen:
  • Privy
  • Turnkey
  • Dynamic
actions.ts
import type { WalletConfig } from "@eth-optimism/actions-sdk";

const walletConfig: WalletConfig = {
  hostedWalletConfig: {
    provider: {
      type: "privy",
    },
  },
  smartWalletConfig: {
    provider: {
      type: "default",
      attributionSuffix: "actions",
    },
  },
};
5

Configure supported assets

Configure which assets you want to support:
actions.ts
// Additional config from previous steps...

// Import popular assets
import { USDC } from '@eth-optimism/actions-sdk/assets'

// Or define custom assets
import type { Asset } from "@eth-optimism/actions-sdk";

export const CustomToken: Asset = {
  address: {
    [mainnet.id]: '0x123...',
    [unichain.id]: '0x456...',
    [baseSepolia.id]: '0x789...',
  },
  metadata: {
    decimals: 6,
    name: 'Custom Token',
    symbol: 'CUSTOM',
  },
  type: 'erc20',
}
6

Configure Markets

Define which markets you want to support or block within your app:
actions.ts
// Additional config from previous steps...

export const GauntletUSDC: LendMarketConfig = {
  address: '0xabc...',
  chainId: unichain.id,
  name: 'Gauntlet USDC',
  asset: USDC,
  lendProvider: 'morpho',
}
7

Configure a Lend Provider

Configure which lend protocol you want to support:
  • Morpho
  • Aave
actions.ts
// Additional config from previous steps...

import type { LendConfig } from "@eth-optimism/actions-sdk";

const lendConfig: LendConfig = {
  type: "morpho",
  assetAllowlist: [USDC, CustomToken],
  assetBlocklist: [],
  marketAllowlist: [GauntletUSDC],
  marketBlocklist: [],
};
8

Configure supported chains

Configure supported chains:
actions.ts
// Additional config from previous steps...

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];
9

Initialize Actions

Finally bring it all together and initialize Actions:
actions.ts
// Additional config from previous steps...

export const actions = createActions({
  wallet: walletConfig,
  lend: lendConfig,
  chains,
});
10

Take Action

Once you’ve initialized your actions instance, import it anywhere you need to take action:
import { actions } from './actions';

// Use actions anywhere in your app
const market = await actions.lend.getMarket({ ... });
const wallet = await actions.wallet.createSmartWallet({ ... });
const receipt = await wallet.lend.openPosition({ ... });