@apibara/starknet 2.0.0-beta.4 → 2.0.0-beta.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/proto/data.ts CHANGED
@@ -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. */
@@ -482,7 +494,7 @@ export interface Event {
482
494
  | readonly number[]
483
495
  | undefined;
484
496
  /** The contract that emitted the event. */
485
- readonly fromAddress?:
497
+ readonly address?:
486
498
  | FieldElement
487
499
  | undefined;
488
500
  /** The event keys. */
@@ -506,7 +518,11 @@ export interface Event {
506
518
  | FieldElement
507
519
  | undefined;
508
520
  /** Transaction status. */
509
- readonly transactionStatus?: TransactionStatus | undefined;
521
+ readonly transactionStatus?:
522
+ | TransactionStatus
523
+ | undefined;
524
+ /** Event index in the transaction. */
525
+ readonly eventIndexInTransaction?: number | undefined;
510
526
  }
511
527
 
512
528
  export interface MessageToL1 {
@@ -538,7 +554,11 @@ export interface MessageToL1 {
538
554
  | FieldElement
539
555
  | undefined;
540
556
  /** Transaction status. */
541
- readonly transactionStatus?: TransactionStatus | undefined;
557
+ readonly transactionStatus?:
558
+ | TransactionStatus
559
+ | undefined;
560
+ /** Message index in the transaction. */
561
+ readonly messageIndexInTransaction?: number | undefined;
542
562
  }
543
563
 
544
564
  /** Price of a unit of a resource. */
@@ -645,8 +665,97 @@ export interface Uint128 {
645
665
  readonly x1?: bigint | undefined;
646
666
  }
647
667
 
668
+ /** Difference in storage values for a contract. */
669
+ export interface StorageDiff {
670
+ readonly filterIds?:
671
+ | readonly number[]
672
+ | undefined;
673
+ /** The contract address. */
674
+ readonly contractAddress?:
675
+ | FieldElement
676
+ | undefined;
677
+ /** Entries that changed. */
678
+ readonly storageEntries?: readonly StorageEntry[] | undefined;
679
+ }
680
+
681
+ /** Storage entry. */
682
+ export interface StorageEntry {
683
+ /** Storage location. */
684
+ readonly key?:
685
+ | FieldElement
686
+ | undefined;
687
+ /** Storage value. */
688
+ readonly value?: FieldElement | undefined;
689
+ }
690
+
691
+ /** A class/contract change. */
692
+ export interface ContractChange {
693
+ readonly filterIds?: readonly number[] | undefined;
694
+ readonly change?:
695
+ | { readonly $case: "declaredClass"; readonly declaredClass: DeclaredClass }
696
+ | { readonly $case: "replacedClass"; readonly replacedClass: ReplacedClass }
697
+ | { readonly $case: "deployedContract"; readonly deployedContract: DeployedContract }
698
+ | undefined;
699
+ }
700
+
701
+ /** Class declared. */
702
+ export interface DeclaredClass {
703
+ /** Class hash of the newly declared class. */
704
+ readonly classHash?:
705
+ | FieldElement
706
+ | undefined;
707
+ /**
708
+ * Hash of the cairo assembly resulting from the sierra compilation.
709
+ *
710
+ * If undefined, it's the result of a deprecated Cairo 0 declaration.
711
+ */
712
+ readonly compiledClassHash?: FieldElement | undefined;
713
+ }
714
+
715
+ /** Class replaced. */
716
+ export interface ReplacedClass {
717
+ /** The address of the contract whose class was replaced. */
718
+ readonly contractAddress?:
719
+ | FieldElement
720
+ | undefined;
721
+ /** The new class hash. */
722
+ readonly classHash?: FieldElement | undefined;
723
+ }
724
+
725
+ /** Contract deployed. */
726
+ export interface DeployedContract {
727
+ /** Address of the newly deployed contract. */
728
+ readonly contractAddress?:
729
+ | FieldElement
730
+ | undefined;
731
+ /** Class hash of the deployed contract. */
732
+ readonly classHash?: FieldElement | undefined;
733
+ }
734
+
735
+ /** Nonce update. */
736
+ export interface NonceUpdate {
737
+ readonly filterIds?:
738
+ | readonly number[]
739
+ | undefined;
740
+ /** Contract address. */
741
+ readonly contractAddress?:
742
+ | FieldElement
743
+ | undefined;
744
+ /** New nonce value. */
745
+ readonly nonce?: FieldElement | undefined;
746
+ }
747
+
648
748
  function createBaseBlock(): Block {
649
- return { header: undefined, transactions: [], receipts: [], events: [], messages: [] };
749
+ return {
750
+ header: undefined,
751
+ transactions: [],
752
+ receipts: [],
753
+ events: [],
754
+ messages: [],
755
+ storageDiffs: [],
756
+ contractChanges: [],
757
+ nonceUpdates: [],
758
+ };
650
759
  }
651
760
 
652
761
  export const Block = {
@@ -674,6 +783,21 @@ export const Block = {
674
783
  MessageToL1.encode(v!, writer.uint32(42).fork()).ldelim();
675
784
  }
676
785
  }
786
+ if (message.storageDiffs !== undefined && message.storageDiffs.length !== 0) {
787
+ for (const v of message.storageDiffs) {
788
+ StorageDiff.encode(v!, writer.uint32(50).fork()).ldelim();
789
+ }
790
+ }
791
+ if (message.contractChanges !== undefined && message.contractChanges.length !== 0) {
792
+ for (const v of message.contractChanges) {
793
+ ContractChange.encode(v!, writer.uint32(58).fork()).ldelim();
794
+ }
795
+ }
796
+ if (message.nonceUpdates !== undefined && message.nonceUpdates.length !== 0) {
797
+ for (const v of message.nonceUpdates) {
798
+ NonceUpdate.encode(v!, writer.uint32(66).fork()).ldelim();
799
+ }
800
+ }
677
801
  return writer;
678
802
  },
679
803
 
@@ -719,6 +843,27 @@ export const Block = {
719
843
 
720
844
  message.messages!.push(MessageToL1.decode(reader, reader.uint32()));
721
845
  continue;
846
+ case 6:
847
+ if (tag !== 50) {
848
+ break;
849
+ }
850
+
851
+ message.storageDiffs!.push(StorageDiff.decode(reader, reader.uint32()));
852
+ continue;
853
+ case 7:
854
+ if (tag !== 58) {
855
+ break;
856
+ }
857
+
858
+ message.contractChanges!.push(ContractChange.decode(reader, reader.uint32()));
859
+ continue;
860
+ case 8:
861
+ if (tag !== 66) {
862
+ break;
863
+ }
864
+
865
+ message.nonceUpdates!.push(NonceUpdate.decode(reader, reader.uint32()));
866
+ continue;
722
867
  }
723
868
  if ((tag & 7) === 4 || tag === 0) {
724
869
  break;
@@ -741,6 +886,15 @@ export const Block = {
741
886
  messages: globalThis.Array.isArray(object?.messages)
742
887
  ? object.messages.map((e: any) => MessageToL1.fromJSON(e))
743
888
  : [],
889
+ storageDiffs: globalThis.Array.isArray(object?.storageDiffs)
890
+ ? object.storageDiffs.map((e: any) => StorageDiff.fromJSON(e))
891
+ : [],
892
+ contractChanges: globalThis.Array.isArray(object?.contractChanges)
893
+ ? object.contractChanges.map((e: any) => ContractChange.fromJSON(e))
894
+ : [],
895
+ nonceUpdates: globalThis.Array.isArray(object?.nonceUpdates)
896
+ ? object.nonceUpdates.map((e: any) => NonceUpdate.fromJSON(e))
897
+ : [],
744
898
  };
745
899
  },
746
900
 
@@ -761,6 +915,15 @@ export const Block = {
761
915
  if (message.messages?.length) {
762
916
  obj.messages = message.messages.map((e) => MessageToL1.toJSON(e));
763
917
  }
918
+ if (message.storageDiffs?.length) {
919
+ obj.storageDiffs = message.storageDiffs.map((e) => StorageDiff.toJSON(e));
920
+ }
921
+ if (message.contractChanges?.length) {
922
+ obj.contractChanges = message.contractChanges.map((e) => ContractChange.toJSON(e));
923
+ }
924
+ if (message.nonceUpdates?.length) {
925
+ obj.nonceUpdates = message.nonceUpdates.map((e) => NonceUpdate.toJSON(e));
926
+ }
764
927
  return obj;
765
928
  },
766
929
 
@@ -776,6 +939,9 @@ export const Block = {
776
939
  message.receipts = object.receipts?.map((e) => TransactionReceipt.fromPartial(e)) || [];
777
940
  message.events = object.events?.map((e) => Event.fromPartial(e)) || [];
778
941
  message.messages = object.messages?.map((e) => MessageToL1.fromPartial(e)) || [];
942
+ message.storageDiffs = object.storageDiffs?.map((e) => StorageDiff.fromPartial(e)) || [];
943
+ message.contractChanges = object.contractChanges?.map((e) => ContractChange.fromPartial(e)) || [];
944
+ message.nonceUpdates = object.nonceUpdates?.map((e) => NonceUpdate.fromPartial(e)) || [];
779
945
  return message;
780
946
  },
781
947
  };
@@ -3976,13 +4142,14 @@ export const DeployAccountTransactionReceipt = {
3976
4142
  function createBaseEvent(): Event {
3977
4143
  return {
3978
4144
  filterIds: [],
3979
- fromAddress: undefined,
4145
+ address: undefined,
3980
4146
  keys: [],
3981
4147
  data: [],
3982
4148
  eventIndex: 0,
3983
4149
  transactionIndex: 0,
3984
4150
  transactionHash: undefined,
3985
4151
  transactionStatus: 0,
4152
+ eventIndexInTransaction: 0,
3986
4153
  };
3987
4154
  }
3988
4155
 
@@ -3995,8 +4162,8 @@ export const Event = {
3995
4162
  }
3996
4163
  writer.ldelim();
3997
4164
  }
3998
- if (message.fromAddress !== undefined) {
3999
- FieldElement.encode(message.fromAddress, writer.uint32(18).fork()).ldelim();
4165
+ if (message.address !== undefined) {
4166
+ FieldElement.encode(message.address, writer.uint32(18).fork()).ldelim();
4000
4167
  }
4001
4168
  if (message.keys !== undefined && message.keys.length !== 0) {
4002
4169
  for (const v of message.keys) {
@@ -4020,6 +4187,9 @@ export const Event = {
4020
4187
  if (message.transactionStatus !== undefined && message.transactionStatus !== 0) {
4021
4188
  writer.uint32(64).int32(message.transactionStatus);
4022
4189
  }
4190
+ if (message.eventIndexInTransaction !== undefined && message.eventIndexInTransaction !== 0) {
4191
+ writer.uint32(72).uint32(message.eventIndexInTransaction);
4192
+ }
4023
4193
  return writer;
4024
4194
  },
4025
4195
 
@@ -4052,7 +4222,7 @@ export const Event = {
4052
4222
  break;
4053
4223
  }
4054
4224
 
4055
- message.fromAddress = FieldElement.decode(reader, reader.uint32());
4225
+ message.address = FieldElement.decode(reader, reader.uint32());
4056
4226
  continue;
4057
4227
  case 3:
4058
4228
  if (tag !== 26) {
@@ -4096,6 +4266,13 @@ export const Event = {
4096
4266
 
4097
4267
  message.transactionStatus = reader.int32() as any;
4098
4268
  continue;
4269
+ case 9:
4270
+ if (tag !== 72) {
4271
+ break;
4272
+ }
4273
+
4274
+ message.eventIndexInTransaction = reader.uint32();
4275
+ continue;
4099
4276
  }
4100
4277
  if ((tag & 7) === 4 || tag === 0) {
4101
4278
  break;
@@ -4110,13 +4287,16 @@ export const Event = {
4110
4287
  filterIds: globalThis.Array.isArray(object?.filterIds)
4111
4288
  ? object.filterIds.map((e: any) => globalThis.Number(e))
4112
4289
  : [],
4113
- fromAddress: isSet(object.fromAddress) ? FieldElement.fromJSON(object.fromAddress) : undefined,
4290
+ address: isSet(object.address) ? FieldElement.fromJSON(object.address) : undefined,
4114
4291
  keys: globalThis.Array.isArray(object?.keys) ? object.keys.map((e: any) => FieldElement.fromJSON(e)) : [],
4115
4292
  data: globalThis.Array.isArray(object?.data) ? object.data.map((e: any) => FieldElement.fromJSON(e)) : [],
4116
4293
  eventIndex: isSet(object.eventIndex) ? globalThis.Number(object.eventIndex) : 0,
4117
4294
  transactionIndex: isSet(object.transactionIndex) ? globalThis.Number(object.transactionIndex) : 0,
4118
4295
  transactionHash: isSet(object.transactionHash) ? FieldElement.fromJSON(object.transactionHash) : undefined,
4119
4296
  transactionStatus: isSet(object.transactionStatus) ? transactionStatusFromJSON(object.transactionStatus) : 0,
4297
+ eventIndexInTransaction: isSet(object.eventIndexInTransaction)
4298
+ ? globalThis.Number(object.eventIndexInTransaction)
4299
+ : 0,
4120
4300
  };
4121
4301
  },
4122
4302
 
@@ -4125,8 +4305,8 @@ export const Event = {
4125
4305
  if (message.filterIds?.length) {
4126
4306
  obj.filterIds = message.filterIds.map((e) => Math.round(e));
4127
4307
  }
4128
- if (message.fromAddress !== undefined) {
4129
- obj.fromAddress = FieldElement.toJSON(message.fromAddress);
4308
+ if (message.address !== undefined) {
4309
+ obj.address = FieldElement.toJSON(message.address);
4130
4310
  }
4131
4311
  if (message.keys?.length) {
4132
4312
  obj.keys = message.keys.map((e) => FieldElement.toJSON(e));
@@ -4146,6 +4326,9 @@ export const Event = {
4146
4326
  if (message.transactionStatus !== undefined && message.transactionStatus !== 0) {
4147
4327
  obj.transactionStatus = transactionStatusToJSON(message.transactionStatus);
4148
4328
  }
4329
+ if (message.eventIndexInTransaction !== undefined && message.eventIndexInTransaction !== 0) {
4330
+ obj.eventIndexInTransaction = Math.round(message.eventIndexInTransaction);
4331
+ }
4149
4332
  return obj;
4150
4333
  },
4151
4334
 
@@ -4155,8 +4338,8 @@ export const Event = {
4155
4338
  fromPartial(object: DeepPartial<Event>): Event {
4156
4339
  const message = createBaseEvent() as any;
4157
4340
  message.filterIds = object.filterIds?.map((e) => e) || [];
4158
- message.fromAddress = (object.fromAddress !== undefined && object.fromAddress !== null)
4159
- ? FieldElement.fromPartial(object.fromAddress)
4341
+ message.address = (object.address !== undefined && object.address !== null)
4342
+ ? FieldElement.fromPartial(object.address)
4160
4343
  : undefined;
4161
4344
  message.keys = object.keys?.map((e) => FieldElement.fromPartial(e)) || [];
4162
4345
  message.data = object.data?.map((e) => FieldElement.fromPartial(e)) || [];
@@ -4166,6 +4349,7 @@ export const Event = {
4166
4349
  ? FieldElement.fromPartial(object.transactionHash)
4167
4350
  : undefined;
4168
4351
  message.transactionStatus = object.transactionStatus ?? 0;
4352
+ message.eventIndexInTransaction = object.eventIndexInTransaction ?? 0;
4169
4353
  return message;
4170
4354
  },
4171
4355
  };
@@ -4180,6 +4364,7 @@ function createBaseMessageToL1(): MessageToL1 {
4180
4364
  transactionIndex: 0,
4181
4365
  transactionHash: undefined,
4182
4366
  transactionStatus: 0,
4367
+ messageIndexInTransaction: 0,
4183
4368
  };
4184
4369
  }
4185
4370
 
@@ -4215,6 +4400,9 @@ export const MessageToL1 = {
4215
4400
  if (message.transactionStatus !== undefined && message.transactionStatus !== 0) {
4216
4401
  writer.uint32(64).int32(message.transactionStatus);
4217
4402
  }
4403
+ if (message.messageIndexInTransaction !== undefined && message.messageIndexInTransaction !== 0) {
4404
+ writer.uint32(72).uint32(message.messageIndexInTransaction);
4405
+ }
4218
4406
  return writer;
4219
4407
  },
4220
4408
 
@@ -4291,6 +4479,13 @@ export const MessageToL1 = {
4291
4479
 
4292
4480
  message.transactionStatus = reader.int32() as any;
4293
4481
  continue;
4482
+ case 9:
4483
+ if (tag !== 72) {
4484
+ break;
4485
+ }
4486
+
4487
+ message.messageIndexInTransaction = reader.uint32();
4488
+ continue;
4294
4489
  }
4295
4490
  if ((tag & 7) === 4 || tag === 0) {
4296
4491
  break;
@@ -4314,6 +4509,9 @@ export const MessageToL1 = {
4314
4509
  transactionIndex: isSet(object.transactionIndex) ? globalThis.Number(object.transactionIndex) : 0,
4315
4510
  transactionHash: isSet(object.transactionHash) ? FieldElement.fromJSON(object.transactionHash) : undefined,
4316
4511
  transactionStatus: isSet(object.transactionStatus) ? transactionStatusFromJSON(object.transactionStatus) : 0,
4512
+ messageIndexInTransaction: isSet(object.messageIndexInTransaction)
4513
+ ? globalThis.Number(object.messageIndexInTransaction)
4514
+ : 0,
4317
4515
  };
4318
4516
  },
4319
4517
 
@@ -4343,6 +4541,9 @@ export const MessageToL1 = {
4343
4541
  if (message.transactionStatus !== undefined && message.transactionStatus !== 0) {
4344
4542
  obj.transactionStatus = transactionStatusToJSON(message.transactionStatus);
4345
4543
  }
4544
+ if (message.messageIndexInTransaction !== undefined && message.messageIndexInTransaction !== 0) {
4545
+ obj.messageIndexInTransaction = Math.round(message.messageIndexInTransaction);
4546
+ }
4346
4547
  return obj;
4347
4548
  },
4348
4549
 
@@ -4365,6 +4566,7 @@ export const MessageToL1 = {
4365
4566
  ? FieldElement.fromPartial(object.transactionHash)
4366
4567
  : undefined;
4367
4568
  message.transactionStatus = object.transactionStatus ?? 0;
4569
+ message.messageIndexInTransaction = object.messageIndexInTransaction ?? 0;
4368
4570
  return message;
4369
4571
  },
4370
4572
  };
@@ -5181,6 +5383,692 @@ export const Uint128 = {
5181
5383
  },
5182
5384
  };
5183
5385
 
5386
+ function createBaseStorageDiff(): StorageDiff {
5387
+ return { filterIds: [], contractAddress: undefined, storageEntries: [] };
5388
+ }
5389
+
5390
+ export const StorageDiff = {
5391
+ encode(message: StorageDiff, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
5392
+ if (message.filterIds !== undefined && message.filterIds.length !== 0) {
5393
+ writer.uint32(10).fork();
5394
+ for (const v of message.filterIds) {
5395
+ writer.uint32(v);
5396
+ }
5397
+ writer.ldelim();
5398
+ }
5399
+ if (message.contractAddress !== undefined) {
5400
+ FieldElement.encode(message.contractAddress, writer.uint32(18).fork()).ldelim();
5401
+ }
5402
+ if (message.storageEntries !== undefined && message.storageEntries.length !== 0) {
5403
+ for (const v of message.storageEntries) {
5404
+ StorageEntry.encode(v!, writer.uint32(26).fork()).ldelim();
5405
+ }
5406
+ }
5407
+ return writer;
5408
+ },
5409
+
5410
+ decode(input: _m0.Reader | Uint8Array, length?: number): StorageDiff {
5411
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
5412
+ let end = length === undefined ? reader.len : reader.pos + length;
5413
+ const message = createBaseStorageDiff() as any;
5414
+ while (reader.pos < end) {
5415
+ const tag = reader.uint32();
5416
+ switch (tag >>> 3) {
5417
+ case 1:
5418
+ if (tag === 8) {
5419
+ message.filterIds!.push(reader.uint32());
5420
+
5421
+ continue;
5422
+ }
5423
+
5424
+ if (tag === 10) {
5425
+ const end2 = reader.uint32() + reader.pos;
5426
+ while (reader.pos < end2) {
5427
+ message.filterIds!.push(reader.uint32());
5428
+ }
5429
+
5430
+ continue;
5431
+ }
5432
+
5433
+ break;
5434
+ case 2:
5435
+ if (tag !== 18) {
5436
+ break;
5437
+ }
5438
+
5439
+ message.contractAddress = FieldElement.decode(reader, reader.uint32());
5440
+ continue;
5441
+ case 3:
5442
+ if (tag !== 26) {
5443
+ break;
5444
+ }
5445
+
5446
+ message.storageEntries!.push(StorageEntry.decode(reader, reader.uint32()));
5447
+ continue;
5448
+ }
5449
+ if ((tag & 7) === 4 || tag === 0) {
5450
+ break;
5451
+ }
5452
+ reader.skipType(tag & 7);
5453
+ }
5454
+ return message;
5455
+ },
5456
+
5457
+ fromJSON(object: any): StorageDiff {
5458
+ return {
5459
+ filterIds: globalThis.Array.isArray(object?.filterIds)
5460
+ ? object.filterIds.map((e: any) => globalThis.Number(e))
5461
+ : [],
5462
+ contractAddress: isSet(object.contractAddress) ? FieldElement.fromJSON(object.contractAddress) : undefined,
5463
+ storageEntries: globalThis.Array.isArray(object?.storageEntries)
5464
+ ? object.storageEntries.map((e: any) => StorageEntry.fromJSON(e))
5465
+ : [],
5466
+ };
5467
+ },
5468
+
5469
+ toJSON(message: StorageDiff): unknown {
5470
+ const obj: any = {};
5471
+ if (message.filterIds?.length) {
5472
+ obj.filterIds = message.filterIds.map((e) => Math.round(e));
5473
+ }
5474
+ if (message.contractAddress !== undefined) {
5475
+ obj.contractAddress = FieldElement.toJSON(message.contractAddress);
5476
+ }
5477
+ if (message.storageEntries?.length) {
5478
+ obj.storageEntries = message.storageEntries.map((e) => StorageEntry.toJSON(e));
5479
+ }
5480
+ return obj;
5481
+ },
5482
+
5483
+ create(base?: DeepPartial<StorageDiff>): StorageDiff {
5484
+ return StorageDiff.fromPartial(base ?? {});
5485
+ },
5486
+ fromPartial(object: DeepPartial<StorageDiff>): StorageDiff {
5487
+ const message = createBaseStorageDiff() as any;
5488
+ message.filterIds = object.filterIds?.map((e) => e) || [];
5489
+ message.contractAddress = (object.contractAddress !== undefined && object.contractAddress !== null)
5490
+ ? FieldElement.fromPartial(object.contractAddress)
5491
+ : undefined;
5492
+ message.storageEntries = object.storageEntries?.map((e) => StorageEntry.fromPartial(e)) || [];
5493
+ return message;
5494
+ },
5495
+ };
5496
+
5497
+ function createBaseStorageEntry(): StorageEntry {
5498
+ return { key: undefined, value: undefined };
5499
+ }
5500
+
5501
+ export const StorageEntry = {
5502
+ encode(message: StorageEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
5503
+ if (message.key !== undefined) {
5504
+ FieldElement.encode(message.key, writer.uint32(10).fork()).ldelim();
5505
+ }
5506
+ if (message.value !== undefined) {
5507
+ FieldElement.encode(message.value, writer.uint32(18).fork()).ldelim();
5508
+ }
5509
+ return writer;
5510
+ },
5511
+
5512
+ decode(input: _m0.Reader | Uint8Array, length?: number): StorageEntry {
5513
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
5514
+ let end = length === undefined ? reader.len : reader.pos + length;
5515
+ const message = createBaseStorageEntry() as any;
5516
+ while (reader.pos < end) {
5517
+ const tag = reader.uint32();
5518
+ switch (tag >>> 3) {
5519
+ case 1:
5520
+ if (tag !== 10) {
5521
+ break;
5522
+ }
5523
+
5524
+ message.key = FieldElement.decode(reader, reader.uint32());
5525
+ continue;
5526
+ case 2:
5527
+ if (tag !== 18) {
5528
+ break;
5529
+ }
5530
+
5531
+ message.value = FieldElement.decode(reader, reader.uint32());
5532
+ continue;
5533
+ }
5534
+ if ((tag & 7) === 4 || tag === 0) {
5535
+ break;
5536
+ }
5537
+ reader.skipType(tag & 7);
5538
+ }
5539
+ return message;
5540
+ },
5541
+
5542
+ fromJSON(object: any): StorageEntry {
5543
+ return {
5544
+ key: isSet(object.key) ? FieldElement.fromJSON(object.key) : undefined,
5545
+ value: isSet(object.value) ? FieldElement.fromJSON(object.value) : undefined,
5546
+ };
5547
+ },
5548
+
5549
+ toJSON(message: StorageEntry): unknown {
5550
+ const obj: any = {};
5551
+ if (message.key !== undefined) {
5552
+ obj.key = FieldElement.toJSON(message.key);
5553
+ }
5554
+ if (message.value !== undefined) {
5555
+ obj.value = FieldElement.toJSON(message.value);
5556
+ }
5557
+ return obj;
5558
+ },
5559
+
5560
+ create(base?: DeepPartial<StorageEntry>): StorageEntry {
5561
+ return StorageEntry.fromPartial(base ?? {});
5562
+ },
5563
+ fromPartial(object: DeepPartial<StorageEntry>): StorageEntry {
5564
+ const message = createBaseStorageEntry() as any;
5565
+ message.key = (object.key !== undefined && object.key !== null) ? FieldElement.fromPartial(object.key) : undefined;
5566
+ message.value = (object.value !== undefined && object.value !== null)
5567
+ ? FieldElement.fromPartial(object.value)
5568
+ : undefined;
5569
+ return message;
5570
+ },
5571
+ };
5572
+
5573
+ function createBaseContractChange(): ContractChange {
5574
+ return { filterIds: [], change: undefined };
5575
+ }
5576
+
5577
+ export const ContractChange = {
5578
+ encode(message: ContractChange, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
5579
+ if (message.filterIds !== undefined && message.filterIds.length !== 0) {
5580
+ writer.uint32(10).fork();
5581
+ for (const v of message.filterIds) {
5582
+ writer.uint32(v);
5583
+ }
5584
+ writer.ldelim();
5585
+ }
5586
+ switch (message.change?.$case) {
5587
+ case "declaredClass":
5588
+ DeclaredClass.encode(message.change.declaredClass, writer.uint32(18).fork()).ldelim();
5589
+ break;
5590
+ case "replacedClass":
5591
+ ReplacedClass.encode(message.change.replacedClass, writer.uint32(26).fork()).ldelim();
5592
+ break;
5593
+ case "deployedContract":
5594
+ DeployedContract.encode(message.change.deployedContract, writer.uint32(34).fork()).ldelim();
5595
+ break;
5596
+ }
5597
+ return writer;
5598
+ },
5599
+
5600
+ decode(input: _m0.Reader | Uint8Array, length?: number): ContractChange {
5601
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
5602
+ let end = length === undefined ? reader.len : reader.pos + length;
5603
+ const message = createBaseContractChange() as any;
5604
+ while (reader.pos < end) {
5605
+ const tag = reader.uint32();
5606
+ switch (tag >>> 3) {
5607
+ case 1:
5608
+ if (tag === 8) {
5609
+ message.filterIds!.push(reader.uint32());
5610
+
5611
+ continue;
5612
+ }
5613
+
5614
+ if (tag === 10) {
5615
+ const end2 = reader.uint32() + reader.pos;
5616
+ while (reader.pos < end2) {
5617
+ message.filterIds!.push(reader.uint32());
5618
+ }
5619
+
5620
+ continue;
5621
+ }
5622
+
5623
+ break;
5624
+ case 2:
5625
+ if (tag !== 18) {
5626
+ break;
5627
+ }
5628
+
5629
+ message.change = { $case: "declaredClass", declaredClass: DeclaredClass.decode(reader, reader.uint32()) };
5630
+ continue;
5631
+ case 3:
5632
+ if (tag !== 26) {
5633
+ break;
5634
+ }
5635
+
5636
+ message.change = { $case: "replacedClass", replacedClass: ReplacedClass.decode(reader, reader.uint32()) };
5637
+ continue;
5638
+ case 4:
5639
+ if (tag !== 34) {
5640
+ break;
5641
+ }
5642
+
5643
+ message.change = {
5644
+ $case: "deployedContract",
5645
+ deployedContract: DeployedContract.decode(reader, reader.uint32()),
5646
+ };
5647
+ continue;
5648
+ }
5649
+ if ((tag & 7) === 4 || tag === 0) {
5650
+ break;
5651
+ }
5652
+ reader.skipType(tag & 7);
5653
+ }
5654
+ return message;
5655
+ },
5656
+
5657
+ fromJSON(object: any): ContractChange {
5658
+ return {
5659
+ filterIds: globalThis.Array.isArray(object?.filterIds)
5660
+ ? object.filterIds.map((e: any) => globalThis.Number(e))
5661
+ : [],
5662
+ change: isSet(object.declaredClass)
5663
+ ? { $case: "declaredClass", declaredClass: DeclaredClass.fromJSON(object.declaredClass) }
5664
+ : isSet(object.replacedClass)
5665
+ ? { $case: "replacedClass", replacedClass: ReplacedClass.fromJSON(object.replacedClass) }
5666
+ : isSet(object.deployedContract)
5667
+ ? { $case: "deployedContract", deployedContract: DeployedContract.fromJSON(object.deployedContract) }
5668
+ : undefined,
5669
+ };
5670
+ },
5671
+
5672
+ toJSON(message: ContractChange): unknown {
5673
+ const obj: any = {};
5674
+ if (message.filterIds?.length) {
5675
+ obj.filterIds = message.filterIds.map((e) => Math.round(e));
5676
+ }
5677
+ if (message.change?.$case === "declaredClass") {
5678
+ obj.declaredClass = DeclaredClass.toJSON(message.change.declaredClass);
5679
+ }
5680
+ if (message.change?.$case === "replacedClass") {
5681
+ obj.replacedClass = ReplacedClass.toJSON(message.change.replacedClass);
5682
+ }
5683
+ if (message.change?.$case === "deployedContract") {
5684
+ obj.deployedContract = DeployedContract.toJSON(message.change.deployedContract);
5685
+ }
5686
+ return obj;
5687
+ },
5688
+
5689
+ create(base?: DeepPartial<ContractChange>): ContractChange {
5690
+ return ContractChange.fromPartial(base ?? {});
5691
+ },
5692
+ fromPartial(object: DeepPartial<ContractChange>): ContractChange {
5693
+ const message = createBaseContractChange() as any;
5694
+ message.filterIds = object.filterIds?.map((e) => e) || [];
5695
+ if (
5696
+ object.change?.$case === "declaredClass" &&
5697
+ object.change?.declaredClass !== undefined &&
5698
+ object.change?.declaredClass !== null
5699
+ ) {
5700
+ message.change = {
5701
+ $case: "declaredClass",
5702
+ declaredClass: DeclaredClass.fromPartial(object.change.declaredClass),
5703
+ };
5704
+ }
5705
+ if (
5706
+ object.change?.$case === "replacedClass" &&
5707
+ object.change?.replacedClass !== undefined &&
5708
+ object.change?.replacedClass !== null
5709
+ ) {
5710
+ message.change = {
5711
+ $case: "replacedClass",
5712
+ replacedClass: ReplacedClass.fromPartial(object.change.replacedClass),
5713
+ };
5714
+ }
5715
+ if (
5716
+ object.change?.$case === "deployedContract" &&
5717
+ object.change?.deployedContract !== undefined &&
5718
+ object.change?.deployedContract !== null
5719
+ ) {
5720
+ message.change = {
5721
+ $case: "deployedContract",
5722
+ deployedContract: DeployedContract.fromPartial(object.change.deployedContract),
5723
+ };
5724
+ }
5725
+ return message;
5726
+ },
5727
+ };
5728
+
5729
+ function createBaseDeclaredClass(): DeclaredClass {
5730
+ return { classHash: undefined, compiledClassHash: undefined };
5731
+ }
5732
+
5733
+ export const DeclaredClass = {
5734
+ encode(message: DeclaredClass, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
5735
+ if (message.classHash !== undefined) {
5736
+ FieldElement.encode(message.classHash, writer.uint32(10).fork()).ldelim();
5737
+ }
5738
+ if (message.compiledClassHash !== undefined) {
5739
+ FieldElement.encode(message.compiledClassHash, writer.uint32(18).fork()).ldelim();
5740
+ }
5741
+ return writer;
5742
+ },
5743
+
5744
+ decode(input: _m0.Reader | Uint8Array, length?: number): DeclaredClass {
5745
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
5746
+ let end = length === undefined ? reader.len : reader.pos + length;
5747
+ const message = createBaseDeclaredClass() as any;
5748
+ while (reader.pos < end) {
5749
+ const tag = reader.uint32();
5750
+ switch (tag >>> 3) {
5751
+ case 1:
5752
+ if (tag !== 10) {
5753
+ break;
5754
+ }
5755
+
5756
+ message.classHash = FieldElement.decode(reader, reader.uint32());
5757
+ continue;
5758
+ case 2:
5759
+ if (tag !== 18) {
5760
+ break;
5761
+ }
5762
+
5763
+ message.compiledClassHash = FieldElement.decode(reader, reader.uint32());
5764
+ continue;
5765
+ }
5766
+ if ((tag & 7) === 4 || tag === 0) {
5767
+ break;
5768
+ }
5769
+ reader.skipType(tag & 7);
5770
+ }
5771
+ return message;
5772
+ },
5773
+
5774
+ fromJSON(object: any): DeclaredClass {
5775
+ return {
5776
+ classHash: isSet(object.classHash) ? FieldElement.fromJSON(object.classHash) : undefined,
5777
+ compiledClassHash: isSet(object.compiledClassHash) ? FieldElement.fromJSON(object.compiledClassHash) : undefined,
5778
+ };
5779
+ },
5780
+
5781
+ toJSON(message: DeclaredClass): unknown {
5782
+ const obj: any = {};
5783
+ if (message.classHash !== undefined) {
5784
+ obj.classHash = FieldElement.toJSON(message.classHash);
5785
+ }
5786
+ if (message.compiledClassHash !== undefined) {
5787
+ obj.compiledClassHash = FieldElement.toJSON(message.compiledClassHash);
5788
+ }
5789
+ return obj;
5790
+ },
5791
+
5792
+ create(base?: DeepPartial<DeclaredClass>): DeclaredClass {
5793
+ return DeclaredClass.fromPartial(base ?? {});
5794
+ },
5795
+ fromPartial(object: DeepPartial<DeclaredClass>): DeclaredClass {
5796
+ const message = createBaseDeclaredClass() as any;
5797
+ message.classHash = (object.classHash !== undefined && object.classHash !== null)
5798
+ ? FieldElement.fromPartial(object.classHash)
5799
+ : undefined;
5800
+ message.compiledClassHash = (object.compiledClassHash !== undefined && object.compiledClassHash !== null)
5801
+ ? FieldElement.fromPartial(object.compiledClassHash)
5802
+ : undefined;
5803
+ return message;
5804
+ },
5805
+ };
5806
+
5807
+ function createBaseReplacedClass(): ReplacedClass {
5808
+ return { contractAddress: undefined, classHash: undefined };
5809
+ }
5810
+
5811
+ export const ReplacedClass = {
5812
+ encode(message: ReplacedClass, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
5813
+ if (message.contractAddress !== undefined) {
5814
+ FieldElement.encode(message.contractAddress, writer.uint32(10).fork()).ldelim();
5815
+ }
5816
+ if (message.classHash !== undefined) {
5817
+ FieldElement.encode(message.classHash, writer.uint32(18).fork()).ldelim();
5818
+ }
5819
+ return writer;
5820
+ },
5821
+
5822
+ decode(input: _m0.Reader | Uint8Array, length?: number): ReplacedClass {
5823
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
5824
+ let end = length === undefined ? reader.len : reader.pos + length;
5825
+ const message = createBaseReplacedClass() as any;
5826
+ while (reader.pos < end) {
5827
+ const tag = reader.uint32();
5828
+ switch (tag >>> 3) {
5829
+ case 1:
5830
+ if (tag !== 10) {
5831
+ break;
5832
+ }
5833
+
5834
+ message.contractAddress = FieldElement.decode(reader, reader.uint32());
5835
+ continue;
5836
+ case 2:
5837
+ if (tag !== 18) {
5838
+ break;
5839
+ }
5840
+
5841
+ message.classHash = FieldElement.decode(reader, reader.uint32());
5842
+ continue;
5843
+ }
5844
+ if ((tag & 7) === 4 || tag === 0) {
5845
+ break;
5846
+ }
5847
+ reader.skipType(tag & 7);
5848
+ }
5849
+ return message;
5850
+ },
5851
+
5852
+ fromJSON(object: any): ReplacedClass {
5853
+ return {
5854
+ contractAddress: isSet(object.contractAddress) ? FieldElement.fromJSON(object.contractAddress) : undefined,
5855
+ classHash: isSet(object.classHash) ? FieldElement.fromJSON(object.classHash) : undefined,
5856
+ };
5857
+ },
5858
+
5859
+ toJSON(message: ReplacedClass): unknown {
5860
+ const obj: any = {};
5861
+ if (message.contractAddress !== undefined) {
5862
+ obj.contractAddress = FieldElement.toJSON(message.contractAddress);
5863
+ }
5864
+ if (message.classHash !== undefined) {
5865
+ obj.classHash = FieldElement.toJSON(message.classHash);
5866
+ }
5867
+ return obj;
5868
+ },
5869
+
5870
+ create(base?: DeepPartial<ReplacedClass>): ReplacedClass {
5871
+ return ReplacedClass.fromPartial(base ?? {});
5872
+ },
5873
+ fromPartial(object: DeepPartial<ReplacedClass>): ReplacedClass {
5874
+ const message = createBaseReplacedClass() as any;
5875
+ message.contractAddress = (object.contractAddress !== undefined && object.contractAddress !== null)
5876
+ ? FieldElement.fromPartial(object.contractAddress)
5877
+ : undefined;
5878
+ message.classHash = (object.classHash !== undefined && object.classHash !== null)
5879
+ ? FieldElement.fromPartial(object.classHash)
5880
+ : undefined;
5881
+ return message;
5882
+ },
5883
+ };
5884
+
5885
+ function createBaseDeployedContract(): DeployedContract {
5886
+ return { contractAddress: undefined, classHash: undefined };
5887
+ }
5888
+
5889
+ export const DeployedContract = {
5890
+ encode(message: DeployedContract, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
5891
+ if (message.contractAddress !== undefined) {
5892
+ FieldElement.encode(message.contractAddress, writer.uint32(10).fork()).ldelim();
5893
+ }
5894
+ if (message.classHash !== undefined) {
5895
+ FieldElement.encode(message.classHash, writer.uint32(18).fork()).ldelim();
5896
+ }
5897
+ return writer;
5898
+ },
5899
+
5900
+ decode(input: _m0.Reader | Uint8Array, length?: number): DeployedContract {
5901
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
5902
+ let end = length === undefined ? reader.len : reader.pos + length;
5903
+ const message = createBaseDeployedContract() as any;
5904
+ while (reader.pos < end) {
5905
+ const tag = reader.uint32();
5906
+ switch (tag >>> 3) {
5907
+ case 1:
5908
+ if (tag !== 10) {
5909
+ break;
5910
+ }
5911
+
5912
+ message.contractAddress = FieldElement.decode(reader, reader.uint32());
5913
+ continue;
5914
+ case 2:
5915
+ if (tag !== 18) {
5916
+ break;
5917
+ }
5918
+
5919
+ message.classHash = FieldElement.decode(reader, reader.uint32());
5920
+ continue;
5921
+ }
5922
+ if ((tag & 7) === 4 || tag === 0) {
5923
+ break;
5924
+ }
5925
+ reader.skipType(tag & 7);
5926
+ }
5927
+ return message;
5928
+ },
5929
+
5930
+ fromJSON(object: any): DeployedContract {
5931
+ return {
5932
+ contractAddress: isSet(object.contractAddress) ? FieldElement.fromJSON(object.contractAddress) : undefined,
5933
+ classHash: isSet(object.classHash) ? FieldElement.fromJSON(object.classHash) : undefined,
5934
+ };
5935
+ },
5936
+
5937
+ toJSON(message: DeployedContract): unknown {
5938
+ const obj: any = {};
5939
+ if (message.contractAddress !== undefined) {
5940
+ obj.contractAddress = FieldElement.toJSON(message.contractAddress);
5941
+ }
5942
+ if (message.classHash !== undefined) {
5943
+ obj.classHash = FieldElement.toJSON(message.classHash);
5944
+ }
5945
+ return obj;
5946
+ },
5947
+
5948
+ create(base?: DeepPartial<DeployedContract>): DeployedContract {
5949
+ return DeployedContract.fromPartial(base ?? {});
5950
+ },
5951
+ fromPartial(object: DeepPartial<DeployedContract>): DeployedContract {
5952
+ const message = createBaseDeployedContract() as any;
5953
+ message.contractAddress = (object.contractAddress !== undefined && object.contractAddress !== null)
5954
+ ? FieldElement.fromPartial(object.contractAddress)
5955
+ : undefined;
5956
+ message.classHash = (object.classHash !== undefined && object.classHash !== null)
5957
+ ? FieldElement.fromPartial(object.classHash)
5958
+ : undefined;
5959
+ return message;
5960
+ },
5961
+ };
5962
+
5963
+ function createBaseNonceUpdate(): NonceUpdate {
5964
+ return { filterIds: [], contractAddress: undefined, nonce: undefined };
5965
+ }
5966
+
5967
+ export const NonceUpdate = {
5968
+ encode(message: NonceUpdate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
5969
+ if (message.filterIds !== undefined && message.filterIds.length !== 0) {
5970
+ writer.uint32(10).fork();
5971
+ for (const v of message.filterIds) {
5972
+ writer.uint32(v);
5973
+ }
5974
+ writer.ldelim();
5975
+ }
5976
+ if (message.contractAddress !== undefined) {
5977
+ FieldElement.encode(message.contractAddress, writer.uint32(18).fork()).ldelim();
5978
+ }
5979
+ if (message.nonce !== undefined) {
5980
+ FieldElement.encode(message.nonce, writer.uint32(26).fork()).ldelim();
5981
+ }
5982
+ return writer;
5983
+ },
5984
+
5985
+ decode(input: _m0.Reader | Uint8Array, length?: number): NonceUpdate {
5986
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
5987
+ let end = length === undefined ? reader.len : reader.pos + length;
5988
+ const message = createBaseNonceUpdate() as any;
5989
+ while (reader.pos < end) {
5990
+ const tag = reader.uint32();
5991
+ switch (tag >>> 3) {
5992
+ case 1:
5993
+ if (tag === 8) {
5994
+ message.filterIds!.push(reader.uint32());
5995
+
5996
+ continue;
5997
+ }
5998
+
5999
+ if (tag === 10) {
6000
+ const end2 = reader.uint32() + reader.pos;
6001
+ while (reader.pos < end2) {
6002
+ message.filterIds!.push(reader.uint32());
6003
+ }
6004
+
6005
+ continue;
6006
+ }
6007
+
6008
+ break;
6009
+ case 2:
6010
+ if (tag !== 18) {
6011
+ break;
6012
+ }
6013
+
6014
+ message.contractAddress = FieldElement.decode(reader, reader.uint32());
6015
+ continue;
6016
+ case 3:
6017
+ if (tag !== 26) {
6018
+ break;
6019
+ }
6020
+
6021
+ message.nonce = FieldElement.decode(reader, reader.uint32());
6022
+ continue;
6023
+ }
6024
+ if ((tag & 7) === 4 || tag === 0) {
6025
+ break;
6026
+ }
6027
+ reader.skipType(tag & 7);
6028
+ }
6029
+ return message;
6030
+ },
6031
+
6032
+ fromJSON(object: any): NonceUpdate {
6033
+ return {
6034
+ filterIds: globalThis.Array.isArray(object?.filterIds)
6035
+ ? object.filterIds.map((e: any) => globalThis.Number(e))
6036
+ : [],
6037
+ contractAddress: isSet(object.contractAddress) ? FieldElement.fromJSON(object.contractAddress) : undefined,
6038
+ nonce: isSet(object.nonce) ? FieldElement.fromJSON(object.nonce) : undefined,
6039
+ };
6040
+ },
6041
+
6042
+ toJSON(message: NonceUpdate): unknown {
6043
+ const obj: any = {};
6044
+ if (message.filterIds?.length) {
6045
+ obj.filterIds = message.filterIds.map((e) => Math.round(e));
6046
+ }
6047
+ if (message.contractAddress !== undefined) {
6048
+ obj.contractAddress = FieldElement.toJSON(message.contractAddress);
6049
+ }
6050
+ if (message.nonce !== undefined) {
6051
+ obj.nonce = FieldElement.toJSON(message.nonce);
6052
+ }
6053
+ return obj;
6054
+ },
6055
+
6056
+ create(base?: DeepPartial<NonceUpdate>): NonceUpdate {
6057
+ return NonceUpdate.fromPartial(base ?? {});
6058
+ },
6059
+ fromPartial(object: DeepPartial<NonceUpdate>): NonceUpdate {
6060
+ const message = createBaseNonceUpdate() as any;
6061
+ message.filterIds = object.filterIds?.map((e) => e) || [];
6062
+ message.contractAddress = (object.contractAddress !== undefined && object.contractAddress !== null)
6063
+ ? FieldElement.fromPartial(object.contractAddress)
6064
+ : undefined;
6065
+ message.nonce = (object.nonce !== undefined && object.nonce !== null)
6066
+ ? FieldElement.fromPartial(object.nonce)
6067
+ : undefined;
6068
+ return message;
6069
+ },
6070
+ };
6071
+
5184
6072
  function bytesFromBase64(b64: string): Uint8Array {
5185
6073
  if ((globalThis as any).Buffer) {
5186
6074
  return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));