-
Notifications
You must be signed in to change notification settings - Fork 305
Add Actions SDK Reference Pages #1857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
c6080de
Add wallet integration doc
its-everdred 12698f3
coming soon guides
its-everdred 5d24e10
Add wallet provider images and details
its-everdred 9c2fe06
Add actions-sdk docs generation script
its-everdred f3660c8
include class description in generated docs
its-everdred eaf51d5
fix multi-line param descriptions
its-everdred 9b18a73
add methods table with links
its-everdred 362895c
remove dash prefix from param descriptions
its-everdred 5cd8886
use bold links in methods table
its-everdred 51cc6e7
Add wallet class docs generation
its-everdred 9d880ba
Separate namespaces and properties sections
its-everdred bd3f5a6
Add wallet definitions reference page
its-everdred 2ab882f
Fix frontmatter in wallet definitions
its-everdred e16485c
Add Lend Documentation and rename to Wallet Documentation
its-everdred 05beaa6
Add WalletLendNamespace to lend documentation
its-everdred 7943a9e
Add more details to wallet docs
its-everdred 2eb074e
Add GitHub source links to function docs
its-everdred 652f5f0
Use version tags for GitHub source links
its-everdred d29ac49
Use empty string instead of unknown for types
its-everdred faa1819
Reorder Actions SDK navigation pages
its-everdred eaeb779
Add wallet provider tabs
its-everdred ac1c377
Add lend provider tabs
its-everdred d2f01b4
Add asset configuration step
its-everdred 61568d1
Add chain configuration step
its-everdred de38081
Add market configuration step
its-everdred b8a67e3
Reorder steps and add initialization
its-everdred e0de38c
Add filenames to code blocks
its-everdred 5871427
Add details to config.
its-everdred 1c35388
Replace config examples with link to guide
its-everdred 5691036
Remove supporting assets and chains pages
its-everdred 83d6b7e
Remove empty backticks from type columns
its-everdred 4da643d
Fix transparent card icon backgrounds
its-everdred 8c203fd
Add type tooltips and populate subtypes
its-everdred 3fb39e6
remove tooltip code
its-everdred 5c8eab3
Refactor component generation script
its-everdred 3ef01a5
Generate docs from 0.0.4
its-everdred 8727f2a
Update app-developers/reference/actions/integrating-wallets.mdx
its-everdred ebc8cf6
Move doc to guides, add Source in links
its-everdred 1b33b64
Fix multiline table descriptions
its-everdred File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,231 @@ | ||
| --- | ||
| title: Configuring Actions | ||
| description: Learn how to configure Actions SDK for your application. | ||
| --- | ||
|
|
||
| Actions SDK lets you choose which assets, markets, chains, protocols, and providers you want to support in your application via configuration file. | ||
|
|
||
| <Steps> | ||
| <Step title="Install Actions SDK"> | ||
| Follow the | ||
| [quickstart](/app-developers/quickstarts/actions) guide to | ||
| add Actions SDK as a dependency in your app. | ||
| </Step> | ||
| <Step title="Integrate an embedded wallet"> | ||
| Follow the [integrating | ||
| wallets](/app-developers/quickstarts/actions#choose-a-wallet-provider) guide, | ||
| choose and install a Wallet Provider. | ||
| </Step> | ||
| <Step title="Create a config file"> | ||
| `actions.ts` - An accessible file that holds all of your configuration preference. | ||
| </Step> | ||
| <Step title="Configure a Wallet Provider"> | ||
| Let Actions SDK know which Wallet Provider you've chosen: | ||
|
|
||
| <Tabs> | ||
| <Tab title="Privy"> | ||
| ```typescript title="actions.ts" | ||
| import type { WalletConfig } from "@eth-optimism/actions-sdk"; | ||
|
|
||
| const walletConfig: WalletConfig = { | ||
| hostedWalletConfig: { | ||
| provider: { | ||
| type: "privy", | ||
| }, | ||
| }, | ||
| smartWalletConfig: { | ||
| provider: { | ||
| type: "default", | ||
| attributionSuffix: "actions", | ||
| }, | ||
| }, | ||
| }; | ||
| ``` | ||
| </Tab> | ||
| <Tab title="Turnkey"> | ||
| ```typescript title="actions.ts" | ||
| import type { WalletConfig } from "@eth-optimism/actions-sdk"; | ||
|
|
||
| const walletConfig: WalletConfig = { | ||
| hostedWalletConfig: { | ||
| provider: { | ||
| type: "turnkey", | ||
| }, | ||
| }, | ||
| smartWalletConfig: { | ||
| provider: { | ||
| type: "default", | ||
| attributionSuffix: "actions", | ||
| }, | ||
| }, | ||
| }; | ||
| ``` | ||
| </Tab> | ||
| <Tab title="Dynamic"> | ||
| ```typescript title="actions.ts" | ||
| import type { WalletConfig } from "@eth-optimism/actions-sdk"; | ||
|
|
||
| const walletConfig: WalletConfig = { | ||
| hostedWalletConfig: { | ||
| provider: { | ||
| type: "dynamic", | ||
| }, | ||
| }, | ||
| smartWalletConfig: { | ||
| provider: { | ||
| type: "default", | ||
| attributionSuffix: "actions", | ||
| }, | ||
| }, | ||
| }; | ||
| ``` | ||
| </Tab> | ||
| </Tabs> | ||
|
|
||
| </Step> | ||
| <Step title="Configure supported assets"> | ||
| Configure which assets you want to support: | ||
|
|
||
| ```typescript title="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', | ||
| } | ||
| ``` | ||
|
|
||
| </Step> | ||
| <Step title="Configure Markets"> | ||
| Define which markets you want to support or block within your app: | ||
|
|
||
| ```typescript title="actions.ts" | ||
| // Additional config from previous steps... | ||
|
|
||
| export const GauntletUSDC: LendMarketConfig = { | ||
| address: '0xabc...', | ||
| chainId: unichain.id, | ||
| name: 'Gauntlet USDC', | ||
| asset: USDC, | ||
| lendProvider: 'morpho', | ||
| } | ||
| ``` | ||
|
|
||
| </Step> | ||
| <Step title="Configure a Lend Provider"> | ||
| Configure which lend protocol you want to support: | ||
|
|
||
| <Tabs> | ||
| <Tab title="Morpho"> | ||
| ```typescript title="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: [], | ||
| }; | ||
| ``` | ||
| </Tab> | ||
| <Tab title="Aave"> | ||
| ```typescript title="actions.ts" | ||
| // Additional config from previous steps... | ||
|
|
||
| import type { LendConfig } from "@eth-optimism/actions-sdk"; | ||
|
|
||
| const lendConfig: LendConfig = { | ||
| type: "aave", | ||
| assetAllowlist: [USDC, CustomToken], | ||
| assetBlocklist: [], | ||
| marketAllowlist: [], | ||
| marketBlocklist: [], | ||
| }; | ||
| ``` | ||
| </Tab> | ||
| </Tabs> | ||
|
|
||
| </Step> | ||
| <Step title="Configure supported chains"> | ||
| Configure supported chains: | ||
|
|
||
| ```typescript title="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]; | ||
| ``` | ||
|
|
||
| </Step> | ||
| <Step title="Initialize Actions"> | ||
| Finally bring it all together and initialize Actions: | ||
|
|
||
| ```typescript title="actions.ts" | ||
| // Additional config from previous steps... | ||
|
|
||
| export const actions = createActions({ | ||
| wallet: walletConfig, | ||
| lend: lendConfig, | ||
| chains, | ||
| }); | ||
| ``` | ||
|
|
||
| </Step> | ||
| <Step title="Take Action"> | ||
| Once you've initialized your actions instance, import it anywhere you need to take action: | ||
|
|
||
| ```typescript | ||
| 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({ ... }); | ||
| ``` | ||
|
|
||
| </Step> | ||
| </Steps> | ||
|
|
||
| ## Next Steps | ||
|
|
||
| For detailed API documentation and type definitions, see the [Actions SDK Reference](/app-developers/reference/actions). | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.