@msaki/eth-rpc 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine/index.d.ts +2 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +1 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/eth-methods.d.ts +62 -22
- package/dist/eth-methods.d.ts.map +1 -1
- package/dist/eth-methods.js +141 -8
- package/dist/eth-methods.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/package.json +36 -35
- package/src/engine/index.ts +0 -0
- package/src/eth-methods.ts +286 -193
- package/src/index.ts +1 -2
- package/src/types/base.d.ts +23 -0
- package/src/types/block.d.ts +46 -0
- package/src/types/client.d.ts +11 -0
- package/src/types/engine.d.ts +127 -0
- package/src/types/execute.d.ts +85 -0
- package/src/types/feeHistory.d.ts +18 -0
- package/src/types/filter.d.ts +20 -0
- package/src/types/forkchoice.d.ts +40 -0
- package/src/types/receit.d.ts +36 -0
- package/src/types/state.d.ts +19 -0
- package/src/types/transaction.d.ts +149 -0
- package/src/types/withdraw.d.ts +11 -0
- package/dist/types.d.ts +0 -338
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -1
- package/dist/types.js.map +0 -1
- package/src/types.ts +0 -360
package/src/eth-methods.ts
CHANGED
|
@@ -1,202 +1,295 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type * as EthSchema from "./types";
|
|
3
|
-
import type { EthSchema } from ".";
|
|
1
|
+
import { initializeRpcClient, JsonRpcClient } from "@msaki/jsonrpc";
|
|
4
2
|
|
|
5
3
|
export enum Methods {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
4
|
+
// eth/transaction
|
|
5
|
+
eth_getTransactionByHash = "eth_getTransactionByHash",
|
|
6
|
+
eth_getTransactionByBlockHashAndIndex = "eth_getTransactionByBlockHashAndIndex",
|
|
7
|
+
eth_getTransactionReceipt = "eth_getTransactionReceipt",
|
|
8
|
+
// eth/submit
|
|
9
|
+
eth_sendTransaction = "eth_sendTransaction",
|
|
10
|
+
eth_sendRawTransaction = "eth_sendRawTransaction",
|
|
11
|
+
// eth/state
|
|
12
|
+
eth_getBalance = "eth_getBalance",
|
|
13
|
+
eth_getStorageAt = "eth_getStorageAt",
|
|
14
|
+
eth_getTransactionCount = "eth_getTransactionCount",
|
|
15
|
+
eth_getCode = "eth_getCode",
|
|
16
|
+
eth_getProof = "eth_getProof",
|
|
17
|
+
// eth/sign
|
|
18
|
+
eth_sign = "eth_sign",
|
|
19
|
+
eth_signTransaction = "eth_signTransaction",
|
|
20
|
+
// eth/filter
|
|
21
|
+
eth_newFilter = "eth_newFilter",
|
|
22
|
+
eth_newBlockFilter = "eth_newBlockFilter",
|
|
23
|
+
eth_newPendingTransactionFilter = "eth_newPendingTransactionFilter",
|
|
24
|
+
eth_uninstallFilter = "eth_uninstallFilter",
|
|
25
|
+
eth_getFilterChanges = "eth_getFilterChanges",
|
|
26
|
+
eth_getFilterLogs = "eth_getFilterLogs",
|
|
27
|
+
eth_getLogs = "eth_getLogs",
|
|
28
|
+
// eth/feeMarket
|
|
29
|
+
eth_gasPrice = "eth_gasPrice",
|
|
30
|
+
eth_blobBaseFee = "eth_blobBaseFee",
|
|
31
|
+
eth_maxPriorityFeePerGas = "eth_maxPriorityFeePerGas",
|
|
32
|
+
eth_feeHistory = "eth_feeHistory",
|
|
33
|
+
// eth/execute
|
|
34
|
+
eth_call = "eth_call",
|
|
35
|
+
eth_estimateGas = "eth_estimateGas",
|
|
36
|
+
eth_createAccessList = "eth_createAccessList",
|
|
37
|
+
eth_simulateV1 = "eth_simulateV1",
|
|
38
|
+
// eth/client
|
|
39
|
+
eth_chainId = "eth_chainId",
|
|
40
|
+
eth_syncing = "eth_syncing",
|
|
41
|
+
eth_coinbase = "eth_coinbase",
|
|
42
|
+
eth_accounts = "eth_accounts",
|
|
43
|
+
eth_blockNumber = "eth_blockNumber",
|
|
44
|
+
net_version = "net_version",
|
|
45
|
+
// eth/block
|
|
46
|
+
eth_getBlockByHash = "eth_getBlockByHash",
|
|
47
|
+
eth_getBlockByNumber = "eth_getBlockByNumber",
|
|
48
|
+
eth_getBlockTransactionCountByHash = "eth_getBlockTransactionCountByHash",
|
|
49
|
+
eth_getBlockTransactionCountByNumber = "eth_getBlockTransactionCountByNumber",
|
|
50
|
+
eth_getUncleCountByBlockHash = "eth_getUncleCountByBlockHash",
|
|
51
|
+
eth_getUncleCountByBlockNumber = "eth_getUncleCountByBlockNumber",
|
|
52
|
+
eth_getBlockReceipts = "eth_getBlockReceipts",
|
|
30
53
|
}
|
|
31
54
|
|
|
32
55
|
export class EthExecutionClient {
|
|
33
|
-
|
|
56
|
+
private client: JsonRpcClient;
|
|
34
57
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
58
|
+
constructor(url: string) {
|
|
59
|
+
this.client = initializeRpcClient(url);
|
|
60
|
+
}
|
|
38
61
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
);
|
|
64
|
-
}
|
|
62
|
+
// eth/transaction
|
|
63
|
+
async eth_getTransactionByHash(
|
|
64
|
+
transactioHash: Hash32,
|
|
65
|
+
): Promise<NotFound | TransactionInfo> {
|
|
66
|
+
return await this.client.call(Methods.eth_getTransactionByHash, [
|
|
67
|
+
transactioHash,
|
|
68
|
+
]);
|
|
69
|
+
}
|
|
70
|
+
async eth_getTransactionByBlockHashAndIndex(
|
|
71
|
+
blockHash: Hash32,
|
|
72
|
+
transactionIndex: Uint,
|
|
73
|
+
): Promise<NotFound | TransactionInfo> {
|
|
74
|
+
return await this.client.call(
|
|
75
|
+
Methods.eth_getTransactionByBlockHashAndIndex,
|
|
76
|
+
[blockHash, transactionIndex],
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
async eth_getTransactionReceipt(
|
|
80
|
+
transactionHash: Hash32,
|
|
81
|
+
): Promise<NotFound | ReceiptInfo> {
|
|
82
|
+
return await this.client.call(Methods.eth_getTransactionReceipt, [
|
|
83
|
+
transactionHash,
|
|
84
|
+
]);
|
|
85
|
+
}
|
|
65
86
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
87
|
+
// eth/submit
|
|
88
|
+
async eth_sendTransaction(transaction: GenericTransaction): Promise<Hash32> {
|
|
89
|
+
return await this.client.call(Methods.eth_sendTransaction, [transaction]);
|
|
90
|
+
}
|
|
91
|
+
async eth_sendRawTransaction(transaction: Bytes): Promise<Hash32> {
|
|
92
|
+
return await this.client.call(Methods.eth_sendRawTransaction, [
|
|
93
|
+
transaction,
|
|
94
|
+
]);
|
|
95
|
+
}
|
|
96
|
+
// eth/state
|
|
97
|
+
async eth_getBalance(
|
|
98
|
+
address: Address,
|
|
99
|
+
block: BlockNumberOrTagOrHash,
|
|
100
|
+
): Promise<Uint> {
|
|
101
|
+
return await this.client.call(Methods.eth_getBalance, [address, block]);
|
|
102
|
+
}
|
|
103
|
+
async eth_getStorageAt(
|
|
104
|
+
address: Address,
|
|
105
|
+
storageSlot: Bytes32,
|
|
106
|
+
block: BlockNumberOrTagOrHash,
|
|
107
|
+
): Promise<Bytes> {
|
|
108
|
+
return await this.client.call(Methods.eth_getStorageAt, [
|
|
109
|
+
address,
|
|
110
|
+
storageSlot,
|
|
111
|
+
block,
|
|
112
|
+
]);
|
|
113
|
+
}
|
|
114
|
+
async eth_getTransactionCount(
|
|
115
|
+
address: Address,
|
|
116
|
+
block: BlockNumberOrTagOrHash,
|
|
117
|
+
): Promise<Uint> {
|
|
118
|
+
return await this.client.call(Methods.eth_getTransactionCount, [
|
|
119
|
+
address,
|
|
120
|
+
block,
|
|
121
|
+
]);
|
|
122
|
+
}
|
|
123
|
+
async eth_getCode(
|
|
124
|
+
address: Address,
|
|
125
|
+
block: BlockNumberOrTagOrHash,
|
|
126
|
+
): Promise<Bytes> {
|
|
127
|
+
return await this.client.call(Methods.eth_getCode, [address, block]);
|
|
128
|
+
}
|
|
129
|
+
async eth_getProof(
|
|
130
|
+
address: Address,
|
|
131
|
+
storageKeys: Bytes32[],
|
|
132
|
+
block: BlockNumberOrTagOrHash,
|
|
133
|
+
): Promise<AccountProof> {
|
|
134
|
+
return await this.client.call(Methods.eth_getProof, [
|
|
135
|
+
address,
|
|
136
|
+
storageKeys,
|
|
137
|
+
block,
|
|
138
|
+
]);
|
|
139
|
+
}
|
|
140
|
+
// eth/sign
|
|
141
|
+
async eth_sign(address: Address, message: Bytes): Promise<Bytes65> {
|
|
142
|
+
return await this.client.call(Methods.eth_sign, [address, message]);
|
|
143
|
+
}
|
|
144
|
+
async eth_signTransaction(transaction: GenericTransaction): Promise<Bytes> {
|
|
145
|
+
return await this.client.call(Methods.eth_signTransaction, [transaction]);
|
|
146
|
+
}
|
|
147
|
+
// eth/filter
|
|
148
|
+
async eth_newFilter(filter: Filter): Promise<Uint> {
|
|
149
|
+
return await this.client.call(Methods.eth_newFilter, [filter]);
|
|
150
|
+
}
|
|
151
|
+
async eth_newBlockFilter(): Promise<Uint> {
|
|
152
|
+
return await this.client.call(Methods.eth_newBlockFilter, []);
|
|
153
|
+
}
|
|
154
|
+
async eth_newPendingTransactionFilter(): Promise<Uint> {
|
|
155
|
+
return await this.client.call(Methods.eth_newPendingTransactionFilter, []);
|
|
156
|
+
}
|
|
157
|
+
async eth_uninstallFilter(): Promise<Uint> {
|
|
158
|
+
return await this.client.call(Methods.eth_uninstallFilter, []);
|
|
159
|
+
}
|
|
160
|
+
async eth_getFilterChanges(): Promise<FilterResults> {
|
|
161
|
+
return await this.client.call(Methods.eth_getFilterChanges, []);
|
|
162
|
+
}
|
|
163
|
+
async eth_getFilterLogs(filterIdentifier: Uint): Promise<FilterResults> {
|
|
164
|
+
return await this.client.call(Methods.eth_getFilterLogs, [
|
|
165
|
+
filterIdentifier,
|
|
166
|
+
]);
|
|
167
|
+
}
|
|
168
|
+
async eth_getLogs(filter: Filter): Promise<FilterResults> {
|
|
169
|
+
return await this.client.call(Methods.eth_getLogs, [filter]);
|
|
170
|
+
}
|
|
171
|
+
// eth/feeMarket
|
|
172
|
+
async eth_gasPrice(): Promise<Uint> {
|
|
173
|
+
return await this.client.call(Methods.eth_gasPrice, []);
|
|
174
|
+
}
|
|
175
|
+
async eth_blobBaseFee(): Promise<Uint> {
|
|
176
|
+
return await this.client.call(Methods.eth_blobBaseFee, []);
|
|
177
|
+
}
|
|
178
|
+
async eth_maxPriorityFeePerGas(): Promise<Uint> {
|
|
179
|
+
return await this.client.call(Methods.eth_maxPriorityFeePerGas, []);
|
|
180
|
+
}
|
|
181
|
+
async eth_feeHistory(
|
|
182
|
+
blockCount: Uint,
|
|
183
|
+
newestBlock: BlockNumberOrTag,
|
|
184
|
+
rewardPercentiles: number[],
|
|
185
|
+
): Promise<FeeHistoryResults> {
|
|
186
|
+
return await this.client.call(Methods.eth_feeHistory, [
|
|
187
|
+
blockCount,
|
|
188
|
+
newestBlock,
|
|
189
|
+
rewardPercentiles,
|
|
190
|
+
]);
|
|
191
|
+
}
|
|
192
|
+
// eth/execute
|
|
193
|
+
async eth_call(
|
|
194
|
+
transaction: GenericTransaction,
|
|
195
|
+
block: BlockNumberOrTagOrHash,
|
|
196
|
+
): Promise<Bytes> {
|
|
197
|
+
return this.client.call(Methods.eth_call, [transaction, block]);
|
|
198
|
+
}
|
|
199
|
+
async eth_estimateGas(
|
|
200
|
+
transaction: GenericTransaction,
|
|
201
|
+
block: BlockNumberOrTag,
|
|
202
|
+
): Promise<Uint> {
|
|
203
|
+
return await this.client.call(Methods.eth_estimateGas, [
|
|
204
|
+
transaction,
|
|
205
|
+
block,
|
|
206
|
+
]);
|
|
207
|
+
}
|
|
208
|
+
async eth_createAccessList(
|
|
209
|
+
transaction: GenericTransaction,
|
|
210
|
+
block: BlockNumberOrTag,
|
|
211
|
+
): Promise<AccessListResult> {
|
|
212
|
+
return await this.client.call(Methods.eth_createAccessList, [
|
|
213
|
+
transaction,
|
|
214
|
+
block,
|
|
215
|
+
]);
|
|
216
|
+
}
|
|
217
|
+
async eth_simulateV1(
|
|
218
|
+
payload: EthSimulatePayload,
|
|
219
|
+
blockTag: BlockNumberOrTagOrHash,
|
|
220
|
+
): Promise<EthSimulateResult> {
|
|
221
|
+
return await this.client.call(Methods.eth_simulateV1, [payload, blockTag]);
|
|
222
|
+
}
|
|
223
|
+
// eth/client
|
|
224
|
+
async eth_chainId(): Promise<Uint> {
|
|
225
|
+
return await this.client.call(Methods.eth_chainId, []);
|
|
226
|
+
}
|
|
227
|
+
async eth_syncing(): Promise<SyncingStatus> {
|
|
228
|
+
return await this.client.call(Methods.eth_syncing, []);
|
|
229
|
+
}
|
|
230
|
+
async eth_coinbase(): Promise<Address> {
|
|
231
|
+
return await this.client.call(Methods.eth_coinbase, []);
|
|
232
|
+
}
|
|
233
|
+
async eth_accounts(): Promise<Addresses> {
|
|
234
|
+
return await this.client.call(Methods.eth_accounts, []);
|
|
235
|
+
}
|
|
236
|
+
async eth_blockNumber(): Promise<Uint> {
|
|
237
|
+
return await this.client.call(Methods.eth_blockNumber, []);
|
|
238
|
+
}
|
|
239
|
+
async net_version(): Promise<UintDecimal> {
|
|
240
|
+
return await this.client.call(Methods.net_version, []);
|
|
241
|
+
}
|
|
242
|
+
// eth/block
|
|
243
|
+
async eth_getBlockByHash(
|
|
244
|
+
blockHash: Hash32,
|
|
245
|
+
hydratedTransactions: boolean,
|
|
246
|
+
): Promise<NotFound | Block> {
|
|
247
|
+
return await this.client.call(Methods.eth_getBlockByHash, [
|
|
248
|
+
blockHash,
|
|
249
|
+
hydratedTransactions,
|
|
250
|
+
]);
|
|
251
|
+
}
|
|
252
|
+
async eth_getBlockByNumber(
|
|
253
|
+
block: BlockNumberOrTag,
|
|
254
|
+
hydratedTransactions: boolean,
|
|
255
|
+
): Promise<NotFound | Block> {
|
|
256
|
+
return await this.client.call(Methods.eth_getBlockByNumber, [
|
|
257
|
+
block,
|
|
258
|
+
hydratedTransactions,
|
|
259
|
+
]);
|
|
260
|
+
}
|
|
261
|
+
async eth_getBlockTransactionCountByHash(
|
|
262
|
+
blockHash: Hash32,
|
|
263
|
+
): Promise<NotFound | Uint> {
|
|
264
|
+
return await this.client.call(Methods.eth_getBlockTransactionCountByHash, [
|
|
265
|
+
blockHash,
|
|
266
|
+
]);
|
|
267
|
+
}
|
|
268
|
+
async eth_getBlockTransactionCountByNumber(
|
|
269
|
+
block: BlockNumberOrTag,
|
|
270
|
+
): Promise<NotFound | Uint> {
|
|
271
|
+
return await this.client.call(
|
|
272
|
+
Methods.eth_getBlockTransactionCountByNumber,
|
|
273
|
+
[block],
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
async eth_getUncleCountByBlockHash(
|
|
277
|
+
blockHash: Hash32,
|
|
278
|
+
): Promise<NotFound | Uint> {
|
|
279
|
+
return await this.client.call(Methods.eth_getUncleCountByBlockHash, [
|
|
280
|
+
blockHash,
|
|
281
|
+
]);
|
|
282
|
+
}
|
|
283
|
+
async eth_getUncleCountByBlockNumber(
|
|
284
|
+
block: BlockNumberOrTag,
|
|
285
|
+
): Promise<NotFound | Uint> {
|
|
286
|
+
return await this.client.call(Methods.eth_getUncleCountByBlockNumber, [
|
|
287
|
+
block,
|
|
288
|
+
]);
|
|
289
|
+
}
|
|
290
|
+
async eth_getBlockReceipts(
|
|
291
|
+
block: BlockNumberOrTagOrHash,
|
|
292
|
+
): Promise<NotFound | ReceiptInfo> {
|
|
293
|
+
return await this.client.call(Methods.eth_getBlockReceipts, [block]);
|
|
294
|
+
}
|
|
202
295
|
}
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
// base.yaml
|
|
3
|
+
export type Hex = `0x${string}`;
|
|
4
|
+
export type Address = `0x${string}`;
|
|
5
|
+
export type Addresses = Address[];
|
|
6
|
+
export type Byte = Hex;
|
|
7
|
+
export type Bytes = Hex;
|
|
8
|
+
export type Bytes32 = Hex;
|
|
9
|
+
export type Bytes8 = Hex;
|
|
10
|
+
export type Bytes48 = Hex;
|
|
11
|
+
export type Bytes96 = Hex;
|
|
12
|
+
export type Bytes256 = Hex;
|
|
13
|
+
export type Bytes65 = Hex;
|
|
14
|
+
export type Ratio = number;
|
|
15
|
+
export type Uint = Hex;
|
|
16
|
+
export type Uint64 = Hex;
|
|
17
|
+
export type Uint256 = Hex;
|
|
18
|
+
export type UintDecimal = string; // e.g '1'
|
|
19
|
+
export type Hash32 = Hex;
|
|
20
|
+
export type NotFound = null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
// block.yaml
|
|
3
|
+
export type BlockTag =
|
|
4
|
+
| "earliest"
|
|
5
|
+
| "finalized"
|
|
6
|
+
| "safe"
|
|
7
|
+
| "latest"
|
|
8
|
+
| "pending";
|
|
9
|
+
export type BlockNumberOrTag = Hex | BlockTag;
|
|
10
|
+
export type BlockNumberOrTagOrHash = BlockNumberOrTag | Hex;
|
|
11
|
+
export interface Block {
|
|
12
|
+
hash: Hash32;
|
|
13
|
+
parentHash: Hash32;
|
|
14
|
+
sha3Uncles: Hash32;
|
|
15
|
+
miner: Address;
|
|
16
|
+
stateRoot: Hash32;
|
|
17
|
+
transactionsRoot: Hash32;
|
|
18
|
+
receiptsRoot: Hash32;
|
|
19
|
+
logsBloom: Bytes256;
|
|
20
|
+
number: Uint;
|
|
21
|
+
gasLimit: Uint;
|
|
22
|
+
gasUsed: Uint;
|
|
23
|
+
timestamp: Uint;
|
|
24
|
+
extraData: Bytes;
|
|
25
|
+
mixHash: Hash32;
|
|
26
|
+
nonce: Bytes8;
|
|
27
|
+
size: Uint;
|
|
28
|
+
transactions: Hash32[] | TransactionInfo[];
|
|
29
|
+
uncles: Hash32[];
|
|
30
|
+
requestedHash?: Hash32;
|
|
31
|
+
baseFeePerGas?: Uint;
|
|
32
|
+
withdrawalsRoot?: Hash32;
|
|
33
|
+
blobGasUsed?: Uint;
|
|
34
|
+
excessBlobGas?: Uint;
|
|
35
|
+
parentBeaconBlockRoot?: Hash32;
|
|
36
|
+
withdrawals?: Withdrawal[];
|
|
37
|
+
difficulty?: Uint;
|
|
38
|
+
}
|
|
39
|
+
export interface BadBlock {
|
|
40
|
+
block: Block;
|
|
41
|
+
hash: Hash32;
|
|
42
|
+
rlp: Bytes;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { };
|