diff --git a/site/packages/aa-accounts/light-account/index.md b/site/packages/aa-accounts/light-account/index.md index e0609dce7d..6181646c25 100644 --- a/site/packages/aa-accounts/light-account/index.md +++ b/site/packages/aa-accounts/light-account/index.md @@ -95,6 +95,8 @@ A Promise containing a new `LightAccount`. - `initCode: Hex` -- [optional] the initCode for deploying the smart account with which the client will connect. +- `salt: bigint` -- [optional] a value that is added to the address calculation to allow for multiple accounts for the same owner. The default value supplied is `0n`. To see this calculation used in the smart contract, check out [the LightAccountFactory](https://github.com/alchemyplatform/light-account/blob/main/src/LightAccountFactory.sol#L30). + - `accountAddress: Address` -- [optional] a smart account address override that this object will manage instead of generating its own. - `version: LightAccountVersion` -- [optional] the LightAccount contract version. Default: [v1.1.0](https://github.com/alchemyplatform/light-account/releases/tag/v1.1.0) diff --git a/site/packages/aa-signers/capsule/authenticate.md b/site/packages/aa-signers/capsule/authenticate.md index eec130163d..b33d7db4c9 100644 --- a/site/packages/aa-signers/capsule/authenticate.md +++ b/site/packages/aa-signers/capsule/authenticate.md @@ -54,8 +54,8 @@ A Promise containing the `CapsuleUserInfo`, an `Record` where Wa - `signer: string` -- Capsule Signer information. -- `address: string` -- [optional] EOA address of the Capusle Signer. +- `address: string` -- [optional] EOA address of the Capsule Signer. -- `publicKey: string` -- [optional] Public Key of the Capusle Signer. +- `publicKey: string` -- [optional] Public Key of the Capsule Signer. - `scheme: WalletScheme` -- [optional] either `CGGMP` or `DKLS`. diff --git a/site/smart-accounts/light-account/index.md b/site/smart-accounts/light-account/index.md index 9fc47e3a89..9a4a436f46 100644 --- a/site/smart-accounts/light-account/index.md +++ b/site/smart-accounts/light-account/index.md @@ -35,6 +35,12 @@ The code snippet below demonstrates how to use Light Account with Account Kit. I ::: code-group +::: tip Address calculation +For the Light Account, the address of the smart account will be calculated as a combination of [the owner and the salt](https://github.com/alchemyplatform/light-account/blob/main/src/LightAccountFactory.sol#L24-L33). You will get the same smart account address each time you supply the same `owner`. You can also optionally supply `salt` if you want a different address for the same owner (the default salt is `0n`). + +If you already have an account with a new or different owner (transferred ownership), you can supply the `accountAddress` to connect with your account with a new owner. In that case, the `owner` is not used for address calculation, but still used for signing the operation. +::: + ## [Deployment addresses](https://github.com/alchemyplatform/light-account/blob/v1.1.0/Deployments.md) The following tables list the deployed factory and account implementation contract addresses for `LightAccount` on different chains: diff --git a/site/smart-accounts/modular-account/getting-started.md b/site/smart-accounts/modular-account/getting-started.md index 1a452e0951..a657343cee 100644 --- a/site/smart-accounts/modular-account/getting-started.md +++ b/site/smart-accounts/modular-account/getting-started.md @@ -20,24 +20,62 @@ head: # Getting started with Modular Account -Getting started with Modular Account is really simple, especially if you are using `@alchemy/aa-alchemy`. +It's easy to get started with Modular Account! We'll show you two different ways using `@alchemy/aa-alchemy` and `@alchemy/aa-core`. + +::: tip Choosing your package +The [`aa-core`](/packages/aa-core/) package is not opinionated about your RPC provider. As a result, creating a client requires more configuration. If you don't need this extra flexibility, [`aa-alchemy`](/packages/aa-alchemy/) is much easier to jump in with, as you'll see below. +::: ## With `@alchemy/aa-alchemy` -When using `@alchemy/aa-alchemy` it is really easy to get started simply do the following: +### Install packages + +::: code-group + +```bash [npm] +npm i @alchemy/aa-alchemy @alchemy/aa-core +``` + +```bash [yarn] +yarn add @alchemy/aa-alchemy @alchemy/aa-core +``` + +::: + +### Create a client + +Then you can simply do the following: <<< @/snippets/aa-alchemy/connected-client.ts +::: tip Address calculation +For the Modular Account, the address of the smart account will be calculated as a combination of [several variables](https://github.com/alchemyplatform/modular-account/blob/74fe1bfa056bbd41c933990fca0598c8cc3e90e8/src/factory/MultiOwnerModularAccountFactory.sol#L66-L71). You will get the same smart account address each time you supply the same `owner` or `owners`. You can also optionally supply `salt` if you want a different address for the same owner(s) (the default salt is `0n`). + +If you already have an account with a new or different owner (transferred ownership), you can supply the `accountAddress` to connect with your account with a new owner. In that case, the `owner` is not used for address calculation, but still used for signing the operation. +::: + +That's it! You've configured your client. + +Next, if you want to replace that `owner` with a smart account signer, check out [choosing a signer](/signers/choosing-a-signer). Or, if you're ready to get onchain, go to [send user operations](/using-smart-accounts/send-user-operations). + ## With `@alchemy/aa-core` ### Install packages If you are using `@alchemy/aa-core` you'll want to also add `@alchemy/aa-accounts` to get the Smart Account factory for Modular Account. -```bash -yarn add @alchemy/aa-core @alchemy/aa-accounts +::: code-group + +```bash [npm] +npm i @alchemy/aa-core @alchemy/aa-accounts viem +``` + +```bash [yarn] +yarn add @alchemy/aa-core @alchemy/aa-accounts viem ``` +::: + ### Create a client Then you'll need to create a `SmartAccountClient` @@ -73,3 +111,5 @@ const decoratedClient = smartAccountClient <<< @/snippets/aa-core/smartAccountClient.ts ::: + +Next, if you want to replace that `owner` with a smart account signer, check out [choosing a signer](/signers/choosing-a-signer). Or, if you're ready to get onchain, go to [send user operations](/using-smart-accounts/send-user-operations). diff --git a/site/snippets/session-keys/add-session-key.ts b/site/snippets/session-keys/add-session-key.ts index 72d9b1bfb5..dbc324c667 100644 --- a/site/snippets/session-keys/add-session-key.ts +++ b/site/snippets/session-keys/add-session-key.ts @@ -1,8 +1,10 @@ import { SessionKeyPermissionsBuilder } from "@alchemy/aa-accounts"; import { client } from "./base-client.js"; +import { keccak256 } from "viem"; const result = await client.addSessionKey({ key: "0xSessionKeyAddress", - tag: "0xkeytag", + // tag is an identifier for the emitted SessionKeyAdded event + tag: keccak256(new TextEncoder().encode("session-key-tag")), permissions: new SessionKeyPermissionsBuilder().encode(), });