diff --git a/site/.vitepress/sidebar/packages/aa-core.ts b/site/.vitepress/sidebar/packages/aa-core.ts index 37a48e6341..2a077e0703 100644 --- a/site/.vitepress/sidebar/packages/aa-core.ts +++ b/site/.vitepress/sidebar/packages/aa-core.ts @@ -104,6 +104,42 @@ export const aaCoreSidebar: DefaultTheme.SidebarItem = { }, ], }, + { + text: "Bundler Client", + base: "/packages/aa-core/bundler-client/index", + link: "/index", + }, + { + text: "Bundler Actions", + collapsed: true, + base: "/packages/aa-core/bundler-client/index/actions", + items: [ + { + text: "sendRawUserOperation", + link: "/sendRawUserOperation", + }, + { + text: "estimateUserOperationGas", + link: "/estimateUserOperationGas", + }, + { + text: "getUserOperationByHash", + link: "/getUserOperationByHash", + }, + { + text: "getUserOperationReceipt", + link: "/getUserOperationReceipt", + }, + { + text: "getSupportedEntryPoints", + link: "/getSupportedEntryPoints", + }, + { + text: "bundlerActions", + link: "/bundlerActions", + }, + ], + }, { text: "Accounts", base: "/packages/aa-core/accounts", @@ -228,56 +264,6 @@ export const aaCoreSidebar: DefaultTheme.SidebarItem = { }, ], }, - { - text: "Public Client", - base: "/packages/aa-core/client", - collapsed: true, - items: [ - { - text: "Introduction", - link: "/", - }, - { - text: "Actions", - collapsed: true, - base: "/packages/aa-core/client/actions", - items: [ - { - text: "sendUserOperation", - link: "/sendUserOperation", - }, - { - text: "estimateUserOperationGas", - link: "/estimateUserOperationGas", - }, - { - text: "getUserOperationByHash", - link: "/getUserOperationByHash", - }, - { - text: "getUserOperationReceipt", - link: "/getUserOperationReceipt", - }, - { - text: "getSupportedEntryPoints", - link: "/getSupportedEntryPoints", - }, - ], - }, - { - text: "createPublicErc4337Client", - link: "/createPublicErc4337Client", - }, - { - text: "createPublicErc4337FromClient", - link: "/createPublicErc4337FromClient", - }, - { - text: "erc4337ClientActions", - link: "/erc4337ClientActions", - }, - ], - }, { text: "Utils", base: "/packages/aa-core/utils", diff --git a/site/.vitepress/sidebar/packages/aa-ethers.ts b/site/.vitepress/sidebar/packages/aa-ethers.ts index 455772e3e5..010f991e77 100644 --- a/site/.vitepress/sidebar/packages/aa-ethers.ts +++ b/site/.vitepress/sidebar/packages/aa-ethers.ts @@ -31,8 +31,8 @@ export const aaEthersSidebar: DefaultTheme.SidebarItem = { link: "/connectToAccount", }, { - text: "getPublicErc4337Client", - link: "/getPublicErc4337Client", + text: "getBundlerClient", + link: "/getBundlerClient", }, { text: "fromEthersProvider", @@ -62,8 +62,8 @@ export const aaEthersSidebar: DefaultTheme.SidebarItem = { link: "/sendTransaction", }, { - text: "getPublicErc4337Client", - link: "/getPublicErc4337Client", + text: "getBundlerClient", + link: "/getBundlerClient", }, { text: "connect", diff --git a/site/glossary/types.md b/site/glossary/types.md index 32b72edb5e..a8ebd0c19b 100644 --- a/site/glossary/types.md +++ b/site/glossary/types.md @@ -92,9 +92,9 @@ Type representing the various transport protocols supported by the package. This [See Type ↗️](https://github.com/alchemyplatform/aa-sdk/blob/main/packages/core/src/client/types.ts#L19) -## `PublicErc4337Client` +## `BundlerClient` -A client type that extends from the [`Viem` client](https://viem.sh/docs/clients/public.html). It integrates custom actions specific to [ERC-4337](https://accountkit.alchemy.com/glossary/terms.html#erc-4337). The `PublicErc4337Client` is used within the [Alchemy Provider](https://github.com/alchemyplatform/aa-sdk/blob/b0f8dd538728f8a7dd4447da8c88a50179d61f95/packages/alchemy/src/provider/base.ts#L26) as a JSON-RPC transport, supporting standard EVM RPC methods as well as facilitating communication and operations specific to ERC-4337, such as sending `UserOperations` (UOs), estimating gas, and fetching operation receipts and responses. +A client type that extends from the [`Viem` client](https://viem.sh/docs/clients/public.html). It integrates custom actions specific to [ERC-4337](https://accountkit.alchemy.com/glossary/terms.html#erc-4337). The `BundlerClient` is used within the [Alchemy Provider](https://github.com/alchemyplatform/aa-sdk/blob/b0f8dd538728f8a7dd4447da8c88a50179d61f95/packages/alchemy/src/provider/base.ts#L26) as a JSON-RPC transport, supporting standard EVM RPC methods as well as facilitating communication and operations specific to ERC-4337, such as sending `UserOperations` (UOs), estimating gas, and fetching operation receipts and responses. [See Type ↗️](https://github.com/alchemyplatform/aa-sdk/blob/main/packages/core/src/client/types.ts#L98) diff --git a/site/packages/aa-accounts/light-account/constructor.md b/site/packages/aa-accounts/light-account/constructor.md index 2006f167a5..8da3b901ac 100644 --- a/site/packages/aa-accounts/light-account/constructor.md +++ b/site/packages/aa-accounts/light-account/constructor.md @@ -63,7 +63,7 @@ A new instance of a `LightSmartContractAccount`. ### `params: SimpleSmartAccountParams` -- `rpcClient: string | PublicErc4337Client` -- a JSON-RPC URL, or a viem Client that supports ERC-4337 methods and Viem public actions. See [createPublicErc4337Client](/packages/aa-core/client/createPublicErc4337Client.md). +- `rpcClient: string | BundlerClient` -- a JSON-RPC URL, or a viem Client that supports ERC-4337 methods and Viem public actions. See [createBundlerClient](/packages/aa-core/bundler-client/index.md). - `chain: Chain` -- the chain on which to create the provider. diff --git a/site/packages/aa-accounts/light-account/provider.md b/site/packages/aa-accounts/light-account/provider.md index c588f9025e..3bf8414c8f 100644 --- a/site/packages/aa-accounts/light-account/provider.md +++ b/site/packages/aa-accounts/light-account/provider.md @@ -33,7 +33,7 @@ A Promise containing a new `SmartAccountProvider` connected to a Light Account. ### `config: LightAccountProviderConfig` -- `rpcProvider: string | PublicErc4337Client` -- a JSON-RPC URL, or a viem Client that supports ERC-4337 methods and Viem public actions. See [createPublicErc4337Client](/packages/aa-core/client/createPublicErc4337Client.md). +- `rpcProvider: string | BundlerClient` -- a JSON-RPC URL, or a viem Client that supports ERC-4337 methods and Viem public actions. See [createBundlerClient](/packages/aa-core/bundler-client/index.md). - `chain: Chain` -- the chain on which to create the provider. diff --git a/site/packages/aa-core/accounts/constructor.md b/site/packages/aa-core/accounts/constructor.md index 2283408176..6eba1dff64 100644 --- a/site/packages/aa-core/accounts/constructor.md +++ b/site/packages/aa-core/accounts/constructor.md @@ -62,7 +62,7 @@ A new instance of a `SimpleSmartContractAccount`. ### `params: SimpleSmartAccountParams` -- `rpcClient: string | PublicErc4337Client` -- a JSON-RPC URL, or a viem Client that supports ERC-4337 methods and Viem public actions. See [createPublicErc4337Client](/packages/aa-core/client/createPublicErc4337Client.md). +- `rpcClient: string | BundlerClient` -- a JSON-RPC URL, or a viem Client that supports ERC-4337 methods and Viem public actions. See [createBundlerClient](/packages/aa-core/bundler-client/index.md). - `chain: Chain` -- the chain on which to create the provider. diff --git a/site/packages/aa-core/bundler-client/actions/bundlerActions.md b/site/packages/aa-core/bundler-client/actions/bundlerActions.md new file mode 100644 index 0000000000..04744079b2 --- /dev/null +++ b/site/packages/aa-core/bundler-client/actions/bundlerActions.md @@ -0,0 +1,45 @@ +--- +outline: deep +head: + - - meta + - property: og:title + content: bundlerActions + - - meta + - name: description + content: Overview of the bundlerActions method in aa-core client + - - meta + - property: og:description + content: Overview of the bundlerActions method in aa-core client +next: + text: Utils +--- + +# bundlerActions + +Allows you to extend a viem `Client` with the new 4337 methods. + +## Usage + +::: code-group + +```ts [example.ts] +import { bundlerActions } from "@alchemy/aa-core"; +import { createPublicClient, http } from "viem"; + +const client = createPublicClient({ + chain: mainnet, + transport: http("https://eth-mainnet.g.alchemy.com/v2/demo"), +}).extend(bundlerActions); +``` + +## Returns + +### `BundlerActions` + +An object containing utility methods for calling the [Rundler RPC Methods](/packages/aa-core/bundler-client/index#rpc-methods). + +## Parameters + +### `Client` + +A viem Client that supports making JSON RPC calls to a Provider that supports the 4337 methods. diff --git a/site/packages/aa-core/client/actions/estimateUserOperationGas.md b/site/packages/aa-core/bundler-client/actions/estimateUserOperationGas.md similarity index 90% rename from site/packages/aa-core/client/actions/estimateUserOperationGas.md rename to site/packages/aa-core/bundler-client/actions/estimateUserOperationGas.md index 84d976d740..2b466f4dcd 100644 --- a/site/packages/aa-core/client/actions/estimateUserOperationGas.md +++ b/site/packages/aa-core/bundler-client/actions/estimateUserOperationGas.md @@ -6,10 +6,10 @@ head: content: estimateUserOperationGas - - meta - name: description - content: Overview of the estimateUserOperationGas action available on the PublicErc4337Client + content: Overview of the estimateUserOperationGas action available on the BundlerClient - - meta - property: og:description - content: Overview of the estimateUserOperationGas action available on the PublicErc4337Client + content: Overview of the estimateUserOperationGas action available on the BundlerClient --- # estimateUserOperationGas @@ -31,7 +31,7 @@ const estimates = await client.estimateUserOperationGas( ); ``` -<<< @/snippets/client.ts +<<< @/snippets/bundlerClient.ts ::: ## Returns diff --git a/site/packages/aa-core/client/actions/getSupportedEntryPoints.md b/site/packages/aa-core/bundler-client/actions/getSupportedEntryPoints.md similarity index 87% rename from site/packages/aa-core/client/actions/getSupportedEntryPoints.md rename to site/packages/aa-core/bundler-client/actions/getSupportedEntryPoints.md index 020cb3aad7..5a1ca728c1 100644 --- a/site/packages/aa-core/client/actions/getSupportedEntryPoints.md +++ b/site/packages/aa-core/bundler-client/actions/getSupportedEntryPoints.md @@ -6,10 +6,10 @@ head: content: getSupportedEntryPoints - - meta - name: description - content: Overview of the getSupportedEntryPoints action available on the PublicErc4337Client + content: Overview of the getSupportedEntryPoints action available on the BundlerClient - - meta - property: og:description - content: Overview of the getSupportedEntryPoints action available on the PublicErc4337Client + content: Overview of the getSupportedEntryPoints action available on the BundlerClient --- # getSupportedEntryPoints @@ -26,7 +26,7 @@ import { client } from "./client"; const entryPoints = await client.getSupportedEntryPoints(); ``` -<<< @/snippets/client.ts +<<< @/snippets/bundlerClient.ts ::: ## Returns diff --git a/site/packages/aa-core/client/actions/getUserOperationByHash.md b/site/packages/aa-core/bundler-client/actions/getUserOperationByHash.md similarity index 89% rename from site/packages/aa-core/client/actions/getUserOperationByHash.md rename to site/packages/aa-core/bundler-client/actions/getUserOperationByHash.md index 1265d69391..a9483d22d3 100644 --- a/site/packages/aa-core/client/actions/getUserOperationByHash.md +++ b/site/packages/aa-core/bundler-client/actions/getUserOperationByHash.md @@ -6,10 +6,10 @@ head: content: getUserOperationByHash - - meta - name: description - content: Overview of the getUserOperationByHash action available on the PublicErc4337Client + content: Overview of the getUserOperationByHash action available on the BundlerClient - - meta - property: og:description - content: Overview of the getUserOperationByHash action available on the PublicErc4337Client + content: Overview of the getUserOperationByHash action available on the BundlerClient --- # getUserOperationByHash @@ -26,7 +26,7 @@ import { client } from "./client"; const uo = await client.getUserOperationByHash("0xUserOperationHash"); ``` -<<< @/snippets/client.ts +<<< @/snippets/bundlerClient.ts ::: ## Returns diff --git a/site/packages/aa-core/client/actions/getUserOperationReceipt.md b/site/packages/aa-core/bundler-client/actions/getUserOperationReceipt.md similarity index 89% rename from site/packages/aa-core/client/actions/getUserOperationReceipt.md rename to site/packages/aa-core/bundler-client/actions/getUserOperationReceipt.md index 260090fc15..476bd71867 100644 --- a/site/packages/aa-core/client/actions/getUserOperationReceipt.md +++ b/site/packages/aa-core/bundler-client/actions/getUserOperationReceipt.md @@ -6,10 +6,10 @@ head: content: getUserOperationReceipt - - meta - name: description - content: Overview of the getUserOperationReceipt action available on the PublicErc4337Client + content: Overview of the getUserOperationReceipt action available on the BundlerClient - - meta - property: og:description - content: Overview of the getUserOperationReceipt action available on the PublicErc4337Client + content: Overview of the getUserOperationReceipt action available on the BundlerClient --- # getUserOperationReceipt @@ -26,7 +26,7 @@ import { client } from "./client"; const receipt = await client.getUserOperationReceipt("0xUserOperationHash"); ``` -<<< @/snippets/client.ts +<<< @/snippets/bundlerClient.ts ::: ## Returns diff --git a/site/packages/aa-core/client/actions/sendUserOperation.md b/site/packages/aa-core/bundler-client/actions/sendRawUserOperation.md similarity index 67% rename from site/packages/aa-core/client/actions/sendUserOperation.md rename to site/packages/aa-core/bundler-client/actions/sendRawUserOperation.md index d0140481a4..60d3e9cc3e 100644 --- a/site/packages/aa-core/client/actions/sendUserOperation.md +++ b/site/packages/aa-core/bundler-client/actions/sendRawUserOperation.md @@ -3,18 +3,18 @@ outline: deep head: - - meta - property: og:title - content: sendUserOperation + content: sendRawUserOperation - - meta - name: description - content: Overview of the sendUserOperation action available on the PublicErc4337Client + content: Overview of the sendRawUserOperation action available on the BundlerClient - - meta - property: og:description - content: Overview of the sendUserOperation action available on the PublicErc4337Client + content: Overview of the sendRawUserOperation action available on the BundlerClient prev: text: Public ERC-4337 Client --- -# sendUserOperation +# sendRawUserOperation Calls `eth_sendUserOperation` and returns the hash of the sent `UserOperation` (UO). @@ -25,7 +25,7 @@ Calls `eth_sendUserOperation` and returns the hash of the sent `UserOperation` ( ```ts [example.ts] import { client } from "./client"; -const hash = await client.sendUserOperation( +const hash = await client.sendRawUserOperation( { // ... user operation }, @@ -33,7 +33,7 @@ const hash = await client.sendUserOperation( ); ``` -<<< @/snippets/client.ts +<<< @/snippets/bundlerClient.ts ::: ## Returns diff --git a/site/packages/aa-core/client/index.md b/site/packages/aa-core/bundler-client/index.md similarity index 54% rename from site/packages/aa-core/client/index.md rename to site/packages/aa-core/bundler-client/index.md index dcf39f294c..c9fb95b235 100644 --- a/site/packages/aa-core/client/index.md +++ b/site/packages/aa-core/bundler-client/index.md @@ -3,22 +3,59 @@ outline: deep head: - - meta - property: og:title - content: Public Client + content: BundlerClient - - meta - name: description - content: Overview of the Public Client exported by aa-core + content: Introduction to BundlerClient exported by aa-core - - meta - property: og:description - content: Overview of the Public Client exported by aa-core -next: - text: Actions + content: Introduction to BundlerClient exported by aa-core --- -# Public ERC-4337 Client +# Bundler Client -Viem exports a `PublicClient` and utilities for creating the `PublicClient`. We extend that functionality here to provide a `PublicClient` that is also typed to work with the RPC endpoints introduced in [ERC-4337](https://eips.ethereum.org/EIPS/eip-4337). +The `BundlerClient` is an extension of viem's [`PublicClient`](https://viem.sh/docs/clients/public) that adds methods for interacting with Bundler RPC methods. -The `PublicErc4337Client` also has a number of methods that wrap the RPC Methods below to make it easier to interact with the RPC provider. +## Import + +```ts +import { createSmartAccountClient } from "@alchemy/aa-core"; +``` + +## Usage + +Initialize a `BundlerClient` in the same way you would initalize a [`PublicClient`](https://viem.sh/docs/clients/public#parameters) + +```ts +import { createBundlerClient } from "@alchemy/aa-core"; +import { http } from "viem"; +import { sepolia } from "@alchemy/aa-core"; + +export const smartAccountClient = createBundlerClient({ + transport: http("ALCHEMY_RPC_URL"), + chain: sepolia, +}); +``` + +If you already have a [`PublicClient`](https://viem.sh/docs/clients/public) instance, you can use `createBundlerClientFromExisting` to create a `BundlerClient` from it. + +```ts +import { createBundlerClientFromExisting } from "@alchemy/aa-core"; +import { http } from "viem"; +import { sepolia } from "@alchemy/aa-core"; + +export const smartAccountClient = createBundlerClientFromExisting(publicClient); +``` + +## Returns + +### `BundlerClient` + +A new instance of a `BundlerClient`. + +## Parameters + +Same parameters outlined in [viem's docs](https://viem.sh/docs/clients/public#parameters) ## RPC Methods diff --git a/site/packages/aa-core/client/createPublicErc4337Client.md b/site/packages/aa-core/client/createPublicErc4337Client.md deleted file mode 100644 index 7c53bca93d..0000000000 --- a/site/packages/aa-core/client/createPublicErc4337Client.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -outline: deep -head: - - - meta - - property: og:title - content: createPublicErc4337Client - - - meta - - name: description - content: Overview of the createPublicErc4337Client method in aa-core client - - - meta - - property: og:description - content: Overview of the createPublicErc4337Client method in aa-core client ---- - -# createPublicErc4337Client - -Allows you to create an HTTP-based PublicErc4337Client with a given RPC provider. - -## Usage - -::: code-group - -```ts [example.ts] -import { createPublicErc4337Client } from "@alchemy/aa-core"; -import { mainnet } from "@alchemy/aa-core"; - -const client = createPublicErc4337Client({ - chain: mainnet, - rpcUrl: "https://eth-mainnet.g.alchemy.com/v2/demo", -}); -``` - -::: - -## Returns - -### `PublicErc4337Client` - -An HTTP-based PublicErc4337Client that supports both traditional RPC methods and the new 4337 methods. - -## Parameters - -### `chain: Chain` - -The chain to connect to - -### `rpcUrl: string` - -The RPC URL to connect to - -### `fetchOptions?: HttpTransportConfig["fetchOptions"]` - -Optional set of params that let you override the default fetch options for the HTTP transport diff --git a/site/packages/aa-core/client/createPublicErc4337FromClient.md b/site/packages/aa-core/client/createPublicErc4337FromClient.md deleted file mode 100644 index 4a6424c4ac..0000000000 --- a/site/packages/aa-core/client/createPublicErc4337FromClient.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -outline: deep -head: - - - meta - - property: og:title - content: createPublicErc4337FromClient - - - meta - - name: description - content: Overview of the createPublicErc4337FromClient method in aa-core client - - - meta - - property: og:description - content: Overview of the createPublicErc4337FromClient method in aa-core client ---- - -# createPublicErc4337FromClient - -Allows you to create an HTTP-based PublicErc4337Client from an already created PublicClient. - -## Usage - -::: code-group - -```ts [example.ts] -import { createPublicErc4337FromClient } from "@alchemy/aa-core"; -import { mainnet } from "@alchemy/aa-core"; -import { createPublicClient, http } from "viem"; - -const publicClient = createPublicClient({ - transport: http("https://eth-mainnet.g.alchemy.com/v2/demo"), - chain: mainnet, -}); - -const client = createPublicErc4337FromClient(publicClient); -``` - -::: - -## Returns - -### `PublicErc4337Client` - -An HTTP-based PublicErc4337Client that supports both traditional RPC methods and the new 4337 methods. - -## Parameters - -### `client: PublicClient` - -The client to adapt to a 4337 client diff --git a/site/packages/aa-core/client/erc4337ClientActions.md b/site/packages/aa-core/client/erc4337ClientActions.md deleted file mode 100644 index f7eb5671aa..0000000000 --- a/site/packages/aa-core/client/erc4337ClientActions.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -outline: deep -head: - - - meta - - property: og:title - content: erc4337ClientActions - - - meta - - name: description - content: Overview of the erc4337ClientActions method in aa-core client - - - meta - - property: og:description - content: Overview of the erc4337ClientActions method in aa-core client -next: - text: Utils ---- - -# erc4337ClientActions - -Allows you to extend a viem `Client` with the new 4337 methods. - -## Usage - -::: code-group - -```ts [example.ts] -import { erc4337ClientActions } from "@alchemy/aa-core"; -import { createPublicClient } from "viem"; - -const client = createPublicClient({ - chain: mainnet, - rpcUrl: "https://eth-mainnet.g.alchemy.com/v2/demo", -}).extend(erc4337ClientActions); -``` - -## Returns - -### `Erc4337Actions` - -An object containing utility methods for calling the [ERC-4337 Methods](/packages/aa-core/client/#rpc-methods). - -## Parameters - -### `Client` - -A viem Client that supports making JSON RPC calls to a Provider that supports the 4337 methods. diff --git a/site/packages/aa-core/smart-account-client/index.md b/site/packages/aa-core/smart-account-client/index.md index cbef421e6f..c15547e1e4 100644 --- a/site/packages/aa-core/smart-account-client/index.md +++ b/site/packages/aa-core/smart-account-client/index.md @@ -26,7 +26,7 @@ import { createSmartAccountClient } from "@alchemy/aa-core"; ## Usage -Initialize a `SmartAcountClient` with your desired Chain and Transport using `createSmartAccountClient`, or use `createSmartAccountClientFromExisting` if you already have a [`BundlerClient`](/packages/aa-core/bundler-client) available +Initialize a `SmartAcountClient` with your desired Chain and Transport using `createSmartAccountClient`, or use `createSmartAccountClientFromExisting` if you already have a [`BundlerClient`](/packages/aa-core/bundler-client/index) available ::: code-group ```ts [createSmartAccountClient.ts] @@ -96,7 +96,7 @@ A new instance of a `SmartAccountClient`. #### If using `createSmartAccountClientFromExisting`: -- `client: BundlerClient` -- a [bundler client](/packages/aa-core/bundler-client) instance that will be used to communicate with an RPC provider that supports Ethereum RPC methods. +- `client: BundlerClient` -- a [bundler client](/packages/aa-core/bundler-client/index) instance that will be used to communicate with an RPC provider that supports Ethereum RPC methods. #### Common to both: diff --git a/site/packages/aa-ethers/account-signer/getPublicErc4337Client.md b/site/packages/aa-ethers/account-signer/getPublicErc4337Client.md index 6f5a22db94..18b11c455e 100644 --- a/site/packages/aa-ethers/account-signer/getPublicErc4337Client.md +++ b/site/packages/aa-ethers/account-signer/getPublicErc4337Client.md @@ -3,18 +3,18 @@ outline: deep head: - - meta - property: og:title - content: AccountSigner • getPublicErc4337Client + content: AccountSigner • getBundlerClient - - meta - name: description - content: Overview of the getPublicErc4337Client method on AccountSigner in aa-ethers + content: Overview of the getBundlerClient method on AccountSigner in aa-ethers - - meta - property: og:description - content: Overview of the getPublicErc4337Client method on AccountSigner in aa-ethers + content: Overview of the getBundlerClient method on AccountSigner in aa-ethers --- -# getPublicErc4337Client +# getBundlerClient -`getPublicErc4337Client` is a method on `AccountSigner` that gets the underlying viem client which has [EIP-4337](https://eips.ethereum.org/EIPS/eip-4337) capability. +`getBundlerClient` is a method on `AccountSigner` that gets the underlying viem client which has [EIP-4337](https://eips.ethereum.org/EIPS/eip-4337) capability. ## Usage @@ -24,7 +24,7 @@ head: import { signer } from "./ethers-signer"; // get the signer's underlying viem client with EIP-4337 capabilties -const client = signer.getPublicErc4337Client(); +const client = signer.getBundlerClient(); ``` <<< @/snippets/ethers-signer.ts @@ -32,6 +32,6 @@ const client = signer.getPublicErc4337Client(); ## Returns -### `PublicErc4337Client` +### `BundlerClient` -The provider's underlying `PublicErc4337Client` +The provider's underlying `BundlerClient` diff --git a/site/packages/aa-ethers/account-signer/introduction.md b/site/packages/aa-ethers/account-signer/introduction.md index 520bb6de98..d257409303 100644 --- a/site/packages/aa-ethers/account-signer/introduction.md +++ b/site/packages/aa-ethers/account-signer/introduction.md @@ -21,7 +21,7 @@ Notable differences between `EthersProviderAdapter` and `JsonRpcProvider` are im 1. [`getAddress`](/packages/aa-ethers/account-signer/getAddress) -- gets the `AccountSigner`'s smart account address. 2. [`signMessage`](/packages/aa-ethers/account-signer/signMessage) -- signs messages with the `AccountSigner`'s owner address. 3. [`sendTransaction`](/packages/aa-ethers/account-signer/sendTransaction) -- sends transactions on behalf of the `AccountSigner`'s smart account, with request and response formatted as if you were using the ethers.js library. -4. [`getPublicErc4337Client`](/packages/aa-ethers/account-signer/getPublicErc4337Client) -- gets the underlying viem cliemt with ERC-4337 compatability. +4. [`getBundlerClient`](/packages/aa-ethers/account-signer/getBundlerClient) -- gets the underlying viem cliemt with ERC-4337 compatability. 5. [`connect`](/packages/aa-ethers/account-signer/connect) -- connects the inputted provider to an account and returns an `AccountSigner`. ## Usage @@ -44,7 +44,7 @@ const txn = await signer.sendTransaction({ }); // get the signer's underlying viem client with EIP-4337 capabilties -const client = signer.getPublicErc4337Client(); +const client = signer.getBundlerClient(); ``` <<< @/snippets/ethers-signer.ts diff --git a/site/packages/aa-ethers/provider-adapter/connectToAccount.md b/site/packages/aa-ethers/provider-adapter/connectToAccount.md index 14597289e9..48ad072f89 100644 --- a/site/packages/aa-ethers/provider-adapter/connectToAccount.md +++ b/site/packages/aa-ethers/provider-adapter/connectToAccount.md @@ -32,6 +32,6 @@ A new instance of a connected `AccountSigner`for any implementation class of `IS ## Parameters -### `fn: (rpcClient: PublicErc4337Client) => TAccount extends ISmartContractAccount` +### `fn: (rpcClient: BundlerClient) => TAccount extends ISmartContractAccount` A function that takes in the provider's rpcClient and returns an AccountSigner diff --git a/site/packages/aa-ethers/provider-adapter/constructor.md b/site/packages/aa-ethers/provider-adapter/constructor.md index 96914568ff..74d68968a2 100644 --- a/site/packages/aa-ethers/provider-adapter/constructor.md +++ b/site/packages/aa-ethers/provider-adapter/constructor.md @@ -70,7 +70,7 @@ A new instance of an `EthersProviderAdapter`. Either: -- `rpcProvider: string | PublicErc4337Client` -- a JSON-RPC URL, or a viem Client that supports ERC-4337 methods and Viem public actions. See [createPublicErc4337Client](/packages/aa-core/client/createPublicErc4337Client.md). +- `rpcProvider: string | BundlerClient` -- a JSON-RPC URL, or a viem Client that supports ERC-4337 methods and Viem public actions. See [createBundlerClient](/packages/aa-core/bundler-client/index.md). - `chainId: number` -- the ID of thechain on which to create the provider. diff --git a/site/packages/aa-ethers/provider-adapter/getPublicErc4337Client.md b/site/packages/aa-ethers/provider-adapter/getPublicErc4337Client.md index 9796ef7a30..aaccb59edc 100644 --- a/site/packages/aa-ethers/provider-adapter/getPublicErc4337Client.md +++ b/site/packages/aa-ethers/provider-adapter/getPublicErc4337Client.md @@ -3,18 +3,18 @@ outline: deep head: - - meta - property: og:title - content: EthersProviderAdapter • getPublicErc4337Client + content: EthersProviderAdapter • getBundlerClient - - meta - name: description - content: Overview of the getPublicErc4337Client method on EthersProviderAdapter in aa-ethers + content: Overview of the getBundlerClient method on EthersProviderAdapter in aa-ethers - - meta - property: og:description - content: Overview of the getPublicErc4337Client method on EthersProviderAdapter in aa-ethers + content: Overview of the getBundlerClient method on EthersProviderAdapter in aa-ethers --- -# getPublicErc4337Client +# getBundlerClient -`getPublicErc4337Client` is a method on `EthersProviderAdapter` that gets the underlying viem client which has [EIP-4337](https://eips.ethereum.org/EIPS/eip-4337) capability. +`getBundlerClient` is a method on `EthersProviderAdapter` that gets the underlying viem client which has [EIP-4337](https://eips.ethereum.org/EIPS/eip-4337) capability. ## Usage @@ -24,7 +24,7 @@ head: import { provider } from "./ethers-provider"; // get the provider's underlying viem client with EIP-4337 capabilties -const client = provider.getPublicErc4337Client(); +const client = provider.getBundlerClient(); ``` <<< @/snippets/ethers-provider.ts @@ -32,6 +32,6 @@ const client = provider.getPublicErc4337Client(); ## Returns -### `PublicErc4337Client` +### `BundlerClient` -The provider's underlying `PublicErc4337Client` +The provider's underlying `BundlerClient` diff --git a/site/packages/aa-ethers/provider-adapter/introduction.md b/site/packages/aa-ethers/provider-adapter/introduction.md index ccd29cbfd3..e1f2f894b4 100644 --- a/site/packages/aa-ethers/provider-adapter/introduction.md +++ b/site/packages/aa-ethers/provider-adapter/introduction.md @@ -20,7 +20,7 @@ Notable differences between `EthersProviderAdapter` and `JsonRpcProvider` are im 1. [`send`](/packages/aa-ethers/provider-adapter/send) -- sends [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193)-compliant requests through the account provider. 2. [`connectToAccount`](/packages/aa-ethers/provider-adapter/connectToAccount) -- connects the provider to an account and returns an `AccountSigner`. -3. [`getPublicErc4337Client`](/packages/aa-ethers/provider-adapter/getPublicErc4337Client) -- gets the underlying viem cliemt with ERC-4337 compatability. +3. [`getBundlerClient`](/packages/aa-ethers/provider-adapter/getBundlerClient) -- gets the underlying viem cliemt with ERC-4337 compatability. 4. [`fromEthersProvider`](/packages/aa-ethers/provider-adapter/fromEthersProvider) -- static method that converts an `ethers.js` `JsonRpcProvider` to an `EthersProviderAdapter`. ## Usage @@ -40,7 +40,7 @@ import { polygonMumbai } from "@alchemy/aa-core"; const chainId = await provider.send("eth_chainId", []); // get the provider's underlying viem client with EIP-4337 capabilties -const client = provider.getPublicErc4337Client(); +const client = provider.getBundlerClient(); // connect the provider to an AccountSigner const owner: SmartAccountSigner = LocalAccountSigner.mnemonicToAccountSigner( diff --git a/site/snippets/bundlerClient.ts b/site/snippets/bundlerClient.ts new file mode 100644 index 0000000000..c9398fd28e --- /dev/null +++ b/site/snippets/bundlerClient.ts @@ -0,0 +1,7 @@ +import { createBundlerClient, mainnet } from "@alchemy/aa-core"; +import { http } from "viem"; + +export const client = createBundlerClient({ + chain: mainnet, + transport: http("https://eth-mainnet.g.alchemy.com/v2/demo"), +}); diff --git a/site/snippets/client.ts b/site/snippets/client.ts deleted file mode 100644 index 8e1907b968..0000000000 --- a/site/snippets/client.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { createPublicErc4337Client, mainnet } from "@alchemy/aa-core"; - -export const client = createPublicErc4337Client({ - chain: mainnet, - rpcUrl: "https://eth-mainnet.g.alchemy.com/v2/demo", -});