@apibara/evm 2.1.0-beta.4 → 2.1.0-beta.40

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/src/proto/data.ts CHANGED
@@ -53,6 +53,147 @@ export function transactionStatusToJSON(object: TransactionStatus): string {
53
53
  }
54
54
  }
55
55
 
56
+ export enum CallType {
57
+ UNSPECIFIED = 0,
58
+ CALL = 1,
59
+ CALL_CODE = 2,
60
+ DELEGATE_CALL = 3,
61
+ STATIC_CALL = 4,
62
+ AUTH_CALL = 5,
63
+ UNRECOGNIZED = -1,
64
+ }
65
+
66
+ export function callTypeFromJSON(object: any): CallType {
67
+ switch (object) {
68
+ case 0:
69
+ case "CALL_TYPE_UNSPECIFIED":
70
+ return CallType.UNSPECIFIED;
71
+ case 1:
72
+ case "CALL_TYPE_CALL":
73
+ return CallType.CALL;
74
+ case 2:
75
+ case "CALL_TYPE_CALL_CODE":
76
+ return CallType.CALL_CODE;
77
+ case 3:
78
+ case "CALL_TYPE_DELEGATE_CALL":
79
+ return CallType.DELEGATE_CALL;
80
+ case 4:
81
+ case "CALL_TYPE_STATIC_CALL":
82
+ return CallType.STATIC_CALL;
83
+ case 5:
84
+ case "CALL_TYPE_AUTH_CALL":
85
+ return CallType.AUTH_CALL;
86
+ case -1:
87
+ case "UNRECOGNIZED":
88
+ default:
89
+ return CallType.UNRECOGNIZED;
90
+ }
91
+ }
92
+
93
+ export function callTypeToJSON(object: CallType): string {
94
+ switch (object) {
95
+ case CallType.UNSPECIFIED:
96
+ return "CALL_TYPE_UNSPECIFIED";
97
+ case CallType.CALL:
98
+ return "CALL_TYPE_CALL";
99
+ case CallType.CALL_CODE:
100
+ return "CALL_TYPE_CALL_CODE";
101
+ case CallType.DELEGATE_CALL:
102
+ return "CALL_TYPE_DELEGATE_CALL";
103
+ case CallType.STATIC_CALL:
104
+ return "CALL_TYPE_STATIC_CALL";
105
+ case CallType.AUTH_CALL:
106
+ return "CALL_TYPE_AUTH_CALL";
107
+ case CallType.UNRECOGNIZED:
108
+ default:
109
+ return "UNRECOGNIZED";
110
+ }
111
+ }
112
+
113
+ export enum CreationMethod {
114
+ UNSPECIFIED = 0,
115
+ CREATE = 1,
116
+ CREATE2 = 2,
117
+ EOF_CREATE = 3,
118
+ UNRECOGNIZED = -1,
119
+ }
120
+
121
+ export function creationMethodFromJSON(object: any): CreationMethod {
122
+ switch (object) {
123
+ case 0:
124
+ case "CREATION_METHOD_UNSPECIFIED":
125
+ return CreationMethod.UNSPECIFIED;
126
+ case 1:
127
+ case "CREATION_METHOD_CREATE":
128
+ return CreationMethod.CREATE;
129
+ case 2:
130
+ case "CREATION_METHOD_CREATE2":
131
+ return CreationMethod.CREATE2;
132
+ case 3:
133
+ case "CREATION_METHOD_EOF_CREATE":
134
+ return CreationMethod.EOF_CREATE;
135
+ case -1:
136
+ case "UNRECOGNIZED":
137
+ default:
138
+ return CreationMethod.UNRECOGNIZED;
139
+ }
140
+ }
141
+
142
+ export function creationMethodToJSON(object: CreationMethod): string {
143
+ switch (object) {
144
+ case CreationMethod.UNSPECIFIED:
145
+ return "CREATION_METHOD_UNSPECIFIED";
146
+ case CreationMethod.CREATE:
147
+ return "CREATION_METHOD_CREATE";
148
+ case CreationMethod.CREATE2:
149
+ return "CREATION_METHOD_CREATE2";
150
+ case CreationMethod.EOF_CREATE:
151
+ return "CREATION_METHOD_EOF_CREATE";
152
+ case CreationMethod.UNRECOGNIZED:
153
+ default:
154
+ return "UNRECOGNIZED";
155
+ }
156
+ }
157
+
158
+ export enum RewardType {
159
+ UNSPECIFIED = 0,
160
+ BLOCK = 1,
161
+ UNCLE = 2,
162
+ UNRECOGNIZED = -1,
163
+ }
164
+
165
+ export function rewardTypeFromJSON(object: any): RewardType {
166
+ switch (object) {
167
+ case 0:
168
+ case "REWARD_TYPE_UNSPECIFIED":
169
+ return RewardType.UNSPECIFIED;
170
+ case 1:
171
+ case "REWARD_TYPE_BLOCK":
172
+ return RewardType.BLOCK;
173
+ case 2:
174
+ case "REWARD_TYPE_UNCLE":
175
+ return RewardType.UNCLE;
176
+ case -1:
177
+ case "UNRECOGNIZED":
178
+ default:
179
+ return RewardType.UNRECOGNIZED;
180
+ }
181
+ }
182
+
183
+ export function rewardTypeToJSON(object: RewardType): string {
184
+ switch (object) {
185
+ case RewardType.UNSPECIFIED:
186
+ return "REWARD_TYPE_UNSPECIFIED";
187
+ case RewardType.BLOCK:
188
+ return "REWARD_TYPE_BLOCK";
189
+ case RewardType.UNCLE:
190
+ return "REWARD_TYPE_UNCLE";
191
+ case RewardType.UNRECOGNIZED:
192
+ default:
193
+ return "UNRECOGNIZED";
194
+ }
195
+ }
196
+
56
197
  /** Requested data, grouped by block. */
57
198
  export interface Block {
58
199
  /** The header. */
@@ -72,7 +213,11 @@ export interface Block {
72
213
  | readonly TransactionReceipt[]
73
214
  | undefined;
74
215
  /** List of logs. */
75
- readonly logs?: readonly Log[] | undefined;
216
+ readonly logs?:
217
+ | readonly Log[]
218
+ | undefined;
219
+ /** List of transaction traces. */
220
+ readonly traces?: readonly TransactionTrace[] | undefined;
76
221
  }
77
222
 
78
223
  /** Block header. */
@@ -162,7 +307,14 @@ export interface BlockHeader {
162
307
  | U128
163
308
  | undefined;
164
309
  /** Parent beacon block root. */
165
- readonly parentBeaconBlockRoot?: B256 | undefined;
310
+ readonly parentBeaconBlockRoot?:
311
+ | B256
312
+ | undefined;
313
+ /**
314
+ * The Keccak 256-bit hash of the an RLP encoded list with each EIP-7685
315
+ * request in the block body.
316
+ */
317
+ readonly requestsHash?: B256 | undefined;
166
318
  }
167
319
 
168
320
  /** A validator's withdrawal from the consensus layer. */
@@ -384,8 +536,139 @@ export interface AccessListItem {
384
536
  readonly storageKeys?: readonly B256[] | undefined;
385
537
  }
386
538
 
539
+ export interface TransactionTrace {
540
+ readonly filterIds?:
541
+ | readonly number[]
542
+ | undefined;
543
+ /** Index of the transaction in the block. */
544
+ readonly transactionIndex?:
545
+ | number
546
+ | undefined;
547
+ /** Transaction hash. */
548
+ readonly transactionHash?:
549
+ | B256
550
+ | undefined;
551
+ /** Traces. */
552
+ readonly traces?: readonly Trace[] | undefined;
553
+ }
554
+
555
+ export interface Trace {
556
+ readonly action?:
557
+ | { readonly $case: "call"; readonly call: CallAction }
558
+ | { readonly $case: "create"; readonly create: CreateAction }
559
+ | { readonly $case: "selfDestruct"; readonly selfDestruct: SelfDestructAction }
560
+ | { readonly $case: "reward"; readonly reward: RewardAction }
561
+ | undefined;
562
+ /** Error message if the transaction failed. */
563
+ readonly error?: string | undefined;
564
+ readonly output?:
565
+ | { readonly $case: "callOutput"; readonly callOutput: CallOutput }
566
+ | { readonly $case: "createOutput"; readonly createOutput: CreateOutput }
567
+ | undefined;
568
+ /** Number of sub traces. */
569
+ readonly subtraces?:
570
+ | number
571
+ | undefined;
572
+ /** The identifier of this trace in the trace tree. */
573
+ readonly traceAddress?: readonly number[] | undefined;
574
+ }
575
+
576
+ export interface CallAction {
577
+ /** Address of the sending account. */
578
+ readonly fromAddress?:
579
+ | Address
580
+ | undefined;
581
+ /** Call type. */
582
+ readonly type?:
583
+ | CallType
584
+ | undefined;
585
+ /** The gas available to execute the call. */
586
+ readonly gas?:
587
+ | bigint
588
+ | undefined;
589
+ /** Input data provided by the call. */
590
+ readonly input?:
591
+ | Uint8Array
592
+ | undefined;
593
+ /** Target of the destination address. */
594
+ readonly toAddress?:
595
+ | Address
596
+ | undefined;
597
+ /** Value transferred to the destination account. */
598
+ readonly value?: U256 | undefined;
599
+ }
600
+
601
+ export interface CreateAction {
602
+ /** Address of the sending account. */
603
+ readonly fromAddress?:
604
+ | Address
605
+ | undefined;
606
+ /** The gas available to execute the call. */
607
+ readonly gas?:
608
+ | bigint
609
+ | undefined;
610
+ /** Input data provided by the call. */
611
+ readonly init?:
612
+ | Uint8Array
613
+ | undefined;
614
+ /** Value transferred to the ne account. */
615
+ readonly value?:
616
+ | U256
617
+ | undefined;
618
+ /** Contract creation method. */
619
+ readonly creationMethod?: CreationMethod | undefined;
620
+ }
621
+
622
+ export interface SelfDestructAction {
623
+ /** The destroyed address. */
624
+ readonly address?:
625
+ | Address
626
+ | undefined;
627
+ /** Balance of the destroyed account before destruct. */
628
+ readonly balance?:
629
+ | U256
630
+ | undefined;
631
+ /** The heir address. */
632
+ readonly refundAddress?: Address | undefined;
633
+ }
634
+
635
+ export interface RewardAction {
636
+ /** The author's address. */
637
+ readonly author?:
638
+ | Address
639
+ | undefined;
640
+ /** Reward type. */
641
+ readonly type?:
642
+ | RewardType
643
+ | undefined;
644
+ /** The reward's value. */
645
+ readonly value?: U256 | undefined;
646
+ }
647
+
648
+ export interface CallOutput {
649
+ /** Gas used. */
650
+ readonly gasUsed?:
651
+ | bigint
652
+ | undefined;
653
+ /** Output data. */
654
+ readonly output?: Uint8Array | undefined;
655
+ }
656
+
657
+ export interface CreateOutput {
658
+ /** Contract address. */
659
+ readonly address?:
660
+ | Address
661
+ | undefined;
662
+ /** Code */
663
+ readonly code?:
664
+ | Uint8Array
665
+ | undefined;
666
+ /** Gas used. */
667
+ readonly gasUsed?: bigint | undefined;
668
+ }
669
+
387
670
  function createBaseBlock(): Block {
388
- return { header: undefined, withdrawals: [], transactions: [], receipts: [], logs: [] };
671
+ return { header: undefined, withdrawals: [], transactions: [], receipts: [], logs: [], traces: [] };
389
672
  }
390
673
 
391
674
  export const Block = {
@@ -413,6 +696,11 @@ export const Block = {
413
696
  Log.encode(v!, writer.uint32(42).fork()).ldelim();
414
697
  }
415
698
  }
699
+ if (message.traces !== undefined && message.traces.length !== 0) {
700
+ for (const v of message.traces) {
701
+ TransactionTrace.encode(v!, writer.uint32(50).fork()).ldelim();
702
+ }
703
+ }
416
704
  return writer;
417
705
  },
418
706
 
@@ -458,6 +746,13 @@ export const Block = {
458
746
 
459
747
  message.logs!.push(Log.decode(reader, reader.uint32()));
460
748
  continue;
749
+ case 6:
750
+ if (tag !== 50) {
751
+ break;
752
+ }
753
+
754
+ message.traces!.push(TransactionTrace.decode(reader, reader.uint32()));
755
+ continue;
461
756
  }
462
757
  if ((tag & 7) === 4 || tag === 0) {
463
758
  break;
@@ -480,6 +775,9 @@ export const Block = {
480
775
  ? object.receipts.map((e: any) => TransactionReceipt.fromJSON(e))
481
776
  : [],
482
777
  logs: globalThis.Array.isArray(object?.logs) ? object.logs.map((e: any) => Log.fromJSON(e)) : [],
778
+ traces: globalThis.Array.isArray(object?.traces)
779
+ ? object.traces.map((e: any) => TransactionTrace.fromJSON(e))
780
+ : [],
483
781
  };
484
782
  },
485
783
 
@@ -500,6 +798,9 @@ export const Block = {
500
798
  if (message.logs?.length) {
501
799
  obj.logs = message.logs.map((e) => Log.toJSON(e));
502
800
  }
801
+ if (message.traces?.length) {
802
+ obj.traces = message.traces.map((e) => TransactionTrace.toJSON(e));
803
+ }
503
804
  return obj;
504
805
  },
505
806
 
@@ -515,6 +816,7 @@ export const Block = {
515
816
  message.transactions = object.transactions?.map((e) => Transaction.fromPartial(e)) || [];
516
817
  message.receipts = object.receipts?.map((e) => TransactionReceipt.fromPartial(e)) || [];
517
818
  message.logs = object.logs?.map((e) => Log.fromPartial(e)) || [];
819
+ message.traces = object.traces?.map((e) => TransactionTrace.fromPartial(e)) || [];
518
820
  return message;
519
821
  },
520
822
  };
@@ -543,6 +845,7 @@ function createBaseBlockHeader(): BlockHeader {
543
845
  blobGasUsed: undefined,
544
846
  excessBlobGas: undefined,
545
847
  parentBeaconBlockRoot: undefined,
848
+ requestsHash: undefined,
546
849
  };
547
850
  }
548
851
 
@@ -620,6 +923,9 @@ export const BlockHeader = {
620
923
  if (message.parentBeaconBlockRoot !== undefined) {
621
924
  B256.encode(message.parentBeaconBlockRoot, writer.uint32(178).fork()).ldelim();
622
925
  }
926
+ if (message.requestsHash !== undefined) {
927
+ B256.encode(message.requestsHash, writer.uint32(186).fork()).ldelim();
928
+ }
623
929
  return writer;
624
930
  },
625
931
 
@@ -784,6 +1090,13 @@ export const BlockHeader = {
784
1090
 
785
1091
  message.parentBeaconBlockRoot = B256.decode(reader, reader.uint32());
786
1092
  continue;
1093
+ case 23:
1094
+ if (tag !== 186) {
1095
+ break;
1096
+ }
1097
+
1098
+ message.requestsHash = B256.decode(reader, reader.uint32());
1099
+ continue;
787
1100
  }
788
1101
  if ((tag & 7) === 4 || tag === 0) {
789
1102
  break;
@@ -819,6 +1132,7 @@ export const BlockHeader = {
819
1132
  parentBeaconBlockRoot: isSet(object.parentBeaconBlockRoot)
820
1133
  ? B256.fromJSON(object.parentBeaconBlockRoot)
821
1134
  : undefined,
1135
+ requestsHash: isSet(object.requestsHash) ? B256.fromJSON(object.requestsHash) : undefined,
822
1136
  };
823
1137
  },
824
1138
 
@@ -890,6 +1204,9 @@ export const BlockHeader = {
890
1204
  if (message.parentBeaconBlockRoot !== undefined) {
891
1205
  obj.parentBeaconBlockRoot = B256.toJSON(message.parentBeaconBlockRoot);
892
1206
  }
1207
+ if (message.requestsHash !== undefined) {
1208
+ obj.requestsHash = B256.toJSON(message.requestsHash);
1209
+ }
893
1210
  return obj;
894
1211
  },
895
1212
 
@@ -957,6 +1274,9 @@ export const BlockHeader = {
957
1274
  (object.parentBeaconBlockRoot !== undefined && object.parentBeaconBlockRoot !== null)
958
1275
  ? B256.fromPartial(object.parentBeaconBlockRoot)
959
1276
  : undefined;
1277
+ message.requestsHash = (object.requestsHash !== undefined && object.requestsHash !== null)
1278
+ ? B256.fromPartial(object.requestsHash)
1279
+ : undefined;
960
1280
  return message;
961
1281
  },
962
1282
  };
@@ -2219,6 +2539,993 @@ export const AccessListItem = {
2219
2539
  },
2220
2540
  };
2221
2541
 
2542
+ function createBaseTransactionTrace(): TransactionTrace {
2543
+ return { filterIds: [], transactionIndex: 0, transactionHash: undefined, traces: [] };
2544
+ }
2545
+
2546
+ export const TransactionTrace = {
2547
+ encode(message: TransactionTrace, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
2548
+ if (message.filterIds !== undefined && message.filterIds.length !== 0) {
2549
+ writer.uint32(10).fork();
2550
+ for (const v of message.filterIds) {
2551
+ writer.uint32(v);
2552
+ }
2553
+ writer.ldelim();
2554
+ }
2555
+ if (message.transactionIndex !== undefined && message.transactionIndex !== 0) {
2556
+ writer.uint32(16).uint32(message.transactionIndex);
2557
+ }
2558
+ if (message.transactionHash !== undefined) {
2559
+ B256.encode(message.transactionHash, writer.uint32(26).fork()).ldelim();
2560
+ }
2561
+ if (message.traces !== undefined && message.traces.length !== 0) {
2562
+ for (const v of message.traces) {
2563
+ Trace.encode(v!, writer.uint32(34).fork()).ldelim();
2564
+ }
2565
+ }
2566
+ return writer;
2567
+ },
2568
+
2569
+ decode(input: _m0.Reader | Uint8Array, length?: number): TransactionTrace {
2570
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
2571
+ let end = length === undefined ? reader.len : reader.pos + length;
2572
+ const message = createBaseTransactionTrace() as any;
2573
+ while (reader.pos < end) {
2574
+ const tag = reader.uint32();
2575
+ switch (tag >>> 3) {
2576
+ case 1:
2577
+ if (tag === 8) {
2578
+ message.filterIds!.push(reader.uint32());
2579
+
2580
+ continue;
2581
+ }
2582
+
2583
+ if (tag === 10) {
2584
+ const end2 = reader.uint32() + reader.pos;
2585
+ while (reader.pos < end2) {
2586
+ message.filterIds!.push(reader.uint32());
2587
+ }
2588
+
2589
+ continue;
2590
+ }
2591
+
2592
+ break;
2593
+ case 2:
2594
+ if (tag !== 16) {
2595
+ break;
2596
+ }
2597
+
2598
+ message.transactionIndex = reader.uint32();
2599
+ continue;
2600
+ case 3:
2601
+ if (tag !== 26) {
2602
+ break;
2603
+ }
2604
+
2605
+ message.transactionHash = B256.decode(reader, reader.uint32());
2606
+ continue;
2607
+ case 4:
2608
+ if (tag !== 34) {
2609
+ break;
2610
+ }
2611
+
2612
+ message.traces!.push(Trace.decode(reader, reader.uint32()));
2613
+ continue;
2614
+ }
2615
+ if ((tag & 7) === 4 || tag === 0) {
2616
+ break;
2617
+ }
2618
+ reader.skipType(tag & 7);
2619
+ }
2620
+ return message;
2621
+ },
2622
+
2623
+ fromJSON(object: any): TransactionTrace {
2624
+ return {
2625
+ filterIds: globalThis.Array.isArray(object?.filterIds)
2626
+ ? object.filterIds.map((e: any) => globalThis.Number(e))
2627
+ : [],
2628
+ transactionIndex: isSet(object.transactionIndex) ? globalThis.Number(object.transactionIndex) : 0,
2629
+ transactionHash: isSet(object.transactionHash) ? B256.fromJSON(object.transactionHash) : undefined,
2630
+ traces: globalThis.Array.isArray(object?.traces) ? object.traces.map((e: any) => Trace.fromJSON(e)) : [],
2631
+ };
2632
+ },
2633
+
2634
+ toJSON(message: TransactionTrace): unknown {
2635
+ const obj: any = {};
2636
+ if (message.filterIds?.length) {
2637
+ obj.filterIds = message.filterIds.map((e) => Math.round(e));
2638
+ }
2639
+ if (message.transactionIndex !== undefined && message.transactionIndex !== 0) {
2640
+ obj.transactionIndex = Math.round(message.transactionIndex);
2641
+ }
2642
+ if (message.transactionHash !== undefined) {
2643
+ obj.transactionHash = B256.toJSON(message.transactionHash);
2644
+ }
2645
+ if (message.traces?.length) {
2646
+ obj.traces = message.traces.map((e) => Trace.toJSON(e));
2647
+ }
2648
+ return obj;
2649
+ },
2650
+
2651
+ create(base?: DeepPartial<TransactionTrace>): TransactionTrace {
2652
+ return TransactionTrace.fromPartial(base ?? {});
2653
+ },
2654
+ fromPartial(object: DeepPartial<TransactionTrace>): TransactionTrace {
2655
+ const message = createBaseTransactionTrace() as any;
2656
+ message.filterIds = object.filterIds?.map((e) => e) || [];
2657
+ message.transactionIndex = object.transactionIndex ?? 0;
2658
+ message.transactionHash = (object.transactionHash !== undefined && object.transactionHash !== null)
2659
+ ? B256.fromPartial(object.transactionHash)
2660
+ : undefined;
2661
+ message.traces = object.traces?.map((e) => Trace.fromPartial(e)) || [];
2662
+ return message;
2663
+ },
2664
+ };
2665
+
2666
+ function createBaseTrace(): Trace {
2667
+ return { action: undefined, error: undefined, output: undefined, subtraces: 0, traceAddress: [] };
2668
+ }
2669
+
2670
+ export const Trace = {
2671
+ encode(message: Trace, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
2672
+ switch (message.action?.$case) {
2673
+ case "call":
2674
+ CallAction.encode(message.action.call, writer.uint32(10).fork()).ldelim();
2675
+ break;
2676
+ case "create":
2677
+ CreateAction.encode(message.action.create, writer.uint32(18).fork()).ldelim();
2678
+ break;
2679
+ case "selfDestruct":
2680
+ SelfDestructAction.encode(message.action.selfDestruct, writer.uint32(26).fork()).ldelim();
2681
+ break;
2682
+ case "reward":
2683
+ RewardAction.encode(message.action.reward, writer.uint32(34).fork()).ldelim();
2684
+ break;
2685
+ }
2686
+ if (message.error !== undefined) {
2687
+ writer.uint32(42).string(message.error);
2688
+ }
2689
+ switch (message.output?.$case) {
2690
+ case "callOutput":
2691
+ CallOutput.encode(message.output.callOutput, writer.uint32(50).fork()).ldelim();
2692
+ break;
2693
+ case "createOutput":
2694
+ CreateOutput.encode(message.output.createOutput, writer.uint32(58).fork()).ldelim();
2695
+ break;
2696
+ }
2697
+ if (message.subtraces !== undefined && message.subtraces !== 0) {
2698
+ writer.uint32(64).uint32(message.subtraces);
2699
+ }
2700
+ if (message.traceAddress !== undefined && message.traceAddress.length !== 0) {
2701
+ writer.uint32(74).fork();
2702
+ for (const v of message.traceAddress) {
2703
+ writer.uint32(v);
2704
+ }
2705
+ writer.ldelim();
2706
+ }
2707
+ return writer;
2708
+ },
2709
+
2710
+ decode(input: _m0.Reader | Uint8Array, length?: number): Trace {
2711
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
2712
+ let end = length === undefined ? reader.len : reader.pos + length;
2713
+ const message = createBaseTrace() as any;
2714
+ while (reader.pos < end) {
2715
+ const tag = reader.uint32();
2716
+ switch (tag >>> 3) {
2717
+ case 1:
2718
+ if (tag !== 10) {
2719
+ break;
2720
+ }
2721
+
2722
+ message.action = { $case: "call", call: CallAction.decode(reader, reader.uint32()) };
2723
+ continue;
2724
+ case 2:
2725
+ if (tag !== 18) {
2726
+ break;
2727
+ }
2728
+
2729
+ message.action = { $case: "create", create: CreateAction.decode(reader, reader.uint32()) };
2730
+ continue;
2731
+ case 3:
2732
+ if (tag !== 26) {
2733
+ break;
2734
+ }
2735
+
2736
+ message.action = { $case: "selfDestruct", selfDestruct: SelfDestructAction.decode(reader, reader.uint32()) };
2737
+ continue;
2738
+ case 4:
2739
+ if (tag !== 34) {
2740
+ break;
2741
+ }
2742
+
2743
+ message.action = { $case: "reward", reward: RewardAction.decode(reader, reader.uint32()) };
2744
+ continue;
2745
+ case 5:
2746
+ if (tag !== 42) {
2747
+ break;
2748
+ }
2749
+
2750
+ message.error = reader.string();
2751
+ continue;
2752
+ case 6:
2753
+ if (tag !== 50) {
2754
+ break;
2755
+ }
2756
+
2757
+ message.output = { $case: "callOutput", callOutput: CallOutput.decode(reader, reader.uint32()) };
2758
+ continue;
2759
+ case 7:
2760
+ if (tag !== 58) {
2761
+ break;
2762
+ }
2763
+
2764
+ message.output = { $case: "createOutput", createOutput: CreateOutput.decode(reader, reader.uint32()) };
2765
+ continue;
2766
+ case 8:
2767
+ if (tag !== 64) {
2768
+ break;
2769
+ }
2770
+
2771
+ message.subtraces = reader.uint32();
2772
+ continue;
2773
+ case 9:
2774
+ if (tag === 72) {
2775
+ message.traceAddress!.push(reader.uint32());
2776
+
2777
+ continue;
2778
+ }
2779
+
2780
+ if (tag === 74) {
2781
+ const end2 = reader.uint32() + reader.pos;
2782
+ while (reader.pos < end2) {
2783
+ message.traceAddress!.push(reader.uint32());
2784
+ }
2785
+
2786
+ continue;
2787
+ }
2788
+
2789
+ break;
2790
+ }
2791
+ if ((tag & 7) === 4 || tag === 0) {
2792
+ break;
2793
+ }
2794
+ reader.skipType(tag & 7);
2795
+ }
2796
+ return message;
2797
+ },
2798
+
2799
+ fromJSON(object: any): Trace {
2800
+ return {
2801
+ action: isSet(object.call)
2802
+ ? { $case: "call", call: CallAction.fromJSON(object.call) }
2803
+ : isSet(object.create)
2804
+ ? { $case: "create", create: CreateAction.fromJSON(object.create) }
2805
+ : isSet(object.selfDestruct)
2806
+ ? { $case: "selfDestruct", selfDestruct: SelfDestructAction.fromJSON(object.selfDestruct) }
2807
+ : isSet(object.reward)
2808
+ ? { $case: "reward", reward: RewardAction.fromJSON(object.reward) }
2809
+ : undefined,
2810
+ error: isSet(object.error) ? globalThis.String(object.error) : undefined,
2811
+ output: isSet(object.callOutput)
2812
+ ? { $case: "callOutput", callOutput: CallOutput.fromJSON(object.callOutput) }
2813
+ : isSet(object.createOutput)
2814
+ ? { $case: "createOutput", createOutput: CreateOutput.fromJSON(object.createOutput) }
2815
+ : undefined,
2816
+ subtraces: isSet(object.subtraces) ? globalThis.Number(object.subtraces) : 0,
2817
+ traceAddress: globalThis.Array.isArray(object?.traceAddress)
2818
+ ? object.traceAddress.map((e: any) => globalThis.Number(e))
2819
+ : [],
2820
+ };
2821
+ },
2822
+
2823
+ toJSON(message: Trace): unknown {
2824
+ const obj: any = {};
2825
+ if (message.action?.$case === "call") {
2826
+ obj.call = CallAction.toJSON(message.action.call);
2827
+ }
2828
+ if (message.action?.$case === "create") {
2829
+ obj.create = CreateAction.toJSON(message.action.create);
2830
+ }
2831
+ if (message.action?.$case === "selfDestruct") {
2832
+ obj.selfDestruct = SelfDestructAction.toJSON(message.action.selfDestruct);
2833
+ }
2834
+ if (message.action?.$case === "reward") {
2835
+ obj.reward = RewardAction.toJSON(message.action.reward);
2836
+ }
2837
+ if (message.error !== undefined) {
2838
+ obj.error = message.error;
2839
+ }
2840
+ if (message.output?.$case === "callOutput") {
2841
+ obj.callOutput = CallOutput.toJSON(message.output.callOutput);
2842
+ }
2843
+ if (message.output?.$case === "createOutput") {
2844
+ obj.createOutput = CreateOutput.toJSON(message.output.createOutput);
2845
+ }
2846
+ if (message.subtraces !== undefined && message.subtraces !== 0) {
2847
+ obj.subtraces = Math.round(message.subtraces);
2848
+ }
2849
+ if (message.traceAddress?.length) {
2850
+ obj.traceAddress = message.traceAddress.map((e) => Math.round(e));
2851
+ }
2852
+ return obj;
2853
+ },
2854
+
2855
+ create(base?: DeepPartial<Trace>): Trace {
2856
+ return Trace.fromPartial(base ?? {});
2857
+ },
2858
+ fromPartial(object: DeepPartial<Trace>): Trace {
2859
+ const message = createBaseTrace() as any;
2860
+ if (object.action?.$case === "call" && object.action?.call !== undefined && object.action?.call !== null) {
2861
+ message.action = { $case: "call", call: CallAction.fromPartial(object.action.call) };
2862
+ }
2863
+ if (object.action?.$case === "create" && object.action?.create !== undefined && object.action?.create !== null) {
2864
+ message.action = { $case: "create", create: CreateAction.fromPartial(object.action.create) };
2865
+ }
2866
+ if (
2867
+ object.action?.$case === "selfDestruct" &&
2868
+ object.action?.selfDestruct !== undefined &&
2869
+ object.action?.selfDestruct !== null
2870
+ ) {
2871
+ message.action = {
2872
+ $case: "selfDestruct",
2873
+ selfDestruct: SelfDestructAction.fromPartial(object.action.selfDestruct),
2874
+ };
2875
+ }
2876
+ if (object.action?.$case === "reward" && object.action?.reward !== undefined && object.action?.reward !== null) {
2877
+ message.action = { $case: "reward", reward: RewardAction.fromPartial(object.action.reward) };
2878
+ }
2879
+ message.error = object.error ?? undefined;
2880
+ if (
2881
+ object.output?.$case === "callOutput" &&
2882
+ object.output?.callOutput !== undefined &&
2883
+ object.output?.callOutput !== null
2884
+ ) {
2885
+ message.output = { $case: "callOutput", callOutput: CallOutput.fromPartial(object.output.callOutput) };
2886
+ }
2887
+ if (
2888
+ object.output?.$case === "createOutput" &&
2889
+ object.output?.createOutput !== undefined &&
2890
+ object.output?.createOutput !== null
2891
+ ) {
2892
+ message.output = { $case: "createOutput", createOutput: CreateOutput.fromPartial(object.output.createOutput) };
2893
+ }
2894
+ message.subtraces = object.subtraces ?? 0;
2895
+ message.traceAddress = object.traceAddress?.map((e) => e) || [];
2896
+ return message;
2897
+ },
2898
+ };
2899
+
2900
+ function createBaseCallAction(): CallAction {
2901
+ return {
2902
+ fromAddress: undefined,
2903
+ type: 0,
2904
+ gas: BigInt("0"),
2905
+ input: new Uint8Array(0),
2906
+ toAddress: undefined,
2907
+ value: undefined,
2908
+ };
2909
+ }
2910
+
2911
+ export const CallAction = {
2912
+ encode(message: CallAction, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
2913
+ if (message.fromAddress !== undefined) {
2914
+ Address.encode(message.fromAddress, writer.uint32(10).fork()).ldelim();
2915
+ }
2916
+ if (message.type !== undefined && message.type !== 0) {
2917
+ writer.uint32(16).int32(message.type);
2918
+ }
2919
+ if (message.gas !== undefined && message.gas !== BigInt("0")) {
2920
+ if (BigInt.asUintN(64, message.gas) !== message.gas) {
2921
+ throw new globalThis.Error("value provided for field message.gas of type uint64 too large");
2922
+ }
2923
+ writer.uint32(24).uint64(message.gas.toString());
2924
+ }
2925
+ if (message.input !== undefined && message.input.length !== 0) {
2926
+ writer.uint32(34).bytes(message.input);
2927
+ }
2928
+ if (message.toAddress !== undefined) {
2929
+ Address.encode(message.toAddress, writer.uint32(42).fork()).ldelim();
2930
+ }
2931
+ if (message.value !== undefined) {
2932
+ U256.encode(message.value, writer.uint32(50).fork()).ldelim();
2933
+ }
2934
+ return writer;
2935
+ },
2936
+
2937
+ decode(input: _m0.Reader | Uint8Array, length?: number): CallAction {
2938
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
2939
+ let end = length === undefined ? reader.len : reader.pos + length;
2940
+ const message = createBaseCallAction() as any;
2941
+ while (reader.pos < end) {
2942
+ const tag = reader.uint32();
2943
+ switch (tag >>> 3) {
2944
+ case 1:
2945
+ if (tag !== 10) {
2946
+ break;
2947
+ }
2948
+
2949
+ message.fromAddress = Address.decode(reader, reader.uint32());
2950
+ continue;
2951
+ case 2:
2952
+ if (tag !== 16) {
2953
+ break;
2954
+ }
2955
+
2956
+ message.type = reader.int32() as any;
2957
+ continue;
2958
+ case 3:
2959
+ if (tag !== 24) {
2960
+ break;
2961
+ }
2962
+
2963
+ message.gas = longToBigint(reader.uint64() as Long);
2964
+ continue;
2965
+ case 4:
2966
+ if (tag !== 34) {
2967
+ break;
2968
+ }
2969
+
2970
+ message.input = reader.bytes();
2971
+ continue;
2972
+ case 5:
2973
+ if (tag !== 42) {
2974
+ break;
2975
+ }
2976
+
2977
+ message.toAddress = Address.decode(reader, reader.uint32());
2978
+ continue;
2979
+ case 6:
2980
+ if (tag !== 50) {
2981
+ break;
2982
+ }
2983
+
2984
+ message.value = U256.decode(reader, reader.uint32());
2985
+ continue;
2986
+ }
2987
+ if ((tag & 7) === 4 || tag === 0) {
2988
+ break;
2989
+ }
2990
+ reader.skipType(tag & 7);
2991
+ }
2992
+ return message;
2993
+ },
2994
+
2995
+ fromJSON(object: any): CallAction {
2996
+ return {
2997
+ fromAddress: isSet(object.fromAddress) ? Address.fromJSON(object.fromAddress) : undefined,
2998
+ type: isSet(object.type) ? callTypeFromJSON(object.type) : 0,
2999
+ gas: isSet(object.gas) ? BigInt(object.gas) : BigInt("0"),
3000
+ input: isSet(object.input) ? bytesFromBase64(object.input) : new Uint8Array(0),
3001
+ toAddress: isSet(object.toAddress) ? Address.fromJSON(object.toAddress) : undefined,
3002
+ value: isSet(object.value) ? U256.fromJSON(object.value) : undefined,
3003
+ };
3004
+ },
3005
+
3006
+ toJSON(message: CallAction): unknown {
3007
+ const obj: any = {};
3008
+ if (message.fromAddress !== undefined) {
3009
+ obj.fromAddress = Address.toJSON(message.fromAddress);
3010
+ }
3011
+ if (message.type !== undefined && message.type !== 0) {
3012
+ obj.type = callTypeToJSON(message.type);
3013
+ }
3014
+ if (message.gas !== undefined && message.gas !== BigInt("0")) {
3015
+ obj.gas = message.gas.toString();
3016
+ }
3017
+ if (message.input !== undefined && message.input.length !== 0) {
3018
+ obj.input = base64FromBytes(message.input);
3019
+ }
3020
+ if (message.toAddress !== undefined) {
3021
+ obj.toAddress = Address.toJSON(message.toAddress);
3022
+ }
3023
+ if (message.value !== undefined) {
3024
+ obj.value = U256.toJSON(message.value);
3025
+ }
3026
+ return obj;
3027
+ },
3028
+
3029
+ create(base?: DeepPartial<CallAction>): CallAction {
3030
+ return CallAction.fromPartial(base ?? {});
3031
+ },
3032
+ fromPartial(object: DeepPartial<CallAction>): CallAction {
3033
+ const message = createBaseCallAction() as any;
3034
+ message.fromAddress = (object.fromAddress !== undefined && object.fromAddress !== null)
3035
+ ? Address.fromPartial(object.fromAddress)
3036
+ : undefined;
3037
+ message.type = object.type ?? 0;
3038
+ message.gas = object.gas ?? BigInt("0");
3039
+ message.input = object.input ?? new Uint8Array(0);
3040
+ message.toAddress = (object.toAddress !== undefined && object.toAddress !== null)
3041
+ ? Address.fromPartial(object.toAddress)
3042
+ : undefined;
3043
+ message.value = (object.value !== undefined && object.value !== null) ? U256.fromPartial(object.value) : undefined;
3044
+ return message;
3045
+ },
3046
+ };
3047
+
3048
+ function createBaseCreateAction(): CreateAction {
3049
+ return { fromAddress: undefined, gas: BigInt("0"), init: new Uint8Array(0), value: undefined, creationMethod: 0 };
3050
+ }
3051
+
3052
+ export const CreateAction = {
3053
+ encode(message: CreateAction, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
3054
+ if (message.fromAddress !== undefined) {
3055
+ Address.encode(message.fromAddress, writer.uint32(10).fork()).ldelim();
3056
+ }
3057
+ if (message.gas !== undefined && message.gas !== BigInt("0")) {
3058
+ if (BigInt.asUintN(64, message.gas) !== message.gas) {
3059
+ throw new globalThis.Error("value provided for field message.gas of type uint64 too large");
3060
+ }
3061
+ writer.uint32(16).uint64(message.gas.toString());
3062
+ }
3063
+ if (message.init !== undefined && message.init.length !== 0) {
3064
+ writer.uint32(26).bytes(message.init);
3065
+ }
3066
+ if (message.value !== undefined) {
3067
+ U256.encode(message.value, writer.uint32(34).fork()).ldelim();
3068
+ }
3069
+ if (message.creationMethod !== undefined && message.creationMethod !== 0) {
3070
+ writer.uint32(40).int32(message.creationMethod);
3071
+ }
3072
+ return writer;
3073
+ },
3074
+
3075
+ decode(input: _m0.Reader | Uint8Array, length?: number): CreateAction {
3076
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
3077
+ let end = length === undefined ? reader.len : reader.pos + length;
3078
+ const message = createBaseCreateAction() as any;
3079
+ while (reader.pos < end) {
3080
+ const tag = reader.uint32();
3081
+ switch (tag >>> 3) {
3082
+ case 1:
3083
+ if (tag !== 10) {
3084
+ break;
3085
+ }
3086
+
3087
+ message.fromAddress = Address.decode(reader, reader.uint32());
3088
+ continue;
3089
+ case 2:
3090
+ if (tag !== 16) {
3091
+ break;
3092
+ }
3093
+
3094
+ message.gas = longToBigint(reader.uint64() as Long);
3095
+ continue;
3096
+ case 3:
3097
+ if (tag !== 26) {
3098
+ break;
3099
+ }
3100
+
3101
+ message.init = reader.bytes();
3102
+ continue;
3103
+ case 4:
3104
+ if (tag !== 34) {
3105
+ break;
3106
+ }
3107
+
3108
+ message.value = U256.decode(reader, reader.uint32());
3109
+ continue;
3110
+ case 5:
3111
+ if (tag !== 40) {
3112
+ break;
3113
+ }
3114
+
3115
+ message.creationMethod = reader.int32() as any;
3116
+ continue;
3117
+ }
3118
+ if ((tag & 7) === 4 || tag === 0) {
3119
+ break;
3120
+ }
3121
+ reader.skipType(tag & 7);
3122
+ }
3123
+ return message;
3124
+ },
3125
+
3126
+ fromJSON(object: any): CreateAction {
3127
+ return {
3128
+ fromAddress: isSet(object.fromAddress) ? Address.fromJSON(object.fromAddress) : undefined,
3129
+ gas: isSet(object.gas) ? BigInt(object.gas) : BigInt("0"),
3130
+ init: isSet(object.init) ? bytesFromBase64(object.init) : new Uint8Array(0),
3131
+ value: isSet(object.value) ? U256.fromJSON(object.value) : undefined,
3132
+ creationMethod: isSet(object.creationMethod) ? creationMethodFromJSON(object.creationMethod) : 0,
3133
+ };
3134
+ },
3135
+
3136
+ toJSON(message: CreateAction): unknown {
3137
+ const obj: any = {};
3138
+ if (message.fromAddress !== undefined) {
3139
+ obj.fromAddress = Address.toJSON(message.fromAddress);
3140
+ }
3141
+ if (message.gas !== undefined && message.gas !== BigInt("0")) {
3142
+ obj.gas = message.gas.toString();
3143
+ }
3144
+ if (message.init !== undefined && message.init.length !== 0) {
3145
+ obj.init = base64FromBytes(message.init);
3146
+ }
3147
+ if (message.value !== undefined) {
3148
+ obj.value = U256.toJSON(message.value);
3149
+ }
3150
+ if (message.creationMethod !== undefined && message.creationMethod !== 0) {
3151
+ obj.creationMethod = creationMethodToJSON(message.creationMethod);
3152
+ }
3153
+ return obj;
3154
+ },
3155
+
3156
+ create(base?: DeepPartial<CreateAction>): CreateAction {
3157
+ return CreateAction.fromPartial(base ?? {});
3158
+ },
3159
+ fromPartial(object: DeepPartial<CreateAction>): CreateAction {
3160
+ const message = createBaseCreateAction() as any;
3161
+ message.fromAddress = (object.fromAddress !== undefined && object.fromAddress !== null)
3162
+ ? Address.fromPartial(object.fromAddress)
3163
+ : undefined;
3164
+ message.gas = object.gas ?? BigInt("0");
3165
+ message.init = object.init ?? new Uint8Array(0);
3166
+ message.value = (object.value !== undefined && object.value !== null) ? U256.fromPartial(object.value) : undefined;
3167
+ message.creationMethod = object.creationMethod ?? 0;
3168
+ return message;
3169
+ },
3170
+ };
3171
+
3172
+ function createBaseSelfDestructAction(): SelfDestructAction {
3173
+ return { address: undefined, balance: undefined, refundAddress: undefined };
3174
+ }
3175
+
3176
+ export const SelfDestructAction = {
3177
+ encode(message: SelfDestructAction, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
3178
+ if (message.address !== undefined) {
3179
+ Address.encode(message.address, writer.uint32(10).fork()).ldelim();
3180
+ }
3181
+ if (message.balance !== undefined) {
3182
+ U256.encode(message.balance, writer.uint32(18).fork()).ldelim();
3183
+ }
3184
+ if (message.refundAddress !== undefined) {
3185
+ Address.encode(message.refundAddress, writer.uint32(26).fork()).ldelim();
3186
+ }
3187
+ return writer;
3188
+ },
3189
+
3190
+ decode(input: _m0.Reader | Uint8Array, length?: number): SelfDestructAction {
3191
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
3192
+ let end = length === undefined ? reader.len : reader.pos + length;
3193
+ const message = createBaseSelfDestructAction() as any;
3194
+ while (reader.pos < end) {
3195
+ const tag = reader.uint32();
3196
+ switch (tag >>> 3) {
3197
+ case 1:
3198
+ if (tag !== 10) {
3199
+ break;
3200
+ }
3201
+
3202
+ message.address = Address.decode(reader, reader.uint32());
3203
+ continue;
3204
+ case 2:
3205
+ if (tag !== 18) {
3206
+ break;
3207
+ }
3208
+
3209
+ message.balance = U256.decode(reader, reader.uint32());
3210
+ continue;
3211
+ case 3:
3212
+ if (tag !== 26) {
3213
+ break;
3214
+ }
3215
+
3216
+ message.refundAddress = Address.decode(reader, reader.uint32());
3217
+ continue;
3218
+ }
3219
+ if ((tag & 7) === 4 || tag === 0) {
3220
+ break;
3221
+ }
3222
+ reader.skipType(tag & 7);
3223
+ }
3224
+ return message;
3225
+ },
3226
+
3227
+ fromJSON(object: any): SelfDestructAction {
3228
+ return {
3229
+ address: isSet(object.address) ? Address.fromJSON(object.address) : undefined,
3230
+ balance: isSet(object.balance) ? U256.fromJSON(object.balance) : undefined,
3231
+ refundAddress: isSet(object.refundAddress) ? Address.fromJSON(object.refundAddress) : undefined,
3232
+ };
3233
+ },
3234
+
3235
+ toJSON(message: SelfDestructAction): unknown {
3236
+ const obj: any = {};
3237
+ if (message.address !== undefined) {
3238
+ obj.address = Address.toJSON(message.address);
3239
+ }
3240
+ if (message.balance !== undefined) {
3241
+ obj.balance = U256.toJSON(message.balance);
3242
+ }
3243
+ if (message.refundAddress !== undefined) {
3244
+ obj.refundAddress = Address.toJSON(message.refundAddress);
3245
+ }
3246
+ return obj;
3247
+ },
3248
+
3249
+ create(base?: DeepPartial<SelfDestructAction>): SelfDestructAction {
3250
+ return SelfDestructAction.fromPartial(base ?? {});
3251
+ },
3252
+ fromPartial(object: DeepPartial<SelfDestructAction>): SelfDestructAction {
3253
+ const message = createBaseSelfDestructAction() as any;
3254
+ message.address = (object.address !== undefined && object.address !== null)
3255
+ ? Address.fromPartial(object.address)
3256
+ : undefined;
3257
+ message.balance = (object.balance !== undefined && object.balance !== null)
3258
+ ? U256.fromPartial(object.balance)
3259
+ : undefined;
3260
+ message.refundAddress = (object.refundAddress !== undefined && object.refundAddress !== null)
3261
+ ? Address.fromPartial(object.refundAddress)
3262
+ : undefined;
3263
+ return message;
3264
+ },
3265
+ };
3266
+
3267
+ function createBaseRewardAction(): RewardAction {
3268
+ return { author: undefined, type: 0, value: undefined };
3269
+ }
3270
+
3271
+ export const RewardAction = {
3272
+ encode(message: RewardAction, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
3273
+ if (message.author !== undefined) {
3274
+ Address.encode(message.author, writer.uint32(10).fork()).ldelim();
3275
+ }
3276
+ if (message.type !== undefined && message.type !== 0) {
3277
+ writer.uint32(16).int32(message.type);
3278
+ }
3279
+ if (message.value !== undefined) {
3280
+ U256.encode(message.value, writer.uint32(26).fork()).ldelim();
3281
+ }
3282
+ return writer;
3283
+ },
3284
+
3285
+ decode(input: _m0.Reader | Uint8Array, length?: number): RewardAction {
3286
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
3287
+ let end = length === undefined ? reader.len : reader.pos + length;
3288
+ const message = createBaseRewardAction() as any;
3289
+ while (reader.pos < end) {
3290
+ const tag = reader.uint32();
3291
+ switch (tag >>> 3) {
3292
+ case 1:
3293
+ if (tag !== 10) {
3294
+ break;
3295
+ }
3296
+
3297
+ message.author = Address.decode(reader, reader.uint32());
3298
+ continue;
3299
+ case 2:
3300
+ if (tag !== 16) {
3301
+ break;
3302
+ }
3303
+
3304
+ message.type = reader.int32() as any;
3305
+ continue;
3306
+ case 3:
3307
+ if (tag !== 26) {
3308
+ break;
3309
+ }
3310
+
3311
+ message.value = U256.decode(reader, reader.uint32());
3312
+ continue;
3313
+ }
3314
+ if ((tag & 7) === 4 || tag === 0) {
3315
+ break;
3316
+ }
3317
+ reader.skipType(tag & 7);
3318
+ }
3319
+ return message;
3320
+ },
3321
+
3322
+ fromJSON(object: any): RewardAction {
3323
+ return {
3324
+ author: isSet(object.author) ? Address.fromJSON(object.author) : undefined,
3325
+ type: isSet(object.type) ? rewardTypeFromJSON(object.type) : 0,
3326
+ value: isSet(object.value) ? U256.fromJSON(object.value) : undefined,
3327
+ };
3328
+ },
3329
+
3330
+ toJSON(message: RewardAction): unknown {
3331
+ const obj: any = {};
3332
+ if (message.author !== undefined) {
3333
+ obj.author = Address.toJSON(message.author);
3334
+ }
3335
+ if (message.type !== undefined && message.type !== 0) {
3336
+ obj.type = rewardTypeToJSON(message.type);
3337
+ }
3338
+ if (message.value !== undefined) {
3339
+ obj.value = U256.toJSON(message.value);
3340
+ }
3341
+ return obj;
3342
+ },
3343
+
3344
+ create(base?: DeepPartial<RewardAction>): RewardAction {
3345
+ return RewardAction.fromPartial(base ?? {});
3346
+ },
3347
+ fromPartial(object: DeepPartial<RewardAction>): RewardAction {
3348
+ const message = createBaseRewardAction() as any;
3349
+ message.author = (object.author !== undefined && object.author !== null)
3350
+ ? Address.fromPartial(object.author)
3351
+ : undefined;
3352
+ message.type = object.type ?? 0;
3353
+ message.value = (object.value !== undefined && object.value !== null) ? U256.fromPartial(object.value) : undefined;
3354
+ return message;
3355
+ },
3356
+ };
3357
+
3358
+ function createBaseCallOutput(): CallOutput {
3359
+ return { gasUsed: BigInt("0"), output: new Uint8Array(0) };
3360
+ }
3361
+
3362
+ export const CallOutput = {
3363
+ encode(message: CallOutput, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
3364
+ if (message.gasUsed !== undefined && message.gasUsed !== BigInt("0")) {
3365
+ if (BigInt.asUintN(64, message.gasUsed) !== message.gasUsed) {
3366
+ throw new globalThis.Error("value provided for field message.gasUsed of type uint64 too large");
3367
+ }
3368
+ writer.uint32(8).uint64(message.gasUsed.toString());
3369
+ }
3370
+ if (message.output !== undefined && message.output.length !== 0) {
3371
+ writer.uint32(18).bytes(message.output);
3372
+ }
3373
+ return writer;
3374
+ },
3375
+
3376
+ decode(input: _m0.Reader | Uint8Array, length?: number): CallOutput {
3377
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
3378
+ let end = length === undefined ? reader.len : reader.pos + length;
3379
+ const message = createBaseCallOutput() as any;
3380
+ while (reader.pos < end) {
3381
+ const tag = reader.uint32();
3382
+ switch (tag >>> 3) {
3383
+ case 1:
3384
+ if (tag !== 8) {
3385
+ break;
3386
+ }
3387
+
3388
+ message.gasUsed = longToBigint(reader.uint64() as Long);
3389
+ continue;
3390
+ case 2:
3391
+ if (tag !== 18) {
3392
+ break;
3393
+ }
3394
+
3395
+ message.output = reader.bytes();
3396
+ continue;
3397
+ }
3398
+ if ((tag & 7) === 4 || tag === 0) {
3399
+ break;
3400
+ }
3401
+ reader.skipType(tag & 7);
3402
+ }
3403
+ return message;
3404
+ },
3405
+
3406
+ fromJSON(object: any): CallOutput {
3407
+ return {
3408
+ gasUsed: isSet(object.gasUsed) ? BigInt(object.gasUsed) : BigInt("0"),
3409
+ output: isSet(object.output) ? bytesFromBase64(object.output) : new Uint8Array(0),
3410
+ };
3411
+ },
3412
+
3413
+ toJSON(message: CallOutput): unknown {
3414
+ const obj: any = {};
3415
+ if (message.gasUsed !== undefined && message.gasUsed !== BigInt("0")) {
3416
+ obj.gasUsed = message.gasUsed.toString();
3417
+ }
3418
+ if (message.output !== undefined && message.output.length !== 0) {
3419
+ obj.output = base64FromBytes(message.output);
3420
+ }
3421
+ return obj;
3422
+ },
3423
+
3424
+ create(base?: DeepPartial<CallOutput>): CallOutput {
3425
+ return CallOutput.fromPartial(base ?? {});
3426
+ },
3427
+ fromPartial(object: DeepPartial<CallOutput>): CallOutput {
3428
+ const message = createBaseCallOutput() as any;
3429
+ message.gasUsed = object.gasUsed ?? BigInt("0");
3430
+ message.output = object.output ?? new Uint8Array(0);
3431
+ return message;
3432
+ },
3433
+ };
3434
+
3435
+ function createBaseCreateOutput(): CreateOutput {
3436
+ return { address: undefined, code: new Uint8Array(0), gasUsed: BigInt("0") };
3437
+ }
3438
+
3439
+ export const CreateOutput = {
3440
+ encode(message: CreateOutput, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
3441
+ if (message.address !== undefined) {
3442
+ Address.encode(message.address, writer.uint32(10).fork()).ldelim();
3443
+ }
3444
+ if (message.code !== undefined && message.code.length !== 0) {
3445
+ writer.uint32(18).bytes(message.code);
3446
+ }
3447
+ if (message.gasUsed !== undefined && message.gasUsed !== BigInt("0")) {
3448
+ if (BigInt.asUintN(64, message.gasUsed) !== message.gasUsed) {
3449
+ throw new globalThis.Error("value provided for field message.gasUsed of type uint64 too large");
3450
+ }
3451
+ writer.uint32(24).uint64(message.gasUsed.toString());
3452
+ }
3453
+ return writer;
3454
+ },
3455
+
3456
+ decode(input: _m0.Reader | Uint8Array, length?: number): CreateOutput {
3457
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
3458
+ let end = length === undefined ? reader.len : reader.pos + length;
3459
+ const message = createBaseCreateOutput() as any;
3460
+ while (reader.pos < end) {
3461
+ const tag = reader.uint32();
3462
+ switch (tag >>> 3) {
3463
+ case 1:
3464
+ if (tag !== 10) {
3465
+ break;
3466
+ }
3467
+
3468
+ message.address = Address.decode(reader, reader.uint32());
3469
+ continue;
3470
+ case 2:
3471
+ if (tag !== 18) {
3472
+ break;
3473
+ }
3474
+
3475
+ message.code = reader.bytes();
3476
+ continue;
3477
+ case 3:
3478
+ if (tag !== 24) {
3479
+ break;
3480
+ }
3481
+
3482
+ message.gasUsed = longToBigint(reader.uint64() as Long);
3483
+ continue;
3484
+ }
3485
+ if ((tag & 7) === 4 || tag === 0) {
3486
+ break;
3487
+ }
3488
+ reader.skipType(tag & 7);
3489
+ }
3490
+ return message;
3491
+ },
3492
+
3493
+ fromJSON(object: any): CreateOutput {
3494
+ return {
3495
+ address: isSet(object.address) ? Address.fromJSON(object.address) : undefined,
3496
+ code: isSet(object.code) ? bytesFromBase64(object.code) : new Uint8Array(0),
3497
+ gasUsed: isSet(object.gasUsed) ? BigInt(object.gasUsed) : BigInt("0"),
3498
+ };
3499
+ },
3500
+
3501
+ toJSON(message: CreateOutput): unknown {
3502
+ const obj: any = {};
3503
+ if (message.address !== undefined) {
3504
+ obj.address = Address.toJSON(message.address);
3505
+ }
3506
+ if (message.code !== undefined && message.code.length !== 0) {
3507
+ obj.code = base64FromBytes(message.code);
3508
+ }
3509
+ if (message.gasUsed !== undefined && message.gasUsed !== BigInt("0")) {
3510
+ obj.gasUsed = message.gasUsed.toString();
3511
+ }
3512
+ return obj;
3513
+ },
3514
+
3515
+ create(base?: DeepPartial<CreateOutput>): CreateOutput {
3516
+ return CreateOutput.fromPartial(base ?? {});
3517
+ },
3518
+ fromPartial(object: DeepPartial<CreateOutput>): CreateOutput {
3519
+ const message = createBaseCreateOutput() as any;
3520
+ message.address = (object.address !== undefined && object.address !== null)
3521
+ ? Address.fromPartial(object.address)
3522
+ : undefined;
3523
+ message.code = object.code ?? new Uint8Array(0);
3524
+ message.gasUsed = object.gasUsed ?? BigInt("0");
3525
+ return message;
3526
+ },
3527
+ };
3528
+
2222
3529
  function bytesFromBase64(b64: string): Uint8Array {
2223
3530
  if ((globalThis as any).Buffer) {
2224
3531
  return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));