Skip to content

Commit 09a962f

Browse files
committed
Add additional methods and update pricing.
Signed-off-by: bgravenorst <byron.gravenorst@consensys.net>
1 parent f5028fa commit 09a962f

37 files changed

Lines changed: 1260 additions & 8 deletions
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import CreditCost from '@site/src/components/CreditCost/CreditCostPrice.js'
2+
3+
Returns the tentative token exchange rates used by the ERC-20 Paymaster. <CreditCost network="bundler" method="pimlico_getTokenQuotes" />
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.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- `Object`: An object containing:
2+
- `tokens`: (array) - An array of token addresses to get quotes for.
3+
4+
- `entryPoint`: (string) - The EntryPoint contract address.
5+
6+
- `chainId`: (string) - The chain ID in hexadecimal format.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
```bash
2+
curl https://mainnet.infura.io/v3/<YOUR-API-KEY> \
3+
-X POST \
4+
-H "Content-Type: application/json" \
5+
-d '{
6+
"jsonrpc": "2.0",
7+
"method": "pimlico_getTokenQuotes",
8+
"params": [
9+
{
10+
"tokens": [
11+
"0x6b175474e89094c44da98b954eedeac495271d0f",
12+
"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
13+
"0x514910771af9ca656af840dff83e8264ecf986ca"
14+
]
15+
},
16+
"0x0000000071727De22E5E9d8BAf0edAc6f37da032",
17+
"0x1"
18+
],
19+
"id": 1
20+
}'
21+
```
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
```json
2+
{
3+
"jsonrpc": "2.0",
4+
"id": 1,
5+
"result": {
6+
"quotes": [
7+
{
8+
"paymaster": "0x0000000000000039cd5e8aE05257CE51C473ddd1",
9+
"token": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
10+
"postOpGas": "0xa7f8",
11+
"exchangeRate": "0xe9d61943a68eaf17e8",
12+
"exchangeRateNativeToUsd": "0xe9e52828",
13+
"balanceSlot": "0x2",
14+
"allowanceSlot": "0x3"
15+
}
16+
]
17+
}
18+
}
19+
```
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
An object containing an array of token quotes. Each quote includes information about the token, exchange rates, and storage slots.
2+
3+
- `quotes`: (array) - An array of quote objects, each containing:
4+
- `paymaster`: (string) - The address of the paymaster contract.
5+
- `token`: (string) - The address of the token.
6+
- `postOpGas`: (string) - The amount of gas required for post-operation processing.
7+
- `exchangeRate`: (string) - The exchange rate between the token and the native gas token.
8+
- `exchangeRateNativeToUsd`: (string) - The exchange rate between the native gas token and USD with 6 decimals of precision.
9+
- `balanceSlot`: (string) - The storage slot for the token balance.
10+
- `allowanceSlot`: (string) - The storage slot for the token allowance.
11+
12+
:::warning
13+
If a token in the request input is not supported by the ERC-20 Paymaster, the request will still succeed but it will not be included in the `quotes` array in the response.
14+
:::
15+
16+
:::info
17+
**exchangeRateNativeToUsd** represents the exchange rate between the chain's native gas token and USD with 6 decimals of precision.
18+
:::
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+
Returns values to be used in paymaster-related fields of a signed user operation. <CreditCost network="bundler" method="pm_getPaymasterData" />
4+
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.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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+
- `eip7702Auth`: (object) [_optional_] - The EIP-7702 authorization data. This can be a dummy authorization:
24+
- `address`: (string) - The contract address for the authorization.
25+
- `chainId`: (string) - The chain ID.
26+
- `nonce`: (string) - The nonce.
27+
- `r`: (string) - The r component of the signature.
28+
- `s`: (string) - The s component of the signature.
29+
- `v`: (string) - The v component of the signature.
30+
- `yParity`: (string) - The y-parity value.
31+
32+
- `entryPoint`: (string) - The EntryPoint contract address (`0x0000000071727De22E5E9d8BAf0edAc6f37da032`).
33+
34+
- `chainId`: (string) - The chain ID in hexadecimal format.
35+
36+
- `context`: (object) [_optional_] - Additional context information. Can be one of:
37+
- An object with `token`: (string) - The ERC-20 token address to use for payment.
38+
- An object with `sponsorshipPolicyId`: (string) - The ID of the sponsorship policy to use.
39+
- `null` - No additional context.
40+
41+
</TabItem>
42+
<TabItem value="v0.6" label="v0.6 user operation">
43+
44+
- `userOperation`: The user operation object containing the following fields:
45+
46+
- `sender`: (string) - The address of the account making the operation.
47+
- `nonce`: (string) - Unique identifier for the request from this sender.
48+
- `initCode`: (string) - The initialization code for the smart account if it doesn't exist yet.
49+
- `callData`: (string) [_optional_] - The data to pass to the sender during the main execution call.
50+
- `callGasLimit`: (string) - The amount of gas to allocate the main execution call.
51+
- `verificationGasLimit`: (string) - The amount of gas to allocate for the verification step.
52+
- `preVerificationGas`: (string) - The amount of gas to pay for to compensate the bundler for pre-verification execution and `calldata`.
53+
- `maxFeePerGas`: (string) - Maximum fee per gas, in wei, the sender is willing to pay per gas.
54+
- `maxPriorityFeePerGas`: (string) - Maximum fee, in wei, the sender is willing to pay per gas above the base fee.
55+
- `eip7702Auth`: (object) [_optional_] - The EIP-7702 authorization data. This can be a dummy authorization:
56+
- `address`: (string) - The contract address for the authorization.
57+
- `chainId`: (string) - The chain ID.
58+
- `nonce`: (string) - The nonce.
59+
- `r`: (string) - The r component of the signature.
60+
- `s`: (string) - The s component of the signature.
61+
- `v`: (string) - The v component of the signature.
62+
- `yParity`: (string) - The y-parity value.
63+
64+
- `entryPoint`: (string) - The EntryPoint contract address (`0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789`).
65+
66+
- `chainId`: (string) - The chain ID in hexadecimal format.
67+
68+
- `context`: (object) [_optional_] - Additional context information. Can be one of:
69+
- An object with `token`: (string) - The ERC-20 token address to use for payment.
70+
- An object with `sponsorshipPolicyId`: (string) - The ID of the sponsorship policy to use.
71+
- `null` - No additional context.
72+
73+
</TabItem>
74+
</Tabs>
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
import Tabs from "@theme/Tabs"
2+
import TabItem from "@theme/TabItem"
3+
4+
<Tabs>
5+
<TabItem value="v0.7-token" label="v0.7/v0.8 with token payment">
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": "pm_getPaymasterData",
14+
"params": [
15+
{
16+
"sender": "0x5a6b47F4131bf1feAFA56A05573314BcF44C9149",
17+
"nonce": "0x845ADB2C711129D4F3966735ED98A9F09FC4CE5700000000000000000000",
18+
"factory": "0xd703aaE79538628d27099B8c4f621bE4CCd142d5",
19+
"factoryData": "0xc5265d5d0000000000000000...",
20+
"callData": "0xe9ae5c53",
21+
"callGasLimit": "0x13880",
22+
"verificationGasLimit": "0x60B01",
23+
"preVerificationGas": "0xD3E3",
24+
"maxPriorityFeePerGas": "0x3B9ACA00",
25+
"maxFeePerGas": "0x7A5CF70D5",
26+
"paymaster": null,
27+
"paymasterVerificationGasLimit": null,
28+
"paymasterPostOpGasLimit": null,
29+
"paymasterData": null,
30+
"eip7702Auth": {
31+
"address": "0x1234567890123456789012345678901234567890",
32+
"chainId": "0x1",
33+
"nonce": "0x1",
34+
"r": "0x1234567890123456789012345678901234567890123456789012345678901234",
35+
"s": "0x1234567890123456789012345678901234567890123456789012345678901234",
36+
"v": "0x1b",
37+
"yParity": "0x1"
38+
}
39+
},
40+
"0x0000000071727De22E5E9d8BAf0edAc6f37da032",
41+
"0x1",
42+
{
43+
"token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
44+
}
45+
],
46+
"id": 4337
47+
}'
48+
```
49+
50+
</TabItem>
51+
<TabItem value="v0.7-policy" label="v0.7/v0.8 with sponsorship policy">
52+
53+
```bash
54+
curl https://mainnet.infura.io/v3/<YOUR-API-KEY> \
55+
-X POST \
56+
-H "Content-Type: application/json" \
57+
-d '{
58+
"jsonrpc": "2.0",
59+
"method": "pm_getPaymasterData",
60+
"params": [
61+
{
62+
"sender": "0x5a6b47F4131bf1feAFA56A05573314BcF44C9149",
63+
"nonce": "0x845ADB2C711129D4F3966735ED98A9F09FC4CE5700000000000000000000",
64+
"factory": "0xd703aaE79538628d27099B8c4f621bE4CCd142d5",
65+
"factoryData": "0xc5265d5d0000000000000000...",
66+
"callData": "0xe9ae5c53",
67+
"callGasLimit": "0x13880",
68+
"verificationGasLimit": "0x60B01",
69+
"preVerificationGas": "0xD3E3",
70+
"maxPriorityFeePerGas": "0x3B9ACA00",
71+
"maxFeePerGas": "0x7A5CF70D5",
72+
"paymaster": null,
73+
"paymasterVerificationGasLimit": null,
74+
"paymasterPostOpGasLimit": null,
75+
"paymasterData": null
76+
},
77+
"0x0000000071727De22E5E9d8BAf0edAc6f37da032",
78+
"0x1",
79+
{
80+
"sponsorshipPolicyId": "policy-123456"
81+
}
82+
],
83+
"id": 4337
84+
}'
85+
```
86+
87+
</TabItem>
88+
<TabItem value="v0.6-token" label="v0.6 with token payment">
89+
90+
```bash
91+
curl https://mainnet.infura.io/v3/<YOUR-API-KEY> \
92+
-X POST \
93+
-H "Content-Type: application/json" \
94+
-d '{
95+
"jsonrpc": "2.0",
96+
"method": "pm_getPaymasterData",
97+
"params": [
98+
{
99+
"sender": "0xb341FEAFaF71b09089d03B7D114599f8F491EE45",
100+
"nonce": "0x0",
101+
"initCode": "0x5de4839a76cf55d0c90e2061ef4386d962E15ae3296601cd000000...",
102+
"callData": "0x51945447",
103+
"eip7702Auth": {
104+
"address": "0x1234567890123456789012345678901234567890",
105+
"chainId": "0x1",
106+
"nonce": "0x1",
107+
"r": "0x1234567890123456789012345678901234567890123456789012345678901234",
108+
"s": "0x1234567890123456789012345678901234567890123456789012345678901234",
109+
"v": "0x1b",
110+
"yParity": "0x1"
111+
},
112+
"callGasLimit": "0x115b5c0",
113+
"verificationGasLimit": "0x249f0",
114+
"preVerificationGas": "0xeb11",
115+
"maxPriorityFeePerGas": "0x12a05f200",
116+
"maxFeePerGas": "0x5b08082fa"
117+
},
118+
"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
119+
"0x1",
120+
{
121+
"token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
122+
}
123+
],
124+
"id": 4337
125+
}'
126+
```
127+
128+
</TabItem>
129+
</Tabs>

0 commit comments

Comments
 (0)