|
| 1 | +--- |
| 2 | +title: Account Abstraction |
| 3 | +sidebar_label: Account Abstraction |
| 4 | +description: "@web3auth/no-modal Native Account Abstraction | Documentation - Web3Auth" |
| 5 | +--- |
| 6 | + |
| 7 | +import AccountAbstractionDescription from "@site/src/common/sdk/pnp/web/_account-abstraction-description.mdx"; |
| 8 | +import AccountAbstractionProviderInstallation from "@site/src/common/sdk/pnp/web/_aa-provider-installation.mdx"; |
| 9 | +import ConfigureSmartAccountProvider from "@site/src/common/sdk/pnp/web/_smart-account-provider-configuration.mdx"; |
| 10 | +import ConfigureBundler from "@site/src/common/sdk/pnp/web/_bundler-configuration.mdx"; |
| 11 | +import ConfigureSponsoredPaymaster from "@site/src/common/sdk/pnp/web/_sponsored-paymaster-configuration.mdx"; |
| 12 | +import ConfigureERC20Paymaster from "@site/src/common/sdk/pnp/web/_erc20-paymaster-configuration.mdx"; |
| 13 | +import AANoModalSetup from "@site/src/common/sdk/pnp/web/_aa-no-modal-setup.mdx"; |
| 14 | +import ConfigureSigners from "@site/src/common/sdk/pnp/web/_configure-aa-signers.mdx"; |
| 15 | +import SmartAccountAddress from "@site/src/common/sdk/pnp/web/_aa-address.mdx"; |
| 16 | +import SmartAccountSendTransaction from "@site/src/common/sdk/pnp/web/_aa-send-transaction.mdx"; |
| 17 | + |
| 18 | +import GrowthPlanNote from "@site/src/common/docs/_growth_plan_note.mdx"; |
| 19 | + |
| 20 | +<AccountAbstractionDescription /> |
| 21 | +<GrowthPlanNote /> |
| 22 | + |
| 23 | +## Installation |
| 24 | + |
| 25 | +<AccountAbstractionProviderInstallation /> |
| 26 | + |
| 27 | +## Configure |
| 28 | + |
| 29 | +When instantiating the Account Abstraction Provider, you can pass configuration objects to the |
| 30 | +constructor. These configuration options allow you to select the desired Account Abstraction (AA) |
| 31 | +provider, as well as configure the bundler and paymaster, giving you flexibility and control over |
| 32 | +the provider. |
| 33 | + |
| 34 | +```tsx |
| 35 | +import { |
| 36 | + AccountAbstractionProvider, |
| 37 | + SafeSmartAccount, |
| 38 | +} from "@web3auth/account-abstraction-provider"; |
| 39 | + |
| 40 | +const chainConfig = { |
| 41 | + chainNamespace: CHAIN_NAMESPACES.EIP155, |
| 42 | + chainId: "0xaa36a7", |
| 43 | + rpcTarget: "https://rpc.ankr.com/eth_sepolia", |
| 44 | + displayName: "Ethereum Sepolia Testnet", |
| 45 | + blockExplorerUrl: "https://sepolia.etherscan.io", |
| 46 | + ticker: "ETH", |
| 47 | + tickerName: "Ethereum", |
| 48 | + logo: "https://cryptologos.cc/logos/ethereum-eth-logo.png", |
| 49 | +}; |
| 50 | + |
| 51 | +// focus-start |
| 52 | +const accountAbstractionProvider = new AccountAbstractionProvider({ |
| 53 | + config: { |
| 54 | + chainConfig, |
| 55 | + bundlerConfig: { |
| 56 | + // Get the pimlico API Key from dashboard.pimlico.io |
| 57 | + url: `https://api.pimlico.io/v2/11155111/rpc?apikey=${pimlicoAPIKey}`, |
| 58 | + }, |
| 59 | + smartAccountInit: new SafeSmartAccount(), |
| 60 | + }, |
| 61 | +}); |
| 62 | +// focus-end |
| 63 | +``` |
| 64 | + |
| 65 | +Please note this is the important step for setting the Web3Auth account abstraction provider. |
| 66 | + |
| 67 | +- [Configure Smart Account provider](#configure-smart-account-provider) |
| 68 | +- [Configure Bundler](configure-bundler) |
| 69 | +- [Configure Sponsored Paymaster](#sponsored-paymaster) |
| 70 | +- [Configure ERC-20 Paymaster](#erc20-paymaster) |
| 71 | + |
| 72 | +## Configure Smart Account Provider |
| 73 | + |
| 74 | +<ConfigureSmartAccountProvider /> |
| 75 | + |
| 76 | +## Configure Bundler |
| 77 | + |
| 78 | +<ConfigureBundler /> |
| 79 | + |
| 80 | +## Configure Paymaster |
| 81 | + |
| 82 | +You can configure the paymaster of your choice to sponsor gas fees for your users, along with the |
| 83 | +paymaster context. The paymaster context lets you set additional parameters, such as choosing the |
| 84 | +token for ERC-20 paymasters, defining gas policies, and more. |
| 85 | + |
| 86 | +### Sponsored Paymaster |
| 87 | + |
| 88 | +<ConfigureSponsoredPaymaster /> |
| 89 | + |
| 90 | +### ERC-20 Paymaster |
| 91 | + |
| 92 | +<ConfigureERC20Paymaster /> |
| 93 | + |
| 94 | +## Set up |
| 95 | + |
| 96 | +Once you have configured your AccountAbstractionProvider, you can now plug it in your Web3Auth No |
| 97 | +Modal instance. If you are also using the external wallets, you can define whether you want to use |
| 98 | +the AccountAbstractionProvider, or EthereumPrivateKeyProvider by setting the |
| 99 | +`useAAWithExternalWallet` in `IWeb3AuthCoreOptions`. |
| 100 | + |
| 101 | +### Configure Web3Auth Instance |
| 102 | + |
| 103 | +<AANoModalSetup /> |
| 104 | + |
| 105 | +### Configure Signer |
| 106 | + |
| 107 | +<ConfigureSigners /> |
| 108 | + |
| 109 | +## Smart Account Address |
| 110 | + |
| 111 | +<SmartAccountAddress /> |
| 112 | + |
| 113 | +## Send Transaction |
| 114 | + |
| 115 | +<SmartAccountSendTransaction /> |
| 116 | + |
| 117 | +## Advanced Smart Account Operations |
| 118 | + |
| 119 | +To learn more about supported transaction methods, and how to perform batch transactions, |
| 120 | +[checkout our detailed documentation of AccountAbstractionProvider](/docs/sdk/pnp/web/providers/aa-provider). |
0 commit comments