@apibara/evm 2.1.0-beta.18 → 2.1.0-beta.19

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. */
@@ -384,8 +529,139 @@ export interface AccessListItem {
384
529
  readonly storageKeys?: readonly B256[] | undefined;
385
530
  }
386
531
 
532
+ export interface TransactionTrace {
533
+ readonly filterIds?:
534
+ | readonly number[]
535
+ | undefined;
536
+ /** Index of the transaction in the block. */
537
+ readonly transactionIndex?:
538
+ | number
539
+ | undefined;
540
+ /** Transaction hash. */
541
+ readonly transactionHash?:
542
+ | B256
543
+ | undefined;
544
+ /** Traces. */
545
+ readonly traces?: readonly Trace[] | undefined;
546
+ }
547
+
548
+ export interface Trace {
549
+ readonly action?:
550
+ | { readonly $case: "call"; readonly call: CallAction }
551
+ | { readonly $case: "create"; readonly create: CreateAction }
552
+ | { readonly $case: "selfDestruct"; readonly selfDestruct: SelfDestructAction }
553
+ | { readonly $case: "reward"; readonly reward: RewardAction }
554
+ | undefined;
555
+ /** Error message if the transaction failed. */
556
+ readonly error?: string | undefined;
557
+ readonly output?:
558
+ | { readonly $case: "callOutput"; readonly callOutput: CallOutput }
559
+ | { readonly $case: "createOutput"; readonly createOutput: CreateOutput }
560
+ | undefined;
561
+ /** Number of sub traces. */
562
+ readonly subtraces?:
563
+ | number
564
+ | undefined;
565
+ /** The identifier of this trace in the trace tree. */
566
+ readonly traceAddress?: readonly number[] | undefined;
567
+ }
568
+
569
+ export interface CallAction {
570
+ /** Address of the sending account. */
571
+ readonly fromAddress?:
572
+ | Address
573
+ | undefined;
574
+ /** Call type. */
575
+ readonly type?:
576
+ | CallType
577
+ | undefined;
578
+ /** The gas available to execute the call. */
579
+ readonly gas?:
580
+ | bigint
581
+ | undefined;
582
+ /** Input data provided by the call. */
583
+ readonly input?:
584
+ | Uint8Array
585
+ | undefined;
586
+ /** Target of the destination address. */
587
+ readonly toAddress?:
588
+ | Address
589
+ | undefined;
590
+ /** Value transferred to the destination account. */
591
+ readonly value?: U256 | undefined;
592
+ }
593
+
594
+ export interface CreateAction {
595
+ /** Address of the sending account. */
596
+ readonly fromAddress?:
597
+ | Address
598
+ | undefined;
599
+ /** The gas available to execute the call. */
600
+ readonly gas?:
601
+ | bigint
602
+ | undefined;
603
+ /** Input data provided by the call. */
604
+ readonly init?:
605
+ | Uint8Array
606
+ | undefined;
607
+ /** Value transferred to the ne account. */
608
+ readonly value?:
609
+ | U256
610
+ | undefined;
611
+ /** Contract creation method. */
612
+ readonly creationMethod?: CreationMethod | undefined;
613
+ }
614
+
615
+ export interface SelfDestructAction {
616
+ /** The destroyed address. */
617
+ readonly address?:
618
+ | Address
619
+ | undefined;
620
+ /** Balance of the destroyed account before destruct. */
621
+ readonly balance?:
622
+ | U256
623
+ | undefined;
624
+ /** The heir address. */
625
+ readonly refundAddress?: Address | undefined;
626
+ }
627
+
628
+ export interface RewardAction {
629
+ /** The author's address. */
630
+ readonly author?:
631
+ | Address
632
+ | undefined;
633
+ /** Reward type. */
634
+ readonly type?:
635
+ | RewardType
636
+ | undefined;
637
+ /** The reward's value. */
638
+ readonly value?: U256 | undefined;
639
+ }
640
+
641
+ export interface CallOutput {
642
+ /** Gas used. */
643
+ readonly gasUsed?:
644
+ | bigint
645
+ | undefined;
646
+ /** Output data. */
647
+ readonly output?: Uint8Array | undefined;
648
+ }
649
+
650
+ export interface CreateOutput {
651
+ /** Contract address. */
652
+ readonly address?:
653
+ | Address
654
+ | undefined;
655
+ /** Code */
656
+ readonly code?:
657
+ | Uint8Array
658
+ | undefined;
659
+ /** Gas used. */
660
+ readonly gasUsed?: bigint | undefined;
661
+ }
662
+
387
663
  function createBaseBlock(): Block {
388
- return { header: undefined, withdrawals: [], transactions: [], receipts: [], logs: [] };
664
+ return { header: undefined, withdrawals: [], transactions: [], receipts: [], logs: [], traces: [] };
389
665
  }
390
666
 
391
667
  export const Block = {
@@ -413,6 +689,11 @@ export const Block = {
413
689
  Log.encode(v!, writer.uint32(42).fork()).ldelim();
414
690
  }
415
691
  }
692
+ if (message.traces !== undefined && message.traces.length !== 0) {
693
+ for (const v of message.traces) {
694
+ TransactionTrace.encode(v!, writer.uint32(50).fork()).ldelim();
695
+ }
696
+ }
416
697
  return writer;
417
698
  },
418
699
 
@@ -458,6 +739,13 @@ export const Block = {
458
739
 
459
740
  message.logs!.push(Log.decode(reader, reader.uint32()));
460
741
  continue;
742
+ case 6:
743
+ if (tag !== 50) {
744
+ break;
745
+ }
746
+
747
+ message.traces!.push(TransactionTrace.decode(reader, reader.uint32()));
748
+ continue;
461
749
  }
462
750
  if ((tag & 7) === 4 || tag === 0) {
463
751
  break;
@@ -480,6 +768,9 @@ export const Block = {
480
768
  ? object.receipts.map((e: any) => TransactionReceipt.fromJSON(e))
481
769
  : [],
482
770
  logs: globalThis.Array.isArray(object?.logs) ? object.logs.map((e: any) => Log.fromJSON(e)) : [],
771
+ traces: globalThis.Array.isArray(object?.traces)
772
+ ? object.traces.map((e: any) => TransactionTrace.fromJSON(e))
773
+ : [],
483
774
  };
484
775
  },
485
776
 
@@ -500,6 +791,9 @@ export const Block = {
500
791
  if (message.logs?.length) {
501
792
  obj.logs = message.logs.map((e) => Log.toJSON(e));
502
793
  }
794
+ if (message.traces?.length) {
795
+ obj.traces = message.traces.map((e) => TransactionTrace.toJSON(e));
796
+ }
503
797
  return obj;
504
798
  },
505
799
 
@@ -515,6 +809,7 @@ export const Block = {
515
809
  message.transactions = object.transactions?.map((e) => Transaction.fromPartial(e)) || [];
516
810
  message.receipts = object.receipts?.map((e) => TransactionReceipt.fromPartial(e)) || [];
517
811
  message.logs = object.logs?.map((e) => Log.fromPartial(e)) || [];
812
+ message.traces = object.traces?.map((e) => TransactionTrace.fromPartial(e)) || [];
518
813
  return message;
519
814
  },
520
815
  };
@@ -2219,6 +2514,993 @@ export const AccessListItem = {
2219
2514
  },
2220
2515
  };
2221
2516
 
2517
+ function createBaseTransactionTrace(): TransactionTrace {
2518
+ return { filterIds: [], transactionIndex: 0, transactionHash: undefined, traces: [] };
2519
+ }
2520
+
2521
+ export const TransactionTrace = {
2522
+ encode(message: TransactionTrace, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
2523
+ if (message.filterIds !== undefined && message.filterIds.length !== 0) {
2524
+ writer.uint32(10).fork();
2525
+ for (const v of message.filterIds) {
2526
+ writer.uint32(v);
2527
+ }
2528
+ writer.ldelim();
2529
+ }
2530
+ if (message.transactionIndex !== undefined && message.transactionIndex !== 0) {
2531
+ writer.uint32(16).uint32(message.transactionIndex);
2532
+ }
2533
+ if (message.transactionHash !== undefined) {
2534
+ B256.encode(message.transactionHash, writer.uint32(26).fork()).ldelim();
2535
+ }
2536
+ if (message.traces !== undefined && message.traces.length !== 0) {
2537
+ for (const v of message.traces) {
2538
+ Trace.encode(v!, writer.uint32(34).fork()).ldelim();
2539
+ }
2540
+ }
2541
+ return writer;
2542
+ },
2543
+
2544
+ decode(input: _m0.Reader | Uint8Array, length?: number): TransactionTrace {
2545
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
2546
+ let end = length === undefined ? reader.len : reader.pos + length;
2547
+ const message = createBaseTransactionTrace() as any;
2548
+ while (reader.pos < end) {
2549
+ const tag = reader.uint32();
2550
+ switch (tag >>> 3) {
2551
+ case 1:
2552
+ if (tag === 8) {
2553
+ message.filterIds!.push(reader.uint32());
2554
+
2555
+ continue;
2556
+ }
2557
+
2558
+ if (tag === 10) {
2559
+ const end2 = reader.uint32() + reader.pos;
2560
+ while (reader.pos < end2) {
2561
+ message.filterIds!.push(reader.uint32());
2562
+ }
2563
+
2564
+ continue;
2565
+ }
2566
+
2567
+ break;
2568
+ case 2:
2569
+ if (tag !== 16) {
2570
+ break;
2571
+ }
2572
+
2573
+ message.transactionIndex = reader.uint32();
2574
+ continue;
2575
+ case 3:
2576
+ if (tag !== 26) {
2577
+ break;
2578
+ }
2579
+
2580
+ message.transactionHash = B256.decode(reader, reader.uint32());
2581
+ continue;
2582
+ case 4:
2583
+ if (tag !== 34) {
2584
+ break;
2585
+ }
2586
+
2587
+ message.traces!.push(Trace.decode(reader, reader.uint32()));
2588
+ continue;
2589
+ }
2590
+ if ((tag & 7) === 4 || tag === 0) {
2591
+ break;
2592
+ }
2593
+ reader.skipType(tag & 7);
2594
+ }
2595
+ return message;
2596
+ },
2597
+
2598
+ fromJSON(object: any): TransactionTrace {
2599
+ return {
2600
+ filterIds: globalThis.Array.isArray(object?.filterIds)
2601
+ ? object.filterIds.map((e: any) => globalThis.Number(e))
2602
+ : [],
2603
+ transactionIndex: isSet(object.transactionIndex) ? globalThis.Number(object.transactionIndex) : 0,
2604
+ transactionHash: isSet(object.transactionHash) ? B256.fromJSON(object.transactionHash) : undefined,
2605
+ traces: globalThis.Array.isArray(object?.traces) ? object.traces.map((e: any) => Trace.fromJSON(e)) : [],
2606
+ };
2607
+ },
2608
+
2609
+ toJSON(message: TransactionTrace): unknown {
2610
+ const obj: any = {};
2611
+ if (message.filterIds?.length) {
2612
+ obj.filterIds = message.filterIds.map((e) => Math.round(e));
2613
+ }
2614
+ if (message.transactionIndex !== undefined && message.transactionIndex !== 0) {
2615
+ obj.transactionIndex = Math.round(message.transactionIndex);
2616
+ }
2617
+ if (message.transactionHash !== undefined) {
2618
+ obj.transactionHash = B256.toJSON(message.transactionHash);
2619
+ }
2620
+ if (message.traces?.length) {
2621
+ obj.traces = message.traces.map((e) => Trace.toJSON(e));
2622
+ }
2623
+ return obj;
2624
+ },
2625
+
2626
+ create(base?: DeepPartial<TransactionTrace>): TransactionTrace {
2627
+ return TransactionTrace.fromPartial(base ?? {});
2628
+ },
2629
+ fromPartial(object: DeepPartial<TransactionTrace>): TransactionTrace {
2630
+ const message = createBaseTransactionTrace() as any;
2631
+ message.filterIds = object.filterIds?.map((e) => e) || [];
2632
+ message.transactionIndex = object.transactionIndex ?? 0;
2633
+ message.transactionHash = (object.transactionHash !== undefined && object.transactionHash !== null)
2634
+ ? B256.fromPartial(object.transactionHash)
2635
+ : undefined;
2636
+ message.traces = object.traces?.map((e) => Trace.fromPartial(e)) || [];
2637
+ return message;
2638
+ },
2639
+ };
2640
+
2641
+ function createBaseTrace(): Trace {
2642
+ return { action: undefined, error: undefined, output: undefined, subtraces: 0, traceAddress: [] };
2643
+ }
2644
+
2645
+ export const Trace = {
2646
+ encode(message: Trace, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
2647
+ switch (message.action?.$case) {
2648
+ case "call":
2649
+ CallAction.encode(message.action.call, writer.uint32(10).fork()).ldelim();
2650
+ break;
2651
+ case "create":
2652
+ CreateAction.encode(message.action.create, writer.uint32(18).fork()).ldelim();
2653
+ break;
2654
+ case "selfDestruct":
2655
+ SelfDestructAction.encode(message.action.selfDestruct, writer.uint32(26).fork()).ldelim();
2656
+ break;
2657
+ case "reward":
2658
+ RewardAction.encode(message.action.reward, writer.uint32(34).fork()).ldelim();
2659
+ break;
2660
+ }
2661
+ if (message.error !== undefined) {
2662
+ writer.uint32(42).string(message.error);
2663
+ }
2664
+ switch (message.output?.$case) {
2665
+ case "callOutput":
2666
+ CallOutput.encode(message.output.callOutput, writer.uint32(50).fork()).ldelim();
2667
+ break;
2668
+ case "createOutput":
2669
+ CreateOutput.encode(message.output.createOutput, writer.uint32(58).fork()).ldelim();
2670
+ break;
2671
+ }
2672
+ if (message.subtraces !== undefined && message.subtraces !== 0) {
2673
+ writer.uint32(64).uint32(message.subtraces);
2674
+ }
2675
+ if (message.traceAddress !== undefined && message.traceAddress.length !== 0) {
2676
+ writer.uint32(74).fork();
2677
+ for (const v of message.traceAddress) {
2678
+ writer.uint32(v);
2679
+ }
2680
+ writer.ldelim();
2681
+ }
2682
+ return writer;
2683
+ },
2684
+
2685
+ decode(input: _m0.Reader | Uint8Array, length?: number): Trace {
2686
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
2687
+ let end = length === undefined ? reader.len : reader.pos + length;
2688
+ const message = createBaseTrace() as any;
2689
+ while (reader.pos < end) {
2690
+ const tag = reader.uint32();
2691
+ switch (tag >>> 3) {
2692
+ case 1:
2693
+ if (tag !== 10) {
2694
+ break;
2695
+ }
2696
+
2697
+ message.action = { $case: "call", call: CallAction.decode(reader, reader.uint32()) };
2698
+ continue;
2699
+ case 2:
2700
+ if (tag !== 18) {
2701
+ break;
2702
+ }
2703
+
2704
+ message.action = { $case: "create", create: CreateAction.decode(reader, reader.uint32()) };
2705
+ continue;
2706
+ case 3:
2707
+ if (tag !== 26) {
2708
+ break;
2709
+ }
2710
+
2711
+ message.action = { $case: "selfDestruct", selfDestruct: SelfDestructAction.decode(reader, reader.uint32()) };
2712
+ continue;
2713
+ case 4:
2714
+ if (tag !== 34) {
2715
+ break;
2716
+ }
2717
+
2718
+ message.action = { $case: "reward", reward: RewardAction.decode(reader, reader.uint32()) };
2719
+ continue;
2720
+ case 5:
2721
+ if (tag !== 42) {
2722
+ break;
2723
+ }
2724
+
2725
+ message.error = reader.string();
2726
+ continue;
2727
+ case 6:
2728
+ if (tag !== 50) {
2729
+ break;
2730
+ }
2731
+
2732
+ message.output = { $case: "callOutput", callOutput: CallOutput.decode(reader, reader.uint32()) };
2733
+ continue;
2734
+ case 7:
2735
+ if (tag !== 58) {
2736
+ break;
2737
+ }
2738
+
2739
+ message.output = { $case: "createOutput", createOutput: CreateOutput.decode(reader, reader.uint32()) };
2740
+ continue;
2741
+ case 8:
2742
+ if (tag !== 64) {
2743
+ break;
2744
+ }
2745
+
2746
+ message.subtraces = reader.uint32();
2747
+ continue;
2748
+ case 9:
2749
+ if (tag === 72) {
2750
+ message.traceAddress!.push(reader.uint32());
2751
+
2752
+ continue;
2753
+ }
2754
+
2755
+ if (tag === 74) {
2756
+ const end2 = reader.uint32() + reader.pos;
2757
+ while (reader.pos < end2) {
2758
+ message.traceAddress!.push(reader.uint32());
2759
+ }
2760
+
2761
+ continue;
2762
+ }
2763
+
2764
+ break;
2765
+ }
2766
+ if ((tag & 7) === 4 || tag === 0) {
2767
+ break;
2768
+ }
2769
+ reader.skipType(tag & 7);
2770
+ }
2771
+ return message;
2772
+ },
2773
+
2774
+ fromJSON(object: any): Trace {
2775
+ return {
2776
+ action: isSet(object.call)
2777
+ ? { $case: "call", call: CallAction.fromJSON(object.call) }
2778
+ : isSet(object.create)
2779
+ ? { $case: "create", create: CreateAction.fromJSON(object.create) }
2780
+ : isSet(object.selfDestruct)
2781
+ ? { $case: "selfDestruct", selfDestruct: SelfDestructAction.fromJSON(object.selfDestruct) }
2782
+ : isSet(object.reward)
2783
+ ? { $case: "reward", reward: RewardAction.fromJSON(object.reward) }
2784
+ : undefined,
2785
+ error: isSet(object.error) ? globalThis.String(object.error) : undefined,
2786
+ output: isSet(object.callOutput)
2787
+ ? { $case: "callOutput", callOutput: CallOutput.fromJSON(object.callOutput) }
2788
+ : isSet(object.createOutput)
2789
+ ? { $case: "createOutput", createOutput: CreateOutput.fromJSON(object.createOutput) }
2790
+ : undefined,
2791
+ subtraces: isSet(object.subtraces) ? globalThis.Number(object.subtraces) : 0,
2792
+ traceAddress: globalThis.Array.isArray(object?.traceAddress)
2793
+ ? object.traceAddress.map((e: any) => globalThis.Number(e))
2794
+ : [],
2795
+ };
2796
+ },
2797
+
2798
+ toJSON(message: Trace): unknown {
2799
+ const obj: any = {};
2800
+ if (message.action?.$case === "call") {
2801
+ obj.call = CallAction.toJSON(message.action.call);
2802
+ }
2803
+ if (message.action?.$case === "create") {
2804
+ obj.create = CreateAction.toJSON(message.action.create);
2805
+ }
2806
+ if (message.action?.$case === "selfDestruct") {
2807
+ obj.selfDestruct = SelfDestructAction.toJSON(message.action.selfDestruct);
2808
+ }
2809
+ if (message.action?.$case === "reward") {
2810
+ obj.reward = RewardAction.toJSON(message.action.reward);
2811
+ }
2812
+ if (message.error !== undefined) {
2813
+ obj.error = message.error;
2814
+ }
2815
+ if (message.output?.$case === "callOutput") {
2816
+ obj.callOutput = CallOutput.toJSON(message.output.callOutput);
2817
+ }
2818
+ if (message.output?.$case === "createOutput") {
2819
+ obj.createOutput = CreateOutput.toJSON(message.output.createOutput);
2820
+ }
2821
+ if (message.subtraces !== undefined && message.subtraces !== 0) {
2822
+ obj.subtraces = Math.round(message.subtraces);
2823
+ }
2824
+ if (message.traceAddress?.length) {
2825
+ obj.traceAddress = message.traceAddress.map((e) => Math.round(e));
2826
+ }
2827
+ return obj;
2828
+ },
2829
+
2830
+ create(base?: DeepPartial<Trace>): Trace {
2831
+ return Trace.fromPartial(base ?? {});
2832
+ },
2833
+ fromPartial(object: DeepPartial<Trace>): Trace {
2834
+ const message = createBaseTrace() as any;
2835
+ if (object.action?.$case === "call" && object.action?.call !== undefined && object.action?.call !== null) {
2836
+ message.action = { $case: "call", call: CallAction.fromPartial(object.action.call) };
2837
+ }
2838
+ if (object.action?.$case === "create" && object.action?.create !== undefined && object.action?.create !== null) {
2839
+ message.action = { $case: "create", create: CreateAction.fromPartial(object.action.create) };
2840
+ }
2841
+ if (
2842
+ object.action?.$case === "selfDestruct" &&
2843
+ object.action?.selfDestruct !== undefined &&
2844
+ object.action?.selfDestruct !== null
2845
+ ) {
2846
+ message.action = {
2847
+ $case: "selfDestruct",
2848
+ selfDestruct: SelfDestructAction.fromPartial(object.action.selfDestruct),
2849
+ };
2850
+ }
2851
+ if (object.action?.$case === "reward" && object.action?.reward !== undefined && object.action?.reward !== null) {
2852
+ message.action = { $case: "reward", reward: RewardAction.fromPartial(object.action.reward) };
2853
+ }
2854
+ message.error = object.error ?? undefined;
2855
+ if (
2856
+ object.output?.$case === "callOutput" &&
2857
+ object.output?.callOutput !== undefined &&
2858
+ object.output?.callOutput !== null
2859
+ ) {
2860
+ message.output = { $case: "callOutput", callOutput: CallOutput.fromPartial(object.output.callOutput) };
2861
+ }
2862
+ if (
2863
+ object.output?.$case === "createOutput" &&
2864
+ object.output?.createOutput !== undefined &&
2865
+ object.output?.createOutput !== null
2866
+ ) {
2867
+ message.output = { $case: "createOutput", createOutput: CreateOutput.fromPartial(object.output.createOutput) };
2868
+ }
2869
+ message.subtraces = object.subtraces ?? 0;
2870
+ message.traceAddress = object.traceAddress?.map((e) => e) || [];
2871
+ return message;
2872
+ },
2873
+ };
2874
+
2875
+ function createBaseCallAction(): CallAction {
2876
+ return {
2877
+ fromAddress: undefined,
2878
+ type: 0,
2879
+ gas: BigInt("0"),
2880
+ input: new Uint8Array(0),
2881
+ toAddress: undefined,
2882
+ value: undefined,
2883
+ };
2884
+ }
2885
+
2886
+ export const CallAction = {
2887
+ encode(message: CallAction, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
2888
+ if (message.fromAddress !== undefined) {
2889
+ Address.encode(message.fromAddress, writer.uint32(10).fork()).ldelim();
2890
+ }
2891
+ if (message.type !== undefined && message.type !== 0) {
2892
+ writer.uint32(16).int32(message.type);
2893
+ }
2894
+ if (message.gas !== undefined && message.gas !== BigInt("0")) {
2895
+ if (BigInt.asUintN(64, message.gas) !== message.gas) {
2896
+ throw new globalThis.Error("value provided for field message.gas of type uint64 too large");
2897
+ }
2898
+ writer.uint32(24).uint64(message.gas.toString());
2899
+ }
2900
+ if (message.input !== undefined && message.input.length !== 0) {
2901
+ writer.uint32(34).bytes(message.input);
2902
+ }
2903
+ if (message.toAddress !== undefined) {
2904
+ Address.encode(message.toAddress, writer.uint32(42).fork()).ldelim();
2905
+ }
2906
+ if (message.value !== undefined) {
2907
+ U256.encode(message.value, writer.uint32(50).fork()).ldelim();
2908
+ }
2909
+ return writer;
2910
+ },
2911
+
2912
+ decode(input: _m0.Reader | Uint8Array, length?: number): CallAction {
2913
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
2914
+ let end = length === undefined ? reader.len : reader.pos + length;
2915
+ const message = createBaseCallAction() as any;
2916
+ while (reader.pos < end) {
2917
+ const tag = reader.uint32();
2918
+ switch (tag >>> 3) {
2919
+ case 1:
2920
+ if (tag !== 10) {
2921
+ break;
2922
+ }
2923
+
2924
+ message.fromAddress = Address.decode(reader, reader.uint32());
2925
+ continue;
2926
+ case 2:
2927
+ if (tag !== 16) {
2928
+ break;
2929
+ }
2930
+
2931
+ message.type = reader.int32() as any;
2932
+ continue;
2933
+ case 3:
2934
+ if (tag !== 24) {
2935
+ break;
2936
+ }
2937
+
2938
+ message.gas = longToBigint(reader.uint64() as Long);
2939
+ continue;
2940
+ case 4:
2941
+ if (tag !== 34) {
2942
+ break;
2943
+ }
2944
+
2945
+ message.input = reader.bytes();
2946
+ continue;
2947
+ case 5:
2948
+ if (tag !== 42) {
2949
+ break;
2950
+ }
2951
+
2952
+ message.toAddress = Address.decode(reader, reader.uint32());
2953
+ continue;
2954
+ case 6:
2955
+ if (tag !== 50) {
2956
+ break;
2957
+ }
2958
+
2959
+ message.value = U256.decode(reader, reader.uint32());
2960
+ continue;
2961
+ }
2962
+ if ((tag & 7) === 4 || tag === 0) {
2963
+ break;
2964
+ }
2965
+ reader.skipType(tag & 7);
2966
+ }
2967
+ return message;
2968
+ },
2969
+
2970
+ fromJSON(object: any): CallAction {
2971
+ return {
2972
+ fromAddress: isSet(object.fromAddress) ? Address.fromJSON(object.fromAddress) : undefined,
2973
+ type: isSet(object.type) ? callTypeFromJSON(object.type) : 0,
2974
+ gas: isSet(object.gas) ? BigInt(object.gas) : BigInt("0"),
2975
+ input: isSet(object.input) ? bytesFromBase64(object.input) : new Uint8Array(0),
2976
+ toAddress: isSet(object.toAddress) ? Address.fromJSON(object.toAddress) : undefined,
2977
+ value: isSet(object.value) ? U256.fromJSON(object.value) : undefined,
2978
+ };
2979
+ },
2980
+
2981
+ toJSON(message: CallAction): unknown {
2982
+ const obj: any = {};
2983
+ if (message.fromAddress !== undefined) {
2984
+ obj.fromAddress = Address.toJSON(message.fromAddress);
2985
+ }
2986
+ if (message.type !== undefined && message.type !== 0) {
2987
+ obj.type = callTypeToJSON(message.type);
2988
+ }
2989
+ if (message.gas !== undefined && message.gas !== BigInt("0")) {
2990
+ obj.gas = message.gas.toString();
2991
+ }
2992
+ if (message.input !== undefined && message.input.length !== 0) {
2993
+ obj.input = base64FromBytes(message.input);
2994
+ }
2995
+ if (message.toAddress !== undefined) {
2996
+ obj.toAddress = Address.toJSON(message.toAddress);
2997
+ }
2998
+ if (message.value !== undefined) {
2999
+ obj.value = U256.toJSON(message.value);
3000
+ }
3001
+ return obj;
3002
+ },
3003
+
3004
+ create(base?: DeepPartial<CallAction>): CallAction {
3005
+ return CallAction.fromPartial(base ?? {});
3006
+ },
3007
+ fromPartial(object: DeepPartial<CallAction>): CallAction {
3008
+ const message = createBaseCallAction() as any;
3009
+ message.fromAddress = (object.fromAddress !== undefined && object.fromAddress !== null)
3010
+ ? Address.fromPartial(object.fromAddress)
3011
+ : undefined;
3012
+ message.type = object.type ?? 0;
3013
+ message.gas = object.gas ?? BigInt("0");
3014
+ message.input = object.input ?? new Uint8Array(0);
3015
+ message.toAddress = (object.toAddress !== undefined && object.toAddress !== null)
3016
+ ? Address.fromPartial(object.toAddress)
3017
+ : undefined;
3018
+ message.value = (object.value !== undefined && object.value !== null) ? U256.fromPartial(object.value) : undefined;
3019
+ return message;
3020
+ },
3021
+ };
3022
+
3023
+ function createBaseCreateAction(): CreateAction {
3024
+ return { fromAddress: undefined, gas: BigInt("0"), init: new Uint8Array(0), value: undefined, creationMethod: 0 };
3025
+ }
3026
+
3027
+ export const CreateAction = {
3028
+ encode(message: CreateAction, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
3029
+ if (message.fromAddress !== undefined) {
3030
+ Address.encode(message.fromAddress, writer.uint32(10).fork()).ldelim();
3031
+ }
3032
+ if (message.gas !== undefined && message.gas !== BigInt("0")) {
3033
+ if (BigInt.asUintN(64, message.gas) !== message.gas) {
3034
+ throw new globalThis.Error("value provided for field message.gas of type uint64 too large");
3035
+ }
3036
+ writer.uint32(16).uint64(message.gas.toString());
3037
+ }
3038
+ if (message.init !== undefined && message.init.length !== 0) {
3039
+ writer.uint32(26).bytes(message.init);
3040
+ }
3041
+ if (message.value !== undefined) {
3042
+ U256.encode(message.value, writer.uint32(34).fork()).ldelim();
3043
+ }
3044
+ if (message.creationMethod !== undefined && message.creationMethod !== 0) {
3045
+ writer.uint32(40).int32(message.creationMethod);
3046
+ }
3047
+ return writer;
3048
+ },
3049
+
3050
+ decode(input: _m0.Reader | Uint8Array, length?: number): CreateAction {
3051
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
3052
+ let end = length === undefined ? reader.len : reader.pos + length;
3053
+ const message = createBaseCreateAction() as any;
3054
+ while (reader.pos < end) {
3055
+ const tag = reader.uint32();
3056
+ switch (tag >>> 3) {
3057
+ case 1:
3058
+ if (tag !== 10) {
3059
+ break;
3060
+ }
3061
+
3062
+ message.fromAddress = Address.decode(reader, reader.uint32());
3063
+ continue;
3064
+ case 2:
3065
+ if (tag !== 16) {
3066
+ break;
3067
+ }
3068
+
3069
+ message.gas = longToBigint(reader.uint64() as Long);
3070
+ continue;
3071
+ case 3:
3072
+ if (tag !== 26) {
3073
+ break;
3074
+ }
3075
+
3076
+ message.init = reader.bytes();
3077
+ continue;
3078
+ case 4:
3079
+ if (tag !== 34) {
3080
+ break;
3081
+ }
3082
+
3083
+ message.value = U256.decode(reader, reader.uint32());
3084
+ continue;
3085
+ case 5:
3086
+ if (tag !== 40) {
3087
+ break;
3088
+ }
3089
+
3090
+ message.creationMethod = reader.int32() as any;
3091
+ continue;
3092
+ }
3093
+ if ((tag & 7) === 4 || tag === 0) {
3094
+ break;
3095
+ }
3096
+ reader.skipType(tag & 7);
3097
+ }
3098
+ return message;
3099
+ },
3100
+
3101
+ fromJSON(object: any): CreateAction {
3102
+ return {
3103
+ fromAddress: isSet(object.fromAddress) ? Address.fromJSON(object.fromAddress) : undefined,
3104
+ gas: isSet(object.gas) ? BigInt(object.gas) : BigInt("0"),
3105
+ init: isSet(object.init) ? bytesFromBase64(object.init) : new Uint8Array(0),
3106
+ value: isSet(object.value) ? U256.fromJSON(object.value) : undefined,
3107
+ creationMethod: isSet(object.creationMethod) ? creationMethodFromJSON(object.creationMethod) : 0,
3108
+ };
3109
+ },
3110
+
3111
+ toJSON(message: CreateAction): unknown {
3112
+ const obj: any = {};
3113
+ if (message.fromAddress !== undefined) {
3114
+ obj.fromAddress = Address.toJSON(message.fromAddress);
3115
+ }
3116
+ if (message.gas !== undefined && message.gas !== BigInt("0")) {
3117
+ obj.gas = message.gas.toString();
3118
+ }
3119
+ if (message.init !== undefined && message.init.length !== 0) {
3120
+ obj.init = base64FromBytes(message.init);
3121
+ }
3122
+ if (message.value !== undefined) {
3123
+ obj.value = U256.toJSON(message.value);
3124
+ }
3125
+ if (message.creationMethod !== undefined && message.creationMethod !== 0) {
3126
+ obj.creationMethod = creationMethodToJSON(message.creationMethod);
3127
+ }
3128
+ return obj;
3129
+ },
3130
+
3131
+ create(base?: DeepPartial<CreateAction>): CreateAction {
3132
+ return CreateAction.fromPartial(base ?? {});
3133
+ },
3134
+ fromPartial(object: DeepPartial<CreateAction>): CreateAction {
3135
+ const message = createBaseCreateAction() as any;
3136
+ message.fromAddress = (object.fromAddress !== undefined && object.fromAddress !== null)
3137
+ ? Address.fromPartial(object.fromAddress)
3138
+ : undefined;
3139
+ message.gas = object.gas ?? BigInt("0");
3140
+ message.init = object.init ?? new Uint8Array(0);
3141
+ message.value = (object.value !== undefined && object.value !== null) ? U256.fromPartial(object.value) : undefined;
3142
+ message.creationMethod = object.creationMethod ?? 0;
3143
+ return message;
3144
+ },
3145
+ };
3146
+
3147
+ function createBaseSelfDestructAction(): SelfDestructAction {
3148
+ return { address: undefined, balance: undefined, refundAddress: undefined };
3149
+ }
3150
+
3151
+ export const SelfDestructAction = {
3152
+ encode(message: SelfDestructAction, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
3153
+ if (message.address !== undefined) {
3154
+ Address.encode(message.address, writer.uint32(10).fork()).ldelim();
3155
+ }
3156
+ if (message.balance !== undefined) {
3157
+ U256.encode(message.balance, writer.uint32(18).fork()).ldelim();
3158
+ }
3159
+ if (message.refundAddress !== undefined) {
3160
+ Address.encode(message.refundAddress, writer.uint32(26).fork()).ldelim();
3161
+ }
3162
+ return writer;
3163
+ },
3164
+
3165
+ decode(input: _m0.Reader | Uint8Array, length?: number): SelfDestructAction {
3166
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
3167
+ let end = length === undefined ? reader.len : reader.pos + length;
3168
+ const message = createBaseSelfDestructAction() as any;
3169
+ while (reader.pos < end) {
3170
+ const tag = reader.uint32();
3171
+ switch (tag >>> 3) {
3172
+ case 1:
3173
+ if (tag !== 10) {
3174
+ break;
3175
+ }
3176
+
3177
+ message.address = Address.decode(reader, reader.uint32());
3178
+ continue;
3179
+ case 2:
3180
+ if (tag !== 18) {
3181
+ break;
3182
+ }
3183
+
3184
+ message.balance = U256.decode(reader, reader.uint32());
3185
+ continue;
3186
+ case 3:
3187
+ if (tag !== 26) {
3188
+ break;
3189
+ }
3190
+
3191
+ message.refundAddress = Address.decode(reader, reader.uint32());
3192
+ continue;
3193
+ }
3194
+ if ((tag & 7) === 4 || tag === 0) {
3195
+ break;
3196
+ }
3197
+ reader.skipType(tag & 7);
3198
+ }
3199
+ return message;
3200
+ },
3201
+
3202
+ fromJSON(object: any): SelfDestructAction {
3203
+ return {
3204
+ address: isSet(object.address) ? Address.fromJSON(object.address) : undefined,
3205
+ balance: isSet(object.balance) ? U256.fromJSON(object.balance) : undefined,
3206
+ refundAddress: isSet(object.refundAddress) ? Address.fromJSON(object.refundAddress) : undefined,
3207
+ };
3208
+ },
3209
+
3210
+ toJSON(message: SelfDestructAction): unknown {
3211
+ const obj: any = {};
3212
+ if (message.address !== undefined) {
3213
+ obj.address = Address.toJSON(message.address);
3214
+ }
3215
+ if (message.balance !== undefined) {
3216
+ obj.balance = U256.toJSON(message.balance);
3217
+ }
3218
+ if (message.refundAddress !== undefined) {
3219
+ obj.refundAddress = Address.toJSON(message.refundAddress);
3220
+ }
3221
+ return obj;
3222
+ },
3223
+
3224
+ create(base?: DeepPartial<SelfDestructAction>): SelfDestructAction {
3225
+ return SelfDestructAction.fromPartial(base ?? {});
3226
+ },
3227
+ fromPartial(object: DeepPartial<SelfDestructAction>): SelfDestructAction {
3228
+ const message = createBaseSelfDestructAction() as any;
3229
+ message.address = (object.address !== undefined && object.address !== null)
3230
+ ? Address.fromPartial(object.address)
3231
+ : undefined;
3232
+ message.balance = (object.balance !== undefined && object.balance !== null)
3233
+ ? U256.fromPartial(object.balance)
3234
+ : undefined;
3235
+ message.refundAddress = (object.refundAddress !== undefined && object.refundAddress !== null)
3236
+ ? Address.fromPartial(object.refundAddress)
3237
+ : undefined;
3238
+ return message;
3239
+ },
3240
+ };
3241
+
3242
+ function createBaseRewardAction(): RewardAction {
3243
+ return { author: undefined, type: 0, value: undefined };
3244
+ }
3245
+
3246
+ export const RewardAction = {
3247
+ encode(message: RewardAction, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
3248
+ if (message.author !== undefined) {
3249
+ Address.encode(message.author, writer.uint32(10).fork()).ldelim();
3250
+ }
3251
+ if (message.type !== undefined && message.type !== 0) {
3252
+ writer.uint32(16).int32(message.type);
3253
+ }
3254
+ if (message.value !== undefined) {
3255
+ U256.encode(message.value, writer.uint32(26).fork()).ldelim();
3256
+ }
3257
+ return writer;
3258
+ },
3259
+
3260
+ decode(input: _m0.Reader | Uint8Array, length?: number): RewardAction {
3261
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
3262
+ let end = length === undefined ? reader.len : reader.pos + length;
3263
+ const message = createBaseRewardAction() as any;
3264
+ while (reader.pos < end) {
3265
+ const tag = reader.uint32();
3266
+ switch (tag >>> 3) {
3267
+ case 1:
3268
+ if (tag !== 10) {
3269
+ break;
3270
+ }
3271
+
3272
+ message.author = Address.decode(reader, reader.uint32());
3273
+ continue;
3274
+ case 2:
3275
+ if (tag !== 16) {
3276
+ break;
3277
+ }
3278
+
3279
+ message.type = reader.int32() as any;
3280
+ continue;
3281
+ case 3:
3282
+ if (tag !== 26) {
3283
+ break;
3284
+ }
3285
+
3286
+ message.value = U256.decode(reader, reader.uint32());
3287
+ continue;
3288
+ }
3289
+ if ((tag & 7) === 4 || tag === 0) {
3290
+ break;
3291
+ }
3292
+ reader.skipType(tag & 7);
3293
+ }
3294
+ return message;
3295
+ },
3296
+
3297
+ fromJSON(object: any): RewardAction {
3298
+ return {
3299
+ author: isSet(object.author) ? Address.fromJSON(object.author) : undefined,
3300
+ type: isSet(object.type) ? rewardTypeFromJSON(object.type) : 0,
3301
+ value: isSet(object.value) ? U256.fromJSON(object.value) : undefined,
3302
+ };
3303
+ },
3304
+
3305
+ toJSON(message: RewardAction): unknown {
3306
+ const obj: any = {};
3307
+ if (message.author !== undefined) {
3308
+ obj.author = Address.toJSON(message.author);
3309
+ }
3310
+ if (message.type !== undefined && message.type !== 0) {
3311
+ obj.type = rewardTypeToJSON(message.type);
3312
+ }
3313
+ if (message.value !== undefined) {
3314
+ obj.value = U256.toJSON(message.value);
3315
+ }
3316
+ return obj;
3317
+ },
3318
+
3319
+ create(base?: DeepPartial<RewardAction>): RewardAction {
3320
+ return RewardAction.fromPartial(base ?? {});
3321
+ },
3322
+ fromPartial(object: DeepPartial<RewardAction>): RewardAction {
3323
+ const message = createBaseRewardAction() as any;
3324
+ message.author = (object.author !== undefined && object.author !== null)
3325
+ ? Address.fromPartial(object.author)
3326
+ : undefined;
3327
+ message.type = object.type ?? 0;
3328
+ message.value = (object.value !== undefined && object.value !== null) ? U256.fromPartial(object.value) : undefined;
3329
+ return message;
3330
+ },
3331
+ };
3332
+
3333
+ function createBaseCallOutput(): CallOutput {
3334
+ return { gasUsed: BigInt("0"), output: new Uint8Array(0) };
3335
+ }
3336
+
3337
+ export const CallOutput = {
3338
+ encode(message: CallOutput, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
3339
+ if (message.gasUsed !== undefined && message.gasUsed !== BigInt("0")) {
3340
+ if (BigInt.asUintN(64, message.gasUsed) !== message.gasUsed) {
3341
+ throw new globalThis.Error("value provided for field message.gasUsed of type uint64 too large");
3342
+ }
3343
+ writer.uint32(8).uint64(message.gasUsed.toString());
3344
+ }
3345
+ if (message.output !== undefined && message.output.length !== 0) {
3346
+ writer.uint32(18).bytes(message.output);
3347
+ }
3348
+ return writer;
3349
+ },
3350
+
3351
+ decode(input: _m0.Reader | Uint8Array, length?: number): CallOutput {
3352
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
3353
+ let end = length === undefined ? reader.len : reader.pos + length;
3354
+ const message = createBaseCallOutput() as any;
3355
+ while (reader.pos < end) {
3356
+ const tag = reader.uint32();
3357
+ switch (tag >>> 3) {
3358
+ case 1:
3359
+ if (tag !== 8) {
3360
+ break;
3361
+ }
3362
+
3363
+ message.gasUsed = longToBigint(reader.uint64() as Long);
3364
+ continue;
3365
+ case 2:
3366
+ if (tag !== 18) {
3367
+ break;
3368
+ }
3369
+
3370
+ message.output = reader.bytes();
3371
+ continue;
3372
+ }
3373
+ if ((tag & 7) === 4 || tag === 0) {
3374
+ break;
3375
+ }
3376
+ reader.skipType(tag & 7);
3377
+ }
3378
+ return message;
3379
+ },
3380
+
3381
+ fromJSON(object: any): CallOutput {
3382
+ return {
3383
+ gasUsed: isSet(object.gasUsed) ? BigInt(object.gasUsed) : BigInt("0"),
3384
+ output: isSet(object.output) ? bytesFromBase64(object.output) : new Uint8Array(0),
3385
+ };
3386
+ },
3387
+
3388
+ toJSON(message: CallOutput): unknown {
3389
+ const obj: any = {};
3390
+ if (message.gasUsed !== undefined && message.gasUsed !== BigInt("0")) {
3391
+ obj.gasUsed = message.gasUsed.toString();
3392
+ }
3393
+ if (message.output !== undefined && message.output.length !== 0) {
3394
+ obj.output = base64FromBytes(message.output);
3395
+ }
3396
+ return obj;
3397
+ },
3398
+
3399
+ create(base?: DeepPartial<CallOutput>): CallOutput {
3400
+ return CallOutput.fromPartial(base ?? {});
3401
+ },
3402
+ fromPartial(object: DeepPartial<CallOutput>): CallOutput {
3403
+ const message = createBaseCallOutput() as any;
3404
+ message.gasUsed = object.gasUsed ?? BigInt("0");
3405
+ message.output = object.output ?? new Uint8Array(0);
3406
+ return message;
3407
+ },
3408
+ };
3409
+
3410
+ function createBaseCreateOutput(): CreateOutput {
3411
+ return { address: undefined, code: new Uint8Array(0), gasUsed: BigInt("0") };
3412
+ }
3413
+
3414
+ export const CreateOutput = {
3415
+ encode(message: CreateOutput, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
3416
+ if (message.address !== undefined) {
3417
+ Address.encode(message.address, writer.uint32(10).fork()).ldelim();
3418
+ }
3419
+ if (message.code !== undefined && message.code.length !== 0) {
3420
+ writer.uint32(18).bytes(message.code);
3421
+ }
3422
+ if (message.gasUsed !== undefined && message.gasUsed !== BigInt("0")) {
3423
+ if (BigInt.asUintN(64, message.gasUsed) !== message.gasUsed) {
3424
+ throw new globalThis.Error("value provided for field message.gasUsed of type uint64 too large");
3425
+ }
3426
+ writer.uint32(24).uint64(message.gasUsed.toString());
3427
+ }
3428
+ return writer;
3429
+ },
3430
+
3431
+ decode(input: _m0.Reader | Uint8Array, length?: number): CreateOutput {
3432
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
3433
+ let end = length === undefined ? reader.len : reader.pos + length;
3434
+ const message = createBaseCreateOutput() as any;
3435
+ while (reader.pos < end) {
3436
+ const tag = reader.uint32();
3437
+ switch (tag >>> 3) {
3438
+ case 1:
3439
+ if (tag !== 10) {
3440
+ break;
3441
+ }
3442
+
3443
+ message.address = Address.decode(reader, reader.uint32());
3444
+ continue;
3445
+ case 2:
3446
+ if (tag !== 18) {
3447
+ break;
3448
+ }
3449
+
3450
+ message.code = reader.bytes();
3451
+ continue;
3452
+ case 3:
3453
+ if (tag !== 24) {
3454
+ break;
3455
+ }
3456
+
3457
+ message.gasUsed = longToBigint(reader.uint64() as Long);
3458
+ continue;
3459
+ }
3460
+ if ((tag & 7) === 4 || tag === 0) {
3461
+ break;
3462
+ }
3463
+ reader.skipType(tag & 7);
3464
+ }
3465
+ return message;
3466
+ },
3467
+
3468
+ fromJSON(object: any): CreateOutput {
3469
+ return {
3470
+ address: isSet(object.address) ? Address.fromJSON(object.address) : undefined,
3471
+ code: isSet(object.code) ? bytesFromBase64(object.code) : new Uint8Array(0),
3472
+ gasUsed: isSet(object.gasUsed) ? BigInt(object.gasUsed) : BigInt("0"),
3473
+ };
3474
+ },
3475
+
3476
+ toJSON(message: CreateOutput): unknown {
3477
+ const obj: any = {};
3478
+ if (message.address !== undefined) {
3479
+ obj.address = Address.toJSON(message.address);
3480
+ }
3481
+ if (message.code !== undefined && message.code.length !== 0) {
3482
+ obj.code = base64FromBytes(message.code);
3483
+ }
3484
+ if (message.gasUsed !== undefined && message.gasUsed !== BigInt("0")) {
3485
+ obj.gasUsed = message.gasUsed.toString();
3486
+ }
3487
+ return obj;
3488
+ },
3489
+
3490
+ create(base?: DeepPartial<CreateOutput>): CreateOutput {
3491
+ return CreateOutput.fromPartial(base ?? {});
3492
+ },
3493
+ fromPartial(object: DeepPartial<CreateOutput>): CreateOutput {
3494
+ const message = createBaseCreateOutput() as any;
3495
+ message.address = (object.address !== undefined && object.address !== null)
3496
+ ? Address.fromPartial(object.address)
3497
+ : undefined;
3498
+ message.code = object.code ?? new Uint8Array(0);
3499
+ message.gasUsed = object.gasUsed ?? BigInt("0");
3500
+ return message;
3501
+ },
3502
+ };
3503
+
2222
3504
  function bytesFromBase64(b64: string): Uint8Array {
2223
3505
  if ((globalThis as any).Buffer) {
2224
3506
  return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));