@totemsdk/omnia-vtxo 0.1.0 → 0.2.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/dist/commitment.js +4 -5
- package/package.json +15 -21
- package/rust/pkg/omnia_vtxo_wasm.d.ts +20 -0
- package/rust/pkg/omnia_vtxo_wasm.js +9 -0
- package/rust/pkg/omnia_vtxo_wasm_bg.js +562 -0
- package/rust/pkg/omnia_vtxo_wasm_bg.wasm +0 -0
- package/rust/pkg/omnia_vtxo_wasm_bg.wasm.d.ts +20 -0
- package/rust/pkg/package.json +27 -0
- package/rust/pkg-node/omnia_vtxo_wasm.d.ts +20 -0
- package/rust/pkg-node/omnia_vtxo_wasm.js +576 -0
- package/rust/pkg-node/omnia_vtxo_wasm_bg.wasm +0 -0
- package/rust/pkg-node/omnia_vtxo_wasm_bg.wasm.d.ts +20 -0
- package/rust/pkg-node/package.json +21 -0
package/dist/commitment.js
CHANGED
|
@@ -7,18 +7,17 @@ exports.computeCommitmentRoot = computeCommitmentRoot;
|
|
|
7
7
|
exports.verifyMerkleProof = verifyMerkleProof;
|
|
8
8
|
exports.buildVtxoProofSet = buildVtxoProofSet;
|
|
9
9
|
exports.computeReceiptId = computeReceiptId;
|
|
10
|
-
const
|
|
11
|
-
const utils_1 = require("@noble/hashes/utils");
|
|
10
|
+
const core_1 = require("@totemsdk/core");
|
|
12
11
|
const constants_js_1 = require("./constants.js");
|
|
13
12
|
function sha3hex(input) {
|
|
14
13
|
const bytes = new TextEncoder().encode(input);
|
|
15
|
-
return (0,
|
|
14
|
+
return (0, core_1.bytesToHex)((0, core_1.sha3_256)(bytes));
|
|
16
15
|
}
|
|
17
16
|
function hashPair(a, b) {
|
|
18
17
|
const [left, right] = a <= b ? [a, b] : [b, a];
|
|
19
18
|
const combined = left + right;
|
|
20
|
-
const bytes = (0,
|
|
21
|
-
return (0,
|
|
19
|
+
const bytes = (0, core_1.hexToBytes)(combined);
|
|
20
|
+
return (0, core_1.bytesToHex)((0, core_1.sha3_256)(bytes));
|
|
22
21
|
}
|
|
23
22
|
function computeVtxoLeaf(vtxo) {
|
|
24
23
|
const input = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@totemsdk/omnia-vtxo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Virtual UTXO / payment-pool claim layer for Omnia — cash-like off-chain balance primitive for Totem Edge",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -13,26 +13,20 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"dist",
|
|
16
|
+
"rust/pkg/",
|
|
17
|
+
"rust/pkg-node/",
|
|
16
18
|
"README.md",
|
|
17
19
|
"LICENSE"
|
|
18
20
|
],
|
|
19
21
|
"dependencies": {
|
|
20
|
-
"@
|
|
21
|
-
},
|
|
22
|
-
"peerDependencies": {
|
|
23
|
-
"@noble/hashes": "^1.0.0"
|
|
24
|
-
},
|
|
25
|
-
"peerDependenciesMeta": {
|
|
26
|
-
"@noble/hashes": {
|
|
27
|
-
"optional": false
|
|
28
|
-
}
|
|
22
|
+
"@totemsdk/core": "^1.2.9"
|
|
29
23
|
},
|
|
30
24
|
"devDependencies": {
|
|
31
|
-
"@types/jest": "^
|
|
25
|
+
"@types/jest": "^30.0.0",
|
|
32
26
|
"@types/node": "^20.0.0",
|
|
33
|
-
"jest": "^
|
|
27
|
+
"jest": "^30.4.2",
|
|
34
28
|
"ts-jest": "^29.0.0",
|
|
35
|
-
"typescript": "^
|
|
29
|
+
"typescript": "^7.0.2"
|
|
36
30
|
},
|
|
37
31
|
"engines": {
|
|
38
32
|
"node": ">=18.0.0"
|
|
@@ -42,14 +36,14 @@
|
|
|
42
36
|
},
|
|
43
37
|
"license": "MIT",
|
|
44
38
|
"author": "Totem SDK",
|
|
45
|
-
"homepage": "https://
|
|
39
|
+
"homepage": "https://docs.totem.ing",
|
|
46
40
|
"bugs": {
|
|
47
|
-
"url": "https://github.com/
|
|
41
|
+
"url": "https://github.com/Totem-Edge/totem-sdk/issues"
|
|
48
42
|
},
|
|
49
43
|
"repository": {
|
|
50
44
|
"type": "git",
|
|
51
|
-
"url": "git+https://github.com/
|
|
52
|
-
"directory": "packages/
|
|
45
|
+
"url": "git+https://github.com/Totem-Edge/totem-sdk.git",
|
|
46
|
+
"directory": "packages/omnia-vtxo"
|
|
53
47
|
},
|
|
54
48
|
"keywords": [
|
|
55
49
|
"totem",
|
|
@@ -58,7 +52,6 @@
|
|
|
58
52
|
"blockchain",
|
|
59
53
|
"quantum-resistant",
|
|
60
54
|
"wots",
|
|
61
|
-
"kissvm",
|
|
62
55
|
"utxo",
|
|
63
56
|
"omnia",
|
|
64
57
|
"vtxo",
|
|
@@ -69,8 +62,9 @@
|
|
|
69
62
|
"ark"
|
|
70
63
|
],
|
|
71
64
|
"scripts": {
|
|
72
|
-
"build": "tsc",
|
|
73
|
-
"clean": "rm -rf dist",
|
|
74
|
-
"test": "
|
|
65
|
+
"build": "npm run build:wasm && tsc && node ../../scripts/clean-wasm-output-ignores.mjs",
|
|
66
|
+
"clean": "rm -rf dist rust/pkg rust/pkg-node rust/target",
|
|
67
|
+
"test": "jest",
|
|
68
|
+
"build:wasm": "cd rust && wasm-pack build --target bundler --out-dir pkg && wasm-pack build --target nodejs --out-dir pkg-node"
|
|
75
69
|
}
|
|
76
70
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export function compute_commitment_root_wasm(leaves_js: any): string;
|
|
5
|
+
|
|
6
|
+
export function compute_pool_id_wasm(operator: string, token_id: string, nonce: string): string;
|
|
7
|
+
|
|
8
|
+
export function compute_vtxo_id_wasm(pool_id: string, owner: string, amount: string, token_id: string, nonce: string): string;
|
|
9
|
+
|
|
10
|
+
export function init(): void;
|
|
11
|
+
|
|
12
|
+
export function sha3_hex_wasm(data: Uint8Array): string;
|
|
13
|
+
|
|
14
|
+
export function verify_conservation_wasm(inputs_js: any, outputs_js: any, mode: string): any;
|
|
15
|
+
|
|
16
|
+
export function verify_merkle_proof_wasm(leaf: Uint8Array, proof_js: any, root: string, leaf_index: number): boolean;
|
|
17
|
+
|
|
18
|
+
export function verify_vtxo_proof_wasm(vtxo_js: any, commitment_root: string): any;
|
|
19
|
+
|
|
20
|
+
export function verify_vtxo_wasm(vtxo_js: any): any;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./omnia_vtxo_wasm.d.ts" */
|
|
2
|
+
import * as wasm from "./omnia_vtxo_wasm_bg.wasm";
|
|
3
|
+
import { __wbg_set_wasm } from "./omnia_vtxo_wasm_bg.js";
|
|
4
|
+
|
|
5
|
+
__wbg_set_wasm(wasm);
|
|
6
|
+
wasm.__wbindgen_start();
|
|
7
|
+
export {
|
|
8
|
+
compute_commitment_root_wasm, compute_pool_id_wasm, compute_vtxo_id_wasm, init, sha3_hex_wasm, verify_conservation_wasm, verify_merkle_proof_wasm, verify_vtxo_proof_wasm, verify_vtxo_wasm
|
|
9
|
+
} from "./omnia_vtxo_wasm_bg.js";
|
|
@@ -0,0 +1,562 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {any} leaves_js
|
|
3
|
+
* @returns {string}
|
|
4
|
+
*/
|
|
5
|
+
export function compute_commitment_root_wasm(leaves_js) {
|
|
6
|
+
let deferred2_0;
|
|
7
|
+
let deferred2_1;
|
|
8
|
+
try {
|
|
9
|
+
const ret = wasm.compute_commitment_root_wasm(leaves_js);
|
|
10
|
+
var ptr1 = ret[0];
|
|
11
|
+
var len1 = ret[1];
|
|
12
|
+
if (ret[3]) {
|
|
13
|
+
ptr1 = 0; len1 = 0;
|
|
14
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
15
|
+
}
|
|
16
|
+
deferred2_0 = ptr1;
|
|
17
|
+
deferred2_1 = len1;
|
|
18
|
+
return getStringFromWasm0(ptr1, len1);
|
|
19
|
+
} finally {
|
|
20
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param {string} operator
|
|
26
|
+
* @param {string} token_id
|
|
27
|
+
* @param {string} nonce
|
|
28
|
+
* @returns {string}
|
|
29
|
+
*/
|
|
30
|
+
export function compute_pool_id_wasm(operator, token_id, nonce) {
|
|
31
|
+
let deferred4_0;
|
|
32
|
+
let deferred4_1;
|
|
33
|
+
try {
|
|
34
|
+
const ptr0 = passStringToWasm0(operator, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
35
|
+
const len0 = WASM_VECTOR_LEN;
|
|
36
|
+
const ptr1 = passStringToWasm0(token_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
37
|
+
const len1 = WASM_VECTOR_LEN;
|
|
38
|
+
const ptr2 = passStringToWasm0(nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
39
|
+
const len2 = WASM_VECTOR_LEN;
|
|
40
|
+
const ret = wasm.compute_pool_id_wasm(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
41
|
+
deferred4_0 = ret[0];
|
|
42
|
+
deferred4_1 = ret[1];
|
|
43
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
44
|
+
} finally {
|
|
45
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @param {string} pool_id
|
|
51
|
+
* @param {string} owner
|
|
52
|
+
* @param {string} amount
|
|
53
|
+
* @param {string} token_id
|
|
54
|
+
* @param {string} nonce
|
|
55
|
+
* @returns {string}
|
|
56
|
+
*/
|
|
57
|
+
export function compute_vtxo_id_wasm(pool_id, owner, amount, token_id, nonce) {
|
|
58
|
+
let deferred6_0;
|
|
59
|
+
let deferred6_1;
|
|
60
|
+
try {
|
|
61
|
+
const ptr0 = passStringToWasm0(pool_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
62
|
+
const len0 = WASM_VECTOR_LEN;
|
|
63
|
+
const ptr1 = passStringToWasm0(owner, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
64
|
+
const len1 = WASM_VECTOR_LEN;
|
|
65
|
+
const ptr2 = passStringToWasm0(amount, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
66
|
+
const len2 = WASM_VECTOR_LEN;
|
|
67
|
+
const ptr3 = passStringToWasm0(token_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
68
|
+
const len3 = WASM_VECTOR_LEN;
|
|
69
|
+
const ptr4 = passStringToWasm0(nonce, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
70
|
+
const len4 = WASM_VECTOR_LEN;
|
|
71
|
+
const ret = wasm.compute_vtxo_id_wasm(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
|
|
72
|
+
deferred6_0 = ret[0];
|
|
73
|
+
deferred6_1 = ret[1];
|
|
74
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
75
|
+
} finally {
|
|
76
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function init() {
|
|
81
|
+
wasm.init();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @param {Uint8Array} data
|
|
86
|
+
* @returns {string}
|
|
87
|
+
*/
|
|
88
|
+
export function sha3_hex_wasm(data) {
|
|
89
|
+
let deferred2_0;
|
|
90
|
+
let deferred2_1;
|
|
91
|
+
try {
|
|
92
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
93
|
+
const len0 = WASM_VECTOR_LEN;
|
|
94
|
+
const ret = wasm.sha3_hex_wasm(ptr0, len0);
|
|
95
|
+
deferred2_0 = ret[0];
|
|
96
|
+
deferred2_1 = ret[1];
|
|
97
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
98
|
+
} finally {
|
|
99
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @param {any} inputs_js
|
|
105
|
+
* @param {any} outputs_js
|
|
106
|
+
* @param {string} mode
|
|
107
|
+
* @returns {any}
|
|
108
|
+
*/
|
|
109
|
+
export function verify_conservation_wasm(inputs_js, outputs_js, mode) {
|
|
110
|
+
const ptr0 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
111
|
+
const len0 = WASM_VECTOR_LEN;
|
|
112
|
+
const ret = wasm.verify_conservation_wasm(inputs_js, outputs_js, ptr0, len0);
|
|
113
|
+
if (ret[2]) {
|
|
114
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
115
|
+
}
|
|
116
|
+
return takeFromExternrefTable0(ret[0]);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @param {Uint8Array} leaf
|
|
121
|
+
* @param {any} proof_js
|
|
122
|
+
* @param {string} root
|
|
123
|
+
* @param {number} leaf_index
|
|
124
|
+
* @returns {boolean}
|
|
125
|
+
*/
|
|
126
|
+
export function verify_merkle_proof_wasm(leaf, proof_js, root, leaf_index) {
|
|
127
|
+
const ptr0 = passArray8ToWasm0(leaf, wasm.__wbindgen_malloc);
|
|
128
|
+
const len0 = WASM_VECTOR_LEN;
|
|
129
|
+
const ptr1 = passStringToWasm0(root, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
130
|
+
const len1 = WASM_VECTOR_LEN;
|
|
131
|
+
const ret = wasm.verify_merkle_proof_wasm(ptr0, len0, proof_js, ptr1, len1, leaf_index);
|
|
132
|
+
if (ret[2]) {
|
|
133
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
134
|
+
}
|
|
135
|
+
return ret[0] !== 0;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @param {any} vtxo_js
|
|
140
|
+
* @param {string} commitment_root
|
|
141
|
+
* @returns {any}
|
|
142
|
+
*/
|
|
143
|
+
export function verify_vtxo_proof_wasm(vtxo_js, commitment_root) {
|
|
144
|
+
const ptr0 = passStringToWasm0(commitment_root, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
145
|
+
const len0 = WASM_VECTOR_LEN;
|
|
146
|
+
const ret = wasm.verify_vtxo_proof_wasm(vtxo_js, ptr0, len0);
|
|
147
|
+
if (ret[2]) {
|
|
148
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
149
|
+
}
|
|
150
|
+
return takeFromExternrefTable0(ret[0]);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @param {any} vtxo_js
|
|
155
|
+
* @returns {any}
|
|
156
|
+
*/
|
|
157
|
+
export function verify_vtxo_wasm(vtxo_js) {
|
|
158
|
+
const ret = wasm.verify_vtxo_wasm(vtxo_js);
|
|
159
|
+
if (ret[2]) {
|
|
160
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
161
|
+
}
|
|
162
|
+
return takeFromExternrefTable0(ret[0]);
|
|
163
|
+
}
|
|
164
|
+
export function __wbg_Error_92b29b0548f8b746(arg0, arg1) {
|
|
165
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
166
|
+
return ret;
|
|
167
|
+
}
|
|
168
|
+
export function __wbg_Number_9a4e0ecb0fa16705(arg0) {
|
|
169
|
+
const ret = Number(arg0);
|
|
170
|
+
return ret;
|
|
171
|
+
}
|
|
172
|
+
export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
173
|
+
const ret = String(arg1);
|
|
174
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
175
|
+
const len1 = WASM_VECTOR_LEN;
|
|
176
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
177
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
178
|
+
}
|
|
179
|
+
export function __wbg___wbindgen_bigint_get_as_i64_d968e41184ae354f(arg0, arg1) {
|
|
180
|
+
const v = arg1;
|
|
181
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
182
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
183
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
184
|
+
}
|
|
185
|
+
export function __wbg___wbindgen_boolean_get_fa956cfa2d1bd751(arg0) {
|
|
186
|
+
const v = arg0;
|
|
187
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
188
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
189
|
+
}
|
|
190
|
+
export function __wbg___wbindgen_debug_string_c25d447a39f5578f(arg0, arg1) {
|
|
191
|
+
const ret = debugString(arg1);
|
|
192
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
193
|
+
const len1 = WASM_VECTOR_LEN;
|
|
194
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
195
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
196
|
+
}
|
|
197
|
+
export function __wbg___wbindgen_in_aca499c5de7ff5e5(arg0, arg1) {
|
|
198
|
+
const ret = arg0 in arg1;
|
|
199
|
+
return ret;
|
|
200
|
+
}
|
|
201
|
+
export function __wbg___wbindgen_is_bigint_2f76dc55065b4273(arg0) {
|
|
202
|
+
const ret = typeof(arg0) === 'bigint';
|
|
203
|
+
return ret;
|
|
204
|
+
}
|
|
205
|
+
export function __wbg___wbindgen_is_function_1ff95bcc5517c252(arg0) {
|
|
206
|
+
const ret = typeof(arg0) === 'function';
|
|
207
|
+
return ret;
|
|
208
|
+
}
|
|
209
|
+
export function __wbg___wbindgen_is_object_a27215656b807791(arg0) {
|
|
210
|
+
const val = arg0;
|
|
211
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
212
|
+
return ret;
|
|
213
|
+
}
|
|
214
|
+
export function __wbg___wbindgen_is_undefined_c05833b95a3cf397(arg0) {
|
|
215
|
+
const ret = arg0 === undefined;
|
|
216
|
+
return ret;
|
|
217
|
+
}
|
|
218
|
+
export function __wbg___wbindgen_jsval_eq_e659fcf7b0e32763(arg0, arg1) {
|
|
219
|
+
const ret = arg0 === arg1;
|
|
220
|
+
return ret;
|
|
221
|
+
}
|
|
222
|
+
export function __wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170(arg0, arg1) {
|
|
223
|
+
const ret = arg0 == arg1;
|
|
224
|
+
return ret;
|
|
225
|
+
}
|
|
226
|
+
export function __wbg___wbindgen_number_get_394265ed1e1b84ee(arg0, arg1) {
|
|
227
|
+
const obj = arg1;
|
|
228
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
229
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
230
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
231
|
+
}
|
|
232
|
+
export function __wbg___wbindgen_string_get_b0ca35b86a603356(arg0, arg1) {
|
|
233
|
+
const obj = arg1;
|
|
234
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
235
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
236
|
+
var len1 = WASM_VECTOR_LEN;
|
|
237
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
238
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
239
|
+
}
|
|
240
|
+
export function __wbg___wbindgen_throw_344f42d3211c4765(arg0, arg1) {
|
|
241
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
242
|
+
}
|
|
243
|
+
export function __wbg_call_8a2dd23819f8a60a() { return handleError(function (arg0, arg1) {
|
|
244
|
+
const ret = arg0.call(arg1);
|
|
245
|
+
return ret;
|
|
246
|
+
}, arguments); }
|
|
247
|
+
export function __wbg_done_89b2b13e91a60321(arg0) {
|
|
248
|
+
const ret = arg0.done;
|
|
249
|
+
return ret;
|
|
250
|
+
}
|
|
251
|
+
export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
|
|
252
|
+
let deferred0_0;
|
|
253
|
+
let deferred0_1;
|
|
254
|
+
try {
|
|
255
|
+
deferred0_0 = arg0;
|
|
256
|
+
deferred0_1 = arg1;
|
|
257
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
258
|
+
} finally {
|
|
259
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
export function __wbg_get_c7eb1f358a7654df() { return handleError(function (arg0, arg1) {
|
|
263
|
+
const ret = Reflect.get(arg0, arg1);
|
|
264
|
+
return ret;
|
|
265
|
+
}, arguments); }
|
|
266
|
+
export function __wbg_get_unchecked_6e0ad6d2a41b06f6(arg0, arg1) {
|
|
267
|
+
const ret = arg0[arg1 >>> 0];
|
|
268
|
+
return ret;
|
|
269
|
+
}
|
|
270
|
+
export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
|
|
271
|
+
const ret = arg0[arg1];
|
|
272
|
+
return ret;
|
|
273
|
+
}
|
|
274
|
+
export function __wbg_instanceof_ArrayBuffer_4480b9e0068a8adb(arg0) {
|
|
275
|
+
let result;
|
|
276
|
+
try {
|
|
277
|
+
result = arg0 instanceof ArrayBuffer;
|
|
278
|
+
} catch (_) {
|
|
279
|
+
result = false;
|
|
280
|
+
}
|
|
281
|
+
const ret = result;
|
|
282
|
+
return ret;
|
|
283
|
+
}
|
|
284
|
+
export function __wbg_instanceof_Uint8Array_309b927aaf7a3fc7(arg0) {
|
|
285
|
+
let result;
|
|
286
|
+
try {
|
|
287
|
+
result = arg0 instanceof Uint8Array;
|
|
288
|
+
} catch (_) {
|
|
289
|
+
result = false;
|
|
290
|
+
}
|
|
291
|
+
const ret = result;
|
|
292
|
+
return ret;
|
|
293
|
+
}
|
|
294
|
+
export function __wbg_isArray_0677c962b281d01a(arg0) {
|
|
295
|
+
const ret = Array.isArray(arg0);
|
|
296
|
+
return ret;
|
|
297
|
+
}
|
|
298
|
+
export function __wbg_isSafeInteger_04f36e4056f1b851(arg0) {
|
|
299
|
+
const ret = Number.isSafeInteger(arg0);
|
|
300
|
+
return ret;
|
|
301
|
+
}
|
|
302
|
+
export function __wbg_iterator_6f722e4a93058b71() {
|
|
303
|
+
const ret = Symbol.iterator;
|
|
304
|
+
return ret;
|
|
305
|
+
}
|
|
306
|
+
export function __wbg_length_1f0964f4a5e2c6d8(arg0) {
|
|
307
|
+
const ret = arg0.length;
|
|
308
|
+
return ret;
|
|
309
|
+
}
|
|
310
|
+
export function __wbg_length_370319915dc99107(arg0) {
|
|
311
|
+
const ret = arg0.length;
|
|
312
|
+
return ret;
|
|
313
|
+
}
|
|
314
|
+
export function __wbg_new_227d7c05414eb861() {
|
|
315
|
+
const ret = new Error();
|
|
316
|
+
return ret;
|
|
317
|
+
}
|
|
318
|
+
export function __wbg_new_cd45aabdf6073e84(arg0) {
|
|
319
|
+
const ret = new Uint8Array(arg0);
|
|
320
|
+
return ret;
|
|
321
|
+
}
|
|
322
|
+
export function __wbg_new_da52cf8fe3429cb2() {
|
|
323
|
+
const ret = new Object();
|
|
324
|
+
return ret;
|
|
325
|
+
}
|
|
326
|
+
export function __wbg_next_6dbf2c0ac8cde20f(arg0) {
|
|
327
|
+
const ret = arg0.next;
|
|
328
|
+
return ret;
|
|
329
|
+
}
|
|
330
|
+
export function __wbg_next_71f2aa1cb3d1e37e() { return handleError(function (arg0) {
|
|
331
|
+
const ret = arg0.next();
|
|
332
|
+
return ret;
|
|
333
|
+
}, arguments); }
|
|
334
|
+
export function __wbg_prototypesetcall_4770620bbe4688a0(arg0, arg1, arg2) {
|
|
335
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
336
|
+
}
|
|
337
|
+
export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
|
|
338
|
+
arg0[arg1] = arg2;
|
|
339
|
+
}
|
|
340
|
+
export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
|
|
341
|
+
const ret = arg1.stack;
|
|
342
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
343
|
+
const len1 = WASM_VECTOR_LEN;
|
|
344
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
345
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
346
|
+
}
|
|
347
|
+
export function __wbg_value_a5d5488a9589444a(arg0) {
|
|
348
|
+
const ret = arg0.value;
|
|
349
|
+
return ret;
|
|
350
|
+
}
|
|
351
|
+
export function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
352
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
353
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
354
|
+
return ret;
|
|
355
|
+
}
|
|
356
|
+
export function __wbindgen_cast_0000000000000002(arg0) {
|
|
357
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
358
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
359
|
+
return ret;
|
|
360
|
+
}
|
|
361
|
+
export function __wbindgen_init_externref_table() {
|
|
362
|
+
const table = wasm.__wbindgen_externrefs;
|
|
363
|
+
const offset = table.grow(4);
|
|
364
|
+
table.set(0, undefined);
|
|
365
|
+
table.set(offset + 0, undefined);
|
|
366
|
+
table.set(offset + 1, null);
|
|
367
|
+
table.set(offset + 2, true);
|
|
368
|
+
table.set(offset + 3, false);
|
|
369
|
+
}
|
|
370
|
+
function addToExternrefTable0(obj) {
|
|
371
|
+
const idx = wasm.__externref_table_alloc();
|
|
372
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
373
|
+
return idx;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
function debugString(val) {
|
|
377
|
+
// primitive types
|
|
378
|
+
const type = typeof val;
|
|
379
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
380
|
+
return `${val}`;
|
|
381
|
+
}
|
|
382
|
+
if (type == 'string') {
|
|
383
|
+
return `"${val}"`;
|
|
384
|
+
}
|
|
385
|
+
if (type == 'symbol') {
|
|
386
|
+
const description = val.description;
|
|
387
|
+
if (description == null) {
|
|
388
|
+
return 'Symbol';
|
|
389
|
+
} else {
|
|
390
|
+
return `Symbol(${description})`;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
if (type == 'function') {
|
|
394
|
+
const name = val.name;
|
|
395
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
396
|
+
return `Function(${name})`;
|
|
397
|
+
} else {
|
|
398
|
+
return 'Function';
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
// objects
|
|
402
|
+
if (Array.isArray(val)) {
|
|
403
|
+
const length = val.length;
|
|
404
|
+
let debug = '[';
|
|
405
|
+
if (length > 0) {
|
|
406
|
+
debug += debugString(val[0]);
|
|
407
|
+
}
|
|
408
|
+
for(let i = 1; i < length; i++) {
|
|
409
|
+
debug += ', ' + debugString(val[i]);
|
|
410
|
+
}
|
|
411
|
+
debug += ']';
|
|
412
|
+
return debug;
|
|
413
|
+
}
|
|
414
|
+
// Test for built-in
|
|
415
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
416
|
+
let className;
|
|
417
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
418
|
+
className = builtInMatches[1];
|
|
419
|
+
} else {
|
|
420
|
+
// Failed to match the standard '[object ClassName]'
|
|
421
|
+
return toString.call(val);
|
|
422
|
+
}
|
|
423
|
+
if (className == 'Object') {
|
|
424
|
+
// we're a user defined class or Object
|
|
425
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
426
|
+
// easier than looping through ownProperties of `val`.
|
|
427
|
+
try {
|
|
428
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
429
|
+
} catch (_) {
|
|
430
|
+
return 'Object';
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
// errors
|
|
434
|
+
if (val instanceof Error) {
|
|
435
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
436
|
+
}
|
|
437
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
438
|
+
return className;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
442
|
+
ptr = ptr >>> 0;
|
|
443
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
let cachedDataViewMemory0 = null;
|
|
447
|
+
function getDataViewMemory0() {
|
|
448
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
449
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
450
|
+
}
|
|
451
|
+
return cachedDataViewMemory0;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
function getStringFromWasm0(ptr, len) {
|
|
455
|
+
return decodeText(ptr >>> 0, len);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
let cachedUint8ArrayMemory0 = null;
|
|
459
|
+
function getUint8ArrayMemory0() {
|
|
460
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
461
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
462
|
+
}
|
|
463
|
+
return cachedUint8ArrayMemory0;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
function handleError(f, args) {
|
|
467
|
+
try {
|
|
468
|
+
return f.apply(this, args);
|
|
469
|
+
} catch (e) {
|
|
470
|
+
const idx = addToExternrefTable0(e);
|
|
471
|
+
wasm.__wbindgen_exn_store(idx);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
function isLikeNone(x) {
|
|
476
|
+
return x === undefined || x === null;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
480
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
481
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
482
|
+
WASM_VECTOR_LEN = arg.length;
|
|
483
|
+
return ptr;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
487
|
+
if (realloc === undefined) {
|
|
488
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
489
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
490
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
491
|
+
WASM_VECTOR_LEN = buf.length;
|
|
492
|
+
return ptr;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
let len = arg.length;
|
|
496
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
497
|
+
|
|
498
|
+
const mem = getUint8ArrayMemory0();
|
|
499
|
+
|
|
500
|
+
let offset = 0;
|
|
501
|
+
|
|
502
|
+
for (; offset < len; offset++) {
|
|
503
|
+
const code = arg.charCodeAt(offset);
|
|
504
|
+
if (code > 0x7F) break;
|
|
505
|
+
mem[ptr + offset] = code;
|
|
506
|
+
}
|
|
507
|
+
if (offset !== len) {
|
|
508
|
+
if (offset !== 0) {
|
|
509
|
+
arg = arg.slice(offset);
|
|
510
|
+
}
|
|
511
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
512
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
513
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
514
|
+
|
|
515
|
+
offset += ret.written;
|
|
516
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
WASM_VECTOR_LEN = offset;
|
|
520
|
+
return ptr;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
function takeFromExternrefTable0(idx) {
|
|
524
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
525
|
+
wasm.__externref_table_dealloc(idx);
|
|
526
|
+
return value;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
530
|
+
cachedTextDecoder.decode();
|
|
531
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
532
|
+
let numBytesDecoded = 0;
|
|
533
|
+
function decodeText(ptr, len) {
|
|
534
|
+
numBytesDecoded += len;
|
|
535
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
536
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
537
|
+
cachedTextDecoder.decode();
|
|
538
|
+
numBytesDecoded = len;
|
|
539
|
+
}
|
|
540
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
const cachedTextEncoder = new TextEncoder();
|
|
544
|
+
|
|
545
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
546
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
547
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
548
|
+
view.set(buf);
|
|
549
|
+
return {
|
|
550
|
+
read: arg.length,
|
|
551
|
+
written: buf.length
|
|
552
|
+
};
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
let WASM_VECTOR_LEN = 0;
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
let wasm;
|
|
560
|
+
export function __wbg_set_wasm(val) {
|
|
561
|
+
wasm = val;
|
|
562
|
+
}
|
|
Binary file
|