Skip to content

Commit 38ba477

Browse files
bgravenorstalexandratranyashovardhan
authored
Document Infura Bundler support (MetaMask#2183)
* Document bundler methods. Signed-off-by: bgravenorst <[email protected]> * Add costing to lib file. Signed-off-by: bgravenorst <[email protected]> * Remove redundent files. Signed-off-by: bgravenorst <[email protected]> * Fix incorrect method name. Signed-off-by: bgravenorst <[email protected]> * Add error codes. Signed-off-by: bgravenorst <[email protected]> * Added v6 methods. Signed-off-by: bgravenorst <[email protected]> * Fix tip. Signed-off-by: bgravenorst <[email protected]> * Add calldata. Signed-off-by: bgravenorst <[email protected]> * Apply suggestions from code review Co-authored-by: Alexandra Carrillo <[email protected]> * Add additional methods and update pricing. Signed-off-by: bgravenorst <[email protected]> * Add additional methods. Signed-off-by: bgravenorst <[email protected]> * Remove pm methods added earlier. Signed-off-by: bgravenorst <[email protected]> * Add bundler support to multiple networks. Signed-off-by: bgravenorst <[email protected]> * Update services/concepts/bundler.md Co-authored-by: Alexandra Carrillo <[email protected]> --------- Signed-off-by: bgravenorst <[email protected]> Co-authored-by: Alexandra Carrillo <[email protected]> Co-authored-by: Yashovardhan Agrawal <[email protected]>
1 parent 991f05b commit 38ba477

File tree

330 files changed

+11509
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

330 files changed

+11509
-5
lines changed

services/concepts/bundler.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
description: Infura supports ERC-4337 bundler methods.
3+
sidebar_label: Bundler methods
4+
---
5+
6+
# Bundler methods (ERC-4337)
7+
8+
Infura supports [ERC-4337](https://docs.erc4337.io/) bundler JSON-RPC methods that enable you to build
9+
account abstraction (AA) experiences like gas sponsorship (paymasters), ERC-20 gas payment, session keys, or
10+
batched actions using smart accounts.
11+
12+
If your dapp or wallet uses smart accounts, use the bundler JSON-RPC methods. If you use externally
13+
owned accounts (EOAs) only, use standard Ethereum JSON-RPC methods.
14+
15+
:::info
16+
AA moves validation and fee-payment logic into smart contracts. Instead of sending raw transactions
17+
from an EOA, clients submit [user operations (UserOps)](#user-operations) to a bundler. The
18+
bundler collects and simulates these operations, then executes them through a
19+
[shared coordination contract (EntryPoint)](#entrypoint-contracts) on the network.
20+
21+
Smart accounts are smart contract-based wallets that serve as the foundation of AA. They embed custom
22+
logic for authentication, authorization, network fee payment, nonce management and execution.
23+
:::
24+
25+
:::info
26+
Refer to the [official Pimlico documentation](https://docs.pimlico.io/references/bundler)
27+
for more about the bundler methods and
28+
[EntryPoint errors](https://docs.pimlico.io/references/bundler/entrypoint-errors#entrypoint-errors).
29+
:::
30+
31+
## User operations
32+
33+
A user operation (UserOp) is an is an off-chain request that a bundler later includes onchain by
34+
calling the EntryPoint. UserOps go to a dedicated mempool watched by bundlers instead of being broadcast
35+
as raw L1/L2 transactions.
36+
37+
## EntryPoint contract
38+
39+
The EntryPoint contract is the shared coordination contract defined by ERC-4337. Bundlers call them to
40+
validate and execute user operations (UserOps) from smart accounts. At a high level, an EntryPoint:
41+
42+
- Runs the ERC-4337 validation and execution.
43+
- Enforces nonce and signature checks exposed by each smart account.
44+
- Coordinates fee payment (including paymasters).
45+
- Executes the requested calls onchain.
46+
47+
The bundler supports calling multiple EntryPoint versions (v0.6 and v0.7/v0.8) through the same set
48+
of RPC methods, allowing it to handle both older and modern smart account schemes.
49+
50+
Use the [`eth_supportedEntryPoints`](../reference/ethereum/json-rpc-methods/bundler/eth_supportedentrypoints)
51+
method to fetch the EntryPoint addresses supported by the bundler.
52+
53+
## Supported methods
54+
55+
The following bundler methods are available on the [supported networks](#supported-networks):
56+
57+
- [`eth_sendUserOperation`](../reference/ethereum/json-rpc-methods/bundler/eth_senduseroperation.mdx):
58+
Submits a user operation to be included onchain.
59+
- [`eth_estimateUserOperationGas`](../reference/ethereum/json-rpc-methods/bundler/eth_estimateuseroperationgas):
60+
Simulates the user operation and estimates the appropriate gas limits.
61+
- [`eth_getUserOperationReceipt`](../reference/ethereum/json-rpc-methods/bundler/eth_getuseroperationreceipt):
62+
Fetches the receipt of a user operation.
63+
- [`eth_getUserOperationByHash`](../reference/ethereum/json-rpc-methods/bundler/eth_getuseroperationbyhash):
64+
Fetches the user operation by hash.
65+
- [`eth_supportedEntryPoints`](../reference/ethereum/json-rpc-methods/bundler/eth_supportedentrypoints):
66+
Fetches the EntryPoint addresses supported by the bundler.
67+
- [`pimlico_getUserOperationGasPrice`](../reference/ethereum/json-rpc-methods/bundler/pimlico_getuseroperationgasprice):
68+
Returns the gas prices that must be used for the user operation.
69+
- [`pimlico_getUserOperationStatus`](../reference/ethereum/json-rpc-methods/bundler/pimlico_getuseroperationstatus):
70+
Returns the user operation status.
71+
- [`pimlico_simulateAssetChanges`](../reference/ethereum/json-rpc-methods/bundler/pimlico_simulateassetchanges):
72+
Simulates a user operation to predict the asset changes it will cause.
73+
74+
## Supported networks
75+
76+
Bundler methods are active on the following networks:
77+
78+
- [Arbitrum](../reference/arbitrum/json-rpc-methods/bundler/index.md) (mainnet and Sepolia)
79+
- [Avalanche](../reference/avalanche-c-chain/json-rpc-methods/bundler/index.md) (mainnet and Fuji)
80+
- [Base](../reference/base/json-rpc-methods/bundler/index.md) (mainnet and Sepolia)
81+
- [Blast](../reference/blast/json-rpc-methods/bundler/index.md) (mainnet and Sepolia)
82+
- [BNB Smart Chain](../reference/bnb-smart-chain/json-rpc-methods/bundler/index.md) (mainnet and testnet)
83+
- [Celo](../reference/celo/json-rpc-methods/bundler/index.md) (mainnet and Alfajores)
84+
- [Ethereum](../reference/ethereum/json-rpc-methods/bundler/index.md) (mainnet and Sepolia)
85+
- [Linea](../reference/linea/json-rpc-methods/bundler/index.md) (mainnet and Sepolia)
86+
- [Mantle](../reference/mantle/json-rpc-methods/bundler/index.md) (mainnet and Sepolia)
87+
- [opBNB](../reference/opbnb/json-rpc-methods/bundler/index.md) (mainnet)
88+
- [Optimism](../reference/optimism/json-rpc-methods/bundler/index.md) (mainnet and Sepolia)
89+
- [Polygon](../reference/polygon-pos/json-rpc-methods/bundler/index.md) (mainnet and Amoy)
90+
- [Scroll](../reference/scroll/json-rpc-methods/bundler/index.md) (mainnet and Sepolia)
91+
- [Sei](../reference/sei/json-rpc-methods/bundler/index.md) (mainnet and testnet)
92+
- [Unichain](../reference/unichain/json-rpc-methods/bundler/index.md) (mainnet and Sepolia)
93+
94+
:::info
95+
[Contact support](https://support.infura.io/) if you require bundler method activation on a network not listed here that’s currently supported by Pimlico.
96+
:::

services/get-started/pricing/credit-cost.mdx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,18 @@ a specific network, then use the default Ethereum method's credit cost.
4646

4747
<CreditCostTable methods="evm" />
4848

49-
5049
### Trace methods
5150

5251
<CreditCostTable methods="evm_trace" />
5352

54-
5553
### Filter methods
5654

5755
<CreditCostTable methods="evm_filter" />
5856

5957
### Debug methods
6058

61-
6259
<CreditCostTable methods="evm_debug" />
6360

64-
6561
### Subscription events
6662

6763
You can subscribe and unsubscribe to events using [`eth_subscribe`](../../reference/ethereum/json-rpc-methods/subscription-methods/eth_subscribe.mdx) and [`eth_unsubscribe`](../../reference/ethereum/json-rpc-methods/subscription-methods/eth_unsubscribe.mdx).
@@ -75,7 +71,6 @@ are charged at approximately one second intervals.
7571

7672
<CreditCostTable methods="linea" />
7773

78-
7974
## Polygon
8075

8176
<CreditCostTable methods="polygon" />
@@ -95,3 +90,11 @@ All Solana methods are charged at 160 credits per request.
9590
## Gas API
9691

9792
<CreditCostTable methods="gasApi" />
93+
94+
## Bundler API
95+
96+
:::info
97+
The Bundler API methods are currently only available on Ethereum Mainnet and Sepolia.
98+
:::
99+
100+
<CreditCostTable methods="bundler" />
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import CreditCost from '@site/src/components/CreditCost/CreditCostPrice.js'
2+
3+
Simulates the user operation and estimates the appropriate gas limits. Returns an error if the operation
4+
is unsuccessful. <CreditCost network="bundler" method="eth_estimateUserOperationGas" />
5+
6+
:::tip
7+
- You can use `stateOverrides` to estimate the gas cost even if the sender has no funds.
8+
However, if the operation is sent onchain when the sender has no balance, it will revert during
9+
the call phase due to lack of funds.
10+
11+
- You can include a dummy signature for the `signature` field to estimate the gas cost. For example:
12+
`0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c`
13+
:::
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Replace `<YOUR-API-KEY>` with an API key from your [MetaMask Developer dashboard](https://developer.metamask.io/).
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import Tabs from "@theme/Tabs"
2+
import TabItem from "@theme/TabItem"
3+
4+
<Tabs>
5+
<TabItem value="v0.7" label="v0.7 and v0.8 user operation">
6+
7+
- `userOperation`: The user operation object containing the following fields:
8+
9+
- `sender`: (string) - The address of the account making the operation.
10+
- `nonce`: (string) - Unique identifier for the request from this sender. This includes the key and sequence number.
11+
- `factory`: (string) [_optional_] - The factory contract address that will deploy the smart account if it doesn't exist yet.
12+
- `factoryData`: (string) [_optional_] - The data passed to the factory contract to deploy the smart account.
13+
- `callData`: (string) [_optional_] - The data to pass to the sender during the main execution call.
14+
- `callGasLimit`: (string) - The amount of gas to allocate the main execution call.
15+
- `verificationGasLimit`: (string) - The amount of gas to allocate for the verification step.
16+
- `preVerificationGas`: (string) - The amount of gas to pay for to compensate the bundler for pre-verification execution and `calldata`.
17+
- `maxFeePerGas`: (string) - Maximum fee per gas, in wei, the sender is willing to pay per gas.
18+
- `maxPriorityFeePerGas`: (string) - Maximum fee, in wei, the sender is willing to pay per gas above the base fee.
19+
- `paymaster`: (string) [_optional_] - Address of paymaster sponsoring the transaction, or `null` if none.
20+
- `paymasterVerificationGasLimit`: (string) [_optional_] - The amount of gas to allocate for the verification step of the paymaster, or `null` if no paymaster.
21+
- `paymasterPostOpGasLimit`: (string) [_optional_] - The amount of gas to allocate for the post-operation step of the paymaster, or `null` if no paymaster.
22+
- `paymasterData`: (string) [_optional_] - The data to pass to the paymaster during the verification step, or `null` if no paymaster.
23+
- `signature`: (string) - The signature data. For gas estimation, this can be a dummy signature.
24+
- `eip7702Auth`: (object) [_optional_] - The EIP-7702 authorization data. This can be a dummy authorization
25+
for estimations:
26+
- `address`: (string) - The contract address for the authorization.
27+
- `chainId`: (string) - The chain ID.
28+
- `nonce`: (string) - The nonce.
29+
- `r`: (string) - The r component of the signature.
30+
- `s`: (string) - The s component of the signature.
31+
- `v`: (string) - The v component of the signature.
32+
- `yParity`: (string) - The y-parity value.
33+
34+
- `entryPoint`: (string) - The EntryPoint contract address (`0x0000000071727De22E5E9d8BAf0edAc6f37da032`).
35+
36+
- `stateOverrides`: (object) [_optional_] - State overrides to apply for the simulation. Each key is an address, and each value is an object that can contain:
37+
- `balance`: (string) [_optional_] - The balance to set for the address.
38+
- `nonce`: (string) [_optional_] - The nonce to set for the address.
39+
- `code`: (string) [_optional_] - The code to set for the address.
40+
- `state`: (object) [_optional_] - Complete state to set, where each key is a 32-byte hex storage slot and each value is a 32-byte hex value.
41+
- `stateDiff`: (object) [_optional_] - State differences to apply, where each key is a 32-byte hex storage slot and each value is a 32-byte hex value.
42+
43+
</TabItem>
44+
<TabItem value="v0.6" label="v0.6 user operation">
45+
46+
- `userOperation`: The user operation object containing the following fields:
47+
48+
- `sender`: (string) - The address of the account making the operation.
49+
- `nonce`: (string) - Unique identifier for the request from this sender.
50+
- `initCode`: (string) - The initialization code for the smart account if it doesn't exist yet.
51+
- `callData`: (string) [_optional_] - The data to pass to the sender during the main execution call.
52+
- `callGasLimit`: (string) - The amount of gas to allocate the main execution call.
53+
- `verificationGasLimit`: (string) - The amount of gas to allocate for the verification step.
54+
- `preVerificationGas`: (string) - The amount of gas to pay for to compensate the bundler for pre-verification execution and `calldata`.
55+
- `maxFeePerGas`: (string) - Maximum fee per gas, in wei, the sender is willing to pay per gas.
56+
- `maxPriorityFeePerGas`: (string) - Maximum fee, in wei, the sender is willing to pay per gas above the base fee.
57+
- `paymasterAndData`: (string) - The address of the paymaster contract and the data that will be passed to it.
58+
- `signature`: (string) - The signature data. For gas estimation, this can be a dummy signature.
59+
- `eip7702Auth`: (object) [_optional_] - The EIP-7702 authorization data. This can be a dummy authorization
60+
for estimations:
61+
- `address`: (string) - The contract address for the authorization.
62+
- `chainId`: (string) - The chain ID.
63+
- `nonce`: (string) - The nonce.
64+
- `r`: (string) - The r component of the signature.
65+
- `s`: (string) - The s component of the signature.
66+
- `v`: (string) - The v component of the signature.
67+
- `yParity`: (string) - The y-parity value.
68+
69+
- `entryPoint`: (string) - The EntryPoint contract address (`0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789`).
70+
71+
- `stateOverrides`: (object) [_optional_] - State overrides to apply for the simulation. Each key is an address, and each value is an object that can contain:
72+
- `balance`: (string) [_optional_] - The balance to set for the address.
73+
- `nonce`: (string) [_optional_] - The nonce to set for the address.
74+
- `code`: (string) [_optional_] - The code to set for the address.
75+
- `state`: (object) [_optional_] - Complete state to set, where each key is a 32-byte hex storage slot and each value is a 32-byte hex value.
76+
- `stateDiff`: (object) [_optional_] - State differences to apply, where each key is a 32-byte hex storage slot and each value is a 32-byte hex value.
77+
78+
</TabItem>
79+
</Tabs>
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import Tabs from "@theme/Tabs"
2+
import TabItem from "@theme/TabItem"
3+
4+
<Tabs>
5+
<TabItem value="curl without an override">
6+
7+
```bash
8+
curl https://mainnet.infura.io/v3/<YOUR-API-KEY> \
9+
-X POST \
10+
-H "Content-Type: application/json" \
11+
-d '{
12+
"jsonrpc": "2.0",
13+
"method": "eth_estimateUserOperationGas",
14+
"params": [
15+
{
16+
"sender": "0x5a6b47F4131bf1feAFA56A05573314BcF44C9149",
17+
"nonce": "0x845adb2c711129d4f3966735ed98a9f09fc4ce5700000000000000000000",
18+
"factory": "0xd703aaE79538628d27099B8c4f621bE4CCd142d5",
19+
"factoryData": "0xc5265d5d000000000000000000000000aac5d4240af87249b3f71bc8e4a2cae074a3e419",
20+
"callData": "0xe9ae5c5300000000000000000000000000000000000000000000000000000000000000000000000000",
21+
"callGasLimit": "0x0",
22+
"verificationGasLimit": "0x0",
23+
"preVerificationGas": "0x0",
24+
"maxFeePerGas": "0x7a5cf70d5",
25+
"maxPriorityFeePerGas": "0x3b9aca00",
26+
"paymaster": null,
27+
"paymasterVerificationGasLimit": null,
28+
"paymasterPostOpGasLimit": null,
29+
"paymasterData": null,
30+
"signature": "0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c"
31+
},
32+
"0x0000000071727De22E5E9d8BAf0edAc6f37da032"
33+
],
34+
"id": 1
35+
}'
36+
```
37+
38+
</TabItem>
39+
<TabItem value="curl with an override">
40+
41+
```bash
42+
curl https://mainnet.infura.io/v3/<YOUR-API-KEY> \
43+
-X POST \
44+
-H "Content-Type: application/json" \
45+
-d '{
46+
"jsonrpc": "2.0",
47+
"method": "eth_estimateUserOperationGas",
48+
"params": [
49+
{
50+
"sender": "0xa203fDb8bC335F86016F635b85389B62B189E417",
51+
"nonce": "0x35bf2a054f92f3730b87582ef223c8d663f9eb01158154750000000000000000",
52+
"factory": "0xd703aaE79538628d27099B8c4f621bE4CCd142d5",
53+
"callData": "0xb61d27f6000000000000000000000000530fff22987e137e7c8d2adcc4c15eb45b4fa752",
54+
"callGasLimit": "0x0",
55+
"verificationGasLimit": "0x0",
56+
"preVerificationGas": "0x0",
57+
"maxPriorityFeePerGas": "0x12a05f200",
58+
"maxFeePerGas": "0x5b08082fa",
59+
"paymaster": null,
60+
"paymasterVerificationGasLimit": null,
61+
"paymasterPostOpGasLimit": null,
62+
"paymasterData": null,
63+
"signature": "0xa6cc6589c8bd561cfd68d7b6b0757ef6f208e7438782939938498eee7d703260137856c840c491b3d415956265e81bf5c2184a725be2abfc365f7536b6af525e1c"
64+
},
65+
"0x0000000071727De22E5E9d8BAf0edAc6f37da032",
66+
{
67+
"0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3": {
68+
"balance": "0xde0b6b3a7640000"
69+
},
70+
"0xebe8efa441b9302a0d7eaecc277c09d20d684540": {
71+
"stateDiff": {
72+
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80": "0x21"
73+
}
74+
}
75+
}
76+
],
77+
"id": 1
78+
}'
79+
```
80+
81+
</TabItem>
82+
</Tabs>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import Tabs from "@theme/Tabs"
2+
import TabItem from "@theme/TabItem"
3+
4+
<Tabs>
5+
<TabItem value="JSON">
6+
7+
```JSON
8+
{
9+
"jsonrpc": "2.0",
10+
"id": 1,
11+
"result": {
12+
"preVerificationGas": "0xd3e3",
13+
"verificationGasLimit": "0x60b01",
14+
"callGasLimit": "0x13880",
15+
"paymasterVerificationGasLimit": "0x0",
16+
"paymasterPostOpGasLimit": "0x0"
17+
}
18+
}
19+
```
20+
21+
</TabItem>
22+
</Tabs>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import Tabs from "@theme/Tabs"
2+
import TabItem from "@theme/TabItem"
3+
4+
**Type:** `Object`
5+
6+
An object containing the estimated gas values for the user operation.
7+
8+
<Tabs>
9+
<TabItem value="v0.7" label="v0.7 and v0.8">
10+
11+
- `preVerificationGas`: (string) - The amount of gas to pay for to compensate the bundler for
12+
pre-verification execution and `calldata`.
13+
- `verificationGasLimit`: (string) - The amount of gas to allocate for the verification step.
14+
- `callGasLimit`: (string) - The amount of gas to allocate the main execution call.
15+
- `paymasterVerificationGasLimit`: (string) - The amount of gas to allocate for the verification step
16+
of the paymaster, or `null` if no paymaster.
17+
- `paymasterPostOpGasLimit`: (string) - The amount of gas to allocate for the post-operation step of
18+
the paymaster, or `null` if no paymaster.
19+
20+
</TabItem>
21+
<TabItem value="v0.6" label="v0.6">
22+
23+
- `preVerificationGas`: (string) - The amount of gas to pay for to compensate the bundler for
24+
pre-verification execution and `calldata`.
25+
- `verificationGas`: (string) - The amount of gas used for verification (legacy field from v0.6).
26+
- `verificationGasLimit`: (string) - The amount of gas to allocate for the verification step.
27+
- `callGasLimit`: (string) - The amount of gas to allocate the main execution call.
28+
29+
</TabItem>
30+
</Tabs>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import CreditCost from '@site/src/components/CreditCost/CreditCostPrice.js'
2+
3+
Fetches user operation details by providing its hash. If the user operation is not available, it
4+
will return `null`. <CreditCost network="bundler" method="eth_getUserOperationByHash" />
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Replace `<YOUR-API-KEY>` with an API key from your [MetaMask Developer dashboard](https://developer.metamask.io/).

0 commit comments

Comments
 (0)