@aztec/wsdb 0.0.1-commit.017a351
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/README.md +29 -0
- package/dest/bin.d.ts +3 -0
- package/dest/bin.d.ts.map +1 -0
- package/dest/bin.js +15 -0
- package/dest/generated/api_types.d.ts +1091 -0
- package/dest/generated/api_types.d.ts.map +1 -0
- package/dest/generated/api_types.js +2459 -0
- package/dest/generated/async.d.ts +53 -0
- package/dest/generated/async.d.ts.map +1 -0
- package/dest/generated/async.js +499 -0
- package/dest/generated/sync.d.ts +53 -0
- package/dest/generated/sync.d.ts.map +1 -0
- package/dest/generated/sync.js +459 -0
- package/dest/index.d.ts +23 -0
- package/dest/index.d.ts.map +1 -0
- package/dest/index.js +136 -0
- package/dest/platform.d.ts +4 -0
- package/dest/platform.d.ts.map +1 -0
- package/dest/platform.js +57 -0
- package/package.json +38 -0
|
@@ -0,0 +1,2459 @@
|
|
|
1
|
+
// AUTOGENERATED FILE - DO NOT EDIT
|
|
2
|
+
/** Schema version hash for compatibility checking */
|
|
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
|
+
}
|
|
33
|
+
// Conversion functions (exported)
|
|
34
|
+
export function toTreeStateReference(o) {
|
|
35
|
+
if (o.treeId === undefined) {
|
|
36
|
+
throw new Error("Expected treeId in TreeStateReference deserialization");
|
|
37
|
+
}
|
|
38
|
+
if (o.root === undefined) {
|
|
39
|
+
throw new Error("Expected root in TreeStateReference deserialization");
|
|
40
|
+
}
|
|
41
|
+
if (o.size === undefined) {
|
|
42
|
+
throw new Error("Expected size in TreeStateReference deserialization");
|
|
43
|
+
}
|
|
44
|
+
;
|
|
45
|
+
return {
|
|
46
|
+
treeId: o.treeId,
|
|
47
|
+
root: assertBin32(o.root, "o.root"),
|
|
48
|
+
size: assertU64(o.size, "o.size"),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export function toPublicDataLeafValue(o) {
|
|
52
|
+
if (o.slot === undefined) {
|
|
53
|
+
throw new Error("Expected slot in PublicDataLeafValue deserialization");
|
|
54
|
+
}
|
|
55
|
+
if (o.value === undefined) {
|
|
56
|
+
throw new Error("Expected value in PublicDataLeafValue deserialization");
|
|
57
|
+
}
|
|
58
|
+
;
|
|
59
|
+
return {
|
|
60
|
+
slot: assertBin32(o.slot, "o.slot"),
|
|
61
|
+
value: assertBin32(o.value, "o.value"),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export function toNullifierLeafValue(o) {
|
|
65
|
+
if (o.nullifier === undefined) {
|
|
66
|
+
throw new Error("Expected nullifier in NullifierLeafValue deserialization");
|
|
67
|
+
}
|
|
68
|
+
;
|
|
69
|
+
return {
|
|
70
|
+
nullifier: assertBin32(o.nullifier, "o.nullifier"),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export function toIndexedPublicDataLeafValue(o) {
|
|
74
|
+
if (o.leaf === undefined) {
|
|
75
|
+
throw new Error("Expected leaf in IndexedPublicDataLeafValue deserialization");
|
|
76
|
+
}
|
|
77
|
+
if (o.nextIndex === undefined) {
|
|
78
|
+
throw new Error("Expected nextIndex in IndexedPublicDataLeafValue deserialization");
|
|
79
|
+
}
|
|
80
|
+
if (o.nextKey === undefined) {
|
|
81
|
+
throw new Error("Expected nextKey in IndexedPublicDataLeafValue deserialization");
|
|
82
|
+
}
|
|
83
|
+
;
|
|
84
|
+
return {
|
|
85
|
+
leaf: toPublicDataLeafValue(o.leaf),
|
|
86
|
+
nextIndex: assertU64(o.nextIndex, "o.nextIndex"),
|
|
87
|
+
nextKey: assertBin32(o.nextKey, "o.nextKey"),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export function toIndexedNullifierLeafValue(o) {
|
|
91
|
+
if (o.leaf === undefined) {
|
|
92
|
+
throw new Error("Expected leaf in IndexedNullifierLeafValue deserialization");
|
|
93
|
+
}
|
|
94
|
+
if (o.nextIndex === undefined) {
|
|
95
|
+
throw new Error("Expected nextIndex in IndexedNullifierLeafValue deserialization");
|
|
96
|
+
}
|
|
97
|
+
if (o.nextKey === undefined) {
|
|
98
|
+
throw new Error("Expected nextKey in IndexedNullifierLeafValue deserialization");
|
|
99
|
+
}
|
|
100
|
+
;
|
|
101
|
+
return {
|
|
102
|
+
leaf: toNullifierLeafValue(o.leaf),
|
|
103
|
+
nextIndex: assertU64(o.nextIndex, "o.nextIndex"),
|
|
104
|
+
nextKey: assertBin32(o.nextKey, "o.nextKey"),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export function toSiblingPathAndIndex(o) {
|
|
108
|
+
if (o.index === undefined) {
|
|
109
|
+
throw new Error("Expected index in SiblingPathAndIndex deserialization");
|
|
110
|
+
}
|
|
111
|
+
if (o.path === undefined) {
|
|
112
|
+
throw new Error("Expected path in SiblingPathAndIndex deserialization");
|
|
113
|
+
}
|
|
114
|
+
;
|
|
115
|
+
return {
|
|
116
|
+
index: assertU64(o.index, "o.index"),
|
|
117
|
+
path: o.path.map((v) => assertBin32(v, "v")),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
export function toPublicDataLeafUpdateWitnessData(o) {
|
|
121
|
+
if (o.leaf === undefined) {
|
|
122
|
+
throw new Error("Expected leaf in PublicDataLeafUpdateWitnessData deserialization");
|
|
123
|
+
}
|
|
124
|
+
if (o.index === undefined) {
|
|
125
|
+
throw new Error("Expected index in PublicDataLeafUpdateWitnessData deserialization");
|
|
126
|
+
}
|
|
127
|
+
if (o.path === undefined) {
|
|
128
|
+
throw new Error("Expected path in PublicDataLeafUpdateWitnessData deserialization");
|
|
129
|
+
}
|
|
130
|
+
;
|
|
131
|
+
return {
|
|
132
|
+
leaf: toIndexedPublicDataLeafValue(o.leaf),
|
|
133
|
+
index: assertU64(o.index, "o.index"),
|
|
134
|
+
path: o.path.map((v) => assertBin32(v, "v")),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
export function toSortedPublicDataLeaf(o) {
|
|
138
|
+
if (o.leaf === undefined) {
|
|
139
|
+
throw new Error("Expected leaf in SortedPublicDataLeaf deserialization");
|
|
140
|
+
}
|
|
141
|
+
if (o.index === undefined) {
|
|
142
|
+
throw new Error("Expected index in SortedPublicDataLeaf deserialization");
|
|
143
|
+
}
|
|
144
|
+
;
|
|
145
|
+
return {
|
|
146
|
+
leaf: toPublicDataLeafValue(o.leaf),
|
|
147
|
+
index: assertU64(o.index, "o.index"),
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
export function toBatchInsertionResultPublicData(o) {
|
|
151
|
+
if (o.lowLeafWitnessData === undefined) {
|
|
152
|
+
throw new Error("Expected lowLeafWitnessData in BatchInsertionResultPublicData deserialization");
|
|
153
|
+
}
|
|
154
|
+
if (o.sortedLeaves === undefined) {
|
|
155
|
+
throw new Error("Expected sortedLeaves in BatchInsertionResultPublicData deserialization");
|
|
156
|
+
}
|
|
157
|
+
if (o.subtreePath === undefined) {
|
|
158
|
+
throw new Error("Expected subtreePath in BatchInsertionResultPublicData deserialization");
|
|
159
|
+
}
|
|
160
|
+
;
|
|
161
|
+
return {
|
|
162
|
+
lowLeafWitnessData: o.lowLeafWitnessData.map((v) => toPublicDataLeafUpdateWitnessData(v)),
|
|
163
|
+
sortedLeaves: o.sortedLeaves.map((v) => toSortedPublicDataLeaf(v)),
|
|
164
|
+
subtreePath: o.subtreePath.map((v) => assertBin32(v, "v")),
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
export function toNullifierLeafUpdateWitnessData(o) {
|
|
168
|
+
if (o.leaf === undefined) {
|
|
169
|
+
throw new Error("Expected leaf in NullifierLeafUpdateWitnessData deserialization");
|
|
170
|
+
}
|
|
171
|
+
if (o.index === undefined) {
|
|
172
|
+
throw new Error("Expected index in NullifierLeafUpdateWitnessData deserialization");
|
|
173
|
+
}
|
|
174
|
+
if (o.path === undefined) {
|
|
175
|
+
throw new Error("Expected path in NullifierLeafUpdateWitnessData deserialization");
|
|
176
|
+
}
|
|
177
|
+
;
|
|
178
|
+
return {
|
|
179
|
+
leaf: toIndexedNullifierLeafValue(o.leaf),
|
|
180
|
+
index: assertU64(o.index, "o.index"),
|
|
181
|
+
path: o.path.map((v) => assertBin32(v, "v")),
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
export function toSortedNullifierLeaf(o) {
|
|
185
|
+
if (o.leaf === undefined) {
|
|
186
|
+
throw new Error("Expected leaf in SortedNullifierLeaf deserialization");
|
|
187
|
+
}
|
|
188
|
+
if (o.index === undefined) {
|
|
189
|
+
throw new Error("Expected index in SortedNullifierLeaf deserialization");
|
|
190
|
+
}
|
|
191
|
+
;
|
|
192
|
+
return {
|
|
193
|
+
leaf: toNullifierLeafValue(o.leaf),
|
|
194
|
+
index: assertU64(o.index, "o.index"),
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
export function toBatchInsertionResultNullifier(o) {
|
|
198
|
+
if (o.lowLeafWitnessData === undefined) {
|
|
199
|
+
throw new Error("Expected lowLeafWitnessData in BatchInsertionResultNullifier deserialization");
|
|
200
|
+
}
|
|
201
|
+
if (o.sortedLeaves === undefined) {
|
|
202
|
+
throw new Error("Expected sortedLeaves in BatchInsertionResultNullifier deserialization");
|
|
203
|
+
}
|
|
204
|
+
if (o.subtreePath === undefined) {
|
|
205
|
+
throw new Error("Expected subtreePath in BatchInsertionResultNullifier deserialization");
|
|
206
|
+
}
|
|
207
|
+
;
|
|
208
|
+
return {
|
|
209
|
+
lowLeafWitnessData: o.lowLeafWitnessData.map((v) => toNullifierLeafUpdateWitnessData(v)),
|
|
210
|
+
sortedLeaves: o.sortedLeaves.map((v) => toSortedNullifierLeaf(v)),
|
|
211
|
+
subtreePath: o.subtreePath.map((v) => assertBin32(v, "v")),
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
export function toSequentialInsertionResultPublicData(o) {
|
|
215
|
+
if (o.lowLeafWitnessData === undefined) {
|
|
216
|
+
throw new Error("Expected lowLeafWitnessData in SequentialInsertionResultPublicData deserialization");
|
|
217
|
+
}
|
|
218
|
+
if (o.insertionWitnessData === undefined) {
|
|
219
|
+
throw new Error("Expected insertionWitnessData in SequentialInsertionResultPublicData deserialization");
|
|
220
|
+
}
|
|
221
|
+
;
|
|
222
|
+
return {
|
|
223
|
+
lowLeafWitnessData: o.lowLeafWitnessData.map((v) => toPublicDataLeafUpdateWitnessData(v)),
|
|
224
|
+
insertionWitnessData: o.insertionWitnessData.map((v) => toPublicDataLeafUpdateWitnessData(v)),
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
export function toSequentialInsertionResultNullifier(o) {
|
|
228
|
+
if (o.lowLeafWitnessData === undefined) {
|
|
229
|
+
throw new Error("Expected lowLeafWitnessData in SequentialInsertionResultNullifier deserialization");
|
|
230
|
+
}
|
|
231
|
+
if (o.insertionWitnessData === undefined) {
|
|
232
|
+
throw new Error("Expected insertionWitnessData in SequentialInsertionResultNullifier deserialization");
|
|
233
|
+
}
|
|
234
|
+
;
|
|
235
|
+
return {
|
|
236
|
+
lowLeafWitnessData: o.lowLeafWitnessData.map((v) => toNullifierLeafUpdateWitnessData(v)),
|
|
237
|
+
insertionWitnessData: o.insertionWitnessData.map((v) => toNullifierLeafUpdateWitnessData(v)),
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
export function toWorldStateStatusSummary(o) {
|
|
241
|
+
if (o.unfinalizedBlockNumber === undefined) {
|
|
242
|
+
throw new Error("Expected unfinalizedBlockNumber in WorldStateStatusSummary deserialization");
|
|
243
|
+
}
|
|
244
|
+
if (o.finalizedBlockNumber === undefined) {
|
|
245
|
+
throw new Error("Expected finalizedBlockNumber in WorldStateStatusSummary deserialization");
|
|
246
|
+
}
|
|
247
|
+
if (o.oldestHistoricalBlock === undefined) {
|
|
248
|
+
throw new Error("Expected oldestHistoricalBlock in WorldStateStatusSummary deserialization");
|
|
249
|
+
}
|
|
250
|
+
if (o.treesAreSynched === undefined) {
|
|
251
|
+
throw new Error("Expected treesAreSynched in WorldStateStatusSummary deserialization");
|
|
252
|
+
}
|
|
253
|
+
;
|
|
254
|
+
return {
|
|
255
|
+
unfinalizedBlockNumber: assertU64(o.unfinalizedBlockNumber, "o.unfinalizedBlockNumber"),
|
|
256
|
+
finalizedBlockNumber: assertU64(o.finalizedBlockNumber, "o.finalizedBlockNumber"),
|
|
257
|
+
oldestHistoricalBlock: assertU64(o.oldestHistoricalBlock, "o.oldestHistoricalBlock"),
|
|
258
|
+
treesAreSynched: o.treesAreSynched,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
export function toDBStats(o) {
|
|
262
|
+
if (o.name === undefined) {
|
|
263
|
+
throw new Error("Expected name in DBStats deserialization");
|
|
264
|
+
}
|
|
265
|
+
if (o.numDataItems === undefined) {
|
|
266
|
+
throw new Error("Expected numDataItems in DBStats deserialization");
|
|
267
|
+
}
|
|
268
|
+
if (o.totalUsedSize === undefined) {
|
|
269
|
+
throw new Error("Expected totalUsedSize in DBStats deserialization");
|
|
270
|
+
}
|
|
271
|
+
;
|
|
272
|
+
return {
|
|
273
|
+
name: o.name,
|
|
274
|
+
numDataItems: assertU64(o.numDataItems, "o.numDataItems"),
|
|
275
|
+
totalUsedSize: assertU64(o.totalUsedSize, "o.totalUsedSize"),
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
export function toTreeDBStats(o) {
|
|
279
|
+
if (o.mapSize === undefined) {
|
|
280
|
+
throw new Error("Expected mapSize in TreeDBStats deserialization");
|
|
281
|
+
}
|
|
282
|
+
if (o.physicalFileSize === undefined) {
|
|
283
|
+
throw new Error("Expected physicalFileSize in TreeDBStats deserialization");
|
|
284
|
+
}
|
|
285
|
+
if (o.blocksDBStats === undefined) {
|
|
286
|
+
throw new Error("Expected blocksDBStats in TreeDBStats deserialization");
|
|
287
|
+
}
|
|
288
|
+
if (o.nodesDBStats === undefined) {
|
|
289
|
+
throw new Error("Expected nodesDBStats in TreeDBStats deserialization");
|
|
290
|
+
}
|
|
291
|
+
if (o.leafPreimagesDBStats === undefined) {
|
|
292
|
+
throw new Error("Expected leafPreimagesDBStats in TreeDBStats deserialization");
|
|
293
|
+
}
|
|
294
|
+
if (o.leafIndicesDBStats === undefined) {
|
|
295
|
+
throw new Error("Expected leafIndicesDBStats in TreeDBStats deserialization");
|
|
296
|
+
}
|
|
297
|
+
if (o.blockIndicesDBStats === undefined) {
|
|
298
|
+
throw new Error("Expected blockIndicesDBStats in TreeDBStats deserialization");
|
|
299
|
+
}
|
|
300
|
+
;
|
|
301
|
+
return {
|
|
302
|
+
mapSize: assertU64(o.mapSize, "o.mapSize"),
|
|
303
|
+
physicalFileSize: assertU64(o.physicalFileSize, "o.physicalFileSize"),
|
|
304
|
+
blocksDBStats: toDBStats(o.blocksDBStats),
|
|
305
|
+
nodesDBStats: toDBStats(o.nodesDBStats),
|
|
306
|
+
leafPreimagesDBStats: toDBStats(o.leafPreimagesDBStats),
|
|
307
|
+
leafIndicesDBStats: toDBStats(o.leafIndicesDBStats),
|
|
308
|
+
blockIndicesDBStats: toDBStats(o.blockIndicesDBStats),
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
export function toWorldStateDBStats(o) {
|
|
312
|
+
if (o.noteHashTreeStats === undefined) {
|
|
313
|
+
throw new Error("Expected noteHashTreeStats in WorldStateDBStats deserialization");
|
|
314
|
+
}
|
|
315
|
+
if (o.messageTreeStats === undefined) {
|
|
316
|
+
throw new Error("Expected messageTreeStats in WorldStateDBStats deserialization");
|
|
317
|
+
}
|
|
318
|
+
if (o.archiveTreeStats === undefined) {
|
|
319
|
+
throw new Error("Expected archiveTreeStats in WorldStateDBStats deserialization");
|
|
320
|
+
}
|
|
321
|
+
if (o.publicDataTreeStats === undefined) {
|
|
322
|
+
throw new Error("Expected publicDataTreeStats in WorldStateDBStats deserialization");
|
|
323
|
+
}
|
|
324
|
+
if (o.nullifierTreeStats === undefined) {
|
|
325
|
+
throw new Error("Expected nullifierTreeStats in WorldStateDBStats deserialization");
|
|
326
|
+
}
|
|
327
|
+
;
|
|
328
|
+
return {
|
|
329
|
+
noteHashTreeStats: toTreeDBStats(o.noteHashTreeStats),
|
|
330
|
+
messageTreeStats: toTreeDBStats(o.messageTreeStats),
|
|
331
|
+
archiveTreeStats: toTreeDBStats(o.archiveTreeStats),
|
|
332
|
+
publicDataTreeStats: toTreeDBStats(o.publicDataTreeStats),
|
|
333
|
+
nullifierTreeStats: toTreeDBStats(o.nullifierTreeStats),
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
export function toTreeMeta(o) {
|
|
337
|
+
if (o.name === undefined) {
|
|
338
|
+
throw new Error("Expected name in TreeMeta deserialization");
|
|
339
|
+
}
|
|
340
|
+
if (o.depth === undefined) {
|
|
341
|
+
throw new Error("Expected depth in TreeMeta deserialization");
|
|
342
|
+
}
|
|
343
|
+
if (o.size === undefined) {
|
|
344
|
+
throw new Error("Expected size in TreeMeta deserialization");
|
|
345
|
+
}
|
|
346
|
+
if (o.committedSize === undefined) {
|
|
347
|
+
throw new Error("Expected committedSize in TreeMeta deserialization");
|
|
348
|
+
}
|
|
349
|
+
if (o.root === undefined) {
|
|
350
|
+
throw new Error("Expected root in TreeMeta deserialization");
|
|
351
|
+
}
|
|
352
|
+
if (o.initialSize === undefined) {
|
|
353
|
+
throw new Error("Expected initialSize in TreeMeta deserialization");
|
|
354
|
+
}
|
|
355
|
+
if (o.initialRoot === undefined) {
|
|
356
|
+
throw new Error("Expected initialRoot in TreeMeta deserialization");
|
|
357
|
+
}
|
|
358
|
+
if (o.oldestHistoricBlock === undefined) {
|
|
359
|
+
throw new Error("Expected oldestHistoricBlock in TreeMeta deserialization");
|
|
360
|
+
}
|
|
361
|
+
if (o.unfinalizedBlockHeight === undefined) {
|
|
362
|
+
throw new Error("Expected unfinalizedBlockHeight in TreeMeta deserialization");
|
|
363
|
+
}
|
|
364
|
+
if (o.finalizedBlockHeight === undefined) {
|
|
365
|
+
throw new Error("Expected finalizedBlockHeight in TreeMeta deserialization");
|
|
366
|
+
}
|
|
367
|
+
;
|
|
368
|
+
return {
|
|
369
|
+
name: o.name,
|
|
370
|
+
depth: o.depth,
|
|
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"),
|
|
376
|
+
oldestHistoricBlock: o.oldestHistoricBlock,
|
|
377
|
+
unfinalizedBlockHeight: o.unfinalizedBlockHeight,
|
|
378
|
+
finalizedBlockHeight: o.finalizedBlockHeight,
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
export function toWorldStateMeta(o) {
|
|
382
|
+
if (o.noteHashTreeMeta === undefined) {
|
|
383
|
+
throw new Error("Expected noteHashTreeMeta in WorldStateMeta deserialization");
|
|
384
|
+
}
|
|
385
|
+
if (o.messageTreeMeta === undefined) {
|
|
386
|
+
throw new Error("Expected messageTreeMeta in WorldStateMeta deserialization");
|
|
387
|
+
}
|
|
388
|
+
if (o.archiveTreeMeta === undefined) {
|
|
389
|
+
throw new Error("Expected archiveTreeMeta in WorldStateMeta deserialization");
|
|
390
|
+
}
|
|
391
|
+
if (o.publicDataTreeMeta === undefined) {
|
|
392
|
+
throw new Error("Expected publicDataTreeMeta in WorldStateMeta deserialization");
|
|
393
|
+
}
|
|
394
|
+
if (o.nullifierTreeMeta === undefined) {
|
|
395
|
+
throw new Error("Expected nullifierTreeMeta in WorldStateMeta deserialization");
|
|
396
|
+
}
|
|
397
|
+
;
|
|
398
|
+
return {
|
|
399
|
+
noteHashTreeMeta: toTreeMeta(o.noteHashTreeMeta),
|
|
400
|
+
messageTreeMeta: toTreeMeta(o.messageTreeMeta),
|
|
401
|
+
archiveTreeMeta: toTreeMeta(o.archiveTreeMeta),
|
|
402
|
+
publicDataTreeMeta: toTreeMeta(o.publicDataTreeMeta),
|
|
403
|
+
nullifierTreeMeta: toTreeMeta(o.nullifierTreeMeta),
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
export function toWorldStateStatusFull(o) {
|
|
407
|
+
if (o.summary === undefined) {
|
|
408
|
+
throw new Error("Expected summary in WorldStateStatusFull deserialization");
|
|
409
|
+
}
|
|
410
|
+
if (o.dbStats === undefined) {
|
|
411
|
+
throw new Error("Expected dbStats in WorldStateStatusFull deserialization");
|
|
412
|
+
}
|
|
413
|
+
if (o.meta === undefined) {
|
|
414
|
+
throw new Error("Expected meta in WorldStateStatusFull deserialization");
|
|
415
|
+
}
|
|
416
|
+
;
|
|
417
|
+
return {
|
|
418
|
+
summary: toWorldStateStatusSummary(o.summary),
|
|
419
|
+
dbStats: toWorldStateDBStats(o.dbStats),
|
|
420
|
+
meta: toWorldStateMeta(o.meta),
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
export function toWorldStateRevision(o) {
|
|
424
|
+
if (o.forkId === undefined) {
|
|
425
|
+
throw new Error("Expected forkId in WorldStateRevision deserialization");
|
|
426
|
+
}
|
|
427
|
+
if (o.blockNumber === undefined) {
|
|
428
|
+
throw new Error("Expected blockNumber in WorldStateRevision deserialization");
|
|
429
|
+
}
|
|
430
|
+
if (o.includeUncommitted === undefined) {
|
|
431
|
+
throw new Error("Expected includeUncommitted in WorldStateRevision deserialization");
|
|
432
|
+
}
|
|
433
|
+
;
|
|
434
|
+
return {
|
|
435
|
+
forkId: assertU64(o.forkId, "o.forkId"),
|
|
436
|
+
blockNumber: o.blockNumber,
|
|
437
|
+
includeUncommitted: o.includeUncommitted,
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
export function toWsdbGetTreeInfo(o) {
|
|
441
|
+
if (o.treeId === undefined) {
|
|
442
|
+
throw new Error("Expected treeId in WsdbGetTreeInfo deserialization");
|
|
443
|
+
}
|
|
444
|
+
if (o.revision === undefined) {
|
|
445
|
+
throw new Error("Expected revision in WsdbGetTreeInfo deserialization");
|
|
446
|
+
}
|
|
447
|
+
;
|
|
448
|
+
return {
|
|
449
|
+
treeId: o.treeId,
|
|
450
|
+
revision: toWorldStateRevision(o.revision),
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
export function toWsdbGetStateReference(o) {
|
|
454
|
+
if (o.revision === undefined) {
|
|
455
|
+
throw new Error("Expected revision in WsdbGetStateReference deserialization");
|
|
456
|
+
}
|
|
457
|
+
;
|
|
458
|
+
return {
|
|
459
|
+
revision: toWorldStateRevision(o.revision),
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
export function toWsdbGetInitialStateReference(o) {
|
|
463
|
+
return {};
|
|
464
|
+
}
|
|
465
|
+
export function toWsdbGetLeafValue(o) {
|
|
466
|
+
if (o.treeId === undefined) {
|
|
467
|
+
throw new Error("Expected treeId in WsdbGetLeafValue deserialization");
|
|
468
|
+
}
|
|
469
|
+
if (o.revision === undefined) {
|
|
470
|
+
throw new Error("Expected revision in WsdbGetLeafValue deserialization");
|
|
471
|
+
}
|
|
472
|
+
if (o.leafIndex === undefined) {
|
|
473
|
+
throw new Error("Expected leafIndex in WsdbGetLeafValue deserialization");
|
|
474
|
+
}
|
|
475
|
+
;
|
|
476
|
+
return {
|
|
477
|
+
treeId: o.treeId,
|
|
478
|
+
revision: toWorldStateRevision(o.revision),
|
|
479
|
+
leafIndex: assertU64(o.leafIndex, "o.leafIndex"),
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
export function toWsdbGetPublicDataLeafValue(o) {
|
|
483
|
+
if (o.revision === undefined) {
|
|
484
|
+
throw new Error("Expected revision in WsdbGetPublicDataLeafValue deserialization");
|
|
485
|
+
}
|
|
486
|
+
if (o.leafIndex === undefined) {
|
|
487
|
+
throw new Error("Expected leafIndex in WsdbGetPublicDataLeafValue deserialization");
|
|
488
|
+
}
|
|
489
|
+
;
|
|
490
|
+
return {
|
|
491
|
+
revision: toWorldStateRevision(o.revision),
|
|
492
|
+
leafIndex: assertU64(o.leafIndex, "o.leafIndex"),
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
export function toWsdbGetNullifierLeafValue(o) {
|
|
496
|
+
if (o.revision === undefined) {
|
|
497
|
+
throw new Error("Expected revision in WsdbGetNullifierLeafValue deserialization");
|
|
498
|
+
}
|
|
499
|
+
if (o.leafIndex === undefined) {
|
|
500
|
+
throw new Error("Expected leafIndex in WsdbGetNullifierLeafValue deserialization");
|
|
501
|
+
}
|
|
502
|
+
;
|
|
503
|
+
return {
|
|
504
|
+
revision: toWorldStateRevision(o.revision),
|
|
505
|
+
leafIndex: assertU64(o.leafIndex, "o.leafIndex"),
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
export function toWsdbGetPublicDataLeafPreimage(o) {
|
|
509
|
+
if (o.revision === undefined) {
|
|
510
|
+
throw new Error("Expected revision in WsdbGetPublicDataLeafPreimage deserialization");
|
|
511
|
+
}
|
|
512
|
+
if (o.leafIndex === undefined) {
|
|
513
|
+
throw new Error("Expected leafIndex in WsdbGetPublicDataLeafPreimage deserialization");
|
|
514
|
+
}
|
|
515
|
+
;
|
|
516
|
+
return {
|
|
517
|
+
revision: toWorldStateRevision(o.revision),
|
|
518
|
+
leafIndex: assertU64(o.leafIndex, "o.leafIndex"),
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
export function toWsdbGetNullifierLeafPreimage(o) {
|
|
522
|
+
if (o.revision === undefined) {
|
|
523
|
+
throw new Error("Expected revision in WsdbGetNullifierLeafPreimage deserialization");
|
|
524
|
+
}
|
|
525
|
+
if (o.leafIndex === undefined) {
|
|
526
|
+
throw new Error("Expected leafIndex in WsdbGetNullifierLeafPreimage deserialization");
|
|
527
|
+
}
|
|
528
|
+
;
|
|
529
|
+
return {
|
|
530
|
+
revision: toWorldStateRevision(o.revision),
|
|
531
|
+
leafIndex: assertU64(o.leafIndex, "o.leafIndex"),
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
export function toWsdbGetSiblingPath(o) {
|
|
535
|
+
if (o.treeId === undefined) {
|
|
536
|
+
throw new Error("Expected treeId in WsdbGetSiblingPath deserialization");
|
|
537
|
+
}
|
|
538
|
+
if (o.revision === undefined) {
|
|
539
|
+
throw new Error("Expected revision in WsdbGetSiblingPath deserialization");
|
|
540
|
+
}
|
|
541
|
+
if (o.leafIndex === undefined) {
|
|
542
|
+
throw new Error("Expected leafIndex in WsdbGetSiblingPath deserialization");
|
|
543
|
+
}
|
|
544
|
+
;
|
|
545
|
+
return {
|
|
546
|
+
treeId: o.treeId,
|
|
547
|
+
revision: toWorldStateRevision(o.revision),
|
|
548
|
+
leafIndex: assertU64(o.leafIndex, "o.leafIndex"),
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
export function toWsdbGetBlockNumbersForLeafIndices(o) {
|
|
552
|
+
if (o.treeId === undefined) {
|
|
553
|
+
throw new Error("Expected treeId in WsdbGetBlockNumbersForLeafIndices deserialization");
|
|
554
|
+
}
|
|
555
|
+
if (o.revision === undefined) {
|
|
556
|
+
throw new Error("Expected revision in WsdbGetBlockNumbersForLeafIndices deserialization");
|
|
557
|
+
}
|
|
558
|
+
if (o.leafIndices === undefined) {
|
|
559
|
+
throw new Error("Expected leafIndices in WsdbGetBlockNumbersForLeafIndices deserialization");
|
|
560
|
+
}
|
|
561
|
+
;
|
|
562
|
+
return {
|
|
563
|
+
treeId: o.treeId,
|
|
564
|
+
revision: toWorldStateRevision(o.revision),
|
|
565
|
+
leafIndices: o.leafIndices.map((v) => assertU64(v, "v")),
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
export function toWsdbFindLeafIndices(o) {
|
|
569
|
+
if (o.treeId === undefined) {
|
|
570
|
+
throw new Error("Expected treeId in WsdbFindLeafIndices deserialization");
|
|
571
|
+
}
|
|
572
|
+
if (o.revision === undefined) {
|
|
573
|
+
throw new Error("Expected revision in WsdbFindLeafIndices deserialization");
|
|
574
|
+
}
|
|
575
|
+
if (o.leaves === undefined) {
|
|
576
|
+
throw new Error("Expected leaves in WsdbFindLeafIndices deserialization");
|
|
577
|
+
}
|
|
578
|
+
if (o.startIndex === undefined) {
|
|
579
|
+
throw new Error("Expected startIndex in WsdbFindLeafIndices deserialization");
|
|
580
|
+
}
|
|
581
|
+
;
|
|
582
|
+
return {
|
|
583
|
+
treeId: o.treeId,
|
|
584
|
+
revision: toWorldStateRevision(o.revision),
|
|
585
|
+
leaves: o.leaves.map((v) => assertBin32(v, "v")),
|
|
586
|
+
startIndex: assertU64(o.startIndex, "o.startIndex"),
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
export function toWsdbFindPublicDataLeafIndices(o) {
|
|
590
|
+
if (o.revision === undefined) {
|
|
591
|
+
throw new Error("Expected revision in WsdbFindPublicDataLeafIndices deserialization");
|
|
592
|
+
}
|
|
593
|
+
if (o.leaves === undefined) {
|
|
594
|
+
throw new Error("Expected leaves in WsdbFindPublicDataLeafIndices deserialization");
|
|
595
|
+
}
|
|
596
|
+
if (o.startIndex === undefined) {
|
|
597
|
+
throw new Error("Expected startIndex in WsdbFindPublicDataLeafIndices deserialization");
|
|
598
|
+
}
|
|
599
|
+
;
|
|
600
|
+
return {
|
|
601
|
+
revision: toWorldStateRevision(o.revision),
|
|
602
|
+
leaves: o.leaves.map((v) => toPublicDataLeafValue(v)),
|
|
603
|
+
startIndex: assertU64(o.startIndex, "o.startIndex"),
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
export function toWsdbFindNullifierLeafIndices(o) {
|
|
607
|
+
if (o.revision === undefined) {
|
|
608
|
+
throw new Error("Expected revision in WsdbFindNullifierLeafIndices deserialization");
|
|
609
|
+
}
|
|
610
|
+
if (o.leaves === undefined) {
|
|
611
|
+
throw new Error("Expected leaves in WsdbFindNullifierLeafIndices deserialization");
|
|
612
|
+
}
|
|
613
|
+
if (o.startIndex === undefined) {
|
|
614
|
+
throw new Error("Expected startIndex in WsdbFindNullifierLeafIndices deserialization");
|
|
615
|
+
}
|
|
616
|
+
;
|
|
617
|
+
return {
|
|
618
|
+
revision: toWorldStateRevision(o.revision),
|
|
619
|
+
leaves: o.leaves.map((v) => toNullifierLeafValue(v)),
|
|
620
|
+
startIndex: assertU64(o.startIndex, "o.startIndex"),
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
export function toWsdbFindLowLeaf(o) {
|
|
624
|
+
if (o.treeId === undefined) {
|
|
625
|
+
throw new Error("Expected treeId in WsdbFindLowLeaf deserialization");
|
|
626
|
+
}
|
|
627
|
+
if (o.revision === undefined) {
|
|
628
|
+
throw new Error("Expected revision in WsdbFindLowLeaf deserialization");
|
|
629
|
+
}
|
|
630
|
+
if (o.key === undefined) {
|
|
631
|
+
throw new Error("Expected key in WsdbFindLowLeaf deserialization");
|
|
632
|
+
}
|
|
633
|
+
;
|
|
634
|
+
return {
|
|
635
|
+
treeId: o.treeId,
|
|
636
|
+
revision: toWorldStateRevision(o.revision),
|
|
637
|
+
key: assertBin32(o.key, "o.key"),
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
export function toWsdbFindSiblingPaths(o) {
|
|
641
|
+
if (o.treeId === undefined) {
|
|
642
|
+
throw new Error("Expected treeId in WsdbFindSiblingPaths deserialization");
|
|
643
|
+
}
|
|
644
|
+
if (o.revision === undefined) {
|
|
645
|
+
throw new Error("Expected revision in WsdbFindSiblingPaths deserialization");
|
|
646
|
+
}
|
|
647
|
+
if (o.leaves === undefined) {
|
|
648
|
+
throw new Error("Expected leaves in WsdbFindSiblingPaths deserialization");
|
|
649
|
+
}
|
|
650
|
+
;
|
|
651
|
+
return {
|
|
652
|
+
treeId: o.treeId,
|
|
653
|
+
revision: toWorldStateRevision(o.revision),
|
|
654
|
+
leaves: o.leaves.map((v) => assertBin32(v, "v")),
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
export function toWsdbFindPublicDataSiblingPaths(o) {
|
|
658
|
+
if (o.revision === undefined) {
|
|
659
|
+
throw new Error("Expected revision in WsdbFindPublicDataSiblingPaths deserialization");
|
|
660
|
+
}
|
|
661
|
+
if (o.leaves === undefined) {
|
|
662
|
+
throw new Error("Expected leaves in WsdbFindPublicDataSiblingPaths deserialization");
|
|
663
|
+
}
|
|
664
|
+
;
|
|
665
|
+
return {
|
|
666
|
+
revision: toWorldStateRevision(o.revision),
|
|
667
|
+
leaves: o.leaves.map((v) => toPublicDataLeafValue(v)),
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
export function toWsdbFindNullifierSiblingPaths(o) {
|
|
671
|
+
if (o.revision === undefined) {
|
|
672
|
+
throw new Error("Expected revision in WsdbFindNullifierSiblingPaths deserialization");
|
|
673
|
+
}
|
|
674
|
+
if (o.leaves === undefined) {
|
|
675
|
+
throw new Error("Expected leaves in WsdbFindNullifierSiblingPaths deserialization");
|
|
676
|
+
}
|
|
677
|
+
;
|
|
678
|
+
return {
|
|
679
|
+
revision: toWorldStateRevision(o.revision),
|
|
680
|
+
leaves: o.leaves.map((v) => toNullifierLeafValue(v)),
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
export function toWsdbAppendLeaves(o) {
|
|
684
|
+
if (o.treeId === undefined) {
|
|
685
|
+
throw new Error("Expected treeId in WsdbAppendLeaves deserialization");
|
|
686
|
+
}
|
|
687
|
+
if (o.leaves === undefined) {
|
|
688
|
+
throw new Error("Expected leaves in WsdbAppendLeaves deserialization");
|
|
689
|
+
}
|
|
690
|
+
if (o.forkId === undefined) {
|
|
691
|
+
throw new Error("Expected forkId in WsdbAppendLeaves deserialization");
|
|
692
|
+
}
|
|
693
|
+
;
|
|
694
|
+
return {
|
|
695
|
+
treeId: o.treeId,
|
|
696
|
+
leaves: o.leaves.map((v) => assertBin32(v, "v")),
|
|
697
|
+
forkId: assertU64(o.forkId, "o.forkId"),
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
export function toWsdbAppendPublicDataLeaves(o) {
|
|
701
|
+
if (o.leaves === undefined) {
|
|
702
|
+
throw new Error("Expected leaves in WsdbAppendPublicDataLeaves deserialization");
|
|
703
|
+
}
|
|
704
|
+
if (o.forkId === undefined) {
|
|
705
|
+
throw new Error("Expected forkId in WsdbAppendPublicDataLeaves deserialization");
|
|
706
|
+
}
|
|
707
|
+
;
|
|
708
|
+
return {
|
|
709
|
+
leaves: o.leaves.map((v) => toPublicDataLeafValue(v)),
|
|
710
|
+
forkId: assertU64(o.forkId, "o.forkId"),
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
export function toWsdbAppendNullifierLeaves(o) {
|
|
714
|
+
if (o.leaves === undefined) {
|
|
715
|
+
throw new Error("Expected leaves in WsdbAppendNullifierLeaves deserialization");
|
|
716
|
+
}
|
|
717
|
+
if (o.forkId === undefined) {
|
|
718
|
+
throw new Error("Expected forkId in WsdbAppendNullifierLeaves deserialization");
|
|
719
|
+
}
|
|
720
|
+
;
|
|
721
|
+
return {
|
|
722
|
+
leaves: o.leaves.map((v) => toNullifierLeafValue(v)),
|
|
723
|
+
forkId: assertU64(o.forkId, "o.forkId"),
|
|
724
|
+
};
|
|
725
|
+
}
|
|
726
|
+
export function toWsdbBatchInsertPublicData(o) {
|
|
727
|
+
if (o.leaves === undefined) {
|
|
728
|
+
throw new Error("Expected leaves in WsdbBatchInsertPublicData deserialization");
|
|
729
|
+
}
|
|
730
|
+
if (o.subtreeDepth === undefined) {
|
|
731
|
+
throw new Error("Expected subtreeDepth in WsdbBatchInsertPublicData deserialization");
|
|
732
|
+
}
|
|
733
|
+
if (o.forkId === undefined) {
|
|
734
|
+
throw new Error("Expected forkId in WsdbBatchInsertPublicData deserialization");
|
|
735
|
+
}
|
|
736
|
+
;
|
|
737
|
+
return {
|
|
738
|
+
leaves: o.leaves.map((v) => toPublicDataLeafValue(v)),
|
|
739
|
+
subtreeDepth: o.subtreeDepth,
|
|
740
|
+
forkId: assertU64(o.forkId, "o.forkId"),
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
export function toWsdbBatchInsertNullifier(o) {
|
|
744
|
+
if (o.leaves === undefined) {
|
|
745
|
+
throw new Error("Expected leaves in WsdbBatchInsertNullifier deserialization");
|
|
746
|
+
}
|
|
747
|
+
if (o.subtreeDepth === undefined) {
|
|
748
|
+
throw new Error("Expected subtreeDepth in WsdbBatchInsertNullifier deserialization");
|
|
749
|
+
}
|
|
750
|
+
if (o.forkId === undefined) {
|
|
751
|
+
throw new Error("Expected forkId in WsdbBatchInsertNullifier deserialization");
|
|
752
|
+
}
|
|
753
|
+
;
|
|
754
|
+
return {
|
|
755
|
+
leaves: o.leaves.map((v) => toNullifierLeafValue(v)),
|
|
756
|
+
subtreeDepth: o.subtreeDepth,
|
|
757
|
+
forkId: assertU64(o.forkId, "o.forkId"),
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
export function toWsdbSequentialInsertPublicData(o) {
|
|
761
|
+
if (o.leaves === undefined) {
|
|
762
|
+
throw new Error("Expected leaves in WsdbSequentialInsertPublicData deserialization");
|
|
763
|
+
}
|
|
764
|
+
if (o.forkId === undefined) {
|
|
765
|
+
throw new Error("Expected forkId in WsdbSequentialInsertPublicData deserialization");
|
|
766
|
+
}
|
|
767
|
+
;
|
|
768
|
+
return {
|
|
769
|
+
leaves: o.leaves.map((v) => toPublicDataLeafValue(v)),
|
|
770
|
+
forkId: assertU64(o.forkId, "o.forkId"),
|
|
771
|
+
};
|
|
772
|
+
}
|
|
773
|
+
export function toWsdbSequentialInsertNullifier(o) {
|
|
774
|
+
if (o.leaves === undefined) {
|
|
775
|
+
throw new Error("Expected leaves in WsdbSequentialInsertNullifier deserialization");
|
|
776
|
+
}
|
|
777
|
+
if (o.forkId === undefined) {
|
|
778
|
+
throw new Error("Expected forkId in WsdbSequentialInsertNullifier deserialization");
|
|
779
|
+
}
|
|
780
|
+
;
|
|
781
|
+
return {
|
|
782
|
+
leaves: o.leaves.map((v) => toNullifierLeafValue(v)),
|
|
783
|
+
forkId: assertU64(o.forkId, "o.forkId"),
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
export function toWsdbUpdateArchive(o) {
|
|
787
|
+
if (o.blockStateRef === undefined) {
|
|
788
|
+
throw new Error("Expected blockStateRef in WsdbUpdateArchive deserialization");
|
|
789
|
+
}
|
|
790
|
+
if (o.blockHeaderHash === undefined) {
|
|
791
|
+
throw new Error("Expected blockHeaderHash in WsdbUpdateArchive deserialization");
|
|
792
|
+
}
|
|
793
|
+
if (o.forkId === undefined) {
|
|
794
|
+
throw new Error("Expected forkId in WsdbUpdateArchive deserialization");
|
|
795
|
+
}
|
|
796
|
+
;
|
|
797
|
+
return {
|
|
798
|
+
blockStateRef: o.blockStateRef.map((v) => toTreeStateReference(v)),
|
|
799
|
+
blockHeaderHash: assertBin32(o.blockHeaderHash, "o.blockHeaderHash"),
|
|
800
|
+
forkId: assertU64(o.forkId, "o.forkId"),
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
export function toWsdbCommit(o) {
|
|
804
|
+
return {};
|
|
805
|
+
}
|
|
806
|
+
export function toWsdbRollback(o) {
|
|
807
|
+
return {};
|
|
808
|
+
}
|
|
809
|
+
export function toWsdbSyncBlock(o) {
|
|
810
|
+
if (o.blockNumber === undefined) {
|
|
811
|
+
throw new Error("Expected blockNumber in WsdbSyncBlock deserialization");
|
|
812
|
+
}
|
|
813
|
+
if (o.blockStateRef === undefined) {
|
|
814
|
+
throw new Error("Expected blockStateRef in WsdbSyncBlock deserialization");
|
|
815
|
+
}
|
|
816
|
+
if (o.blockHeaderHash === undefined) {
|
|
817
|
+
throw new Error("Expected blockHeaderHash in WsdbSyncBlock deserialization");
|
|
818
|
+
}
|
|
819
|
+
if (o.paddedNoteHashes === undefined) {
|
|
820
|
+
throw new Error("Expected paddedNoteHashes in WsdbSyncBlock deserialization");
|
|
821
|
+
}
|
|
822
|
+
if (o.paddedL1ToL2Messages === undefined) {
|
|
823
|
+
throw new Error("Expected paddedL1ToL2Messages in WsdbSyncBlock deserialization");
|
|
824
|
+
}
|
|
825
|
+
if (o.paddedNullifiers === undefined) {
|
|
826
|
+
throw new Error("Expected paddedNullifiers in WsdbSyncBlock deserialization");
|
|
827
|
+
}
|
|
828
|
+
if (o.publicDataWrites === undefined) {
|
|
829
|
+
throw new Error("Expected publicDataWrites in WsdbSyncBlock deserialization");
|
|
830
|
+
}
|
|
831
|
+
;
|
|
832
|
+
return {
|
|
833
|
+
blockNumber: o.blockNumber,
|
|
834
|
+
blockStateRef: o.blockStateRef.map((v) => toTreeStateReference(v)),
|
|
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")),
|
|
838
|
+
paddedNullifiers: o.paddedNullifiers.map((v) => toNullifierLeafValue(v)),
|
|
839
|
+
publicDataWrites: o.publicDataWrites.map((v) => toPublicDataLeafValue(v)),
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
export function toWsdbCreateFork(o) {
|
|
843
|
+
if (o.latest === undefined) {
|
|
844
|
+
throw new Error("Expected latest in WsdbCreateFork deserialization");
|
|
845
|
+
}
|
|
846
|
+
if (o.blockNumber === undefined) {
|
|
847
|
+
throw new Error("Expected blockNumber in WsdbCreateFork deserialization");
|
|
848
|
+
}
|
|
849
|
+
;
|
|
850
|
+
return {
|
|
851
|
+
latest: o.latest,
|
|
852
|
+
blockNumber: o.blockNumber,
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
export function toWsdbDeleteFork(o) {
|
|
856
|
+
if (o.forkId === undefined) {
|
|
857
|
+
throw new Error("Expected forkId in WsdbDeleteFork deserialization");
|
|
858
|
+
}
|
|
859
|
+
;
|
|
860
|
+
return {
|
|
861
|
+
forkId: assertU64(o.forkId, "o.forkId"),
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
export function toWsdbFinalizeBlocks(o) {
|
|
865
|
+
if (o.toBlockNumber === undefined) {
|
|
866
|
+
throw new Error("Expected toBlockNumber in WsdbFinalizeBlocks deserialization");
|
|
867
|
+
}
|
|
868
|
+
;
|
|
869
|
+
return {
|
|
870
|
+
toBlockNumber: o.toBlockNumber,
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
export function toWsdbUnwindBlocks(o) {
|
|
874
|
+
if (o.toBlockNumber === undefined) {
|
|
875
|
+
throw new Error("Expected toBlockNumber in WsdbUnwindBlocks deserialization");
|
|
876
|
+
}
|
|
877
|
+
;
|
|
878
|
+
return {
|
|
879
|
+
toBlockNumber: o.toBlockNumber,
|
|
880
|
+
};
|
|
881
|
+
}
|
|
882
|
+
export function toWsdbRemoveHistoricalBlocks(o) {
|
|
883
|
+
if (o.toBlockNumber === undefined) {
|
|
884
|
+
throw new Error("Expected toBlockNumber in WsdbRemoveHistoricalBlocks deserialization");
|
|
885
|
+
}
|
|
886
|
+
;
|
|
887
|
+
return {
|
|
888
|
+
toBlockNumber: o.toBlockNumber,
|
|
889
|
+
};
|
|
890
|
+
}
|
|
891
|
+
export function toWsdbGetStatus(o) {
|
|
892
|
+
return {};
|
|
893
|
+
}
|
|
894
|
+
export function toWsdbCreateCheckpoint(o) {
|
|
895
|
+
if (o.forkId === undefined) {
|
|
896
|
+
throw new Error("Expected forkId in WsdbCreateCheckpoint deserialization");
|
|
897
|
+
}
|
|
898
|
+
;
|
|
899
|
+
return {
|
|
900
|
+
forkId: assertU64(o.forkId, "o.forkId"),
|
|
901
|
+
};
|
|
902
|
+
}
|
|
903
|
+
export function toWsdbCommitCheckpoint(o) {
|
|
904
|
+
if (o.forkId === undefined) {
|
|
905
|
+
throw new Error("Expected forkId in WsdbCommitCheckpoint deserialization");
|
|
906
|
+
}
|
|
907
|
+
;
|
|
908
|
+
return {
|
|
909
|
+
forkId: assertU64(o.forkId, "o.forkId"),
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
export function toWsdbRevertCheckpoint(o) {
|
|
913
|
+
if (o.forkId === undefined) {
|
|
914
|
+
throw new Error("Expected forkId in WsdbRevertCheckpoint deserialization");
|
|
915
|
+
}
|
|
916
|
+
;
|
|
917
|
+
return {
|
|
918
|
+
forkId: assertU64(o.forkId, "o.forkId"),
|
|
919
|
+
};
|
|
920
|
+
}
|
|
921
|
+
export function toWsdbCommitAllCheckpoints(o) {
|
|
922
|
+
if (o.forkId === undefined) {
|
|
923
|
+
throw new Error("Expected forkId in WsdbCommitAllCheckpoints deserialization");
|
|
924
|
+
}
|
|
925
|
+
;
|
|
926
|
+
return {
|
|
927
|
+
forkId: assertU64(o.forkId, "o.forkId"),
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
export function toWsdbRevertAllCheckpoints(o) {
|
|
931
|
+
if (o.forkId === undefined) {
|
|
932
|
+
throw new Error("Expected forkId in WsdbRevertAllCheckpoints deserialization");
|
|
933
|
+
}
|
|
934
|
+
;
|
|
935
|
+
return {
|
|
936
|
+
forkId: assertU64(o.forkId, "o.forkId"),
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
export function toWsdbCopyStores(o) {
|
|
940
|
+
if (o.dstPath === undefined) {
|
|
941
|
+
throw new Error("Expected dstPath in WsdbCopyStores deserialization");
|
|
942
|
+
}
|
|
943
|
+
;
|
|
944
|
+
return {
|
|
945
|
+
dstPath: o.dstPath,
|
|
946
|
+
compact: o.compact ?? null,
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
export function toWsdbGetTreeInfoResponse(o) {
|
|
950
|
+
if (o.treeId === undefined) {
|
|
951
|
+
throw new Error("Expected treeId in WsdbGetTreeInfoResponse deserialization");
|
|
952
|
+
}
|
|
953
|
+
if (o.root === undefined) {
|
|
954
|
+
throw new Error("Expected root in WsdbGetTreeInfoResponse deserialization");
|
|
955
|
+
}
|
|
956
|
+
if (o.size === undefined) {
|
|
957
|
+
throw new Error("Expected size in WsdbGetTreeInfoResponse deserialization");
|
|
958
|
+
}
|
|
959
|
+
if (o.depth === undefined) {
|
|
960
|
+
throw new Error("Expected depth in WsdbGetTreeInfoResponse deserialization");
|
|
961
|
+
}
|
|
962
|
+
;
|
|
963
|
+
return {
|
|
964
|
+
treeId: o.treeId,
|
|
965
|
+
root: assertBin32(o.root, "o.root"),
|
|
966
|
+
size: assertU64(o.size, "o.size"),
|
|
967
|
+
depth: o.depth,
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
export function toWsdbGetStateReferenceResponse(o) {
|
|
971
|
+
if (o.state === undefined) {
|
|
972
|
+
throw new Error("Expected state in WsdbGetStateReferenceResponse deserialization");
|
|
973
|
+
}
|
|
974
|
+
;
|
|
975
|
+
return {
|
|
976
|
+
state: o.state.map((v) => toTreeStateReference(v)),
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
export function toWsdbGetInitialStateReferenceResponse(o) {
|
|
980
|
+
if (o.state === undefined) {
|
|
981
|
+
throw new Error("Expected state in WsdbGetInitialStateReferenceResponse deserialization");
|
|
982
|
+
}
|
|
983
|
+
;
|
|
984
|
+
return {
|
|
985
|
+
state: o.state.map((v) => toTreeStateReference(v)),
|
|
986
|
+
};
|
|
987
|
+
}
|
|
988
|
+
export function toWsdbGetLeafValueResponse(o) {
|
|
989
|
+
;
|
|
990
|
+
return {
|
|
991
|
+
value: o.value != null ? assertBin32(o.value, "o.value") : null,
|
|
992
|
+
};
|
|
993
|
+
}
|
|
994
|
+
export function toWsdbGetPublicDataLeafValueResponse(o) {
|
|
995
|
+
;
|
|
996
|
+
return {
|
|
997
|
+
value: o.value != null ? toPublicDataLeafValue(o.value) : null,
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
export function toWsdbGetNullifierLeafValueResponse(o) {
|
|
1001
|
+
;
|
|
1002
|
+
return {
|
|
1003
|
+
value: o.value != null ? toNullifierLeafValue(o.value) : null,
|
|
1004
|
+
};
|
|
1005
|
+
}
|
|
1006
|
+
export function toWsdbGetPublicDataLeafPreimageResponse(o) {
|
|
1007
|
+
;
|
|
1008
|
+
return {
|
|
1009
|
+
preimage: o.preimage != null ? toIndexedPublicDataLeafValue(o.preimage) : null,
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
export function toWsdbGetNullifierLeafPreimageResponse(o) {
|
|
1013
|
+
;
|
|
1014
|
+
return {
|
|
1015
|
+
preimage: o.preimage != null ? toIndexedNullifierLeafValue(o.preimage) : null,
|
|
1016
|
+
};
|
|
1017
|
+
}
|
|
1018
|
+
export function toWsdbGetSiblingPathResponse(o) {
|
|
1019
|
+
if (o.path === undefined) {
|
|
1020
|
+
throw new Error("Expected path in WsdbGetSiblingPathResponse deserialization");
|
|
1021
|
+
}
|
|
1022
|
+
;
|
|
1023
|
+
return {
|
|
1024
|
+
path: o.path.map((v) => assertBin32(v, "v")),
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
export function toWsdbGetBlockNumbersForLeafIndicesResponse(o) {
|
|
1028
|
+
if (o.blockNumbers === undefined) {
|
|
1029
|
+
throw new Error("Expected blockNumbers in WsdbGetBlockNumbersForLeafIndicesResponse deserialization");
|
|
1030
|
+
}
|
|
1031
|
+
;
|
|
1032
|
+
return {
|
|
1033
|
+
blockNumbers: o.blockNumbers.map((v) => v ?? null),
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
export function toWsdbFindLeafIndicesResponse(o) {
|
|
1037
|
+
if (o.indices === undefined) {
|
|
1038
|
+
throw new Error("Expected indices in WsdbFindLeafIndicesResponse deserialization");
|
|
1039
|
+
}
|
|
1040
|
+
;
|
|
1041
|
+
return {
|
|
1042
|
+
indices: o.indices.map((v) => v != null ? assertU64(v, "v") : null),
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
1045
|
+
export function toWsdbFindPublicDataLeafIndicesResponse(o) {
|
|
1046
|
+
if (o.indices === undefined) {
|
|
1047
|
+
throw new Error("Expected indices in WsdbFindPublicDataLeafIndicesResponse deserialization");
|
|
1048
|
+
}
|
|
1049
|
+
;
|
|
1050
|
+
return {
|
|
1051
|
+
indices: o.indices.map((v) => v != null ? assertU64(v, "v") : null),
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
export function toWsdbFindNullifierLeafIndicesResponse(o) {
|
|
1055
|
+
if (o.indices === undefined) {
|
|
1056
|
+
throw new Error("Expected indices in WsdbFindNullifierLeafIndicesResponse deserialization");
|
|
1057
|
+
}
|
|
1058
|
+
;
|
|
1059
|
+
return {
|
|
1060
|
+
indices: o.indices.map((v) => v != null ? assertU64(v, "v") : null),
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
export function toWsdbFindLowLeafResponse(o) {
|
|
1064
|
+
if (o.alreadyPresent === undefined) {
|
|
1065
|
+
throw new Error("Expected alreadyPresent in WsdbFindLowLeafResponse deserialization");
|
|
1066
|
+
}
|
|
1067
|
+
if (o.index === undefined) {
|
|
1068
|
+
throw new Error("Expected index in WsdbFindLowLeafResponse deserialization");
|
|
1069
|
+
}
|
|
1070
|
+
;
|
|
1071
|
+
return {
|
|
1072
|
+
alreadyPresent: o.alreadyPresent,
|
|
1073
|
+
index: assertU64(o.index, "o.index"),
|
|
1074
|
+
};
|
|
1075
|
+
}
|
|
1076
|
+
export function toWsdbFindSiblingPathsResponse(o) {
|
|
1077
|
+
if (o.paths === undefined) {
|
|
1078
|
+
throw new Error("Expected paths in WsdbFindSiblingPathsResponse deserialization");
|
|
1079
|
+
}
|
|
1080
|
+
;
|
|
1081
|
+
return {
|
|
1082
|
+
paths: o.paths.map((v) => v != null ? toSiblingPathAndIndex(v) : null),
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
export function toWsdbFindPublicDataSiblingPathsResponse(o) {
|
|
1086
|
+
if (o.paths === undefined) {
|
|
1087
|
+
throw new Error("Expected paths in WsdbFindPublicDataSiblingPathsResponse deserialization");
|
|
1088
|
+
}
|
|
1089
|
+
;
|
|
1090
|
+
return {
|
|
1091
|
+
paths: o.paths.map((v) => v != null ? toSiblingPathAndIndex(v) : null),
|
|
1092
|
+
};
|
|
1093
|
+
}
|
|
1094
|
+
export function toWsdbFindNullifierSiblingPathsResponse(o) {
|
|
1095
|
+
if (o.paths === undefined) {
|
|
1096
|
+
throw new Error("Expected paths in WsdbFindNullifierSiblingPathsResponse deserialization");
|
|
1097
|
+
}
|
|
1098
|
+
;
|
|
1099
|
+
return {
|
|
1100
|
+
paths: o.paths.map((v) => v != null ? toSiblingPathAndIndex(v) : null),
|
|
1101
|
+
};
|
|
1102
|
+
}
|
|
1103
|
+
export function toWsdbAppendLeavesResponse(o) {
|
|
1104
|
+
return {};
|
|
1105
|
+
}
|
|
1106
|
+
export function toWsdbAppendPublicDataLeavesResponse(o) {
|
|
1107
|
+
return {};
|
|
1108
|
+
}
|
|
1109
|
+
export function toWsdbAppendNullifierLeavesResponse(o) {
|
|
1110
|
+
return {};
|
|
1111
|
+
}
|
|
1112
|
+
export function toWsdbBatchInsertPublicDataResponse(o) {
|
|
1113
|
+
if (o.result === undefined) {
|
|
1114
|
+
throw new Error("Expected result in WsdbBatchInsertPublicDataResponse deserialization");
|
|
1115
|
+
}
|
|
1116
|
+
;
|
|
1117
|
+
return {
|
|
1118
|
+
result: toBatchInsertionResultPublicData(o.result),
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
export function toWsdbBatchInsertNullifierResponse(o) {
|
|
1122
|
+
if (o.result === undefined) {
|
|
1123
|
+
throw new Error("Expected result in WsdbBatchInsertNullifierResponse deserialization");
|
|
1124
|
+
}
|
|
1125
|
+
;
|
|
1126
|
+
return {
|
|
1127
|
+
result: toBatchInsertionResultNullifier(o.result),
|
|
1128
|
+
};
|
|
1129
|
+
}
|
|
1130
|
+
export function toWsdbSequentialInsertPublicDataResponse(o) {
|
|
1131
|
+
if (o.result === undefined) {
|
|
1132
|
+
throw new Error("Expected result in WsdbSequentialInsertPublicDataResponse deserialization");
|
|
1133
|
+
}
|
|
1134
|
+
;
|
|
1135
|
+
return {
|
|
1136
|
+
result: toSequentialInsertionResultPublicData(o.result),
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
export function toWsdbSequentialInsertNullifierResponse(o) {
|
|
1140
|
+
if (o.result === undefined) {
|
|
1141
|
+
throw new Error("Expected result in WsdbSequentialInsertNullifierResponse deserialization");
|
|
1142
|
+
}
|
|
1143
|
+
;
|
|
1144
|
+
return {
|
|
1145
|
+
result: toSequentialInsertionResultNullifier(o.result),
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
export function toWsdbUpdateArchiveResponse(o) {
|
|
1149
|
+
return {};
|
|
1150
|
+
}
|
|
1151
|
+
export function toWsdbCommitResponse(o) {
|
|
1152
|
+
if (o.status === undefined) {
|
|
1153
|
+
throw new Error("Expected status in WsdbCommitResponse deserialization");
|
|
1154
|
+
}
|
|
1155
|
+
;
|
|
1156
|
+
return {
|
|
1157
|
+
status: toWorldStateStatusFull(o.status),
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1160
|
+
export function toWsdbRollbackResponse(o) {
|
|
1161
|
+
return {};
|
|
1162
|
+
}
|
|
1163
|
+
export function toWsdbSyncBlockResponse(o) {
|
|
1164
|
+
if (o.status === undefined) {
|
|
1165
|
+
throw new Error("Expected status in WsdbSyncBlockResponse deserialization");
|
|
1166
|
+
}
|
|
1167
|
+
;
|
|
1168
|
+
return {
|
|
1169
|
+
status: toWorldStateStatusFull(o.status),
|
|
1170
|
+
};
|
|
1171
|
+
}
|
|
1172
|
+
export function toWsdbCreateForkResponse(o) {
|
|
1173
|
+
if (o.forkId === undefined) {
|
|
1174
|
+
throw new Error("Expected forkId in WsdbCreateForkResponse deserialization");
|
|
1175
|
+
}
|
|
1176
|
+
;
|
|
1177
|
+
return {
|
|
1178
|
+
forkId: assertU64(o.forkId, "o.forkId"),
|
|
1179
|
+
};
|
|
1180
|
+
}
|
|
1181
|
+
export function toWsdbDeleteForkResponse(o) {
|
|
1182
|
+
return {};
|
|
1183
|
+
}
|
|
1184
|
+
export function toWsdbFinalizeBlocksResponse(o) {
|
|
1185
|
+
if (o.status === undefined) {
|
|
1186
|
+
throw new Error("Expected status in WsdbFinalizeBlocksResponse deserialization");
|
|
1187
|
+
}
|
|
1188
|
+
;
|
|
1189
|
+
return {
|
|
1190
|
+
status: toWorldStateStatusSummary(o.status),
|
|
1191
|
+
};
|
|
1192
|
+
}
|
|
1193
|
+
export function toWsdbUnwindBlocksResponse(o) {
|
|
1194
|
+
if (o.status === undefined) {
|
|
1195
|
+
throw new Error("Expected status in WsdbUnwindBlocksResponse deserialization");
|
|
1196
|
+
}
|
|
1197
|
+
;
|
|
1198
|
+
return {
|
|
1199
|
+
status: toWorldStateStatusFull(o.status),
|
|
1200
|
+
};
|
|
1201
|
+
}
|
|
1202
|
+
export function toWsdbRemoveHistoricalBlocksResponse(o) {
|
|
1203
|
+
if (o.status === undefined) {
|
|
1204
|
+
throw new Error("Expected status in WsdbRemoveHistoricalBlocksResponse deserialization");
|
|
1205
|
+
}
|
|
1206
|
+
;
|
|
1207
|
+
return {
|
|
1208
|
+
status: toWorldStateStatusFull(o.status),
|
|
1209
|
+
};
|
|
1210
|
+
}
|
|
1211
|
+
export function toWsdbGetStatusResponse(o) {
|
|
1212
|
+
if (o.status === undefined) {
|
|
1213
|
+
throw new Error("Expected status in WsdbGetStatusResponse deserialization");
|
|
1214
|
+
}
|
|
1215
|
+
;
|
|
1216
|
+
return {
|
|
1217
|
+
status: toWorldStateStatusSummary(o.status),
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
export function toWsdbCreateCheckpointResponse(o) {
|
|
1221
|
+
return {};
|
|
1222
|
+
}
|
|
1223
|
+
export function toWsdbCommitCheckpointResponse(o) {
|
|
1224
|
+
return {};
|
|
1225
|
+
}
|
|
1226
|
+
export function toWsdbRevertCheckpointResponse(o) {
|
|
1227
|
+
return {};
|
|
1228
|
+
}
|
|
1229
|
+
export function toWsdbCommitAllCheckpointsResponse(o) {
|
|
1230
|
+
return {};
|
|
1231
|
+
}
|
|
1232
|
+
export function toWsdbRevertAllCheckpointsResponse(o) {
|
|
1233
|
+
return {};
|
|
1234
|
+
}
|
|
1235
|
+
export function toWsdbCopyStoresResponse(o) {
|
|
1236
|
+
return {};
|
|
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
|
+
}
|
|
1247
|
+
export function fromTreeStateReference(o) {
|
|
1248
|
+
if (o.treeId === undefined) {
|
|
1249
|
+
throw new Error("Expected treeId in TreeStateReference serialization");
|
|
1250
|
+
}
|
|
1251
|
+
if (o.root === undefined) {
|
|
1252
|
+
throw new Error("Expected root in TreeStateReference serialization");
|
|
1253
|
+
}
|
|
1254
|
+
if (o.size === undefined) {
|
|
1255
|
+
throw new Error("Expected size in TreeStateReference serialization");
|
|
1256
|
+
}
|
|
1257
|
+
;
|
|
1258
|
+
return {
|
|
1259
|
+
treeId: o.treeId,
|
|
1260
|
+
root: assertBin32(o.root, "o.root"),
|
|
1261
|
+
size: toWireU64(o.size, "o.size"),
|
|
1262
|
+
};
|
|
1263
|
+
}
|
|
1264
|
+
export function fromPublicDataLeafValue(o) {
|
|
1265
|
+
if (o.slot === undefined) {
|
|
1266
|
+
throw new Error("Expected slot in PublicDataLeafValue serialization");
|
|
1267
|
+
}
|
|
1268
|
+
if (o.value === undefined) {
|
|
1269
|
+
throw new Error("Expected value in PublicDataLeafValue serialization");
|
|
1270
|
+
}
|
|
1271
|
+
;
|
|
1272
|
+
return {
|
|
1273
|
+
slot: assertBin32(o.slot, "o.slot"),
|
|
1274
|
+
value: assertBin32(o.value, "o.value"),
|
|
1275
|
+
};
|
|
1276
|
+
}
|
|
1277
|
+
export function fromNullifierLeafValue(o) {
|
|
1278
|
+
if (o.nullifier === undefined) {
|
|
1279
|
+
throw new Error("Expected nullifier in NullifierLeafValue serialization");
|
|
1280
|
+
}
|
|
1281
|
+
;
|
|
1282
|
+
return {
|
|
1283
|
+
nullifier: assertBin32(o.nullifier, "o.nullifier"),
|
|
1284
|
+
};
|
|
1285
|
+
}
|
|
1286
|
+
export function fromIndexedPublicDataLeafValue(o) {
|
|
1287
|
+
if (o.leaf === undefined) {
|
|
1288
|
+
throw new Error("Expected leaf in IndexedPublicDataLeafValue serialization");
|
|
1289
|
+
}
|
|
1290
|
+
if (o.nextIndex === undefined) {
|
|
1291
|
+
throw new Error("Expected nextIndex in IndexedPublicDataLeafValue serialization");
|
|
1292
|
+
}
|
|
1293
|
+
if (o.nextKey === undefined) {
|
|
1294
|
+
throw new Error("Expected nextKey in IndexedPublicDataLeafValue serialization");
|
|
1295
|
+
}
|
|
1296
|
+
;
|
|
1297
|
+
return {
|
|
1298
|
+
leaf: fromPublicDataLeafValue(o.leaf),
|
|
1299
|
+
nextIndex: toWireU64(o.nextIndex, "o.nextIndex"),
|
|
1300
|
+
nextKey: assertBin32(o.nextKey, "o.nextKey"),
|
|
1301
|
+
};
|
|
1302
|
+
}
|
|
1303
|
+
export function fromIndexedNullifierLeafValue(o) {
|
|
1304
|
+
if (o.leaf === undefined) {
|
|
1305
|
+
throw new Error("Expected leaf in IndexedNullifierLeafValue serialization");
|
|
1306
|
+
}
|
|
1307
|
+
if (o.nextIndex === undefined) {
|
|
1308
|
+
throw new Error("Expected nextIndex in IndexedNullifierLeafValue serialization");
|
|
1309
|
+
}
|
|
1310
|
+
if (o.nextKey === undefined) {
|
|
1311
|
+
throw new Error("Expected nextKey in IndexedNullifierLeafValue serialization");
|
|
1312
|
+
}
|
|
1313
|
+
;
|
|
1314
|
+
return {
|
|
1315
|
+
leaf: fromNullifierLeafValue(o.leaf),
|
|
1316
|
+
nextIndex: toWireU64(o.nextIndex, "o.nextIndex"),
|
|
1317
|
+
nextKey: assertBin32(o.nextKey, "o.nextKey"),
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
export function fromSiblingPathAndIndex(o) {
|
|
1321
|
+
if (o.index === undefined) {
|
|
1322
|
+
throw new Error("Expected index in SiblingPathAndIndex serialization");
|
|
1323
|
+
}
|
|
1324
|
+
if (o.path === undefined) {
|
|
1325
|
+
throw new Error("Expected path in SiblingPathAndIndex serialization");
|
|
1326
|
+
}
|
|
1327
|
+
;
|
|
1328
|
+
return {
|
|
1329
|
+
index: toWireU64(o.index, "o.index"),
|
|
1330
|
+
path: o.path.map((v) => assertBin32(v, "v")),
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1333
|
+
export function fromPublicDataLeafUpdateWitnessData(o) {
|
|
1334
|
+
if (o.leaf === undefined) {
|
|
1335
|
+
throw new Error("Expected leaf in PublicDataLeafUpdateWitnessData serialization");
|
|
1336
|
+
}
|
|
1337
|
+
if (o.index === undefined) {
|
|
1338
|
+
throw new Error("Expected index in PublicDataLeafUpdateWitnessData serialization");
|
|
1339
|
+
}
|
|
1340
|
+
if (o.path === undefined) {
|
|
1341
|
+
throw new Error("Expected path in PublicDataLeafUpdateWitnessData serialization");
|
|
1342
|
+
}
|
|
1343
|
+
;
|
|
1344
|
+
return {
|
|
1345
|
+
leaf: fromIndexedPublicDataLeafValue(o.leaf),
|
|
1346
|
+
index: toWireU64(o.index, "o.index"),
|
|
1347
|
+
path: o.path.map((v) => assertBin32(v, "v")),
|
|
1348
|
+
};
|
|
1349
|
+
}
|
|
1350
|
+
export function fromSortedPublicDataLeaf(o) {
|
|
1351
|
+
if (o.leaf === undefined) {
|
|
1352
|
+
throw new Error("Expected leaf in SortedPublicDataLeaf serialization");
|
|
1353
|
+
}
|
|
1354
|
+
if (o.index === undefined) {
|
|
1355
|
+
throw new Error("Expected index in SortedPublicDataLeaf serialization");
|
|
1356
|
+
}
|
|
1357
|
+
;
|
|
1358
|
+
return {
|
|
1359
|
+
leaf: fromPublicDataLeafValue(o.leaf),
|
|
1360
|
+
index: toWireU64(o.index, "o.index"),
|
|
1361
|
+
};
|
|
1362
|
+
}
|
|
1363
|
+
export function fromBatchInsertionResultPublicData(o) {
|
|
1364
|
+
if (o.lowLeafWitnessData === undefined) {
|
|
1365
|
+
throw new Error("Expected lowLeafWitnessData in BatchInsertionResultPublicData serialization");
|
|
1366
|
+
}
|
|
1367
|
+
if (o.sortedLeaves === undefined) {
|
|
1368
|
+
throw new Error("Expected sortedLeaves in BatchInsertionResultPublicData serialization");
|
|
1369
|
+
}
|
|
1370
|
+
if (o.subtreePath === undefined) {
|
|
1371
|
+
throw new Error("Expected subtreePath in BatchInsertionResultPublicData serialization");
|
|
1372
|
+
}
|
|
1373
|
+
;
|
|
1374
|
+
return {
|
|
1375
|
+
lowLeafWitnessData: o.lowLeafWitnessData.map((v) => fromPublicDataLeafUpdateWitnessData(v)),
|
|
1376
|
+
sortedLeaves: o.sortedLeaves.map((v) => fromSortedPublicDataLeaf(v)),
|
|
1377
|
+
subtreePath: o.subtreePath.map((v) => assertBin32(v, "v")),
|
|
1378
|
+
};
|
|
1379
|
+
}
|
|
1380
|
+
export function fromNullifierLeafUpdateWitnessData(o) {
|
|
1381
|
+
if (o.leaf === undefined) {
|
|
1382
|
+
throw new Error("Expected leaf in NullifierLeafUpdateWitnessData serialization");
|
|
1383
|
+
}
|
|
1384
|
+
if (o.index === undefined) {
|
|
1385
|
+
throw new Error("Expected index in NullifierLeafUpdateWitnessData serialization");
|
|
1386
|
+
}
|
|
1387
|
+
if (o.path === undefined) {
|
|
1388
|
+
throw new Error("Expected path in NullifierLeafUpdateWitnessData serialization");
|
|
1389
|
+
}
|
|
1390
|
+
;
|
|
1391
|
+
return {
|
|
1392
|
+
leaf: fromIndexedNullifierLeafValue(o.leaf),
|
|
1393
|
+
index: toWireU64(o.index, "o.index"),
|
|
1394
|
+
path: o.path.map((v) => assertBin32(v, "v")),
|
|
1395
|
+
};
|
|
1396
|
+
}
|
|
1397
|
+
export function fromSortedNullifierLeaf(o) {
|
|
1398
|
+
if (o.leaf === undefined) {
|
|
1399
|
+
throw new Error("Expected leaf in SortedNullifierLeaf serialization");
|
|
1400
|
+
}
|
|
1401
|
+
if (o.index === undefined) {
|
|
1402
|
+
throw new Error("Expected index in SortedNullifierLeaf serialization");
|
|
1403
|
+
}
|
|
1404
|
+
;
|
|
1405
|
+
return {
|
|
1406
|
+
leaf: fromNullifierLeafValue(o.leaf),
|
|
1407
|
+
index: toWireU64(o.index, "o.index"),
|
|
1408
|
+
};
|
|
1409
|
+
}
|
|
1410
|
+
export function fromBatchInsertionResultNullifier(o) {
|
|
1411
|
+
if (o.lowLeafWitnessData === undefined) {
|
|
1412
|
+
throw new Error("Expected lowLeafWitnessData in BatchInsertionResultNullifier serialization");
|
|
1413
|
+
}
|
|
1414
|
+
if (o.sortedLeaves === undefined) {
|
|
1415
|
+
throw new Error("Expected sortedLeaves in BatchInsertionResultNullifier serialization");
|
|
1416
|
+
}
|
|
1417
|
+
if (o.subtreePath === undefined) {
|
|
1418
|
+
throw new Error("Expected subtreePath in BatchInsertionResultNullifier serialization");
|
|
1419
|
+
}
|
|
1420
|
+
;
|
|
1421
|
+
return {
|
|
1422
|
+
lowLeafWitnessData: o.lowLeafWitnessData.map((v) => fromNullifierLeafUpdateWitnessData(v)),
|
|
1423
|
+
sortedLeaves: o.sortedLeaves.map((v) => fromSortedNullifierLeaf(v)),
|
|
1424
|
+
subtreePath: o.subtreePath.map((v) => assertBin32(v, "v")),
|
|
1425
|
+
};
|
|
1426
|
+
}
|
|
1427
|
+
export function fromSequentialInsertionResultPublicData(o) {
|
|
1428
|
+
if (o.lowLeafWitnessData === undefined) {
|
|
1429
|
+
throw new Error("Expected lowLeafWitnessData in SequentialInsertionResultPublicData serialization");
|
|
1430
|
+
}
|
|
1431
|
+
if (o.insertionWitnessData === undefined) {
|
|
1432
|
+
throw new Error("Expected insertionWitnessData in SequentialInsertionResultPublicData serialization");
|
|
1433
|
+
}
|
|
1434
|
+
;
|
|
1435
|
+
return {
|
|
1436
|
+
lowLeafWitnessData: o.lowLeafWitnessData.map((v) => fromPublicDataLeafUpdateWitnessData(v)),
|
|
1437
|
+
insertionWitnessData: o.insertionWitnessData.map((v) => fromPublicDataLeafUpdateWitnessData(v)),
|
|
1438
|
+
};
|
|
1439
|
+
}
|
|
1440
|
+
export function fromSequentialInsertionResultNullifier(o) {
|
|
1441
|
+
if (o.lowLeafWitnessData === undefined) {
|
|
1442
|
+
throw new Error("Expected lowLeafWitnessData in SequentialInsertionResultNullifier serialization");
|
|
1443
|
+
}
|
|
1444
|
+
if (o.insertionWitnessData === undefined) {
|
|
1445
|
+
throw new Error("Expected insertionWitnessData in SequentialInsertionResultNullifier serialization");
|
|
1446
|
+
}
|
|
1447
|
+
;
|
|
1448
|
+
return {
|
|
1449
|
+
lowLeafWitnessData: o.lowLeafWitnessData.map((v) => fromNullifierLeafUpdateWitnessData(v)),
|
|
1450
|
+
insertionWitnessData: o.insertionWitnessData.map((v) => fromNullifierLeafUpdateWitnessData(v)),
|
|
1451
|
+
};
|
|
1452
|
+
}
|
|
1453
|
+
export function fromWorldStateStatusSummary(o) {
|
|
1454
|
+
if (o.unfinalizedBlockNumber === undefined) {
|
|
1455
|
+
throw new Error("Expected unfinalizedBlockNumber in WorldStateStatusSummary serialization");
|
|
1456
|
+
}
|
|
1457
|
+
if (o.finalizedBlockNumber === undefined) {
|
|
1458
|
+
throw new Error("Expected finalizedBlockNumber in WorldStateStatusSummary serialization");
|
|
1459
|
+
}
|
|
1460
|
+
if (o.oldestHistoricalBlock === undefined) {
|
|
1461
|
+
throw new Error("Expected oldestHistoricalBlock in WorldStateStatusSummary serialization");
|
|
1462
|
+
}
|
|
1463
|
+
if (o.treesAreSynched === undefined) {
|
|
1464
|
+
throw new Error("Expected treesAreSynched in WorldStateStatusSummary serialization");
|
|
1465
|
+
}
|
|
1466
|
+
;
|
|
1467
|
+
return {
|
|
1468
|
+
unfinalizedBlockNumber: toWireU64(o.unfinalizedBlockNumber, "o.unfinalizedBlockNumber"),
|
|
1469
|
+
finalizedBlockNumber: toWireU64(o.finalizedBlockNumber, "o.finalizedBlockNumber"),
|
|
1470
|
+
oldestHistoricalBlock: toWireU64(o.oldestHistoricalBlock, "o.oldestHistoricalBlock"),
|
|
1471
|
+
treesAreSynched: o.treesAreSynched,
|
|
1472
|
+
};
|
|
1473
|
+
}
|
|
1474
|
+
export function fromDBStats(o) {
|
|
1475
|
+
if (o.name === undefined) {
|
|
1476
|
+
throw new Error("Expected name in DBStats serialization");
|
|
1477
|
+
}
|
|
1478
|
+
if (o.numDataItems === undefined) {
|
|
1479
|
+
throw new Error("Expected numDataItems in DBStats serialization");
|
|
1480
|
+
}
|
|
1481
|
+
if (o.totalUsedSize === undefined) {
|
|
1482
|
+
throw new Error("Expected totalUsedSize in DBStats serialization");
|
|
1483
|
+
}
|
|
1484
|
+
;
|
|
1485
|
+
return {
|
|
1486
|
+
name: o.name,
|
|
1487
|
+
numDataItems: toWireU64(o.numDataItems, "o.numDataItems"),
|
|
1488
|
+
totalUsedSize: toWireU64(o.totalUsedSize, "o.totalUsedSize"),
|
|
1489
|
+
};
|
|
1490
|
+
}
|
|
1491
|
+
export function fromTreeDBStats(o) {
|
|
1492
|
+
if (o.mapSize === undefined) {
|
|
1493
|
+
throw new Error("Expected mapSize in TreeDBStats serialization");
|
|
1494
|
+
}
|
|
1495
|
+
if (o.physicalFileSize === undefined) {
|
|
1496
|
+
throw new Error("Expected physicalFileSize in TreeDBStats serialization");
|
|
1497
|
+
}
|
|
1498
|
+
if (o.blocksDBStats === undefined) {
|
|
1499
|
+
throw new Error("Expected blocksDBStats in TreeDBStats serialization");
|
|
1500
|
+
}
|
|
1501
|
+
if (o.nodesDBStats === undefined) {
|
|
1502
|
+
throw new Error("Expected nodesDBStats in TreeDBStats serialization");
|
|
1503
|
+
}
|
|
1504
|
+
if (o.leafPreimagesDBStats === undefined) {
|
|
1505
|
+
throw new Error("Expected leafPreimagesDBStats in TreeDBStats serialization");
|
|
1506
|
+
}
|
|
1507
|
+
if (o.leafIndicesDBStats === undefined) {
|
|
1508
|
+
throw new Error("Expected leafIndicesDBStats in TreeDBStats serialization");
|
|
1509
|
+
}
|
|
1510
|
+
if (o.blockIndicesDBStats === undefined) {
|
|
1511
|
+
throw new Error("Expected blockIndicesDBStats in TreeDBStats serialization");
|
|
1512
|
+
}
|
|
1513
|
+
;
|
|
1514
|
+
return {
|
|
1515
|
+
mapSize: toWireU64(o.mapSize, "o.mapSize"),
|
|
1516
|
+
physicalFileSize: toWireU64(o.physicalFileSize, "o.physicalFileSize"),
|
|
1517
|
+
blocksDBStats: fromDBStats(o.blocksDBStats),
|
|
1518
|
+
nodesDBStats: fromDBStats(o.nodesDBStats),
|
|
1519
|
+
leafPreimagesDBStats: fromDBStats(o.leafPreimagesDBStats),
|
|
1520
|
+
leafIndicesDBStats: fromDBStats(o.leafIndicesDBStats),
|
|
1521
|
+
blockIndicesDBStats: fromDBStats(o.blockIndicesDBStats),
|
|
1522
|
+
};
|
|
1523
|
+
}
|
|
1524
|
+
export function fromWorldStateDBStats(o) {
|
|
1525
|
+
if (o.noteHashTreeStats === undefined) {
|
|
1526
|
+
throw new Error("Expected noteHashTreeStats in WorldStateDBStats serialization");
|
|
1527
|
+
}
|
|
1528
|
+
if (o.messageTreeStats === undefined) {
|
|
1529
|
+
throw new Error("Expected messageTreeStats in WorldStateDBStats serialization");
|
|
1530
|
+
}
|
|
1531
|
+
if (o.archiveTreeStats === undefined) {
|
|
1532
|
+
throw new Error("Expected archiveTreeStats in WorldStateDBStats serialization");
|
|
1533
|
+
}
|
|
1534
|
+
if (o.publicDataTreeStats === undefined) {
|
|
1535
|
+
throw new Error("Expected publicDataTreeStats in WorldStateDBStats serialization");
|
|
1536
|
+
}
|
|
1537
|
+
if (o.nullifierTreeStats === undefined) {
|
|
1538
|
+
throw new Error("Expected nullifierTreeStats in WorldStateDBStats serialization");
|
|
1539
|
+
}
|
|
1540
|
+
;
|
|
1541
|
+
return {
|
|
1542
|
+
noteHashTreeStats: fromTreeDBStats(o.noteHashTreeStats),
|
|
1543
|
+
messageTreeStats: fromTreeDBStats(o.messageTreeStats),
|
|
1544
|
+
archiveTreeStats: fromTreeDBStats(o.archiveTreeStats),
|
|
1545
|
+
publicDataTreeStats: fromTreeDBStats(o.publicDataTreeStats),
|
|
1546
|
+
nullifierTreeStats: fromTreeDBStats(o.nullifierTreeStats),
|
|
1547
|
+
};
|
|
1548
|
+
}
|
|
1549
|
+
export function fromTreeMeta(o) {
|
|
1550
|
+
if (o.name === undefined) {
|
|
1551
|
+
throw new Error("Expected name in TreeMeta serialization");
|
|
1552
|
+
}
|
|
1553
|
+
if (o.depth === undefined) {
|
|
1554
|
+
throw new Error("Expected depth in TreeMeta serialization");
|
|
1555
|
+
}
|
|
1556
|
+
if (o.size === undefined) {
|
|
1557
|
+
throw new Error("Expected size in TreeMeta serialization");
|
|
1558
|
+
}
|
|
1559
|
+
if (o.committedSize === undefined) {
|
|
1560
|
+
throw new Error("Expected committedSize in TreeMeta serialization");
|
|
1561
|
+
}
|
|
1562
|
+
if (o.root === undefined) {
|
|
1563
|
+
throw new Error("Expected root in TreeMeta serialization");
|
|
1564
|
+
}
|
|
1565
|
+
if (o.initialSize === undefined) {
|
|
1566
|
+
throw new Error("Expected initialSize in TreeMeta serialization");
|
|
1567
|
+
}
|
|
1568
|
+
if (o.initialRoot === undefined) {
|
|
1569
|
+
throw new Error("Expected initialRoot in TreeMeta serialization");
|
|
1570
|
+
}
|
|
1571
|
+
if (o.oldestHistoricBlock === undefined) {
|
|
1572
|
+
throw new Error("Expected oldestHistoricBlock in TreeMeta serialization");
|
|
1573
|
+
}
|
|
1574
|
+
if (o.unfinalizedBlockHeight === undefined) {
|
|
1575
|
+
throw new Error("Expected unfinalizedBlockHeight in TreeMeta serialization");
|
|
1576
|
+
}
|
|
1577
|
+
if (o.finalizedBlockHeight === undefined) {
|
|
1578
|
+
throw new Error("Expected finalizedBlockHeight in TreeMeta serialization");
|
|
1579
|
+
}
|
|
1580
|
+
;
|
|
1581
|
+
return {
|
|
1582
|
+
name: o.name,
|
|
1583
|
+
depth: o.depth,
|
|
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"),
|
|
1589
|
+
oldestHistoricBlock: o.oldestHistoricBlock,
|
|
1590
|
+
unfinalizedBlockHeight: o.unfinalizedBlockHeight,
|
|
1591
|
+
finalizedBlockHeight: o.finalizedBlockHeight,
|
|
1592
|
+
};
|
|
1593
|
+
}
|
|
1594
|
+
export function fromWorldStateMeta(o) {
|
|
1595
|
+
if (o.noteHashTreeMeta === undefined) {
|
|
1596
|
+
throw new Error("Expected noteHashTreeMeta in WorldStateMeta serialization");
|
|
1597
|
+
}
|
|
1598
|
+
if (o.messageTreeMeta === undefined) {
|
|
1599
|
+
throw new Error("Expected messageTreeMeta in WorldStateMeta serialization");
|
|
1600
|
+
}
|
|
1601
|
+
if (o.archiveTreeMeta === undefined) {
|
|
1602
|
+
throw new Error("Expected archiveTreeMeta in WorldStateMeta serialization");
|
|
1603
|
+
}
|
|
1604
|
+
if (o.publicDataTreeMeta === undefined) {
|
|
1605
|
+
throw new Error("Expected publicDataTreeMeta in WorldStateMeta serialization");
|
|
1606
|
+
}
|
|
1607
|
+
if (o.nullifierTreeMeta === undefined) {
|
|
1608
|
+
throw new Error("Expected nullifierTreeMeta in WorldStateMeta serialization");
|
|
1609
|
+
}
|
|
1610
|
+
;
|
|
1611
|
+
return {
|
|
1612
|
+
noteHashTreeMeta: fromTreeMeta(o.noteHashTreeMeta),
|
|
1613
|
+
messageTreeMeta: fromTreeMeta(o.messageTreeMeta),
|
|
1614
|
+
archiveTreeMeta: fromTreeMeta(o.archiveTreeMeta),
|
|
1615
|
+
publicDataTreeMeta: fromTreeMeta(o.publicDataTreeMeta),
|
|
1616
|
+
nullifierTreeMeta: fromTreeMeta(o.nullifierTreeMeta),
|
|
1617
|
+
};
|
|
1618
|
+
}
|
|
1619
|
+
export function fromWorldStateStatusFull(o) {
|
|
1620
|
+
if (o.summary === undefined) {
|
|
1621
|
+
throw new Error("Expected summary in WorldStateStatusFull serialization");
|
|
1622
|
+
}
|
|
1623
|
+
if (o.dbStats === undefined) {
|
|
1624
|
+
throw new Error("Expected dbStats in WorldStateStatusFull serialization");
|
|
1625
|
+
}
|
|
1626
|
+
if (o.meta === undefined) {
|
|
1627
|
+
throw new Error("Expected meta in WorldStateStatusFull serialization");
|
|
1628
|
+
}
|
|
1629
|
+
;
|
|
1630
|
+
return {
|
|
1631
|
+
summary: fromWorldStateStatusSummary(o.summary),
|
|
1632
|
+
dbStats: fromWorldStateDBStats(o.dbStats),
|
|
1633
|
+
meta: fromWorldStateMeta(o.meta),
|
|
1634
|
+
};
|
|
1635
|
+
}
|
|
1636
|
+
export function fromWorldStateRevision(o) {
|
|
1637
|
+
if (o.forkId === undefined) {
|
|
1638
|
+
throw new Error("Expected forkId in WorldStateRevision serialization");
|
|
1639
|
+
}
|
|
1640
|
+
if (o.blockNumber === undefined) {
|
|
1641
|
+
throw new Error("Expected blockNumber in WorldStateRevision serialization");
|
|
1642
|
+
}
|
|
1643
|
+
if (o.includeUncommitted === undefined) {
|
|
1644
|
+
throw new Error("Expected includeUncommitted in WorldStateRevision serialization");
|
|
1645
|
+
}
|
|
1646
|
+
;
|
|
1647
|
+
return {
|
|
1648
|
+
forkId: toWireU64(o.forkId, "o.forkId"),
|
|
1649
|
+
blockNumber: o.blockNumber,
|
|
1650
|
+
includeUncommitted: o.includeUncommitted,
|
|
1651
|
+
};
|
|
1652
|
+
}
|
|
1653
|
+
export function fromWsdbGetTreeInfo(o) {
|
|
1654
|
+
if (o.treeId === undefined) {
|
|
1655
|
+
throw new Error("Expected treeId in WsdbGetTreeInfo serialization");
|
|
1656
|
+
}
|
|
1657
|
+
if (o.revision === undefined) {
|
|
1658
|
+
throw new Error("Expected revision in WsdbGetTreeInfo serialization");
|
|
1659
|
+
}
|
|
1660
|
+
;
|
|
1661
|
+
return {
|
|
1662
|
+
treeId: o.treeId,
|
|
1663
|
+
revision: fromWorldStateRevision(o.revision),
|
|
1664
|
+
};
|
|
1665
|
+
}
|
|
1666
|
+
export function fromWsdbGetStateReference(o) {
|
|
1667
|
+
if (o.revision === undefined) {
|
|
1668
|
+
throw new Error("Expected revision in WsdbGetStateReference serialization");
|
|
1669
|
+
}
|
|
1670
|
+
;
|
|
1671
|
+
return {
|
|
1672
|
+
revision: fromWorldStateRevision(o.revision),
|
|
1673
|
+
};
|
|
1674
|
+
}
|
|
1675
|
+
export function fromWsdbGetInitialStateReference(o) {
|
|
1676
|
+
return {};
|
|
1677
|
+
}
|
|
1678
|
+
export function fromWsdbGetLeafValue(o) {
|
|
1679
|
+
if (o.treeId === undefined) {
|
|
1680
|
+
throw new Error("Expected treeId in WsdbGetLeafValue serialization");
|
|
1681
|
+
}
|
|
1682
|
+
if (o.revision === undefined) {
|
|
1683
|
+
throw new Error("Expected revision in WsdbGetLeafValue serialization");
|
|
1684
|
+
}
|
|
1685
|
+
if (o.leafIndex === undefined) {
|
|
1686
|
+
throw new Error("Expected leafIndex in WsdbGetLeafValue serialization");
|
|
1687
|
+
}
|
|
1688
|
+
;
|
|
1689
|
+
return {
|
|
1690
|
+
treeId: o.treeId,
|
|
1691
|
+
revision: fromWorldStateRevision(o.revision),
|
|
1692
|
+
leafIndex: toWireU64(o.leafIndex, "o.leafIndex"),
|
|
1693
|
+
};
|
|
1694
|
+
}
|
|
1695
|
+
export function fromWsdbGetPublicDataLeafValue(o) {
|
|
1696
|
+
if (o.revision === undefined) {
|
|
1697
|
+
throw new Error("Expected revision in WsdbGetPublicDataLeafValue serialization");
|
|
1698
|
+
}
|
|
1699
|
+
if (o.leafIndex === undefined) {
|
|
1700
|
+
throw new Error("Expected leafIndex in WsdbGetPublicDataLeafValue serialization");
|
|
1701
|
+
}
|
|
1702
|
+
;
|
|
1703
|
+
return {
|
|
1704
|
+
revision: fromWorldStateRevision(o.revision),
|
|
1705
|
+
leafIndex: toWireU64(o.leafIndex, "o.leafIndex"),
|
|
1706
|
+
};
|
|
1707
|
+
}
|
|
1708
|
+
export function fromWsdbGetNullifierLeafValue(o) {
|
|
1709
|
+
if (o.revision === undefined) {
|
|
1710
|
+
throw new Error("Expected revision in WsdbGetNullifierLeafValue serialization");
|
|
1711
|
+
}
|
|
1712
|
+
if (o.leafIndex === undefined) {
|
|
1713
|
+
throw new Error("Expected leafIndex in WsdbGetNullifierLeafValue serialization");
|
|
1714
|
+
}
|
|
1715
|
+
;
|
|
1716
|
+
return {
|
|
1717
|
+
revision: fromWorldStateRevision(o.revision),
|
|
1718
|
+
leafIndex: toWireU64(o.leafIndex, "o.leafIndex"),
|
|
1719
|
+
};
|
|
1720
|
+
}
|
|
1721
|
+
export function fromWsdbGetPublicDataLeafPreimage(o) {
|
|
1722
|
+
if (o.revision === undefined) {
|
|
1723
|
+
throw new Error("Expected revision in WsdbGetPublicDataLeafPreimage serialization");
|
|
1724
|
+
}
|
|
1725
|
+
if (o.leafIndex === undefined) {
|
|
1726
|
+
throw new Error("Expected leafIndex in WsdbGetPublicDataLeafPreimage serialization");
|
|
1727
|
+
}
|
|
1728
|
+
;
|
|
1729
|
+
return {
|
|
1730
|
+
revision: fromWorldStateRevision(o.revision),
|
|
1731
|
+
leafIndex: toWireU64(o.leafIndex, "o.leafIndex"),
|
|
1732
|
+
};
|
|
1733
|
+
}
|
|
1734
|
+
export function fromWsdbGetNullifierLeafPreimage(o) {
|
|
1735
|
+
if (o.revision === undefined) {
|
|
1736
|
+
throw new Error("Expected revision in WsdbGetNullifierLeafPreimage serialization");
|
|
1737
|
+
}
|
|
1738
|
+
if (o.leafIndex === undefined) {
|
|
1739
|
+
throw new Error("Expected leafIndex in WsdbGetNullifierLeafPreimage serialization");
|
|
1740
|
+
}
|
|
1741
|
+
;
|
|
1742
|
+
return {
|
|
1743
|
+
revision: fromWorldStateRevision(o.revision),
|
|
1744
|
+
leafIndex: toWireU64(o.leafIndex, "o.leafIndex"),
|
|
1745
|
+
};
|
|
1746
|
+
}
|
|
1747
|
+
export function fromWsdbGetSiblingPath(o) {
|
|
1748
|
+
if (o.treeId === undefined) {
|
|
1749
|
+
throw new Error("Expected treeId in WsdbGetSiblingPath serialization");
|
|
1750
|
+
}
|
|
1751
|
+
if (o.revision === undefined) {
|
|
1752
|
+
throw new Error("Expected revision in WsdbGetSiblingPath serialization");
|
|
1753
|
+
}
|
|
1754
|
+
if (o.leafIndex === undefined) {
|
|
1755
|
+
throw new Error("Expected leafIndex in WsdbGetSiblingPath serialization");
|
|
1756
|
+
}
|
|
1757
|
+
;
|
|
1758
|
+
return {
|
|
1759
|
+
treeId: o.treeId,
|
|
1760
|
+
revision: fromWorldStateRevision(o.revision),
|
|
1761
|
+
leafIndex: toWireU64(o.leafIndex, "o.leafIndex"),
|
|
1762
|
+
};
|
|
1763
|
+
}
|
|
1764
|
+
export function fromWsdbGetBlockNumbersForLeafIndices(o) {
|
|
1765
|
+
if (o.treeId === undefined) {
|
|
1766
|
+
throw new Error("Expected treeId in WsdbGetBlockNumbersForLeafIndices serialization");
|
|
1767
|
+
}
|
|
1768
|
+
if (o.revision === undefined) {
|
|
1769
|
+
throw new Error("Expected revision in WsdbGetBlockNumbersForLeafIndices serialization");
|
|
1770
|
+
}
|
|
1771
|
+
if (o.leafIndices === undefined) {
|
|
1772
|
+
throw new Error("Expected leafIndices in WsdbGetBlockNumbersForLeafIndices serialization");
|
|
1773
|
+
}
|
|
1774
|
+
;
|
|
1775
|
+
return {
|
|
1776
|
+
treeId: o.treeId,
|
|
1777
|
+
revision: fromWorldStateRevision(o.revision),
|
|
1778
|
+
leafIndices: o.leafIndices.map((v) => toWireU64(v, "v")),
|
|
1779
|
+
};
|
|
1780
|
+
}
|
|
1781
|
+
export function fromWsdbFindLeafIndices(o) {
|
|
1782
|
+
if (o.treeId === undefined) {
|
|
1783
|
+
throw new Error("Expected treeId in WsdbFindLeafIndices serialization");
|
|
1784
|
+
}
|
|
1785
|
+
if (o.revision === undefined) {
|
|
1786
|
+
throw new Error("Expected revision in WsdbFindLeafIndices serialization");
|
|
1787
|
+
}
|
|
1788
|
+
if (o.leaves === undefined) {
|
|
1789
|
+
throw new Error("Expected leaves in WsdbFindLeafIndices serialization");
|
|
1790
|
+
}
|
|
1791
|
+
if (o.startIndex === undefined) {
|
|
1792
|
+
throw new Error("Expected startIndex in WsdbFindLeafIndices serialization");
|
|
1793
|
+
}
|
|
1794
|
+
;
|
|
1795
|
+
return {
|
|
1796
|
+
treeId: o.treeId,
|
|
1797
|
+
revision: fromWorldStateRevision(o.revision),
|
|
1798
|
+
leaves: o.leaves.map((v) => assertBin32(v, "v")),
|
|
1799
|
+
startIndex: toWireU64(o.startIndex, "o.startIndex"),
|
|
1800
|
+
};
|
|
1801
|
+
}
|
|
1802
|
+
export function fromWsdbFindPublicDataLeafIndices(o) {
|
|
1803
|
+
if (o.revision === undefined) {
|
|
1804
|
+
throw new Error("Expected revision in WsdbFindPublicDataLeafIndices serialization");
|
|
1805
|
+
}
|
|
1806
|
+
if (o.leaves === undefined) {
|
|
1807
|
+
throw new Error("Expected leaves in WsdbFindPublicDataLeafIndices serialization");
|
|
1808
|
+
}
|
|
1809
|
+
if (o.startIndex === undefined) {
|
|
1810
|
+
throw new Error("Expected startIndex in WsdbFindPublicDataLeafIndices serialization");
|
|
1811
|
+
}
|
|
1812
|
+
;
|
|
1813
|
+
return {
|
|
1814
|
+
revision: fromWorldStateRevision(o.revision),
|
|
1815
|
+
leaves: o.leaves.map((v) => fromPublicDataLeafValue(v)),
|
|
1816
|
+
startIndex: toWireU64(o.startIndex, "o.startIndex"),
|
|
1817
|
+
};
|
|
1818
|
+
}
|
|
1819
|
+
export function fromWsdbFindNullifierLeafIndices(o) {
|
|
1820
|
+
if (o.revision === undefined) {
|
|
1821
|
+
throw new Error("Expected revision in WsdbFindNullifierLeafIndices serialization");
|
|
1822
|
+
}
|
|
1823
|
+
if (o.leaves === undefined) {
|
|
1824
|
+
throw new Error("Expected leaves in WsdbFindNullifierLeafIndices serialization");
|
|
1825
|
+
}
|
|
1826
|
+
if (o.startIndex === undefined) {
|
|
1827
|
+
throw new Error("Expected startIndex in WsdbFindNullifierLeafIndices serialization");
|
|
1828
|
+
}
|
|
1829
|
+
;
|
|
1830
|
+
return {
|
|
1831
|
+
revision: fromWorldStateRevision(o.revision),
|
|
1832
|
+
leaves: o.leaves.map((v) => fromNullifierLeafValue(v)),
|
|
1833
|
+
startIndex: toWireU64(o.startIndex, "o.startIndex"),
|
|
1834
|
+
};
|
|
1835
|
+
}
|
|
1836
|
+
export function fromWsdbFindLowLeaf(o) {
|
|
1837
|
+
if (o.treeId === undefined) {
|
|
1838
|
+
throw new Error("Expected treeId in WsdbFindLowLeaf serialization");
|
|
1839
|
+
}
|
|
1840
|
+
if (o.revision === undefined) {
|
|
1841
|
+
throw new Error("Expected revision in WsdbFindLowLeaf serialization");
|
|
1842
|
+
}
|
|
1843
|
+
if (o.key === undefined) {
|
|
1844
|
+
throw new Error("Expected key in WsdbFindLowLeaf serialization");
|
|
1845
|
+
}
|
|
1846
|
+
;
|
|
1847
|
+
return {
|
|
1848
|
+
treeId: o.treeId,
|
|
1849
|
+
revision: fromWorldStateRevision(o.revision),
|
|
1850
|
+
key: assertBin32(o.key, "o.key"),
|
|
1851
|
+
};
|
|
1852
|
+
}
|
|
1853
|
+
export function fromWsdbFindSiblingPaths(o) {
|
|
1854
|
+
if (o.treeId === undefined) {
|
|
1855
|
+
throw new Error("Expected treeId in WsdbFindSiblingPaths serialization");
|
|
1856
|
+
}
|
|
1857
|
+
if (o.revision === undefined) {
|
|
1858
|
+
throw new Error("Expected revision in WsdbFindSiblingPaths serialization");
|
|
1859
|
+
}
|
|
1860
|
+
if (o.leaves === undefined) {
|
|
1861
|
+
throw new Error("Expected leaves in WsdbFindSiblingPaths serialization");
|
|
1862
|
+
}
|
|
1863
|
+
;
|
|
1864
|
+
return {
|
|
1865
|
+
treeId: o.treeId,
|
|
1866
|
+
revision: fromWorldStateRevision(o.revision),
|
|
1867
|
+
leaves: o.leaves.map((v) => assertBin32(v, "v")),
|
|
1868
|
+
};
|
|
1869
|
+
}
|
|
1870
|
+
export function fromWsdbFindPublicDataSiblingPaths(o) {
|
|
1871
|
+
if (o.revision === undefined) {
|
|
1872
|
+
throw new Error("Expected revision in WsdbFindPublicDataSiblingPaths serialization");
|
|
1873
|
+
}
|
|
1874
|
+
if (o.leaves === undefined) {
|
|
1875
|
+
throw new Error("Expected leaves in WsdbFindPublicDataSiblingPaths serialization");
|
|
1876
|
+
}
|
|
1877
|
+
;
|
|
1878
|
+
return {
|
|
1879
|
+
revision: fromWorldStateRevision(o.revision),
|
|
1880
|
+
leaves: o.leaves.map((v) => fromPublicDataLeafValue(v)),
|
|
1881
|
+
};
|
|
1882
|
+
}
|
|
1883
|
+
export function fromWsdbFindNullifierSiblingPaths(o) {
|
|
1884
|
+
if (o.revision === undefined) {
|
|
1885
|
+
throw new Error("Expected revision in WsdbFindNullifierSiblingPaths serialization");
|
|
1886
|
+
}
|
|
1887
|
+
if (o.leaves === undefined) {
|
|
1888
|
+
throw new Error("Expected leaves in WsdbFindNullifierSiblingPaths serialization");
|
|
1889
|
+
}
|
|
1890
|
+
;
|
|
1891
|
+
return {
|
|
1892
|
+
revision: fromWorldStateRevision(o.revision),
|
|
1893
|
+
leaves: o.leaves.map((v) => fromNullifierLeafValue(v)),
|
|
1894
|
+
};
|
|
1895
|
+
}
|
|
1896
|
+
export function fromWsdbAppendLeaves(o) {
|
|
1897
|
+
if (o.treeId === undefined) {
|
|
1898
|
+
throw new Error("Expected treeId in WsdbAppendLeaves serialization");
|
|
1899
|
+
}
|
|
1900
|
+
if (o.leaves === undefined) {
|
|
1901
|
+
throw new Error("Expected leaves in WsdbAppendLeaves serialization");
|
|
1902
|
+
}
|
|
1903
|
+
if (o.forkId === undefined) {
|
|
1904
|
+
throw new Error("Expected forkId in WsdbAppendLeaves serialization");
|
|
1905
|
+
}
|
|
1906
|
+
;
|
|
1907
|
+
return {
|
|
1908
|
+
treeId: o.treeId,
|
|
1909
|
+
leaves: o.leaves.map((v) => assertBin32(v, "v")),
|
|
1910
|
+
forkId: toWireU64(o.forkId, "o.forkId"),
|
|
1911
|
+
};
|
|
1912
|
+
}
|
|
1913
|
+
export function fromWsdbAppendPublicDataLeaves(o) {
|
|
1914
|
+
if (o.leaves === undefined) {
|
|
1915
|
+
throw new Error("Expected leaves in WsdbAppendPublicDataLeaves serialization");
|
|
1916
|
+
}
|
|
1917
|
+
if (o.forkId === undefined) {
|
|
1918
|
+
throw new Error("Expected forkId in WsdbAppendPublicDataLeaves serialization");
|
|
1919
|
+
}
|
|
1920
|
+
;
|
|
1921
|
+
return {
|
|
1922
|
+
leaves: o.leaves.map((v) => fromPublicDataLeafValue(v)),
|
|
1923
|
+
forkId: toWireU64(o.forkId, "o.forkId"),
|
|
1924
|
+
};
|
|
1925
|
+
}
|
|
1926
|
+
export function fromWsdbAppendNullifierLeaves(o) {
|
|
1927
|
+
if (o.leaves === undefined) {
|
|
1928
|
+
throw new Error("Expected leaves in WsdbAppendNullifierLeaves serialization");
|
|
1929
|
+
}
|
|
1930
|
+
if (o.forkId === undefined) {
|
|
1931
|
+
throw new Error("Expected forkId in WsdbAppendNullifierLeaves serialization");
|
|
1932
|
+
}
|
|
1933
|
+
;
|
|
1934
|
+
return {
|
|
1935
|
+
leaves: o.leaves.map((v) => fromNullifierLeafValue(v)),
|
|
1936
|
+
forkId: toWireU64(o.forkId, "o.forkId"),
|
|
1937
|
+
};
|
|
1938
|
+
}
|
|
1939
|
+
export function fromWsdbBatchInsertPublicData(o) {
|
|
1940
|
+
if (o.leaves === undefined) {
|
|
1941
|
+
throw new Error("Expected leaves in WsdbBatchInsertPublicData serialization");
|
|
1942
|
+
}
|
|
1943
|
+
if (o.subtreeDepth === undefined) {
|
|
1944
|
+
throw new Error("Expected subtreeDepth in WsdbBatchInsertPublicData serialization");
|
|
1945
|
+
}
|
|
1946
|
+
if (o.forkId === undefined) {
|
|
1947
|
+
throw new Error("Expected forkId in WsdbBatchInsertPublicData serialization");
|
|
1948
|
+
}
|
|
1949
|
+
;
|
|
1950
|
+
return {
|
|
1951
|
+
leaves: o.leaves.map((v) => fromPublicDataLeafValue(v)),
|
|
1952
|
+
subtreeDepth: o.subtreeDepth,
|
|
1953
|
+
forkId: toWireU64(o.forkId, "o.forkId"),
|
|
1954
|
+
};
|
|
1955
|
+
}
|
|
1956
|
+
export function fromWsdbBatchInsertNullifier(o) {
|
|
1957
|
+
if (o.leaves === undefined) {
|
|
1958
|
+
throw new Error("Expected leaves in WsdbBatchInsertNullifier serialization");
|
|
1959
|
+
}
|
|
1960
|
+
if (o.subtreeDepth === undefined) {
|
|
1961
|
+
throw new Error("Expected subtreeDepth in WsdbBatchInsertNullifier serialization");
|
|
1962
|
+
}
|
|
1963
|
+
if (o.forkId === undefined) {
|
|
1964
|
+
throw new Error("Expected forkId in WsdbBatchInsertNullifier serialization");
|
|
1965
|
+
}
|
|
1966
|
+
;
|
|
1967
|
+
return {
|
|
1968
|
+
leaves: o.leaves.map((v) => fromNullifierLeafValue(v)),
|
|
1969
|
+
subtreeDepth: o.subtreeDepth,
|
|
1970
|
+
forkId: toWireU64(o.forkId, "o.forkId"),
|
|
1971
|
+
};
|
|
1972
|
+
}
|
|
1973
|
+
export function fromWsdbSequentialInsertPublicData(o) {
|
|
1974
|
+
if (o.leaves === undefined) {
|
|
1975
|
+
throw new Error("Expected leaves in WsdbSequentialInsertPublicData serialization");
|
|
1976
|
+
}
|
|
1977
|
+
if (o.forkId === undefined) {
|
|
1978
|
+
throw new Error("Expected forkId in WsdbSequentialInsertPublicData serialization");
|
|
1979
|
+
}
|
|
1980
|
+
;
|
|
1981
|
+
return {
|
|
1982
|
+
leaves: o.leaves.map((v) => fromPublicDataLeafValue(v)),
|
|
1983
|
+
forkId: toWireU64(o.forkId, "o.forkId"),
|
|
1984
|
+
};
|
|
1985
|
+
}
|
|
1986
|
+
export function fromWsdbSequentialInsertNullifier(o) {
|
|
1987
|
+
if (o.leaves === undefined) {
|
|
1988
|
+
throw new Error("Expected leaves in WsdbSequentialInsertNullifier serialization");
|
|
1989
|
+
}
|
|
1990
|
+
if (o.forkId === undefined) {
|
|
1991
|
+
throw new Error("Expected forkId in WsdbSequentialInsertNullifier serialization");
|
|
1992
|
+
}
|
|
1993
|
+
;
|
|
1994
|
+
return {
|
|
1995
|
+
leaves: o.leaves.map((v) => fromNullifierLeafValue(v)),
|
|
1996
|
+
forkId: toWireU64(o.forkId, "o.forkId"),
|
|
1997
|
+
};
|
|
1998
|
+
}
|
|
1999
|
+
export function fromWsdbUpdateArchive(o) {
|
|
2000
|
+
if (o.blockStateRef === undefined) {
|
|
2001
|
+
throw new Error("Expected blockStateRef in WsdbUpdateArchive serialization");
|
|
2002
|
+
}
|
|
2003
|
+
if (o.blockHeaderHash === undefined) {
|
|
2004
|
+
throw new Error("Expected blockHeaderHash in WsdbUpdateArchive serialization");
|
|
2005
|
+
}
|
|
2006
|
+
if (o.forkId === undefined) {
|
|
2007
|
+
throw new Error("Expected forkId in WsdbUpdateArchive serialization");
|
|
2008
|
+
}
|
|
2009
|
+
;
|
|
2010
|
+
return {
|
|
2011
|
+
blockStateRef: o.blockStateRef.map((v) => fromTreeStateReference(v)),
|
|
2012
|
+
blockHeaderHash: assertBin32(o.blockHeaderHash, "o.blockHeaderHash"),
|
|
2013
|
+
forkId: toWireU64(o.forkId, "o.forkId"),
|
|
2014
|
+
};
|
|
2015
|
+
}
|
|
2016
|
+
export function fromWsdbCommit(o) {
|
|
2017
|
+
return {};
|
|
2018
|
+
}
|
|
2019
|
+
export function fromWsdbRollback(o) {
|
|
2020
|
+
return {};
|
|
2021
|
+
}
|
|
2022
|
+
export function fromWsdbSyncBlock(o) {
|
|
2023
|
+
if (o.blockNumber === undefined) {
|
|
2024
|
+
throw new Error("Expected blockNumber in WsdbSyncBlock serialization");
|
|
2025
|
+
}
|
|
2026
|
+
if (o.blockStateRef === undefined) {
|
|
2027
|
+
throw new Error("Expected blockStateRef in WsdbSyncBlock serialization");
|
|
2028
|
+
}
|
|
2029
|
+
if (o.blockHeaderHash === undefined) {
|
|
2030
|
+
throw new Error("Expected blockHeaderHash in WsdbSyncBlock serialization");
|
|
2031
|
+
}
|
|
2032
|
+
if (o.paddedNoteHashes === undefined) {
|
|
2033
|
+
throw new Error("Expected paddedNoteHashes in WsdbSyncBlock serialization");
|
|
2034
|
+
}
|
|
2035
|
+
if (o.paddedL1ToL2Messages === undefined) {
|
|
2036
|
+
throw new Error("Expected paddedL1ToL2Messages in WsdbSyncBlock serialization");
|
|
2037
|
+
}
|
|
2038
|
+
if (o.paddedNullifiers === undefined) {
|
|
2039
|
+
throw new Error("Expected paddedNullifiers in WsdbSyncBlock serialization");
|
|
2040
|
+
}
|
|
2041
|
+
if (o.publicDataWrites === undefined) {
|
|
2042
|
+
throw new Error("Expected publicDataWrites in WsdbSyncBlock serialization");
|
|
2043
|
+
}
|
|
2044
|
+
;
|
|
2045
|
+
return {
|
|
2046
|
+
blockNumber: o.blockNumber,
|
|
2047
|
+
blockStateRef: o.blockStateRef.map((v) => fromTreeStateReference(v)),
|
|
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")),
|
|
2051
|
+
paddedNullifiers: o.paddedNullifiers.map((v) => fromNullifierLeafValue(v)),
|
|
2052
|
+
publicDataWrites: o.publicDataWrites.map((v) => fromPublicDataLeafValue(v)),
|
|
2053
|
+
};
|
|
2054
|
+
}
|
|
2055
|
+
export function fromWsdbCreateFork(o) {
|
|
2056
|
+
if (o.latest === undefined) {
|
|
2057
|
+
throw new Error("Expected latest in WsdbCreateFork serialization");
|
|
2058
|
+
}
|
|
2059
|
+
if (o.blockNumber === undefined) {
|
|
2060
|
+
throw new Error("Expected blockNumber in WsdbCreateFork serialization");
|
|
2061
|
+
}
|
|
2062
|
+
;
|
|
2063
|
+
return {
|
|
2064
|
+
latest: o.latest,
|
|
2065
|
+
blockNumber: o.blockNumber,
|
|
2066
|
+
};
|
|
2067
|
+
}
|
|
2068
|
+
export function fromWsdbDeleteFork(o) {
|
|
2069
|
+
if (o.forkId === undefined) {
|
|
2070
|
+
throw new Error("Expected forkId in WsdbDeleteFork serialization");
|
|
2071
|
+
}
|
|
2072
|
+
;
|
|
2073
|
+
return {
|
|
2074
|
+
forkId: toWireU64(o.forkId, "o.forkId"),
|
|
2075
|
+
};
|
|
2076
|
+
}
|
|
2077
|
+
export function fromWsdbFinalizeBlocks(o) {
|
|
2078
|
+
if (o.toBlockNumber === undefined) {
|
|
2079
|
+
throw new Error("Expected toBlockNumber in WsdbFinalizeBlocks serialization");
|
|
2080
|
+
}
|
|
2081
|
+
;
|
|
2082
|
+
return {
|
|
2083
|
+
toBlockNumber: o.toBlockNumber,
|
|
2084
|
+
};
|
|
2085
|
+
}
|
|
2086
|
+
export function fromWsdbUnwindBlocks(o) {
|
|
2087
|
+
if (o.toBlockNumber === undefined) {
|
|
2088
|
+
throw new Error("Expected toBlockNumber in WsdbUnwindBlocks serialization");
|
|
2089
|
+
}
|
|
2090
|
+
;
|
|
2091
|
+
return {
|
|
2092
|
+
toBlockNumber: o.toBlockNumber,
|
|
2093
|
+
};
|
|
2094
|
+
}
|
|
2095
|
+
export function fromWsdbRemoveHistoricalBlocks(o) {
|
|
2096
|
+
if (o.toBlockNumber === undefined) {
|
|
2097
|
+
throw new Error("Expected toBlockNumber in WsdbRemoveHistoricalBlocks serialization");
|
|
2098
|
+
}
|
|
2099
|
+
;
|
|
2100
|
+
return {
|
|
2101
|
+
toBlockNumber: o.toBlockNumber,
|
|
2102
|
+
};
|
|
2103
|
+
}
|
|
2104
|
+
export function fromWsdbGetStatus(o) {
|
|
2105
|
+
return {};
|
|
2106
|
+
}
|
|
2107
|
+
export function fromWsdbCreateCheckpoint(o) {
|
|
2108
|
+
if (o.forkId === undefined) {
|
|
2109
|
+
throw new Error("Expected forkId in WsdbCreateCheckpoint serialization");
|
|
2110
|
+
}
|
|
2111
|
+
;
|
|
2112
|
+
return {
|
|
2113
|
+
forkId: toWireU64(o.forkId, "o.forkId"),
|
|
2114
|
+
};
|
|
2115
|
+
}
|
|
2116
|
+
export function fromWsdbCommitCheckpoint(o) {
|
|
2117
|
+
if (o.forkId === undefined) {
|
|
2118
|
+
throw new Error("Expected forkId in WsdbCommitCheckpoint serialization");
|
|
2119
|
+
}
|
|
2120
|
+
;
|
|
2121
|
+
return {
|
|
2122
|
+
forkId: toWireU64(o.forkId, "o.forkId"),
|
|
2123
|
+
};
|
|
2124
|
+
}
|
|
2125
|
+
export function fromWsdbRevertCheckpoint(o) {
|
|
2126
|
+
if (o.forkId === undefined) {
|
|
2127
|
+
throw new Error("Expected forkId in WsdbRevertCheckpoint serialization");
|
|
2128
|
+
}
|
|
2129
|
+
;
|
|
2130
|
+
return {
|
|
2131
|
+
forkId: toWireU64(o.forkId, "o.forkId"),
|
|
2132
|
+
};
|
|
2133
|
+
}
|
|
2134
|
+
export function fromWsdbCommitAllCheckpoints(o) {
|
|
2135
|
+
if (o.forkId === undefined) {
|
|
2136
|
+
throw new Error("Expected forkId in WsdbCommitAllCheckpoints serialization");
|
|
2137
|
+
}
|
|
2138
|
+
;
|
|
2139
|
+
return {
|
|
2140
|
+
forkId: toWireU64(o.forkId, "o.forkId"),
|
|
2141
|
+
};
|
|
2142
|
+
}
|
|
2143
|
+
export function fromWsdbRevertAllCheckpoints(o) {
|
|
2144
|
+
if (o.forkId === undefined) {
|
|
2145
|
+
throw new Error("Expected forkId in WsdbRevertAllCheckpoints serialization");
|
|
2146
|
+
}
|
|
2147
|
+
;
|
|
2148
|
+
return {
|
|
2149
|
+
forkId: toWireU64(o.forkId, "o.forkId"),
|
|
2150
|
+
};
|
|
2151
|
+
}
|
|
2152
|
+
export function fromWsdbCopyStores(o) {
|
|
2153
|
+
if (o.dstPath === undefined) {
|
|
2154
|
+
throw new Error("Expected dstPath in WsdbCopyStores serialization");
|
|
2155
|
+
}
|
|
2156
|
+
;
|
|
2157
|
+
return {
|
|
2158
|
+
dstPath: o.dstPath,
|
|
2159
|
+
compact: o.compact ?? null,
|
|
2160
|
+
};
|
|
2161
|
+
}
|
|
2162
|
+
export function fromWsdbGetTreeInfoResponse(o) {
|
|
2163
|
+
if (o.treeId === undefined) {
|
|
2164
|
+
throw new Error("Expected treeId in WsdbGetTreeInfoResponse serialization");
|
|
2165
|
+
}
|
|
2166
|
+
if (o.root === undefined) {
|
|
2167
|
+
throw new Error("Expected root in WsdbGetTreeInfoResponse serialization");
|
|
2168
|
+
}
|
|
2169
|
+
if (o.size === undefined) {
|
|
2170
|
+
throw new Error("Expected size in WsdbGetTreeInfoResponse serialization");
|
|
2171
|
+
}
|
|
2172
|
+
if (o.depth === undefined) {
|
|
2173
|
+
throw new Error("Expected depth in WsdbGetTreeInfoResponse serialization");
|
|
2174
|
+
}
|
|
2175
|
+
;
|
|
2176
|
+
return {
|
|
2177
|
+
treeId: o.treeId,
|
|
2178
|
+
root: assertBin32(o.root, "o.root"),
|
|
2179
|
+
size: toWireU64(o.size, "o.size"),
|
|
2180
|
+
depth: o.depth,
|
|
2181
|
+
};
|
|
2182
|
+
}
|
|
2183
|
+
export function fromWsdbGetStateReferenceResponse(o) {
|
|
2184
|
+
if (o.state === undefined) {
|
|
2185
|
+
throw new Error("Expected state in WsdbGetStateReferenceResponse serialization");
|
|
2186
|
+
}
|
|
2187
|
+
;
|
|
2188
|
+
return {
|
|
2189
|
+
state: o.state.map((v) => fromTreeStateReference(v)),
|
|
2190
|
+
};
|
|
2191
|
+
}
|
|
2192
|
+
export function fromWsdbGetInitialStateReferenceResponse(o) {
|
|
2193
|
+
if (o.state === undefined) {
|
|
2194
|
+
throw new Error("Expected state in WsdbGetInitialStateReferenceResponse serialization");
|
|
2195
|
+
}
|
|
2196
|
+
;
|
|
2197
|
+
return {
|
|
2198
|
+
state: o.state.map((v) => fromTreeStateReference(v)),
|
|
2199
|
+
};
|
|
2200
|
+
}
|
|
2201
|
+
export function fromWsdbGetLeafValueResponse(o) {
|
|
2202
|
+
;
|
|
2203
|
+
return {
|
|
2204
|
+
value: o.value != null ? assertBin32(o.value, "o.value") : null,
|
|
2205
|
+
};
|
|
2206
|
+
}
|
|
2207
|
+
export function fromWsdbGetPublicDataLeafValueResponse(o) {
|
|
2208
|
+
;
|
|
2209
|
+
return {
|
|
2210
|
+
value: o.value != null ? fromPublicDataLeafValue(o.value) : null,
|
|
2211
|
+
};
|
|
2212
|
+
}
|
|
2213
|
+
export function fromWsdbGetNullifierLeafValueResponse(o) {
|
|
2214
|
+
;
|
|
2215
|
+
return {
|
|
2216
|
+
value: o.value != null ? fromNullifierLeafValue(o.value) : null,
|
|
2217
|
+
};
|
|
2218
|
+
}
|
|
2219
|
+
export function fromWsdbGetPublicDataLeafPreimageResponse(o) {
|
|
2220
|
+
;
|
|
2221
|
+
return {
|
|
2222
|
+
preimage: o.preimage != null ? fromIndexedPublicDataLeafValue(o.preimage) : null,
|
|
2223
|
+
};
|
|
2224
|
+
}
|
|
2225
|
+
export function fromWsdbGetNullifierLeafPreimageResponse(o) {
|
|
2226
|
+
;
|
|
2227
|
+
return {
|
|
2228
|
+
preimage: o.preimage != null ? fromIndexedNullifierLeafValue(o.preimage) : null,
|
|
2229
|
+
};
|
|
2230
|
+
}
|
|
2231
|
+
export function fromWsdbGetSiblingPathResponse(o) {
|
|
2232
|
+
if (o.path === undefined) {
|
|
2233
|
+
throw new Error("Expected path in WsdbGetSiblingPathResponse serialization");
|
|
2234
|
+
}
|
|
2235
|
+
;
|
|
2236
|
+
return {
|
|
2237
|
+
path: o.path.map((v) => assertBin32(v, "v")),
|
|
2238
|
+
};
|
|
2239
|
+
}
|
|
2240
|
+
export function fromWsdbGetBlockNumbersForLeafIndicesResponse(o) {
|
|
2241
|
+
if (o.blockNumbers === undefined) {
|
|
2242
|
+
throw new Error("Expected blockNumbers in WsdbGetBlockNumbersForLeafIndicesResponse serialization");
|
|
2243
|
+
}
|
|
2244
|
+
;
|
|
2245
|
+
return {
|
|
2246
|
+
blockNumbers: o.blockNumbers.map((v) => v ?? null),
|
|
2247
|
+
};
|
|
2248
|
+
}
|
|
2249
|
+
export function fromWsdbFindLeafIndicesResponse(o) {
|
|
2250
|
+
if (o.indices === undefined) {
|
|
2251
|
+
throw new Error("Expected indices in WsdbFindLeafIndicesResponse serialization");
|
|
2252
|
+
}
|
|
2253
|
+
;
|
|
2254
|
+
return {
|
|
2255
|
+
indices: o.indices.map((v) => v != null ? toWireU64(v, "v") : null),
|
|
2256
|
+
};
|
|
2257
|
+
}
|
|
2258
|
+
export function fromWsdbFindPublicDataLeafIndicesResponse(o) {
|
|
2259
|
+
if (o.indices === undefined) {
|
|
2260
|
+
throw new Error("Expected indices in WsdbFindPublicDataLeafIndicesResponse serialization");
|
|
2261
|
+
}
|
|
2262
|
+
;
|
|
2263
|
+
return {
|
|
2264
|
+
indices: o.indices.map((v) => v != null ? toWireU64(v, "v") : null),
|
|
2265
|
+
};
|
|
2266
|
+
}
|
|
2267
|
+
export function fromWsdbFindNullifierLeafIndicesResponse(o) {
|
|
2268
|
+
if (o.indices === undefined) {
|
|
2269
|
+
throw new Error("Expected indices in WsdbFindNullifierLeafIndicesResponse serialization");
|
|
2270
|
+
}
|
|
2271
|
+
;
|
|
2272
|
+
return {
|
|
2273
|
+
indices: o.indices.map((v) => v != null ? toWireU64(v, "v") : null),
|
|
2274
|
+
};
|
|
2275
|
+
}
|
|
2276
|
+
export function fromWsdbFindLowLeafResponse(o) {
|
|
2277
|
+
if (o.alreadyPresent === undefined) {
|
|
2278
|
+
throw new Error("Expected alreadyPresent in WsdbFindLowLeafResponse serialization");
|
|
2279
|
+
}
|
|
2280
|
+
if (o.index === undefined) {
|
|
2281
|
+
throw new Error("Expected index in WsdbFindLowLeafResponse serialization");
|
|
2282
|
+
}
|
|
2283
|
+
;
|
|
2284
|
+
return {
|
|
2285
|
+
alreadyPresent: o.alreadyPresent,
|
|
2286
|
+
index: toWireU64(o.index, "o.index"),
|
|
2287
|
+
};
|
|
2288
|
+
}
|
|
2289
|
+
export function fromWsdbFindSiblingPathsResponse(o) {
|
|
2290
|
+
if (o.paths === undefined) {
|
|
2291
|
+
throw new Error("Expected paths in WsdbFindSiblingPathsResponse serialization");
|
|
2292
|
+
}
|
|
2293
|
+
;
|
|
2294
|
+
return {
|
|
2295
|
+
paths: o.paths.map((v) => v != null ? fromSiblingPathAndIndex(v) : null),
|
|
2296
|
+
};
|
|
2297
|
+
}
|
|
2298
|
+
export function fromWsdbFindPublicDataSiblingPathsResponse(o) {
|
|
2299
|
+
if (o.paths === undefined) {
|
|
2300
|
+
throw new Error("Expected paths in WsdbFindPublicDataSiblingPathsResponse serialization");
|
|
2301
|
+
}
|
|
2302
|
+
;
|
|
2303
|
+
return {
|
|
2304
|
+
paths: o.paths.map((v) => v != null ? fromSiblingPathAndIndex(v) : null),
|
|
2305
|
+
};
|
|
2306
|
+
}
|
|
2307
|
+
export function fromWsdbFindNullifierSiblingPathsResponse(o) {
|
|
2308
|
+
if (o.paths === undefined) {
|
|
2309
|
+
throw new Error("Expected paths in WsdbFindNullifierSiblingPathsResponse serialization");
|
|
2310
|
+
}
|
|
2311
|
+
;
|
|
2312
|
+
return {
|
|
2313
|
+
paths: o.paths.map((v) => v != null ? fromSiblingPathAndIndex(v) : null),
|
|
2314
|
+
};
|
|
2315
|
+
}
|
|
2316
|
+
export function fromWsdbAppendLeavesResponse(o) {
|
|
2317
|
+
return {};
|
|
2318
|
+
}
|
|
2319
|
+
export function fromWsdbAppendPublicDataLeavesResponse(o) {
|
|
2320
|
+
return {};
|
|
2321
|
+
}
|
|
2322
|
+
export function fromWsdbAppendNullifierLeavesResponse(o) {
|
|
2323
|
+
return {};
|
|
2324
|
+
}
|
|
2325
|
+
export function fromWsdbBatchInsertPublicDataResponse(o) {
|
|
2326
|
+
if (o.result === undefined) {
|
|
2327
|
+
throw new Error("Expected result in WsdbBatchInsertPublicDataResponse serialization");
|
|
2328
|
+
}
|
|
2329
|
+
;
|
|
2330
|
+
return {
|
|
2331
|
+
result: fromBatchInsertionResultPublicData(o.result),
|
|
2332
|
+
};
|
|
2333
|
+
}
|
|
2334
|
+
export function fromWsdbBatchInsertNullifierResponse(o) {
|
|
2335
|
+
if (o.result === undefined) {
|
|
2336
|
+
throw new Error("Expected result in WsdbBatchInsertNullifierResponse serialization");
|
|
2337
|
+
}
|
|
2338
|
+
;
|
|
2339
|
+
return {
|
|
2340
|
+
result: fromBatchInsertionResultNullifier(o.result),
|
|
2341
|
+
};
|
|
2342
|
+
}
|
|
2343
|
+
export function fromWsdbSequentialInsertPublicDataResponse(o) {
|
|
2344
|
+
if (o.result === undefined) {
|
|
2345
|
+
throw new Error("Expected result in WsdbSequentialInsertPublicDataResponse serialization");
|
|
2346
|
+
}
|
|
2347
|
+
;
|
|
2348
|
+
return {
|
|
2349
|
+
result: fromSequentialInsertionResultPublicData(o.result),
|
|
2350
|
+
};
|
|
2351
|
+
}
|
|
2352
|
+
export function fromWsdbSequentialInsertNullifierResponse(o) {
|
|
2353
|
+
if (o.result === undefined) {
|
|
2354
|
+
throw new Error("Expected result in WsdbSequentialInsertNullifierResponse serialization");
|
|
2355
|
+
}
|
|
2356
|
+
;
|
|
2357
|
+
return {
|
|
2358
|
+
result: fromSequentialInsertionResultNullifier(o.result),
|
|
2359
|
+
};
|
|
2360
|
+
}
|
|
2361
|
+
export function fromWsdbUpdateArchiveResponse(o) {
|
|
2362
|
+
return {};
|
|
2363
|
+
}
|
|
2364
|
+
export function fromWsdbCommitResponse(o) {
|
|
2365
|
+
if (o.status === undefined) {
|
|
2366
|
+
throw new Error("Expected status in WsdbCommitResponse serialization");
|
|
2367
|
+
}
|
|
2368
|
+
;
|
|
2369
|
+
return {
|
|
2370
|
+
status: fromWorldStateStatusFull(o.status),
|
|
2371
|
+
};
|
|
2372
|
+
}
|
|
2373
|
+
export function fromWsdbRollbackResponse(o) {
|
|
2374
|
+
return {};
|
|
2375
|
+
}
|
|
2376
|
+
export function fromWsdbSyncBlockResponse(o) {
|
|
2377
|
+
if (o.status === undefined) {
|
|
2378
|
+
throw new Error("Expected status in WsdbSyncBlockResponse serialization");
|
|
2379
|
+
}
|
|
2380
|
+
;
|
|
2381
|
+
return {
|
|
2382
|
+
status: fromWorldStateStatusFull(o.status),
|
|
2383
|
+
};
|
|
2384
|
+
}
|
|
2385
|
+
export function fromWsdbCreateForkResponse(o) {
|
|
2386
|
+
if (o.forkId === undefined) {
|
|
2387
|
+
throw new Error("Expected forkId in WsdbCreateForkResponse serialization");
|
|
2388
|
+
}
|
|
2389
|
+
;
|
|
2390
|
+
return {
|
|
2391
|
+
forkId: toWireU64(o.forkId, "o.forkId"),
|
|
2392
|
+
};
|
|
2393
|
+
}
|
|
2394
|
+
export function fromWsdbDeleteForkResponse(o) {
|
|
2395
|
+
return {};
|
|
2396
|
+
}
|
|
2397
|
+
export function fromWsdbFinalizeBlocksResponse(o) {
|
|
2398
|
+
if (o.status === undefined) {
|
|
2399
|
+
throw new Error("Expected status in WsdbFinalizeBlocksResponse serialization");
|
|
2400
|
+
}
|
|
2401
|
+
;
|
|
2402
|
+
return {
|
|
2403
|
+
status: fromWorldStateStatusSummary(o.status),
|
|
2404
|
+
};
|
|
2405
|
+
}
|
|
2406
|
+
export function fromWsdbUnwindBlocksResponse(o) {
|
|
2407
|
+
if (o.status === undefined) {
|
|
2408
|
+
throw new Error("Expected status in WsdbUnwindBlocksResponse serialization");
|
|
2409
|
+
}
|
|
2410
|
+
;
|
|
2411
|
+
return {
|
|
2412
|
+
status: fromWorldStateStatusFull(o.status),
|
|
2413
|
+
};
|
|
2414
|
+
}
|
|
2415
|
+
export function fromWsdbRemoveHistoricalBlocksResponse(o) {
|
|
2416
|
+
if (o.status === undefined) {
|
|
2417
|
+
throw new Error("Expected status in WsdbRemoveHistoricalBlocksResponse serialization");
|
|
2418
|
+
}
|
|
2419
|
+
;
|
|
2420
|
+
return {
|
|
2421
|
+
status: fromWorldStateStatusFull(o.status),
|
|
2422
|
+
};
|
|
2423
|
+
}
|
|
2424
|
+
export function fromWsdbGetStatusResponse(o) {
|
|
2425
|
+
if (o.status === undefined) {
|
|
2426
|
+
throw new Error("Expected status in WsdbGetStatusResponse serialization");
|
|
2427
|
+
}
|
|
2428
|
+
;
|
|
2429
|
+
return {
|
|
2430
|
+
status: fromWorldStateStatusSummary(o.status),
|
|
2431
|
+
};
|
|
2432
|
+
}
|
|
2433
|
+
export function fromWsdbCreateCheckpointResponse(o) {
|
|
2434
|
+
return {};
|
|
2435
|
+
}
|
|
2436
|
+
export function fromWsdbCommitCheckpointResponse(o) {
|
|
2437
|
+
return {};
|
|
2438
|
+
}
|
|
2439
|
+
export function fromWsdbRevertCheckpointResponse(o) {
|
|
2440
|
+
return {};
|
|
2441
|
+
}
|
|
2442
|
+
export function fromWsdbCommitAllCheckpointsResponse(o) {
|
|
2443
|
+
return {};
|
|
2444
|
+
}
|
|
2445
|
+
export function fromWsdbRevertAllCheckpointsResponse(o) {
|
|
2446
|
+
return {};
|
|
2447
|
+
}
|
|
2448
|
+
export function fromWsdbCopyStoresResponse(o) {
|
|
2449
|
+
return {};
|
|
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
|
+
}
|