Skip to content

Commit

Permalink
docs: update the aa-core docs for bundler client
Browse files Browse the repository at this point in the history
  • Loading branch information
moldy530 committed Jan 31, 2024
1 parent 408b5a4 commit 8817be1
Show file tree
Hide file tree
Showing 25 changed files with 184 additions and 261 deletions.
86 changes: 36 additions & 50 deletions site/.vitepress/sidebar/packages/aa-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions site/.vitepress/sidebar/packages/aa-ethers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export const aaEthersSidebar: DefaultTheme.SidebarItem = {
link: "/connectToAccount",
},
{
text: "getPublicErc4337Client",
link: "/getPublicErc4337Client",
text: "getBundlerClient",
link: "/getBundlerClient",
},
{
text: "fromEthersProvider",
Expand Down Expand Up @@ -62,8 +62,8 @@ export const aaEthersSidebar: DefaultTheme.SidebarItem = {
link: "/sendTransaction",
},
{
text: "getPublicErc4337Client",
link: "/getPublicErc4337Client",
text: "getBundlerClient",
link: "/getBundlerClient",
},
{
text: "connect",
Expand Down
4 changes: 2 additions & 2 deletions site/glossary/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion site/packages/aa-accounts/light-account/constructor.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion site/packages/aa-accounts/light-account/provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ A Promise containing a new `SmartAccountProvider` connected to a Light Account.

### `config: LightAccountProviderConfig`

- `rpcProvider: string | PublicErc4337Client<TTransport extends SupportedTransports = Transport>` -- 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<TTransport extends SupportedTransports = Transport>` -- 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.

Expand Down
2 changes: 1 addition & 1 deletion site/packages/aa-core/accounts/constructor.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
45 changes: 45 additions & 0 deletions site/packages/aa-core/bundler-client/actions/bundlerActions.md
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,7 +31,7 @@ const estimates = await client.estimateUserOperationGas(
);
```

<<< @/snippets/client.ts
<<< @/snippets/bundlerClient.ts
:::

## Returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,7 +26,7 @@ import { client } from "./client";
const entryPoints = await client.getSupportedEntryPoints();
```

<<< @/snippets/client.ts
<<< @/snippets/bundlerClient.ts
:::

## Returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,7 +26,7 @@ import { client } from "./client";
const uo = await client.getUserOperationByHash("0xUserOperationHash");
```

<<< @/snippets/client.ts
<<< @/snippets/bundlerClient.ts
:::

## Returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,7 +26,7 @@ import { client } from "./client";
const receipt = await client.getUserOperationReceipt("0xUserOperationHash");
```

<<< @/snippets/client.ts
<<< @/snippets/bundlerClient.ts
:::

## Returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand All @@ -25,15 +25,15 @@ 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
},
"0xEntryPointAddress"
);
```

<<< @/snippets/client.ts
<<< @/snippets/bundlerClient.ts
:::

## Returns
Expand Down
Loading

0 comments on commit 8817be1

Please sign in to comment.