Commit 5db56bf
authored
feat!: Add method for getting genesis block (#3788)
Add method for getting genesis block to Ethereum provider example Snap.
This is useful for properly testing what chain we are connected to in
E2E. Also removes some unused methods.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Add `getGenesisBlock` RPC to the example Snap (with `getBlock`
helper), remove `getGasPrice`/`getVersion`, and update tests and UI to
support it.
>
> - **Ethereum Provider Snap**:
> - Add `getGenesisBlock` RPC; implement `getBlock(number)` using
`eth_getBlockByNumber` and wire into `onRpcRequest`.
> - Remove unused RPCs `getGasPrice` and `getVersion`; retain
`getChainId` and existing signing/account methods.
> - **Tests**:
> - Add genesis block test mocking `eth_getBlockByNumber`; remove gas
price/version tests.
> - **Test App UI**:
> - Add "Get Genesis Block" button and handler in
`packages/test-snaps/src/features/snaps/ethereum-provider/EthereumProvider.tsx`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
f1b0591. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent db7a1ca commit 5db56bf
File tree
4 files changed
+69
-59
lines changed- packages
- examples/packages/ethereum-provider
- src
- test-snaps/src/features/snaps/ethereum-provider
4 files changed
+69
-59
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
Lines changed: 37 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
27 | 56 | | |
28 | 57 | | |
29 | 58 | | |
30 | 59 | | |
31 | 60 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 61 | + | |
| 62 | + | |
38 | 63 | | |
39 | 64 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | 65 | | |
51 | | - | |
| 66 | + | |
52 | 67 | | |
53 | 68 | | |
54 | | - | |
| 69 | + | |
55 | 70 | | |
56 | 71 | | |
57 | 72 | | |
| |||
Lines changed: 21 additions & 36 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
39 | | - | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
48 | 47 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
| 48 | + | |
63 | 49 | | |
64 | | - | |
| 50 | + | |
65 | 51 | | |
66 | 52 | | |
67 | 53 | | |
68 | | - | |
| 54 | + | |
69 | 55 | | |
70 | 56 | | |
71 | 57 | | |
72 | 58 | | |
73 | 59 | | |
74 | 60 | | |
75 | | - | |
| 61 | + | |
| 62 | + | |
76 | 63 | | |
77 | 64 | | |
78 | | - | |
79 | | - | |
80 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
81 | 69 | | |
82 | 70 | | |
83 | | - | |
| 71 | + | |
84 | 72 | | |
85 | | - | |
| 73 | + | |
86 | 74 | | |
87 | 75 | | |
88 | 76 | | |
| |||
249 | 237 | | |
250 | 238 | | |
251 | 239 | | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | 240 | | |
259 | 241 | | |
260 | 242 | | |
261 | 243 | | |
262 | 244 | | |
263 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
264 | 249 | | |
265 | 250 | | |
266 | 251 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
53 | 63 | | |
54 | 64 | | |
55 | 65 | | |
| |||
0 commit comments