-
Notifications
You must be signed in to change notification settings - Fork 277
Actions Quickstart content #1799
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
Conversation
❌ Deploy Preview for docs-optimism failed. Why did it fail? →
|
.vscode/settings.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can omit this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, thank you
| @@ -0,0 +1,536 @@ | |||
| --- | |||
| title: Integrating DeFi with Actions SDK | |||
| description: Lend, Borrow, Swap, Pay in your app with a single dependency. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: is it a single dependency if you also need the wallet provider? What if we use the description that's on your landing page? "Perform DeFi actions with lightweight, composable, and type-safe modules."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left some minor comments, but looks great!
|
|
||
| - **Embedded Wallets**: Actions supports popular embedded [wallet providers](https://actions.money/#wallet), allowing your users to access DeFi with email authentication flows alone. | ||
|
|
||
| - **Configure Actions**: Extend your embedded wallet with DeFi actions like Lend, Borrow, Swap, and Pay. Set multiple providers for each Action to choose the best markets across DeFi. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you think we should leave out mentioning borrow, swap and pay until they're implemented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll leave it on this line, but I'll add
| client: httpClient, | ||
| organizationId: session.organizationId, | ||
| signWith: walletAddress, | ||
| ethereumAddress: walletAddress, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the ethereumAddress argument is optional and defaults to the same value as signWith , so you could leave it out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
|
|
||
| // Fetch Turnkey wallet | ||
| const { wallets, httpClient, session } = useTurnkey() | ||
| const embeddedWallet = wallets[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: not sure if we should include this since the turnkey sdk can always change, but this is how you get an embedded wallet:
const embeddedWallet = wallets.find(
(wallet) =>
wallet.accounts.some(
(account) => account.addressFormat === 'ADDRESS_FORMAT_ETHEREUM',
) && wallet.source === WalletSource.Embedded,
)
you could also update the example above to use this as well instead of calling createWallet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
| 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: [], | ||
| } | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: it might be good to mention that these are not supported yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Contains quickstart doc for Actions