@freedomofpress/ics23 0.1.0
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 +3 -0
- package/dist/.gitkeep +0 -0
- package/dist/compress.d.ts +3 -0
- package/dist/compress.js +96 -0
- package/dist/compress.js.map +1 -0
- package/dist/ics23.d.ts +18 -0
- package/dist/ics23.js +118 -0
- package/dist/ics23.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/ops.d.ts +4 -0
- package/dist/ops.js +111 -0
- package/dist/ops.js.map +1 -0
- package/dist/proofs.d.ts +11 -0
- package/dist/proofs.js +235 -0
- package/dist/proofs.js.map +1 -0
- package/dist/proto/cosmos/ics23/v1/proofs.d.ts +264 -0
- package/dist/proto/cosmos/ics23/v1/proofs.js +1411 -0
- package/dist/proto/cosmos/ics23/v1/proofs.js.map +1 -0
- package/dist/specs.d.ts +7 -0
- package/dist/specs.js +105 -0
- package/dist/specs.js.map +1 -0
- package/dist/tests/ops.test.d.ts +1 -0
- package/dist/tests/ops.test.js +143 -0
- package/dist/tests/ops.test.js.map +1 -0
- package/dist/tests/proofs.test.d.ts +1 -0
- package/dist/tests/proofs.test.js +194 -0
- package/dist/tests/proofs.test.js.map +1 -0
- package/dist/tests/testhelpers.d.ts +3 -0
- package/dist/tests/testhelpers.js +35 -0
- package/dist/tests/testhelpers.js.map +1 -0
- package/dist/tests/testvectors.test.d.ts +1 -0
- package/dist/tests/testvectors.test.js +229 -0
- package/dist/tests/testvectors.test.js.map +1 -0
- package/dist/tests/webcat.test.d.ts +1 -0
- package/dist/tests/webcat.test.js +45 -0
- package/dist/tests/webcat.test.js.map +1 -0
- package/dist/webcat.d.ts +15 -0
- package/dist/webcat.js +77 -0
- package/dist/webcat.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,1411 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.6.1
|
|
4
|
+
// protoc unknown
|
|
5
|
+
// source: cosmos/ics23/v1/proofs.proto
|
|
6
|
+
/* eslint-disable */
|
|
7
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
8
|
+
export const protobufPackage = "cosmos.ics23.v1";
|
|
9
|
+
export var HashOp;
|
|
10
|
+
(function (HashOp) {
|
|
11
|
+
/** NO_HASH - NO_HASH is the default if no data passed. Note this is an illegal argument some places. */
|
|
12
|
+
HashOp[HashOp["NO_HASH"] = 0] = "NO_HASH";
|
|
13
|
+
HashOp[HashOp["SHA256"] = 1] = "SHA256";
|
|
14
|
+
HashOp[HashOp["SHA512"] = 2] = "SHA512";
|
|
15
|
+
HashOp[HashOp["KECCAK256"] = 3] = "KECCAK256";
|
|
16
|
+
HashOp[HashOp["RIPEMD160"] = 4] = "RIPEMD160";
|
|
17
|
+
/** BITCOIN - ripemd160(sha256(x)) */
|
|
18
|
+
HashOp[HashOp["BITCOIN"] = 5] = "BITCOIN";
|
|
19
|
+
HashOp[HashOp["SHA512_256"] = 6] = "SHA512_256";
|
|
20
|
+
HashOp[HashOp["BLAKE2B_512"] = 7] = "BLAKE2B_512";
|
|
21
|
+
HashOp[HashOp["BLAKE2S_256"] = 8] = "BLAKE2S_256";
|
|
22
|
+
HashOp[HashOp["BLAKE3"] = 9] = "BLAKE3";
|
|
23
|
+
HashOp[HashOp["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
24
|
+
})(HashOp || (HashOp = {}));
|
|
25
|
+
export function hashOpFromJSON(object) {
|
|
26
|
+
switch (object) {
|
|
27
|
+
case 0:
|
|
28
|
+
case "NO_HASH":
|
|
29
|
+
return HashOp.NO_HASH;
|
|
30
|
+
case 1:
|
|
31
|
+
case "SHA256":
|
|
32
|
+
return HashOp.SHA256;
|
|
33
|
+
case 2:
|
|
34
|
+
case "SHA512":
|
|
35
|
+
return HashOp.SHA512;
|
|
36
|
+
case 3:
|
|
37
|
+
case "KECCAK256":
|
|
38
|
+
return HashOp.KECCAK256;
|
|
39
|
+
case 4:
|
|
40
|
+
case "RIPEMD160":
|
|
41
|
+
return HashOp.RIPEMD160;
|
|
42
|
+
case 5:
|
|
43
|
+
case "BITCOIN":
|
|
44
|
+
return HashOp.BITCOIN;
|
|
45
|
+
case 6:
|
|
46
|
+
case "SHA512_256":
|
|
47
|
+
return HashOp.SHA512_256;
|
|
48
|
+
case 7:
|
|
49
|
+
case "BLAKE2B_512":
|
|
50
|
+
return HashOp.BLAKE2B_512;
|
|
51
|
+
case 8:
|
|
52
|
+
case "BLAKE2S_256":
|
|
53
|
+
return HashOp.BLAKE2S_256;
|
|
54
|
+
case 9:
|
|
55
|
+
case "BLAKE3":
|
|
56
|
+
return HashOp.BLAKE3;
|
|
57
|
+
case -1:
|
|
58
|
+
case "UNRECOGNIZED":
|
|
59
|
+
default:
|
|
60
|
+
return HashOp.UNRECOGNIZED;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export function hashOpToJSON(object) {
|
|
64
|
+
switch (object) {
|
|
65
|
+
case HashOp.NO_HASH:
|
|
66
|
+
return "NO_HASH";
|
|
67
|
+
case HashOp.SHA256:
|
|
68
|
+
return "SHA256";
|
|
69
|
+
case HashOp.SHA512:
|
|
70
|
+
return "SHA512";
|
|
71
|
+
case HashOp.KECCAK256:
|
|
72
|
+
return "KECCAK256";
|
|
73
|
+
case HashOp.RIPEMD160:
|
|
74
|
+
return "RIPEMD160";
|
|
75
|
+
case HashOp.BITCOIN:
|
|
76
|
+
return "BITCOIN";
|
|
77
|
+
case HashOp.SHA512_256:
|
|
78
|
+
return "SHA512_256";
|
|
79
|
+
case HashOp.BLAKE2B_512:
|
|
80
|
+
return "BLAKE2B_512";
|
|
81
|
+
case HashOp.BLAKE2S_256:
|
|
82
|
+
return "BLAKE2S_256";
|
|
83
|
+
case HashOp.BLAKE3:
|
|
84
|
+
return "BLAKE3";
|
|
85
|
+
case HashOp.UNRECOGNIZED:
|
|
86
|
+
default:
|
|
87
|
+
return "UNRECOGNIZED";
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* LengthOp defines how to process the key and value of the LeafOp
|
|
92
|
+
* to include length information. After encoding the length with the given
|
|
93
|
+
* algorithm, the length will be prepended to the key and value bytes.
|
|
94
|
+
* (Each one with it's own encoded length)
|
|
95
|
+
*/
|
|
96
|
+
export var LengthOp;
|
|
97
|
+
(function (LengthOp) {
|
|
98
|
+
/** NO_PREFIX - NO_PREFIX don't include any length info */
|
|
99
|
+
LengthOp[LengthOp["NO_PREFIX"] = 0] = "NO_PREFIX";
|
|
100
|
+
/** VAR_PROTO - VAR_PROTO uses protobuf (and go-amino) varint encoding of the length */
|
|
101
|
+
LengthOp[LengthOp["VAR_PROTO"] = 1] = "VAR_PROTO";
|
|
102
|
+
/** VAR_RLP - VAR_RLP uses rlp int encoding of the length */
|
|
103
|
+
LengthOp[LengthOp["VAR_RLP"] = 2] = "VAR_RLP";
|
|
104
|
+
/** FIXED32_BIG - FIXED32_BIG uses big-endian encoding of the length as a 32 bit integer */
|
|
105
|
+
LengthOp[LengthOp["FIXED32_BIG"] = 3] = "FIXED32_BIG";
|
|
106
|
+
/** FIXED32_LITTLE - FIXED32_LITTLE uses little-endian encoding of the length as a 32 bit integer */
|
|
107
|
+
LengthOp[LengthOp["FIXED32_LITTLE"] = 4] = "FIXED32_LITTLE";
|
|
108
|
+
/** FIXED64_BIG - FIXED64_BIG uses big-endian encoding of the length as a 64 bit integer */
|
|
109
|
+
LengthOp[LengthOp["FIXED64_BIG"] = 5] = "FIXED64_BIG";
|
|
110
|
+
/** FIXED64_LITTLE - FIXED64_LITTLE uses little-endian encoding of the length as a 64 bit integer */
|
|
111
|
+
LengthOp[LengthOp["FIXED64_LITTLE"] = 6] = "FIXED64_LITTLE";
|
|
112
|
+
/** REQUIRE_32_BYTES - REQUIRE_32_BYTES is like NONE, but will fail if the input is not exactly 32 bytes (sha256 output) */
|
|
113
|
+
LengthOp[LengthOp["REQUIRE_32_BYTES"] = 7] = "REQUIRE_32_BYTES";
|
|
114
|
+
/** REQUIRE_64_BYTES - REQUIRE_64_BYTES is like NONE, but will fail if the input is not exactly 64 bytes (sha512 output) */
|
|
115
|
+
LengthOp[LengthOp["REQUIRE_64_BYTES"] = 8] = "REQUIRE_64_BYTES";
|
|
116
|
+
LengthOp[LengthOp["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
117
|
+
})(LengthOp || (LengthOp = {}));
|
|
118
|
+
export function lengthOpFromJSON(object) {
|
|
119
|
+
switch (object) {
|
|
120
|
+
case 0:
|
|
121
|
+
case "NO_PREFIX":
|
|
122
|
+
return LengthOp.NO_PREFIX;
|
|
123
|
+
case 1:
|
|
124
|
+
case "VAR_PROTO":
|
|
125
|
+
return LengthOp.VAR_PROTO;
|
|
126
|
+
case 2:
|
|
127
|
+
case "VAR_RLP":
|
|
128
|
+
return LengthOp.VAR_RLP;
|
|
129
|
+
case 3:
|
|
130
|
+
case "FIXED32_BIG":
|
|
131
|
+
return LengthOp.FIXED32_BIG;
|
|
132
|
+
case 4:
|
|
133
|
+
case "FIXED32_LITTLE":
|
|
134
|
+
return LengthOp.FIXED32_LITTLE;
|
|
135
|
+
case 5:
|
|
136
|
+
case "FIXED64_BIG":
|
|
137
|
+
return LengthOp.FIXED64_BIG;
|
|
138
|
+
case 6:
|
|
139
|
+
case "FIXED64_LITTLE":
|
|
140
|
+
return LengthOp.FIXED64_LITTLE;
|
|
141
|
+
case 7:
|
|
142
|
+
case "REQUIRE_32_BYTES":
|
|
143
|
+
return LengthOp.REQUIRE_32_BYTES;
|
|
144
|
+
case 8:
|
|
145
|
+
case "REQUIRE_64_BYTES":
|
|
146
|
+
return LengthOp.REQUIRE_64_BYTES;
|
|
147
|
+
case -1:
|
|
148
|
+
case "UNRECOGNIZED":
|
|
149
|
+
default:
|
|
150
|
+
return LengthOp.UNRECOGNIZED;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
export function lengthOpToJSON(object) {
|
|
154
|
+
switch (object) {
|
|
155
|
+
case LengthOp.NO_PREFIX:
|
|
156
|
+
return "NO_PREFIX";
|
|
157
|
+
case LengthOp.VAR_PROTO:
|
|
158
|
+
return "VAR_PROTO";
|
|
159
|
+
case LengthOp.VAR_RLP:
|
|
160
|
+
return "VAR_RLP";
|
|
161
|
+
case LengthOp.FIXED32_BIG:
|
|
162
|
+
return "FIXED32_BIG";
|
|
163
|
+
case LengthOp.FIXED32_LITTLE:
|
|
164
|
+
return "FIXED32_LITTLE";
|
|
165
|
+
case LengthOp.FIXED64_BIG:
|
|
166
|
+
return "FIXED64_BIG";
|
|
167
|
+
case LengthOp.FIXED64_LITTLE:
|
|
168
|
+
return "FIXED64_LITTLE";
|
|
169
|
+
case LengthOp.REQUIRE_32_BYTES:
|
|
170
|
+
return "REQUIRE_32_BYTES";
|
|
171
|
+
case LengthOp.REQUIRE_64_BYTES:
|
|
172
|
+
return "REQUIRE_64_BYTES";
|
|
173
|
+
case LengthOp.UNRECOGNIZED:
|
|
174
|
+
default:
|
|
175
|
+
return "UNRECOGNIZED";
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function createBaseExistenceProof() {
|
|
179
|
+
return { key: new Uint8Array(0), value: new Uint8Array(0), leaf: undefined, path: [] };
|
|
180
|
+
}
|
|
181
|
+
export const ExistenceProof = {
|
|
182
|
+
encode(message, writer = new BinaryWriter()) {
|
|
183
|
+
if (message.key.length !== 0) {
|
|
184
|
+
writer.uint32(10).bytes(message.key);
|
|
185
|
+
}
|
|
186
|
+
if (message.value.length !== 0) {
|
|
187
|
+
writer.uint32(18).bytes(message.value);
|
|
188
|
+
}
|
|
189
|
+
if (message.leaf !== undefined) {
|
|
190
|
+
LeafOp.encode(message.leaf, writer.uint32(26).fork()).join();
|
|
191
|
+
}
|
|
192
|
+
for (const v of message.path) {
|
|
193
|
+
InnerOp.encode(v, writer.uint32(34).fork()).join();
|
|
194
|
+
}
|
|
195
|
+
return writer;
|
|
196
|
+
},
|
|
197
|
+
decode(input, length) {
|
|
198
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
199
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
200
|
+
const message = createBaseExistenceProof();
|
|
201
|
+
while (reader.pos < end) {
|
|
202
|
+
const tag = reader.uint32();
|
|
203
|
+
switch (tag >>> 3) {
|
|
204
|
+
case 1: {
|
|
205
|
+
if (tag !== 10) {
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
message.key = reader.bytes();
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
case 2: {
|
|
212
|
+
if (tag !== 18) {
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
message.value = reader.bytes();
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
case 3: {
|
|
219
|
+
if (tag !== 26) {
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
message.leaf = LeafOp.decode(reader, reader.uint32());
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
case 4: {
|
|
226
|
+
if (tag !== 34) {
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
message.path.push(InnerOp.decode(reader, reader.uint32()));
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
reader.skip(tag & 7);
|
|
237
|
+
}
|
|
238
|
+
return message;
|
|
239
|
+
},
|
|
240
|
+
fromJSON(object) {
|
|
241
|
+
return {
|
|
242
|
+
key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0),
|
|
243
|
+
value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0),
|
|
244
|
+
leaf: isSet(object.leaf) ? LeafOp.fromJSON(object.leaf) : undefined,
|
|
245
|
+
path: globalThis.Array.isArray(object?.path) ? object.path.map((e) => InnerOp.fromJSON(e)) : [],
|
|
246
|
+
};
|
|
247
|
+
},
|
|
248
|
+
toJSON(message) {
|
|
249
|
+
const obj = {};
|
|
250
|
+
if (message.key.length !== 0) {
|
|
251
|
+
obj.key = base64FromBytes(message.key);
|
|
252
|
+
}
|
|
253
|
+
if (message.value.length !== 0) {
|
|
254
|
+
obj.value = base64FromBytes(message.value);
|
|
255
|
+
}
|
|
256
|
+
if (message.leaf !== undefined) {
|
|
257
|
+
obj.leaf = LeafOp.toJSON(message.leaf);
|
|
258
|
+
}
|
|
259
|
+
if (message.path?.length) {
|
|
260
|
+
obj.path = message.path.map((e) => InnerOp.toJSON(e));
|
|
261
|
+
}
|
|
262
|
+
return obj;
|
|
263
|
+
},
|
|
264
|
+
create(base) {
|
|
265
|
+
return ExistenceProof.fromPartial(base ?? {});
|
|
266
|
+
},
|
|
267
|
+
fromPartial(object) {
|
|
268
|
+
const message = createBaseExistenceProof();
|
|
269
|
+
message.key = object.key ?? new Uint8Array(0);
|
|
270
|
+
message.value = object.value ?? new Uint8Array(0);
|
|
271
|
+
message.leaf = (object.leaf !== undefined && object.leaf !== null) ? LeafOp.fromPartial(object.leaf) : undefined;
|
|
272
|
+
message.path = object.path?.map((e) => InnerOp.fromPartial(e)) || [];
|
|
273
|
+
return message;
|
|
274
|
+
},
|
|
275
|
+
};
|
|
276
|
+
function createBaseNonExistenceProof() {
|
|
277
|
+
return { key: new Uint8Array(0), left: undefined, right: undefined };
|
|
278
|
+
}
|
|
279
|
+
export const NonExistenceProof = {
|
|
280
|
+
encode(message, writer = new BinaryWriter()) {
|
|
281
|
+
if (message.key.length !== 0) {
|
|
282
|
+
writer.uint32(10).bytes(message.key);
|
|
283
|
+
}
|
|
284
|
+
if (message.left !== undefined) {
|
|
285
|
+
ExistenceProof.encode(message.left, writer.uint32(18).fork()).join();
|
|
286
|
+
}
|
|
287
|
+
if (message.right !== undefined) {
|
|
288
|
+
ExistenceProof.encode(message.right, writer.uint32(26).fork()).join();
|
|
289
|
+
}
|
|
290
|
+
return writer;
|
|
291
|
+
},
|
|
292
|
+
decode(input, length) {
|
|
293
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
294
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
295
|
+
const message = createBaseNonExistenceProof();
|
|
296
|
+
while (reader.pos < end) {
|
|
297
|
+
const tag = reader.uint32();
|
|
298
|
+
switch (tag >>> 3) {
|
|
299
|
+
case 1: {
|
|
300
|
+
if (tag !== 10) {
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
message.key = reader.bytes();
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
case 2: {
|
|
307
|
+
if (tag !== 18) {
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
message.left = ExistenceProof.decode(reader, reader.uint32());
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
case 3: {
|
|
314
|
+
if (tag !== 26) {
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
message.right = ExistenceProof.decode(reader, reader.uint32());
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
reader.skip(tag & 7);
|
|
325
|
+
}
|
|
326
|
+
return message;
|
|
327
|
+
},
|
|
328
|
+
fromJSON(object) {
|
|
329
|
+
return {
|
|
330
|
+
key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0),
|
|
331
|
+
left: isSet(object.left) ? ExistenceProof.fromJSON(object.left) : undefined,
|
|
332
|
+
right: isSet(object.right) ? ExistenceProof.fromJSON(object.right) : undefined,
|
|
333
|
+
};
|
|
334
|
+
},
|
|
335
|
+
toJSON(message) {
|
|
336
|
+
const obj = {};
|
|
337
|
+
if (message.key.length !== 0) {
|
|
338
|
+
obj.key = base64FromBytes(message.key);
|
|
339
|
+
}
|
|
340
|
+
if (message.left !== undefined) {
|
|
341
|
+
obj.left = ExistenceProof.toJSON(message.left);
|
|
342
|
+
}
|
|
343
|
+
if (message.right !== undefined) {
|
|
344
|
+
obj.right = ExistenceProof.toJSON(message.right);
|
|
345
|
+
}
|
|
346
|
+
return obj;
|
|
347
|
+
},
|
|
348
|
+
create(base) {
|
|
349
|
+
return NonExistenceProof.fromPartial(base ?? {});
|
|
350
|
+
},
|
|
351
|
+
fromPartial(object) {
|
|
352
|
+
const message = createBaseNonExistenceProof();
|
|
353
|
+
message.key = object.key ?? new Uint8Array(0);
|
|
354
|
+
message.left = (object.left !== undefined && object.left !== null)
|
|
355
|
+
? ExistenceProof.fromPartial(object.left)
|
|
356
|
+
: undefined;
|
|
357
|
+
message.right = (object.right !== undefined && object.right !== null)
|
|
358
|
+
? ExistenceProof.fromPartial(object.right)
|
|
359
|
+
: undefined;
|
|
360
|
+
return message;
|
|
361
|
+
},
|
|
362
|
+
};
|
|
363
|
+
function createBaseCommitmentProof() {
|
|
364
|
+
return { exist: undefined, nonexist: undefined, batch: undefined, compressed: undefined };
|
|
365
|
+
}
|
|
366
|
+
export const CommitmentProof = {
|
|
367
|
+
encode(message, writer = new BinaryWriter()) {
|
|
368
|
+
if (message.exist !== undefined) {
|
|
369
|
+
ExistenceProof.encode(message.exist, writer.uint32(10).fork()).join();
|
|
370
|
+
}
|
|
371
|
+
if (message.nonexist !== undefined) {
|
|
372
|
+
NonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).join();
|
|
373
|
+
}
|
|
374
|
+
if (message.batch !== undefined) {
|
|
375
|
+
BatchProof.encode(message.batch, writer.uint32(26).fork()).join();
|
|
376
|
+
}
|
|
377
|
+
if (message.compressed !== undefined) {
|
|
378
|
+
CompressedBatchProof.encode(message.compressed, writer.uint32(34).fork()).join();
|
|
379
|
+
}
|
|
380
|
+
return writer;
|
|
381
|
+
},
|
|
382
|
+
decode(input, length) {
|
|
383
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
384
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
385
|
+
const message = createBaseCommitmentProof();
|
|
386
|
+
while (reader.pos < end) {
|
|
387
|
+
const tag = reader.uint32();
|
|
388
|
+
switch (tag >>> 3) {
|
|
389
|
+
case 1: {
|
|
390
|
+
if (tag !== 10) {
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
message.exist = ExistenceProof.decode(reader, reader.uint32());
|
|
394
|
+
continue;
|
|
395
|
+
}
|
|
396
|
+
case 2: {
|
|
397
|
+
if (tag !== 18) {
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
message.nonexist = NonExistenceProof.decode(reader, reader.uint32());
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
case 3: {
|
|
404
|
+
if (tag !== 26) {
|
|
405
|
+
break;
|
|
406
|
+
}
|
|
407
|
+
message.batch = BatchProof.decode(reader, reader.uint32());
|
|
408
|
+
continue;
|
|
409
|
+
}
|
|
410
|
+
case 4: {
|
|
411
|
+
if (tag !== 34) {
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
414
|
+
message.compressed = CompressedBatchProof.decode(reader, reader.uint32());
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
reader.skip(tag & 7);
|
|
422
|
+
}
|
|
423
|
+
return message;
|
|
424
|
+
},
|
|
425
|
+
fromJSON(object) {
|
|
426
|
+
return {
|
|
427
|
+
exist: isSet(object.exist) ? ExistenceProof.fromJSON(object.exist) : undefined,
|
|
428
|
+
nonexist: isSet(object.nonexist) ? NonExistenceProof.fromJSON(object.nonexist) : undefined,
|
|
429
|
+
batch: isSet(object.batch) ? BatchProof.fromJSON(object.batch) : undefined,
|
|
430
|
+
compressed: isSet(object.compressed) ? CompressedBatchProof.fromJSON(object.compressed) : undefined,
|
|
431
|
+
};
|
|
432
|
+
},
|
|
433
|
+
toJSON(message) {
|
|
434
|
+
const obj = {};
|
|
435
|
+
if (message.exist !== undefined) {
|
|
436
|
+
obj.exist = ExistenceProof.toJSON(message.exist);
|
|
437
|
+
}
|
|
438
|
+
if (message.nonexist !== undefined) {
|
|
439
|
+
obj.nonexist = NonExistenceProof.toJSON(message.nonexist);
|
|
440
|
+
}
|
|
441
|
+
if (message.batch !== undefined) {
|
|
442
|
+
obj.batch = BatchProof.toJSON(message.batch);
|
|
443
|
+
}
|
|
444
|
+
if (message.compressed !== undefined) {
|
|
445
|
+
obj.compressed = CompressedBatchProof.toJSON(message.compressed);
|
|
446
|
+
}
|
|
447
|
+
return obj;
|
|
448
|
+
},
|
|
449
|
+
create(base) {
|
|
450
|
+
return CommitmentProof.fromPartial(base ?? {});
|
|
451
|
+
},
|
|
452
|
+
fromPartial(object) {
|
|
453
|
+
const message = createBaseCommitmentProof();
|
|
454
|
+
message.exist = (object.exist !== undefined && object.exist !== null)
|
|
455
|
+
? ExistenceProof.fromPartial(object.exist)
|
|
456
|
+
: undefined;
|
|
457
|
+
message.nonexist = (object.nonexist !== undefined && object.nonexist !== null)
|
|
458
|
+
? NonExistenceProof.fromPartial(object.nonexist)
|
|
459
|
+
: undefined;
|
|
460
|
+
message.batch = (object.batch !== undefined && object.batch !== null)
|
|
461
|
+
? BatchProof.fromPartial(object.batch)
|
|
462
|
+
: undefined;
|
|
463
|
+
message.compressed = (object.compressed !== undefined && object.compressed !== null)
|
|
464
|
+
? CompressedBatchProof.fromPartial(object.compressed)
|
|
465
|
+
: undefined;
|
|
466
|
+
return message;
|
|
467
|
+
},
|
|
468
|
+
};
|
|
469
|
+
function createBaseLeafOp() {
|
|
470
|
+
return { hash: 0, prehashKey: 0, prehashValue: 0, length: 0, prefix: new Uint8Array(0) };
|
|
471
|
+
}
|
|
472
|
+
export const LeafOp = {
|
|
473
|
+
encode(message, writer = new BinaryWriter()) {
|
|
474
|
+
if (message.hash !== 0) {
|
|
475
|
+
writer.uint32(8).int32(message.hash);
|
|
476
|
+
}
|
|
477
|
+
if (message.prehashKey !== 0) {
|
|
478
|
+
writer.uint32(16).int32(message.prehashKey);
|
|
479
|
+
}
|
|
480
|
+
if (message.prehashValue !== 0) {
|
|
481
|
+
writer.uint32(24).int32(message.prehashValue);
|
|
482
|
+
}
|
|
483
|
+
if (message.length !== 0) {
|
|
484
|
+
writer.uint32(32).int32(message.length);
|
|
485
|
+
}
|
|
486
|
+
if (message.prefix.length !== 0) {
|
|
487
|
+
writer.uint32(42).bytes(message.prefix);
|
|
488
|
+
}
|
|
489
|
+
return writer;
|
|
490
|
+
},
|
|
491
|
+
decode(input, length) {
|
|
492
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
493
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
494
|
+
const message = createBaseLeafOp();
|
|
495
|
+
while (reader.pos < end) {
|
|
496
|
+
const tag = reader.uint32();
|
|
497
|
+
switch (tag >>> 3) {
|
|
498
|
+
case 1: {
|
|
499
|
+
if (tag !== 8) {
|
|
500
|
+
break;
|
|
501
|
+
}
|
|
502
|
+
message.hash = reader.int32();
|
|
503
|
+
continue;
|
|
504
|
+
}
|
|
505
|
+
case 2: {
|
|
506
|
+
if (tag !== 16) {
|
|
507
|
+
break;
|
|
508
|
+
}
|
|
509
|
+
message.prehashKey = reader.int32();
|
|
510
|
+
continue;
|
|
511
|
+
}
|
|
512
|
+
case 3: {
|
|
513
|
+
if (tag !== 24) {
|
|
514
|
+
break;
|
|
515
|
+
}
|
|
516
|
+
message.prehashValue = reader.int32();
|
|
517
|
+
continue;
|
|
518
|
+
}
|
|
519
|
+
case 4: {
|
|
520
|
+
if (tag !== 32) {
|
|
521
|
+
break;
|
|
522
|
+
}
|
|
523
|
+
message.length = reader.int32();
|
|
524
|
+
continue;
|
|
525
|
+
}
|
|
526
|
+
case 5: {
|
|
527
|
+
if (tag !== 42) {
|
|
528
|
+
break;
|
|
529
|
+
}
|
|
530
|
+
message.prefix = reader.bytes();
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
535
|
+
break;
|
|
536
|
+
}
|
|
537
|
+
reader.skip(tag & 7);
|
|
538
|
+
}
|
|
539
|
+
return message;
|
|
540
|
+
},
|
|
541
|
+
fromJSON(object) {
|
|
542
|
+
return {
|
|
543
|
+
hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0,
|
|
544
|
+
prehashKey: isSet(object.prehashKey) ? hashOpFromJSON(object.prehashKey) : 0,
|
|
545
|
+
prehashValue: isSet(object.prehashValue) ? hashOpFromJSON(object.prehashValue) : 0,
|
|
546
|
+
length: isSet(object.length) ? lengthOpFromJSON(object.length) : 0,
|
|
547
|
+
prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array(0),
|
|
548
|
+
};
|
|
549
|
+
},
|
|
550
|
+
toJSON(message) {
|
|
551
|
+
const obj = {};
|
|
552
|
+
if (message.hash !== 0) {
|
|
553
|
+
obj.hash = hashOpToJSON(message.hash);
|
|
554
|
+
}
|
|
555
|
+
if (message.prehashKey !== 0) {
|
|
556
|
+
obj.prehashKey = hashOpToJSON(message.prehashKey);
|
|
557
|
+
}
|
|
558
|
+
if (message.prehashValue !== 0) {
|
|
559
|
+
obj.prehashValue = hashOpToJSON(message.prehashValue);
|
|
560
|
+
}
|
|
561
|
+
if (message.length !== 0) {
|
|
562
|
+
obj.length = lengthOpToJSON(message.length);
|
|
563
|
+
}
|
|
564
|
+
if (message.prefix.length !== 0) {
|
|
565
|
+
obj.prefix = base64FromBytes(message.prefix);
|
|
566
|
+
}
|
|
567
|
+
return obj;
|
|
568
|
+
},
|
|
569
|
+
create(base) {
|
|
570
|
+
return LeafOp.fromPartial(base ?? {});
|
|
571
|
+
},
|
|
572
|
+
fromPartial(object) {
|
|
573
|
+
const message = createBaseLeafOp();
|
|
574
|
+
message.hash = object.hash ?? 0;
|
|
575
|
+
message.prehashKey = object.prehashKey ?? 0;
|
|
576
|
+
message.prehashValue = object.prehashValue ?? 0;
|
|
577
|
+
message.length = object.length ?? 0;
|
|
578
|
+
message.prefix = object.prefix ?? new Uint8Array(0);
|
|
579
|
+
return message;
|
|
580
|
+
},
|
|
581
|
+
};
|
|
582
|
+
function createBaseInnerOp() {
|
|
583
|
+
return { hash: 0, prefix: new Uint8Array(0), suffix: new Uint8Array(0) };
|
|
584
|
+
}
|
|
585
|
+
export const InnerOp = {
|
|
586
|
+
encode(message, writer = new BinaryWriter()) {
|
|
587
|
+
if (message.hash !== 0) {
|
|
588
|
+
writer.uint32(8).int32(message.hash);
|
|
589
|
+
}
|
|
590
|
+
if (message.prefix.length !== 0) {
|
|
591
|
+
writer.uint32(18).bytes(message.prefix);
|
|
592
|
+
}
|
|
593
|
+
if (message.suffix.length !== 0) {
|
|
594
|
+
writer.uint32(26).bytes(message.suffix);
|
|
595
|
+
}
|
|
596
|
+
return writer;
|
|
597
|
+
},
|
|
598
|
+
decode(input, length) {
|
|
599
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
600
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
601
|
+
const message = createBaseInnerOp();
|
|
602
|
+
while (reader.pos < end) {
|
|
603
|
+
const tag = reader.uint32();
|
|
604
|
+
switch (tag >>> 3) {
|
|
605
|
+
case 1: {
|
|
606
|
+
if (tag !== 8) {
|
|
607
|
+
break;
|
|
608
|
+
}
|
|
609
|
+
message.hash = reader.int32();
|
|
610
|
+
continue;
|
|
611
|
+
}
|
|
612
|
+
case 2: {
|
|
613
|
+
if (tag !== 18) {
|
|
614
|
+
break;
|
|
615
|
+
}
|
|
616
|
+
message.prefix = reader.bytes();
|
|
617
|
+
continue;
|
|
618
|
+
}
|
|
619
|
+
case 3: {
|
|
620
|
+
if (tag !== 26) {
|
|
621
|
+
break;
|
|
622
|
+
}
|
|
623
|
+
message.suffix = reader.bytes();
|
|
624
|
+
continue;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
628
|
+
break;
|
|
629
|
+
}
|
|
630
|
+
reader.skip(tag & 7);
|
|
631
|
+
}
|
|
632
|
+
return message;
|
|
633
|
+
},
|
|
634
|
+
fromJSON(object) {
|
|
635
|
+
return {
|
|
636
|
+
hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0,
|
|
637
|
+
prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array(0),
|
|
638
|
+
suffix: isSet(object.suffix) ? bytesFromBase64(object.suffix) : new Uint8Array(0),
|
|
639
|
+
};
|
|
640
|
+
},
|
|
641
|
+
toJSON(message) {
|
|
642
|
+
const obj = {};
|
|
643
|
+
if (message.hash !== 0) {
|
|
644
|
+
obj.hash = hashOpToJSON(message.hash);
|
|
645
|
+
}
|
|
646
|
+
if (message.prefix.length !== 0) {
|
|
647
|
+
obj.prefix = base64FromBytes(message.prefix);
|
|
648
|
+
}
|
|
649
|
+
if (message.suffix.length !== 0) {
|
|
650
|
+
obj.suffix = base64FromBytes(message.suffix);
|
|
651
|
+
}
|
|
652
|
+
return obj;
|
|
653
|
+
},
|
|
654
|
+
create(base) {
|
|
655
|
+
return InnerOp.fromPartial(base ?? {});
|
|
656
|
+
},
|
|
657
|
+
fromPartial(object) {
|
|
658
|
+
const message = createBaseInnerOp();
|
|
659
|
+
message.hash = object.hash ?? 0;
|
|
660
|
+
message.prefix = object.prefix ?? new Uint8Array(0);
|
|
661
|
+
message.suffix = object.suffix ?? new Uint8Array(0);
|
|
662
|
+
return message;
|
|
663
|
+
},
|
|
664
|
+
};
|
|
665
|
+
function createBaseProofSpec() {
|
|
666
|
+
return { leafSpec: undefined, innerSpec: undefined, maxDepth: 0, minDepth: 0, prehashKeyBeforeComparison: false };
|
|
667
|
+
}
|
|
668
|
+
export const ProofSpec = {
|
|
669
|
+
encode(message, writer = new BinaryWriter()) {
|
|
670
|
+
if (message.leafSpec !== undefined) {
|
|
671
|
+
LeafOp.encode(message.leafSpec, writer.uint32(10).fork()).join();
|
|
672
|
+
}
|
|
673
|
+
if (message.innerSpec !== undefined) {
|
|
674
|
+
InnerSpec.encode(message.innerSpec, writer.uint32(18).fork()).join();
|
|
675
|
+
}
|
|
676
|
+
if (message.maxDepth !== 0) {
|
|
677
|
+
writer.uint32(24).int32(message.maxDepth);
|
|
678
|
+
}
|
|
679
|
+
if (message.minDepth !== 0) {
|
|
680
|
+
writer.uint32(32).int32(message.minDepth);
|
|
681
|
+
}
|
|
682
|
+
if (message.prehashKeyBeforeComparison !== false) {
|
|
683
|
+
writer.uint32(40).bool(message.prehashKeyBeforeComparison);
|
|
684
|
+
}
|
|
685
|
+
return writer;
|
|
686
|
+
},
|
|
687
|
+
decode(input, length) {
|
|
688
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
689
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
690
|
+
const message = createBaseProofSpec();
|
|
691
|
+
while (reader.pos < end) {
|
|
692
|
+
const tag = reader.uint32();
|
|
693
|
+
switch (tag >>> 3) {
|
|
694
|
+
case 1: {
|
|
695
|
+
if (tag !== 10) {
|
|
696
|
+
break;
|
|
697
|
+
}
|
|
698
|
+
message.leafSpec = LeafOp.decode(reader, reader.uint32());
|
|
699
|
+
continue;
|
|
700
|
+
}
|
|
701
|
+
case 2: {
|
|
702
|
+
if (tag !== 18) {
|
|
703
|
+
break;
|
|
704
|
+
}
|
|
705
|
+
message.innerSpec = InnerSpec.decode(reader, reader.uint32());
|
|
706
|
+
continue;
|
|
707
|
+
}
|
|
708
|
+
case 3: {
|
|
709
|
+
if (tag !== 24) {
|
|
710
|
+
break;
|
|
711
|
+
}
|
|
712
|
+
message.maxDepth = reader.int32();
|
|
713
|
+
continue;
|
|
714
|
+
}
|
|
715
|
+
case 4: {
|
|
716
|
+
if (tag !== 32) {
|
|
717
|
+
break;
|
|
718
|
+
}
|
|
719
|
+
message.minDepth = reader.int32();
|
|
720
|
+
continue;
|
|
721
|
+
}
|
|
722
|
+
case 5: {
|
|
723
|
+
if (tag !== 40) {
|
|
724
|
+
break;
|
|
725
|
+
}
|
|
726
|
+
message.prehashKeyBeforeComparison = reader.bool();
|
|
727
|
+
continue;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
731
|
+
break;
|
|
732
|
+
}
|
|
733
|
+
reader.skip(tag & 7);
|
|
734
|
+
}
|
|
735
|
+
return message;
|
|
736
|
+
},
|
|
737
|
+
fromJSON(object) {
|
|
738
|
+
return {
|
|
739
|
+
leafSpec: isSet(object.leafSpec) ? LeafOp.fromJSON(object.leafSpec) : undefined,
|
|
740
|
+
innerSpec: isSet(object.innerSpec) ? InnerSpec.fromJSON(object.innerSpec) : undefined,
|
|
741
|
+
maxDepth: isSet(object.maxDepth) ? globalThis.Number(object.maxDepth) : 0,
|
|
742
|
+
minDepth: isSet(object.minDepth) ? globalThis.Number(object.minDepth) : 0,
|
|
743
|
+
prehashKeyBeforeComparison: isSet(object.prehashKeyBeforeComparison)
|
|
744
|
+
? globalThis.Boolean(object.prehashKeyBeforeComparison)
|
|
745
|
+
: false,
|
|
746
|
+
};
|
|
747
|
+
},
|
|
748
|
+
toJSON(message) {
|
|
749
|
+
const obj = {};
|
|
750
|
+
if (message.leafSpec !== undefined) {
|
|
751
|
+
obj.leafSpec = LeafOp.toJSON(message.leafSpec);
|
|
752
|
+
}
|
|
753
|
+
if (message.innerSpec !== undefined) {
|
|
754
|
+
obj.innerSpec = InnerSpec.toJSON(message.innerSpec);
|
|
755
|
+
}
|
|
756
|
+
if (message.maxDepth !== 0) {
|
|
757
|
+
obj.maxDepth = Math.round(message.maxDepth);
|
|
758
|
+
}
|
|
759
|
+
if (message.minDepth !== 0) {
|
|
760
|
+
obj.minDepth = Math.round(message.minDepth);
|
|
761
|
+
}
|
|
762
|
+
if (message.prehashKeyBeforeComparison !== false) {
|
|
763
|
+
obj.prehashKeyBeforeComparison = message.prehashKeyBeforeComparison;
|
|
764
|
+
}
|
|
765
|
+
return obj;
|
|
766
|
+
},
|
|
767
|
+
create(base) {
|
|
768
|
+
return ProofSpec.fromPartial(base ?? {});
|
|
769
|
+
},
|
|
770
|
+
fromPartial(object) {
|
|
771
|
+
const message = createBaseProofSpec();
|
|
772
|
+
message.leafSpec = (object.leafSpec !== undefined && object.leafSpec !== null)
|
|
773
|
+
? LeafOp.fromPartial(object.leafSpec)
|
|
774
|
+
: undefined;
|
|
775
|
+
message.innerSpec = (object.innerSpec !== undefined && object.innerSpec !== null)
|
|
776
|
+
? InnerSpec.fromPartial(object.innerSpec)
|
|
777
|
+
: undefined;
|
|
778
|
+
message.maxDepth = object.maxDepth ?? 0;
|
|
779
|
+
message.minDepth = object.minDepth ?? 0;
|
|
780
|
+
message.prehashKeyBeforeComparison = object.prehashKeyBeforeComparison ?? false;
|
|
781
|
+
return message;
|
|
782
|
+
},
|
|
783
|
+
};
|
|
784
|
+
function createBaseInnerSpec() {
|
|
785
|
+
return {
|
|
786
|
+
childOrder: [],
|
|
787
|
+
childSize: 0,
|
|
788
|
+
minPrefixLength: 0,
|
|
789
|
+
maxPrefixLength: 0,
|
|
790
|
+
emptyChild: new Uint8Array(0),
|
|
791
|
+
hash: 0,
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
export const InnerSpec = {
|
|
795
|
+
encode(message, writer = new BinaryWriter()) {
|
|
796
|
+
writer.uint32(10).fork();
|
|
797
|
+
for (const v of message.childOrder) {
|
|
798
|
+
writer.int32(v);
|
|
799
|
+
}
|
|
800
|
+
writer.join();
|
|
801
|
+
if (message.childSize !== 0) {
|
|
802
|
+
writer.uint32(16).int32(message.childSize);
|
|
803
|
+
}
|
|
804
|
+
if (message.minPrefixLength !== 0) {
|
|
805
|
+
writer.uint32(24).int32(message.minPrefixLength);
|
|
806
|
+
}
|
|
807
|
+
if (message.maxPrefixLength !== 0) {
|
|
808
|
+
writer.uint32(32).int32(message.maxPrefixLength);
|
|
809
|
+
}
|
|
810
|
+
if (message.emptyChild.length !== 0) {
|
|
811
|
+
writer.uint32(42).bytes(message.emptyChild);
|
|
812
|
+
}
|
|
813
|
+
if (message.hash !== 0) {
|
|
814
|
+
writer.uint32(48).int32(message.hash);
|
|
815
|
+
}
|
|
816
|
+
return writer;
|
|
817
|
+
},
|
|
818
|
+
decode(input, length) {
|
|
819
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
820
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
821
|
+
const message = createBaseInnerSpec();
|
|
822
|
+
while (reader.pos < end) {
|
|
823
|
+
const tag = reader.uint32();
|
|
824
|
+
switch (tag >>> 3) {
|
|
825
|
+
case 1: {
|
|
826
|
+
if (tag === 8) {
|
|
827
|
+
message.childOrder.push(reader.int32());
|
|
828
|
+
continue;
|
|
829
|
+
}
|
|
830
|
+
if (tag === 10) {
|
|
831
|
+
const end2 = reader.uint32() + reader.pos;
|
|
832
|
+
while (reader.pos < end2) {
|
|
833
|
+
message.childOrder.push(reader.int32());
|
|
834
|
+
}
|
|
835
|
+
continue;
|
|
836
|
+
}
|
|
837
|
+
break;
|
|
838
|
+
}
|
|
839
|
+
case 2: {
|
|
840
|
+
if (tag !== 16) {
|
|
841
|
+
break;
|
|
842
|
+
}
|
|
843
|
+
message.childSize = reader.int32();
|
|
844
|
+
continue;
|
|
845
|
+
}
|
|
846
|
+
case 3: {
|
|
847
|
+
if (tag !== 24) {
|
|
848
|
+
break;
|
|
849
|
+
}
|
|
850
|
+
message.minPrefixLength = reader.int32();
|
|
851
|
+
continue;
|
|
852
|
+
}
|
|
853
|
+
case 4: {
|
|
854
|
+
if (tag !== 32) {
|
|
855
|
+
break;
|
|
856
|
+
}
|
|
857
|
+
message.maxPrefixLength = reader.int32();
|
|
858
|
+
continue;
|
|
859
|
+
}
|
|
860
|
+
case 5: {
|
|
861
|
+
if (tag !== 42) {
|
|
862
|
+
break;
|
|
863
|
+
}
|
|
864
|
+
message.emptyChild = reader.bytes();
|
|
865
|
+
continue;
|
|
866
|
+
}
|
|
867
|
+
case 6: {
|
|
868
|
+
if (tag !== 48) {
|
|
869
|
+
break;
|
|
870
|
+
}
|
|
871
|
+
message.hash = reader.int32();
|
|
872
|
+
continue;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
876
|
+
break;
|
|
877
|
+
}
|
|
878
|
+
reader.skip(tag & 7);
|
|
879
|
+
}
|
|
880
|
+
return message;
|
|
881
|
+
},
|
|
882
|
+
fromJSON(object) {
|
|
883
|
+
return {
|
|
884
|
+
childOrder: globalThis.Array.isArray(object?.childOrder)
|
|
885
|
+
? object.childOrder.map((e) => globalThis.Number(e))
|
|
886
|
+
: [],
|
|
887
|
+
childSize: isSet(object.childSize) ? globalThis.Number(object.childSize) : 0,
|
|
888
|
+
minPrefixLength: isSet(object.minPrefixLength) ? globalThis.Number(object.minPrefixLength) : 0,
|
|
889
|
+
maxPrefixLength: isSet(object.maxPrefixLength) ? globalThis.Number(object.maxPrefixLength) : 0,
|
|
890
|
+
emptyChild: isSet(object.emptyChild) ? bytesFromBase64(object.emptyChild) : new Uint8Array(0),
|
|
891
|
+
hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0,
|
|
892
|
+
};
|
|
893
|
+
},
|
|
894
|
+
toJSON(message) {
|
|
895
|
+
const obj = {};
|
|
896
|
+
if (message.childOrder?.length) {
|
|
897
|
+
obj.childOrder = message.childOrder.map((e) => Math.round(e));
|
|
898
|
+
}
|
|
899
|
+
if (message.childSize !== 0) {
|
|
900
|
+
obj.childSize = Math.round(message.childSize);
|
|
901
|
+
}
|
|
902
|
+
if (message.minPrefixLength !== 0) {
|
|
903
|
+
obj.minPrefixLength = Math.round(message.minPrefixLength);
|
|
904
|
+
}
|
|
905
|
+
if (message.maxPrefixLength !== 0) {
|
|
906
|
+
obj.maxPrefixLength = Math.round(message.maxPrefixLength);
|
|
907
|
+
}
|
|
908
|
+
if (message.emptyChild.length !== 0) {
|
|
909
|
+
obj.emptyChild = base64FromBytes(message.emptyChild);
|
|
910
|
+
}
|
|
911
|
+
if (message.hash !== 0) {
|
|
912
|
+
obj.hash = hashOpToJSON(message.hash);
|
|
913
|
+
}
|
|
914
|
+
return obj;
|
|
915
|
+
},
|
|
916
|
+
create(base) {
|
|
917
|
+
return InnerSpec.fromPartial(base ?? {});
|
|
918
|
+
},
|
|
919
|
+
fromPartial(object) {
|
|
920
|
+
const message = createBaseInnerSpec();
|
|
921
|
+
message.childOrder = object.childOrder?.map((e) => e) || [];
|
|
922
|
+
message.childSize = object.childSize ?? 0;
|
|
923
|
+
message.minPrefixLength = object.minPrefixLength ?? 0;
|
|
924
|
+
message.maxPrefixLength = object.maxPrefixLength ?? 0;
|
|
925
|
+
message.emptyChild = object.emptyChild ?? new Uint8Array(0);
|
|
926
|
+
message.hash = object.hash ?? 0;
|
|
927
|
+
return message;
|
|
928
|
+
},
|
|
929
|
+
};
|
|
930
|
+
function createBaseBatchProof() {
|
|
931
|
+
return { entries: [] };
|
|
932
|
+
}
|
|
933
|
+
export const BatchProof = {
|
|
934
|
+
encode(message, writer = new BinaryWriter()) {
|
|
935
|
+
for (const v of message.entries) {
|
|
936
|
+
BatchEntry.encode(v, writer.uint32(10).fork()).join();
|
|
937
|
+
}
|
|
938
|
+
return writer;
|
|
939
|
+
},
|
|
940
|
+
decode(input, length) {
|
|
941
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
942
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
943
|
+
const message = createBaseBatchProof();
|
|
944
|
+
while (reader.pos < end) {
|
|
945
|
+
const tag = reader.uint32();
|
|
946
|
+
switch (tag >>> 3) {
|
|
947
|
+
case 1: {
|
|
948
|
+
if (tag !== 10) {
|
|
949
|
+
break;
|
|
950
|
+
}
|
|
951
|
+
message.entries.push(BatchEntry.decode(reader, reader.uint32()));
|
|
952
|
+
continue;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
956
|
+
break;
|
|
957
|
+
}
|
|
958
|
+
reader.skip(tag & 7);
|
|
959
|
+
}
|
|
960
|
+
return message;
|
|
961
|
+
},
|
|
962
|
+
fromJSON(object) {
|
|
963
|
+
return {
|
|
964
|
+
entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e) => BatchEntry.fromJSON(e)) : [],
|
|
965
|
+
};
|
|
966
|
+
},
|
|
967
|
+
toJSON(message) {
|
|
968
|
+
const obj = {};
|
|
969
|
+
if (message.entries?.length) {
|
|
970
|
+
obj.entries = message.entries.map((e) => BatchEntry.toJSON(e));
|
|
971
|
+
}
|
|
972
|
+
return obj;
|
|
973
|
+
},
|
|
974
|
+
create(base) {
|
|
975
|
+
return BatchProof.fromPartial(base ?? {});
|
|
976
|
+
},
|
|
977
|
+
fromPartial(object) {
|
|
978
|
+
const message = createBaseBatchProof();
|
|
979
|
+
message.entries = object.entries?.map((e) => BatchEntry.fromPartial(e)) || [];
|
|
980
|
+
return message;
|
|
981
|
+
},
|
|
982
|
+
};
|
|
983
|
+
function createBaseBatchEntry() {
|
|
984
|
+
return { exist: undefined, nonexist: undefined };
|
|
985
|
+
}
|
|
986
|
+
export const BatchEntry = {
|
|
987
|
+
encode(message, writer = new BinaryWriter()) {
|
|
988
|
+
if (message.exist !== undefined) {
|
|
989
|
+
ExistenceProof.encode(message.exist, writer.uint32(10).fork()).join();
|
|
990
|
+
}
|
|
991
|
+
if (message.nonexist !== undefined) {
|
|
992
|
+
NonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).join();
|
|
993
|
+
}
|
|
994
|
+
return writer;
|
|
995
|
+
},
|
|
996
|
+
decode(input, length) {
|
|
997
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
998
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
999
|
+
const message = createBaseBatchEntry();
|
|
1000
|
+
while (reader.pos < end) {
|
|
1001
|
+
const tag = reader.uint32();
|
|
1002
|
+
switch (tag >>> 3) {
|
|
1003
|
+
case 1: {
|
|
1004
|
+
if (tag !== 10) {
|
|
1005
|
+
break;
|
|
1006
|
+
}
|
|
1007
|
+
message.exist = ExistenceProof.decode(reader, reader.uint32());
|
|
1008
|
+
continue;
|
|
1009
|
+
}
|
|
1010
|
+
case 2: {
|
|
1011
|
+
if (tag !== 18) {
|
|
1012
|
+
break;
|
|
1013
|
+
}
|
|
1014
|
+
message.nonexist = NonExistenceProof.decode(reader, reader.uint32());
|
|
1015
|
+
continue;
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1019
|
+
break;
|
|
1020
|
+
}
|
|
1021
|
+
reader.skip(tag & 7);
|
|
1022
|
+
}
|
|
1023
|
+
return message;
|
|
1024
|
+
},
|
|
1025
|
+
fromJSON(object) {
|
|
1026
|
+
return {
|
|
1027
|
+
exist: isSet(object.exist) ? ExistenceProof.fromJSON(object.exist) : undefined,
|
|
1028
|
+
nonexist: isSet(object.nonexist) ? NonExistenceProof.fromJSON(object.nonexist) : undefined,
|
|
1029
|
+
};
|
|
1030
|
+
},
|
|
1031
|
+
toJSON(message) {
|
|
1032
|
+
const obj = {};
|
|
1033
|
+
if (message.exist !== undefined) {
|
|
1034
|
+
obj.exist = ExistenceProof.toJSON(message.exist);
|
|
1035
|
+
}
|
|
1036
|
+
if (message.nonexist !== undefined) {
|
|
1037
|
+
obj.nonexist = NonExistenceProof.toJSON(message.nonexist);
|
|
1038
|
+
}
|
|
1039
|
+
return obj;
|
|
1040
|
+
},
|
|
1041
|
+
create(base) {
|
|
1042
|
+
return BatchEntry.fromPartial(base ?? {});
|
|
1043
|
+
},
|
|
1044
|
+
fromPartial(object) {
|
|
1045
|
+
const message = createBaseBatchEntry();
|
|
1046
|
+
message.exist = (object.exist !== undefined && object.exist !== null)
|
|
1047
|
+
? ExistenceProof.fromPartial(object.exist)
|
|
1048
|
+
: undefined;
|
|
1049
|
+
message.nonexist = (object.nonexist !== undefined && object.nonexist !== null)
|
|
1050
|
+
? NonExistenceProof.fromPartial(object.nonexist)
|
|
1051
|
+
: undefined;
|
|
1052
|
+
return message;
|
|
1053
|
+
},
|
|
1054
|
+
};
|
|
1055
|
+
function createBaseCompressedBatchProof() {
|
|
1056
|
+
return { entries: [], lookupInners: [] };
|
|
1057
|
+
}
|
|
1058
|
+
export const CompressedBatchProof = {
|
|
1059
|
+
encode(message, writer = new BinaryWriter()) {
|
|
1060
|
+
for (const v of message.entries) {
|
|
1061
|
+
CompressedBatchEntry.encode(v, writer.uint32(10).fork()).join();
|
|
1062
|
+
}
|
|
1063
|
+
for (const v of message.lookupInners) {
|
|
1064
|
+
InnerOp.encode(v, writer.uint32(18).fork()).join();
|
|
1065
|
+
}
|
|
1066
|
+
return writer;
|
|
1067
|
+
},
|
|
1068
|
+
decode(input, length) {
|
|
1069
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1070
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1071
|
+
const message = createBaseCompressedBatchProof();
|
|
1072
|
+
while (reader.pos < end) {
|
|
1073
|
+
const tag = reader.uint32();
|
|
1074
|
+
switch (tag >>> 3) {
|
|
1075
|
+
case 1: {
|
|
1076
|
+
if (tag !== 10) {
|
|
1077
|
+
break;
|
|
1078
|
+
}
|
|
1079
|
+
message.entries.push(CompressedBatchEntry.decode(reader, reader.uint32()));
|
|
1080
|
+
continue;
|
|
1081
|
+
}
|
|
1082
|
+
case 2: {
|
|
1083
|
+
if (tag !== 18) {
|
|
1084
|
+
break;
|
|
1085
|
+
}
|
|
1086
|
+
message.lookupInners.push(InnerOp.decode(reader, reader.uint32()));
|
|
1087
|
+
continue;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1091
|
+
break;
|
|
1092
|
+
}
|
|
1093
|
+
reader.skip(tag & 7);
|
|
1094
|
+
}
|
|
1095
|
+
return message;
|
|
1096
|
+
},
|
|
1097
|
+
fromJSON(object) {
|
|
1098
|
+
return {
|
|
1099
|
+
entries: globalThis.Array.isArray(object?.entries)
|
|
1100
|
+
? object.entries.map((e) => CompressedBatchEntry.fromJSON(e))
|
|
1101
|
+
: [],
|
|
1102
|
+
lookupInners: globalThis.Array.isArray(object?.lookupInners)
|
|
1103
|
+
? object.lookupInners.map((e) => InnerOp.fromJSON(e))
|
|
1104
|
+
: [],
|
|
1105
|
+
};
|
|
1106
|
+
},
|
|
1107
|
+
toJSON(message) {
|
|
1108
|
+
const obj = {};
|
|
1109
|
+
if (message.entries?.length) {
|
|
1110
|
+
obj.entries = message.entries.map((e) => CompressedBatchEntry.toJSON(e));
|
|
1111
|
+
}
|
|
1112
|
+
if (message.lookupInners?.length) {
|
|
1113
|
+
obj.lookupInners = message.lookupInners.map((e) => InnerOp.toJSON(e));
|
|
1114
|
+
}
|
|
1115
|
+
return obj;
|
|
1116
|
+
},
|
|
1117
|
+
create(base) {
|
|
1118
|
+
return CompressedBatchProof.fromPartial(base ?? {});
|
|
1119
|
+
},
|
|
1120
|
+
fromPartial(object) {
|
|
1121
|
+
const message = createBaseCompressedBatchProof();
|
|
1122
|
+
message.entries = object.entries?.map((e) => CompressedBatchEntry.fromPartial(e)) || [];
|
|
1123
|
+
message.lookupInners = object.lookupInners?.map((e) => InnerOp.fromPartial(e)) || [];
|
|
1124
|
+
return message;
|
|
1125
|
+
},
|
|
1126
|
+
};
|
|
1127
|
+
function createBaseCompressedBatchEntry() {
|
|
1128
|
+
return { exist: undefined, nonexist: undefined };
|
|
1129
|
+
}
|
|
1130
|
+
export const CompressedBatchEntry = {
|
|
1131
|
+
encode(message, writer = new BinaryWriter()) {
|
|
1132
|
+
if (message.exist !== undefined) {
|
|
1133
|
+
CompressedExistenceProof.encode(message.exist, writer.uint32(10).fork()).join();
|
|
1134
|
+
}
|
|
1135
|
+
if (message.nonexist !== undefined) {
|
|
1136
|
+
CompressedNonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).join();
|
|
1137
|
+
}
|
|
1138
|
+
return writer;
|
|
1139
|
+
},
|
|
1140
|
+
decode(input, length) {
|
|
1141
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1142
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1143
|
+
const message = createBaseCompressedBatchEntry();
|
|
1144
|
+
while (reader.pos < end) {
|
|
1145
|
+
const tag = reader.uint32();
|
|
1146
|
+
switch (tag >>> 3) {
|
|
1147
|
+
case 1: {
|
|
1148
|
+
if (tag !== 10) {
|
|
1149
|
+
break;
|
|
1150
|
+
}
|
|
1151
|
+
message.exist = CompressedExistenceProof.decode(reader, reader.uint32());
|
|
1152
|
+
continue;
|
|
1153
|
+
}
|
|
1154
|
+
case 2: {
|
|
1155
|
+
if (tag !== 18) {
|
|
1156
|
+
break;
|
|
1157
|
+
}
|
|
1158
|
+
message.nonexist = CompressedNonExistenceProof.decode(reader, reader.uint32());
|
|
1159
|
+
continue;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1163
|
+
break;
|
|
1164
|
+
}
|
|
1165
|
+
reader.skip(tag & 7);
|
|
1166
|
+
}
|
|
1167
|
+
return message;
|
|
1168
|
+
},
|
|
1169
|
+
fromJSON(object) {
|
|
1170
|
+
return {
|
|
1171
|
+
exist: isSet(object.exist) ? CompressedExistenceProof.fromJSON(object.exist) : undefined,
|
|
1172
|
+
nonexist: isSet(object.nonexist) ? CompressedNonExistenceProof.fromJSON(object.nonexist) : undefined,
|
|
1173
|
+
};
|
|
1174
|
+
},
|
|
1175
|
+
toJSON(message) {
|
|
1176
|
+
const obj = {};
|
|
1177
|
+
if (message.exist !== undefined) {
|
|
1178
|
+
obj.exist = CompressedExistenceProof.toJSON(message.exist);
|
|
1179
|
+
}
|
|
1180
|
+
if (message.nonexist !== undefined) {
|
|
1181
|
+
obj.nonexist = CompressedNonExistenceProof.toJSON(message.nonexist);
|
|
1182
|
+
}
|
|
1183
|
+
return obj;
|
|
1184
|
+
},
|
|
1185
|
+
create(base) {
|
|
1186
|
+
return CompressedBatchEntry.fromPartial(base ?? {});
|
|
1187
|
+
},
|
|
1188
|
+
fromPartial(object) {
|
|
1189
|
+
const message = createBaseCompressedBatchEntry();
|
|
1190
|
+
message.exist = (object.exist !== undefined && object.exist !== null)
|
|
1191
|
+
? CompressedExistenceProof.fromPartial(object.exist)
|
|
1192
|
+
: undefined;
|
|
1193
|
+
message.nonexist = (object.nonexist !== undefined && object.nonexist !== null)
|
|
1194
|
+
? CompressedNonExistenceProof.fromPartial(object.nonexist)
|
|
1195
|
+
: undefined;
|
|
1196
|
+
return message;
|
|
1197
|
+
},
|
|
1198
|
+
};
|
|
1199
|
+
function createBaseCompressedExistenceProof() {
|
|
1200
|
+
return { key: new Uint8Array(0), value: new Uint8Array(0), leaf: undefined, path: [] };
|
|
1201
|
+
}
|
|
1202
|
+
export const CompressedExistenceProof = {
|
|
1203
|
+
encode(message, writer = new BinaryWriter()) {
|
|
1204
|
+
if (message.key.length !== 0) {
|
|
1205
|
+
writer.uint32(10).bytes(message.key);
|
|
1206
|
+
}
|
|
1207
|
+
if (message.value.length !== 0) {
|
|
1208
|
+
writer.uint32(18).bytes(message.value);
|
|
1209
|
+
}
|
|
1210
|
+
if (message.leaf !== undefined) {
|
|
1211
|
+
LeafOp.encode(message.leaf, writer.uint32(26).fork()).join();
|
|
1212
|
+
}
|
|
1213
|
+
writer.uint32(34).fork();
|
|
1214
|
+
for (const v of message.path) {
|
|
1215
|
+
writer.int32(v);
|
|
1216
|
+
}
|
|
1217
|
+
writer.join();
|
|
1218
|
+
return writer;
|
|
1219
|
+
},
|
|
1220
|
+
decode(input, length) {
|
|
1221
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1222
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1223
|
+
const message = createBaseCompressedExistenceProof();
|
|
1224
|
+
while (reader.pos < end) {
|
|
1225
|
+
const tag = reader.uint32();
|
|
1226
|
+
switch (tag >>> 3) {
|
|
1227
|
+
case 1: {
|
|
1228
|
+
if (tag !== 10) {
|
|
1229
|
+
break;
|
|
1230
|
+
}
|
|
1231
|
+
message.key = reader.bytes();
|
|
1232
|
+
continue;
|
|
1233
|
+
}
|
|
1234
|
+
case 2: {
|
|
1235
|
+
if (tag !== 18) {
|
|
1236
|
+
break;
|
|
1237
|
+
}
|
|
1238
|
+
message.value = reader.bytes();
|
|
1239
|
+
continue;
|
|
1240
|
+
}
|
|
1241
|
+
case 3: {
|
|
1242
|
+
if (tag !== 26) {
|
|
1243
|
+
break;
|
|
1244
|
+
}
|
|
1245
|
+
message.leaf = LeafOp.decode(reader, reader.uint32());
|
|
1246
|
+
continue;
|
|
1247
|
+
}
|
|
1248
|
+
case 4: {
|
|
1249
|
+
if (tag === 32) {
|
|
1250
|
+
message.path.push(reader.int32());
|
|
1251
|
+
continue;
|
|
1252
|
+
}
|
|
1253
|
+
if (tag === 34) {
|
|
1254
|
+
const end2 = reader.uint32() + reader.pos;
|
|
1255
|
+
while (reader.pos < end2) {
|
|
1256
|
+
message.path.push(reader.int32());
|
|
1257
|
+
}
|
|
1258
|
+
continue;
|
|
1259
|
+
}
|
|
1260
|
+
break;
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1264
|
+
break;
|
|
1265
|
+
}
|
|
1266
|
+
reader.skip(tag & 7);
|
|
1267
|
+
}
|
|
1268
|
+
return message;
|
|
1269
|
+
},
|
|
1270
|
+
fromJSON(object) {
|
|
1271
|
+
return {
|
|
1272
|
+
key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0),
|
|
1273
|
+
value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0),
|
|
1274
|
+
leaf: isSet(object.leaf) ? LeafOp.fromJSON(object.leaf) : undefined,
|
|
1275
|
+
path: globalThis.Array.isArray(object?.path) ? object.path.map((e) => globalThis.Number(e)) : [],
|
|
1276
|
+
};
|
|
1277
|
+
},
|
|
1278
|
+
toJSON(message) {
|
|
1279
|
+
const obj = {};
|
|
1280
|
+
if (message.key.length !== 0) {
|
|
1281
|
+
obj.key = base64FromBytes(message.key);
|
|
1282
|
+
}
|
|
1283
|
+
if (message.value.length !== 0) {
|
|
1284
|
+
obj.value = base64FromBytes(message.value);
|
|
1285
|
+
}
|
|
1286
|
+
if (message.leaf !== undefined) {
|
|
1287
|
+
obj.leaf = LeafOp.toJSON(message.leaf);
|
|
1288
|
+
}
|
|
1289
|
+
if (message.path?.length) {
|
|
1290
|
+
obj.path = message.path.map((e) => Math.round(e));
|
|
1291
|
+
}
|
|
1292
|
+
return obj;
|
|
1293
|
+
},
|
|
1294
|
+
create(base) {
|
|
1295
|
+
return CompressedExistenceProof.fromPartial(base ?? {});
|
|
1296
|
+
},
|
|
1297
|
+
fromPartial(object) {
|
|
1298
|
+
const message = createBaseCompressedExistenceProof();
|
|
1299
|
+
message.key = object.key ?? new Uint8Array(0);
|
|
1300
|
+
message.value = object.value ?? new Uint8Array(0);
|
|
1301
|
+
message.leaf = (object.leaf !== undefined && object.leaf !== null) ? LeafOp.fromPartial(object.leaf) : undefined;
|
|
1302
|
+
message.path = object.path?.map((e) => e) || [];
|
|
1303
|
+
return message;
|
|
1304
|
+
},
|
|
1305
|
+
};
|
|
1306
|
+
function createBaseCompressedNonExistenceProof() {
|
|
1307
|
+
return { key: new Uint8Array(0), left: undefined, right: undefined };
|
|
1308
|
+
}
|
|
1309
|
+
export const CompressedNonExistenceProof = {
|
|
1310
|
+
encode(message, writer = new BinaryWriter()) {
|
|
1311
|
+
if (message.key.length !== 0) {
|
|
1312
|
+
writer.uint32(10).bytes(message.key);
|
|
1313
|
+
}
|
|
1314
|
+
if (message.left !== undefined) {
|
|
1315
|
+
CompressedExistenceProof.encode(message.left, writer.uint32(18).fork()).join();
|
|
1316
|
+
}
|
|
1317
|
+
if (message.right !== undefined) {
|
|
1318
|
+
CompressedExistenceProof.encode(message.right, writer.uint32(26).fork()).join();
|
|
1319
|
+
}
|
|
1320
|
+
return writer;
|
|
1321
|
+
},
|
|
1322
|
+
decode(input, length) {
|
|
1323
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1324
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1325
|
+
const message = createBaseCompressedNonExistenceProof();
|
|
1326
|
+
while (reader.pos < end) {
|
|
1327
|
+
const tag = reader.uint32();
|
|
1328
|
+
switch (tag >>> 3) {
|
|
1329
|
+
case 1: {
|
|
1330
|
+
if (tag !== 10) {
|
|
1331
|
+
break;
|
|
1332
|
+
}
|
|
1333
|
+
message.key = reader.bytes();
|
|
1334
|
+
continue;
|
|
1335
|
+
}
|
|
1336
|
+
case 2: {
|
|
1337
|
+
if (tag !== 18) {
|
|
1338
|
+
break;
|
|
1339
|
+
}
|
|
1340
|
+
message.left = CompressedExistenceProof.decode(reader, reader.uint32());
|
|
1341
|
+
continue;
|
|
1342
|
+
}
|
|
1343
|
+
case 3: {
|
|
1344
|
+
if (tag !== 26) {
|
|
1345
|
+
break;
|
|
1346
|
+
}
|
|
1347
|
+
message.right = CompressedExistenceProof.decode(reader, reader.uint32());
|
|
1348
|
+
continue;
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1352
|
+
break;
|
|
1353
|
+
}
|
|
1354
|
+
reader.skip(tag & 7);
|
|
1355
|
+
}
|
|
1356
|
+
return message;
|
|
1357
|
+
},
|
|
1358
|
+
fromJSON(object) {
|
|
1359
|
+
return {
|
|
1360
|
+
key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0),
|
|
1361
|
+
left: isSet(object.left) ? CompressedExistenceProof.fromJSON(object.left) : undefined,
|
|
1362
|
+
right: isSet(object.right) ? CompressedExistenceProof.fromJSON(object.right) : undefined,
|
|
1363
|
+
};
|
|
1364
|
+
},
|
|
1365
|
+
toJSON(message) {
|
|
1366
|
+
const obj = {};
|
|
1367
|
+
if (message.key.length !== 0) {
|
|
1368
|
+
obj.key = base64FromBytes(message.key);
|
|
1369
|
+
}
|
|
1370
|
+
if (message.left !== undefined) {
|
|
1371
|
+
obj.left = CompressedExistenceProof.toJSON(message.left);
|
|
1372
|
+
}
|
|
1373
|
+
if (message.right !== undefined) {
|
|
1374
|
+
obj.right = CompressedExistenceProof.toJSON(message.right);
|
|
1375
|
+
}
|
|
1376
|
+
return obj;
|
|
1377
|
+
},
|
|
1378
|
+
create(base) {
|
|
1379
|
+
return CompressedNonExistenceProof.fromPartial(base ?? {});
|
|
1380
|
+
},
|
|
1381
|
+
fromPartial(object) {
|
|
1382
|
+
const message = createBaseCompressedNonExistenceProof();
|
|
1383
|
+
message.key = object.key ?? new Uint8Array(0);
|
|
1384
|
+
message.left = (object.left !== undefined && object.left !== null)
|
|
1385
|
+
? CompressedExistenceProof.fromPartial(object.left)
|
|
1386
|
+
: undefined;
|
|
1387
|
+
message.right = (object.right !== undefined && object.right !== null)
|
|
1388
|
+
? CompressedExistenceProof.fromPartial(object.right)
|
|
1389
|
+
: undefined;
|
|
1390
|
+
return message;
|
|
1391
|
+
},
|
|
1392
|
+
};
|
|
1393
|
+
function bytesFromBase64(b64) {
|
|
1394
|
+
const bin = globalThis.atob(b64);
|
|
1395
|
+
const arr = new Uint8Array(bin.length);
|
|
1396
|
+
for (let i = 0; i < bin.length; ++i) {
|
|
1397
|
+
arr[i] = bin.charCodeAt(i);
|
|
1398
|
+
}
|
|
1399
|
+
return arr;
|
|
1400
|
+
}
|
|
1401
|
+
function base64FromBytes(arr) {
|
|
1402
|
+
const bin = [];
|
|
1403
|
+
arr.forEach((byte) => {
|
|
1404
|
+
bin.push(globalThis.String.fromCharCode(byte));
|
|
1405
|
+
});
|
|
1406
|
+
return globalThis.btoa(bin.join(""));
|
|
1407
|
+
}
|
|
1408
|
+
function isSet(value) {
|
|
1409
|
+
return value !== null && value !== undefined;
|
|
1410
|
+
}
|
|
1411
|
+
//# sourceMappingURL=proofs.js.map
|