@aztec/wsdb 0.0.1-commit.031e54b → 0.0.1-commit.2606882

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.
@@ -1,6 +1,35 @@
1
1
  // AUTOGENERATED FILE - DO NOT EDIT
2
2
  /** Schema version hash for compatibility checking */
3
- export const SCHEMA_HASH = '90183fc3ff00d1a28bf97f82639c1db1a5f8f466ae3a1d3699e0bb666915c6c6';
3
+ export const SCHEMA_HASH = 'ca16f46e63028fba3b2e74491994394ebcdf89f48145e74320eb343277fe3bfd';
4
+ // Runtime guards for wire types that JS cannot represent natively.
5
+ // TODO: migrate u64 fields to bigint end-to-end and drop these.
6
+ //
7
+ // Decode: msgpackr returns uint64/int64 wire values as bigint once they
8
+ // exceed 32 bits; values must fit in the JS safe integer range.
9
+ function assertU64(value, ctx) {
10
+ if (typeof value === "bigint") {
11
+ if (value < 0n || value > BigInt(Number.MAX_SAFE_INTEGER)) {
12
+ throw new Error(`${ctx}: u64 value ${value} is outside JS safe integer range`);
13
+ }
14
+ return Number(value);
15
+ }
16
+ if (!Number.isSafeInteger(value) || value < 0) {
17
+ throw new Error(`${ctx}: u64 value ${value} is outside JS safe integer range`);
18
+ }
19
+ return value;
20
+ }
21
+ // Encode: msgpackr encodes JS numbers above 2^32 as float64, which strict
22
+ // u64 decoders reject; route them through bigint so the wire type stays uint.
23
+ function toWireU64(value, ctx) {
24
+ const checked = assertU64(value, ctx);
25
+ return checked > 0xffffffff ? BigInt(checked) : checked;
26
+ }
27
+ function assertBin32(value, ctx) {
28
+ if (value.length !== 32) {
29
+ throw new Error(`${ctx}: expected 32 bytes, got ${value.length}`);
30
+ }
31
+ return value;
32
+ }
4
33
  // Conversion functions (exported)
5
34
  export function toTreeStateReference(o) {
6
35
  if (o.treeId === undefined) {
@@ -15,8 +44,8 @@ export function toTreeStateReference(o) {
15
44
  ;
16
45
  return {
17
46
  treeId: o.treeId,
18
- root: o.root,
19
- size: o.size,
47
+ root: assertBin32(o.root, "o.root"),
48
+ size: assertU64(o.size, "o.size"),
20
49
  };
21
50
  }
22
51
  export function toPublicDataLeafValue(o) {
@@ -28,8 +57,8 @@ export function toPublicDataLeafValue(o) {
28
57
  }
29
58
  ;
30
59
  return {
31
- slot: o.slot,
32
- value: o.value,
60
+ slot: assertBin32(o.slot, "o.slot"),
61
+ value: assertBin32(o.value, "o.value"),
33
62
  };
34
63
  }
35
64
  export function toNullifierLeafValue(o) {
@@ -38,7 +67,7 @@ export function toNullifierLeafValue(o) {
38
67
  }
39
68
  ;
40
69
  return {
41
- nullifier: o.nullifier,
70
+ nullifier: assertBin32(o.nullifier, "o.nullifier"),
42
71
  };
43
72
  }
44
73
  export function toIndexedPublicDataLeafValue(o) {
@@ -54,8 +83,8 @@ export function toIndexedPublicDataLeafValue(o) {
54
83
  ;
55
84
  return {
56
85
  leaf: toPublicDataLeafValue(o.leaf),
57
- nextIndex: o.nextIndex,
58
- nextKey: o.nextKey,
86
+ nextIndex: assertU64(o.nextIndex, "o.nextIndex"),
87
+ nextKey: assertBin32(o.nextKey, "o.nextKey"),
59
88
  };
60
89
  }
61
90
  export function toIndexedNullifierLeafValue(o) {
@@ -71,8 +100,8 @@ export function toIndexedNullifierLeafValue(o) {
71
100
  ;
72
101
  return {
73
102
  leaf: toNullifierLeafValue(o.leaf),
74
- nextIndex: o.nextIndex,
75
- nextKey: o.nextKey,
103
+ nextIndex: assertU64(o.nextIndex, "o.nextIndex"),
104
+ nextKey: assertBin32(o.nextKey, "o.nextKey"),
76
105
  };
77
106
  }
78
107
  export function toSiblingPathAndIndex(o) {
@@ -84,8 +113,8 @@ export function toSiblingPathAndIndex(o) {
84
113
  }
85
114
  ;
86
115
  return {
87
- index: o.index,
88
- path: o.path,
116
+ index: assertU64(o.index, "o.index"),
117
+ path: o.path.map((v) => assertBin32(v, "v")),
89
118
  };
90
119
  }
91
120
  export function toPublicDataLeafUpdateWitnessData(o) {
@@ -101,8 +130,8 @@ export function toPublicDataLeafUpdateWitnessData(o) {
101
130
  ;
102
131
  return {
103
132
  leaf: toIndexedPublicDataLeafValue(o.leaf),
104
- index: o.index,
105
- path: o.path,
133
+ index: assertU64(o.index, "o.index"),
134
+ path: o.path.map((v) => assertBin32(v, "v")),
106
135
  };
107
136
  }
108
137
  export function toSortedPublicDataLeaf(o) {
@@ -115,7 +144,7 @@ export function toSortedPublicDataLeaf(o) {
115
144
  ;
116
145
  return {
117
146
  leaf: toPublicDataLeafValue(o.leaf),
118
- index: o.index,
147
+ index: assertU64(o.index, "o.index"),
119
148
  };
120
149
  }
121
150
  export function toBatchInsertionResultPublicData(o) {
@@ -132,7 +161,7 @@ export function toBatchInsertionResultPublicData(o) {
132
161
  return {
133
162
  lowLeafWitnessData: o.lowLeafWitnessData.map((v) => toPublicDataLeafUpdateWitnessData(v)),
134
163
  sortedLeaves: o.sortedLeaves.map((v) => toSortedPublicDataLeaf(v)),
135
- subtreePath: o.subtreePath,
164
+ subtreePath: o.subtreePath.map((v) => assertBin32(v, "v")),
136
165
  };
137
166
  }
138
167
  export function toNullifierLeafUpdateWitnessData(o) {
@@ -148,8 +177,8 @@ export function toNullifierLeafUpdateWitnessData(o) {
148
177
  ;
149
178
  return {
150
179
  leaf: toIndexedNullifierLeafValue(o.leaf),
151
- index: o.index,
152
- path: o.path,
180
+ index: assertU64(o.index, "o.index"),
181
+ path: o.path.map((v) => assertBin32(v, "v")),
153
182
  };
154
183
  }
155
184
  export function toSortedNullifierLeaf(o) {
@@ -162,7 +191,7 @@ export function toSortedNullifierLeaf(o) {
162
191
  ;
163
192
  return {
164
193
  leaf: toNullifierLeafValue(o.leaf),
165
- index: o.index,
194
+ index: assertU64(o.index, "o.index"),
166
195
  };
167
196
  }
168
197
  export function toBatchInsertionResultNullifier(o) {
@@ -179,7 +208,7 @@ export function toBatchInsertionResultNullifier(o) {
179
208
  return {
180
209
  lowLeafWitnessData: o.lowLeafWitnessData.map((v) => toNullifierLeafUpdateWitnessData(v)),
181
210
  sortedLeaves: o.sortedLeaves.map((v) => toSortedNullifierLeaf(v)),
182
- subtreePath: o.subtreePath,
211
+ subtreePath: o.subtreePath.map((v) => assertBin32(v, "v")),
183
212
  };
184
213
  }
185
214
  export function toSequentialInsertionResultPublicData(o) {
@@ -223,9 +252,9 @@ export function toWorldStateStatusSummary(o) {
223
252
  }
224
253
  ;
225
254
  return {
226
- unfinalizedBlockNumber: o.unfinalizedBlockNumber,
227
- finalizedBlockNumber: o.finalizedBlockNumber,
228
- oldestHistoricalBlock: o.oldestHistoricalBlock,
255
+ unfinalizedBlockNumber: assertU64(o.unfinalizedBlockNumber, "o.unfinalizedBlockNumber"),
256
+ finalizedBlockNumber: assertU64(o.finalizedBlockNumber, "o.finalizedBlockNumber"),
257
+ oldestHistoricalBlock: assertU64(o.oldestHistoricalBlock, "o.oldestHistoricalBlock"),
229
258
  treesAreSynched: o.treesAreSynched,
230
259
  };
231
260
  }
@@ -242,8 +271,8 @@ export function toDBStats(o) {
242
271
  ;
243
272
  return {
244
273
  name: o.name,
245
- numDataItems: o.numDataItems,
246
- totalUsedSize: o.totalUsedSize,
274
+ numDataItems: assertU64(o.numDataItems, "o.numDataItems"),
275
+ totalUsedSize: assertU64(o.totalUsedSize, "o.totalUsedSize"),
247
276
  };
248
277
  }
249
278
  export function toTreeDBStats(o) {
@@ -270,8 +299,8 @@ export function toTreeDBStats(o) {
270
299
  }
271
300
  ;
272
301
  return {
273
- mapSize: o.mapSize,
274
- physicalFileSize: o.physicalFileSize,
302
+ mapSize: assertU64(o.mapSize, "o.mapSize"),
303
+ physicalFileSize: assertU64(o.physicalFileSize, "o.physicalFileSize"),
275
304
  blocksDBStats: toDBStats(o.blocksDBStats),
276
305
  nodesDBStats: toDBStats(o.nodesDBStats),
277
306
  leafPreimagesDBStats: toDBStats(o.leafPreimagesDBStats),
@@ -339,11 +368,11 @@ export function toTreeMeta(o) {
339
368
  return {
340
369
  name: o.name,
341
370
  depth: o.depth,
342
- size: o.size,
343
- committedSize: o.committedSize,
344
- root: o.root,
345
- initialSize: o.initialSize,
346
- initialRoot: o.initialRoot,
371
+ size: assertU64(o.size, "o.size"),
372
+ committedSize: assertU64(o.committedSize, "o.committedSize"),
373
+ root: assertBin32(o.root, "o.root"),
374
+ initialSize: assertU64(o.initialSize, "o.initialSize"),
375
+ initialRoot: assertBin32(o.initialRoot, "o.initialRoot"),
347
376
  oldestHistoricBlock: o.oldestHistoricBlock,
348
377
  unfinalizedBlockHeight: o.unfinalizedBlockHeight,
349
378
  finalizedBlockHeight: o.finalizedBlockHeight,
@@ -403,7 +432,7 @@ export function toWorldStateRevision(o) {
403
432
  }
404
433
  ;
405
434
  return {
406
- forkId: o.forkId,
435
+ forkId: assertU64(o.forkId, "o.forkId"),
407
436
  blockNumber: o.blockNumber,
408
437
  includeUncommitted: o.includeUncommitted,
409
438
  };
@@ -447,7 +476,7 @@ export function toWsdbGetLeafValue(o) {
447
476
  return {
448
477
  treeId: o.treeId,
449
478
  revision: toWorldStateRevision(o.revision),
450
- leafIndex: o.leafIndex,
479
+ leafIndex: assertU64(o.leafIndex, "o.leafIndex"),
451
480
  };
452
481
  }
453
482
  export function toWsdbGetPublicDataLeafValue(o) {
@@ -460,7 +489,7 @@ export function toWsdbGetPublicDataLeafValue(o) {
460
489
  ;
461
490
  return {
462
491
  revision: toWorldStateRevision(o.revision),
463
- leafIndex: o.leafIndex,
492
+ leafIndex: assertU64(o.leafIndex, "o.leafIndex"),
464
493
  };
465
494
  }
466
495
  export function toWsdbGetNullifierLeafValue(o) {
@@ -473,7 +502,7 @@ export function toWsdbGetNullifierLeafValue(o) {
473
502
  ;
474
503
  return {
475
504
  revision: toWorldStateRevision(o.revision),
476
- leafIndex: o.leafIndex,
505
+ leafIndex: assertU64(o.leafIndex, "o.leafIndex"),
477
506
  };
478
507
  }
479
508
  export function toWsdbGetPublicDataLeafPreimage(o) {
@@ -486,7 +515,7 @@ export function toWsdbGetPublicDataLeafPreimage(o) {
486
515
  ;
487
516
  return {
488
517
  revision: toWorldStateRevision(o.revision),
489
- leafIndex: o.leafIndex,
518
+ leafIndex: assertU64(o.leafIndex, "o.leafIndex"),
490
519
  };
491
520
  }
492
521
  export function toWsdbGetNullifierLeafPreimage(o) {
@@ -499,7 +528,7 @@ export function toWsdbGetNullifierLeafPreimage(o) {
499
528
  ;
500
529
  return {
501
530
  revision: toWorldStateRevision(o.revision),
502
- leafIndex: o.leafIndex,
531
+ leafIndex: assertU64(o.leafIndex, "o.leafIndex"),
503
532
  };
504
533
  }
505
534
  export function toWsdbGetSiblingPath(o) {
@@ -516,7 +545,7 @@ export function toWsdbGetSiblingPath(o) {
516
545
  return {
517
546
  treeId: o.treeId,
518
547
  revision: toWorldStateRevision(o.revision),
519
- leafIndex: o.leafIndex,
548
+ leafIndex: assertU64(o.leafIndex, "o.leafIndex"),
520
549
  };
521
550
  }
522
551
  export function toWsdbGetBlockNumbersForLeafIndices(o) {
@@ -533,7 +562,7 @@ export function toWsdbGetBlockNumbersForLeafIndices(o) {
533
562
  return {
534
563
  treeId: o.treeId,
535
564
  revision: toWorldStateRevision(o.revision),
536
- leafIndices: o.leafIndices,
565
+ leafIndices: o.leafIndices.map((v) => assertU64(v, "v")),
537
566
  };
538
567
  }
539
568
  export function toWsdbFindLeafIndices(o) {
@@ -553,8 +582,8 @@ export function toWsdbFindLeafIndices(o) {
553
582
  return {
554
583
  treeId: o.treeId,
555
584
  revision: toWorldStateRevision(o.revision),
556
- leaves: o.leaves,
557
- startIndex: o.startIndex,
585
+ leaves: o.leaves.map((v) => assertBin32(v, "v")),
586
+ startIndex: assertU64(o.startIndex, "o.startIndex"),
558
587
  };
559
588
  }
560
589
  export function toWsdbFindPublicDataLeafIndices(o) {
@@ -571,7 +600,7 @@ export function toWsdbFindPublicDataLeafIndices(o) {
571
600
  return {
572
601
  revision: toWorldStateRevision(o.revision),
573
602
  leaves: o.leaves.map((v) => toPublicDataLeafValue(v)),
574
- startIndex: o.startIndex,
603
+ startIndex: assertU64(o.startIndex, "o.startIndex"),
575
604
  };
576
605
  }
577
606
  export function toWsdbFindNullifierLeafIndices(o) {
@@ -588,7 +617,7 @@ export function toWsdbFindNullifierLeafIndices(o) {
588
617
  return {
589
618
  revision: toWorldStateRevision(o.revision),
590
619
  leaves: o.leaves.map((v) => toNullifierLeafValue(v)),
591
- startIndex: o.startIndex,
620
+ startIndex: assertU64(o.startIndex, "o.startIndex"),
592
621
  };
593
622
  }
594
623
  export function toWsdbFindLowLeaf(o) {
@@ -605,7 +634,7 @@ export function toWsdbFindLowLeaf(o) {
605
634
  return {
606
635
  treeId: o.treeId,
607
636
  revision: toWorldStateRevision(o.revision),
608
- key: o.key,
637
+ key: assertBin32(o.key, "o.key"),
609
638
  };
610
639
  }
611
640
  export function toWsdbFindSiblingPaths(o) {
@@ -622,7 +651,7 @@ export function toWsdbFindSiblingPaths(o) {
622
651
  return {
623
652
  treeId: o.treeId,
624
653
  revision: toWorldStateRevision(o.revision),
625
- leaves: o.leaves,
654
+ leaves: o.leaves.map((v) => assertBin32(v, "v")),
626
655
  };
627
656
  }
628
657
  export function toWsdbFindPublicDataSiblingPaths(o) {
@@ -664,8 +693,8 @@ export function toWsdbAppendLeaves(o) {
664
693
  ;
665
694
  return {
666
695
  treeId: o.treeId,
667
- leaves: o.leaves,
668
- forkId: o.forkId,
696
+ leaves: o.leaves.map((v) => assertBin32(v, "v")),
697
+ forkId: assertU64(o.forkId, "o.forkId"),
669
698
  };
670
699
  }
671
700
  export function toWsdbAppendPublicDataLeaves(o) {
@@ -678,7 +707,7 @@ export function toWsdbAppendPublicDataLeaves(o) {
678
707
  ;
679
708
  return {
680
709
  leaves: o.leaves.map((v) => toPublicDataLeafValue(v)),
681
- forkId: o.forkId,
710
+ forkId: assertU64(o.forkId, "o.forkId"),
682
711
  };
683
712
  }
684
713
  export function toWsdbAppendNullifierLeaves(o) {
@@ -691,7 +720,7 @@ export function toWsdbAppendNullifierLeaves(o) {
691
720
  ;
692
721
  return {
693
722
  leaves: o.leaves.map((v) => toNullifierLeafValue(v)),
694
- forkId: o.forkId,
723
+ forkId: assertU64(o.forkId, "o.forkId"),
695
724
  };
696
725
  }
697
726
  export function toWsdbBatchInsertPublicData(o) {
@@ -708,7 +737,7 @@ export function toWsdbBatchInsertPublicData(o) {
708
737
  return {
709
738
  leaves: o.leaves.map((v) => toPublicDataLeafValue(v)),
710
739
  subtreeDepth: o.subtreeDepth,
711
- forkId: o.forkId,
740
+ forkId: assertU64(o.forkId, "o.forkId"),
712
741
  };
713
742
  }
714
743
  export function toWsdbBatchInsertNullifier(o) {
@@ -725,7 +754,7 @@ export function toWsdbBatchInsertNullifier(o) {
725
754
  return {
726
755
  leaves: o.leaves.map((v) => toNullifierLeafValue(v)),
727
756
  subtreeDepth: o.subtreeDepth,
728
- forkId: o.forkId,
757
+ forkId: assertU64(o.forkId, "o.forkId"),
729
758
  };
730
759
  }
731
760
  export function toWsdbSequentialInsertPublicData(o) {
@@ -738,7 +767,7 @@ export function toWsdbSequentialInsertPublicData(o) {
738
767
  ;
739
768
  return {
740
769
  leaves: o.leaves.map((v) => toPublicDataLeafValue(v)),
741
- forkId: o.forkId,
770
+ forkId: assertU64(o.forkId, "o.forkId"),
742
771
  };
743
772
  }
744
773
  export function toWsdbSequentialInsertNullifier(o) {
@@ -751,7 +780,7 @@ export function toWsdbSequentialInsertNullifier(o) {
751
780
  ;
752
781
  return {
753
782
  leaves: o.leaves.map((v) => toNullifierLeafValue(v)),
754
- forkId: o.forkId,
783
+ forkId: assertU64(o.forkId, "o.forkId"),
755
784
  };
756
785
  }
757
786
  export function toWsdbUpdateArchive(o) {
@@ -767,8 +796,8 @@ export function toWsdbUpdateArchive(o) {
767
796
  ;
768
797
  return {
769
798
  blockStateRef: o.blockStateRef.map((v) => toTreeStateReference(v)),
770
- blockHeaderHash: o.blockHeaderHash,
771
- forkId: o.forkId,
799
+ blockHeaderHash: assertBin32(o.blockHeaderHash, "o.blockHeaderHash"),
800
+ forkId: assertU64(o.forkId, "o.forkId"),
772
801
  };
773
802
  }
774
803
  export function toWsdbCommit(o) {
@@ -803,9 +832,9 @@ export function toWsdbSyncBlock(o) {
803
832
  return {
804
833
  blockNumber: o.blockNumber,
805
834
  blockStateRef: o.blockStateRef.map((v) => toTreeStateReference(v)),
806
- blockHeaderHash: o.blockHeaderHash,
807
- paddedNoteHashes: o.paddedNoteHashes,
808
- paddedL1ToL2Messages: o.paddedL1ToL2Messages,
835
+ blockHeaderHash: assertBin32(o.blockHeaderHash, "o.blockHeaderHash"),
836
+ paddedNoteHashes: o.paddedNoteHashes.map((v) => assertBin32(v, "v")),
837
+ paddedL1ToL2Messages: o.paddedL1ToL2Messages.map((v) => assertBin32(v, "v")),
809
838
  paddedNullifiers: o.paddedNullifiers.map((v) => toNullifierLeafValue(v)),
810
839
  publicDataWrites: o.publicDataWrites.map((v) => toPublicDataLeafValue(v)),
811
840
  };
@@ -829,7 +858,7 @@ export function toWsdbDeleteFork(o) {
829
858
  }
830
859
  ;
831
860
  return {
832
- forkId: o.forkId,
861
+ forkId: assertU64(o.forkId, "o.forkId"),
833
862
  };
834
863
  }
835
864
  export function toWsdbFinalizeBlocks(o) {
@@ -868,7 +897,7 @@ export function toWsdbCreateCheckpoint(o) {
868
897
  }
869
898
  ;
870
899
  return {
871
- forkId: o.forkId,
900
+ forkId: assertU64(o.forkId, "o.forkId"),
872
901
  };
873
902
  }
874
903
  export function toWsdbCommitCheckpoint(o) {
@@ -877,7 +906,7 @@ export function toWsdbCommitCheckpoint(o) {
877
906
  }
878
907
  ;
879
908
  return {
880
- forkId: o.forkId,
909
+ forkId: assertU64(o.forkId, "o.forkId"),
881
910
  };
882
911
  }
883
912
  export function toWsdbRevertCheckpoint(o) {
@@ -886,7 +915,7 @@ export function toWsdbRevertCheckpoint(o) {
886
915
  }
887
916
  ;
888
917
  return {
889
- forkId: o.forkId,
918
+ forkId: assertU64(o.forkId, "o.forkId"),
890
919
  };
891
920
  }
892
921
  export function toWsdbCommitAllCheckpoints(o) {
@@ -895,7 +924,7 @@ export function toWsdbCommitAllCheckpoints(o) {
895
924
  }
896
925
  ;
897
926
  return {
898
- forkId: o.forkId,
927
+ forkId: assertU64(o.forkId, "o.forkId"),
899
928
  };
900
929
  }
901
930
  export function toWsdbRevertAllCheckpoints(o) {
@@ -904,29 +933,17 @@ export function toWsdbRevertAllCheckpoints(o) {
904
933
  }
905
934
  ;
906
935
  return {
907
- forkId: o.forkId,
936
+ forkId: assertU64(o.forkId, "o.forkId"),
908
937
  };
909
938
  }
910
939
  export function toWsdbCopyStores(o) {
911
940
  if (o.dstPath === undefined) {
912
941
  throw new Error("Expected dstPath in WsdbCopyStores deserialization");
913
942
  }
914
- if (o.compact === undefined) {
915
- throw new Error("Expected compact in WsdbCopyStores deserialization");
916
- }
917
943
  ;
918
944
  return {
919
945
  dstPath: o.dstPath,
920
- compact: o.compact,
921
- };
922
- }
923
- export function toWsdbErrorResponse(o) {
924
- if (o.message === undefined) {
925
- throw new Error("Expected message in WsdbErrorResponse deserialization");
926
- }
927
- ;
928
- return {
929
- message: o.message,
946
+ compact: o.compact ?? null,
930
947
  };
931
948
  }
932
949
  export function toWsdbGetTreeInfoResponse(o) {
@@ -945,8 +962,8 @@ export function toWsdbGetTreeInfoResponse(o) {
945
962
  ;
946
963
  return {
947
964
  treeId: o.treeId,
948
- root: o.root,
949
- size: o.size,
965
+ root: assertBin32(o.root, "o.root"),
966
+ size: assertU64(o.size, "o.size"),
950
967
  depth: o.depth,
951
968
  };
952
969
  }
@@ -969,45 +986,30 @@ export function toWsdbGetInitialStateReferenceResponse(o) {
969
986
  };
970
987
  }
971
988
  export function toWsdbGetLeafValueResponse(o) {
972
- if (o.value === undefined) {
973
- throw new Error("Expected value in WsdbGetLeafValueResponse deserialization");
974
- }
975
989
  ;
976
990
  return {
977
- value: o.value,
991
+ value: o.value != null ? assertBin32(o.value, "o.value") : null,
978
992
  };
979
993
  }
980
994
  export function toWsdbGetPublicDataLeafValueResponse(o) {
981
- if (o.value === undefined) {
982
- throw new Error("Expected value in WsdbGetPublicDataLeafValueResponse deserialization");
983
- }
984
995
  ;
985
996
  return {
986
997
  value: o.value != null ? toPublicDataLeafValue(o.value) : null,
987
998
  };
988
999
  }
989
1000
  export function toWsdbGetNullifierLeafValueResponse(o) {
990
- if (o.value === undefined) {
991
- throw new Error("Expected value in WsdbGetNullifierLeafValueResponse deserialization");
992
- }
993
1001
  ;
994
1002
  return {
995
1003
  value: o.value != null ? toNullifierLeafValue(o.value) : null,
996
1004
  };
997
1005
  }
998
1006
  export function toWsdbGetPublicDataLeafPreimageResponse(o) {
999
- if (o.preimage === undefined) {
1000
- throw new Error("Expected preimage in WsdbGetPublicDataLeafPreimageResponse deserialization");
1001
- }
1002
1007
  ;
1003
1008
  return {
1004
1009
  preimage: o.preimage != null ? toIndexedPublicDataLeafValue(o.preimage) : null,
1005
1010
  };
1006
1011
  }
1007
1012
  export function toWsdbGetNullifierLeafPreimageResponse(o) {
1008
- if (o.preimage === undefined) {
1009
- throw new Error("Expected preimage in WsdbGetNullifierLeafPreimageResponse deserialization");
1010
- }
1011
1013
  ;
1012
1014
  return {
1013
1015
  preimage: o.preimage != null ? toIndexedNullifierLeafValue(o.preimage) : null,
@@ -1019,7 +1021,7 @@ export function toWsdbGetSiblingPathResponse(o) {
1019
1021
  }
1020
1022
  ;
1021
1023
  return {
1022
- path: o.path,
1024
+ path: o.path.map((v) => assertBin32(v, "v")),
1023
1025
  };
1024
1026
  }
1025
1027
  export function toWsdbGetBlockNumbersForLeafIndicesResponse(o) {
@@ -1028,7 +1030,7 @@ export function toWsdbGetBlockNumbersForLeafIndicesResponse(o) {
1028
1030
  }
1029
1031
  ;
1030
1032
  return {
1031
- blockNumbers: o.blockNumbers,
1033
+ blockNumbers: o.blockNumbers.map((v) => v ?? null),
1032
1034
  };
1033
1035
  }
1034
1036
  export function toWsdbFindLeafIndicesResponse(o) {
@@ -1037,7 +1039,7 @@ export function toWsdbFindLeafIndicesResponse(o) {
1037
1039
  }
1038
1040
  ;
1039
1041
  return {
1040
- indices: o.indices,
1042
+ indices: o.indices.map((v) => v != null ? assertU64(v, "v") : null),
1041
1043
  };
1042
1044
  }
1043
1045
  export function toWsdbFindPublicDataLeafIndicesResponse(o) {
@@ -1046,7 +1048,7 @@ export function toWsdbFindPublicDataLeafIndicesResponse(o) {
1046
1048
  }
1047
1049
  ;
1048
1050
  return {
1049
- indices: o.indices,
1051
+ indices: o.indices.map((v) => v != null ? assertU64(v, "v") : null),
1050
1052
  };
1051
1053
  }
1052
1054
  export function toWsdbFindNullifierLeafIndicesResponse(o) {
@@ -1055,7 +1057,7 @@ export function toWsdbFindNullifierLeafIndicesResponse(o) {
1055
1057
  }
1056
1058
  ;
1057
1059
  return {
1058
- indices: o.indices,
1060
+ indices: o.indices.map((v) => v != null ? assertU64(v, "v") : null),
1059
1061
  };
1060
1062
  }
1061
1063
  export function toWsdbFindLowLeafResponse(o) {
@@ -1068,7 +1070,7 @@ export function toWsdbFindLowLeafResponse(o) {
1068
1070
  ;
1069
1071
  return {
1070
1072
  alreadyPresent: o.alreadyPresent,
1071
- index: o.index,
1073
+ index: assertU64(o.index, "o.index"),
1072
1074
  };
1073
1075
  }
1074
1076
  export function toWsdbFindSiblingPathsResponse(o) {
@@ -1173,7 +1175,7 @@ export function toWsdbCreateForkResponse(o) {
1173
1175
  }
1174
1176
  ;
1175
1177
  return {
1176
- forkId: o.forkId,
1178
+ forkId: assertU64(o.forkId, "o.forkId"),
1177
1179
  };
1178
1180
  }
1179
1181
  export function toWsdbDeleteForkResponse(o) {
@@ -1233,6 +1235,15 @@ export function toWsdbRevertAllCheckpointsResponse(o) {
1233
1235
  export function toWsdbCopyStoresResponse(o) {
1234
1236
  return {};
1235
1237
  }
1238
+ export function toWsdbErrorResponse(o) {
1239
+ if (o.message === undefined) {
1240
+ throw new Error("Expected message in WsdbErrorResponse deserialization");
1241
+ }
1242
+ ;
1243
+ return {
1244
+ message: o.message,
1245
+ };
1246
+ }
1236
1247
  export function fromTreeStateReference(o) {
1237
1248
  if (o.treeId === undefined) {
1238
1249
  throw new Error("Expected treeId in TreeStateReference serialization");
@@ -1246,8 +1257,8 @@ export function fromTreeStateReference(o) {
1246
1257
  ;
1247
1258
  return {
1248
1259
  treeId: o.treeId,
1249
- root: o.root,
1250
- size: o.size,
1260
+ root: assertBin32(o.root, "o.root"),
1261
+ size: toWireU64(o.size, "o.size"),
1251
1262
  };
1252
1263
  }
1253
1264
  export function fromPublicDataLeafValue(o) {
@@ -1259,8 +1270,8 @@ export function fromPublicDataLeafValue(o) {
1259
1270
  }
1260
1271
  ;
1261
1272
  return {
1262
- slot: o.slot,
1263
- value: o.value,
1273
+ slot: assertBin32(o.slot, "o.slot"),
1274
+ value: assertBin32(o.value, "o.value"),
1264
1275
  };
1265
1276
  }
1266
1277
  export function fromNullifierLeafValue(o) {
@@ -1269,7 +1280,7 @@ export function fromNullifierLeafValue(o) {
1269
1280
  }
1270
1281
  ;
1271
1282
  return {
1272
- nullifier: o.nullifier,
1283
+ nullifier: assertBin32(o.nullifier, "o.nullifier"),
1273
1284
  };
1274
1285
  }
1275
1286
  export function fromIndexedPublicDataLeafValue(o) {
@@ -1285,8 +1296,8 @@ export function fromIndexedPublicDataLeafValue(o) {
1285
1296
  ;
1286
1297
  return {
1287
1298
  leaf: fromPublicDataLeafValue(o.leaf),
1288
- nextIndex: o.nextIndex,
1289
- nextKey: o.nextKey,
1299
+ nextIndex: toWireU64(o.nextIndex, "o.nextIndex"),
1300
+ nextKey: assertBin32(o.nextKey, "o.nextKey"),
1290
1301
  };
1291
1302
  }
1292
1303
  export function fromIndexedNullifierLeafValue(o) {
@@ -1302,8 +1313,8 @@ export function fromIndexedNullifierLeafValue(o) {
1302
1313
  ;
1303
1314
  return {
1304
1315
  leaf: fromNullifierLeafValue(o.leaf),
1305
- nextIndex: o.nextIndex,
1306
- nextKey: o.nextKey,
1316
+ nextIndex: toWireU64(o.nextIndex, "o.nextIndex"),
1317
+ nextKey: assertBin32(o.nextKey, "o.nextKey"),
1307
1318
  };
1308
1319
  }
1309
1320
  export function fromSiblingPathAndIndex(o) {
@@ -1315,8 +1326,8 @@ export function fromSiblingPathAndIndex(o) {
1315
1326
  }
1316
1327
  ;
1317
1328
  return {
1318
- index: o.index,
1319
- path: o.path,
1329
+ index: toWireU64(o.index, "o.index"),
1330
+ path: o.path.map((v) => assertBin32(v, "v")),
1320
1331
  };
1321
1332
  }
1322
1333
  export function fromPublicDataLeafUpdateWitnessData(o) {
@@ -1332,8 +1343,8 @@ export function fromPublicDataLeafUpdateWitnessData(o) {
1332
1343
  ;
1333
1344
  return {
1334
1345
  leaf: fromIndexedPublicDataLeafValue(o.leaf),
1335
- index: o.index,
1336
- path: o.path,
1346
+ index: toWireU64(o.index, "o.index"),
1347
+ path: o.path.map((v) => assertBin32(v, "v")),
1337
1348
  };
1338
1349
  }
1339
1350
  export function fromSortedPublicDataLeaf(o) {
@@ -1346,7 +1357,7 @@ export function fromSortedPublicDataLeaf(o) {
1346
1357
  ;
1347
1358
  return {
1348
1359
  leaf: fromPublicDataLeafValue(o.leaf),
1349
- index: o.index,
1360
+ index: toWireU64(o.index, "o.index"),
1350
1361
  };
1351
1362
  }
1352
1363
  export function fromBatchInsertionResultPublicData(o) {
@@ -1363,7 +1374,7 @@ export function fromBatchInsertionResultPublicData(o) {
1363
1374
  return {
1364
1375
  lowLeafWitnessData: o.lowLeafWitnessData.map((v) => fromPublicDataLeafUpdateWitnessData(v)),
1365
1376
  sortedLeaves: o.sortedLeaves.map((v) => fromSortedPublicDataLeaf(v)),
1366
- subtreePath: o.subtreePath,
1377
+ subtreePath: o.subtreePath.map((v) => assertBin32(v, "v")),
1367
1378
  };
1368
1379
  }
1369
1380
  export function fromNullifierLeafUpdateWitnessData(o) {
@@ -1379,8 +1390,8 @@ export function fromNullifierLeafUpdateWitnessData(o) {
1379
1390
  ;
1380
1391
  return {
1381
1392
  leaf: fromIndexedNullifierLeafValue(o.leaf),
1382
- index: o.index,
1383
- path: o.path,
1393
+ index: toWireU64(o.index, "o.index"),
1394
+ path: o.path.map((v) => assertBin32(v, "v")),
1384
1395
  };
1385
1396
  }
1386
1397
  export function fromSortedNullifierLeaf(o) {
@@ -1393,7 +1404,7 @@ export function fromSortedNullifierLeaf(o) {
1393
1404
  ;
1394
1405
  return {
1395
1406
  leaf: fromNullifierLeafValue(o.leaf),
1396
- index: o.index,
1407
+ index: toWireU64(o.index, "o.index"),
1397
1408
  };
1398
1409
  }
1399
1410
  export function fromBatchInsertionResultNullifier(o) {
@@ -1410,7 +1421,7 @@ export function fromBatchInsertionResultNullifier(o) {
1410
1421
  return {
1411
1422
  lowLeafWitnessData: o.lowLeafWitnessData.map((v) => fromNullifierLeafUpdateWitnessData(v)),
1412
1423
  sortedLeaves: o.sortedLeaves.map((v) => fromSortedNullifierLeaf(v)),
1413
- subtreePath: o.subtreePath,
1424
+ subtreePath: o.subtreePath.map((v) => assertBin32(v, "v")),
1414
1425
  };
1415
1426
  }
1416
1427
  export function fromSequentialInsertionResultPublicData(o) {
@@ -1454,9 +1465,9 @@ export function fromWorldStateStatusSummary(o) {
1454
1465
  }
1455
1466
  ;
1456
1467
  return {
1457
- unfinalizedBlockNumber: o.unfinalizedBlockNumber,
1458
- finalizedBlockNumber: o.finalizedBlockNumber,
1459
- oldestHistoricalBlock: o.oldestHistoricalBlock,
1468
+ unfinalizedBlockNumber: toWireU64(o.unfinalizedBlockNumber, "o.unfinalizedBlockNumber"),
1469
+ finalizedBlockNumber: toWireU64(o.finalizedBlockNumber, "o.finalizedBlockNumber"),
1470
+ oldestHistoricalBlock: toWireU64(o.oldestHistoricalBlock, "o.oldestHistoricalBlock"),
1460
1471
  treesAreSynched: o.treesAreSynched,
1461
1472
  };
1462
1473
  }
@@ -1473,8 +1484,8 @@ export function fromDBStats(o) {
1473
1484
  ;
1474
1485
  return {
1475
1486
  name: o.name,
1476
- numDataItems: o.numDataItems,
1477
- totalUsedSize: o.totalUsedSize,
1487
+ numDataItems: toWireU64(o.numDataItems, "o.numDataItems"),
1488
+ totalUsedSize: toWireU64(o.totalUsedSize, "o.totalUsedSize"),
1478
1489
  };
1479
1490
  }
1480
1491
  export function fromTreeDBStats(o) {
@@ -1501,8 +1512,8 @@ export function fromTreeDBStats(o) {
1501
1512
  }
1502
1513
  ;
1503
1514
  return {
1504
- mapSize: o.mapSize,
1505
- physicalFileSize: o.physicalFileSize,
1515
+ mapSize: toWireU64(o.mapSize, "o.mapSize"),
1516
+ physicalFileSize: toWireU64(o.physicalFileSize, "o.physicalFileSize"),
1506
1517
  blocksDBStats: fromDBStats(o.blocksDBStats),
1507
1518
  nodesDBStats: fromDBStats(o.nodesDBStats),
1508
1519
  leafPreimagesDBStats: fromDBStats(o.leafPreimagesDBStats),
@@ -1570,11 +1581,11 @@ export function fromTreeMeta(o) {
1570
1581
  return {
1571
1582
  name: o.name,
1572
1583
  depth: o.depth,
1573
- size: o.size,
1574
- committedSize: o.committedSize,
1575
- root: o.root,
1576
- initialSize: o.initialSize,
1577
- initialRoot: o.initialRoot,
1584
+ size: toWireU64(o.size, "o.size"),
1585
+ committedSize: toWireU64(o.committedSize, "o.committedSize"),
1586
+ root: assertBin32(o.root, "o.root"),
1587
+ initialSize: toWireU64(o.initialSize, "o.initialSize"),
1588
+ initialRoot: assertBin32(o.initialRoot, "o.initialRoot"),
1578
1589
  oldestHistoricBlock: o.oldestHistoricBlock,
1579
1590
  unfinalizedBlockHeight: o.unfinalizedBlockHeight,
1580
1591
  finalizedBlockHeight: o.finalizedBlockHeight,
@@ -1634,7 +1645,7 @@ export function fromWorldStateRevision(o) {
1634
1645
  }
1635
1646
  ;
1636
1647
  return {
1637
- forkId: o.forkId,
1648
+ forkId: toWireU64(o.forkId, "o.forkId"),
1638
1649
  blockNumber: o.blockNumber,
1639
1650
  includeUncommitted: o.includeUncommitted,
1640
1651
  };
@@ -1678,7 +1689,7 @@ export function fromWsdbGetLeafValue(o) {
1678
1689
  return {
1679
1690
  treeId: o.treeId,
1680
1691
  revision: fromWorldStateRevision(o.revision),
1681
- leafIndex: o.leafIndex,
1692
+ leafIndex: toWireU64(o.leafIndex, "o.leafIndex"),
1682
1693
  };
1683
1694
  }
1684
1695
  export function fromWsdbGetPublicDataLeafValue(o) {
@@ -1691,7 +1702,7 @@ export function fromWsdbGetPublicDataLeafValue(o) {
1691
1702
  ;
1692
1703
  return {
1693
1704
  revision: fromWorldStateRevision(o.revision),
1694
- leafIndex: o.leafIndex,
1705
+ leafIndex: toWireU64(o.leafIndex, "o.leafIndex"),
1695
1706
  };
1696
1707
  }
1697
1708
  export function fromWsdbGetNullifierLeafValue(o) {
@@ -1704,7 +1715,7 @@ export function fromWsdbGetNullifierLeafValue(o) {
1704
1715
  ;
1705
1716
  return {
1706
1717
  revision: fromWorldStateRevision(o.revision),
1707
- leafIndex: o.leafIndex,
1718
+ leafIndex: toWireU64(o.leafIndex, "o.leafIndex"),
1708
1719
  };
1709
1720
  }
1710
1721
  export function fromWsdbGetPublicDataLeafPreimage(o) {
@@ -1717,7 +1728,7 @@ export function fromWsdbGetPublicDataLeafPreimage(o) {
1717
1728
  ;
1718
1729
  return {
1719
1730
  revision: fromWorldStateRevision(o.revision),
1720
- leafIndex: o.leafIndex,
1731
+ leafIndex: toWireU64(o.leafIndex, "o.leafIndex"),
1721
1732
  };
1722
1733
  }
1723
1734
  export function fromWsdbGetNullifierLeafPreimage(o) {
@@ -1730,7 +1741,7 @@ export function fromWsdbGetNullifierLeafPreimage(o) {
1730
1741
  ;
1731
1742
  return {
1732
1743
  revision: fromWorldStateRevision(o.revision),
1733
- leafIndex: o.leafIndex,
1744
+ leafIndex: toWireU64(o.leafIndex, "o.leafIndex"),
1734
1745
  };
1735
1746
  }
1736
1747
  export function fromWsdbGetSiblingPath(o) {
@@ -1747,7 +1758,7 @@ export function fromWsdbGetSiblingPath(o) {
1747
1758
  return {
1748
1759
  treeId: o.treeId,
1749
1760
  revision: fromWorldStateRevision(o.revision),
1750
- leafIndex: o.leafIndex,
1761
+ leafIndex: toWireU64(o.leafIndex, "o.leafIndex"),
1751
1762
  };
1752
1763
  }
1753
1764
  export function fromWsdbGetBlockNumbersForLeafIndices(o) {
@@ -1764,7 +1775,7 @@ export function fromWsdbGetBlockNumbersForLeafIndices(o) {
1764
1775
  return {
1765
1776
  treeId: o.treeId,
1766
1777
  revision: fromWorldStateRevision(o.revision),
1767
- leafIndices: o.leafIndices,
1778
+ leafIndices: o.leafIndices.map((v) => toWireU64(v, "v")),
1768
1779
  };
1769
1780
  }
1770
1781
  export function fromWsdbFindLeafIndices(o) {
@@ -1784,8 +1795,8 @@ export function fromWsdbFindLeafIndices(o) {
1784
1795
  return {
1785
1796
  treeId: o.treeId,
1786
1797
  revision: fromWorldStateRevision(o.revision),
1787
- leaves: o.leaves,
1788
- startIndex: o.startIndex,
1798
+ leaves: o.leaves.map((v) => assertBin32(v, "v")),
1799
+ startIndex: toWireU64(o.startIndex, "o.startIndex"),
1789
1800
  };
1790
1801
  }
1791
1802
  export function fromWsdbFindPublicDataLeafIndices(o) {
@@ -1802,7 +1813,7 @@ export function fromWsdbFindPublicDataLeafIndices(o) {
1802
1813
  return {
1803
1814
  revision: fromWorldStateRevision(o.revision),
1804
1815
  leaves: o.leaves.map((v) => fromPublicDataLeafValue(v)),
1805
- startIndex: o.startIndex,
1816
+ startIndex: toWireU64(o.startIndex, "o.startIndex"),
1806
1817
  };
1807
1818
  }
1808
1819
  export function fromWsdbFindNullifierLeafIndices(o) {
@@ -1819,7 +1830,7 @@ export function fromWsdbFindNullifierLeafIndices(o) {
1819
1830
  return {
1820
1831
  revision: fromWorldStateRevision(o.revision),
1821
1832
  leaves: o.leaves.map((v) => fromNullifierLeafValue(v)),
1822
- startIndex: o.startIndex,
1833
+ startIndex: toWireU64(o.startIndex, "o.startIndex"),
1823
1834
  };
1824
1835
  }
1825
1836
  export function fromWsdbFindLowLeaf(o) {
@@ -1836,7 +1847,7 @@ export function fromWsdbFindLowLeaf(o) {
1836
1847
  return {
1837
1848
  treeId: o.treeId,
1838
1849
  revision: fromWorldStateRevision(o.revision),
1839
- key: o.key,
1850
+ key: assertBin32(o.key, "o.key"),
1840
1851
  };
1841
1852
  }
1842
1853
  export function fromWsdbFindSiblingPaths(o) {
@@ -1853,7 +1864,7 @@ export function fromWsdbFindSiblingPaths(o) {
1853
1864
  return {
1854
1865
  treeId: o.treeId,
1855
1866
  revision: fromWorldStateRevision(o.revision),
1856
- leaves: o.leaves,
1867
+ leaves: o.leaves.map((v) => assertBin32(v, "v")),
1857
1868
  };
1858
1869
  }
1859
1870
  export function fromWsdbFindPublicDataSiblingPaths(o) {
@@ -1895,8 +1906,8 @@ export function fromWsdbAppendLeaves(o) {
1895
1906
  ;
1896
1907
  return {
1897
1908
  treeId: o.treeId,
1898
- leaves: o.leaves,
1899
- forkId: o.forkId,
1909
+ leaves: o.leaves.map((v) => assertBin32(v, "v")),
1910
+ forkId: toWireU64(o.forkId, "o.forkId"),
1900
1911
  };
1901
1912
  }
1902
1913
  export function fromWsdbAppendPublicDataLeaves(o) {
@@ -1909,7 +1920,7 @@ export function fromWsdbAppendPublicDataLeaves(o) {
1909
1920
  ;
1910
1921
  return {
1911
1922
  leaves: o.leaves.map((v) => fromPublicDataLeafValue(v)),
1912
- forkId: o.forkId,
1923
+ forkId: toWireU64(o.forkId, "o.forkId"),
1913
1924
  };
1914
1925
  }
1915
1926
  export function fromWsdbAppendNullifierLeaves(o) {
@@ -1922,7 +1933,7 @@ export function fromWsdbAppendNullifierLeaves(o) {
1922
1933
  ;
1923
1934
  return {
1924
1935
  leaves: o.leaves.map((v) => fromNullifierLeafValue(v)),
1925
- forkId: o.forkId,
1936
+ forkId: toWireU64(o.forkId, "o.forkId"),
1926
1937
  };
1927
1938
  }
1928
1939
  export function fromWsdbBatchInsertPublicData(o) {
@@ -1939,7 +1950,7 @@ export function fromWsdbBatchInsertPublicData(o) {
1939
1950
  return {
1940
1951
  leaves: o.leaves.map((v) => fromPublicDataLeafValue(v)),
1941
1952
  subtreeDepth: o.subtreeDepth,
1942
- forkId: o.forkId,
1953
+ forkId: toWireU64(o.forkId, "o.forkId"),
1943
1954
  };
1944
1955
  }
1945
1956
  export function fromWsdbBatchInsertNullifier(o) {
@@ -1956,7 +1967,7 @@ export function fromWsdbBatchInsertNullifier(o) {
1956
1967
  return {
1957
1968
  leaves: o.leaves.map((v) => fromNullifierLeafValue(v)),
1958
1969
  subtreeDepth: o.subtreeDepth,
1959
- forkId: o.forkId,
1970
+ forkId: toWireU64(o.forkId, "o.forkId"),
1960
1971
  };
1961
1972
  }
1962
1973
  export function fromWsdbSequentialInsertPublicData(o) {
@@ -1969,7 +1980,7 @@ export function fromWsdbSequentialInsertPublicData(o) {
1969
1980
  ;
1970
1981
  return {
1971
1982
  leaves: o.leaves.map((v) => fromPublicDataLeafValue(v)),
1972
- forkId: o.forkId,
1983
+ forkId: toWireU64(o.forkId, "o.forkId"),
1973
1984
  };
1974
1985
  }
1975
1986
  export function fromWsdbSequentialInsertNullifier(o) {
@@ -1982,7 +1993,7 @@ export function fromWsdbSequentialInsertNullifier(o) {
1982
1993
  ;
1983
1994
  return {
1984
1995
  leaves: o.leaves.map((v) => fromNullifierLeafValue(v)),
1985
- forkId: o.forkId,
1996
+ forkId: toWireU64(o.forkId, "o.forkId"),
1986
1997
  };
1987
1998
  }
1988
1999
  export function fromWsdbUpdateArchive(o) {
@@ -1998,8 +2009,8 @@ export function fromWsdbUpdateArchive(o) {
1998
2009
  ;
1999
2010
  return {
2000
2011
  blockStateRef: o.blockStateRef.map((v) => fromTreeStateReference(v)),
2001
- blockHeaderHash: o.blockHeaderHash,
2002
- forkId: o.forkId,
2012
+ blockHeaderHash: assertBin32(o.blockHeaderHash, "o.blockHeaderHash"),
2013
+ forkId: toWireU64(o.forkId, "o.forkId"),
2003
2014
  };
2004
2015
  }
2005
2016
  export function fromWsdbCommit(o) {
@@ -2034,9 +2045,9 @@ export function fromWsdbSyncBlock(o) {
2034
2045
  return {
2035
2046
  blockNumber: o.blockNumber,
2036
2047
  blockStateRef: o.blockStateRef.map((v) => fromTreeStateReference(v)),
2037
- blockHeaderHash: o.blockHeaderHash,
2038
- paddedNoteHashes: o.paddedNoteHashes,
2039
- paddedL1ToL2Messages: o.paddedL1ToL2Messages,
2048
+ blockHeaderHash: assertBin32(o.blockHeaderHash, "o.blockHeaderHash"),
2049
+ paddedNoteHashes: o.paddedNoteHashes.map((v) => assertBin32(v, "v")),
2050
+ paddedL1ToL2Messages: o.paddedL1ToL2Messages.map((v) => assertBin32(v, "v")),
2040
2051
  paddedNullifiers: o.paddedNullifiers.map((v) => fromNullifierLeafValue(v)),
2041
2052
  publicDataWrites: o.publicDataWrites.map((v) => fromPublicDataLeafValue(v)),
2042
2053
  };
@@ -2060,7 +2071,7 @@ export function fromWsdbDeleteFork(o) {
2060
2071
  }
2061
2072
  ;
2062
2073
  return {
2063
- forkId: o.forkId,
2074
+ forkId: toWireU64(o.forkId, "o.forkId"),
2064
2075
  };
2065
2076
  }
2066
2077
  export function fromWsdbFinalizeBlocks(o) {
@@ -2099,7 +2110,7 @@ export function fromWsdbCreateCheckpoint(o) {
2099
2110
  }
2100
2111
  ;
2101
2112
  return {
2102
- forkId: o.forkId,
2113
+ forkId: toWireU64(o.forkId, "o.forkId"),
2103
2114
  };
2104
2115
  }
2105
2116
  export function fromWsdbCommitCheckpoint(o) {
@@ -2108,7 +2119,7 @@ export function fromWsdbCommitCheckpoint(o) {
2108
2119
  }
2109
2120
  ;
2110
2121
  return {
2111
- forkId: o.forkId,
2122
+ forkId: toWireU64(o.forkId, "o.forkId"),
2112
2123
  };
2113
2124
  }
2114
2125
  export function fromWsdbRevertCheckpoint(o) {
@@ -2117,7 +2128,7 @@ export function fromWsdbRevertCheckpoint(o) {
2117
2128
  }
2118
2129
  ;
2119
2130
  return {
2120
- forkId: o.forkId,
2131
+ forkId: toWireU64(o.forkId, "o.forkId"),
2121
2132
  };
2122
2133
  }
2123
2134
  export function fromWsdbCommitAllCheckpoints(o) {
@@ -2126,7 +2137,7 @@ export function fromWsdbCommitAllCheckpoints(o) {
2126
2137
  }
2127
2138
  ;
2128
2139
  return {
2129
- forkId: o.forkId,
2140
+ forkId: toWireU64(o.forkId, "o.forkId"),
2130
2141
  };
2131
2142
  }
2132
2143
  export function fromWsdbRevertAllCheckpoints(o) {
@@ -2135,29 +2146,17 @@ export function fromWsdbRevertAllCheckpoints(o) {
2135
2146
  }
2136
2147
  ;
2137
2148
  return {
2138
- forkId: o.forkId,
2149
+ forkId: toWireU64(o.forkId, "o.forkId"),
2139
2150
  };
2140
2151
  }
2141
2152
  export function fromWsdbCopyStores(o) {
2142
2153
  if (o.dstPath === undefined) {
2143
2154
  throw new Error("Expected dstPath in WsdbCopyStores serialization");
2144
2155
  }
2145
- if (o.compact === undefined) {
2146
- throw new Error("Expected compact in WsdbCopyStores serialization");
2147
- }
2148
2156
  ;
2149
2157
  return {
2150
2158
  dstPath: o.dstPath,
2151
- compact: o.compact,
2152
- };
2153
- }
2154
- export function fromWsdbErrorResponse(o) {
2155
- if (o.message === undefined) {
2156
- throw new Error("Expected message in WsdbErrorResponse serialization");
2157
- }
2158
- ;
2159
- return {
2160
- message: o.message,
2159
+ compact: o.compact ?? null,
2161
2160
  };
2162
2161
  }
2163
2162
  export function fromWsdbGetTreeInfoResponse(o) {
@@ -2176,8 +2175,8 @@ export function fromWsdbGetTreeInfoResponse(o) {
2176
2175
  ;
2177
2176
  return {
2178
2177
  treeId: o.treeId,
2179
- root: o.root,
2180
- size: o.size,
2178
+ root: assertBin32(o.root, "o.root"),
2179
+ size: toWireU64(o.size, "o.size"),
2181
2180
  depth: o.depth,
2182
2181
  };
2183
2182
  }
@@ -2200,45 +2199,30 @@ export function fromWsdbGetInitialStateReferenceResponse(o) {
2200
2199
  };
2201
2200
  }
2202
2201
  export function fromWsdbGetLeafValueResponse(o) {
2203
- if (o.value === undefined) {
2204
- throw new Error("Expected value in WsdbGetLeafValueResponse serialization");
2205
- }
2206
2202
  ;
2207
2203
  return {
2208
- value: o.value,
2204
+ value: o.value != null ? assertBin32(o.value, "o.value") : null,
2209
2205
  };
2210
2206
  }
2211
2207
  export function fromWsdbGetPublicDataLeafValueResponse(o) {
2212
- if (o.value === undefined) {
2213
- throw new Error("Expected value in WsdbGetPublicDataLeafValueResponse serialization");
2214
- }
2215
2208
  ;
2216
2209
  return {
2217
2210
  value: o.value != null ? fromPublicDataLeafValue(o.value) : null,
2218
2211
  };
2219
2212
  }
2220
2213
  export function fromWsdbGetNullifierLeafValueResponse(o) {
2221
- if (o.value === undefined) {
2222
- throw new Error("Expected value in WsdbGetNullifierLeafValueResponse serialization");
2223
- }
2224
2214
  ;
2225
2215
  return {
2226
2216
  value: o.value != null ? fromNullifierLeafValue(o.value) : null,
2227
2217
  };
2228
2218
  }
2229
2219
  export function fromWsdbGetPublicDataLeafPreimageResponse(o) {
2230
- if (o.preimage === undefined) {
2231
- throw new Error("Expected preimage in WsdbGetPublicDataLeafPreimageResponse serialization");
2232
- }
2233
2220
  ;
2234
2221
  return {
2235
2222
  preimage: o.preimage != null ? fromIndexedPublicDataLeafValue(o.preimage) : null,
2236
2223
  };
2237
2224
  }
2238
2225
  export function fromWsdbGetNullifierLeafPreimageResponse(o) {
2239
- if (o.preimage === undefined) {
2240
- throw new Error("Expected preimage in WsdbGetNullifierLeafPreimageResponse serialization");
2241
- }
2242
2226
  ;
2243
2227
  return {
2244
2228
  preimage: o.preimage != null ? fromIndexedNullifierLeafValue(o.preimage) : null,
@@ -2250,7 +2234,7 @@ export function fromWsdbGetSiblingPathResponse(o) {
2250
2234
  }
2251
2235
  ;
2252
2236
  return {
2253
- path: o.path,
2237
+ path: o.path.map((v) => assertBin32(v, "v")),
2254
2238
  };
2255
2239
  }
2256
2240
  export function fromWsdbGetBlockNumbersForLeafIndicesResponse(o) {
@@ -2259,7 +2243,7 @@ export function fromWsdbGetBlockNumbersForLeafIndicesResponse(o) {
2259
2243
  }
2260
2244
  ;
2261
2245
  return {
2262
- blockNumbers: o.blockNumbers,
2246
+ blockNumbers: o.blockNumbers.map((v) => v ?? null),
2263
2247
  };
2264
2248
  }
2265
2249
  export function fromWsdbFindLeafIndicesResponse(o) {
@@ -2268,7 +2252,7 @@ export function fromWsdbFindLeafIndicesResponse(o) {
2268
2252
  }
2269
2253
  ;
2270
2254
  return {
2271
- indices: o.indices,
2255
+ indices: o.indices.map((v) => v != null ? toWireU64(v, "v") : null),
2272
2256
  };
2273
2257
  }
2274
2258
  export function fromWsdbFindPublicDataLeafIndicesResponse(o) {
@@ -2277,7 +2261,7 @@ export function fromWsdbFindPublicDataLeafIndicesResponse(o) {
2277
2261
  }
2278
2262
  ;
2279
2263
  return {
2280
- indices: o.indices,
2264
+ indices: o.indices.map((v) => v != null ? toWireU64(v, "v") : null),
2281
2265
  };
2282
2266
  }
2283
2267
  export function fromWsdbFindNullifierLeafIndicesResponse(o) {
@@ -2286,7 +2270,7 @@ export function fromWsdbFindNullifierLeafIndicesResponse(o) {
2286
2270
  }
2287
2271
  ;
2288
2272
  return {
2289
- indices: o.indices,
2273
+ indices: o.indices.map((v) => v != null ? toWireU64(v, "v") : null),
2290
2274
  };
2291
2275
  }
2292
2276
  export function fromWsdbFindLowLeafResponse(o) {
@@ -2299,7 +2283,7 @@ export function fromWsdbFindLowLeafResponse(o) {
2299
2283
  ;
2300
2284
  return {
2301
2285
  alreadyPresent: o.alreadyPresent,
2302
- index: o.index,
2286
+ index: toWireU64(o.index, "o.index"),
2303
2287
  };
2304
2288
  }
2305
2289
  export function fromWsdbFindSiblingPathsResponse(o) {
@@ -2404,7 +2388,7 @@ export function fromWsdbCreateForkResponse(o) {
2404
2388
  }
2405
2389
  ;
2406
2390
  return {
2407
- forkId: o.forkId,
2391
+ forkId: toWireU64(o.forkId, "o.forkId"),
2408
2392
  };
2409
2393
  }
2410
2394
  export function fromWsdbDeleteForkResponse(o) {
@@ -2464,3 +2448,12 @@ export function fromWsdbRevertAllCheckpointsResponse(o) {
2464
2448
  export function fromWsdbCopyStoresResponse(o) {
2465
2449
  return {};
2466
2450
  }
2451
+ export function fromWsdbErrorResponse(o) {
2452
+ if (o.message === undefined) {
2453
+ throw new Error("Expected message in WsdbErrorResponse serialization");
2454
+ }
2455
+ ;
2456
+ return {
2457
+ message: o.message,
2458
+ };
2459
+ }