@apibara/starknet 2.0.0-beta.6 → 2.0.0-beta.8

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
@@ -6,9 +6,9 @@
6
6
 
7
7
  /* eslint-disable */
8
8
  import Long from "long";
9
- import _m0 from "protobufjs/minimal";
10
- import { FieldElement } from "./common";
11
- import { Timestamp } from "./google/protobuf/timestamp";
9
+ import _m0 from "protobufjs/minimal.js";
10
+ import { FieldElement } from "./common.js";
11
+ import { Timestamp } from "./google/protobuf/timestamp.js";
12
12
 
13
13
  export const protobufPackage = "starknet.v2";
14
14
 
@@ -243,7 +243,19 @@ export interface Block {
243
243
  | readonly Event[]
244
244
  | undefined;
245
245
  /** List of messages. */
246
- readonly messages?: readonly MessageToL1[] | undefined;
246
+ readonly messages?:
247
+ | readonly MessageToL1[]
248
+ | undefined;
249
+ /** List of storage changes by contract. */
250
+ readonly storageDiffs?:
251
+ | readonly StorageDiff[]
252
+ | undefined;
253
+ /** List of contract/class changes. */
254
+ readonly contractChanges?:
255
+ | readonly ContractChange[]
256
+ | undefined;
257
+ /** List of nonce updates. */
258
+ readonly nonceUpdates?: readonly NonceUpdate[] | undefined;
247
259
  }
248
260
 
249
261
  /** Block header. */
@@ -645,8 +657,97 @@ export interface Uint128 {
645
657
  readonly x1?: bigint | undefined;
646
658
  }
647
659
 
660
+ /** Difference in storage values for a contract. */
661
+ export interface StorageDiff {
662
+ readonly filterIds?:
663
+ | readonly number[]
664
+ | undefined;
665
+ /** The contract address. */
666
+ readonly contractAddress?:
667
+ | FieldElement
668
+ | undefined;
669
+ /** Entries that changed. */
670
+ readonly storageEntries?: readonly StorageEntry[] | undefined;
671
+ }
672
+
673
+ /** Storage entry. */
674
+ export interface StorageEntry {
675
+ /** Storage location. */
676
+ readonly key?:
677
+ | FieldElement
678
+ | undefined;
679
+ /** Storage value. */
680
+ readonly value?: FieldElement | undefined;
681
+ }
682
+
683
+ /** A class/contract change. */
684
+ export interface ContractChange {
685
+ readonly filterIds?: readonly number[] | undefined;
686
+ readonly change?:
687
+ | { readonly $case: "declaredClass"; readonly declaredClass: DeclaredClass }
688
+ | { readonly $case: "replacedClass"; readonly replacedClass: ReplacedClass }
689
+ | { readonly $case: "deployedContract"; readonly deployedContract: DeployedContract }
690
+ | undefined;
691
+ }
692
+
693
+ /** Class declared. */
694
+ export interface DeclaredClass {
695
+ /** Class hash of the newly declared class. */
696
+ readonly classHash?:
697
+ | FieldElement
698
+ | undefined;
699
+ /**
700
+ * Hash of the cairo assembly resulting from the sierra compilation.
701
+ *
702
+ * If undefined, it's the result of a deprecated Cairo 0 declaration.
703
+ */
704
+ readonly compiledClassHash?: FieldElement | undefined;
705
+ }
706
+
707
+ /** Class replaced. */
708
+ export interface ReplacedClass {
709
+ /** The address of the contract whose class was replaced. */
710
+ readonly contractAddress?:
711
+ | FieldElement
712
+ | undefined;
713
+ /** The new class hash. */
714
+ readonly classHash?: FieldElement | undefined;
715
+ }
716
+
717
+ /** Contract deployed. */
718
+ export interface DeployedContract {
719
+ /** Address of the newly deployed contract. */
720
+ readonly contractAddress?:
721
+ | FieldElement
722
+ | undefined;
723
+ /** Class hash of the deployed contract. */
724
+ readonly classHash?: FieldElement | undefined;
725
+ }
726
+
727
+ /** Nonce update. */
728
+ export interface NonceUpdate {
729
+ readonly filterIds?:
730
+ | readonly number[]
731
+ | undefined;
732
+ /** Contract address. */
733
+ readonly contractAddress?:
734
+ | FieldElement
735
+ | undefined;
736
+ /** New nonce value. */
737
+ readonly nonce?: FieldElement | undefined;
738
+ }
739
+
648
740
  function createBaseBlock(): Block {
649
- return { header: undefined, transactions: [], receipts: [], events: [], messages: [] };
741
+ return {
742
+ header: undefined,
743
+ transactions: [],
744
+ receipts: [],
745
+ events: [],
746
+ messages: [],
747
+ storageDiffs: [],
748
+ contractChanges: [],
749
+ nonceUpdates: [],
750
+ };
650
751
  }
651
752
 
652
753
  export const Block = {
@@ -674,6 +775,21 @@ export const Block = {
674
775
  MessageToL1.encode(v!, writer.uint32(42).fork()).ldelim();
675
776
  }
676
777
  }
778
+ if (message.storageDiffs !== undefined && message.storageDiffs.length !== 0) {
779
+ for (const v of message.storageDiffs) {
780
+ StorageDiff.encode(v!, writer.uint32(50).fork()).ldelim();
781
+ }
782
+ }
783
+ if (message.contractChanges !== undefined && message.contractChanges.length !== 0) {
784
+ for (const v of message.contractChanges) {
785
+ ContractChange.encode(v!, writer.uint32(58).fork()).ldelim();
786
+ }
787
+ }
788
+ if (message.nonceUpdates !== undefined && message.nonceUpdates.length !== 0) {
789
+ for (const v of message.nonceUpdates) {
790
+ NonceUpdate.encode(v!, writer.uint32(66).fork()).ldelim();
791
+ }
792
+ }
677
793
  return writer;
678
794
  },
679
795
 
@@ -719,6 +835,27 @@ export const Block = {
719
835
 
720
836
  message.messages!.push(MessageToL1.decode(reader, reader.uint32()));
721
837
  continue;
838
+ case 6:
839
+ if (tag !== 50) {
840
+ break;
841
+ }
842
+
843
+ message.storageDiffs!.push(StorageDiff.decode(reader, reader.uint32()));
844
+ continue;
845
+ case 7:
846
+ if (tag !== 58) {
847
+ break;
848
+ }
849
+
850
+ message.contractChanges!.push(ContractChange.decode(reader, reader.uint32()));
851
+ continue;
852
+ case 8:
853
+ if (tag !== 66) {
854
+ break;
855
+ }
856
+
857
+ message.nonceUpdates!.push(NonceUpdate.decode(reader, reader.uint32()));
858
+ continue;
722
859
  }
723
860
  if ((tag & 7) === 4 || tag === 0) {
724
861
  break;
@@ -741,6 +878,15 @@ export const Block = {
741
878
  messages: globalThis.Array.isArray(object?.messages)
742
879
  ? object.messages.map((e: any) => MessageToL1.fromJSON(e))
743
880
  : [],
881
+ storageDiffs: globalThis.Array.isArray(object?.storageDiffs)
882
+ ? object.storageDiffs.map((e: any) => StorageDiff.fromJSON(e))
883
+ : [],
884
+ contractChanges: globalThis.Array.isArray(object?.contractChanges)
885
+ ? object.contractChanges.map((e: any) => ContractChange.fromJSON(e))
886
+ : [],
887
+ nonceUpdates: globalThis.Array.isArray(object?.nonceUpdates)
888
+ ? object.nonceUpdates.map((e: any) => NonceUpdate.fromJSON(e))
889
+ : [],
744
890
  };
745
891
  },
746
892
 
@@ -761,6 +907,15 @@ export const Block = {
761
907
  if (message.messages?.length) {
762
908
  obj.messages = message.messages.map((e) => MessageToL1.toJSON(e));
763
909
  }
910
+ if (message.storageDiffs?.length) {
911
+ obj.storageDiffs = message.storageDiffs.map((e) => StorageDiff.toJSON(e));
912
+ }
913
+ if (message.contractChanges?.length) {
914
+ obj.contractChanges = message.contractChanges.map((e) => ContractChange.toJSON(e));
915
+ }
916
+ if (message.nonceUpdates?.length) {
917
+ obj.nonceUpdates = message.nonceUpdates.map((e) => NonceUpdate.toJSON(e));
918
+ }
764
919
  return obj;
765
920
  },
766
921
 
@@ -776,6 +931,9 @@ export const Block = {
776
931
  message.receipts = object.receipts?.map((e) => TransactionReceipt.fromPartial(e)) || [];
777
932
  message.events = object.events?.map((e) => Event.fromPartial(e)) || [];
778
933
  message.messages = object.messages?.map((e) => MessageToL1.fromPartial(e)) || [];
934
+ message.storageDiffs = object.storageDiffs?.map((e) => StorageDiff.fromPartial(e)) || [];
935
+ message.contractChanges = object.contractChanges?.map((e) => ContractChange.fromPartial(e)) || [];
936
+ message.nonceUpdates = object.nonceUpdates?.map((e) => NonceUpdate.fromPartial(e)) || [];
779
937
  return message;
780
938
  },
781
939
  };
@@ -5181,6 +5339,692 @@ export const Uint128 = {
5181
5339
  },
5182
5340
  };
5183
5341
 
5342
+ function createBaseStorageDiff(): StorageDiff {
5343
+ return { filterIds: [], contractAddress: undefined, storageEntries: [] };
5344
+ }
5345
+
5346
+ export const StorageDiff = {
5347
+ encode(message: StorageDiff, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
5348
+ if (message.filterIds !== undefined && message.filterIds.length !== 0) {
5349
+ writer.uint32(10).fork();
5350
+ for (const v of message.filterIds) {
5351
+ writer.uint32(v);
5352
+ }
5353
+ writer.ldelim();
5354
+ }
5355
+ if (message.contractAddress !== undefined) {
5356
+ FieldElement.encode(message.contractAddress, writer.uint32(18).fork()).ldelim();
5357
+ }
5358
+ if (message.storageEntries !== undefined && message.storageEntries.length !== 0) {
5359
+ for (const v of message.storageEntries) {
5360
+ StorageEntry.encode(v!, writer.uint32(26).fork()).ldelim();
5361
+ }
5362
+ }
5363
+ return writer;
5364
+ },
5365
+
5366
+ decode(input: _m0.Reader | Uint8Array, length?: number): StorageDiff {
5367
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
5368
+ let end = length === undefined ? reader.len : reader.pos + length;
5369
+ const message = createBaseStorageDiff() as any;
5370
+ while (reader.pos < end) {
5371
+ const tag = reader.uint32();
5372
+ switch (tag >>> 3) {
5373
+ case 1:
5374
+ if (tag === 8) {
5375
+ message.filterIds!.push(reader.uint32());
5376
+
5377
+ continue;
5378
+ }
5379
+
5380
+ if (tag === 10) {
5381
+ const end2 = reader.uint32() + reader.pos;
5382
+ while (reader.pos < end2) {
5383
+ message.filterIds!.push(reader.uint32());
5384
+ }
5385
+
5386
+ continue;
5387
+ }
5388
+
5389
+ break;
5390
+ case 2:
5391
+ if (tag !== 18) {
5392
+ break;
5393
+ }
5394
+
5395
+ message.contractAddress = FieldElement.decode(reader, reader.uint32());
5396
+ continue;
5397
+ case 3:
5398
+ if (tag !== 26) {
5399
+ break;
5400
+ }
5401
+
5402
+ message.storageEntries!.push(StorageEntry.decode(reader, reader.uint32()));
5403
+ continue;
5404
+ }
5405
+ if ((tag & 7) === 4 || tag === 0) {
5406
+ break;
5407
+ }
5408
+ reader.skipType(tag & 7);
5409
+ }
5410
+ return message;
5411
+ },
5412
+
5413
+ fromJSON(object: any): StorageDiff {
5414
+ return {
5415
+ filterIds: globalThis.Array.isArray(object?.filterIds)
5416
+ ? object.filterIds.map((e: any) => globalThis.Number(e))
5417
+ : [],
5418
+ contractAddress: isSet(object.contractAddress) ? FieldElement.fromJSON(object.contractAddress) : undefined,
5419
+ storageEntries: globalThis.Array.isArray(object?.storageEntries)
5420
+ ? object.storageEntries.map((e: any) => StorageEntry.fromJSON(e))
5421
+ : [],
5422
+ };
5423
+ },
5424
+
5425
+ toJSON(message: StorageDiff): unknown {
5426
+ const obj: any = {};
5427
+ if (message.filterIds?.length) {
5428
+ obj.filterIds = message.filterIds.map((e) => Math.round(e));
5429
+ }
5430
+ if (message.contractAddress !== undefined) {
5431
+ obj.contractAddress = FieldElement.toJSON(message.contractAddress);
5432
+ }
5433
+ if (message.storageEntries?.length) {
5434
+ obj.storageEntries = message.storageEntries.map((e) => StorageEntry.toJSON(e));
5435
+ }
5436
+ return obj;
5437
+ },
5438
+
5439
+ create(base?: DeepPartial<StorageDiff>): StorageDiff {
5440
+ return StorageDiff.fromPartial(base ?? {});
5441
+ },
5442
+ fromPartial(object: DeepPartial<StorageDiff>): StorageDiff {
5443
+ const message = createBaseStorageDiff() as any;
5444
+ message.filterIds = object.filterIds?.map((e) => e) || [];
5445
+ message.contractAddress = (object.contractAddress !== undefined && object.contractAddress !== null)
5446
+ ? FieldElement.fromPartial(object.contractAddress)
5447
+ : undefined;
5448
+ message.storageEntries = object.storageEntries?.map((e) => StorageEntry.fromPartial(e)) || [];
5449
+ return message;
5450
+ },
5451
+ };
5452
+
5453
+ function createBaseStorageEntry(): StorageEntry {
5454
+ return { key: undefined, value: undefined };
5455
+ }
5456
+
5457
+ export const StorageEntry = {
5458
+ encode(message: StorageEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
5459
+ if (message.key !== undefined) {
5460
+ FieldElement.encode(message.key, writer.uint32(10).fork()).ldelim();
5461
+ }
5462
+ if (message.value !== undefined) {
5463
+ FieldElement.encode(message.value, writer.uint32(18).fork()).ldelim();
5464
+ }
5465
+ return writer;
5466
+ },
5467
+
5468
+ decode(input: _m0.Reader | Uint8Array, length?: number): StorageEntry {
5469
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
5470
+ let end = length === undefined ? reader.len : reader.pos + length;
5471
+ const message = createBaseStorageEntry() as any;
5472
+ while (reader.pos < end) {
5473
+ const tag = reader.uint32();
5474
+ switch (tag >>> 3) {
5475
+ case 1:
5476
+ if (tag !== 10) {
5477
+ break;
5478
+ }
5479
+
5480
+ message.key = FieldElement.decode(reader, reader.uint32());
5481
+ continue;
5482
+ case 2:
5483
+ if (tag !== 18) {
5484
+ break;
5485
+ }
5486
+
5487
+ message.value = FieldElement.decode(reader, reader.uint32());
5488
+ continue;
5489
+ }
5490
+ if ((tag & 7) === 4 || tag === 0) {
5491
+ break;
5492
+ }
5493
+ reader.skipType(tag & 7);
5494
+ }
5495
+ return message;
5496
+ },
5497
+
5498
+ fromJSON(object: any): StorageEntry {
5499
+ return {
5500
+ key: isSet(object.key) ? FieldElement.fromJSON(object.key) : undefined,
5501
+ value: isSet(object.value) ? FieldElement.fromJSON(object.value) : undefined,
5502
+ };
5503
+ },
5504
+
5505
+ toJSON(message: StorageEntry): unknown {
5506
+ const obj: any = {};
5507
+ if (message.key !== undefined) {
5508
+ obj.key = FieldElement.toJSON(message.key);
5509
+ }
5510
+ if (message.value !== undefined) {
5511
+ obj.value = FieldElement.toJSON(message.value);
5512
+ }
5513
+ return obj;
5514
+ },
5515
+
5516
+ create(base?: DeepPartial<StorageEntry>): StorageEntry {
5517
+ return StorageEntry.fromPartial(base ?? {});
5518
+ },
5519
+ fromPartial(object: DeepPartial<StorageEntry>): StorageEntry {
5520
+ const message = createBaseStorageEntry() as any;
5521
+ message.key = (object.key !== undefined && object.key !== null) ? FieldElement.fromPartial(object.key) : undefined;
5522
+ message.value = (object.value !== undefined && object.value !== null)
5523
+ ? FieldElement.fromPartial(object.value)
5524
+ : undefined;
5525
+ return message;
5526
+ },
5527
+ };
5528
+
5529
+ function createBaseContractChange(): ContractChange {
5530
+ return { filterIds: [], change: undefined };
5531
+ }
5532
+
5533
+ export const ContractChange = {
5534
+ encode(message: ContractChange, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
5535
+ if (message.filterIds !== undefined && message.filterIds.length !== 0) {
5536
+ writer.uint32(10).fork();
5537
+ for (const v of message.filterIds) {
5538
+ writer.uint32(v);
5539
+ }
5540
+ writer.ldelim();
5541
+ }
5542
+ switch (message.change?.$case) {
5543
+ case "declaredClass":
5544
+ DeclaredClass.encode(message.change.declaredClass, writer.uint32(18).fork()).ldelim();
5545
+ break;
5546
+ case "replacedClass":
5547
+ ReplacedClass.encode(message.change.replacedClass, writer.uint32(26).fork()).ldelim();
5548
+ break;
5549
+ case "deployedContract":
5550
+ DeployedContract.encode(message.change.deployedContract, writer.uint32(34).fork()).ldelim();
5551
+ break;
5552
+ }
5553
+ return writer;
5554
+ },
5555
+
5556
+ decode(input: _m0.Reader | Uint8Array, length?: number): ContractChange {
5557
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
5558
+ let end = length === undefined ? reader.len : reader.pos + length;
5559
+ const message = createBaseContractChange() as any;
5560
+ while (reader.pos < end) {
5561
+ const tag = reader.uint32();
5562
+ switch (tag >>> 3) {
5563
+ case 1:
5564
+ if (tag === 8) {
5565
+ message.filterIds!.push(reader.uint32());
5566
+
5567
+ continue;
5568
+ }
5569
+
5570
+ if (tag === 10) {
5571
+ const end2 = reader.uint32() + reader.pos;
5572
+ while (reader.pos < end2) {
5573
+ message.filterIds!.push(reader.uint32());
5574
+ }
5575
+
5576
+ continue;
5577
+ }
5578
+
5579
+ break;
5580
+ case 2:
5581
+ if (tag !== 18) {
5582
+ break;
5583
+ }
5584
+
5585
+ message.change = { $case: "declaredClass", declaredClass: DeclaredClass.decode(reader, reader.uint32()) };
5586
+ continue;
5587
+ case 3:
5588
+ if (tag !== 26) {
5589
+ break;
5590
+ }
5591
+
5592
+ message.change = { $case: "replacedClass", replacedClass: ReplacedClass.decode(reader, reader.uint32()) };
5593
+ continue;
5594
+ case 4:
5595
+ if (tag !== 34) {
5596
+ break;
5597
+ }
5598
+
5599
+ message.change = {
5600
+ $case: "deployedContract",
5601
+ deployedContract: DeployedContract.decode(reader, reader.uint32()),
5602
+ };
5603
+ continue;
5604
+ }
5605
+ if ((tag & 7) === 4 || tag === 0) {
5606
+ break;
5607
+ }
5608
+ reader.skipType(tag & 7);
5609
+ }
5610
+ return message;
5611
+ },
5612
+
5613
+ fromJSON(object: any): ContractChange {
5614
+ return {
5615
+ filterIds: globalThis.Array.isArray(object?.filterIds)
5616
+ ? object.filterIds.map((e: any) => globalThis.Number(e))
5617
+ : [],
5618
+ change: isSet(object.declaredClass)
5619
+ ? { $case: "declaredClass", declaredClass: DeclaredClass.fromJSON(object.declaredClass) }
5620
+ : isSet(object.replacedClass)
5621
+ ? { $case: "replacedClass", replacedClass: ReplacedClass.fromJSON(object.replacedClass) }
5622
+ : isSet(object.deployedContract)
5623
+ ? { $case: "deployedContract", deployedContract: DeployedContract.fromJSON(object.deployedContract) }
5624
+ : undefined,
5625
+ };
5626
+ },
5627
+
5628
+ toJSON(message: ContractChange): unknown {
5629
+ const obj: any = {};
5630
+ if (message.filterIds?.length) {
5631
+ obj.filterIds = message.filterIds.map((e) => Math.round(e));
5632
+ }
5633
+ if (message.change?.$case === "declaredClass") {
5634
+ obj.declaredClass = DeclaredClass.toJSON(message.change.declaredClass);
5635
+ }
5636
+ if (message.change?.$case === "replacedClass") {
5637
+ obj.replacedClass = ReplacedClass.toJSON(message.change.replacedClass);
5638
+ }
5639
+ if (message.change?.$case === "deployedContract") {
5640
+ obj.deployedContract = DeployedContract.toJSON(message.change.deployedContract);
5641
+ }
5642
+ return obj;
5643
+ },
5644
+
5645
+ create(base?: DeepPartial<ContractChange>): ContractChange {
5646
+ return ContractChange.fromPartial(base ?? {});
5647
+ },
5648
+ fromPartial(object: DeepPartial<ContractChange>): ContractChange {
5649
+ const message = createBaseContractChange() as any;
5650
+ message.filterIds = object.filterIds?.map((e) => e) || [];
5651
+ if (
5652
+ object.change?.$case === "declaredClass" &&
5653
+ object.change?.declaredClass !== undefined &&
5654
+ object.change?.declaredClass !== null
5655
+ ) {
5656
+ message.change = {
5657
+ $case: "declaredClass",
5658
+ declaredClass: DeclaredClass.fromPartial(object.change.declaredClass),
5659
+ };
5660
+ }
5661
+ if (
5662
+ object.change?.$case === "replacedClass" &&
5663
+ object.change?.replacedClass !== undefined &&
5664
+ object.change?.replacedClass !== null
5665
+ ) {
5666
+ message.change = {
5667
+ $case: "replacedClass",
5668
+ replacedClass: ReplacedClass.fromPartial(object.change.replacedClass),
5669
+ };
5670
+ }
5671
+ if (
5672
+ object.change?.$case === "deployedContract" &&
5673
+ object.change?.deployedContract !== undefined &&
5674
+ object.change?.deployedContract !== null
5675
+ ) {
5676
+ message.change = {
5677
+ $case: "deployedContract",
5678
+ deployedContract: DeployedContract.fromPartial(object.change.deployedContract),
5679
+ };
5680
+ }
5681
+ return message;
5682
+ },
5683
+ };
5684
+
5685
+ function createBaseDeclaredClass(): DeclaredClass {
5686
+ return { classHash: undefined, compiledClassHash: undefined };
5687
+ }
5688
+
5689
+ export const DeclaredClass = {
5690
+ encode(message: DeclaredClass, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
5691
+ if (message.classHash !== undefined) {
5692
+ FieldElement.encode(message.classHash, writer.uint32(10).fork()).ldelim();
5693
+ }
5694
+ if (message.compiledClassHash !== undefined) {
5695
+ FieldElement.encode(message.compiledClassHash, writer.uint32(18).fork()).ldelim();
5696
+ }
5697
+ return writer;
5698
+ },
5699
+
5700
+ decode(input: _m0.Reader | Uint8Array, length?: number): DeclaredClass {
5701
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
5702
+ let end = length === undefined ? reader.len : reader.pos + length;
5703
+ const message = createBaseDeclaredClass() as any;
5704
+ while (reader.pos < end) {
5705
+ const tag = reader.uint32();
5706
+ switch (tag >>> 3) {
5707
+ case 1:
5708
+ if (tag !== 10) {
5709
+ break;
5710
+ }
5711
+
5712
+ message.classHash = FieldElement.decode(reader, reader.uint32());
5713
+ continue;
5714
+ case 2:
5715
+ if (tag !== 18) {
5716
+ break;
5717
+ }
5718
+
5719
+ message.compiledClassHash = FieldElement.decode(reader, reader.uint32());
5720
+ continue;
5721
+ }
5722
+ if ((tag & 7) === 4 || tag === 0) {
5723
+ break;
5724
+ }
5725
+ reader.skipType(tag & 7);
5726
+ }
5727
+ return message;
5728
+ },
5729
+
5730
+ fromJSON(object: any): DeclaredClass {
5731
+ return {
5732
+ classHash: isSet(object.classHash) ? FieldElement.fromJSON(object.classHash) : undefined,
5733
+ compiledClassHash: isSet(object.compiledClassHash) ? FieldElement.fromJSON(object.compiledClassHash) : undefined,
5734
+ };
5735
+ },
5736
+
5737
+ toJSON(message: DeclaredClass): unknown {
5738
+ const obj: any = {};
5739
+ if (message.classHash !== undefined) {
5740
+ obj.classHash = FieldElement.toJSON(message.classHash);
5741
+ }
5742
+ if (message.compiledClassHash !== undefined) {
5743
+ obj.compiledClassHash = FieldElement.toJSON(message.compiledClassHash);
5744
+ }
5745
+ return obj;
5746
+ },
5747
+
5748
+ create(base?: DeepPartial<DeclaredClass>): DeclaredClass {
5749
+ return DeclaredClass.fromPartial(base ?? {});
5750
+ },
5751
+ fromPartial(object: DeepPartial<DeclaredClass>): DeclaredClass {
5752
+ const message = createBaseDeclaredClass() as any;
5753
+ message.classHash = (object.classHash !== undefined && object.classHash !== null)
5754
+ ? FieldElement.fromPartial(object.classHash)
5755
+ : undefined;
5756
+ message.compiledClassHash = (object.compiledClassHash !== undefined && object.compiledClassHash !== null)
5757
+ ? FieldElement.fromPartial(object.compiledClassHash)
5758
+ : undefined;
5759
+ return message;
5760
+ },
5761
+ };
5762
+
5763
+ function createBaseReplacedClass(): ReplacedClass {
5764
+ return { contractAddress: undefined, classHash: undefined };
5765
+ }
5766
+
5767
+ export const ReplacedClass = {
5768
+ encode(message: ReplacedClass, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
5769
+ if (message.contractAddress !== undefined) {
5770
+ FieldElement.encode(message.contractAddress, writer.uint32(10).fork()).ldelim();
5771
+ }
5772
+ if (message.classHash !== undefined) {
5773
+ FieldElement.encode(message.classHash, writer.uint32(18).fork()).ldelim();
5774
+ }
5775
+ return writer;
5776
+ },
5777
+
5778
+ decode(input: _m0.Reader | Uint8Array, length?: number): ReplacedClass {
5779
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
5780
+ let end = length === undefined ? reader.len : reader.pos + length;
5781
+ const message = createBaseReplacedClass() as any;
5782
+ while (reader.pos < end) {
5783
+ const tag = reader.uint32();
5784
+ switch (tag >>> 3) {
5785
+ case 1:
5786
+ if (tag !== 10) {
5787
+ break;
5788
+ }
5789
+
5790
+ message.contractAddress = FieldElement.decode(reader, reader.uint32());
5791
+ continue;
5792
+ case 2:
5793
+ if (tag !== 18) {
5794
+ break;
5795
+ }
5796
+
5797
+ message.classHash = FieldElement.decode(reader, reader.uint32());
5798
+ continue;
5799
+ }
5800
+ if ((tag & 7) === 4 || tag === 0) {
5801
+ break;
5802
+ }
5803
+ reader.skipType(tag & 7);
5804
+ }
5805
+ return message;
5806
+ },
5807
+
5808
+ fromJSON(object: any): ReplacedClass {
5809
+ return {
5810
+ contractAddress: isSet(object.contractAddress) ? FieldElement.fromJSON(object.contractAddress) : undefined,
5811
+ classHash: isSet(object.classHash) ? FieldElement.fromJSON(object.classHash) : undefined,
5812
+ };
5813
+ },
5814
+
5815
+ toJSON(message: ReplacedClass): unknown {
5816
+ const obj: any = {};
5817
+ if (message.contractAddress !== undefined) {
5818
+ obj.contractAddress = FieldElement.toJSON(message.contractAddress);
5819
+ }
5820
+ if (message.classHash !== undefined) {
5821
+ obj.classHash = FieldElement.toJSON(message.classHash);
5822
+ }
5823
+ return obj;
5824
+ },
5825
+
5826
+ create(base?: DeepPartial<ReplacedClass>): ReplacedClass {
5827
+ return ReplacedClass.fromPartial(base ?? {});
5828
+ },
5829
+ fromPartial(object: DeepPartial<ReplacedClass>): ReplacedClass {
5830
+ const message = createBaseReplacedClass() as any;
5831
+ message.contractAddress = (object.contractAddress !== undefined && object.contractAddress !== null)
5832
+ ? FieldElement.fromPartial(object.contractAddress)
5833
+ : undefined;
5834
+ message.classHash = (object.classHash !== undefined && object.classHash !== null)
5835
+ ? FieldElement.fromPartial(object.classHash)
5836
+ : undefined;
5837
+ return message;
5838
+ },
5839
+ };
5840
+
5841
+ function createBaseDeployedContract(): DeployedContract {
5842
+ return { contractAddress: undefined, classHash: undefined };
5843
+ }
5844
+
5845
+ export const DeployedContract = {
5846
+ encode(message: DeployedContract, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
5847
+ if (message.contractAddress !== undefined) {
5848
+ FieldElement.encode(message.contractAddress, writer.uint32(10).fork()).ldelim();
5849
+ }
5850
+ if (message.classHash !== undefined) {
5851
+ FieldElement.encode(message.classHash, writer.uint32(18).fork()).ldelim();
5852
+ }
5853
+ return writer;
5854
+ },
5855
+
5856
+ decode(input: _m0.Reader | Uint8Array, length?: number): DeployedContract {
5857
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
5858
+ let end = length === undefined ? reader.len : reader.pos + length;
5859
+ const message = createBaseDeployedContract() as any;
5860
+ while (reader.pos < end) {
5861
+ const tag = reader.uint32();
5862
+ switch (tag >>> 3) {
5863
+ case 1:
5864
+ if (tag !== 10) {
5865
+ break;
5866
+ }
5867
+
5868
+ message.contractAddress = FieldElement.decode(reader, reader.uint32());
5869
+ continue;
5870
+ case 2:
5871
+ if (tag !== 18) {
5872
+ break;
5873
+ }
5874
+
5875
+ message.classHash = FieldElement.decode(reader, reader.uint32());
5876
+ continue;
5877
+ }
5878
+ if ((tag & 7) === 4 || tag === 0) {
5879
+ break;
5880
+ }
5881
+ reader.skipType(tag & 7);
5882
+ }
5883
+ return message;
5884
+ },
5885
+
5886
+ fromJSON(object: any): DeployedContract {
5887
+ return {
5888
+ contractAddress: isSet(object.contractAddress) ? FieldElement.fromJSON(object.contractAddress) : undefined,
5889
+ classHash: isSet(object.classHash) ? FieldElement.fromJSON(object.classHash) : undefined,
5890
+ };
5891
+ },
5892
+
5893
+ toJSON(message: DeployedContract): unknown {
5894
+ const obj: any = {};
5895
+ if (message.contractAddress !== undefined) {
5896
+ obj.contractAddress = FieldElement.toJSON(message.contractAddress);
5897
+ }
5898
+ if (message.classHash !== undefined) {
5899
+ obj.classHash = FieldElement.toJSON(message.classHash);
5900
+ }
5901
+ return obj;
5902
+ },
5903
+
5904
+ create(base?: DeepPartial<DeployedContract>): DeployedContract {
5905
+ return DeployedContract.fromPartial(base ?? {});
5906
+ },
5907
+ fromPartial(object: DeepPartial<DeployedContract>): DeployedContract {
5908
+ const message = createBaseDeployedContract() as any;
5909
+ message.contractAddress = (object.contractAddress !== undefined && object.contractAddress !== null)
5910
+ ? FieldElement.fromPartial(object.contractAddress)
5911
+ : undefined;
5912
+ message.classHash = (object.classHash !== undefined && object.classHash !== null)
5913
+ ? FieldElement.fromPartial(object.classHash)
5914
+ : undefined;
5915
+ return message;
5916
+ },
5917
+ };
5918
+
5919
+ function createBaseNonceUpdate(): NonceUpdate {
5920
+ return { filterIds: [], contractAddress: undefined, nonce: undefined };
5921
+ }
5922
+
5923
+ export const NonceUpdate = {
5924
+ encode(message: NonceUpdate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
5925
+ if (message.filterIds !== undefined && message.filterIds.length !== 0) {
5926
+ writer.uint32(10).fork();
5927
+ for (const v of message.filterIds) {
5928
+ writer.uint32(v);
5929
+ }
5930
+ writer.ldelim();
5931
+ }
5932
+ if (message.contractAddress !== undefined) {
5933
+ FieldElement.encode(message.contractAddress, writer.uint32(18).fork()).ldelim();
5934
+ }
5935
+ if (message.nonce !== undefined) {
5936
+ FieldElement.encode(message.nonce, writer.uint32(26).fork()).ldelim();
5937
+ }
5938
+ return writer;
5939
+ },
5940
+
5941
+ decode(input: _m0.Reader | Uint8Array, length?: number): NonceUpdate {
5942
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
5943
+ let end = length === undefined ? reader.len : reader.pos + length;
5944
+ const message = createBaseNonceUpdate() as any;
5945
+ while (reader.pos < end) {
5946
+ const tag = reader.uint32();
5947
+ switch (tag >>> 3) {
5948
+ case 1:
5949
+ if (tag === 8) {
5950
+ message.filterIds!.push(reader.uint32());
5951
+
5952
+ continue;
5953
+ }
5954
+
5955
+ if (tag === 10) {
5956
+ const end2 = reader.uint32() + reader.pos;
5957
+ while (reader.pos < end2) {
5958
+ message.filterIds!.push(reader.uint32());
5959
+ }
5960
+
5961
+ continue;
5962
+ }
5963
+
5964
+ break;
5965
+ case 2:
5966
+ if (tag !== 18) {
5967
+ break;
5968
+ }
5969
+
5970
+ message.contractAddress = FieldElement.decode(reader, reader.uint32());
5971
+ continue;
5972
+ case 3:
5973
+ if (tag !== 26) {
5974
+ break;
5975
+ }
5976
+
5977
+ message.nonce = FieldElement.decode(reader, reader.uint32());
5978
+ continue;
5979
+ }
5980
+ if ((tag & 7) === 4 || tag === 0) {
5981
+ break;
5982
+ }
5983
+ reader.skipType(tag & 7);
5984
+ }
5985
+ return message;
5986
+ },
5987
+
5988
+ fromJSON(object: any): NonceUpdate {
5989
+ return {
5990
+ filterIds: globalThis.Array.isArray(object?.filterIds)
5991
+ ? object.filterIds.map((e: any) => globalThis.Number(e))
5992
+ : [],
5993
+ contractAddress: isSet(object.contractAddress) ? FieldElement.fromJSON(object.contractAddress) : undefined,
5994
+ nonce: isSet(object.nonce) ? FieldElement.fromJSON(object.nonce) : undefined,
5995
+ };
5996
+ },
5997
+
5998
+ toJSON(message: NonceUpdate): unknown {
5999
+ const obj: any = {};
6000
+ if (message.filterIds?.length) {
6001
+ obj.filterIds = message.filterIds.map((e) => Math.round(e));
6002
+ }
6003
+ if (message.contractAddress !== undefined) {
6004
+ obj.contractAddress = FieldElement.toJSON(message.contractAddress);
6005
+ }
6006
+ if (message.nonce !== undefined) {
6007
+ obj.nonce = FieldElement.toJSON(message.nonce);
6008
+ }
6009
+ return obj;
6010
+ },
6011
+
6012
+ create(base?: DeepPartial<NonceUpdate>): NonceUpdate {
6013
+ return NonceUpdate.fromPartial(base ?? {});
6014
+ },
6015
+ fromPartial(object: DeepPartial<NonceUpdate>): NonceUpdate {
6016
+ const message = createBaseNonceUpdate() as any;
6017
+ message.filterIds = object.filterIds?.map((e) => e) || [];
6018
+ message.contractAddress = (object.contractAddress !== undefined && object.contractAddress !== null)
6019
+ ? FieldElement.fromPartial(object.contractAddress)
6020
+ : undefined;
6021
+ message.nonce = (object.nonce !== undefined && object.nonce !== null)
6022
+ ? FieldElement.fromPartial(object.nonce)
6023
+ : undefined;
6024
+ return message;
6025
+ },
6026
+ };
6027
+
5184
6028
  function bytesFromBase64(b64: string): Uint8Array {
5185
6029
  if ((globalThis as any).Buffer) {
5186
6030
  return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));