@typeberry/native 0.0.1-a96fbcf → 0.0.1-fd03743
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/index.d.ts +6 -5
- package/index.js +77 -72
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -235,10 +235,11 @@ declare function __wbg_init(module_or_path?: {
|
|
|
235
235
|
} | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
236
236
|
//#endregion
|
|
237
237
|
//#region native/index.d.ts
|
|
238
|
-
declare
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
238
|
+
declare function initAll(): Promise<void>;
|
|
239
|
+
declare const init: {
|
|
240
|
+
bandersnatch: () => Promise<InitOutput$2>;
|
|
241
|
+
ed25519: () => Promise<InitOutput$1>;
|
|
242
|
+
reedSolomon: () => Promise<InitOutput>;
|
|
242
243
|
};
|
|
243
244
|
//#endregion
|
|
244
|
-
export { bandersnatch_d_exports as bandersnatch, ed25519_wasm_d_exports as ed25519, reed_solomon_wasm_d_exports as reedSolomon
|
|
245
|
+
export { bandersnatch_d_exports as bandersnatch, ed25519_wasm_d_exports as ed25519, init, initAll, reed_solomon_wasm_d_exports as reedSolomon };
|
package/index.js
CHANGED
|
@@ -10,10 +10,10 @@ __export(bandersnatch_exports, {
|
|
|
10
10
|
ring_commitment: () => ring_commitment,
|
|
11
11
|
verify_seal: () => verify_seal
|
|
12
12
|
});
|
|
13
|
-
let wasm$
|
|
13
|
+
let wasm$2;
|
|
14
14
|
let cachedUint8Memory0 = null;
|
|
15
15
|
function getUint8Memory0() {
|
|
16
|
-
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) cachedUint8Memory0 = new Uint8Array(wasm$
|
|
16
|
+
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) cachedUint8Memory0 = new Uint8Array(wasm$2.memory.buffer);
|
|
17
17
|
return cachedUint8Memory0;
|
|
18
18
|
}
|
|
19
19
|
let WASM_VECTOR_LEN$1 = 0;
|
|
@@ -25,7 +25,7 @@ function passArray8ToWasm0$1(arg, malloc) {
|
|
|
25
25
|
}
|
|
26
26
|
let cachedInt32Memory0 = null;
|
|
27
27
|
function getInt32Memory0() {
|
|
28
|
-
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) cachedInt32Memory0 = new Int32Array(wasm$
|
|
28
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) cachedInt32Memory0 = new Int32Array(wasm$2.memory.buffer);
|
|
29
29
|
return cachedInt32Memory0;
|
|
30
30
|
}
|
|
31
31
|
function getArrayU8FromWasm0$1(ptr, len) {
|
|
@@ -38,17 +38,17 @@ function getArrayU8FromWasm0$1(ptr, len) {
|
|
|
38
38
|
*/
|
|
39
39
|
function ring_commitment(keys) {
|
|
40
40
|
try {
|
|
41
|
-
const retptr = wasm$
|
|
42
|
-
const ptr0 = passArray8ToWasm0$1(keys, wasm$
|
|
41
|
+
const retptr = wasm$2.__wbindgen_add_to_stack_pointer(-16);
|
|
42
|
+
const ptr0 = passArray8ToWasm0$1(keys, wasm$2.__wbindgen_malloc);
|
|
43
43
|
const len0 = WASM_VECTOR_LEN$1;
|
|
44
|
-
wasm$
|
|
44
|
+
wasm$2.ring_commitment(retptr, ptr0, len0);
|
|
45
45
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
46
46
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
47
47
|
var v2 = getArrayU8FromWasm0$1(r0, r1).slice();
|
|
48
|
-
wasm$
|
|
48
|
+
wasm$2.__wbindgen_free(r0, r1 * 1, 1);
|
|
49
49
|
return v2;
|
|
50
50
|
} finally {
|
|
51
|
-
wasm$
|
|
51
|
+
wasm$2.__wbindgen_add_to_stack_pointer(16);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
@@ -60,17 +60,17 @@ function ring_commitment(keys) {
|
|
|
60
60
|
*/
|
|
61
61
|
function derive_public_key(seed) {
|
|
62
62
|
try {
|
|
63
|
-
const retptr = wasm$
|
|
64
|
-
const ptr0 = passArray8ToWasm0$1(seed, wasm$
|
|
63
|
+
const retptr = wasm$2.__wbindgen_add_to_stack_pointer(-16);
|
|
64
|
+
const ptr0 = passArray8ToWasm0$1(seed, wasm$2.__wbindgen_malloc);
|
|
65
65
|
const len0 = WASM_VECTOR_LEN$1;
|
|
66
|
-
wasm$
|
|
66
|
+
wasm$2.derive_public_key(retptr, ptr0, len0);
|
|
67
67
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
68
68
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
69
69
|
var v2 = getArrayU8FromWasm0$1(r0, r1).slice();
|
|
70
|
-
wasm$
|
|
70
|
+
wasm$2.__wbindgen_free(r0, r1 * 1, 1);
|
|
71
71
|
return v2;
|
|
72
72
|
} finally {
|
|
73
|
-
wasm$
|
|
73
|
+
wasm$2.__wbindgen_add_to_stack_pointer(16);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
@@ -87,23 +87,23 @@ function derive_public_key(seed) {
|
|
|
87
87
|
*/
|
|
88
88
|
function verify_seal(keys, signer_key_index, seal_data, payload, aux_data) {
|
|
89
89
|
try {
|
|
90
|
-
const retptr = wasm$
|
|
91
|
-
const ptr0 = passArray8ToWasm0$1(keys, wasm$
|
|
90
|
+
const retptr = wasm$2.__wbindgen_add_to_stack_pointer(-16);
|
|
91
|
+
const ptr0 = passArray8ToWasm0$1(keys, wasm$2.__wbindgen_malloc);
|
|
92
92
|
const len0 = WASM_VECTOR_LEN$1;
|
|
93
|
-
const ptr1 = passArray8ToWasm0$1(seal_data, wasm$
|
|
93
|
+
const ptr1 = passArray8ToWasm0$1(seal_data, wasm$2.__wbindgen_malloc);
|
|
94
94
|
const len1 = WASM_VECTOR_LEN$1;
|
|
95
|
-
const ptr2 = passArray8ToWasm0$1(payload, wasm$
|
|
95
|
+
const ptr2 = passArray8ToWasm0$1(payload, wasm$2.__wbindgen_malloc);
|
|
96
96
|
const len2 = WASM_VECTOR_LEN$1;
|
|
97
|
-
const ptr3 = passArray8ToWasm0$1(aux_data, wasm$
|
|
97
|
+
const ptr3 = passArray8ToWasm0$1(aux_data, wasm$2.__wbindgen_malloc);
|
|
98
98
|
const len3 = WASM_VECTOR_LEN$1;
|
|
99
|
-
wasm$
|
|
99
|
+
wasm$2.verify_seal(retptr, ptr0, len0, signer_key_index, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
100
100
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
101
101
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
102
102
|
var v5 = getArrayU8FromWasm0$1(r0, r1).slice();
|
|
103
|
-
wasm$
|
|
103
|
+
wasm$2.__wbindgen_free(r0, r1 * 1, 1);
|
|
104
104
|
return v5;
|
|
105
105
|
} finally {
|
|
106
|
-
wasm$
|
|
106
|
+
wasm$2.__wbindgen_add_to_stack_pointer(16);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
@@ -118,19 +118,19 @@ function verify_seal(keys, signer_key_index, seal_data, payload, aux_data) {
|
|
|
118
118
|
*/
|
|
119
119
|
function batch_verify_tickets(keys, tickets_data, vrf_input_data_len) {
|
|
120
120
|
try {
|
|
121
|
-
const retptr = wasm$
|
|
122
|
-
const ptr0 = passArray8ToWasm0$1(keys, wasm$
|
|
121
|
+
const retptr = wasm$2.__wbindgen_add_to_stack_pointer(-16);
|
|
122
|
+
const ptr0 = passArray8ToWasm0$1(keys, wasm$2.__wbindgen_malloc);
|
|
123
123
|
const len0 = WASM_VECTOR_LEN$1;
|
|
124
|
-
const ptr1 = passArray8ToWasm0$1(tickets_data, wasm$
|
|
124
|
+
const ptr1 = passArray8ToWasm0$1(tickets_data, wasm$2.__wbindgen_malloc);
|
|
125
125
|
const len1 = WASM_VECTOR_LEN$1;
|
|
126
|
-
wasm$
|
|
126
|
+
wasm$2.batch_verify_tickets(retptr, ptr0, len0, ptr1, len1, vrf_input_data_len);
|
|
127
127
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
128
128
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
129
129
|
var v3 = getArrayU8FromWasm0$1(r0, r1).slice();
|
|
130
|
-
wasm$
|
|
130
|
+
wasm$2.__wbindgen_free(r0, r1 * 1, 1);
|
|
131
131
|
return v3;
|
|
132
132
|
} finally {
|
|
133
|
-
wasm$
|
|
133
|
+
wasm$2.__wbindgen_add_to_stack_pointer(16);
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
async function __wbg_load$2(module, imports) {
|
|
@@ -159,14 +159,14 @@ function __wbg_get_imports$2() {
|
|
|
159
159
|
}
|
|
160
160
|
function __wbg_init_memory$2(imports, maybe_memory) {}
|
|
161
161
|
function __wbg_finalize_init$2(instance, module) {
|
|
162
|
-
wasm$
|
|
162
|
+
wasm$2 = instance.exports;
|
|
163
163
|
__wbg_init$2.__wbindgen_wasm_module = module;
|
|
164
164
|
cachedInt32Memory0 = null;
|
|
165
165
|
cachedUint8Memory0 = null;
|
|
166
|
-
return wasm$
|
|
166
|
+
return wasm$2;
|
|
167
167
|
}
|
|
168
168
|
function initSync$2(module) {
|
|
169
|
-
if (wasm$
|
|
169
|
+
if (wasm$2 !== void 0) return wasm$2;
|
|
170
170
|
const imports = __wbg_get_imports$2();
|
|
171
171
|
__wbg_init_memory$2(imports);
|
|
172
172
|
if (!(module instanceof WebAssembly.Module)) module = new WebAssembly.Module(module);
|
|
@@ -174,7 +174,7 @@ function initSync$2(module) {
|
|
|
174
174
|
return __wbg_finalize_init$2(instance, module);
|
|
175
175
|
}
|
|
176
176
|
async function __wbg_init$2(input) {
|
|
177
|
-
if (wasm$
|
|
177
|
+
if (wasm$2 !== void 0) return wasm$2;
|
|
178
178
|
if (typeof input === "undefined") input = new URL("bandersnatch_bg.wasm", import.meta.url);
|
|
179
179
|
const imports = __wbg_get_imports$2();
|
|
180
180
|
if (typeof input === "string" || typeof Request === "function" && input instanceof Request || typeof URL === "function" && input instanceof URL) input = fetch(input);
|
|
@@ -193,10 +193,10 @@ __export(ed25519_wasm_exports, {
|
|
|
193
193
|
verify_ed25519: () => verify_ed25519,
|
|
194
194
|
verify_ed25519_batch: () => verify_ed25519_batch
|
|
195
195
|
});
|
|
196
|
-
let wasm$
|
|
196
|
+
let wasm$1;
|
|
197
197
|
let cachedUint8ArrayMemory0$1 = null;
|
|
198
198
|
function getUint8ArrayMemory0$1() {
|
|
199
|
-
if (cachedUint8ArrayMemory0$1 === null || cachedUint8ArrayMemory0$1.byteLength === 0) cachedUint8ArrayMemory0$1 = new Uint8Array(wasm$
|
|
199
|
+
if (cachedUint8ArrayMemory0$1 === null || cachedUint8ArrayMemory0$1.byteLength === 0) cachedUint8ArrayMemory0$1 = new Uint8Array(wasm$1.memory.buffer);
|
|
200
200
|
return cachedUint8ArrayMemory0$1;
|
|
201
201
|
}
|
|
202
202
|
let WASM_VECTOR_LEN = 0;
|
|
@@ -220,11 +220,11 @@ function getArrayU8FromWasm0(ptr, len) {
|
|
|
220
220
|
* @returns {Uint8Array}
|
|
221
221
|
*/
|
|
222
222
|
function verify_ed25519(data) {
|
|
223
|
-
const ptr0 = passArray8ToWasm0(data, wasm$
|
|
223
|
+
const ptr0 = passArray8ToWasm0(data, wasm$1.__wbindgen_malloc);
|
|
224
224
|
const len0 = WASM_VECTOR_LEN;
|
|
225
|
-
const ret = wasm$
|
|
225
|
+
const ret = wasm$1.verify_ed25519(ptr0, len0);
|
|
226
226
|
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
227
|
-
wasm$
|
|
227
|
+
wasm$1.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
228
228
|
return v2;
|
|
229
229
|
}
|
|
230
230
|
/**
|
|
@@ -238,9 +238,9 @@ function verify_ed25519(data) {
|
|
|
238
238
|
* @returns {boolean}
|
|
239
239
|
*/
|
|
240
240
|
function verify_ed25519_batch(data) {
|
|
241
|
-
const ptr0 = passArray8ToWasm0(data, wasm$
|
|
241
|
+
const ptr0 = passArray8ToWasm0(data, wasm$1.__wbindgen_malloc);
|
|
242
242
|
const len0 = WASM_VECTOR_LEN;
|
|
243
|
-
return wasm$
|
|
243
|
+
return wasm$1.verify_ed25519_batch(ptr0, len0) !== 0;
|
|
244
244
|
}
|
|
245
245
|
async function __wbg_load$1(module, imports) {
|
|
246
246
|
if (typeof Response === "function" && module instanceof Response) {
|
|
@@ -265,7 +265,7 @@ function __wbg_get_imports$1() {
|
|
|
265
265
|
const imports = {};
|
|
266
266
|
imports.wbg = {};
|
|
267
267
|
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
268
|
-
const table = wasm$
|
|
268
|
+
const table = wasm$1.__wbindgen_export_0;
|
|
269
269
|
const offset = table.grow(4);
|
|
270
270
|
table.set(0, void 0);
|
|
271
271
|
table.set(offset + 0, void 0);
|
|
@@ -277,14 +277,14 @@ function __wbg_get_imports$1() {
|
|
|
277
277
|
}
|
|
278
278
|
function __wbg_init_memory$1(imports, memory) {}
|
|
279
279
|
function __wbg_finalize_init$1(instance, module) {
|
|
280
|
-
wasm$
|
|
280
|
+
wasm$1 = instance.exports;
|
|
281
281
|
__wbg_init$1.__wbindgen_wasm_module = module;
|
|
282
282
|
cachedUint8ArrayMemory0$1 = null;
|
|
283
|
-
wasm$
|
|
284
|
-
return wasm$
|
|
283
|
+
wasm$1.__wbindgen_start();
|
|
284
|
+
return wasm$1;
|
|
285
285
|
}
|
|
286
286
|
function initSync$1(module) {
|
|
287
|
-
if (wasm$
|
|
287
|
+
if (wasm$1 !== void 0) return wasm$1;
|
|
288
288
|
if (typeof module !== "undefined") if (Object.getPrototypeOf(module) === Object.prototype) ({module} = module);
|
|
289
289
|
else console.warn("using deprecated parameters for `initSync()`; pass a single object instead");
|
|
290
290
|
const imports = __wbg_get_imports$1();
|
|
@@ -294,7 +294,7 @@ function initSync$1(module) {
|
|
|
294
294
|
return __wbg_finalize_init$1(instance, module);
|
|
295
295
|
}
|
|
296
296
|
async function __wbg_init$1(module_or_path) {
|
|
297
|
-
if (wasm$
|
|
297
|
+
if (wasm$1 !== void 0) return wasm$1;
|
|
298
298
|
if (typeof module_or_path !== "undefined") if (Object.getPrototypeOf(module_or_path) === Object.prototype) ({module_or_path} = module_or_path);
|
|
299
299
|
else console.warn("using deprecated parameters for the initialization function; pass a single object instead");
|
|
300
300
|
if (typeof module_or_path === "undefined") module_or_path = new URL("ed25519_wasm_bg.wasm", import.meta.url);
|
|
@@ -316,7 +316,7 @@ __export(reed_solomon_wasm_exports, {
|
|
|
316
316
|
encode: () => encode,
|
|
317
317
|
initSync: () => initSync
|
|
318
318
|
});
|
|
319
|
-
let wasm
|
|
319
|
+
let wasm;
|
|
320
320
|
const heap = new Array(128).fill(void 0);
|
|
321
321
|
heap.push(void 0, null, true, false);
|
|
322
322
|
let heap_next = heap.length;
|
|
@@ -349,7 +349,7 @@ const cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("
|
|
|
349
349
|
if (typeof TextDecoder !== "undefined") cachedTextDecoder.decode();
|
|
350
350
|
let cachedUint8ArrayMemory0 = null;
|
|
351
351
|
function getUint8ArrayMemory0() {
|
|
352
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) cachedUint8ArrayMemory0 = new Uint8Array(wasm
|
|
352
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
353
353
|
return cachedUint8ArrayMemory0;
|
|
354
354
|
}
|
|
355
355
|
function getStringFromWasm0(ptr, len) {
|
|
@@ -365,7 +365,7 @@ function _assertClass(instance, klass) {
|
|
|
365
365
|
}
|
|
366
366
|
let cachedDataViewMemory0 = null;
|
|
367
367
|
function getDataViewMemory0() {
|
|
368
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm
|
|
368
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
369
369
|
return cachedDataViewMemory0;
|
|
370
370
|
}
|
|
371
371
|
/**
|
|
@@ -375,16 +375,16 @@ function getDataViewMemory0() {
|
|
|
375
375
|
*/
|
|
376
376
|
function encode(recovery_count, shards) {
|
|
377
377
|
try {
|
|
378
|
-
const retptr = wasm
|
|
378
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
379
379
|
_assertClass(shards, ShardsCollection);
|
|
380
380
|
var ptr0 = shards.__destroy_into_raw();
|
|
381
|
-
wasm
|
|
381
|
+
wasm.encode(retptr, recovery_count, ptr0);
|
|
382
382
|
var r0 = getDataViewMemory0().getInt32(retptr + 0, true);
|
|
383
383
|
var r1 = getDataViewMemory0().getInt32(retptr + 4, true);
|
|
384
384
|
if (getDataViewMemory0().getInt32(retptr + 8, true)) throw takeObject(r1);
|
|
385
385
|
return ShardsCollection.__wrap(r0);
|
|
386
386
|
} finally {
|
|
387
|
-
wasm
|
|
387
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
/**
|
|
@@ -395,22 +395,22 @@ function encode(recovery_count, shards) {
|
|
|
395
395
|
*/
|
|
396
396
|
function decode(original_count, recovery_count, shards) {
|
|
397
397
|
try {
|
|
398
|
-
const retptr = wasm
|
|
398
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
399
399
|
_assertClass(shards, ShardsCollection);
|
|
400
400
|
var ptr0 = shards.__destroy_into_raw();
|
|
401
|
-
wasm
|
|
401
|
+
wasm.decode(retptr, original_count, recovery_count, ptr0);
|
|
402
402
|
var r0 = getDataViewMemory0().getInt32(retptr + 0, true);
|
|
403
403
|
var r1 = getDataViewMemory0().getInt32(retptr + 4, true);
|
|
404
404
|
if (getDataViewMemory0().getInt32(retptr + 8, true)) throw takeObject(r1);
|
|
405
405
|
return ShardsCollection.__wrap(r0);
|
|
406
406
|
} finally {
|
|
407
|
-
wasm
|
|
407
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
410
|
const ShardsCollectionFinalization = typeof FinalizationRegistry === "undefined" ? {
|
|
411
411
|
register: () => {},
|
|
412
412
|
unregister: () => {}
|
|
413
|
-
} : new FinalizationRegistry((ptr) => wasm
|
|
413
|
+
} : new FinalizationRegistry((ptr) => wasm.__wbg_shardscollection_free(ptr >>> 0, 1));
|
|
414
414
|
/**
|
|
415
415
|
* Collection of shards (either input or output).
|
|
416
416
|
*
|
|
@@ -443,35 +443,35 @@ var ShardsCollection = class ShardsCollection {
|
|
|
443
443
|
}
|
|
444
444
|
free() {
|
|
445
445
|
const ptr = this.__destroy_into_raw();
|
|
446
|
-
wasm
|
|
446
|
+
wasm.__wbg_shardscollection_free(ptr, 0);
|
|
447
447
|
}
|
|
448
448
|
/**
|
|
449
449
|
* Number of shards within the collection.
|
|
450
450
|
* @returns {number}
|
|
451
451
|
*/
|
|
452
452
|
get length() {
|
|
453
|
-
return wasm
|
|
453
|
+
return wasm.__wbg_get_shardscollection_length(this.__wbg_ptr) >>> 0;
|
|
454
454
|
}
|
|
455
455
|
/**
|
|
456
456
|
* Number of shards within the collection.
|
|
457
457
|
* @param {number} arg0
|
|
458
458
|
*/
|
|
459
459
|
set length(arg0) {
|
|
460
|
-
wasm
|
|
460
|
+
wasm.__wbg_set_shardscollection_length(this.__wbg_ptr, arg0);
|
|
461
461
|
}
|
|
462
462
|
/**
|
|
463
463
|
* The length of each shard.
|
|
464
464
|
* @returns {number}
|
|
465
465
|
*/
|
|
466
466
|
get shard_len() {
|
|
467
|
-
return wasm
|
|
467
|
+
return wasm.__wbg_get_shardscollection_shard_len(this.__wbg_ptr);
|
|
468
468
|
}
|
|
469
469
|
/**
|
|
470
470
|
* The length of each shard.
|
|
471
471
|
* @param {number} arg0
|
|
472
472
|
*/
|
|
473
473
|
set shard_len(arg0) {
|
|
474
|
-
wasm
|
|
474
|
+
wasm.__wbg_set_shardscollection_shard_len(this.__wbg_ptr, arg0);
|
|
475
475
|
}
|
|
476
476
|
/**
|
|
477
477
|
* @param {number} shard_len
|
|
@@ -479,7 +479,7 @@ var ShardsCollection = class ShardsCollection {
|
|
|
479
479
|
* @param {Uint16Array | undefined} [indices]
|
|
480
480
|
*/
|
|
481
481
|
constructor(shard_len, data, indices) {
|
|
482
|
-
this.__wbg_ptr = wasm
|
|
482
|
+
this.__wbg_ptr = wasm.shardscollection_new(shard_len, addHeapObject(data), isLikeNone(indices) ? 0 : addHeapObject(indices)) >>> 0;
|
|
483
483
|
ShardsCollectionFinalization.register(this, this.__wbg_ptr, this);
|
|
484
484
|
return this;
|
|
485
485
|
}
|
|
@@ -491,7 +491,7 @@ var ShardsCollection = class ShardsCollection {
|
|
|
491
491
|
* @returns {Uint16Array | undefined}
|
|
492
492
|
*/
|
|
493
493
|
take_indices() {
|
|
494
|
-
const ret = wasm
|
|
494
|
+
const ret = wasm.shardscollection_take_indices(this.__wbg_ptr);
|
|
495
495
|
return takeObject(ret);
|
|
496
496
|
}
|
|
497
497
|
/**
|
|
@@ -503,7 +503,7 @@ var ShardsCollection = class ShardsCollection {
|
|
|
503
503
|
*/
|
|
504
504
|
take_data() {
|
|
505
505
|
const ptr = this.__destroy_into_raw();
|
|
506
|
-
const ret = wasm
|
|
506
|
+
const ret = wasm.shardscollection_take_data(ptr);
|
|
507
507
|
return takeObject(ret);
|
|
508
508
|
}
|
|
509
509
|
};
|
|
@@ -530,7 +530,7 @@ function __wbg_get_imports() {
|
|
|
530
530
|
const imports = {};
|
|
531
531
|
imports.wbg = {};
|
|
532
532
|
imports.wbg.__wbindgen_memory = function() {
|
|
533
|
-
const ret = wasm
|
|
533
|
+
const ret = wasm.memory;
|
|
534
534
|
return addHeapObject(ret);
|
|
535
535
|
};
|
|
536
536
|
imports.wbg.__wbg_buffer_b7b08af79b0b0974 = function(arg0) {
|
|
@@ -579,14 +579,14 @@ function __wbg_get_imports() {
|
|
|
579
579
|
}
|
|
580
580
|
function __wbg_init_memory(imports, memory) {}
|
|
581
581
|
function __wbg_finalize_init(instance, module) {
|
|
582
|
-
wasm
|
|
582
|
+
wasm = instance.exports;
|
|
583
583
|
__wbg_init.__wbindgen_wasm_module = module;
|
|
584
584
|
cachedDataViewMemory0 = null;
|
|
585
585
|
cachedUint8ArrayMemory0 = null;
|
|
586
|
-
return wasm
|
|
586
|
+
return wasm;
|
|
587
587
|
}
|
|
588
588
|
function initSync(module) {
|
|
589
|
-
if (wasm
|
|
589
|
+
if (wasm !== void 0) return wasm;
|
|
590
590
|
if (typeof module !== "undefined" && Object.getPrototypeOf(module) === Object.prototype) ({module} = module);
|
|
591
591
|
else console.warn("using deprecated parameters for `initSync()`; pass a single object instead");
|
|
592
592
|
const imports = __wbg_get_imports();
|
|
@@ -596,7 +596,7 @@ function initSync(module) {
|
|
|
596
596
|
return __wbg_finalize_init(instance, module);
|
|
597
597
|
}
|
|
598
598
|
async function __wbg_init(module_or_path) {
|
|
599
|
-
if (wasm
|
|
599
|
+
if (wasm !== void 0) return wasm;
|
|
600
600
|
if (typeof module_or_path !== "undefined" && Object.getPrototypeOf(module_or_path) === Object.prototype) ({module_or_path} = module_or_path);
|
|
601
601
|
else console.warn("using deprecated parameters for the initialization function; pass a single object instead");
|
|
602
602
|
if (typeof module_or_path === "undefined") module_or_path = new URL("reed_solomon_wasm_bg.wasm", import.meta.url);
|
|
@@ -662,11 +662,16 @@ function reed_solomon_wasm_bg_default(imports) {
|
|
|
662
662
|
|
|
663
663
|
//#endregion
|
|
664
664
|
//#region native/index.ts
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
665
|
+
async function initAll() {
|
|
666
|
+
await init.bandersnatch();
|
|
667
|
+
await init.ed25519();
|
|
668
|
+
await init.reedSolomon();
|
|
669
|
+
}
|
|
670
|
+
const init = {
|
|
671
|
+
bandersnatch: async () => await bandersnatch_default(await bandersnatch_bg_default()),
|
|
672
|
+
ed25519: async () => await ed25519_wasm_default(await ed25519_wasm_bg_default()),
|
|
673
|
+
reedSolomon: async () => await reed_solomon_wasm_default(await reed_solomon_wasm_bg_default())
|
|
669
674
|
};
|
|
670
675
|
|
|
671
676
|
//#endregion
|
|
672
|
-
export { bandersnatch_exports as bandersnatch, ed25519_wasm_exports as ed25519, reed_solomon_wasm_exports as reedSolomon
|
|
677
|
+
export { bandersnatch_exports as bandersnatch, ed25519_wasm_exports as ed25519, init, initAll, reed_solomon_wasm_exports as reedSolomon };
|