Skip to content

Commit 0472600

Browse files
0xfourzerofourniveda-krishsilviavlgraphite-app[bot]
authored
feat(docs): rebased infra docs (#2048)
* fix: merge conflict * docs: added swaps page under transactions (#1953) * docs: added tx overview (#1999) * chore: add overview page for low level infra * fix: merge conflict * fix: merge conflict * fix: page links * feat(docs): low level bundler docs (#2026) * feat(docs): bundler docs init * feat(docs): add sdk example * feat(docs): change path * Update docs/pages/low-level-infra/bundler/sdk.mdx Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> * Update docs/pages/low-level-infra/bundler/sdk.mdx Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> * Update docs/pages/low-level-infra/bundler/sdk.mdx Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> * feat(docs): change path * feat(docs): change path back * feat(docs): alter path * feat(docs): alter path * feat(docs): change to new seciton * feat(docs): remove url from section * feat(docs): clean up info * feat(docs): lint --------- Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> * feat(docs): add config * feat(docs): change to ts * feat(bundler): change to modularAccountClient * feat(infra): fix --------- Co-authored-by: Niveda Krishnamoorthy <81185262+niveda-krish@users.noreply.github.com> Co-authored-by: silviavl <82773616+silviavl@users.noreply.github.com> Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
1 parent 2807f9d commit 0472600

File tree

12 files changed

+207
-3
lines changed

12 files changed

+207
-3
lines changed

docs-site

docs/docs.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,26 @@ navigation:
220220
- page: Overview
221221
path: wallets/pages/low-level-infra/overview.mdx
222222
- page: Quickstart
223-
path: wallets/pages/low-level-infra/quickstart.mdx
223+
path: wallets/pages/low-level-infra/quickstart/quickstart.mdx
224+
- section: Gas Manager
225+
contents:
226+
- section: Policy Management
227+
contents:
228+
- page: API Endpoints
229+
path: wallets/pages/low-level-infra/gas-manager/policy-management/api-endpoints.mdx
230+
- section: Gas Sponsorship
231+
contents:
232+
- page: API Endpoints
233+
path: wallets/pages/low-level-infra/gas-manager/gas-sponsorship/api-endpoints.mdx
234+
- section: Bundler
235+
path: wallets/pages/low-level-infra/bundler/overview.mdx
236+
contents:
237+
- page: API Endpoints
238+
path: wallets/pages/low-level-infra/bundler/api-endpoints.mdx
239+
- page: Using SDK
240+
path: wallets/pages/low-level-infra/bundler/sdk.mdx
241+
- page: Bundler FAQs
242+
path: wallets/pages/bundler-api/bundler-faqs.mdx
224243

225244
- section: PRE-BLITZ TO REMOVE Transactions
226245
contents:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Bundler API Endpoints
3+
description: The Bundler API Endpoints allow you to interact with the lowest level of the account abstraction stack, giving users full control over their User Operations.
4+
subtitle: The Bundler API Endpoints allow you to interact with the lowest level of the account abstraction stack.
5+
---
6+
7+
<Markdown src="../../../shared/infra/api-endpoints/bundler.mdx" />
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: Bundler Overview
3+
description: Raw EIP-4337 Bundler APIs for advanced developers
4+
slug: wallets/transactions/low-level-infra/bundler/overview
5+
---
6+
7+
The Bundler is a key component in the ERC-4337 Account Abstraction stack, responsible for collecting, validating, and bundling UserOperations (UserOps) into transactions that are submitted to the EntryPoint contract on the blockchain. In Alchemy's Account Kit, the Bundler APIs provide direct access to our high-performance, scalable bundler infrastructure (powered by Rundler), enabling developers to interact with a production-grade ERC-4337 bundler for reliable on-chain submission of UserOps.
8+
These APIs are part of the `@account-kit/infra` library, allowing advanced customization when building smart wallet applications. They follow the standard ERC-4337 JSON-RPC endpoints and support versions v0.6 and v0.7 of the protocol, with optimizations for gas estimation, validation, and error handling to ensure UserOps land efficiently while protecting against attacks.
9+
10+
For full control, bring your own smart contracts or signers while leveraging Alchemy's bundler for scalability. If you prefer a higher-level abstraction, use the Wallet APIs or aa-sdk instead.
11+
12+
<markdown src="../../../shared/infra/api-endpoints/bundler.mdx"></markdown>
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<Info>**Required SDK version**: ^v4.59.1</Info>
2+
3+
## Using the `@account-kit/infra` Library for UserOperation Management
4+
5+
The `@account-kit/infra` library enables direct interaction with Alchemy's ERC-4337 bundler for advanced UserOperation management. The `alchemyFeeEstimator` function leverages underlying APIs, including `rundler_maxPriorityFeePerGas` and `eth_estimateUserOperation`, to estimate gas fees for UserOperations. Below are examples demonstrating how to estimate and send a UserOperation and how to retrieve a UserOperation by its hash using low-level Bundler APIs.
6+
7+
<CodeBlocks>
8+
9+
```ts twoslash title="config.ts"
10+
import { alchemy, sepolia } from "@account-kit/infra";
11+
12+
const YOUR_API_KEY = "<YOUR_API_KEY>";
13+
export const YOUR_PRIVATE_KEY = "<YOUR_PRIVATE_KEY>";
14+
export const chain = sepolia;
15+
16+
export const transport = alchemy({
17+
apiKey: YOUR_API_KEY,
18+
});
19+
```
20+
21+
```ts twoslash title="estimateAndSendUserOperation.ts"
22+
import { alchemyFeeEstimator } from "@account-kit/infra";
23+
import { createModularAccountV2Client } from "@account-kit/smart-contracts";
24+
import { LocalAccountSigner } from "@aa-sdk/core";
25+
import { entryPoint07Address } from "viem/account-abstraction";
26+
import {
27+
chain,
28+
transport
29+
YOUR_PRIVATE_KEY,
30+
} from "./config.ts";
31+
32+
export async function estimateAndSendUserOperation() {
33+
const client = await createModularAccountV2Client({
34+
signer: LocalAccountSigner.privateKeyToAccountSigner(YOUR_PRIVATE_KEY),
35+
chain,
36+
transport,
37+
feeEstimator: alchemyFeeEstimator(transport),
38+
});
39+
40+
try {
41+
let uo = await client.buildUserOperation({
42+
uo: {
43+
data: "0x",
44+
target: "0x0000000000000000000000000000000000000000",
45+
},
46+
});
47+
const uoWithSig = await client.signUserOperation({ uoStruct: uo });
48+
const sendResult = await client.sendRawUserOperation(
49+
uoWithSig,
50+
entryPoint07Address,
51+
);
52+
await client.waitForUserOperationTransaction({
53+
hash: sendResult,
54+
retries: {
55+
intervalMs: 100,
56+
maxRetries: 600,
57+
multiplier: 0,
58+
},
59+
});
60+
const receipt = await client.getUserOperationReceipt(sendResult);
61+
console.log("UserOperation receipt:", receipt);
62+
} catch (error) {
63+
console.error("Error processing UserOperation:", error);
64+
}
65+
}
66+
```
67+
68+
```ts twoslash title="getUserOperationByHash.ts"
69+
import { createAlchemyPublicRpcClient } from "@account-kit/infra";
70+
import { chain, transport } from "./config.ts";
71+
import type { Hash } from "viem";
72+
73+
export async function getUserOperationByHash(uoHash: Hash) {
74+
const client = createAlchemyPublicRpcClient({
75+
chain,
76+
transport,
77+
});
78+
try {
79+
let userOp = await client.getUserOperationByHash(uoHash);
80+
console.log("User Operation: ", userOp);
81+
} catch (error) {
82+
console.error("Error processing UserOperation:", error);
83+
}
84+
}
85+
```
86+
87+
</CodeBlocks>
88+
89+
<Info>
90+
Make sure that you environment is set with your correct `ALCHEMY_API_KEY` and
91+
`PRIVATE_KEY`. These examples assume familiarity with ERC-4337 and proper
92+
configuration of the EntryPoint contract (`entryPoint07Address`).
93+
</Info>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: Gas Sponsorship API Endpoints
3+
description: The Gas Sponsorship API Endpoints allows you to sponsor gas fees for your users, removing the biggest barrier to entry.
4+
subtitle: The Gas Coverage API Endpoints allows you to sponsor gas fees for your users, removing the biggest barrier to entry.
5+
url: https://docs.alchemy.com/reference/paymaster-sponsorship-api-endpoints
6+
slug: reference/paymaster-sponsorship-api-endpoints
7+
---
8+
9+
<Markdown src="../../../../shared/infra/api-endpoints/gas-manager-sponsorship.mdx" />
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: Gas Manager Admin API Endpoints
3+
description: The Gas Manager Admin API Endpoints allows you to programmatically manage your gas manager policies.
4+
subtitle: The Gas Manager Admin API Endpoints allows you to programmatically manage your gas manager policies.
5+
url: https://docs.alchemy.com/reference/paymaster-admin-api-endpoints
6+
slug: reference/paymaster-admin-api-endpoints
7+
---
8+
9+
<Markdown src="../../../../shared/infra/api-endpoints/gas-manager-policy.mdx" />

docs/pages/low-level-infra/overview.mdx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,15 @@ description: Raw EIP-4337 APIs for advanced developers
44
slug: wallets/transactions/low-level-infra/overview
55
---
66

7-
Coming soon...
7+
# Lower Level Infra Overview
8+
9+
Smart Wallets is composed of some lower-level libraries if you're looking for further customization of your stack or want more control over how you build your application and use third party providers.
10+
One of these libraries is `@account-kit/infra` which allows you to interact with our infrastructure directly, while bringing your own smart contracts or signer.
11+
12+
If you do not need customization, we highly recommend that you use our Wallet APIs to simplify development.
13+
14+
<Markdown src="../../shared/infra/api-endpoints/bundler.mdx" />
15+
16+
<Markdown src="../../shared/infra/api-endpoints/gas-manager-policy.mdx" />
17+
18+
<Markdown src="../../shared/infra/api-endpoints/gas-manager-sponsorship.mdx" />
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Low-level Infrastructure Quickstart
3+
description: Raw EIP-4337 APIs for advanced developers
4+
slug: wallets/transactions/low-level-infra/quickstart
5+
---
6+
7+
Coming soon...
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## What is the Bundler API?
2+
3+
The Bundler APIs are a collection of ERC-4337 compliant JSON-RPC endpoints which makes it possible for users to work with user operations. Below are the Bundler API endpoints available and the corresponding docs for each of them.
4+
5+
| Method | Description |
6+
| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
7+
| [eth_sendUserOperation](/docs/node/bundler-api/bundler-api-endpoints/eth-send-user-operation) | Submits a user operation to a Bundler. If the request is successful, the endpoint will return a user operation hash that the caller can use to look up the status of the user operation. If it fails, or another error occurs, an error code and description will be returned. |
8+
| [eth_estimateUserOperationGas](docs/node/bundler-api/bundler-api-endpoints/eth-estimate-user-operation-gas) | Estimates the gas values for a user operation. It returns the [preVerificationGas], [verificationGasLimit], and [callGasLimit] values associated with the provided user operation. |
9+
| [eth_getUserOperationByHash](/docs/node/bundler-api/bundler-api-endpoints/eth-get-user-operation-by-hash) | Returns a user operation based on the given user operation hash. It returns the user operation along with extra information including what block/transaction it was included in. If the operation has not yet been included, it will return [null]. |
10+
| [eth_getUserOperationReceipt](/docs/node/bundler-api/bundler-api-endpoints/eth-get-user-operation-receipt) | Returns a user operation receipt ( metadata associated with the given user operation ) based on the given user operation hash. It returns [null] if the user operation has not yet been included. |
11+
| [rundler_maxPriorityFeePerGas](/docs/node/bundler-api/bundler-api-endpoints/rundler-max-priority-fee-per-gas) | Returns a fee per gas that is an estimate of how much users should set as a priority fee in UOs for Rundler endpoints. |
12+
| [eth_supportedEntryPoints](/docs/node/bundler-api/bundler-api-endpoints/eth-supported-entry-points) | Returns a list of Entrypoint contract addresses supported by the bundler endpoints. |

0 commit comments

Comments
 (0)