@apibara/starknet 2.1.0-beta.5 → 2.1.0-beta.50

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
@@ -224,6 +224,51 @@ export function dataAvailabilityModeToJSON(object: DataAvailabilityMode): string
224
224
  }
225
225
  }
226
226
 
227
+ export enum CallType {
228
+ UNSPECIFIED = 0,
229
+ LIBRARY_CALL = 1,
230
+ CALL = 2,
231
+ DELEGATE = 3,
232
+ UNRECOGNIZED = -1,
233
+ }
234
+
235
+ export function callTypeFromJSON(object: any): CallType {
236
+ switch (object) {
237
+ case 0:
238
+ case "CALL_TYPE_UNSPECIFIED":
239
+ return CallType.UNSPECIFIED;
240
+ case 1:
241
+ case "CALL_TYPE_LIBRARY_CALL":
242
+ return CallType.LIBRARY_CALL;
243
+ case 2:
244
+ case "CALL_TYPE_CALL":
245
+ return CallType.CALL;
246
+ case 3:
247
+ case "CALL_TYPE_DELEGATE":
248
+ return CallType.DELEGATE;
249
+ case -1:
250
+ case "UNRECOGNIZED":
251
+ default:
252
+ return CallType.UNRECOGNIZED;
253
+ }
254
+ }
255
+
256
+ export function callTypeToJSON(object: CallType): string {
257
+ switch (object) {
258
+ case CallType.UNSPECIFIED:
259
+ return "CALL_TYPE_UNSPECIFIED";
260
+ case CallType.LIBRARY_CALL:
261
+ return "CALL_TYPE_LIBRARY_CALL";
262
+ case CallType.CALL:
263
+ return "CALL_TYPE_CALL";
264
+ case CallType.DELEGATE:
265
+ return "CALL_TYPE_DELEGATE";
266
+ case CallType.UNRECOGNIZED:
267
+ default:
268
+ return "UNRECOGNIZED";
269
+ }
270
+ }
271
+
227
272
  /** Requested data, grouped by block. */
228
273
  export interface Block {
229
274
  /** The header. */
@@ -255,7 +300,11 @@ export interface Block {
255
300
  | readonly ContractChange[]
256
301
  | undefined;
257
302
  /** List of nonce updates. */
258
- readonly nonceUpdates?: readonly NonceUpdate[] | undefined;
303
+ readonly nonceUpdates?:
304
+ | readonly NonceUpdate[]
305
+ | undefined;
306
+ /** List of transaction traces. */
307
+ readonly traces?: readonly TransactionTrace[] | undefined;
259
308
  }
260
309
 
261
310
  /** Block header. */
@@ -297,7 +346,11 @@ export interface BlockHeader {
297
346
  | ResourcePrice
298
347
  | undefined;
299
348
  /** L1 data availability mode. */
300
- readonly l1DataAvailabilityMode?: L1DataAvailabilityMode | undefined;
349
+ readonly l1DataAvailabilityMode?:
350
+ | L1DataAvailabilityMode
351
+ | undefined;
352
+ /** Price of L2 gas in the block. */
353
+ readonly l2GasPrice?: ResourcePrice | undefined;
301
354
  }
302
355
 
303
356
  /** A transaction. */
@@ -745,6 +798,67 @@ export interface NonceUpdate {
745
798
  readonly nonce?: FieldElement | undefined;
746
799
  }
747
800
 
801
+ export interface TransactionTrace {
802
+ readonly filterIds?:
803
+ | readonly number[]
804
+ | undefined;
805
+ /** Index of the transaction in the block. */
806
+ readonly transactionIndex?:
807
+ | number
808
+ | undefined;
809
+ /** Transaction hash. */
810
+ readonly transactionHash?: FieldElement | undefined;
811
+ readonly traceRoot?:
812
+ | { readonly $case: "invoke"; readonly invoke: InvokeTransactionTrace }
813
+ | { readonly $case: "declare"; readonly declare: DeclareTransactionTrace }
814
+ | { readonly $case: "deployAccount"; readonly deployAccount: DeployAccountTransactionTrace }
815
+ | { readonly $case: "l1Handler"; readonly l1Handler: L1HandlerTransactionTrace }
816
+ | undefined;
817
+ }
818
+
819
+ export interface InvokeTransactionTrace {
820
+ readonly validateInvocation?: FunctionInvocation | undefined;
821
+ readonly executeInvocation?: { readonly $case: "success"; readonly success: FunctionInvocation } | {
822
+ readonly $case: "reverted";
823
+ readonly reverted: ExecutionReverted;
824
+ } | undefined;
825
+ readonly feeTransferInvocation?: FunctionInvocation | undefined;
826
+ }
827
+
828
+ export interface DeclareTransactionTrace {
829
+ readonly validateInvocation?: FunctionInvocation | undefined;
830
+ readonly feeTransferInvocation?: FunctionInvocation | undefined;
831
+ }
832
+
833
+ export interface DeployAccountTransactionTrace {
834
+ readonly validateInvocation?: FunctionInvocation | undefined;
835
+ readonly constructorInvocation?: FunctionInvocation | undefined;
836
+ readonly feeTransferInvocation?: FunctionInvocation | undefined;
837
+ }
838
+
839
+ export interface L1HandlerTransactionTrace {
840
+ readonly functionInvocation?: FunctionInvocation | undefined;
841
+ }
842
+
843
+ export interface FunctionInvocation {
844
+ readonly contractAddress?: FieldElement | undefined;
845
+ readonly entryPointSelector?: FieldElement | undefined;
846
+ readonly calldata?: readonly FieldElement[] | undefined;
847
+ readonly callerAddress?: FieldElement | undefined;
848
+ readonly classHash?: FieldElement | undefined;
849
+ readonly callType?: CallType | undefined;
850
+ readonly result?: readonly FieldElement[] | undefined;
851
+ readonly calls?: readonly FunctionInvocation[] | undefined;
852
+ readonly events?: readonly number[] | undefined;
853
+ readonly messages?: readonly number[] | undefined;
854
+ }
855
+
856
+ export interface FunctionCall {
857
+ readonly contractAddress?: FieldElement | undefined;
858
+ readonly entryPointSelector?: FieldElement | undefined;
859
+ readonly calldata?: readonly FieldElement[] | undefined;
860
+ }
861
+
748
862
  function createBaseBlock(): Block {
749
863
  return {
750
864
  header: undefined,
@@ -755,6 +869,7 @@ function createBaseBlock(): Block {
755
869
  storageDiffs: [],
756
870
  contractChanges: [],
757
871
  nonceUpdates: [],
872
+ traces: [],
758
873
  };
759
874
  }
760
875
 
@@ -798,6 +913,11 @@ export const Block = {
798
913
  NonceUpdate.encode(v!, writer.uint32(66).fork()).ldelim();
799
914
  }
800
915
  }
916
+ if (message.traces !== undefined && message.traces.length !== 0) {
917
+ for (const v of message.traces) {
918
+ TransactionTrace.encode(v!, writer.uint32(74).fork()).ldelim();
919
+ }
920
+ }
801
921
  return writer;
802
922
  },
803
923
 
@@ -864,6 +984,13 @@ export const Block = {
864
984
 
865
985
  message.nonceUpdates!.push(NonceUpdate.decode(reader, reader.uint32()));
866
986
  continue;
987
+ case 9:
988
+ if (tag !== 74) {
989
+ break;
990
+ }
991
+
992
+ message.traces!.push(TransactionTrace.decode(reader, reader.uint32()));
993
+ continue;
867
994
  }
868
995
  if ((tag & 7) === 4 || tag === 0) {
869
996
  break;
@@ -895,6 +1022,9 @@ export const Block = {
895
1022
  nonceUpdates: globalThis.Array.isArray(object?.nonceUpdates)
896
1023
  ? object.nonceUpdates.map((e: any) => NonceUpdate.fromJSON(e))
897
1024
  : [],
1025
+ traces: globalThis.Array.isArray(object?.traces)
1026
+ ? object.traces.map((e: any) => TransactionTrace.fromJSON(e))
1027
+ : [],
898
1028
  };
899
1029
  },
900
1030
 
@@ -924,6 +1054,9 @@ export const Block = {
924
1054
  if (message.nonceUpdates?.length) {
925
1055
  obj.nonceUpdates = message.nonceUpdates.map((e) => NonceUpdate.toJSON(e));
926
1056
  }
1057
+ if (message.traces?.length) {
1058
+ obj.traces = message.traces.map((e) => TransactionTrace.toJSON(e));
1059
+ }
927
1060
  return obj;
928
1061
  },
929
1062
 
@@ -942,6 +1075,7 @@ export const Block = {
942
1075
  message.storageDiffs = object.storageDiffs?.map((e) => StorageDiff.fromPartial(e)) || [];
943
1076
  message.contractChanges = object.contractChanges?.map((e) => ContractChange.fromPartial(e)) || [];
944
1077
  message.nonceUpdates = object.nonceUpdates?.map((e) => NonceUpdate.fromPartial(e)) || [];
1078
+ message.traces = object.traces?.map((e) => TransactionTrace.fromPartial(e)) || [];
945
1079
  return message;
946
1080
  },
947
1081
  };
@@ -958,6 +1092,7 @@ function createBaseBlockHeader(): BlockHeader {
958
1092
  l1GasPrice: undefined,
959
1093
  l1DataGasPrice: undefined,
960
1094
  l1DataAvailabilityMode: 0,
1095
+ l2GasPrice: undefined,
961
1096
  };
962
1097
  }
963
1098
 
@@ -996,6 +1131,9 @@ export const BlockHeader = {
996
1131
  if (message.l1DataAvailabilityMode !== undefined && message.l1DataAvailabilityMode !== 0) {
997
1132
  writer.uint32(80).int32(message.l1DataAvailabilityMode);
998
1133
  }
1134
+ if (message.l2GasPrice !== undefined) {
1135
+ ResourcePrice.encode(message.l2GasPrice, writer.uint32(90).fork()).ldelim();
1136
+ }
999
1137
  return writer;
1000
1138
  },
1001
1139
 
@@ -1076,6 +1214,13 @@ export const BlockHeader = {
1076
1214
 
1077
1215
  message.l1DataAvailabilityMode = reader.int32() as any;
1078
1216
  continue;
1217
+ case 11:
1218
+ if (tag !== 90) {
1219
+ break;
1220
+ }
1221
+
1222
+ message.l2GasPrice = ResourcePrice.decode(reader, reader.uint32());
1223
+ continue;
1079
1224
  }
1080
1225
  if ((tag & 7) === 4 || tag === 0) {
1081
1226
  break;
@@ -1099,6 +1244,7 @@ export const BlockHeader = {
1099
1244
  l1DataAvailabilityMode: isSet(object.l1DataAvailabilityMode)
1100
1245
  ? l1DataAvailabilityModeFromJSON(object.l1DataAvailabilityMode)
1101
1246
  : 0,
1247
+ l2GasPrice: isSet(object.l2GasPrice) ? ResourcePrice.fromJSON(object.l2GasPrice) : undefined,
1102
1248
  };
1103
1249
  },
1104
1250
 
@@ -1134,6 +1280,9 @@ export const BlockHeader = {
1134
1280
  if (message.l1DataAvailabilityMode !== undefined && message.l1DataAvailabilityMode !== 0) {
1135
1281
  obj.l1DataAvailabilityMode = l1DataAvailabilityModeToJSON(message.l1DataAvailabilityMode);
1136
1282
  }
1283
+ if (message.l2GasPrice !== undefined) {
1284
+ obj.l2GasPrice = ResourcePrice.toJSON(message.l2GasPrice);
1285
+ }
1137
1286
  return obj;
1138
1287
  },
1139
1288
 
@@ -1164,6 +1313,9 @@ export const BlockHeader = {
1164
1313
  ? ResourcePrice.fromPartial(object.l1DataGasPrice)
1165
1314
  : undefined;
1166
1315
  message.l1DataAvailabilityMode = object.l1DataAvailabilityMode ?? 0;
1316
+ message.l2GasPrice = (object.l2GasPrice !== undefined && object.l2GasPrice !== null)
1317
+ ? ResourcePrice.fromPartial(object.l2GasPrice)
1318
+ : undefined;
1167
1319
  return message;
1168
1320
  },
1169
1321
  };
@@ -6069,6 +6221,956 @@ export const NonceUpdate = {
6069
6221
  },
6070
6222
  };
6071
6223
 
6224
+ function createBaseTransactionTrace(): TransactionTrace {
6225
+ return { filterIds: [], transactionIndex: 0, transactionHash: undefined, traceRoot: undefined };
6226
+ }
6227
+
6228
+ export const TransactionTrace = {
6229
+ encode(message: TransactionTrace, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
6230
+ if (message.filterIds !== undefined && message.filterIds.length !== 0) {
6231
+ writer.uint32(10).fork();
6232
+ for (const v of message.filterIds) {
6233
+ writer.uint32(v);
6234
+ }
6235
+ writer.ldelim();
6236
+ }
6237
+ if (message.transactionIndex !== undefined && message.transactionIndex !== 0) {
6238
+ writer.uint32(16).uint32(message.transactionIndex);
6239
+ }
6240
+ if (message.transactionHash !== undefined) {
6241
+ FieldElement.encode(message.transactionHash, writer.uint32(26).fork()).ldelim();
6242
+ }
6243
+ switch (message.traceRoot?.$case) {
6244
+ case "invoke":
6245
+ InvokeTransactionTrace.encode(message.traceRoot.invoke, writer.uint32(34).fork()).ldelim();
6246
+ break;
6247
+ case "declare":
6248
+ DeclareTransactionTrace.encode(message.traceRoot.declare, writer.uint32(42).fork()).ldelim();
6249
+ break;
6250
+ case "deployAccount":
6251
+ DeployAccountTransactionTrace.encode(message.traceRoot.deployAccount, writer.uint32(50).fork()).ldelim();
6252
+ break;
6253
+ case "l1Handler":
6254
+ L1HandlerTransactionTrace.encode(message.traceRoot.l1Handler, writer.uint32(58).fork()).ldelim();
6255
+ break;
6256
+ }
6257
+ return writer;
6258
+ },
6259
+
6260
+ decode(input: _m0.Reader | Uint8Array, length?: number): TransactionTrace {
6261
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
6262
+ let end = length === undefined ? reader.len : reader.pos + length;
6263
+ const message = createBaseTransactionTrace() as any;
6264
+ while (reader.pos < end) {
6265
+ const tag = reader.uint32();
6266
+ switch (tag >>> 3) {
6267
+ case 1:
6268
+ if (tag === 8) {
6269
+ message.filterIds!.push(reader.uint32());
6270
+
6271
+ continue;
6272
+ }
6273
+
6274
+ if (tag === 10) {
6275
+ const end2 = reader.uint32() + reader.pos;
6276
+ while (reader.pos < end2) {
6277
+ message.filterIds!.push(reader.uint32());
6278
+ }
6279
+
6280
+ continue;
6281
+ }
6282
+
6283
+ break;
6284
+ case 2:
6285
+ if (tag !== 16) {
6286
+ break;
6287
+ }
6288
+
6289
+ message.transactionIndex = reader.uint32();
6290
+ continue;
6291
+ case 3:
6292
+ if (tag !== 26) {
6293
+ break;
6294
+ }
6295
+
6296
+ message.transactionHash = FieldElement.decode(reader, reader.uint32());
6297
+ continue;
6298
+ case 4:
6299
+ if (tag !== 34) {
6300
+ break;
6301
+ }
6302
+
6303
+ message.traceRoot = { $case: "invoke", invoke: InvokeTransactionTrace.decode(reader, reader.uint32()) };
6304
+ continue;
6305
+ case 5:
6306
+ if (tag !== 42) {
6307
+ break;
6308
+ }
6309
+
6310
+ message.traceRoot = { $case: "declare", declare: DeclareTransactionTrace.decode(reader, reader.uint32()) };
6311
+ continue;
6312
+ case 6:
6313
+ if (tag !== 50) {
6314
+ break;
6315
+ }
6316
+
6317
+ message.traceRoot = {
6318
+ $case: "deployAccount",
6319
+ deployAccount: DeployAccountTransactionTrace.decode(reader, reader.uint32()),
6320
+ };
6321
+ continue;
6322
+ case 7:
6323
+ if (tag !== 58) {
6324
+ break;
6325
+ }
6326
+
6327
+ message.traceRoot = {
6328
+ $case: "l1Handler",
6329
+ l1Handler: L1HandlerTransactionTrace.decode(reader, reader.uint32()),
6330
+ };
6331
+ continue;
6332
+ }
6333
+ if ((tag & 7) === 4 || tag === 0) {
6334
+ break;
6335
+ }
6336
+ reader.skipType(tag & 7);
6337
+ }
6338
+ return message;
6339
+ },
6340
+
6341
+ fromJSON(object: any): TransactionTrace {
6342
+ return {
6343
+ filterIds: globalThis.Array.isArray(object?.filterIds)
6344
+ ? object.filterIds.map((e: any) => globalThis.Number(e))
6345
+ : [],
6346
+ transactionIndex: isSet(object.transactionIndex) ? globalThis.Number(object.transactionIndex) : 0,
6347
+ transactionHash: isSet(object.transactionHash) ? FieldElement.fromJSON(object.transactionHash) : undefined,
6348
+ traceRoot: isSet(object.invoke)
6349
+ ? { $case: "invoke", invoke: InvokeTransactionTrace.fromJSON(object.invoke) }
6350
+ : isSet(object.declare)
6351
+ ? { $case: "declare", declare: DeclareTransactionTrace.fromJSON(object.declare) }
6352
+ : isSet(object.deployAccount)
6353
+ ? { $case: "deployAccount", deployAccount: DeployAccountTransactionTrace.fromJSON(object.deployAccount) }
6354
+ : isSet(object.l1Handler)
6355
+ ? { $case: "l1Handler", l1Handler: L1HandlerTransactionTrace.fromJSON(object.l1Handler) }
6356
+ : undefined,
6357
+ };
6358
+ },
6359
+
6360
+ toJSON(message: TransactionTrace): unknown {
6361
+ const obj: any = {};
6362
+ if (message.filterIds?.length) {
6363
+ obj.filterIds = message.filterIds.map((e) => Math.round(e));
6364
+ }
6365
+ if (message.transactionIndex !== undefined && message.transactionIndex !== 0) {
6366
+ obj.transactionIndex = Math.round(message.transactionIndex);
6367
+ }
6368
+ if (message.transactionHash !== undefined) {
6369
+ obj.transactionHash = FieldElement.toJSON(message.transactionHash);
6370
+ }
6371
+ if (message.traceRoot?.$case === "invoke") {
6372
+ obj.invoke = InvokeTransactionTrace.toJSON(message.traceRoot.invoke);
6373
+ }
6374
+ if (message.traceRoot?.$case === "declare") {
6375
+ obj.declare = DeclareTransactionTrace.toJSON(message.traceRoot.declare);
6376
+ }
6377
+ if (message.traceRoot?.$case === "deployAccount") {
6378
+ obj.deployAccount = DeployAccountTransactionTrace.toJSON(message.traceRoot.deployAccount);
6379
+ }
6380
+ if (message.traceRoot?.$case === "l1Handler") {
6381
+ obj.l1Handler = L1HandlerTransactionTrace.toJSON(message.traceRoot.l1Handler);
6382
+ }
6383
+ return obj;
6384
+ },
6385
+
6386
+ create(base?: DeepPartial<TransactionTrace>): TransactionTrace {
6387
+ return TransactionTrace.fromPartial(base ?? {});
6388
+ },
6389
+ fromPartial(object: DeepPartial<TransactionTrace>): TransactionTrace {
6390
+ const message = createBaseTransactionTrace() as any;
6391
+ message.filterIds = object.filterIds?.map((e) => e) || [];
6392
+ message.transactionIndex = object.transactionIndex ?? 0;
6393
+ message.transactionHash = (object.transactionHash !== undefined && object.transactionHash !== null)
6394
+ ? FieldElement.fromPartial(object.transactionHash)
6395
+ : undefined;
6396
+ if (
6397
+ object.traceRoot?.$case === "invoke" &&
6398
+ object.traceRoot?.invoke !== undefined &&
6399
+ object.traceRoot?.invoke !== null
6400
+ ) {
6401
+ message.traceRoot = { $case: "invoke", invoke: InvokeTransactionTrace.fromPartial(object.traceRoot.invoke) };
6402
+ }
6403
+ if (
6404
+ object.traceRoot?.$case === "declare" &&
6405
+ object.traceRoot?.declare !== undefined &&
6406
+ object.traceRoot?.declare !== null
6407
+ ) {
6408
+ message.traceRoot = { $case: "declare", declare: DeclareTransactionTrace.fromPartial(object.traceRoot.declare) };
6409
+ }
6410
+ if (
6411
+ object.traceRoot?.$case === "deployAccount" &&
6412
+ object.traceRoot?.deployAccount !== undefined &&
6413
+ object.traceRoot?.deployAccount !== null
6414
+ ) {
6415
+ message.traceRoot = {
6416
+ $case: "deployAccount",
6417
+ deployAccount: DeployAccountTransactionTrace.fromPartial(object.traceRoot.deployAccount),
6418
+ };
6419
+ }
6420
+ if (
6421
+ object.traceRoot?.$case === "l1Handler" &&
6422
+ object.traceRoot?.l1Handler !== undefined &&
6423
+ object.traceRoot?.l1Handler !== null
6424
+ ) {
6425
+ message.traceRoot = {
6426
+ $case: "l1Handler",
6427
+ l1Handler: L1HandlerTransactionTrace.fromPartial(object.traceRoot.l1Handler),
6428
+ };
6429
+ }
6430
+ return message;
6431
+ },
6432
+ };
6433
+
6434
+ function createBaseInvokeTransactionTrace(): InvokeTransactionTrace {
6435
+ return { validateInvocation: undefined, executeInvocation: undefined, feeTransferInvocation: undefined };
6436
+ }
6437
+
6438
+ export const InvokeTransactionTrace = {
6439
+ encode(message: InvokeTransactionTrace, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
6440
+ if (message.validateInvocation !== undefined) {
6441
+ FunctionInvocation.encode(message.validateInvocation, writer.uint32(10).fork()).ldelim();
6442
+ }
6443
+ switch (message.executeInvocation?.$case) {
6444
+ case "success":
6445
+ FunctionInvocation.encode(message.executeInvocation.success, writer.uint32(18).fork()).ldelim();
6446
+ break;
6447
+ case "reverted":
6448
+ ExecutionReverted.encode(message.executeInvocation.reverted, writer.uint32(26).fork()).ldelim();
6449
+ break;
6450
+ }
6451
+ if (message.feeTransferInvocation !== undefined) {
6452
+ FunctionInvocation.encode(message.feeTransferInvocation, writer.uint32(34).fork()).ldelim();
6453
+ }
6454
+ return writer;
6455
+ },
6456
+
6457
+ decode(input: _m0.Reader | Uint8Array, length?: number): InvokeTransactionTrace {
6458
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
6459
+ let end = length === undefined ? reader.len : reader.pos + length;
6460
+ const message = createBaseInvokeTransactionTrace() as any;
6461
+ while (reader.pos < end) {
6462
+ const tag = reader.uint32();
6463
+ switch (tag >>> 3) {
6464
+ case 1:
6465
+ if (tag !== 10) {
6466
+ break;
6467
+ }
6468
+
6469
+ message.validateInvocation = FunctionInvocation.decode(reader, reader.uint32());
6470
+ continue;
6471
+ case 2:
6472
+ if (tag !== 18) {
6473
+ break;
6474
+ }
6475
+
6476
+ message.executeInvocation = { $case: "success", success: FunctionInvocation.decode(reader, reader.uint32()) };
6477
+ continue;
6478
+ case 3:
6479
+ if (tag !== 26) {
6480
+ break;
6481
+ }
6482
+
6483
+ message.executeInvocation = {
6484
+ $case: "reverted",
6485
+ reverted: ExecutionReverted.decode(reader, reader.uint32()),
6486
+ };
6487
+ continue;
6488
+ case 4:
6489
+ if (tag !== 34) {
6490
+ break;
6491
+ }
6492
+
6493
+ message.feeTransferInvocation = FunctionInvocation.decode(reader, reader.uint32());
6494
+ continue;
6495
+ }
6496
+ if ((tag & 7) === 4 || tag === 0) {
6497
+ break;
6498
+ }
6499
+ reader.skipType(tag & 7);
6500
+ }
6501
+ return message;
6502
+ },
6503
+
6504
+ fromJSON(object: any): InvokeTransactionTrace {
6505
+ return {
6506
+ validateInvocation: isSet(object.validateInvocation)
6507
+ ? FunctionInvocation.fromJSON(object.validateInvocation)
6508
+ : undefined,
6509
+ executeInvocation: isSet(object.success)
6510
+ ? { $case: "success", success: FunctionInvocation.fromJSON(object.success) }
6511
+ : isSet(object.reverted)
6512
+ ? { $case: "reverted", reverted: ExecutionReverted.fromJSON(object.reverted) }
6513
+ : undefined,
6514
+ feeTransferInvocation: isSet(object.feeTransferInvocation)
6515
+ ? FunctionInvocation.fromJSON(object.feeTransferInvocation)
6516
+ : undefined,
6517
+ };
6518
+ },
6519
+
6520
+ toJSON(message: InvokeTransactionTrace): unknown {
6521
+ const obj: any = {};
6522
+ if (message.validateInvocation !== undefined) {
6523
+ obj.validateInvocation = FunctionInvocation.toJSON(message.validateInvocation);
6524
+ }
6525
+ if (message.executeInvocation?.$case === "success") {
6526
+ obj.success = FunctionInvocation.toJSON(message.executeInvocation.success);
6527
+ }
6528
+ if (message.executeInvocation?.$case === "reverted") {
6529
+ obj.reverted = ExecutionReverted.toJSON(message.executeInvocation.reverted);
6530
+ }
6531
+ if (message.feeTransferInvocation !== undefined) {
6532
+ obj.feeTransferInvocation = FunctionInvocation.toJSON(message.feeTransferInvocation);
6533
+ }
6534
+ return obj;
6535
+ },
6536
+
6537
+ create(base?: DeepPartial<InvokeTransactionTrace>): InvokeTransactionTrace {
6538
+ return InvokeTransactionTrace.fromPartial(base ?? {});
6539
+ },
6540
+ fromPartial(object: DeepPartial<InvokeTransactionTrace>): InvokeTransactionTrace {
6541
+ const message = createBaseInvokeTransactionTrace() as any;
6542
+ message.validateInvocation = (object.validateInvocation !== undefined && object.validateInvocation !== null)
6543
+ ? FunctionInvocation.fromPartial(object.validateInvocation)
6544
+ : undefined;
6545
+ if (
6546
+ object.executeInvocation?.$case === "success" &&
6547
+ object.executeInvocation?.success !== undefined &&
6548
+ object.executeInvocation?.success !== null
6549
+ ) {
6550
+ message.executeInvocation = {
6551
+ $case: "success",
6552
+ success: FunctionInvocation.fromPartial(object.executeInvocation.success),
6553
+ };
6554
+ }
6555
+ if (
6556
+ object.executeInvocation?.$case === "reverted" &&
6557
+ object.executeInvocation?.reverted !== undefined &&
6558
+ object.executeInvocation?.reverted !== null
6559
+ ) {
6560
+ message.executeInvocation = {
6561
+ $case: "reverted",
6562
+ reverted: ExecutionReverted.fromPartial(object.executeInvocation.reverted),
6563
+ };
6564
+ }
6565
+ message.feeTransferInvocation =
6566
+ (object.feeTransferInvocation !== undefined && object.feeTransferInvocation !== null)
6567
+ ? FunctionInvocation.fromPartial(object.feeTransferInvocation)
6568
+ : undefined;
6569
+ return message;
6570
+ },
6571
+ };
6572
+
6573
+ function createBaseDeclareTransactionTrace(): DeclareTransactionTrace {
6574
+ return { validateInvocation: undefined, feeTransferInvocation: undefined };
6575
+ }
6576
+
6577
+ export const DeclareTransactionTrace = {
6578
+ encode(message: DeclareTransactionTrace, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
6579
+ if (message.validateInvocation !== undefined) {
6580
+ FunctionInvocation.encode(message.validateInvocation, writer.uint32(10).fork()).ldelim();
6581
+ }
6582
+ if (message.feeTransferInvocation !== undefined) {
6583
+ FunctionInvocation.encode(message.feeTransferInvocation, writer.uint32(18).fork()).ldelim();
6584
+ }
6585
+ return writer;
6586
+ },
6587
+
6588
+ decode(input: _m0.Reader | Uint8Array, length?: number): DeclareTransactionTrace {
6589
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
6590
+ let end = length === undefined ? reader.len : reader.pos + length;
6591
+ const message = createBaseDeclareTransactionTrace() as any;
6592
+ while (reader.pos < end) {
6593
+ const tag = reader.uint32();
6594
+ switch (tag >>> 3) {
6595
+ case 1:
6596
+ if (tag !== 10) {
6597
+ break;
6598
+ }
6599
+
6600
+ message.validateInvocation = FunctionInvocation.decode(reader, reader.uint32());
6601
+ continue;
6602
+ case 2:
6603
+ if (tag !== 18) {
6604
+ break;
6605
+ }
6606
+
6607
+ message.feeTransferInvocation = FunctionInvocation.decode(reader, reader.uint32());
6608
+ continue;
6609
+ }
6610
+ if ((tag & 7) === 4 || tag === 0) {
6611
+ break;
6612
+ }
6613
+ reader.skipType(tag & 7);
6614
+ }
6615
+ return message;
6616
+ },
6617
+
6618
+ fromJSON(object: any): DeclareTransactionTrace {
6619
+ return {
6620
+ validateInvocation: isSet(object.validateInvocation)
6621
+ ? FunctionInvocation.fromJSON(object.validateInvocation)
6622
+ : undefined,
6623
+ feeTransferInvocation: isSet(object.feeTransferInvocation)
6624
+ ? FunctionInvocation.fromJSON(object.feeTransferInvocation)
6625
+ : undefined,
6626
+ };
6627
+ },
6628
+
6629
+ toJSON(message: DeclareTransactionTrace): unknown {
6630
+ const obj: any = {};
6631
+ if (message.validateInvocation !== undefined) {
6632
+ obj.validateInvocation = FunctionInvocation.toJSON(message.validateInvocation);
6633
+ }
6634
+ if (message.feeTransferInvocation !== undefined) {
6635
+ obj.feeTransferInvocation = FunctionInvocation.toJSON(message.feeTransferInvocation);
6636
+ }
6637
+ return obj;
6638
+ },
6639
+
6640
+ create(base?: DeepPartial<DeclareTransactionTrace>): DeclareTransactionTrace {
6641
+ return DeclareTransactionTrace.fromPartial(base ?? {});
6642
+ },
6643
+ fromPartial(object: DeepPartial<DeclareTransactionTrace>): DeclareTransactionTrace {
6644
+ const message = createBaseDeclareTransactionTrace() as any;
6645
+ message.validateInvocation = (object.validateInvocation !== undefined && object.validateInvocation !== null)
6646
+ ? FunctionInvocation.fromPartial(object.validateInvocation)
6647
+ : undefined;
6648
+ message.feeTransferInvocation =
6649
+ (object.feeTransferInvocation !== undefined && object.feeTransferInvocation !== null)
6650
+ ? FunctionInvocation.fromPartial(object.feeTransferInvocation)
6651
+ : undefined;
6652
+ return message;
6653
+ },
6654
+ };
6655
+
6656
+ function createBaseDeployAccountTransactionTrace(): DeployAccountTransactionTrace {
6657
+ return { validateInvocation: undefined, constructorInvocation: undefined, feeTransferInvocation: undefined };
6658
+ }
6659
+
6660
+ export const DeployAccountTransactionTrace = {
6661
+ encode(message: DeployAccountTransactionTrace, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
6662
+ if (message.validateInvocation !== undefined) {
6663
+ FunctionInvocation.encode(message.validateInvocation, writer.uint32(10).fork()).ldelim();
6664
+ }
6665
+ if (message.constructorInvocation !== undefined) {
6666
+ FunctionInvocation.encode(message.constructorInvocation, writer.uint32(18).fork()).ldelim();
6667
+ }
6668
+ if (message.feeTransferInvocation !== undefined) {
6669
+ FunctionInvocation.encode(message.feeTransferInvocation, writer.uint32(26).fork()).ldelim();
6670
+ }
6671
+ return writer;
6672
+ },
6673
+
6674
+ decode(input: _m0.Reader | Uint8Array, length?: number): DeployAccountTransactionTrace {
6675
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
6676
+ let end = length === undefined ? reader.len : reader.pos + length;
6677
+ const message = createBaseDeployAccountTransactionTrace() as any;
6678
+ while (reader.pos < end) {
6679
+ const tag = reader.uint32();
6680
+ switch (tag >>> 3) {
6681
+ case 1:
6682
+ if (tag !== 10) {
6683
+ break;
6684
+ }
6685
+
6686
+ message.validateInvocation = FunctionInvocation.decode(reader, reader.uint32());
6687
+ continue;
6688
+ case 2:
6689
+ if (tag !== 18) {
6690
+ break;
6691
+ }
6692
+
6693
+ message.constructorInvocation = FunctionInvocation.decode(reader, reader.uint32());
6694
+ continue;
6695
+ case 3:
6696
+ if (tag !== 26) {
6697
+ break;
6698
+ }
6699
+
6700
+ message.feeTransferInvocation = FunctionInvocation.decode(reader, reader.uint32());
6701
+ continue;
6702
+ }
6703
+ if ((tag & 7) === 4 || tag === 0) {
6704
+ break;
6705
+ }
6706
+ reader.skipType(tag & 7);
6707
+ }
6708
+ return message;
6709
+ },
6710
+
6711
+ fromJSON(object: any): DeployAccountTransactionTrace {
6712
+ return {
6713
+ validateInvocation: isSet(object.validateInvocation)
6714
+ ? FunctionInvocation.fromJSON(object.validateInvocation)
6715
+ : undefined,
6716
+ constructorInvocation: isSet(object.constructorInvocation)
6717
+ ? FunctionInvocation.fromJSON(object.constructorInvocation)
6718
+ : undefined,
6719
+ feeTransferInvocation: isSet(object.feeTransferInvocation)
6720
+ ? FunctionInvocation.fromJSON(object.feeTransferInvocation)
6721
+ : undefined,
6722
+ };
6723
+ },
6724
+
6725
+ toJSON(message: DeployAccountTransactionTrace): unknown {
6726
+ const obj: any = {};
6727
+ if (message.validateInvocation !== undefined) {
6728
+ obj.validateInvocation = FunctionInvocation.toJSON(message.validateInvocation);
6729
+ }
6730
+ if (message.constructorInvocation !== undefined) {
6731
+ obj.constructorInvocation = FunctionInvocation.toJSON(message.constructorInvocation);
6732
+ }
6733
+ if (message.feeTransferInvocation !== undefined) {
6734
+ obj.feeTransferInvocation = FunctionInvocation.toJSON(message.feeTransferInvocation);
6735
+ }
6736
+ return obj;
6737
+ },
6738
+
6739
+ create(base?: DeepPartial<DeployAccountTransactionTrace>): DeployAccountTransactionTrace {
6740
+ return DeployAccountTransactionTrace.fromPartial(base ?? {});
6741
+ },
6742
+ fromPartial(object: DeepPartial<DeployAccountTransactionTrace>): DeployAccountTransactionTrace {
6743
+ const message = createBaseDeployAccountTransactionTrace() as any;
6744
+ message.validateInvocation = (object.validateInvocation !== undefined && object.validateInvocation !== null)
6745
+ ? FunctionInvocation.fromPartial(object.validateInvocation)
6746
+ : undefined;
6747
+ message.constructorInvocation =
6748
+ (object.constructorInvocation !== undefined && object.constructorInvocation !== null)
6749
+ ? FunctionInvocation.fromPartial(object.constructorInvocation)
6750
+ : undefined;
6751
+ message.feeTransferInvocation =
6752
+ (object.feeTransferInvocation !== undefined && object.feeTransferInvocation !== null)
6753
+ ? FunctionInvocation.fromPartial(object.feeTransferInvocation)
6754
+ : undefined;
6755
+ return message;
6756
+ },
6757
+ };
6758
+
6759
+ function createBaseL1HandlerTransactionTrace(): L1HandlerTransactionTrace {
6760
+ return { functionInvocation: undefined };
6761
+ }
6762
+
6763
+ export const L1HandlerTransactionTrace = {
6764
+ encode(message: L1HandlerTransactionTrace, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
6765
+ if (message.functionInvocation !== undefined) {
6766
+ FunctionInvocation.encode(message.functionInvocation, writer.uint32(18).fork()).ldelim();
6767
+ }
6768
+ return writer;
6769
+ },
6770
+
6771
+ decode(input: _m0.Reader | Uint8Array, length?: number): L1HandlerTransactionTrace {
6772
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
6773
+ let end = length === undefined ? reader.len : reader.pos + length;
6774
+ const message = createBaseL1HandlerTransactionTrace() as any;
6775
+ while (reader.pos < end) {
6776
+ const tag = reader.uint32();
6777
+ switch (tag >>> 3) {
6778
+ case 2:
6779
+ if (tag !== 18) {
6780
+ break;
6781
+ }
6782
+
6783
+ message.functionInvocation = FunctionInvocation.decode(reader, reader.uint32());
6784
+ continue;
6785
+ }
6786
+ if ((tag & 7) === 4 || tag === 0) {
6787
+ break;
6788
+ }
6789
+ reader.skipType(tag & 7);
6790
+ }
6791
+ return message;
6792
+ },
6793
+
6794
+ fromJSON(object: any): L1HandlerTransactionTrace {
6795
+ return {
6796
+ functionInvocation: isSet(object.functionInvocation)
6797
+ ? FunctionInvocation.fromJSON(object.functionInvocation)
6798
+ : undefined,
6799
+ };
6800
+ },
6801
+
6802
+ toJSON(message: L1HandlerTransactionTrace): unknown {
6803
+ const obj: any = {};
6804
+ if (message.functionInvocation !== undefined) {
6805
+ obj.functionInvocation = FunctionInvocation.toJSON(message.functionInvocation);
6806
+ }
6807
+ return obj;
6808
+ },
6809
+
6810
+ create(base?: DeepPartial<L1HandlerTransactionTrace>): L1HandlerTransactionTrace {
6811
+ return L1HandlerTransactionTrace.fromPartial(base ?? {});
6812
+ },
6813
+ fromPartial(object: DeepPartial<L1HandlerTransactionTrace>): L1HandlerTransactionTrace {
6814
+ const message = createBaseL1HandlerTransactionTrace() as any;
6815
+ message.functionInvocation = (object.functionInvocation !== undefined && object.functionInvocation !== null)
6816
+ ? FunctionInvocation.fromPartial(object.functionInvocation)
6817
+ : undefined;
6818
+ return message;
6819
+ },
6820
+ };
6821
+
6822
+ function createBaseFunctionInvocation(): FunctionInvocation {
6823
+ return {
6824
+ contractAddress: undefined,
6825
+ entryPointSelector: undefined,
6826
+ calldata: [],
6827
+ callerAddress: undefined,
6828
+ classHash: undefined,
6829
+ callType: 0,
6830
+ result: [],
6831
+ calls: [],
6832
+ events: [],
6833
+ messages: [],
6834
+ };
6835
+ }
6836
+
6837
+ export const FunctionInvocation = {
6838
+ encode(message: FunctionInvocation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
6839
+ if (message.contractAddress !== undefined) {
6840
+ FieldElement.encode(message.contractAddress, writer.uint32(10).fork()).ldelim();
6841
+ }
6842
+ if (message.entryPointSelector !== undefined) {
6843
+ FieldElement.encode(message.entryPointSelector, writer.uint32(18).fork()).ldelim();
6844
+ }
6845
+ if (message.calldata !== undefined && message.calldata.length !== 0) {
6846
+ for (const v of message.calldata) {
6847
+ FieldElement.encode(v!, writer.uint32(26).fork()).ldelim();
6848
+ }
6849
+ }
6850
+ if (message.callerAddress !== undefined) {
6851
+ FieldElement.encode(message.callerAddress, writer.uint32(34).fork()).ldelim();
6852
+ }
6853
+ if (message.classHash !== undefined) {
6854
+ FieldElement.encode(message.classHash, writer.uint32(42).fork()).ldelim();
6855
+ }
6856
+ if (message.callType !== undefined && message.callType !== 0) {
6857
+ writer.uint32(48).int32(message.callType);
6858
+ }
6859
+ if (message.result !== undefined && message.result.length !== 0) {
6860
+ for (const v of message.result) {
6861
+ FieldElement.encode(v!, writer.uint32(58).fork()).ldelim();
6862
+ }
6863
+ }
6864
+ if (message.calls !== undefined && message.calls.length !== 0) {
6865
+ for (const v of message.calls) {
6866
+ FunctionInvocation.encode(v!, writer.uint32(66).fork()).ldelim();
6867
+ }
6868
+ }
6869
+ if (message.events !== undefined && message.events.length !== 0) {
6870
+ writer.uint32(74).fork();
6871
+ for (const v of message.events) {
6872
+ writer.uint32(v);
6873
+ }
6874
+ writer.ldelim();
6875
+ }
6876
+ if (message.messages !== undefined && message.messages.length !== 0) {
6877
+ writer.uint32(82).fork();
6878
+ for (const v of message.messages) {
6879
+ writer.uint32(v);
6880
+ }
6881
+ writer.ldelim();
6882
+ }
6883
+ return writer;
6884
+ },
6885
+
6886
+ decode(input: _m0.Reader | Uint8Array, length?: number): FunctionInvocation {
6887
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
6888
+ let end = length === undefined ? reader.len : reader.pos + length;
6889
+ const message = createBaseFunctionInvocation() as any;
6890
+ while (reader.pos < end) {
6891
+ const tag = reader.uint32();
6892
+ switch (tag >>> 3) {
6893
+ case 1:
6894
+ if (tag !== 10) {
6895
+ break;
6896
+ }
6897
+
6898
+ message.contractAddress = FieldElement.decode(reader, reader.uint32());
6899
+ continue;
6900
+ case 2:
6901
+ if (tag !== 18) {
6902
+ break;
6903
+ }
6904
+
6905
+ message.entryPointSelector = FieldElement.decode(reader, reader.uint32());
6906
+ continue;
6907
+ case 3:
6908
+ if (tag !== 26) {
6909
+ break;
6910
+ }
6911
+
6912
+ message.calldata!.push(FieldElement.decode(reader, reader.uint32()));
6913
+ continue;
6914
+ case 4:
6915
+ if (tag !== 34) {
6916
+ break;
6917
+ }
6918
+
6919
+ message.callerAddress = FieldElement.decode(reader, reader.uint32());
6920
+ continue;
6921
+ case 5:
6922
+ if (tag !== 42) {
6923
+ break;
6924
+ }
6925
+
6926
+ message.classHash = FieldElement.decode(reader, reader.uint32());
6927
+ continue;
6928
+ case 6:
6929
+ if (tag !== 48) {
6930
+ break;
6931
+ }
6932
+
6933
+ message.callType = reader.int32() as any;
6934
+ continue;
6935
+ case 7:
6936
+ if (tag !== 58) {
6937
+ break;
6938
+ }
6939
+
6940
+ message.result!.push(FieldElement.decode(reader, reader.uint32()));
6941
+ continue;
6942
+ case 8:
6943
+ if (tag !== 66) {
6944
+ break;
6945
+ }
6946
+
6947
+ message.calls!.push(FunctionInvocation.decode(reader, reader.uint32()));
6948
+ continue;
6949
+ case 9:
6950
+ if (tag === 72) {
6951
+ message.events!.push(reader.uint32());
6952
+
6953
+ continue;
6954
+ }
6955
+
6956
+ if (tag === 74) {
6957
+ const end2 = reader.uint32() + reader.pos;
6958
+ while (reader.pos < end2) {
6959
+ message.events!.push(reader.uint32());
6960
+ }
6961
+
6962
+ continue;
6963
+ }
6964
+
6965
+ break;
6966
+ case 10:
6967
+ if (tag === 80) {
6968
+ message.messages!.push(reader.uint32());
6969
+
6970
+ continue;
6971
+ }
6972
+
6973
+ if (tag === 82) {
6974
+ const end2 = reader.uint32() + reader.pos;
6975
+ while (reader.pos < end2) {
6976
+ message.messages!.push(reader.uint32());
6977
+ }
6978
+
6979
+ continue;
6980
+ }
6981
+
6982
+ break;
6983
+ }
6984
+ if ((tag & 7) === 4 || tag === 0) {
6985
+ break;
6986
+ }
6987
+ reader.skipType(tag & 7);
6988
+ }
6989
+ return message;
6990
+ },
6991
+
6992
+ fromJSON(object: any): FunctionInvocation {
6993
+ return {
6994
+ contractAddress: isSet(object.contractAddress) ? FieldElement.fromJSON(object.contractAddress) : undefined,
6995
+ entryPointSelector: isSet(object.entryPointSelector)
6996
+ ? FieldElement.fromJSON(object.entryPointSelector)
6997
+ : undefined,
6998
+ calldata: globalThis.Array.isArray(object?.calldata)
6999
+ ? object.calldata.map((e: any) => FieldElement.fromJSON(e))
7000
+ : [],
7001
+ callerAddress: isSet(object.callerAddress) ? FieldElement.fromJSON(object.callerAddress) : undefined,
7002
+ classHash: isSet(object.classHash) ? FieldElement.fromJSON(object.classHash) : undefined,
7003
+ callType: isSet(object.callType) ? callTypeFromJSON(object.callType) : 0,
7004
+ result: globalThis.Array.isArray(object?.result) ? object.result.map((e: any) => FieldElement.fromJSON(e)) : [],
7005
+ calls: globalThis.Array.isArray(object?.calls)
7006
+ ? object.calls.map((e: any) => FunctionInvocation.fromJSON(e))
7007
+ : [],
7008
+ events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => globalThis.Number(e)) : [],
7009
+ messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => globalThis.Number(e)) : [],
7010
+ };
7011
+ },
7012
+
7013
+ toJSON(message: FunctionInvocation): unknown {
7014
+ const obj: any = {};
7015
+ if (message.contractAddress !== undefined) {
7016
+ obj.contractAddress = FieldElement.toJSON(message.contractAddress);
7017
+ }
7018
+ if (message.entryPointSelector !== undefined) {
7019
+ obj.entryPointSelector = FieldElement.toJSON(message.entryPointSelector);
7020
+ }
7021
+ if (message.calldata?.length) {
7022
+ obj.calldata = message.calldata.map((e) => FieldElement.toJSON(e));
7023
+ }
7024
+ if (message.callerAddress !== undefined) {
7025
+ obj.callerAddress = FieldElement.toJSON(message.callerAddress);
7026
+ }
7027
+ if (message.classHash !== undefined) {
7028
+ obj.classHash = FieldElement.toJSON(message.classHash);
7029
+ }
7030
+ if (message.callType !== undefined && message.callType !== 0) {
7031
+ obj.callType = callTypeToJSON(message.callType);
7032
+ }
7033
+ if (message.result?.length) {
7034
+ obj.result = message.result.map((e) => FieldElement.toJSON(e));
7035
+ }
7036
+ if (message.calls?.length) {
7037
+ obj.calls = message.calls.map((e) => FunctionInvocation.toJSON(e));
7038
+ }
7039
+ if (message.events?.length) {
7040
+ obj.events = message.events.map((e) => Math.round(e));
7041
+ }
7042
+ if (message.messages?.length) {
7043
+ obj.messages = message.messages.map((e) => Math.round(e));
7044
+ }
7045
+ return obj;
7046
+ },
7047
+
7048
+ create(base?: DeepPartial<FunctionInvocation>): FunctionInvocation {
7049
+ return FunctionInvocation.fromPartial(base ?? {});
7050
+ },
7051
+ fromPartial(object: DeepPartial<FunctionInvocation>): FunctionInvocation {
7052
+ const message = createBaseFunctionInvocation() as any;
7053
+ message.contractAddress = (object.contractAddress !== undefined && object.contractAddress !== null)
7054
+ ? FieldElement.fromPartial(object.contractAddress)
7055
+ : undefined;
7056
+ message.entryPointSelector = (object.entryPointSelector !== undefined && object.entryPointSelector !== null)
7057
+ ? FieldElement.fromPartial(object.entryPointSelector)
7058
+ : undefined;
7059
+ message.calldata = object.calldata?.map((e) => FieldElement.fromPartial(e)) || [];
7060
+ message.callerAddress = (object.callerAddress !== undefined && object.callerAddress !== null)
7061
+ ? FieldElement.fromPartial(object.callerAddress)
7062
+ : undefined;
7063
+ message.classHash = (object.classHash !== undefined && object.classHash !== null)
7064
+ ? FieldElement.fromPartial(object.classHash)
7065
+ : undefined;
7066
+ message.callType = object.callType ?? 0;
7067
+ message.result = object.result?.map((e) => FieldElement.fromPartial(e)) || [];
7068
+ message.calls = object.calls?.map((e) => FunctionInvocation.fromPartial(e)) || [];
7069
+ message.events = object.events?.map((e) => e) || [];
7070
+ message.messages = object.messages?.map((e) => e) || [];
7071
+ return message;
7072
+ },
7073
+ };
7074
+
7075
+ function createBaseFunctionCall(): FunctionCall {
7076
+ return { contractAddress: undefined, entryPointSelector: undefined, calldata: [] };
7077
+ }
7078
+
7079
+ export const FunctionCall = {
7080
+ encode(message: FunctionCall, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
7081
+ if (message.contractAddress !== undefined) {
7082
+ FieldElement.encode(message.contractAddress, writer.uint32(10).fork()).ldelim();
7083
+ }
7084
+ if (message.entryPointSelector !== undefined) {
7085
+ FieldElement.encode(message.entryPointSelector, writer.uint32(18).fork()).ldelim();
7086
+ }
7087
+ if (message.calldata !== undefined && message.calldata.length !== 0) {
7088
+ for (const v of message.calldata) {
7089
+ FieldElement.encode(v!, writer.uint32(26).fork()).ldelim();
7090
+ }
7091
+ }
7092
+ return writer;
7093
+ },
7094
+
7095
+ decode(input: _m0.Reader | Uint8Array, length?: number): FunctionCall {
7096
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
7097
+ let end = length === undefined ? reader.len : reader.pos + length;
7098
+ const message = createBaseFunctionCall() as any;
7099
+ while (reader.pos < end) {
7100
+ const tag = reader.uint32();
7101
+ switch (tag >>> 3) {
7102
+ case 1:
7103
+ if (tag !== 10) {
7104
+ break;
7105
+ }
7106
+
7107
+ message.contractAddress = FieldElement.decode(reader, reader.uint32());
7108
+ continue;
7109
+ case 2:
7110
+ if (tag !== 18) {
7111
+ break;
7112
+ }
7113
+
7114
+ message.entryPointSelector = FieldElement.decode(reader, reader.uint32());
7115
+ continue;
7116
+ case 3:
7117
+ if (tag !== 26) {
7118
+ break;
7119
+ }
7120
+
7121
+ message.calldata!.push(FieldElement.decode(reader, reader.uint32()));
7122
+ continue;
7123
+ }
7124
+ if ((tag & 7) === 4 || tag === 0) {
7125
+ break;
7126
+ }
7127
+ reader.skipType(tag & 7);
7128
+ }
7129
+ return message;
7130
+ },
7131
+
7132
+ fromJSON(object: any): FunctionCall {
7133
+ return {
7134
+ contractAddress: isSet(object.contractAddress) ? FieldElement.fromJSON(object.contractAddress) : undefined,
7135
+ entryPointSelector: isSet(object.entryPointSelector)
7136
+ ? FieldElement.fromJSON(object.entryPointSelector)
7137
+ : undefined,
7138
+ calldata: globalThis.Array.isArray(object?.calldata)
7139
+ ? object.calldata.map((e: any) => FieldElement.fromJSON(e))
7140
+ : [],
7141
+ };
7142
+ },
7143
+
7144
+ toJSON(message: FunctionCall): unknown {
7145
+ const obj: any = {};
7146
+ if (message.contractAddress !== undefined) {
7147
+ obj.contractAddress = FieldElement.toJSON(message.contractAddress);
7148
+ }
7149
+ if (message.entryPointSelector !== undefined) {
7150
+ obj.entryPointSelector = FieldElement.toJSON(message.entryPointSelector);
7151
+ }
7152
+ if (message.calldata?.length) {
7153
+ obj.calldata = message.calldata.map((e) => FieldElement.toJSON(e));
7154
+ }
7155
+ return obj;
7156
+ },
7157
+
7158
+ create(base?: DeepPartial<FunctionCall>): FunctionCall {
7159
+ return FunctionCall.fromPartial(base ?? {});
7160
+ },
7161
+ fromPartial(object: DeepPartial<FunctionCall>): FunctionCall {
7162
+ const message = createBaseFunctionCall() as any;
7163
+ message.contractAddress = (object.contractAddress !== undefined && object.contractAddress !== null)
7164
+ ? FieldElement.fromPartial(object.contractAddress)
7165
+ : undefined;
7166
+ message.entryPointSelector = (object.entryPointSelector !== undefined && object.entryPointSelector !== null)
7167
+ ? FieldElement.fromPartial(object.entryPointSelector)
7168
+ : undefined;
7169
+ message.calldata = object.calldata?.map((e) => FieldElement.fromPartial(e)) || [];
7170
+ return message;
7171
+ },
7172
+ };
7173
+
6072
7174
  function bytesFromBase64(b64: string): Uint8Array {
6073
7175
  if ((globalThis as any).Buffer) {
6074
7176
  return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));