@apibara/evm 2.0.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/.turbo/turbo-build.log +17 -0
- package/CHANGELOG.md +1 -0
- package/LICENSE.txt +202 -0
- package/README.md +27 -0
- package/buf.gen.yaml +14 -0
- package/build.config.ts +11 -0
- package/dist/index.cjs +2994 -0
- package/dist/index.d.cts +1900 -0
- package/dist/index.d.mts +1900 -0
- package/dist/index.d.ts +1900 -0
- package/dist/index.mjs +2953 -0
- package/package.json +49 -0
- package/proto/common.proto +37 -0
- package/proto/data.proto +192 -0
- package/proto/filter.proto +61 -0
- package/src/block.ts +167 -0
- package/src/common.test.ts +79 -0
- package/src/common.ts +117 -0
- package/src/filter.test.ts +191 -0
- package/src/filter.ts +117 -0
- package/src/index.ts +15 -0
- package/src/proto/common.ts +561 -0
- package/src/proto/data.ts +2111 -0
- package/src/proto/filter.ts +658 -0
- package/src/proto/google/protobuf/timestamp.ts +220 -0
- package/src/proto/index.ts +3 -0
- package/tsconfig.json +11 -0
|
@@ -0,0 +1,2111 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v1.176.0
|
|
4
|
+
// protoc unknown
|
|
5
|
+
// source: data.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import Long from "long";
|
|
9
|
+
import _m0 from "protobufjs/minimal";
|
|
10
|
+
import { Address, B256, Bloom, U128, U256 } from "./common";
|
|
11
|
+
import { Timestamp } from "./google/protobuf/timestamp";
|
|
12
|
+
|
|
13
|
+
export const protobufPackage = "evm.v2";
|
|
14
|
+
|
|
15
|
+
/** EVM DNA definitions (data). */
|
|
16
|
+
|
|
17
|
+
/** Requested data, grouped by block. */
|
|
18
|
+
export interface Block {
|
|
19
|
+
/** The header. */
|
|
20
|
+
readonly header?:
|
|
21
|
+
| BlockHeader
|
|
22
|
+
| undefined;
|
|
23
|
+
/** List of withdrawals. */
|
|
24
|
+
readonly withdrawals?:
|
|
25
|
+
| readonly Withdrawal[]
|
|
26
|
+
| undefined;
|
|
27
|
+
/** List of transactions. */
|
|
28
|
+
readonly transactions?:
|
|
29
|
+
| readonly Transaction[]
|
|
30
|
+
| undefined;
|
|
31
|
+
/** List of receipts. */
|
|
32
|
+
readonly receipts?:
|
|
33
|
+
| readonly TransactionReceipt[]
|
|
34
|
+
| undefined;
|
|
35
|
+
/** List of logs. */
|
|
36
|
+
readonly logs?: readonly Log[] | undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Block header. */
|
|
40
|
+
export interface BlockHeader {
|
|
41
|
+
/** Block number. */
|
|
42
|
+
readonly number?:
|
|
43
|
+
| bigint
|
|
44
|
+
| undefined;
|
|
45
|
+
/** Hash of the block. */
|
|
46
|
+
readonly hash?:
|
|
47
|
+
| B256
|
|
48
|
+
| undefined;
|
|
49
|
+
/** Hash of the parent block. */
|
|
50
|
+
readonly parentHash?:
|
|
51
|
+
| B256
|
|
52
|
+
| undefined;
|
|
53
|
+
/** Hash of the uncles. */
|
|
54
|
+
readonly unclesHash?:
|
|
55
|
+
| B256
|
|
56
|
+
| undefined;
|
|
57
|
+
/** Author of the block. */
|
|
58
|
+
readonly miner?:
|
|
59
|
+
| Address
|
|
60
|
+
| undefined;
|
|
61
|
+
/** State root hash. */
|
|
62
|
+
readonly stateRoot?:
|
|
63
|
+
| B256
|
|
64
|
+
| undefined;
|
|
65
|
+
/** Transactions root hash. */
|
|
66
|
+
readonly transactionsRoot?:
|
|
67
|
+
| B256
|
|
68
|
+
| undefined;
|
|
69
|
+
/** Receipts root hash. */
|
|
70
|
+
readonly receiptsRoot?:
|
|
71
|
+
| B256
|
|
72
|
+
| undefined;
|
|
73
|
+
/** Logs bloom. */
|
|
74
|
+
readonly logsBloom?:
|
|
75
|
+
| Bloom
|
|
76
|
+
| undefined;
|
|
77
|
+
/** Difficulty. */
|
|
78
|
+
readonly difficulty?:
|
|
79
|
+
| U256
|
|
80
|
+
| undefined;
|
|
81
|
+
/** Gas limit. */
|
|
82
|
+
readonly gasLimit?:
|
|
83
|
+
| U256
|
|
84
|
+
| undefined;
|
|
85
|
+
/** Gas used. */
|
|
86
|
+
readonly gasUsed?:
|
|
87
|
+
| U256
|
|
88
|
+
| undefined;
|
|
89
|
+
/** Timestamp. */
|
|
90
|
+
readonly timestamp?:
|
|
91
|
+
| Date
|
|
92
|
+
| undefined;
|
|
93
|
+
/** Extra data. */
|
|
94
|
+
readonly extraData?:
|
|
95
|
+
| Uint8Array
|
|
96
|
+
| undefined;
|
|
97
|
+
/** Mix hash. */
|
|
98
|
+
readonly mixHash?:
|
|
99
|
+
| B256
|
|
100
|
+
| undefined;
|
|
101
|
+
/** Nonce. */
|
|
102
|
+
readonly nonce?:
|
|
103
|
+
| bigint
|
|
104
|
+
| undefined;
|
|
105
|
+
/** Base fee per unit of gas. */
|
|
106
|
+
readonly baseFeePerGas?:
|
|
107
|
+
| U256
|
|
108
|
+
| undefined;
|
|
109
|
+
/** Withdrawals root hash. */
|
|
110
|
+
readonly withdrawalsRoot?:
|
|
111
|
+
| B256
|
|
112
|
+
| undefined;
|
|
113
|
+
/** Total difficulty. */
|
|
114
|
+
readonly totalDifficulty?:
|
|
115
|
+
| U256
|
|
116
|
+
| undefined;
|
|
117
|
+
/** Uncles' hashes. */
|
|
118
|
+
readonly uncles?:
|
|
119
|
+
| readonly B256[]
|
|
120
|
+
| undefined;
|
|
121
|
+
/** The size of this block in bytes. */
|
|
122
|
+
readonly size?:
|
|
123
|
+
| U256
|
|
124
|
+
| undefined;
|
|
125
|
+
/** Blob gas used. */
|
|
126
|
+
readonly blobGasUsed?:
|
|
127
|
+
| bigint
|
|
128
|
+
| undefined;
|
|
129
|
+
/** Excess blob gas. */
|
|
130
|
+
readonly excessBlobGas?:
|
|
131
|
+
| bigint
|
|
132
|
+
| undefined;
|
|
133
|
+
/** Parent beacon block root. */
|
|
134
|
+
readonly parentBeaconBlockRoot?: B256 | undefined;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** A validator's withdrawal from the consensus layer. */
|
|
138
|
+
export interface Withdrawal {
|
|
139
|
+
/** Increasing index of the withdrawal. */
|
|
140
|
+
readonly index?:
|
|
141
|
+
| bigint
|
|
142
|
+
| undefined;
|
|
143
|
+
/** Index of the validator. */
|
|
144
|
+
readonly validatorIndex?:
|
|
145
|
+
| bigint
|
|
146
|
+
| undefined;
|
|
147
|
+
/** Withdrawal index in the block. */
|
|
148
|
+
readonly withdrawalIndex?:
|
|
149
|
+
| bigint
|
|
150
|
+
| undefined;
|
|
151
|
+
/** Target address of the withdrawal. */
|
|
152
|
+
readonly address?:
|
|
153
|
+
| Address
|
|
154
|
+
| undefined;
|
|
155
|
+
/** Value of the withdrawal, in gwei. */
|
|
156
|
+
readonly amount?: U256 | undefined;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface Transaction {
|
|
160
|
+
/** Transaction hash. */
|
|
161
|
+
readonly hash?:
|
|
162
|
+
| B256
|
|
163
|
+
| undefined;
|
|
164
|
+
/** Nonce. */
|
|
165
|
+
readonly nonce?:
|
|
166
|
+
| bigint
|
|
167
|
+
| undefined;
|
|
168
|
+
/** Transaction index in the block. */
|
|
169
|
+
readonly transactionIndex?:
|
|
170
|
+
| bigint
|
|
171
|
+
| undefined;
|
|
172
|
+
/** Sender. */
|
|
173
|
+
readonly from?:
|
|
174
|
+
| Address
|
|
175
|
+
| undefined;
|
|
176
|
+
/** Recipient. */
|
|
177
|
+
readonly to?:
|
|
178
|
+
| Address
|
|
179
|
+
| undefined;
|
|
180
|
+
/** Amount of wei transferred. */
|
|
181
|
+
readonly value?:
|
|
182
|
+
| U256
|
|
183
|
+
| undefined;
|
|
184
|
+
/** Gas price. */
|
|
185
|
+
readonly gasPrice?:
|
|
186
|
+
| U128
|
|
187
|
+
| undefined;
|
|
188
|
+
/** Gas amount. */
|
|
189
|
+
readonly gas?:
|
|
190
|
+
| U256
|
|
191
|
+
| undefined;
|
|
192
|
+
/** Max base fee per gas the sender is willing to pay. */
|
|
193
|
+
readonly maxFeePerGas?:
|
|
194
|
+
| U128
|
|
195
|
+
| undefined;
|
|
196
|
+
/** Miner's tip. */
|
|
197
|
+
readonly maxPriorityFeePerGas?:
|
|
198
|
+
| U128
|
|
199
|
+
| undefined;
|
|
200
|
+
/** Data. */
|
|
201
|
+
readonly input?:
|
|
202
|
+
| Uint8Array
|
|
203
|
+
| undefined;
|
|
204
|
+
/** The signature's r,s,v,yParity values. */
|
|
205
|
+
readonly signature?:
|
|
206
|
+
| Signature
|
|
207
|
+
| undefined;
|
|
208
|
+
/** Chain ID. */
|
|
209
|
+
readonly chainId?:
|
|
210
|
+
| bigint
|
|
211
|
+
| undefined;
|
|
212
|
+
/** EIP-2930 access list. */
|
|
213
|
+
readonly accessList?:
|
|
214
|
+
| readonly AccessListItem[]
|
|
215
|
+
| undefined;
|
|
216
|
+
/** EIP-2718 transaction type. */
|
|
217
|
+
readonly transactionType?:
|
|
218
|
+
| bigint
|
|
219
|
+
| undefined;
|
|
220
|
+
/** EIP-4844 max gas fee per blob. */
|
|
221
|
+
readonly maxFeePerBlobGas?:
|
|
222
|
+
| U128
|
|
223
|
+
| undefined;
|
|
224
|
+
/** EIP-4844 blob hashes. */
|
|
225
|
+
readonly blobVersionedHashes?: readonly B256[] | undefined;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export interface TransactionReceipt {
|
|
229
|
+
/** Transaction hash. */
|
|
230
|
+
readonly transactionHash?:
|
|
231
|
+
| B256
|
|
232
|
+
| undefined;
|
|
233
|
+
/** Index of the transaction in the block. */
|
|
234
|
+
readonly transactionIndex?:
|
|
235
|
+
| bigint
|
|
236
|
+
| undefined;
|
|
237
|
+
/** Cumulative gas used in the block after this transaction has been executed. */
|
|
238
|
+
readonly cumulativeGasUsed?:
|
|
239
|
+
| U256
|
|
240
|
+
| undefined;
|
|
241
|
+
/** Gas used by this transaction. */
|
|
242
|
+
readonly gasUsed?:
|
|
243
|
+
| U256
|
|
244
|
+
| undefined;
|
|
245
|
+
/** The price paid by the transaction. */
|
|
246
|
+
readonly effectiveGasPrice?:
|
|
247
|
+
| U128
|
|
248
|
+
| undefined;
|
|
249
|
+
/** Sender. */
|
|
250
|
+
readonly from?:
|
|
251
|
+
| Address
|
|
252
|
+
| undefined;
|
|
253
|
+
/** Recipient, if any. */
|
|
254
|
+
readonly to?:
|
|
255
|
+
| Address
|
|
256
|
+
| undefined;
|
|
257
|
+
/** Contract address created, if any. */
|
|
258
|
+
readonly contractAddress?:
|
|
259
|
+
| Address
|
|
260
|
+
| undefined;
|
|
261
|
+
/** Logs bloom. */
|
|
262
|
+
readonly logsBloom?:
|
|
263
|
+
| Bloom
|
|
264
|
+
| undefined;
|
|
265
|
+
/** Either 1 (success) or 0 (failure). */
|
|
266
|
+
readonly statusCode?:
|
|
267
|
+
| bigint
|
|
268
|
+
| undefined;
|
|
269
|
+
/** EIP-2718 transaction type. */
|
|
270
|
+
readonly transactionType?:
|
|
271
|
+
| bigint
|
|
272
|
+
| undefined;
|
|
273
|
+
/** EIP-4844 blob gas used. */
|
|
274
|
+
readonly blobGasUsed?:
|
|
275
|
+
| U128
|
|
276
|
+
| undefined;
|
|
277
|
+
/** EIP-4844 blob gas paid by the transaction. */
|
|
278
|
+
readonly blobGasPrice?: U128 | undefined;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export interface Log {
|
|
282
|
+
/** Address of the contract that emitted the log. */
|
|
283
|
+
readonly address?:
|
|
284
|
+
| Address
|
|
285
|
+
| undefined;
|
|
286
|
+
/** Log topics. */
|
|
287
|
+
readonly topics?:
|
|
288
|
+
| readonly B256[]
|
|
289
|
+
| undefined;
|
|
290
|
+
/** Additional data. */
|
|
291
|
+
readonly data?:
|
|
292
|
+
| Uint8Array
|
|
293
|
+
| undefined;
|
|
294
|
+
/** Index of the log in the block. */
|
|
295
|
+
readonly logIndex?:
|
|
296
|
+
| bigint
|
|
297
|
+
| undefined;
|
|
298
|
+
/** Index of the transaction that emitted the log. */
|
|
299
|
+
readonly transactionIndex?:
|
|
300
|
+
| bigint
|
|
301
|
+
| undefined;
|
|
302
|
+
/** Hash of the transaction that emitted the log. */
|
|
303
|
+
readonly transactionHash?: B256 | undefined;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export interface Signature {
|
|
307
|
+
/** The signature's r value. */
|
|
308
|
+
readonly r?:
|
|
309
|
+
| U256
|
|
310
|
+
| undefined;
|
|
311
|
+
/** The signature's s value. */
|
|
312
|
+
readonly s?:
|
|
313
|
+
| U256
|
|
314
|
+
| undefined;
|
|
315
|
+
/** The signature's v value. */
|
|
316
|
+
readonly v?:
|
|
317
|
+
| U256
|
|
318
|
+
| undefined;
|
|
319
|
+
/** The signature's parity byte. */
|
|
320
|
+
readonly yParity?: boolean | undefined;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export interface AccessListItem {
|
|
324
|
+
/** Account address to be loaded at the start of the transaction. */
|
|
325
|
+
readonly address?:
|
|
326
|
+
| Address
|
|
327
|
+
| undefined;
|
|
328
|
+
/** Storage keys to be loaded at the start of the transaction. */
|
|
329
|
+
readonly storageKeys?: readonly B256[] | undefined;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
function createBaseBlock(): Block {
|
|
333
|
+
return { header: undefined, withdrawals: [], transactions: [], receipts: [], logs: [] };
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export const Block = {
|
|
337
|
+
encode(message: Block, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
338
|
+
if (message.header !== undefined) {
|
|
339
|
+
BlockHeader.encode(message.header, writer.uint32(10).fork()).ldelim();
|
|
340
|
+
}
|
|
341
|
+
if (message.withdrawals !== undefined && message.withdrawals.length !== 0) {
|
|
342
|
+
for (const v of message.withdrawals) {
|
|
343
|
+
Withdrawal.encode(v!, writer.uint32(18).fork()).ldelim();
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
if (message.transactions !== undefined && message.transactions.length !== 0) {
|
|
347
|
+
for (const v of message.transactions) {
|
|
348
|
+
Transaction.encode(v!, writer.uint32(26).fork()).ldelim();
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
if (message.receipts !== undefined && message.receipts.length !== 0) {
|
|
352
|
+
for (const v of message.receipts) {
|
|
353
|
+
TransactionReceipt.encode(v!, writer.uint32(34).fork()).ldelim();
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
if (message.logs !== undefined && message.logs.length !== 0) {
|
|
357
|
+
for (const v of message.logs) {
|
|
358
|
+
Log.encode(v!, writer.uint32(42).fork()).ldelim();
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
return writer;
|
|
362
|
+
},
|
|
363
|
+
|
|
364
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Block {
|
|
365
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
366
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
367
|
+
const message = createBaseBlock() as any;
|
|
368
|
+
while (reader.pos < end) {
|
|
369
|
+
const tag = reader.uint32();
|
|
370
|
+
switch (tag >>> 3) {
|
|
371
|
+
case 1:
|
|
372
|
+
if (tag !== 10) {
|
|
373
|
+
break;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
message.header = BlockHeader.decode(reader, reader.uint32());
|
|
377
|
+
continue;
|
|
378
|
+
case 2:
|
|
379
|
+
if (tag !== 18) {
|
|
380
|
+
break;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
message.withdrawals!.push(Withdrawal.decode(reader, reader.uint32()));
|
|
384
|
+
continue;
|
|
385
|
+
case 3:
|
|
386
|
+
if (tag !== 26) {
|
|
387
|
+
break;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
message.transactions!.push(Transaction.decode(reader, reader.uint32()));
|
|
391
|
+
continue;
|
|
392
|
+
case 4:
|
|
393
|
+
if (tag !== 34) {
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
message.receipts!.push(TransactionReceipt.decode(reader, reader.uint32()));
|
|
398
|
+
continue;
|
|
399
|
+
case 5:
|
|
400
|
+
if (tag !== 42) {
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
message.logs!.push(Log.decode(reader, reader.uint32()));
|
|
405
|
+
continue;
|
|
406
|
+
}
|
|
407
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
408
|
+
break;
|
|
409
|
+
}
|
|
410
|
+
reader.skipType(tag & 7);
|
|
411
|
+
}
|
|
412
|
+
return message;
|
|
413
|
+
},
|
|
414
|
+
|
|
415
|
+
fromJSON(object: any): Block {
|
|
416
|
+
return {
|
|
417
|
+
header: isSet(object.header) ? BlockHeader.fromJSON(object.header) : undefined,
|
|
418
|
+
withdrawals: globalThis.Array.isArray(object?.withdrawals)
|
|
419
|
+
? object.withdrawals.map((e: any) => Withdrawal.fromJSON(e))
|
|
420
|
+
: [],
|
|
421
|
+
transactions: globalThis.Array.isArray(object?.transactions)
|
|
422
|
+
? object.transactions.map((e: any) => Transaction.fromJSON(e))
|
|
423
|
+
: [],
|
|
424
|
+
receipts: globalThis.Array.isArray(object?.receipts)
|
|
425
|
+
? object.receipts.map((e: any) => TransactionReceipt.fromJSON(e))
|
|
426
|
+
: [],
|
|
427
|
+
logs: globalThis.Array.isArray(object?.logs) ? object.logs.map((e: any) => Log.fromJSON(e)) : [],
|
|
428
|
+
};
|
|
429
|
+
},
|
|
430
|
+
|
|
431
|
+
toJSON(message: Block): unknown {
|
|
432
|
+
const obj: any = {};
|
|
433
|
+
if (message.header !== undefined) {
|
|
434
|
+
obj.header = BlockHeader.toJSON(message.header);
|
|
435
|
+
}
|
|
436
|
+
if (message.withdrawals?.length) {
|
|
437
|
+
obj.withdrawals = message.withdrawals.map((e) => Withdrawal.toJSON(e));
|
|
438
|
+
}
|
|
439
|
+
if (message.transactions?.length) {
|
|
440
|
+
obj.transactions = message.transactions.map((e) => Transaction.toJSON(e));
|
|
441
|
+
}
|
|
442
|
+
if (message.receipts?.length) {
|
|
443
|
+
obj.receipts = message.receipts.map((e) => TransactionReceipt.toJSON(e));
|
|
444
|
+
}
|
|
445
|
+
if (message.logs?.length) {
|
|
446
|
+
obj.logs = message.logs.map((e) => Log.toJSON(e));
|
|
447
|
+
}
|
|
448
|
+
return obj;
|
|
449
|
+
},
|
|
450
|
+
|
|
451
|
+
create(base?: DeepPartial<Block>): Block {
|
|
452
|
+
return Block.fromPartial(base ?? {});
|
|
453
|
+
},
|
|
454
|
+
fromPartial(object: DeepPartial<Block>): Block {
|
|
455
|
+
const message = createBaseBlock() as any;
|
|
456
|
+
message.header = (object.header !== undefined && object.header !== null)
|
|
457
|
+
? BlockHeader.fromPartial(object.header)
|
|
458
|
+
: undefined;
|
|
459
|
+
message.withdrawals = object.withdrawals?.map((e) => Withdrawal.fromPartial(e)) || [];
|
|
460
|
+
message.transactions = object.transactions?.map((e) => Transaction.fromPartial(e)) || [];
|
|
461
|
+
message.receipts = object.receipts?.map((e) => TransactionReceipt.fromPartial(e)) || [];
|
|
462
|
+
message.logs = object.logs?.map((e) => Log.fromPartial(e)) || [];
|
|
463
|
+
return message;
|
|
464
|
+
},
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
function createBaseBlockHeader(): BlockHeader {
|
|
468
|
+
return {
|
|
469
|
+
number: BigInt("0"),
|
|
470
|
+
hash: undefined,
|
|
471
|
+
parentHash: undefined,
|
|
472
|
+
unclesHash: undefined,
|
|
473
|
+
miner: undefined,
|
|
474
|
+
stateRoot: undefined,
|
|
475
|
+
transactionsRoot: undefined,
|
|
476
|
+
receiptsRoot: undefined,
|
|
477
|
+
logsBloom: undefined,
|
|
478
|
+
difficulty: undefined,
|
|
479
|
+
gasLimit: undefined,
|
|
480
|
+
gasUsed: undefined,
|
|
481
|
+
timestamp: undefined,
|
|
482
|
+
extraData: new Uint8Array(0),
|
|
483
|
+
mixHash: undefined,
|
|
484
|
+
nonce: BigInt("0"),
|
|
485
|
+
baseFeePerGas: undefined,
|
|
486
|
+
withdrawalsRoot: undefined,
|
|
487
|
+
totalDifficulty: undefined,
|
|
488
|
+
uncles: [],
|
|
489
|
+
size: undefined,
|
|
490
|
+
blobGasUsed: BigInt("0"),
|
|
491
|
+
excessBlobGas: BigInt("0"),
|
|
492
|
+
parentBeaconBlockRoot: undefined,
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
export const BlockHeader = {
|
|
497
|
+
encode(message: BlockHeader, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
498
|
+
if (message.number !== undefined && message.number !== BigInt("0")) {
|
|
499
|
+
if (BigInt.asUintN(64, message.number) !== message.number) {
|
|
500
|
+
throw new globalThis.Error("value provided for field message.number of type uint64 too large");
|
|
501
|
+
}
|
|
502
|
+
writer.uint32(8).uint64(message.number.toString());
|
|
503
|
+
}
|
|
504
|
+
if (message.hash !== undefined) {
|
|
505
|
+
B256.encode(message.hash, writer.uint32(18).fork()).ldelim();
|
|
506
|
+
}
|
|
507
|
+
if (message.parentHash !== undefined) {
|
|
508
|
+
B256.encode(message.parentHash, writer.uint32(26).fork()).ldelim();
|
|
509
|
+
}
|
|
510
|
+
if (message.unclesHash !== undefined) {
|
|
511
|
+
B256.encode(message.unclesHash, writer.uint32(34).fork()).ldelim();
|
|
512
|
+
}
|
|
513
|
+
if (message.miner !== undefined) {
|
|
514
|
+
Address.encode(message.miner, writer.uint32(42).fork()).ldelim();
|
|
515
|
+
}
|
|
516
|
+
if (message.stateRoot !== undefined) {
|
|
517
|
+
B256.encode(message.stateRoot, writer.uint32(50).fork()).ldelim();
|
|
518
|
+
}
|
|
519
|
+
if (message.transactionsRoot !== undefined) {
|
|
520
|
+
B256.encode(message.transactionsRoot, writer.uint32(58).fork()).ldelim();
|
|
521
|
+
}
|
|
522
|
+
if (message.receiptsRoot !== undefined) {
|
|
523
|
+
B256.encode(message.receiptsRoot, writer.uint32(66).fork()).ldelim();
|
|
524
|
+
}
|
|
525
|
+
if (message.logsBloom !== undefined) {
|
|
526
|
+
Bloom.encode(message.logsBloom, writer.uint32(74).fork()).ldelim();
|
|
527
|
+
}
|
|
528
|
+
if (message.difficulty !== undefined) {
|
|
529
|
+
U256.encode(message.difficulty, writer.uint32(82).fork()).ldelim();
|
|
530
|
+
}
|
|
531
|
+
if (message.gasLimit !== undefined) {
|
|
532
|
+
U256.encode(message.gasLimit, writer.uint32(90).fork()).ldelim();
|
|
533
|
+
}
|
|
534
|
+
if (message.gasUsed !== undefined) {
|
|
535
|
+
U256.encode(message.gasUsed, writer.uint32(98).fork()).ldelim();
|
|
536
|
+
}
|
|
537
|
+
if (message.timestamp !== undefined) {
|
|
538
|
+
Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(106).fork()).ldelim();
|
|
539
|
+
}
|
|
540
|
+
if (message.extraData !== undefined && message.extraData.length !== 0) {
|
|
541
|
+
writer.uint32(114).bytes(message.extraData);
|
|
542
|
+
}
|
|
543
|
+
if (message.mixHash !== undefined) {
|
|
544
|
+
B256.encode(message.mixHash, writer.uint32(122).fork()).ldelim();
|
|
545
|
+
}
|
|
546
|
+
if (message.nonce !== undefined && message.nonce !== BigInt("0")) {
|
|
547
|
+
if (BigInt.asUintN(64, message.nonce) !== message.nonce) {
|
|
548
|
+
throw new globalThis.Error("value provided for field message.nonce of type uint64 too large");
|
|
549
|
+
}
|
|
550
|
+
writer.uint32(128).uint64(message.nonce.toString());
|
|
551
|
+
}
|
|
552
|
+
if (message.baseFeePerGas !== undefined) {
|
|
553
|
+
U256.encode(message.baseFeePerGas, writer.uint32(138).fork()).ldelim();
|
|
554
|
+
}
|
|
555
|
+
if (message.withdrawalsRoot !== undefined) {
|
|
556
|
+
B256.encode(message.withdrawalsRoot, writer.uint32(146).fork()).ldelim();
|
|
557
|
+
}
|
|
558
|
+
if (message.totalDifficulty !== undefined) {
|
|
559
|
+
U256.encode(message.totalDifficulty, writer.uint32(154).fork()).ldelim();
|
|
560
|
+
}
|
|
561
|
+
if (message.uncles !== undefined && message.uncles.length !== 0) {
|
|
562
|
+
for (const v of message.uncles) {
|
|
563
|
+
B256.encode(v!, writer.uint32(162).fork()).ldelim();
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
if (message.size !== undefined) {
|
|
567
|
+
U256.encode(message.size, writer.uint32(170).fork()).ldelim();
|
|
568
|
+
}
|
|
569
|
+
if (message.blobGasUsed !== undefined && message.blobGasUsed !== BigInt("0")) {
|
|
570
|
+
if (BigInt.asUintN(64, message.blobGasUsed) !== message.blobGasUsed) {
|
|
571
|
+
throw new globalThis.Error("value provided for field message.blobGasUsed of type uint64 too large");
|
|
572
|
+
}
|
|
573
|
+
writer.uint32(176).uint64(message.blobGasUsed.toString());
|
|
574
|
+
}
|
|
575
|
+
if (message.excessBlobGas !== undefined && message.excessBlobGas !== BigInt("0")) {
|
|
576
|
+
if (BigInt.asUintN(64, message.excessBlobGas) !== message.excessBlobGas) {
|
|
577
|
+
throw new globalThis.Error("value provided for field message.excessBlobGas of type uint64 too large");
|
|
578
|
+
}
|
|
579
|
+
writer.uint32(184).uint64(message.excessBlobGas.toString());
|
|
580
|
+
}
|
|
581
|
+
if (message.parentBeaconBlockRoot !== undefined) {
|
|
582
|
+
B256.encode(message.parentBeaconBlockRoot, writer.uint32(194).fork()).ldelim();
|
|
583
|
+
}
|
|
584
|
+
return writer;
|
|
585
|
+
},
|
|
586
|
+
|
|
587
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): BlockHeader {
|
|
588
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
589
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
590
|
+
const message = createBaseBlockHeader() as any;
|
|
591
|
+
while (reader.pos < end) {
|
|
592
|
+
const tag = reader.uint32();
|
|
593
|
+
switch (tag >>> 3) {
|
|
594
|
+
case 1:
|
|
595
|
+
if (tag !== 8) {
|
|
596
|
+
break;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
message.number = longToBigint(reader.uint64() as Long);
|
|
600
|
+
continue;
|
|
601
|
+
case 2:
|
|
602
|
+
if (tag !== 18) {
|
|
603
|
+
break;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
message.hash = B256.decode(reader, reader.uint32());
|
|
607
|
+
continue;
|
|
608
|
+
case 3:
|
|
609
|
+
if (tag !== 26) {
|
|
610
|
+
break;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
message.parentHash = B256.decode(reader, reader.uint32());
|
|
614
|
+
continue;
|
|
615
|
+
case 4:
|
|
616
|
+
if (tag !== 34) {
|
|
617
|
+
break;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
message.unclesHash = B256.decode(reader, reader.uint32());
|
|
621
|
+
continue;
|
|
622
|
+
case 5:
|
|
623
|
+
if (tag !== 42) {
|
|
624
|
+
break;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
message.miner = Address.decode(reader, reader.uint32());
|
|
628
|
+
continue;
|
|
629
|
+
case 6:
|
|
630
|
+
if (tag !== 50) {
|
|
631
|
+
break;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
message.stateRoot = B256.decode(reader, reader.uint32());
|
|
635
|
+
continue;
|
|
636
|
+
case 7:
|
|
637
|
+
if (tag !== 58) {
|
|
638
|
+
break;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
message.transactionsRoot = B256.decode(reader, reader.uint32());
|
|
642
|
+
continue;
|
|
643
|
+
case 8:
|
|
644
|
+
if (tag !== 66) {
|
|
645
|
+
break;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
message.receiptsRoot = B256.decode(reader, reader.uint32());
|
|
649
|
+
continue;
|
|
650
|
+
case 9:
|
|
651
|
+
if (tag !== 74) {
|
|
652
|
+
break;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
message.logsBloom = Bloom.decode(reader, reader.uint32());
|
|
656
|
+
continue;
|
|
657
|
+
case 10:
|
|
658
|
+
if (tag !== 82) {
|
|
659
|
+
break;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
message.difficulty = U256.decode(reader, reader.uint32());
|
|
663
|
+
continue;
|
|
664
|
+
case 11:
|
|
665
|
+
if (tag !== 90) {
|
|
666
|
+
break;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
message.gasLimit = U256.decode(reader, reader.uint32());
|
|
670
|
+
continue;
|
|
671
|
+
case 12:
|
|
672
|
+
if (tag !== 98) {
|
|
673
|
+
break;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
message.gasUsed = U256.decode(reader, reader.uint32());
|
|
677
|
+
continue;
|
|
678
|
+
case 13:
|
|
679
|
+
if (tag !== 106) {
|
|
680
|
+
break;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
684
|
+
continue;
|
|
685
|
+
case 14:
|
|
686
|
+
if (tag !== 114) {
|
|
687
|
+
break;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
message.extraData = reader.bytes();
|
|
691
|
+
continue;
|
|
692
|
+
case 15:
|
|
693
|
+
if (tag !== 122) {
|
|
694
|
+
break;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
message.mixHash = B256.decode(reader, reader.uint32());
|
|
698
|
+
continue;
|
|
699
|
+
case 16:
|
|
700
|
+
if (tag !== 128) {
|
|
701
|
+
break;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
message.nonce = longToBigint(reader.uint64() as Long);
|
|
705
|
+
continue;
|
|
706
|
+
case 17:
|
|
707
|
+
if (tag !== 138) {
|
|
708
|
+
break;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
message.baseFeePerGas = U256.decode(reader, reader.uint32());
|
|
712
|
+
continue;
|
|
713
|
+
case 18:
|
|
714
|
+
if (tag !== 146) {
|
|
715
|
+
break;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
message.withdrawalsRoot = B256.decode(reader, reader.uint32());
|
|
719
|
+
continue;
|
|
720
|
+
case 19:
|
|
721
|
+
if (tag !== 154) {
|
|
722
|
+
break;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
message.totalDifficulty = U256.decode(reader, reader.uint32());
|
|
726
|
+
continue;
|
|
727
|
+
case 20:
|
|
728
|
+
if (tag !== 162) {
|
|
729
|
+
break;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
message.uncles!.push(B256.decode(reader, reader.uint32()));
|
|
733
|
+
continue;
|
|
734
|
+
case 21:
|
|
735
|
+
if (tag !== 170) {
|
|
736
|
+
break;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
message.size = U256.decode(reader, reader.uint32());
|
|
740
|
+
continue;
|
|
741
|
+
case 22:
|
|
742
|
+
if (tag !== 176) {
|
|
743
|
+
break;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
message.blobGasUsed = longToBigint(reader.uint64() as Long);
|
|
747
|
+
continue;
|
|
748
|
+
case 23:
|
|
749
|
+
if (tag !== 184) {
|
|
750
|
+
break;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
message.excessBlobGas = longToBigint(reader.uint64() as Long);
|
|
754
|
+
continue;
|
|
755
|
+
case 24:
|
|
756
|
+
if (tag !== 194) {
|
|
757
|
+
break;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
message.parentBeaconBlockRoot = B256.decode(reader, reader.uint32());
|
|
761
|
+
continue;
|
|
762
|
+
}
|
|
763
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
764
|
+
break;
|
|
765
|
+
}
|
|
766
|
+
reader.skipType(tag & 7);
|
|
767
|
+
}
|
|
768
|
+
return message;
|
|
769
|
+
},
|
|
770
|
+
|
|
771
|
+
fromJSON(object: any): BlockHeader {
|
|
772
|
+
return {
|
|
773
|
+
number: isSet(object.number) ? BigInt(object.number) : BigInt("0"),
|
|
774
|
+
hash: isSet(object.hash) ? B256.fromJSON(object.hash) : undefined,
|
|
775
|
+
parentHash: isSet(object.parentHash) ? B256.fromJSON(object.parentHash) : undefined,
|
|
776
|
+
unclesHash: isSet(object.unclesHash) ? B256.fromJSON(object.unclesHash) : undefined,
|
|
777
|
+
miner: isSet(object.miner) ? Address.fromJSON(object.miner) : undefined,
|
|
778
|
+
stateRoot: isSet(object.stateRoot) ? B256.fromJSON(object.stateRoot) : undefined,
|
|
779
|
+
transactionsRoot: isSet(object.transactionsRoot) ? B256.fromJSON(object.transactionsRoot) : undefined,
|
|
780
|
+
receiptsRoot: isSet(object.receiptsRoot) ? B256.fromJSON(object.receiptsRoot) : undefined,
|
|
781
|
+
logsBloom: isSet(object.logsBloom) ? Bloom.fromJSON(object.logsBloom) : undefined,
|
|
782
|
+
difficulty: isSet(object.difficulty) ? U256.fromJSON(object.difficulty) : undefined,
|
|
783
|
+
gasLimit: isSet(object.gasLimit) ? U256.fromJSON(object.gasLimit) : undefined,
|
|
784
|
+
gasUsed: isSet(object.gasUsed) ? U256.fromJSON(object.gasUsed) : undefined,
|
|
785
|
+
timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
|
|
786
|
+
extraData: isSet(object.extraData) ? bytesFromBase64(object.extraData) : new Uint8Array(0),
|
|
787
|
+
mixHash: isSet(object.mixHash) ? B256.fromJSON(object.mixHash) : undefined,
|
|
788
|
+
nonce: isSet(object.nonce) ? BigInt(object.nonce) : BigInt("0"),
|
|
789
|
+
baseFeePerGas: isSet(object.baseFeePerGas) ? U256.fromJSON(object.baseFeePerGas) : undefined,
|
|
790
|
+
withdrawalsRoot: isSet(object.withdrawalsRoot) ? B256.fromJSON(object.withdrawalsRoot) : undefined,
|
|
791
|
+
totalDifficulty: isSet(object.totalDifficulty) ? U256.fromJSON(object.totalDifficulty) : undefined,
|
|
792
|
+
uncles: globalThis.Array.isArray(object?.uncles) ? object.uncles.map((e: any) => B256.fromJSON(e)) : [],
|
|
793
|
+
size: isSet(object.size) ? U256.fromJSON(object.size) : undefined,
|
|
794
|
+
blobGasUsed: isSet(object.blobGasUsed) ? BigInt(object.blobGasUsed) : BigInt("0"),
|
|
795
|
+
excessBlobGas: isSet(object.excessBlobGas) ? BigInt(object.excessBlobGas) : BigInt("0"),
|
|
796
|
+
parentBeaconBlockRoot: isSet(object.parentBeaconBlockRoot)
|
|
797
|
+
? B256.fromJSON(object.parentBeaconBlockRoot)
|
|
798
|
+
: undefined,
|
|
799
|
+
};
|
|
800
|
+
},
|
|
801
|
+
|
|
802
|
+
toJSON(message: BlockHeader): unknown {
|
|
803
|
+
const obj: any = {};
|
|
804
|
+
if (message.number !== undefined && message.number !== BigInt("0")) {
|
|
805
|
+
obj.number = message.number.toString();
|
|
806
|
+
}
|
|
807
|
+
if (message.hash !== undefined) {
|
|
808
|
+
obj.hash = B256.toJSON(message.hash);
|
|
809
|
+
}
|
|
810
|
+
if (message.parentHash !== undefined) {
|
|
811
|
+
obj.parentHash = B256.toJSON(message.parentHash);
|
|
812
|
+
}
|
|
813
|
+
if (message.unclesHash !== undefined) {
|
|
814
|
+
obj.unclesHash = B256.toJSON(message.unclesHash);
|
|
815
|
+
}
|
|
816
|
+
if (message.miner !== undefined) {
|
|
817
|
+
obj.miner = Address.toJSON(message.miner);
|
|
818
|
+
}
|
|
819
|
+
if (message.stateRoot !== undefined) {
|
|
820
|
+
obj.stateRoot = B256.toJSON(message.stateRoot);
|
|
821
|
+
}
|
|
822
|
+
if (message.transactionsRoot !== undefined) {
|
|
823
|
+
obj.transactionsRoot = B256.toJSON(message.transactionsRoot);
|
|
824
|
+
}
|
|
825
|
+
if (message.receiptsRoot !== undefined) {
|
|
826
|
+
obj.receiptsRoot = B256.toJSON(message.receiptsRoot);
|
|
827
|
+
}
|
|
828
|
+
if (message.logsBloom !== undefined) {
|
|
829
|
+
obj.logsBloom = Bloom.toJSON(message.logsBloom);
|
|
830
|
+
}
|
|
831
|
+
if (message.difficulty !== undefined) {
|
|
832
|
+
obj.difficulty = U256.toJSON(message.difficulty);
|
|
833
|
+
}
|
|
834
|
+
if (message.gasLimit !== undefined) {
|
|
835
|
+
obj.gasLimit = U256.toJSON(message.gasLimit);
|
|
836
|
+
}
|
|
837
|
+
if (message.gasUsed !== undefined) {
|
|
838
|
+
obj.gasUsed = U256.toJSON(message.gasUsed);
|
|
839
|
+
}
|
|
840
|
+
if (message.timestamp !== undefined) {
|
|
841
|
+
obj.timestamp = message.timestamp.toISOString();
|
|
842
|
+
}
|
|
843
|
+
if (message.extraData !== undefined && message.extraData.length !== 0) {
|
|
844
|
+
obj.extraData = base64FromBytes(message.extraData);
|
|
845
|
+
}
|
|
846
|
+
if (message.mixHash !== undefined) {
|
|
847
|
+
obj.mixHash = B256.toJSON(message.mixHash);
|
|
848
|
+
}
|
|
849
|
+
if (message.nonce !== undefined && message.nonce !== BigInt("0")) {
|
|
850
|
+
obj.nonce = message.nonce.toString();
|
|
851
|
+
}
|
|
852
|
+
if (message.baseFeePerGas !== undefined) {
|
|
853
|
+
obj.baseFeePerGas = U256.toJSON(message.baseFeePerGas);
|
|
854
|
+
}
|
|
855
|
+
if (message.withdrawalsRoot !== undefined) {
|
|
856
|
+
obj.withdrawalsRoot = B256.toJSON(message.withdrawalsRoot);
|
|
857
|
+
}
|
|
858
|
+
if (message.totalDifficulty !== undefined) {
|
|
859
|
+
obj.totalDifficulty = U256.toJSON(message.totalDifficulty);
|
|
860
|
+
}
|
|
861
|
+
if (message.uncles?.length) {
|
|
862
|
+
obj.uncles = message.uncles.map((e) => B256.toJSON(e));
|
|
863
|
+
}
|
|
864
|
+
if (message.size !== undefined) {
|
|
865
|
+
obj.size = U256.toJSON(message.size);
|
|
866
|
+
}
|
|
867
|
+
if (message.blobGasUsed !== undefined && message.blobGasUsed !== BigInt("0")) {
|
|
868
|
+
obj.blobGasUsed = message.blobGasUsed.toString();
|
|
869
|
+
}
|
|
870
|
+
if (message.excessBlobGas !== undefined && message.excessBlobGas !== BigInt("0")) {
|
|
871
|
+
obj.excessBlobGas = message.excessBlobGas.toString();
|
|
872
|
+
}
|
|
873
|
+
if (message.parentBeaconBlockRoot !== undefined) {
|
|
874
|
+
obj.parentBeaconBlockRoot = B256.toJSON(message.parentBeaconBlockRoot);
|
|
875
|
+
}
|
|
876
|
+
return obj;
|
|
877
|
+
},
|
|
878
|
+
|
|
879
|
+
create(base?: DeepPartial<BlockHeader>): BlockHeader {
|
|
880
|
+
return BlockHeader.fromPartial(base ?? {});
|
|
881
|
+
},
|
|
882
|
+
fromPartial(object: DeepPartial<BlockHeader>): BlockHeader {
|
|
883
|
+
const message = createBaseBlockHeader() as any;
|
|
884
|
+
message.number = object.number ?? BigInt("0");
|
|
885
|
+
message.hash = (object.hash !== undefined && object.hash !== null) ? B256.fromPartial(object.hash) : undefined;
|
|
886
|
+
message.parentHash = (object.parentHash !== undefined && object.parentHash !== null)
|
|
887
|
+
? B256.fromPartial(object.parentHash)
|
|
888
|
+
: undefined;
|
|
889
|
+
message.unclesHash = (object.unclesHash !== undefined && object.unclesHash !== null)
|
|
890
|
+
? B256.fromPartial(object.unclesHash)
|
|
891
|
+
: undefined;
|
|
892
|
+
message.miner = (object.miner !== undefined && object.miner !== null)
|
|
893
|
+
? Address.fromPartial(object.miner)
|
|
894
|
+
: undefined;
|
|
895
|
+
message.stateRoot = (object.stateRoot !== undefined && object.stateRoot !== null)
|
|
896
|
+
? B256.fromPartial(object.stateRoot)
|
|
897
|
+
: undefined;
|
|
898
|
+
message.transactionsRoot = (object.transactionsRoot !== undefined && object.transactionsRoot !== null)
|
|
899
|
+
? B256.fromPartial(object.transactionsRoot)
|
|
900
|
+
: undefined;
|
|
901
|
+
message.receiptsRoot = (object.receiptsRoot !== undefined && object.receiptsRoot !== null)
|
|
902
|
+
? B256.fromPartial(object.receiptsRoot)
|
|
903
|
+
: undefined;
|
|
904
|
+
message.logsBloom = (object.logsBloom !== undefined && object.logsBloom !== null)
|
|
905
|
+
? Bloom.fromPartial(object.logsBloom)
|
|
906
|
+
: undefined;
|
|
907
|
+
message.difficulty = (object.difficulty !== undefined && object.difficulty !== null)
|
|
908
|
+
? U256.fromPartial(object.difficulty)
|
|
909
|
+
: undefined;
|
|
910
|
+
message.gasLimit = (object.gasLimit !== undefined && object.gasLimit !== null)
|
|
911
|
+
? U256.fromPartial(object.gasLimit)
|
|
912
|
+
: undefined;
|
|
913
|
+
message.gasUsed = (object.gasUsed !== undefined && object.gasUsed !== null)
|
|
914
|
+
? U256.fromPartial(object.gasUsed)
|
|
915
|
+
: undefined;
|
|
916
|
+
message.timestamp = object.timestamp ?? undefined;
|
|
917
|
+
message.extraData = object.extraData ?? new Uint8Array(0);
|
|
918
|
+
message.mixHash = (object.mixHash !== undefined && object.mixHash !== null)
|
|
919
|
+
? B256.fromPartial(object.mixHash)
|
|
920
|
+
: undefined;
|
|
921
|
+
message.nonce = object.nonce ?? BigInt("0");
|
|
922
|
+
message.baseFeePerGas = (object.baseFeePerGas !== undefined && object.baseFeePerGas !== null)
|
|
923
|
+
? U256.fromPartial(object.baseFeePerGas)
|
|
924
|
+
: undefined;
|
|
925
|
+
message.withdrawalsRoot = (object.withdrawalsRoot !== undefined && object.withdrawalsRoot !== null)
|
|
926
|
+
? B256.fromPartial(object.withdrawalsRoot)
|
|
927
|
+
: undefined;
|
|
928
|
+
message.totalDifficulty = (object.totalDifficulty !== undefined && object.totalDifficulty !== null)
|
|
929
|
+
? U256.fromPartial(object.totalDifficulty)
|
|
930
|
+
: undefined;
|
|
931
|
+
message.uncles = object.uncles?.map((e) => B256.fromPartial(e)) || [];
|
|
932
|
+
message.size = (object.size !== undefined && object.size !== null) ? U256.fromPartial(object.size) : undefined;
|
|
933
|
+
message.blobGasUsed = object.blobGasUsed ?? BigInt("0");
|
|
934
|
+
message.excessBlobGas = object.excessBlobGas ?? BigInt("0");
|
|
935
|
+
message.parentBeaconBlockRoot =
|
|
936
|
+
(object.parentBeaconBlockRoot !== undefined && object.parentBeaconBlockRoot !== null)
|
|
937
|
+
? B256.fromPartial(object.parentBeaconBlockRoot)
|
|
938
|
+
: undefined;
|
|
939
|
+
return message;
|
|
940
|
+
},
|
|
941
|
+
};
|
|
942
|
+
|
|
943
|
+
function createBaseWithdrawal(): Withdrawal {
|
|
944
|
+
return {
|
|
945
|
+
index: BigInt("0"),
|
|
946
|
+
validatorIndex: BigInt("0"),
|
|
947
|
+
withdrawalIndex: BigInt("0"),
|
|
948
|
+
address: undefined,
|
|
949
|
+
amount: undefined,
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
export const Withdrawal = {
|
|
954
|
+
encode(message: Withdrawal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
955
|
+
if (message.index !== undefined && message.index !== BigInt("0")) {
|
|
956
|
+
if (BigInt.asUintN(64, message.index) !== message.index) {
|
|
957
|
+
throw new globalThis.Error("value provided for field message.index of type uint64 too large");
|
|
958
|
+
}
|
|
959
|
+
writer.uint32(8).uint64(message.index.toString());
|
|
960
|
+
}
|
|
961
|
+
if (message.validatorIndex !== undefined && message.validatorIndex !== BigInt("0")) {
|
|
962
|
+
if (BigInt.asUintN(64, message.validatorIndex) !== message.validatorIndex) {
|
|
963
|
+
throw new globalThis.Error("value provided for field message.validatorIndex of type uint64 too large");
|
|
964
|
+
}
|
|
965
|
+
writer.uint32(16).uint64(message.validatorIndex.toString());
|
|
966
|
+
}
|
|
967
|
+
if (message.withdrawalIndex !== undefined && message.withdrawalIndex !== BigInt("0")) {
|
|
968
|
+
if (BigInt.asUintN(64, message.withdrawalIndex) !== message.withdrawalIndex) {
|
|
969
|
+
throw new globalThis.Error("value provided for field message.withdrawalIndex of type uint64 too large");
|
|
970
|
+
}
|
|
971
|
+
writer.uint32(24).uint64(message.withdrawalIndex.toString());
|
|
972
|
+
}
|
|
973
|
+
if (message.address !== undefined) {
|
|
974
|
+
Address.encode(message.address, writer.uint32(34).fork()).ldelim();
|
|
975
|
+
}
|
|
976
|
+
if (message.amount !== undefined) {
|
|
977
|
+
U256.encode(message.amount, writer.uint32(42).fork()).ldelim();
|
|
978
|
+
}
|
|
979
|
+
return writer;
|
|
980
|
+
},
|
|
981
|
+
|
|
982
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Withdrawal {
|
|
983
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
984
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
985
|
+
const message = createBaseWithdrawal() as any;
|
|
986
|
+
while (reader.pos < end) {
|
|
987
|
+
const tag = reader.uint32();
|
|
988
|
+
switch (tag >>> 3) {
|
|
989
|
+
case 1:
|
|
990
|
+
if (tag !== 8) {
|
|
991
|
+
break;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
message.index = longToBigint(reader.uint64() as Long);
|
|
995
|
+
continue;
|
|
996
|
+
case 2:
|
|
997
|
+
if (tag !== 16) {
|
|
998
|
+
break;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
message.validatorIndex = longToBigint(reader.uint64() as Long);
|
|
1002
|
+
continue;
|
|
1003
|
+
case 3:
|
|
1004
|
+
if (tag !== 24) {
|
|
1005
|
+
break;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
message.withdrawalIndex = longToBigint(reader.uint64() as Long);
|
|
1009
|
+
continue;
|
|
1010
|
+
case 4:
|
|
1011
|
+
if (tag !== 34) {
|
|
1012
|
+
break;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
message.address = Address.decode(reader, reader.uint32());
|
|
1016
|
+
continue;
|
|
1017
|
+
case 5:
|
|
1018
|
+
if (tag !== 42) {
|
|
1019
|
+
break;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
message.amount = U256.decode(reader, reader.uint32());
|
|
1023
|
+
continue;
|
|
1024
|
+
}
|
|
1025
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1026
|
+
break;
|
|
1027
|
+
}
|
|
1028
|
+
reader.skipType(tag & 7);
|
|
1029
|
+
}
|
|
1030
|
+
return message;
|
|
1031
|
+
},
|
|
1032
|
+
|
|
1033
|
+
fromJSON(object: any): Withdrawal {
|
|
1034
|
+
return {
|
|
1035
|
+
index: isSet(object.index) ? BigInt(object.index) : BigInt("0"),
|
|
1036
|
+
validatorIndex: isSet(object.validatorIndex) ? BigInt(object.validatorIndex) : BigInt("0"),
|
|
1037
|
+
withdrawalIndex: isSet(object.withdrawalIndex) ? BigInt(object.withdrawalIndex) : BigInt("0"),
|
|
1038
|
+
address: isSet(object.address) ? Address.fromJSON(object.address) : undefined,
|
|
1039
|
+
amount: isSet(object.amount) ? U256.fromJSON(object.amount) : undefined,
|
|
1040
|
+
};
|
|
1041
|
+
},
|
|
1042
|
+
|
|
1043
|
+
toJSON(message: Withdrawal): unknown {
|
|
1044
|
+
const obj: any = {};
|
|
1045
|
+
if (message.index !== undefined && message.index !== BigInt("0")) {
|
|
1046
|
+
obj.index = message.index.toString();
|
|
1047
|
+
}
|
|
1048
|
+
if (message.validatorIndex !== undefined && message.validatorIndex !== BigInt("0")) {
|
|
1049
|
+
obj.validatorIndex = message.validatorIndex.toString();
|
|
1050
|
+
}
|
|
1051
|
+
if (message.withdrawalIndex !== undefined && message.withdrawalIndex !== BigInt("0")) {
|
|
1052
|
+
obj.withdrawalIndex = message.withdrawalIndex.toString();
|
|
1053
|
+
}
|
|
1054
|
+
if (message.address !== undefined) {
|
|
1055
|
+
obj.address = Address.toJSON(message.address);
|
|
1056
|
+
}
|
|
1057
|
+
if (message.amount !== undefined) {
|
|
1058
|
+
obj.amount = U256.toJSON(message.amount);
|
|
1059
|
+
}
|
|
1060
|
+
return obj;
|
|
1061
|
+
},
|
|
1062
|
+
|
|
1063
|
+
create(base?: DeepPartial<Withdrawal>): Withdrawal {
|
|
1064
|
+
return Withdrawal.fromPartial(base ?? {});
|
|
1065
|
+
},
|
|
1066
|
+
fromPartial(object: DeepPartial<Withdrawal>): Withdrawal {
|
|
1067
|
+
const message = createBaseWithdrawal() as any;
|
|
1068
|
+
message.index = object.index ?? BigInt("0");
|
|
1069
|
+
message.validatorIndex = object.validatorIndex ?? BigInt("0");
|
|
1070
|
+
message.withdrawalIndex = object.withdrawalIndex ?? BigInt("0");
|
|
1071
|
+
message.address = (object.address !== undefined && object.address !== null)
|
|
1072
|
+
? Address.fromPartial(object.address)
|
|
1073
|
+
: undefined;
|
|
1074
|
+
message.amount = (object.amount !== undefined && object.amount !== null)
|
|
1075
|
+
? U256.fromPartial(object.amount)
|
|
1076
|
+
: undefined;
|
|
1077
|
+
return message;
|
|
1078
|
+
},
|
|
1079
|
+
};
|
|
1080
|
+
|
|
1081
|
+
function createBaseTransaction(): Transaction {
|
|
1082
|
+
return {
|
|
1083
|
+
hash: undefined,
|
|
1084
|
+
nonce: BigInt("0"),
|
|
1085
|
+
transactionIndex: BigInt("0"),
|
|
1086
|
+
from: undefined,
|
|
1087
|
+
to: undefined,
|
|
1088
|
+
value: undefined,
|
|
1089
|
+
gasPrice: undefined,
|
|
1090
|
+
gas: undefined,
|
|
1091
|
+
maxFeePerGas: undefined,
|
|
1092
|
+
maxPriorityFeePerGas: undefined,
|
|
1093
|
+
input: new Uint8Array(0),
|
|
1094
|
+
signature: undefined,
|
|
1095
|
+
chainId: BigInt("0"),
|
|
1096
|
+
accessList: [],
|
|
1097
|
+
transactionType: BigInt("0"),
|
|
1098
|
+
maxFeePerBlobGas: undefined,
|
|
1099
|
+
blobVersionedHashes: [],
|
|
1100
|
+
};
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
export const Transaction = {
|
|
1104
|
+
encode(message: Transaction, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
1105
|
+
if (message.hash !== undefined) {
|
|
1106
|
+
B256.encode(message.hash, writer.uint32(10).fork()).ldelim();
|
|
1107
|
+
}
|
|
1108
|
+
if (message.nonce !== undefined && message.nonce !== BigInt("0")) {
|
|
1109
|
+
if (BigInt.asUintN(64, message.nonce) !== message.nonce) {
|
|
1110
|
+
throw new globalThis.Error("value provided for field message.nonce of type uint64 too large");
|
|
1111
|
+
}
|
|
1112
|
+
writer.uint32(16).uint64(message.nonce.toString());
|
|
1113
|
+
}
|
|
1114
|
+
if (message.transactionIndex !== undefined && message.transactionIndex !== BigInt("0")) {
|
|
1115
|
+
if (BigInt.asUintN(64, message.transactionIndex) !== message.transactionIndex) {
|
|
1116
|
+
throw new globalThis.Error("value provided for field message.transactionIndex of type uint64 too large");
|
|
1117
|
+
}
|
|
1118
|
+
writer.uint32(24).uint64(message.transactionIndex.toString());
|
|
1119
|
+
}
|
|
1120
|
+
if (message.from !== undefined) {
|
|
1121
|
+
Address.encode(message.from, writer.uint32(34).fork()).ldelim();
|
|
1122
|
+
}
|
|
1123
|
+
if (message.to !== undefined) {
|
|
1124
|
+
Address.encode(message.to, writer.uint32(42).fork()).ldelim();
|
|
1125
|
+
}
|
|
1126
|
+
if (message.value !== undefined) {
|
|
1127
|
+
U256.encode(message.value, writer.uint32(50).fork()).ldelim();
|
|
1128
|
+
}
|
|
1129
|
+
if (message.gasPrice !== undefined) {
|
|
1130
|
+
U128.encode(message.gasPrice, writer.uint32(58).fork()).ldelim();
|
|
1131
|
+
}
|
|
1132
|
+
if (message.gas !== undefined) {
|
|
1133
|
+
U256.encode(message.gas, writer.uint32(66).fork()).ldelim();
|
|
1134
|
+
}
|
|
1135
|
+
if (message.maxFeePerGas !== undefined) {
|
|
1136
|
+
U128.encode(message.maxFeePerGas, writer.uint32(74).fork()).ldelim();
|
|
1137
|
+
}
|
|
1138
|
+
if (message.maxPriorityFeePerGas !== undefined) {
|
|
1139
|
+
U128.encode(message.maxPriorityFeePerGas, writer.uint32(82).fork()).ldelim();
|
|
1140
|
+
}
|
|
1141
|
+
if (message.input !== undefined && message.input.length !== 0) {
|
|
1142
|
+
writer.uint32(90).bytes(message.input);
|
|
1143
|
+
}
|
|
1144
|
+
if (message.signature !== undefined) {
|
|
1145
|
+
Signature.encode(message.signature, writer.uint32(98).fork()).ldelim();
|
|
1146
|
+
}
|
|
1147
|
+
if (message.chainId !== undefined && message.chainId !== BigInt("0")) {
|
|
1148
|
+
if (BigInt.asUintN(64, message.chainId) !== message.chainId) {
|
|
1149
|
+
throw new globalThis.Error("value provided for field message.chainId of type uint64 too large");
|
|
1150
|
+
}
|
|
1151
|
+
writer.uint32(104).uint64(message.chainId.toString());
|
|
1152
|
+
}
|
|
1153
|
+
if (message.accessList !== undefined && message.accessList.length !== 0) {
|
|
1154
|
+
for (const v of message.accessList) {
|
|
1155
|
+
AccessListItem.encode(v!, writer.uint32(114).fork()).ldelim();
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
if (message.transactionType !== undefined && message.transactionType !== BigInt("0")) {
|
|
1159
|
+
if (BigInt.asUintN(64, message.transactionType) !== message.transactionType) {
|
|
1160
|
+
throw new globalThis.Error("value provided for field message.transactionType of type uint64 too large");
|
|
1161
|
+
}
|
|
1162
|
+
writer.uint32(120).uint64(message.transactionType.toString());
|
|
1163
|
+
}
|
|
1164
|
+
if (message.maxFeePerBlobGas !== undefined) {
|
|
1165
|
+
U128.encode(message.maxFeePerBlobGas, writer.uint32(130).fork()).ldelim();
|
|
1166
|
+
}
|
|
1167
|
+
if (message.blobVersionedHashes !== undefined && message.blobVersionedHashes.length !== 0) {
|
|
1168
|
+
for (const v of message.blobVersionedHashes) {
|
|
1169
|
+
B256.encode(v!, writer.uint32(138).fork()).ldelim();
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
return writer;
|
|
1173
|
+
},
|
|
1174
|
+
|
|
1175
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Transaction {
|
|
1176
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
1177
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1178
|
+
const message = createBaseTransaction() as any;
|
|
1179
|
+
while (reader.pos < end) {
|
|
1180
|
+
const tag = reader.uint32();
|
|
1181
|
+
switch (tag >>> 3) {
|
|
1182
|
+
case 1:
|
|
1183
|
+
if (tag !== 10) {
|
|
1184
|
+
break;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
message.hash = B256.decode(reader, reader.uint32());
|
|
1188
|
+
continue;
|
|
1189
|
+
case 2:
|
|
1190
|
+
if (tag !== 16) {
|
|
1191
|
+
break;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
message.nonce = longToBigint(reader.uint64() as Long);
|
|
1195
|
+
continue;
|
|
1196
|
+
case 3:
|
|
1197
|
+
if (tag !== 24) {
|
|
1198
|
+
break;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
message.transactionIndex = longToBigint(reader.uint64() as Long);
|
|
1202
|
+
continue;
|
|
1203
|
+
case 4:
|
|
1204
|
+
if (tag !== 34) {
|
|
1205
|
+
break;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
message.from = Address.decode(reader, reader.uint32());
|
|
1209
|
+
continue;
|
|
1210
|
+
case 5:
|
|
1211
|
+
if (tag !== 42) {
|
|
1212
|
+
break;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
message.to = Address.decode(reader, reader.uint32());
|
|
1216
|
+
continue;
|
|
1217
|
+
case 6:
|
|
1218
|
+
if (tag !== 50) {
|
|
1219
|
+
break;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
message.value = U256.decode(reader, reader.uint32());
|
|
1223
|
+
continue;
|
|
1224
|
+
case 7:
|
|
1225
|
+
if (tag !== 58) {
|
|
1226
|
+
break;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
message.gasPrice = U128.decode(reader, reader.uint32());
|
|
1230
|
+
continue;
|
|
1231
|
+
case 8:
|
|
1232
|
+
if (tag !== 66) {
|
|
1233
|
+
break;
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
message.gas = U256.decode(reader, reader.uint32());
|
|
1237
|
+
continue;
|
|
1238
|
+
case 9:
|
|
1239
|
+
if (tag !== 74) {
|
|
1240
|
+
break;
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
message.maxFeePerGas = U128.decode(reader, reader.uint32());
|
|
1244
|
+
continue;
|
|
1245
|
+
case 10:
|
|
1246
|
+
if (tag !== 82) {
|
|
1247
|
+
break;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
message.maxPriorityFeePerGas = U128.decode(reader, reader.uint32());
|
|
1251
|
+
continue;
|
|
1252
|
+
case 11:
|
|
1253
|
+
if (tag !== 90) {
|
|
1254
|
+
break;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
message.input = reader.bytes();
|
|
1258
|
+
continue;
|
|
1259
|
+
case 12:
|
|
1260
|
+
if (tag !== 98) {
|
|
1261
|
+
break;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
message.signature = Signature.decode(reader, reader.uint32());
|
|
1265
|
+
continue;
|
|
1266
|
+
case 13:
|
|
1267
|
+
if (tag !== 104) {
|
|
1268
|
+
break;
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
message.chainId = longToBigint(reader.uint64() as Long);
|
|
1272
|
+
continue;
|
|
1273
|
+
case 14:
|
|
1274
|
+
if (tag !== 114) {
|
|
1275
|
+
break;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
message.accessList!.push(AccessListItem.decode(reader, reader.uint32()));
|
|
1279
|
+
continue;
|
|
1280
|
+
case 15:
|
|
1281
|
+
if (tag !== 120) {
|
|
1282
|
+
break;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
message.transactionType = longToBigint(reader.uint64() as Long);
|
|
1286
|
+
continue;
|
|
1287
|
+
case 16:
|
|
1288
|
+
if (tag !== 130) {
|
|
1289
|
+
break;
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
message.maxFeePerBlobGas = U128.decode(reader, reader.uint32());
|
|
1293
|
+
continue;
|
|
1294
|
+
case 17:
|
|
1295
|
+
if (tag !== 138) {
|
|
1296
|
+
break;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
message.blobVersionedHashes!.push(B256.decode(reader, reader.uint32()));
|
|
1300
|
+
continue;
|
|
1301
|
+
}
|
|
1302
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1303
|
+
break;
|
|
1304
|
+
}
|
|
1305
|
+
reader.skipType(tag & 7);
|
|
1306
|
+
}
|
|
1307
|
+
return message;
|
|
1308
|
+
},
|
|
1309
|
+
|
|
1310
|
+
fromJSON(object: any): Transaction {
|
|
1311
|
+
return {
|
|
1312
|
+
hash: isSet(object.hash) ? B256.fromJSON(object.hash) : undefined,
|
|
1313
|
+
nonce: isSet(object.nonce) ? BigInt(object.nonce) : BigInt("0"),
|
|
1314
|
+
transactionIndex: isSet(object.transactionIndex) ? BigInt(object.transactionIndex) : BigInt("0"),
|
|
1315
|
+
from: isSet(object.from) ? Address.fromJSON(object.from) : undefined,
|
|
1316
|
+
to: isSet(object.to) ? Address.fromJSON(object.to) : undefined,
|
|
1317
|
+
value: isSet(object.value) ? U256.fromJSON(object.value) : undefined,
|
|
1318
|
+
gasPrice: isSet(object.gasPrice) ? U128.fromJSON(object.gasPrice) : undefined,
|
|
1319
|
+
gas: isSet(object.gas) ? U256.fromJSON(object.gas) : undefined,
|
|
1320
|
+
maxFeePerGas: isSet(object.maxFeePerGas) ? U128.fromJSON(object.maxFeePerGas) : undefined,
|
|
1321
|
+
maxPriorityFeePerGas: isSet(object.maxPriorityFeePerGas) ? U128.fromJSON(object.maxPriorityFeePerGas) : undefined,
|
|
1322
|
+
input: isSet(object.input) ? bytesFromBase64(object.input) : new Uint8Array(0),
|
|
1323
|
+
signature: isSet(object.signature) ? Signature.fromJSON(object.signature) : undefined,
|
|
1324
|
+
chainId: isSet(object.chainId) ? BigInt(object.chainId) : BigInt("0"),
|
|
1325
|
+
accessList: globalThis.Array.isArray(object?.accessList)
|
|
1326
|
+
? object.accessList.map((e: any) => AccessListItem.fromJSON(e))
|
|
1327
|
+
: [],
|
|
1328
|
+
transactionType: isSet(object.transactionType) ? BigInt(object.transactionType) : BigInt("0"),
|
|
1329
|
+
maxFeePerBlobGas: isSet(object.maxFeePerBlobGas) ? U128.fromJSON(object.maxFeePerBlobGas) : undefined,
|
|
1330
|
+
blobVersionedHashes: globalThis.Array.isArray(object?.blobVersionedHashes)
|
|
1331
|
+
? object.blobVersionedHashes.map((e: any) => B256.fromJSON(e))
|
|
1332
|
+
: [],
|
|
1333
|
+
};
|
|
1334
|
+
},
|
|
1335
|
+
|
|
1336
|
+
toJSON(message: Transaction): unknown {
|
|
1337
|
+
const obj: any = {};
|
|
1338
|
+
if (message.hash !== undefined) {
|
|
1339
|
+
obj.hash = B256.toJSON(message.hash);
|
|
1340
|
+
}
|
|
1341
|
+
if (message.nonce !== undefined && message.nonce !== BigInt("0")) {
|
|
1342
|
+
obj.nonce = message.nonce.toString();
|
|
1343
|
+
}
|
|
1344
|
+
if (message.transactionIndex !== undefined && message.transactionIndex !== BigInt("0")) {
|
|
1345
|
+
obj.transactionIndex = message.transactionIndex.toString();
|
|
1346
|
+
}
|
|
1347
|
+
if (message.from !== undefined) {
|
|
1348
|
+
obj.from = Address.toJSON(message.from);
|
|
1349
|
+
}
|
|
1350
|
+
if (message.to !== undefined) {
|
|
1351
|
+
obj.to = Address.toJSON(message.to);
|
|
1352
|
+
}
|
|
1353
|
+
if (message.value !== undefined) {
|
|
1354
|
+
obj.value = U256.toJSON(message.value);
|
|
1355
|
+
}
|
|
1356
|
+
if (message.gasPrice !== undefined) {
|
|
1357
|
+
obj.gasPrice = U128.toJSON(message.gasPrice);
|
|
1358
|
+
}
|
|
1359
|
+
if (message.gas !== undefined) {
|
|
1360
|
+
obj.gas = U256.toJSON(message.gas);
|
|
1361
|
+
}
|
|
1362
|
+
if (message.maxFeePerGas !== undefined) {
|
|
1363
|
+
obj.maxFeePerGas = U128.toJSON(message.maxFeePerGas);
|
|
1364
|
+
}
|
|
1365
|
+
if (message.maxPriorityFeePerGas !== undefined) {
|
|
1366
|
+
obj.maxPriorityFeePerGas = U128.toJSON(message.maxPriorityFeePerGas);
|
|
1367
|
+
}
|
|
1368
|
+
if (message.input !== undefined && message.input.length !== 0) {
|
|
1369
|
+
obj.input = base64FromBytes(message.input);
|
|
1370
|
+
}
|
|
1371
|
+
if (message.signature !== undefined) {
|
|
1372
|
+
obj.signature = Signature.toJSON(message.signature);
|
|
1373
|
+
}
|
|
1374
|
+
if (message.chainId !== undefined && message.chainId !== BigInt("0")) {
|
|
1375
|
+
obj.chainId = message.chainId.toString();
|
|
1376
|
+
}
|
|
1377
|
+
if (message.accessList?.length) {
|
|
1378
|
+
obj.accessList = message.accessList.map((e) => AccessListItem.toJSON(e));
|
|
1379
|
+
}
|
|
1380
|
+
if (message.transactionType !== undefined && message.transactionType !== BigInt("0")) {
|
|
1381
|
+
obj.transactionType = message.transactionType.toString();
|
|
1382
|
+
}
|
|
1383
|
+
if (message.maxFeePerBlobGas !== undefined) {
|
|
1384
|
+
obj.maxFeePerBlobGas = U128.toJSON(message.maxFeePerBlobGas);
|
|
1385
|
+
}
|
|
1386
|
+
if (message.blobVersionedHashes?.length) {
|
|
1387
|
+
obj.blobVersionedHashes = message.blobVersionedHashes.map((e) => B256.toJSON(e));
|
|
1388
|
+
}
|
|
1389
|
+
return obj;
|
|
1390
|
+
},
|
|
1391
|
+
|
|
1392
|
+
create(base?: DeepPartial<Transaction>): Transaction {
|
|
1393
|
+
return Transaction.fromPartial(base ?? {});
|
|
1394
|
+
},
|
|
1395
|
+
fromPartial(object: DeepPartial<Transaction>): Transaction {
|
|
1396
|
+
const message = createBaseTransaction() as any;
|
|
1397
|
+
message.hash = (object.hash !== undefined && object.hash !== null) ? B256.fromPartial(object.hash) : undefined;
|
|
1398
|
+
message.nonce = object.nonce ?? BigInt("0");
|
|
1399
|
+
message.transactionIndex = object.transactionIndex ?? BigInt("0");
|
|
1400
|
+
message.from = (object.from !== undefined && object.from !== null) ? Address.fromPartial(object.from) : undefined;
|
|
1401
|
+
message.to = (object.to !== undefined && object.to !== null) ? Address.fromPartial(object.to) : undefined;
|
|
1402
|
+
message.value = (object.value !== undefined && object.value !== null) ? U256.fromPartial(object.value) : undefined;
|
|
1403
|
+
message.gasPrice = (object.gasPrice !== undefined && object.gasPrice !== null)
|
|
1404
|
+
? U128.fromPartial(object.gasPrice)
|
|
1405
|
+
: undefined;
|
|
1406
|
+
message.gas = (object.gas !== undefined && object.gas !== null) ? U256.fromPartial(object.gas) : undefined;
|
|
1407
|
+
message.maxFeePerGas = (object.maxFeePerGas !== undefined && object.maxFeePerGas !== null)
|
|
1408
|
+
? U128.fromPartial(object.maxFeePerGas)
|
|
1409
|
+
: undefined;
|
|
1410
|
+
message.maxPriorityFeePerGas = (object.maxPriorityFeePerGas !== undefined && object.maxPriorityFeePerGas !== null)
|
|
1411
|
+
? U128.fromPartial(object.maxPriorityFeePerGas)
|
|
1412
|
+
: undefined;
|
|
1413
|
+
message.input = object.input ?? new Uint8Array(0);
|
|
1414
|
+
message.signature = (object.signature !== undefined && object.signature !== null)
|
|
1415
|
+
? Signature.fromPartial(object.signature)
|
|
1416
|
+
: undefined;
|
|
1417
|
+
message.chainId = object.chainId ?? BigInt("0");
|
|
1418
|
+
message.accessList = object.accessList?.map((e) => AccessListItem.fromPartial(e)) || [];
|
|
1419
|
+
message.transactionType = object.transactionType ?? BigInt("0");
|
|
1420
|
+
message.maxFeePerBlobGas = (object.maxFeePerBlobGas !== undefined && object.maxFeePerBlobGas !== null)
|
|
1421
|
+
? U128.fromPartial(object.maxFeePerBlobGas)
|
|
1422
|
+
: undefined;
|
|
1423
|
+
message.blobVersionedHashes = object.blobVersionedHashes?.map((e) => B256.fromPartial(e)) || [];
|
|
1424
|
+
return message;
|
|
1425
|
+
},
|
|
1426
|
+
};
|
|
1427
|
+
|
|
1428
|
+
function createBaseTransactionReceipt(): TransactionReceipt {
|
|
1429
|
+
return {
|
|
1430
|
+
transactionHash: undefined,
|
|
1431
|
+
transactionIndex: BigInt("0"),
|
|
1432
|
+
cumulativeGasUsed: undefined,
|
|
1433
|
+
gasUsed: undefined,
|
|
1434
|
+
effectiveGasPrice: undefined,
|
|
1435
|
+
from: undefined,
|
|
1436
|
+
to: undefined,
|
|
1437
|
+
contractAddress: undefined,
|
|
1438
|
+
logsBloom: undefined,
|
|
1439
|
+
statusCode: BigInt("0"),
|
|
1440
|
+
transactionType: BigInt("0"),
|
|
1441
|
+
blobGasUsed: undefined,
|
|
1442
|
+
blobGasPrice: undefined,
|
|
1443
|
+
};
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
export const TransactionReceipt = {
|
|
1447
|
+
encode(message: TransactionReceipt, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
1448
|
+
if (message.transactionHash !== undefined) {
|
|
1449
|
+
B256.encode(message.transactionHash, writer.uint32(10).fork()).ldelim();
|
|
1450
|
+
}
|
|
1451
|
+
if (message.transactionIndex !== undefined && message.transactionIndex !== BigInt("0")) {
|
|
1452
|
+
if (BigInt.asUintN(64, message.transactionIndex) !== message.transactionIndex) {
|
|
1453
|
+
throw new globalThis.Error("value provided for field message.transactionIndex of type uint64 too large");
|
|
1454
|
+
}
|
|
1455
|
+
writer.uint32(16).uint64(message.transactionIndex.toString());
|
|
1456
|
+
}
|
|
1457
|
+
if (message.cumulativeGasUsed !== undefined) {
|
|
1458
|
+
U256.encode(message.cumulativeGasUsed, writer.uint32(26).fork()).ldelim();
|
|
1459
|
+
}
|
|
1460
|
+
if (message.gasUsed !== undefined) {
|
|
1461
|
+
U256.encode(message.gasUsed, writer.uint32(34).fork()).ldelim();
|
|
1462
|
+
}
|
|
1463
|
+
if (message.effectiveGasPrice !== undefined) {
|
|
1464
|
+
U128.encode(message.effectiveGasPrice, writer.uint32(42).fork()).ldelim();
|
|
1465
|
+
}
|
|
1466
|
+
if (message.from !== undefined) {
|
|
1467
|
+
Address.encode(message.from, writer.uint32(50).fork()).ldelim();
|
|
1468
|
+
}
|
|
1469
|
+
if (message.to !== undefined) {
|
|
1470
|
+
Address.encode(message.to, writer.uint32(58).fork()).ldelim();
|
|
1471
|
+
}
|
|
1472
|
+
if (message.contractAddress !== undefined) {
|
|
1473
|
+
Address.encode(message.contractAddress, writer.uint32(66).fork()).ldelim();
|
|
1474
|
+
}
|
|
1475
|
+
if (message.logsBloom !== undefined) {
|
|
1476
|
+
Bloom.encode(message.logsBloom, writer.uint32(74).fork()).ldelim();
|
|
1477
|
+
}
|
|
1478
|
+
if (message.statusCode !== undefined && message.statusCode !== BigInt("0")) {
|
|
1479
|
+
if (BigInt.asUintN(64, message.statusCode) !== message.statusCode) {
|
|
1480
|
+
throw new globalThis.Error("value provided for field message.statusCode of type uint64 too large");
|
|
1481
|
+
}
|
|
1482
|
+
writer.uint32(80).uint64(message.statusCode.toString());
|
|
1483
|
+
}
|
|
1484
|
+
if (message.transactionType !== undefined && message.transactionType !== BigInt("0")) {
|
|
1485
|
+
if (BigInt.asUintN(64, message.transactionType) !== message.transactionType) {
|
|
1486
|
+
throw new globalThis.Error("value provided for field message.transactionType of type uint64 too large");
|
|
1487
|
+
}
|
|
1488
|
+
writer.uint32(88).uint64(message.transactionType.toString());
|
|
1489
|
+
}
|
|
1490
|
+
if (message.blobGasUsed !== undefined) {
|
|
1491
|
+
U128.encode(message.blobGasUsed, writer.uint32(98).fork()).ldelim();
|
|
1492
|
+
}
|
|
1493
|
+
if (message.blobGasPrice !== undefined) {
|
|
1494
|
+
U128.encode(message.blobGasPrice, writer.uint32(106).fork()).ldelim();
|
|
1495
|
+
}
|
|
1496
|
+
return writer;
|
|
1497
|
+
},
|
|
1498
|
+
|
|
1499
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): TransactionReceipt {
|
|
1500
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
1501
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1502
|
+
const message = createBaseTransactionReceipt() as any;
|
|
1503
|
+
while (reader.pos < end) {
|
|
1504
|
+
const tag = reader.uint32();
|
|
1505
|
+
switch (tag >>> 3) {
|
|
1506
|
+
case 1:
|
|
1507
|
+
if (tag !== 10) {
|
|
1508
|
+
break;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
message.transactionHash = B256.decode(reader, reader.uint32());
|
|
1512
|
+
continue;
|
|
1513
|
+
case 2:
|
|
1514
|
+
if (tag !== 16) {
|
|
1515
|
+
break;
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
message.transactionIndex = longToBigint(reader.uint64() as Long);
|
|
1519
|
+
continue;
|
|
1520
|
+
case 3:
|
|
1521
|
+
if (tag !== 26) {
|
|
1522
|
+
break;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
message.cumulativeGasUsed = U256.decode(reader, reader.uint32());
|
|
1526
|
+
continue;
|
|
1527
|
+
case 4:
|
|
1528
|
+
if (tag !== 34) {
|
|
1529
|
+
break;
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
message.gasUsed = U256.decode(reader, reader.uint32());
|
|
1533
|
+
continue;
|
|
1534
|
+
case 5:
|
|
1535
|
+
if (tag !== 42) {
|
|
1536
|
+
break;
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
message.effectiveGasPrice = U128.decode(reader, reader.uint32());
|
|
1540
|
+
continue;
|
|
1541
|
+
case 6:
|
|
1542
|
+
if (tag !== 50) {
|
|
1543
|
+
break;
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
message.from = Address.decode(reader, reader.uint32());
|
|
1547
|
+
continue;
|
|
1548
|
+
case 7:
|
|
1549
|
+
if (tag !== 58) {
|
|
1550
|
+
break;
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
message.to = Address.decode(reader, reader.uint32());
|
|
1554
|
+
continue;
|
|
1555
|
+
case 8:
|
|
1556
|
+
if (tag !== 66) {
|
|
1557
|
+
break;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
message.contractAddress = Address.decode(reader, reader.uint32());
|
|
1561
|
+
continue;
|
|
1562
|
+
case 9:
|
|
1563
|
+
if (tag !== 74) {
|
|
1564
|
+
break;
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
message.logsBloom = Bloom.decode(reader, reader.uint32());
|
|
1568
|
+
continue;
|
|
1569
|
+
case 10:
|
|
1570
|
+
if (tag !== 80) {
|
|
1571
|
+
break;
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
message.statusCode = longToBigint(reader.uint64() as Long);
|
|
1575
|
+
continue;
|
|
1576
|
+
case 11:
|
|
1577
|
+
if (tag !== 88) {
|
|
1578
|
+
break;
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
message.transactionType = longToBigint(reader.uint64() as Long);
|
|
1582
|
+
continue;
|
|
1583
|
+
case 12:
|
|
1584
|
+
if (tag !== 98) {
|
|
1585
|
+
break;
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
message.blobGasUsed = U128.decode(reader, reader.uint32());
|
|
1589
|
+
continue;
|
|
1590
|
+
case 13:
|
|
1591
|
+
if (tag !== 106) {
|
|
1592
|
+
break;
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
message.blobGasPrice = U128.decode(reader, reader.uint32());
|
|
1596
|
+
continue;
|
|
1597
|
+
}
|
|
1598
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1599
|
+
break;
|
|
1600
|
+
}
|
|
1601
|
+
reader.skipType(tag & 7);
|
|
1602
|
+
}
|
|
1603
|
+
return message;
|
|
1604
|
+
},
|
|
1605
|
+
|
|
1606
|
+
fromJSON(object: any): TransactionReceipt {
|
|
1607
|
+
return {
|
|
1608
|
+
transactionHash: isSet(object.transactionHash) ? B256.fromJSON(object.transactionHash) : undefined,
|
|
1609
|
+
transactionIndex: isSet(object.transactionIndex) ? BigInt(object.transactionIndex) : BigInt("0"),
|
|
1610
|
+
cumulativeGasUsed: isSet(object.cumulativeGasUsed) ? U256.fromJSON(object.cumulativeGasUsed) : undefined,
|
|
1611
|
+
gasUsed: isSet(object.gasUsed) ? U256.fromJSON(object.gasUsed) : undefined,
|
|
1612
|
+
effectiveGasPrice: isSet(object.effectiveGasPrice) ? U128.fromJSON(object.effectiveGasPrice) : undefined,
|
|
1613
|
+
from: isSet(object.from) ? Address.fromJSON(object.from) : undefined,
|
|
1614
|
+
to: isSet(object.to) ? Address.fromJSON(object.to) : undefined,
|
|
1615
|
+
contractAddress: isSet(object.contractAddress) ? Address.fromJSON(object.contractAddress) : undefined,
|
|
1616
|
+
logsBloom: isSet(object.logsBloom) ? Bloom.fromJSON(object.logsBloom) : undefined,
|
|
1617
|
+
statusCode: isSet(object.statusCode) ? BigInt(object.statusCode) : BigInt("0"),
|
|
1618
|
+
transactionType: isSet(object.transactionType) ? BigInt(object.transactionType) : BigInt("0"),
|
|
1619
|
+
blobGasUsed: isSet(object.blobGasUsed) ? U128.fromJSON(object.blobGasUsed) : undefined,
|
|
1620
|
+
blobGasPrice: isSet(object.blobGasPrice) ? U128.fromJSON(object.blobGasPrice) : undefined,
|
|
1621
|
+
};
|
|
1622
|
+
},
|
|
1623
|
+
|
|
1624
|
+
toJSON(message: TransactionReceipt): unknown {
|
|
1625
|
+
const obj: any = {};
|
|
1626
|
+
if (message.transactionHash !== undefined) {
|
|
1627
|
+
obj.transactionHash = B256.toJSON(message.transactionHash);
|
|
1628
|
+
}
|
|
1629
|
+
if (message.transactionIndex !== undefined && message.transactionIndex !== BigInt("0")) {
|
|
1630
|
+
obj.transactionIndex = message.transactionIndex.toString();
|
|
1631
|
+
}
|
|
1632
|
+
if (message.cumulativeGasUsed !== undefined) {
|
|
1633
|
+
obj.cumulativeGasUsed = U256.toJSON(message.cumulativeGasUsed);
|
|
1634
|
+
}
|
|
1635
|
+
if (message.gasUsed !== undefined) {
|
|
1636
|
+
obj.gasUsed = U256.toJSON(message.gasUsed);
|
|
1637
|
+
}
|
|
1638
|
+
if (message.effectiveGasPrice !== undefined) {
|
|
1639
|
+
obj.effectiveGasPrice = U128.toJSON(message.effectiveGasPrice);
|
|
1640
|
+
}
|
|
1641
|
+
if (message.from !== undefined) {
|
|
1642
|
+
obj.from = Address.toJSON(message.from);
|
|
1643
|
+
}
|
|
1644
|
+
if (message.to !== undefined) {
|
|
1645
|
+
obj.to = Address.toJSON(message.to);
|
|
1646
|
+
}
|
|
1647
|
+
if (message.contractAddress !== undefined) {
|
|
1648
|
+
obj.contractAddress = Address.toJSON(message.contractAddress);
|
|
1649
|
+
}
|
|
1650
|
+
if (message.logsBloom !== undefined) {
|
|
1651
|
+
obj.logsBloom = Bloom.toJSON(message.logsBloom);
|
|
1652
|
+
}
|
|
1653
|
+
if (message.statusCode !== undefined && message.statusCode !== BigInt("0")) {
|
|
1654
|
+
obj.statusCode = message.statusCode.toString();
|
|
1655
|
+
}
|
|
1656
|
+
if (message.transactionType !== undefined && message.transactionType !== BigInt("0")) {
|
|
1657
|
+
obj.transactionType = message.transactionType.toString();
|
|
1658
|
+
}
|
|
1659
|
+
if (message.blobGasUsed !== undefined) {
|
|
1660
|
+
obj.blobGasUsed = U128.toJSON(message.blobGasUsed);
|
|
1661
|
+
}
|
|
1662
|
+
if (message.blobGasPrice !== undefined) {
|
|
1663
|
+
obj.blobGasPrice = U128.toJSON(message.blobGasPrice);
|
|
1664
|
+
}
|
|
1665
|
+
return obj;
|
|
1666
|
+
},
|
|
1667
|
+
|
|
1668
|
+
create(base?: DeepPartial<TransactionReceipt>): TransactionReceipt {
|
|
1669
|
+
return TransactionReceipt.fromPartial(base ?? {});
|
|
1670
|
+
},
|
|
1671
|
+
fromPartial(object: DeepPartial<TransactionReceipt>): TransactionReceipt {
|
|
1672
|
+
const message = createBaseTransactionReceipt() as any;
|
|
1673
|
+
message.transactionHash = (object.transactionHash !== undefined && object.transactionHash !== null)
|
|
1674
|
+
? B256.fromPartial(object.transactionHash)
|
|
1675
|
+
: undefined;
|
|
1676
|
+
message.transactionIndex = object.transactionIndex ?? BigInt("0");
|
|
1677
|
+
message.cumulativeGasUsed = (object.cumulativeGasUsed !== undefined && object.cumulativeGasUsed !== null)
|
|
1678
|
+
? U256.fromPartial(object.cumulativeGasUsed)
|
|
1679
|
+
: undefined;
|
|
1680
|
+
message.gasUsed = (object.gasUsed !== undefined && object.gasUsed !== null)
|
|
1681
|
+
? U256.fromPartial(object.gasUsed)
|
|
1682
|
+
: undefined;
|
|
1683
|
+
message.effectiveGasPrice = (object.effectiveGasPrice !== undefined && object.effectiveGasPrice !== null)
|
|
1684
|
+
? U128.fromPartial(object.effectiveGasPrice)
|
|
1685
|
+
: undefined;
|
|
1686
|
+
message.from = (object.from !== undefined && object.from !== null) ? Address.fromPartial(object.from) : undefined;
|
|
1687
|
+
message.to = (object.to !== undefined && object.to !== null) ? Address.fromPartial(object.to) : undefined;
|
|
1688
|
+
message.contractAddress = (object.contractAddress !== undefined && object.contractAddress !== null)
|
|
1689
|
+
? Address.fromPartial(object.contractAddress)
|
|
1690
|
+
: undefined;
|
|
1691
|
+
message.logsBloom = (object.logsBloom !== undefined && object.logsBloom !== null)
|
|
1692
|
+
? Bloom.fromPartial(object.logsBloom)
|
|
1693
|
+
: undefined;
|
|
1694
|
+
message.statusCode = object.statusCode ?? BigInt("0");
|
|
1695
|
+
message.transactionType = object.transactionType ?? BigInt("0");
|
|
1696
|
+
message.blobGasUsed = (object.blobGasUsed !== undefined && object.blobGasUsed !== null)
|
|
1697
|
+
? U128.fromPartial(object.blobGasUsed)
|
|
1698
|
+
: undefined;
|
|
1699
|
+
message.blobGasPrice = (object.blobGasPrice !== undefined && object.blobGasPrice !== null)
|
|
1700
|
+
? U128.fromPartial(object.blobGasPrice)
|
|
1701
|
+
: undefined;
|
|
1702
|
+
return message;
|
|
1703
|
+
},
|
|
1704
|
+
};
|
|
1705
|
+
|
|
1706
|
+
function createBaseLog(): Log {
|
|
1707
|
+
return {
|
|
1708
|
+
address: undefined,
|
|
1709
|
+
topics: [],
|
|
1710
|
+
data: new Uint8Array(0),
|
|
1711
|
+
logIndex: BigInt("0"),
|
|
1712
|
+
transactionIndex: BigInt("0"),
|
|
1713
|
+
transactionHash: undefined,
|
|
1714
|
+
};
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
export const Log = {
|
|
1718
|
+
encode(message: Log, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
1719
|
+
if (message.address !== undefined) {
|
|
1720
|
+
Address.encode(message.address, writer.uint32(10).fork()).ldelim();
|
|
1721
|
+
}
|
|
1722
|
+
if (message.topics !== undefined && message.topics.length !== 0) {
|
|
1723
|
+
for (const v of message.topics) {
|
|
1724
|
+
B256.encode(v!, writer.uint32(18).fork()).ldelim();
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
if (message.data !== undefined && message.data.length !== 0) {
|
|
1728
|
+
writer.uint32(26).bytes(message.data);
|
|
1729
|
+
}
|
|
1730
|
+
if (message.logIndex !== undefined && message.logIndex !== BigInt("0")) {
|
|
1731
|
+
if (BigInt.asUintN(64, message.logIndex) !== message.logIndex) {
|
|
1732
|
+
throw new globalThis.Error("value provided for field message.logIndex of type uint64 too large");
|
|
1733
|
+
}
|
|
1734
|
+
writer.uint32(32).uint64(message.logIndex.toString());
|
|
1735
|
+
}
|
|
1736
|
+
if (message.transactionIndex !== undefined && message.transactionIndex !== BigInt("0")) {
|
|
1737
|
+
if (BigInt.asUintN(64, message.transactionIndex) !== message.transactionIndex) {
|
|
1738
|
+
throw new globalThis.Error("value provided for field message.transactionIndex of type uint64 too large");
|
|
1739
|
+
}
|
|
1740
|
+
writer.uint32(40).uint64(message.transactionIndex.toString());
|
|
1741
|
+
}
|
|
1742
|
+
if (message.transactionHash !== undefined) {
|
|
1743
|
+
B256.encode(message.transactionHash, writer.uint32(50).fork()).ldelim();
|
|
1744
|
+
}
|
|
1745
|
+
return writer;
|
|
1746
|
+
},
|
|
1747
|
+
|
|
1748
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Log {
|
|
1749
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
1750
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1751
|
+
const message = createBaseLog() as any;
|
|
1752
|
+
while (reader.pos < end) {
|
|
1753
|
+
const tag = reader.uint32();
|
|
1754
|
+
switch (tag >>> 3) {
|
|
1755
|
+
case 1:
|
|
1756
|
+
if (tag !== 10) {
|
|
1757
|
+
break;
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
message.address = Address.decode(reader, reader.uint32());
|
|
1761
|
+
continue;
|
|
1762
|
+
case 2:
|
|
1763
|
+
if (tag !== 18) {
|
|
1764
|
+
break;
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
message.topics!.push(B256.decode(reader, reader.uint32()));
|
|
1768
|
+
continue;
|
|
1769
|
+
case 3:
|
|
1770
|
+
if (tag !== 26) {
|
|
1771
|
+
break;
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1774
|
+
message.data = reader.bytes();
|
|
1775
|
+
continue;
|
|
1776
|
+
case 4:
|
|
1777
|
+
if (tag !== 32) {
|
|
1778
|
+
break;
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
message.logIndex = longToBigint(reader.uint64() as Long);
|
|
1782
|
+
continue;
|
|
1783
|
+
case 5:
|
|
1784
|
+
if (tag !== 40) {
|
|
1785
|
+
break;
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
message.transactionIndex = longToBigint(reader.uint64() as Long);
|
|
1789
|
+
continue;
|
|
1790
|
+
case 6:
|
|
1791
|
+
if (tag !== 50) {
|
|
1792
|
+
break;
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
message.transactionHash = B256.decode(reader, reader.uint32());
|
|
1796
|
+
continue;
|
|
1797
|
+
}
|
|
1798
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1799
|
+
break;
|
|
1800
|
+
}
|
|
1801
|
+
reader.skipType(tag & 7);
|
|
1802
|
+
}
|
|
1803
|
+
return message;
|
|
1804
|
+
},
|
|
1805
|
+
|
|
1806
|
+
fromJSON(object: any): Log {
|
|
1807
|
+
return {
|
|
1808
|
+
address: isSet(object.address) ? Address.fromJSON(object.address) : undefined,
|
|
1809
|
+
topics: globalThis.Array.isArray(object?.topics) ? object.topics.map((e: any) => B256.fromJSON(e)) : [],
|
|
1810
|
+
data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0),
|
|
1811
|
+
logIndex: isSet(object.logIndex) ? BigInt(object.logIndex) : BigInt("0"),
|
|
1812
|
+
transactionIndex: isSet(object.transactionIndex) ? BigInt(object.transactionIndex) : BigInt("0"),
|
|
1813
|
+
transactionHash: isSet(object.transactionHash) ? B256.fromJSON(object.transactionHash) : undefined,
|
|
1814
|
+
};
|
|
1815
|
+
},
|
|
1816
|
+
|
|
1817
|
+
toJSON(message: Log): unknown {
|
|
1818
|
+
const obj: any = {};
|
|
1819
|
+
if (message.address !== undefined) {
|
|
1820
|
+
obj.address = Address.toJSON(message.address);
|
|
1821
|
+
}
|
|
1822
|
+
if (message.topics?.length) {
|
|
1823
|
+
obj.topics = message.topics.map((e) => B256.toJSON(e));
|
|
1824
|
+
}
|
|
1825
|
+
if (message.data !== undefined && message.data.length !== 0) {
|
|
1826
|
+
obj.data = base64FromBytes(message.data);
|
|
1827
|
+
}
|
|
1828
|
+
if (message.logIndex !== undefined && message.logIndex !== BigInt("0")) {
|
|
1829
|
+
obj.logIndex = message.logIndex.toString();
|
|
1830
|
+
}
|
|
1831
|
+
if (message.transactionIndex !== undefined && message.transactionIndex !== BigInt("0")) {
|
|
1832
|
+
obj.transactionIndex = message.transactionIndex.toString();
|
|
1833
|
+
}
|
|
1834
|
+
if (message.transactionHash !== undefined) {
|
|
1835
|
+
obj.transactionHash = B256.toJSON(message.transactionHash);
|
|
1836
|
+
}
|
|
1837
|
+
return obj;
|
|
1838
|
+
},
|
|
1839
|
+
|
|
1840
|
+
create(base?: DeepPartial<Log>): Log {
|
|
1841
|
+
return Log.fromPartial(base ?? {});
|
|
1842
|
+
},
|
|
1843
|
+
fromPartial(object: DeepPartial<Log>): Log {
|
|
1844
|
+
const message = createBaseLog() as any;
|
|
1845
|
+
message.address = (object.address !== undefined && object.address !== null)
|
|
1846
|
+
? Address.fromPartial(object.address)
|
|
1847
|
+
: undefined;
|
|
1848
|
+
message.topics = object.topics?.map((e) => B256.fromPartial(e)) || [];
|
|
1849
|
+
message.data = object.data ?? new Uint8Array(0);
|
|
1850
|
+
message.logIndex = object.logIndex ?? BigInt("0");
|
|
1851
|
+
message.transactionIndex = object.transactionIndex ?? BigInt("0");
|
|
1852
|
+
message.transactionHash = (object.transactionHash !== undefined && object.transactionHash !== null)
|
|
1853
|
+
? B256.fromPartial(object.transactionHash)
|
|
1854
|
+
: undefined;
|
|
1855
|
+
return message;
|
|
1856
|
+
},
|
|
1857
|
+
};
|
|
1858
|
+
|
|
1859
|
+
function createBaseSignature(): Signature {
|
|
1860
|
+
return { r: undefined, s: undefined, v: undefined, yParity: false };
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
export const Signature = {
|
|
1864
|
+
encode(message: Signature, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
1865
|
+
if (message.r !== undefined) {
|
|
1866
|
+
U256.encode(message.r, writer.uint32(10).fork()).ldelim();
|
|
1867
|
+
}
|
|
1868
|
+
if (message.s !== undefined) {
|
|
1869
|
+
U256.encode(message.s, writer.uint32(18).fork()).ldelim();
|
|
1870
|
+
}
|
|
1871
|
+
if (message.v !== undefined) {
|
|
1872
|
+
U256.encode(message.v, writer.uint32(26).fork()).ldelim();
|
|
1873
|
+
}
|
|
1874
|
+
if (message.yParity !== undefined && message.yParity !== false) {
|
|
1875
|
+
writer.uint32(32).bool(message.yParity);
|
|
1876
|
+
}
|
|
1877
|
+
return writer;
|
|
1878
|
+
},
|
|
1879
|
+
|
|
1880
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Signature {
|
|
1881
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
1882
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1883
|
+
const message = createBaseSignature() as any;
|
|
1884
|
+
while (reader.pos < end) {
|
|
1885
|
+
const tag = reader.uint32();
|
|
1886
|
+
switch (tag >>> 3) {
|
|
1887
|
+
case 1:
|
|
1888
|
+
if (tag !== 10) {
|
|
1889
|
+
break;
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
message.r = U256.decode(reader, reader.uint32());
|
|
1893
|
+
continue;
|
|
1894
|
+
case 2:
|
|
1895
|
+
if (tag !== 18) {
|
|
1896
|
+
break;
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
message.s = U256.decode(reader, reader.uint32());
|
|
1900
|
+
continue;
|
|
1901
|
+
case 3:
|
|
1902
|
+
if (tag !== 26) {
|
|
1903
|
+
break;
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
message.v = U256.decode(reader, reader.uint32());
|
|
1907
|
+
continue;
|
|
1908
|
+
case 4:
|
|
1909
|
+
if (tag !== 32) {
|
|
1910
|
+
break;
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
message.yParity = reader.bool();
|
|
1914
|
+
continue;
|
|
1915
|
+
}
|
|
1916
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1917
|
+
break;
|
|
1918
|
+
}
|
|
1919
|
+
reader.skipType(tag & 7);
|
|
1920
|
+
}
|
|
1921
|
+
return message;
|
|
1922
|
+
},
|
|
1923
|
+
|
|
1924
|
+
fromJSON(object: any): Signature {
|
|
1925
|
+
return {
|
|
1926
|
+
r: isSet(object.r) ? U256.fromJSON(object.r) : undefined,
|
|
1927
|
+
s: isSet(object.s) ? U256.fromJSON(object.s) : undefined,
|
|
1928
|
+
v: isSet(object.v) ? U256.fromJSON(object.v) : undefined,
|
|
1929
|
+
yParity: isSet(object.yParity) ? globalThis.Boolean(object.yParity) : false,
|
|
1930
|
+
};
|
|
1931
|
+
},
|
|
1932
|
+
|
|
1933
|
+
toJSON(message: Signature): unknown {
|
|
1934
|
+
const obj: any = {};
|
|
1935
|
+
if (message.r !== undefined) {
|
|
1936
|
+
obj.r = U256.toJSON(message.r);
|
|
1937
|
+
}
|
|
1938
|
+
if (message.s !== undefined) {
|
|
1939
|
+
obj.s = U256.toJSON(message.s);
|
|
1940
|
+
}
|
|
1941
|
+
if (message.v !== undefined) {
|
|
1942
|
+
obj.v = U256.toJSON(message.v);
|
|
1943
|
+
}
|
|
1944
|
+
if (message.yParity !== undefined && message.yParity !== false) {
|
|
1945
|
+
obj.yParity = message.yParity;
|
|
1946
|
+
}
|
|
1947
|
+
return obj;
|
|
1948
|
+
},
|
|
1949
|
+
|
|
1950
|
+
create(base?: DeepPartial<Signature>): Signature {
|
|
1951
|
+
return Signature.fromPartial(base ?? {});
|
|
1952
|
+
},
|
|
1953
|
+
fromPartial(object: DeepPartial<Signature>): Signature {
|
|
1954
|
+
const message = createBaseSignature() as any;
|
|
1955
|
+
message.r = (object.r !== undefined && object.r !== null) ? U256.fromPartial(object.r) : undefined;
|
|
1956
|
+
message.s = (object.s !== undefined && object.s !== null) ? U256.fromPartial(object.s) : undefined;
|
|
1957
|
+
message.v = (object.v !== undefined && object.v !== null) ? U256.fromPartial(object.v) : undefined;
|
|
1958
|
+
message.yParity = object.yParity ?? false;
|
|
1959
|
+
return message;
|
|
1960
|
+
},
|
|
1961
|
+
};
|
|
1962
|
+
|
|
1963
|
+
function createBaseAccessListItem(): AccessListItem {
|
|
1964
|
+
return { address: undefined, storageKeys: [] };
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
export const AccessListItem = {
|
|
1968
|
+
encode(message: AccessListItem, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
1969
|
+
if (message.address !== undefined) {
|
|
1970
|
+
Address.encode(message.address, writer.uint32(10).fork()).ldelim();
|
|
1971
|
+
}
|
|
1972
|
+
if (message.storageKeys !== undefined && message.storageKeys.length !== 0) {
|
|
1973
|
+
for (const v of message.storageKeys) {
|
|
1974
|
+
B256.encode(v!, writer.uint32(18).fork()).ldelim();
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
return writer;
|
|
1978
|
+
},
|
|
1979
|
+
|
|
1980
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): AccessListItem {
|
|
1981
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
1982
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1983
|
+
const message = createBaseAccessListItem() as any;
|
|
1984
|
+
while (reader.pos < end) {
|
|
1985
|
+
const tag = reader.uint32();
|
|
1986
|
+
switch (tag >>> 3) {
|
|
1987
|
+
case 1:
|
|
1988
|
+
if (tag !== 10) {
|
|
1989
|
+
break;
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
message.address = Address.decode(reader, reader.uint32());
|
|
1993
|
+
continue;
|
|
1994
|
+
case 2:
|
|
1995
|
+
if (tag !== 18) {
|
|
1996
|
+
break;
|
|
1997
|
+
}
|
|
1998
|
+
|
|
1999
|
+
message.storageKeys!.push(B256.decode(reader, reader.uint32()));
|
|
2000
|
+
continue;
|
|
2001
|
+
}
|
|
2002
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
2003
|
+
break;
|
|
2004
|
+
}
|
|
2005
|
+
reader.skipType(tag & 7);
|
|
2006
|
+
}
|
|
2007
|
+
return message;
|
|
2008
|
+
},
|
|
2009
|
+
|
|
2010
|
+
fromJSON(object: any): AccessListItem {
|
|
2011
|
+
return {
|
|
2012
|
+
address: isSet(object.address) ? Address.fromJSON(object.address) : undefined,
|
|
2013
|
+
storageKeys: globalThis.Array.isArray(object?.storageKeys)
|
|
2014
|
+
? object.storageKeys.map((e: any) => B256.fromJSON(e))
|
|
2015
|
+
: [],
|
|
2016
|
+
};
|
|
2017
|
+
},
|
|
2018
|
+
|
|
2019
|
+
toJSON(message: AccessListItem): unknown {
|
|
2020
|
+
const obj: any = {};
|
|
2021
|
+
if (message.address !== undefined) {
|
|
2022
|
+
obj.address = Address.toJSON(message.address);
|
|
2023
|
+
}
|
|
2024
|
+
if (message.storageKeys?.length) {
|
|
2025
|
+
obj.storageKeys = message.storageKeys.map((e) => B256.toJSON(e));
|
|
2026
|
+
}
|
|
2027
|
+
return obj;
|
|
2028
|
+
},
|
|
2029
|
+
|
|
2030
|
+
create(base?: DeepPartial<AccessListItem>): AccessListItem {
|
|
2031
|
+
return AccessListItem.fromPartial(base ?? {});
|
|
2032
|
+
},
|
|
2033
|
+
fromPartial(object: DeepPartial<AccessListItem>): AccessListItem {
|
|
2034
|
+
const message = createBaseAccessListItem() as any;
|
|
2035
|
+
message.address = (object.address !== undefined && object.address !== null)
|
|
2036
|
+
? Address.fromPartial(object.address)
|
|
2037
|
+
: undefined;
|
|
2038
|
+
message.storageKeys = object.storageKeys?.map((e) => B256.fromPartial(e)) || [];
|
|
2039
|
+
return message;
|
|
2040
|
+
},
|
|
2041
|
+
};
|
|
2042
|
+
|
|
2043
|
+
function bytesFromBase64(b64: string): Uint8Array {
|
|
2044
|
+
if ((globalThis as any).Buffer) {
|
|
2045
|
+
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
2046
|
+
} else {
|
|
2047
|
+
const bin = globalThis.atob(b64);
|
|
2048
|
+
const arr = new Uint8Array(bin.length);
|
|
2049
|
+
for (let i = 0; i < bin.length; ++i) {
|
|
2050
|
+
arr[i] = bin.charCodeAt(i);
|
|
2051
|
+
}
|
|
2052
|
+
return arr;
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
function base64FromBytes(arr: Uint8Array): string {
|
|
2057
|
+
if ((globalThis as any).Buffer) {
|
|
2058
|
+
return globalThis.Buffer.from(arr).toString("base64");
|
|
2059
|
+
} else {
|
|
2060
|
+
const bin: string[] = [];
|
|
2061
|
+
arr.forEach((byte) => {
|
|
2062
|
+
bin.push(globalThis.String.fromCharCode(byte));
|
|
2063
|
+
});
|
|
2064
|
+
return globalThis.btoa(bin.join(""));
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2068
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
|
|
2069
|
+
|
|
2070
|
+
export type DeepPartial<T> = T extends Builtin ? T
|
|
2071
|
+
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
|
2072
|
+
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
|
2073
|
+
: T extends { readonly $case: string }
|
|
2074
|
+
? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { readonly $case: T["$case"] }
|
|
2075
|
+
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
2076
|
+
: Partial<T>;
|
|
2077
|
+
|
|
2078
|
+
function toTimestamp(date: Date): Timestamp {
|
|
2079
|
+
const seconds = BigInt(Math.trunc(date.getTime() / 1_000));
|
|
2080
|
+
const nanos = (date.getTime() % 1_000) * 1_000_000;
|
|
2081
|
+
return { seconds, nanos };
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
function fromTimestamp(t: Timestamp): Date {
|
|
2085
|
+
let millis = (globalThis.Number(t.seconds?.toString()) || 0) * 1_000;
|
|
2086
|
+
millis += (t.nanos || 0) / 1_000_000;
|
|
2087
|
+
return new globalThis.Date(millis);
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
function fromJsonTimestamp(o: any): Date {
|
|
2091
|
+
if (o instanceof globalThis.Date) {
|
|
2092
|
+
return o;
|
|
2093
|
+
} else if (typeof o === "string") {
|
|
2094
|
+
return new globalThis.Date(o);
|
|
2095
|
+
} else {
|
|
2096
|
+
return fromTimestamp(Timestamp.fromJSON(o));
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
|
|
2100
|
+
function longToBigint(long: Long) {
|
|
2101
|
+
return BigInt(long.toString());
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
if (_m0.util.Long !== Long) {
|
|
2105
|
+
_m0.util.Long = Long as any;
|
|
2106
|
+
_m0.configure();
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
function isSet(value: any): boolean {
|
|
2110
|
+
return value !== null && value !== undefined;
|
|
2111
|
+
}
|