Skip to content

Commit

Permalink
docs: refactor using smart accounts docs
Browse files Browse the repository at this point in the history
  • Loading branch information
moldy530 committed Feb 1, 2024
1 parent 24cf8cd commit 6965d74
Show file tree
Hide file tree
Showing 30 changed files with 172 additions and 265 deletions.
1 change: 0 additions & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export { isSmartAccountClient } from "./client/isSmartAccountClient.js";
export {
ConnectionConfigSchema,
SmartAccountClientOptsSchema as SmartAccountProviderOptsSchema,
createPublicErc4337ClientSchema,
} from "./client/schema.js";
export type * from "./client/smartAccountClient.js";
export {
Expand Down
45 changes: 32 additions & 13 deletions site/.vitepress/sidebar/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,7 @@ export const newSidebar: DefaultTheme.Sidebar = [
},
{
text: "Light Account",
collapsed: true,
base: "/smart-accounts/light-account",
items: [
{ text: "Introduction", link: "/" },
{ text: "Getting started", link: "/getting-started" },
{ text: "Deployments", link: "/deployments" },
],
link: "/smart-accounts/light-account/",
},
{
text: "Custom Accounts",
Expand Down Expand Up @@ -105,17 +99,42 @@ export const newSidebar: DefaultTheme.Sidebar = [
},
{
text: "Using Smart Accounts",
base: "/using-smart-accounts",
items: [
{ text: "Send User Operations", link: "/" },
{ text: "Batch User Operations", link: "/" },
{ text: "Simulate User Operations", link: "/" },
{ text: "Send User Operations", link: "/send-user-operations" },
{ text: "Batch User Operations", link: "/batch-user-operations" },
{
text: "Sponsoring Gas",
collapsed: false,
base: "/using-smart-accounts/sponsoring-gas",
items: [
{ text: "Alchemy Gas Manager", link: "/gas-manager" },
{ text: "Check Eligibility", link: "/checking-eligibility" },
],
},
{ text: "Simulate User Operations", link: "/simulate-user-operations" },
{
text: "Transfer Ownership",
base: "/using-smart-accounts/transfer-ownership",
collapsed: false,
items: [{ text: "Modular Account" }, { text: "Light Account" }],
items: [
{ text: "Modular Account", link: "/modular-account" },
{ text: "Light Account", link: "/light-account" },
],
},
{ text: "Session Keys", link: "/session-keys" },
{
text: "Alchemy Enhanced Apis",
base: "/using-smart-accounts/enhanced-apis",
collapsed: true,
items: [
{
text: "Get Account's NFTs",
link: "/nft",
},
{ text: "Get Account's Tokens", link: "/token" },
],
},
{ text: "Session Keys", link: "/" },
{ text: "Alchemy Enhanced Apis", link: "/" },
],
},
{
Expand Down
6 changes: 3 additions & 3 deletions site/faqs.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Right now, `UserOperation`s are sent to a private mempool for all networks other
### Can I simulate `UserOperation`s the same way I simulate transactions?

::: details Answer
Yes! Check out [this guide](/tutorials/sim-user-operation.html).
Yes! Check out [this guide](/using-smart-accounts/simulate-user-operations.html).
:::

## Gas Estimation
Expand Down Expand Up @@ -106,7 +106,7 @@ Gas sponsorship is available on testnet for all tiers. For support on mainnet, y
### How is gas sponsored? Do I need to fund the Gas Manager?

::: details Answer
We front the gas for your application and put the USD equivalent on your bill at the end of the month. No need to worry about pre-funding the Gas Manager or conversions, we’ve got you covered! You can follow [this guide](/tutorials/sponsoring-gas/sponsoring-gas.html) for more details on how to sponsor `UserOperation`s.
We front the gas for your application and put the USD equivalent on your bill at the end of the month. No need to worry about pre-funding the Gas Manager or conversions, we’ve got you covered! You can follow [this guide](/using-smart-accounts/sponsoring-gas/gas-manager.html) for more details on how to sponsor `UserOperation`s.
:::

### What are my gas sponsorship limits?
Expand All @@ -124,7 +124,7 @@ Currently, we don’t support this, but we are actively exploring. Please [reach
### How is the Gas Manager protected from DDOS attacks?

::: details Answer
In your Gas Manager policy, you can configure spending rules per address, per app, and/or policy wide limits. See how to set up these policies [here](/tutorials/sponsoring-gas/sponsoring-gas.html#_2-create-a-gas-manager-policy).
In your Gas Manager policy, you can configure spending rules per address, per app, and/or policy wide limits. See how to set up these policies [here](/using-smart-accounts/sponsoring-gas/gas-manager.html#_2-create-a-gas-manager-policy).
:::

## Common Errors {#common-errors}
Expand Down
6 changes: 3 additions & 3 deletions site/getting-started/deploy-an-account.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ At this point you should be able to integrate smart accounts in your application

## 4. Sponsoring Gas

Being able to sponsor gas for your users is one of the most powerful features enabled by smart accounts and can help you build a seamless user experience. We'll cover this in detail with code examples in the [Sponsoring Gas](/tutorials/sponsoring-gas/sponsoring-gas) section.
Being able to sponsor gas for your users is one of the most powerful features enabled by smart accounts and can help you build a seamless user experience. We'll cover this in detail with code examples in the [Sponsoring Gas](/using-smart-accounts/sponsoring-gas/gas-manager) section.

## 5. Batching Transactions

Transaction batching allows you to bundle multiple transaction calls into a single User Operation and execute them in a single atomic transaction. This can help you save on gas costs and improve the user experience. We'll cover this in detail with code examples in the [Batching Transactions](/tutorials/batching-transactions) section.
Transaction batching allows you to bundle multiple transaction calls into a single User Operation and execute them in a single atomic transaction. This can help you save on gas costs and improve the user experience. We'll cover this in detail with code examples in the [Batching Transactions](/using-smart-accounts/batch-user-operations) section.

## 6. Transferring Ownership

Ownership is an important aspect of smart accounts. The Light Account implementation allows you to transfer the ownership of a smart account to another entity. We'll cover this in detail with code examples in the [Transferring Ownership](/tutorials/transferring-ownership) section.
Ownership is an important aspect of smart accounts. The Light Account implementation allows you to transfer the ownership of a smart account to another entity. We'll cover this in detail with code examples in the [Transferring Ownership](/using-smart-accounts/transfer-ownership/light-account) section.
6 changes: 3 additions & 3 deletions site/getting-started/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Smart Account Address: 0xYOUR_SMART_ACCOUNT_ADDRESS

To deploy the smart account and send UOs on its behalf, you'll need to add native token to your smart account.

At scale, you might consider using our Gas Manager to [sponsor UserOperations](/tutorials/sponsoring-gas/sponsoring-gas) for smart accounts. But for the purpose of this example, and because we're using a testnet, let's fund the account using the [Alchemy Faucet](https://sepoliafaucet.com). Make sure to log in with Alchemy to receive your testnet tokens.
At scale, you might consider using our Gas Manager to [sponsor UserOperations](/using-smart-accounts/sponsoring-gas/gas-manager) for smart accounts. But for the purpose of this example, and because we're using a testnet, let's fund the account using the [Alchemy Faucet](https://sepoliafaucet.com). Make sure to log in with Alchemy to receive your testnet tokens.

<img src="/images/alchemy-faucet.png" width="auto" height="auto" alt="Account Kit Overview" style="display: block; margin: auto;">

Expand Down Expand Up @@ -167,8 +167,8 @@ In this guide, we initialized an `AlchemyProvider` with the `aa-alchemy` package

3. To learn about the `owner` field on your smart account, check out the section on [Choosing a Signer](/smart-accounts/signers/choosing-a-signer) to own the smart account.

4. To learn more about different User Operations you can send with different `target` and `data` fields in the `sendUserOperation` function above, look at our [How to Send a User Operation](/tutorials/send-user-operation) guide for an example using NFT mints.
4. To learn more about different User Operations you can send with different `target` and `data` fields in the `sendUserOperation` function above, look at our [How to Send a User Operation](/using-smart-accounts/send-user-operations) guide for an example using NFT mints.

5. To explore more ways to use Account Kit, check out the many step-by-step guides, such as [How to Sponsor Gas for a User Operation](/tutorials/sponsoring-gas/sponsoring-gas) or [How to Fetch Smart Account Data](/tutorials/enhanced-apis/nft).
5. To explore more ways to use Account Kit, check out the many step-by-step guides, such as [How to Sponsor Gas for a User Operation](/using-smart-accounts/sponsoring-gas/gas-manager) or [How to Fetch Smart Account Data](/using-smart-accounts/enhanced-apis/nft).

6. To see Account Kit in action, check out our [Demos](/overview/demos).
2 changes: 1 addition & 1 deletion site/glossary/terms.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ head:

## Account Kit

Account Kit is a framework designed to embed smart accounts in web3 applications. It includes a set of tools such as [Signer integrations](https://accountkit.alchemy.com/smart-accounts/signers/choosing-a-signer.html), [Gas Manager](https://docs.alchemy.com/docs/gas-manager-services) and [Bundler](https://docs.alchemy.com/docs/bundler-services) utilities that unlock features such as [gas sponsorship](https://accountkit.alchemy.com/tutorials/sponsoring-gas/sponsoring-gas.html), [batched transactions](https://accountkit.alchemy.com/tutorials/batching-transactions.html) and email/social login. With its user-friendly suite of SDKs, known as [aa-sdk](https://github.com/alchemyplatform/aa-sdk), Account Kit makes it easy to deploy smart accounts, manage `UserOperation`s, and handle gas sponsorship, streamlining the entire process with minimal coding effort.
Account Kit is a framework designed to embed smart accounts in web3 applications. It includes a set of tools such as [Signer integrations](https://accountkit.alchemy.com/smart-accounts/signers/choosing-a-signer.html), [Gas Manager](https://docs.alchemy.com/docs/gas-manager-services) and [Bundler](https://docs.alchemy.com/docs/bundler-services) utilities that unlock features such as [gas sponsorship](https://accountkit.alchemy.com/using-smart-accounts/sponsoring-gas/gas-manager.html), [batched transactions](https://accountkit.alchemy.com/using-smart-accounts/batch-user-operations.html) and email/social login. With its user-friendly suite of SDKs, known as [aa-sdk](https://github.com/alchemyplatform/aa-sdk), Account Kit makes it easy to deploy smart accounts, manage `UserOperation`s, and handle gas sponsorship, streamlining the entire process with minimal coding effort.

## Bundler

Expand Down
2 changes: 1 addition & 1 deletion site/overview/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ To get started with a Signer, read the doc: [How to Choose a Signer](/smart-acco

The Gas Manager is a programmable API to sponsor gas for UserOps. You can create programmable gas policies to specify exactly which transactions should be sponsored, set strict spending limits per wallet or globally, and allowlist/blocklist particular wallet addresses. This expressive programmability is available through a REST API and an intuitive dashboard interface.

To learn how to sponsor gas with the Gas Manager API, see the [Sponsoring Gas](/tutorials/sponsoring-gas/sponsoring-gas) tutorial.
To learn how to sponsor gas with the Gas Manager API, see the [Sponsoring Gas](/using-smart-accounts/sponsoring-gas/gas-manager) tutorial.

### Bundler API

Expand Down
8 changes: 4 additions & 4 deletions site/overview/why-account-kit.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Streamline your sign up flow with simple web2 login options supported by Account
- Self-custodial wallets like MetaMask or Ledger
- and more

Account Kit integrates all the leading wallet Signers with integration guides that you can find [here](/smart-accounts/signers/choosing-a-signer). Account Kit even supports self-custodial wallets like MetaMask or Ledger. Users can even change their Signer later via Account Kit’s [ownership transfer](/tutorials/transferring-ownership) functionality.
Account Kit integrates all the leading wallet Signers with integration guides that you can find [here](/smart-accounts/signers/choosing-a-signer). Account Kit even supports self-custodial wallets like MetaMask or Ledger. Users can even change their Signer later via Account Kit’s [ownership transfer](/using-smart-accounts/transfer-ownership/light-account) functionality.

Learn [how to choose and integrate the right Signer for your use case in this doc](/smart-accounts/signers/choosing-a-signer).

Expand All @@ -75,15 +75,15 @@ Account Kit removes the greatest barrier to entry of all: gas fees.

Many newcomers give up on web3 before submitting their first transaction. It's daunting to buy crypto for the first time, especially before trying the app! Gas fees -- even cheap ones on L2 -- discourage newcomers from trying your app.

With Account Kit you can remove this barrier by [sponsoring gas fees](/tutorials/sponsoring-gas/sponsoring-gas) for transactions — especially the first one! Get the user to your app’s magic moment as quickly, and help them fall in love with your product before asking them to deposit money.
With Account Kit you can remove this barrier by [sponsoring gas fees](/using-smart-accounts/sponsoring-gas/gas-manager) for transactions — especially the first one! Get the user to your app’s magic moment as quickly, and help them fall in love with your product before asking them to deposit money.

The [Gas Manager API](https://dashboard.alchemy.com/gas-manager/?a=ak-docs) included in Account Kit is a powerful tool to [sponsor gas](/tutorials/sponsoring-gas/sponsoring-gas). Sponsorship rules are programmable, giving you precise control over spending limits, allowlisted/blocklisted wallet addresses, and more through a REST API or an intuitive management dashboard.
The [Gas Manager API](https://dashboard.alchemy.com/gas-manager/?a=ak-docs) included in Account Kit is a powerful tool to [sponsor gas](/using-smart-accounts/sponsoring-gas/gas-manager). Sponsorship rules are programmable, giving you precise control over spending limits, allowlisted/blocklisted wallet addresses, and more through a REST API or an intuitive management dashboard.

In the future, Account Kit will support paying gas in stablecoins like USDC and other ERC20s. If you’re interested those features, [contact us](mailto:[email protected]) to chat.

## Batch transactions

Streamline multi-step actions into a single click. Using the Bundler API, you can effortlessly [batch multiple transactions](/tutorials/batching-transactions) into a single operation. For example, imagine a normal user who wants to mint two NFTs as part of your giveaway. You can submit a single user operation that batches the following transactions together all with a single click and sponsored gas:
Streamline multi-step actions into a single click. Using the Bundler API, you can effortlessly [batch multiple transactions](/using-smart-accounts/batch-user-operations) into a single operation. For example, imagine a normal user who wants to mint two NFTs as part of your giveaway. You can submit a single user operation that batches the following transactions together all with a single click and sponsored gas:

1. Deploy a smart account contract for the user
2. Mint NFT #1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Internally, this method invokes [`buildUserOperation`](./buildUserOperation.md),

You can utilize this method before sending the user operation to confirm its eligibility for gas sponsorship. Depending on the outcome, it allows you to tailor the user experience accordingly, based on eligibility.

For a deeper understanding of how to employ this method to provide varied user experiences contingent on gas sponsorship eligibility, please refer to the guide [How to Handle User Operations Not Eligibile for Gas Sponsorship](/tutorials/sponsoring-gas/gas-sponsorship-eligibility.md).
For a deeper understanding of how to employ this method to provide varied user experiences contingent on gas sponsorship eligibility, please refer to the guide [How to Handle User Operations Not Eligibile for Gas Sponsorship](/using-smart-accounts/sponsoring-gas/checking-eligibility.md).

## Usage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ These override values are available from each middleware of the `SmartAccountPro

Other than the `paymasterAndData` field, the override fields could be either the absolute value or the percentage value. In the default middlewares, if the override value is an absolute value, it simply overrides the estimated value. If the override value is a percentage value, the estimated value is _bumped_ with the indicated percentage value. For example, if the override value is `{ percentage: 10 }` for the `maxPriorityFeePerGas` field, then 10% bump is applied to the estimated `maxPriorityFeePerGas` of the user operation.

The `paymasterAndData` only allows an absolute value override, and if the override value is provided, then the paymaster middleware is bypassed entirely. Refer to our guide [How to Handle User Operations that are Not Eligible for Gas Sponsorship](/tutorials/sponsoring-gas/gas-sponsorship-eligibility.md) on the example of using the `paymasterAndData` override to bypass the paymaster middleware to fallback to the user paying the gas fee instead of the gas being subsidized by the paymaster.
The `paymasterAndData` only allows an absolute value override, and if the override value is provided, then the paymaster middleware is bypassed entirely. Refer to our guide [How to Handle User Operations that are Not Eligible for Gas Sponsorship](/using-smart-accounts/sponsoring-gas/checking-eligibility.md) on the example of using the `paymasterAndData` override to bypass the paymaster middleware to fallback to the user paying the gas fee instead of the gas being subsidized by the paymaster.

:::tip Note
Note that if you are using your own middleware, for example a custom `feeEstimator` using config method on the client, then the default `feeEstimator` middleware is overriden. As you are opting out of using the default middleware, you are also responsible for handling the `UserOperationOverrides` appropriately.
Expand Down
32 changes: 0 additions & 32 deletions site/smart-accounts/light-account/deployments.md

This file was deleted.

Loading

0 comments on commit 6965d74

Please sign in to comment.