From 2c1073c9a24c16f7e09b6f34e61e517bbba9bec7 Mon Sep 17 00:00:00 2001 From: moldy Date: Thu, 1 Feb 2024 16:23:41 -0500 Subject: [PATCH] docs: clean up the signer docs to match the new interfaces --- README.md | 2 +- .../alchemy/src/client/smartAccountClient.ts | 1 - site/.vitepress/sidebar/new.ts | 4 +-- site/getting-started/deploy-an-account.md | 2 +- site/getting-started/setup.md | 2 +- site/glossary/terms.md | 2 +- site/overview/introduction.md | 4 +-- site/overview/why-account-kit.md | 4 +-- .../signers/choosing-a-signer.md | 2 +- .../signers/contributing.md | 6 ++--- .../signers/guides/arcana-auth.md | 19 +++----------- .../signers/guides/capsule.md | 19 +++----------- .../signers/guides/custom-signer.md | 2 +- .../signers/guides/dfns.md | 22 ++++------------ .../signers/guides/dynamic.md | 19 +++----------- .../signers/guides/eoa.md | 0 .../signers/guides/fireblocks.md | 19 +++----------- .../signers/guides/lit.md | 20 ++++---------- .../signers/guides/magic.md | 20 +++----------- .../signers/guides/particle-network.md | 23 ++++------------ .../signers/guides/portal.md | 26 ++++++------------- .../signers/guides/privy.md | 0 .../signers/guides/turnkey.md | 22 ++++------------ .../signers/guides/web3auth.md | 19 +++----------- site/smart-accounts/index.md | 2 +- 25 files changed, 68 insertions(+), 193 deletions(-) rename site/{smart-accounts => }/signers/choosing-a-signer.md (98%) rename site/{smart-accounts => }/signers/contributing.md (97%) rename site/{smart-accounts => }/signers/guides/arcana-auth.md (85%) rename site/{smart-accounts => }/signers/guides/capsule.md (87%) rename site/{smart-accounts => }/signers/guides/custom-signer.md (92%) rename site/{smart-accounts => }/signers/guides/dfns.md (78%) rename site/{smart-accounts => }/signers/guides/dynamic.md (87%) rename site/{smart-accounts => }/signers/guides/eoa.md (100%) rename site/{smart-accounts => }/signers/guides/fireblocks.md (89%) rename site/{smart-accounts => }/signers/guides/lit.md (85%) rename site/{smart-accounts => }/signers/guides/magic.md (85%) rename site/{smart-accounts => }/signers/guides/particle-network.md (84%) rename site/{smart-accounts => }/signers/guides/portal.md (81%) rename site/{smart-accounts => }/signers/guides/privy.md (100%) rename site/{smart-accounts => }/signers/guides/turnkey.md (85%) rename site/{smart-accounts => }/signers/guides/web3auth.md (86%) diff --git a/README.md b/README.md index b5579e4b9e..2657749636 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ There are currently 5 SDKs that are part of the `aa-sdk` suite: The core SDK also implements an EIP-1193 provider interface to easily plug into any popular dapp or wallet connect libraries such as RainbowKit, Wagmi, and Web3Modal. It also includes [`ethers.js`](https://docs.ethers.org/v5/) adapters to provide full support for `ethers.js`` apps. -The `aa-sdk` is modular at every layer of the stack and can be easily extended to fit your custom needs. You can plug in any [smart account](https://accountkit.alchemy.com/smart-accounts/accounts/using-your-own) implementation, [Signer](https://accountkit.alchemy.com/smart-accounts/signers/overview), [Gas Manager API](https://accountkit.alchemy.com/overview/introduction.html#gas-manager-api) and RPC Provider. +The `aa-sdk` is modular at every layer of the stack and can be easily extended to fit your custom needs. You can plug in any [smart account](https://accountkit.alchemy.com/smart-accounts/accounts/using-your-own) implementation, [Signer](https://accountkit.alchemy.com/signers/overview), [Gas Manager API](https://accountkit.alchemy.com/overview/introduction.html#gas-manager-api) and RPC Provider. ## Getting Started diff --git a/packages/alchemy/src/client/smartAccountClient.ts b/packages/alchemy/src/client/smartAccountClient.ts index 5c300f2bac..bd6828dca6 100644 --- a/packages/alchemy/src/client/smartAccountClient.ts +++ b/packages/alchemy/src/client/smartAccountClient.ts @@ -25,7 +25,6 @@ export type AlchemySmartAccountClientConfig< > = { account?: account; useSimulation?: boolean; - // TODO: this is missing the current gas manager fallback stuff gasManagerConfig?: AlchemyGasManagerConfig; } & AlchemyProviderConfig & Pick< diff --git a/site/.vitepress/sidebar/new.ts b/site/.vitepress/sidebar/new.ts index 294fe62ae4..bf412abc92 100644 --- a/site/.vitepress/sidebar/new.ts +++ b/site/.vitepress/sidebar/new.ts @@ -58,12 +58,12 @@ export const newSidebar: DefaultTheme.Sidebar = [ }, { text: "Choosing a Signer", - base: "/smart-accounts/signers", + base: "/signers", items: [ { text: "Introduction", link: "/choosing-a-signer" }, { text: "Signer Guides", - base: "/smart-accounts/signers/guides", + base: "/signers/guides", collapsed: true, items: [ { text: "Magic", link: "/magic" }, diff --git a/site/getting-started/deploy-an-account.md b/site/getting-started/deploy-an-account.md index 72daca3ece..31903b6faa 100644 --- a/site/getting-started/deploy-an-account.md +++ b/site/getting-started/deploy-an-account.md @@ -40,7 +40,7 @@ The `LightAccount` implementation is not [ERC-6900](/smart-accounts/modular-acco ## 3. Choosing a Signer -A Signer is the entity that signs transactions (User Operations) on behalf of the smart account. It can be an EOA, a custodial service, or a multi-party computation (MPC) service. We explain the different types of signers in detail in the [overview](/smart-accounts/signers/choosing-a-signer) section on choosing a Signer and offer integration guides in these docs, many of which use our `aa-signers` SDK. +A Signer is the entity that signs transactions (User Operations) on behalf of the smart account. It can be an EOA, a custodial service, or a multi-party computation (MPC) service. We explain the different types of signers in detail in the [overview](/signers/choosing-a-signer) section on choosing a Signer and offer integration guides in these docs, many of which use our `aa-signers` SDK. At this point you should be able to integrate smart accounts in your application. However, there are a few advanced features that can help you improve the user experience and save on gas costs. Information about these can be found in the `Guides` section. diff --git a/site/getting-started/setup.md b/site/getting-started/setup.md index 1f3aaf1ac4..5f13f8bfe9 100644 --- a/site/getting-started/setup.md +++ b/site/getting-started/setup.md @@ -165,7 +165,7 @@ In this guide, we initialized an `AlchemyProvider` with the `aa-alchemy` package 2. To learn about the end-to-end process of integrating smart accounts in your applications, check out the section on [Smart Accounts](/smart-accounts/). -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. +3. To learn about the `owner` field on your smart account, check out the section on [Choosing a Signer](/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](/using-smart-accounts/send-user-operations) guide for an example using NFT mints. diff --git a/site/glossary/terms.md b/site/glossary/terms.md index 4e240c671d..3681b25e1c 100644 --- a/site/glossary/terms.md +++ b/site/glossary/terms.md @@ -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/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. +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/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 diff --git a/site/overview/introduction.md b/site/overview/introduction.md index f43fc65bf5..8a860eb6c1 100644 --- a/site/overview/introduction.md +++ b/site/overview/introduction.md @@ -42,7 +42,7 @@ The `aa-sdk` is a type-safe and performant TypeScript library built on top of [v The SDK also implements an EIP-1193 provider interface to easily plug into any popular dapp or wallet connect libraries such as RainbowKit, Wagmi, and Web3Modal. It also includes ethers.js adapters to provide full support for ethers.js apps. -The `aa-sdk` is modular at every layer of the stack and can be easily extended to fit your custom needs. You can plug in any [smart account](/smart-accounts/custom/using-your-own) implementation, [Signer](/smart-accounts/signers/choosing-a-signer), Gas Manager API, RPC provider. +The `aa-sdk` is modular at every layer of the stack and can be easily extended to fit your custom needs. You can plug in any [smart account](/smart-accounts/custom/using-your-own) implementation, [Signer](/signers/choosing-a-signer), Gas Manager API, RPC provider. Get started with `aa-sdk` in our [Getting Started guide](/getting-started/setup) or checkout the [open source repo](https://github.com/alchemyplatform/aa-sdk). @@ -66,7 +66,7 @@ To learn how to deploy a `LightAccount`, see [Light Account](/smart-accounts/lig A Signer is responsible for securely managing the private key and signing transaction requests on the smart account. Account Kit supports many popular wallet signers. It also supports self-custodial wallets like MetaMask or Ledger. -To get started with a Signer, read the doc: [How to Choose a Signer](/smart-accounts/signers/choosing-a-signer). +To get started with a Signer, read the doc: [How to Choose a Signer](/signers/choosing-a-signer). ### Gas Manager API diff --git a/site/overview/why-account-kit.md b/site/overview/why-account-kit.md index 3a90ff5f40..d0ca685694 100644 --- a/site/overview/why-account-kit.md +++ b/site/overview/why-account-kit.md @@ -65,9 +65,9 @@ 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](/using-smart-accounts/transfer-ownership/light-account) functionality. +Account Kit integrates all the leading wallet Signers with integration guides that you can find [here](/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). +Learn [how to choose and integrate the right Signer for your use case in this doc](/signers/choosing-a-signer). ## Sponsor gas diff --git a/site/smart-accounts/signers/choosing-a-signer.md b/site/signers/choosing-a-signer.md similarity index 98% rename from site/smart-accounts/signers/choosing-a-signer.md rename to site/signers/choosing-a-signer.md index 580e20d43f..032804ad33 100644 --- a/site/smart-accounts/signers/choosing-a-signer.md +++ b/site/signers/choosing-a-signer.md @@ -50,7 +50,7 @@ The Signer plays a crucial role in your app because it controls the user’s sma Account Kit is compatible with any EIP-1193 provider. Many of the most popular signers can be configured in minutes through our integration signer guides. -If you want to use another Signer, you can integrate any other Signer by wrapping it in an [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) provider or using [`SmartAccountSigner`](/smart-accounts/signers/guides/custom-signer#implementing-smartaccountsigner) to adapt non-standard Signer. +If you want to use another Signer, you can integrate any other Signer by wrapping it in an [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) provider or using [`SmartAccountSigner`](/signers/guides/custom-signer#implementing-smartaccountsigner) to adapt non-standard Signer. ## Criteria to consider diff --git a/site/smart-accounts/signers/contributing.md b/site/signers/contributing.md similarity index 97% rename from site/smart-accounts/signers/contributing.md rename to site/signers/contributing.md index 2ca2c2bda5..6c5cc571ff 100644 --- a/site/smart-accounts/signers/contributing.md +++ b/site/signers/contributing.md @@ -28,7 +28,7 @@ To ensure the best developer experience for anyone using Account Kit, we ask tha There, you'll be able to implement [`SmartAccountAuthenticator`](https://github.com/alchemyplatform/aa-sdk/blob/main/packages/core/src/signer/types.ts#L15) interface from `aa-core` which offers a wrapper for any SDKs, `inner`, that you may use to call upon for implementation details. You may also wish to build your Signer implementation from scratch. -In either case, if your `Signer` or library exports an `EIP-1193` compliant provider, you may find it helpful to use [`WalletClientSigner`](/packages/aa-core/signers/wallet-client) from `aa-core` to easily integrate your Signer in `aa-signers`. See the ["Using Your Own Signer"](/smart-accounts/signers/guides/custom-signer) guide for more details. +In either case, if your `Signer` or library exports an `EIP-1193` compliant provider, you may find it helpful to use [`WalletClientSigner`](/packages/aa-core/signers/wallet-client) from `aa-core` to easily integrate your Signer in `aa-signers`. See the ["Using Your Own Signer"](/signers/guides/custom-signer) guide for more details. Make sure to include unit tests along with your implementation! Take a look at these PRs from [Magic](https://github.com/alchemyplatform/aa-sdk/pull/229) and [Web3Auth](https://github.com/alchemyplatform/aa-sdk/pull/247) for reference. @@ -99,12 +99,12 @@ Find the `Choosing a Signer` item in the `sidebar` and add a new entry in `items // ... other entries { text: "Choosing a Signer", - base: "/smart-accounts/signers", + base: "/signers", items: [ { text: "Introduction", link: "/choosing-a-signer" }, { text: "Signer Guides", - base: "/smart-accounts/signers/guides", + base: "/signers/guides", collapsed: true, items: [ // ... other signers diff --git a/site/smart-accounts/signers/guides/arcana-auth.md b/site/signers/guides/arcana-auth.md similarity index 85% rename from site/smart-accounts/signers/guides/arcana-auth.md rename to site/signers/guides/arcana-auth.md index 753b9a496a..82127a6579 100644 --- a/site/smart-accounts/signers/guides/arcana-auth.md +++ b/site/signers/guides/arcana-auth.md @@ -57,11 +57,7 @@ Let's see it in action with `aa-alchemy` and `LightSmartContractAccount` from `a ::: code-group ```ts [example.ts] -import { AlchemyProvider } from "@alchemy/aa-alchemy"; -import { - LightSmartContractAccount, - getDefaultLightAccountFactoryAddress, -} from "@alchemy/aa-accounts"; +import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy"; import { sepolia } from "@alchemy/aa-core"; import { createArcanaAuthSigner } from "./arcana-auth"; @@ -69,18 +65,11 @@ const chain = sepolia; export async function getProvider() { const signer = await createArcanaAuthSigner(); - return new AlchemyProvider({ + return createModularAccountAlchemyClient({ apiKey: "ALCHEMY_API_KEY", chain, - }).connect( - (rpcClient) => - new LightSmartContractAccount({ - chain, - owner: signer, - factoryAddress: getDefaultLightAccountFactoryAddress(chain), - rpcClient, - }) - ); + owner: signer, + }); } ``` diff --git a/site/smart-accounts/signers/guides/capsule.md b/site/signers/guides/capsule.md similarity index 87% rename from site/smart-accounts/signers/guides/capsule.md rename to site/signers/guides/capsule.md index b9b6d1fcce..fd05a75fbc 100644 --- a/site/smart-accounts/signers/guides/capsule.md +++ b/site/signers/guides/capsule.md @@ -77,28 +77,17 @@ Let's see it in action with `aa-alchemy` and `LightSmartContractAccount` from `a ::: code-group ```ts [alchemy.ts] -import { AlchemyProvider } from "@alchemy/aa-alchemy"; -import { - LightSmartContractAccount, - getDefaultLightAccountFactoryAddress, -} from "@alchemy/aa-accounts"; +import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy"; import { sepolia } from "@alchemy/aa-core"; import { createCapsuleSigner } from "./capsule"; const chain = sepolia; -const provider = new AlchemyProvider({ +const provider = await createModularAccountAlchemyClient({ apiKey: "ALCHEMY_API_KEY", chain, -}).connect( - (rpcClient) => - new LightSmartContractAccount({ - chain, - owner: await createCapsuleSigner(), - factoryAddress: getDefaultLightAccountFactoryAddress(chain), - rpcClient, - }) -); + owner: await createCapsuleSigner(), +}); ``` <<< @/snippets/signers/capsule.ts diff --git a/site/smart-accounts/signers/guides/custom-signer.md b/site/signers/guides/custom-signer.md similarity index 92% rename from site/smart-accounts/signers/guides/custom-signer.md rename to site/signers/guides/custom-signer.md index c10bf55fa8..53b9750ed1 100644 --- a/site/smart-accounts/signers/guides/custom-signer.md +++ b/site/signers/guides/custom-signer.md @@ -26,7 +26,7 @@ Account Kit is designed to be flexible and allow you to use any Signer you want. 2. If your Signer is an [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) compliant provider, you can leverage `viem`'s `WalletClient` and the [`WalletClientSigner`](/packages/aa-core/signers/wallet-client) (exported in `aa-core`). :::tip Note -If you want to add your Signer implementation to Account Kit's codebase, take a look at the [contibuting](/smart-accounts/signers/contributing) docs. We welcome Pull Requests onto the Github repo for [`aa-sdk`](https://github.com/alchemyplatform/aa-sdk)! +If you want to add your Signer implementation to Account Kit's codebase, take a look at the [contibuting](/signers/contributing) docs. We welcome Pull Requests onto the Github repo for [`aa-sdk`](https://github.com/alchemyplatform/aa-sdk)! ::: ## 1. Implementing `SmartAccountAuthenticator` or `SmartAccountSigner` diff --git a/site/smart-accounts/signers/guides/dfns.md b/site/signers/guides/dfns.md similarity index 78% rename from site/smart-accounts/signers/guides/dfns.md rename to site/signers/guides/dfns.md index e08fc157ea..de6b9b2dbf 100644 --- a/site/smart-accounts/signers/guides/dfns.md +++ b/site/signers/guides/dfns.md @@ -45,12 +45,7 @@ Setup the Dfns Web3 Provider and wrap it in an `AlchemyProvider`. ::: code-group ```ts [example.ts] -import { AlchemyProvider } from "@alchemy/aa-alchemy"; -import { - LightSmartContractAccount, - getDefaultLightAccountFactoryAddress, -} from "@alchemy/aa-accounts"; -import { encodeFunctionData, parseAbi } from "viem"; +import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy"; import { sepolia } from "@alchemy/aa-core"; import { createDfnsSigner } from "./dfns"; @@ -58,19 +53,12 @@ import { createDfnsSigner } from "./dfns"; const ALCHEMY_API_KEY = "API_KEY"; const chain = sepolia; -const createAlchemyProvider = async (): Promise => { - return new AlchemyProvider({ +const createAlchemyProvider = async () => { + return createModularAccountAlchemyClient({ apiKey: ALCHEMY_API_KEY, chain, - }).connect( - (rpcClient) => - new LightSmartContractAccount({ - chain, - owner: await createDfnsSigner(), - factoryAddress: getDefaultLightAccountFactoryAddress(chain), - rpcClient, - }) - ); + owner: await createDfnsSigner(), + }); }; ``` diff --git a/site/smart-accounts/signers/guides/dynamic.md b/site/signers/guides/dynamic.md similarity index 87% rename from site/smart-accounts/signers/guides/dynamic.md rename to site/signers/guides/dynamic.md index 6e5ec49371..77ca5746c8 100644 --- a/site/smart-accounts/signers/guides/dynamic.md +++ b/site/signers/guides/dynamic.md @@ -82,28 +82,17 @@ Let's see it in action with `aa-alchemy` and `LightSmartContractAccount` from `a ::: code-group ```ts [example.ts] -import { AlchemyProvider } from "@alchemy/aa-alchemy"; -import { - LightSmartContractAccount, - getDefaultLightAccountFactoryAddress, -} from "@alchemy/aa-accounts"; +import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy"; import { sepolia } from "@alchemy/aa-core"; import { dynamicSigner } from "./dynamic"; const chain = sepolia; -const provider = new AlchemyProvider({ +const provider = await createModularAccountAlchemyClient({ apiKey: "ALCHEMY_API_KEY", chain, -}).connect( - (rpcClient) => - new LightSmartContractAccount({ - chain, - owner: dynamicSigner, - factoryAddress: getDefaultLightAccountFactoryAddress(chain), - rpcClient, - }) -); + owner: dynamicSigner, +}); ``` <<< @/snippets/signers/dynamic.ts diff --git a/site/smart-accounts/signers/guides/eoa.md b/site/signers/guides/eoa.md similarity index 100% rename from site/smart-accounts/signers/guides/eoa.md rename to site/signers/guides/eoa.md diff --git a/site/smart-accounts/signers/guides/fireblocks.md b/site/signers/guides/fireblocks.md similarity index 89% rename from site/smart-accounts/signers/guides/fireblocks.md rename to site/signers/guides/fireblocks.md index 31bbcffa80..4d3eefc7a8 100644 --- a/site/smart-accounts/signers/guides/fireblocks.md +++ b/site/signers/guides/fireblocks.md @@ -58,27 +58,16 @@ Let's see it in action with `aa-alchemy` and `LightSmartContractAccount` from `a ::: code-group ```ts [example.ts] -import { AlchemyProvider } from "@alchemy/aa-alchemy"; -import { - LightSmartContractAccount, - getDefaultLightAccountFactoryAddress, -} from "@alchemy/aa-accounts"; +import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy"; import { sepolia } from "@alchemy/aa-core"; import { createFireblocksSigner } from "./fireblocks"; const chain = sepolia; -const provider = new AlchemyProvider({ +const provider = await createModularAccountAlchemyClient({ apiKey: "ALCHEMY_API_KEY", chain, -}).connect( - (rpcClient) => - new LightSmartContractAccount({ - chain: rpcClient.chain, - owner: await createFireblocksSigner(), - factoryAddress: getDefaultLightAccountFactoryAddress(chain), - rpcClient, - }) -); + owner: await createFireblocksSigner(), +}); ``` <<< @/snippets/signers/fireblocks.ts diff --git a/site/smart-accounts/signers/guides/lit.md b/site/signers/guides/lit.md similarity index 85% rename from site/smart-accounts/signers/guides/lit.md rename to site/signers/guides/lit.md index 292a6c2b38..677fdeca5c 100644 --- a/site/smart-accounts/signers/guides/lit.md +++ b/site/signers/guides/lit.md @@ -79,26 +79,16 @@ We can link our `SmartAccountSigner` to a `LightSmartContractAccount` from `aa-a ::: code-group ```ts [example.ts] -import { AlchemyProvider } from "@alchemy/aa-alchemy"; -import { - LightSmartContractAccount, - getDefaultLightAccountFactoryAddress, -} from "@alchemy/aa-accounts"; +import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy"; +import { sepolia } from "@alchemy/aa-core"; import { createLitSigner } from "./lit"; const chain = sepolia; -const provider = new AlchemyProvider({ +const provider = await createModularAccountAlchemyClient({ apiKey: "ALCHEMY_API_KEY", chain, -}).connect( - (rpcClient) => - new LightSmartContractAccount({ - chain, - owner: await createLitSigner(AUTH_METHOD), - factoryAddress: getDefaultLightAccountFactoryAddress(chain), - rpcClient, - }) -); + owner: await createLitSigner(AUTH_METHOD), +}); ``` ::: diff --git a/site/smart-accounts/signers/guides/magic.md b/site/signers/guides/magic.md similarity index 85% rename from site/smart-accounts/signers/guides/magic.md rename to site/signers/guides/magic.md index f24a5ef961..451ed3237f 100644 --- a/site/smart-accounts/signers/guides/magic.md +++ b/site/signers/guides/magic.md @@ -56,11 +56,7 @@ Let's see it in action with `aa-alchemy` and `LightSmartContractAccount` from `a ::: code-group ```ts [example.ts] -import { AlchemyProvider } from "@alchemy/aa-alchemy"; -import { - LightSmartContractAccount, - getDefaultLightAccountFactoryAddress, -} from "@alchemy/aa-accounts"; +import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy"; import { sepolia } from "@alchemy/aa-core"; import { createMagicSigner } from "./magic"; @@ -68,19 +64,11 @@ const chain = sepolia; // NOTE: the below is async because it depends on creating a magic Signer. You can choose to break that up how you want // e.g. use a useEffect + useState to create the Signer and then pass it down to the provider -const provider = new AlchemyProvider({ +const provider = await createModularAccountAlchemyClient({ apiKey: "ALCHEMY_API_KEY", chain, -}).connect( - (rpcClient) => - new LightSmartContractAccount({ - entryPointAddress, - chain: rpcClient.chain, - owner: await createMagicSigner(), - factoryAddress: getDefaultLightAccountFactoryAddress(chain), - rpcClient, - }) -); + owner: await createMagicSigner(), +}); ``` <<< @/snippets/signers/magic.ts diff --git a/site/smart-accounts/signers/guides/particle-network.md b/site/signers/guides/particle-network.md similarity index 84% rename from site/smart-accounts/signers/guides/particle-network.md rename to site/signers/guides/particle-network.md index c30f74653d..e753310506 100644 --- a/site/smart-accounts/signers/guides/particle-network.md +++ b/site/signers/guides/particle-network.md @@ -57,29 +57,16 @@ Next, setup the Particle SDK and create an authenticated `ParticleSigner` using ::: code-group ```ts [example.ts] -import { AlchemyProvider } from "@alchemy/aa-alchemy"; -import { - LightSmartContractAccount, - getDefaultLightAccountFactoryAddress, -} from "@alchemy/aa-accounts"; -import { getDefaultEntryPointAddress } from "@alchemy/aa-core"; -import { polygonMumbai } from "@alchemy/aa-core"; +import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy"; +import { sepolia } from "@alchemy/aa-core"; import { createParticleSigner } from "./particle"; const chain = polygonMumbai; -const provider = new AlchemyProvider({ +const provider = await createModularAccountAlchemyClient({ apiKey: process.env.ALCHEMY_API_KEY, chain, -}).connect( - (rpcClient) => - new LightSmartContractAccount({ - entryPointAddress: getDefaultEntryPointAddress(chain), - chain: rpcClient.chain, - owner: await createParticleSigner(), - factoryAddress: getDefaultLightAccountFactoryAddress(chain), - rpcClient, - }) -); + owner: await createParticleSigner(), +}); ``` <<< @/snippets/signers/particle.ts diff --git a/site/smart-accounts/signers/guides/portal.md b/site/signers/guides/portal.md similarity index 81% rename from site/smart-accounts/signers/guides/portal.md rename to site/signers/guides/portal.md index 5bdcfcc562..8b8a841c12 100644 --- a/site/smart-accounts/signers/guides/portal.md +++ b/site/signers/guides/portal.md @@ -56,27 +56,17 @@ Let's see it in action with `aa-alchemy` and `LightSmartContractAccount` from `a ::: code-group ```ts [example.ts] -import { AlchemyProvider } from "@alchemy/aa-alchemy"; -import { - LightSmartContractAccount, - getDefaultLightAccountFactoryAddress, -} from "@alchemy/aa-accounts"; -import { polygonMumbai } from "@alchemy/aa-core"; +import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy"; +import { sepolia } from "@alchemy/aa-core"; import { createPortalSigner } from "./portal"; -const chain = polygonMumbai; -const provider = new AlchemyProvider({ - apiKey: process.env.ALCHEMY_API_KEY, +const chain = sepolia; + +const provider = await createModularAccountAlchemyClient({ + apiKey: "ALCHEMY_API_KEY", chain, -}).connect( - (rpcClient) => - new LightSmartContractAccount({ - chain, - owner: await createPortalSigner(), - factoryAddress: getDefaultLightAccountFactoryAddress(chain), - rpcClient, - }) -); + owner: await createPortalSigner(), +}); ``` <<< @/snippets/signers/portal.ts diff --git a/site/smart-accounts/signers/guides/privy.md b/site/signers/guides/privy.md similarity index 100% rename from site/smart-accounts/signers/guides/privy.md rename to site/signers/guides/privy.md diff --git a/site/smart-accounts/signers/guides/turnkey.md b/site/signers/guides/turnkey.md similarity index 85% rename from site/smart-accounts/signers/guides/turnkey.md rename to site/signers/guides/turnkey.md index e8ce9e9c86..88375360cb 100644 --- a/site/smart-accounts/signers/guides/turnkey.md +++ b/site/signers/guides/turnkey.md @@ -58,33 +58,21 @@ Next, setup the Turnkey SDK and create an authenticated `TurnkeySigner` using th ### Use it with Light Account -Let's see it in action with `aa-alchemy` and `LightSmartContractAccount` from `aa-accounts`: +Let's see it in action with `aa-alchemy` and `ModularAccount` from `aa-accounts`: ::: code-group ```ts [example.ts] -import { AlchemyProvider } from "@alchemy/aa-alchemy"; -import { - LightSmartContractAccount, - getDefaultLightAccountFactoryAddress, -} from "@alchemy/aa-accounts"; +import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy"; import { sepolia } from "@alchemy/aa-core"; import { createTurnkeySigner } from "./turnkey"; const chain = sepolia; -const provider = new AlchemyProvider({ +const provider = await createModularAccountAlchemyClient({ apiKey: "ALCHEMY_API_KEY", chain, -}).connect( - (rpcClient) => - new LightSmartContractAccount({ - entryPointAddress, - chain: rpcClient.chain, - owner: await createTurnkeySigner(), - factoryAddress: getDefaultLightAccountFactoryAddress(chain), - rpcClient, - }) -); + owner: await createTurnkeySigner(), +}); ``` <<< @/snippets/signers/turnkey.ts diff --git a/site/smart-accounts/signers/guides/web3auth.md b/site/signers/guides/web3auth.md similarity index 86% rename from site/smart-accounts/signers/guides/web3auth.md rename to site/signers/guides/web3auth.md index 34ae8e9b8f..6160250f40 100644 --- a/site/smart-accounts/signers/guides/web3auth.md +++ b/site/signers/guides/web3auth.md @@ -56,28 +56,17 @@ Let's see it in action with `aa-alchemy` and `LightSmartContractAccount` from `a ::: code-group ```ts [example.ts] -import { AlchemyProvider } from "@alchemy/aa-alchemy"; -import { - LightSmartContractAccount, - getDefaultLightAccountFactoryAddress, -} from "@alchemy/aa-accounts"; +import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy"; import { sepolia } from "@alchemy/aa-core"; import { createWeb3AuthSigner } from "./web3auth"; const chain = sepolia; -const provider = new AlchemyProvider({ +const provider = await createModularAccountAlchemyClient({ apiKey: "ALCHEMY_API_KEY", chain, -}).connect( - (rpcClient) => - new LightSmartContractAccount({ - chain, - owner: await createWeb3AuthSigner(), - factoryAddress: getDefaultLightAccountFactoryAddress(chain), - rpcClient, - }) -); + owner: await createWeb3AuthSigner(), +}); ``` <<< @/snippets/signers/web3auth.ts diff --git a/site/smart-accounts/index.md b/site/smart-accounts/index.md index 50002a7d75..4f4cb668b8 100644 --- a/site/smart-accounts/index.md +++ b/site/smart-accounts/index.md @@ -21,7 +21,7 @@ prev: link: /smart-accounts/overview next: text: Choosing a Signer - link: /smart-accounts/signers/choosing-a-signer + link: /signers/choosing-a-signer --- # Choosing a Smart Account