bitmask-core 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,14 @@
1
+ This software is licensed under [Apache 2.0](LICENSE-APACHE) or
2
+ [MIT](LICENSE-MIT), at your option.
3
+
4
+ Some files retain their own copyright notice, however, for full authorship
5
+ information, see version control history.
6
+
7
+ Except as otherwise noted in individual files, all files in this repository are
8
+ licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
9
+ http://www.apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
10
+ http://opensource.org/licenses/MIT>, at your option.
11
+
12
+ You may not use, copy, modify, merge, publish, distribute, sublicense, and/or
13
+ sell copies of this software or any files in this repository except in
14
+ accordance with one or both of these licenses.
package/LICENSE-APACHE ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
package/LICENSE-MIT ADDED
@@ -0,0 +1,25 @@
1
+ Copyright (c) 2022 DIBA Global, Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any
4
+ person obtaining a copy of this software and associated
5
+ documentation files (the "Software"), to deal in the
6
+ Software without restriction, including without
7
+ limitation the rights to use, copy, modify, merge,
8
+ publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software
10
+ is furnished to do so, subject to the following
11
+ conditions:
12
+
13
+ The above copyright notice and this permission notice
14
+ shall be included in all copies or substantial portions
15
+ of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
18
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19
+ TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
20
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
21
+ SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
24
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
+ DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # BitMask Core
2
+
3
+ Core functionality for the BitMask wallet - <https://bitmask.app>
4
+
5
+ ## Uses
6
+
7
+ - [bdk](https://github.com/bitcoindevkit/bdk) - Bitcoin Dev Kit
8
+ - [gloo](https://github.com/rustwasm/gloo)
9
+ - [wasm-pack](https://github.com/rustwasm/wasm-pack)
10
+
11
+ ## Build
12
+
13
+ This should work with either wasm-pack, trunk, or x86-64.
14
+
15
+ Some environment variables may be needed in order to compile on macos-aarch64, for more, [see this](https://github.com/sapio-lang/sapio/issues/146#issuecomment-960659800).
16
+
17
+ ## Test
18
+
19
+ 1. Lint against wasm32: `cargo clippy --target wasm32-unknown-unknown`
20
+ 2. Run tests in browser: `wasm-pack test --headless --chrome`
@@ -0,0 +1,125 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * @param {string} password
5
+ * @returns {Promise<any>}
6
+ */
7
+ export function get_vault(password: string): Promise<any>;
8
+ /**
9
+ * @param {string} encryption_password
10
+ * @param {string} seed_password
11
+ * @returns {Promise<any>}
12
+ */
13
+ export function get_mnemonic_seed(encryption_password: string, seed_password: string): Promise<any>;
14
+ /**
15
+ * @param {string} mnemonic
16
+ * @param {string} encryption_password
17
+ * @param {string} seed_password
18
+ * @returns {Promise<any>}
19
+ */
20
+ export function save_mnemonic_seed(mnemonic: string, encryption_password: string, seed_password: string): Promise<any>;
21
+ /**
22
+ * @param {string} descriptor
23
+ * @param {string} change_descriptor
24
+ * @returns {Promise<any>}
25
+ */
26
+ export function get_wallet_data(descriptor: string, change_descriptor: string): Promise<any>;
27
+ /**
28
+ * @returns {Promise<any>}
29
+ */
30
+ export function import_list_assets(): Promise<any>;
31
+ /**
32
+ * @param {string} descriptor
33
+ * @param {string} change_descriptor
34
+ * @param {string | undefined} asset
35
+ * @param {string | undefined} genesis
36
+ * @returns {Promise<any>}
37
+ */
38
+ export function import_asset(descriptor: string, change_descriptor: string, asset?: string, genesis?: string): Promise<any>;
39
+ /**
40
+ * @returns {Promise<any>}
41
+ */
42
+ export function set_blinded_utxos(): Promise<any>;
43
+ /**
44
+ * @param {string} descriptor
45
+ * @param {string} change_descriptor
46
+ * @param {string} address
47
+ * @param {BigInt} amount
48
+ * @returns {Promise<any>}
49
+ */
50
+ export function send_sats(descriptor: string, change_descriptor: string, address: string, amount: BigInt): Promise<any>;
51
+ /**
52
+ * @param {string} descriptor
53
+ * @param {string} change_descriptor
54
+ * @param {string} blinded_utxo
55
+ * @param {BigInt} amount
56
+ * @param {string} asset
57
+ * @returns {Promise<any>}
58
+ */
59
+ export function send_tokens(descriptor: string, change_descriptor: string, blinded_utxo: string, amount: BigInt, asset: string): Promise<any>;
60
+ /**
61
+ * @param {string} descriptor
62
+ * @param {string} change_descriptor
63
+ * @param {string} utxo
64
+ * @param {BigInt} amount
65
+ * @param {string} asset
66
+ * @returns {Promise<any>}
67
+ */
68
+ export function send_tokens_full(descriptor: string, change_descriptor: string, utxo: string, amount: BigInt, asset: string): Promise<any>;
69
+ /**
70
+ * @param {string} consignment
71
+ * @returns {Promise<any>}
72
+ */
73
+ export function validate_transaction(consignment: string): Promise<any>;
74
+ /**
75
+ * @param {string} consignment
76
+ * @param {string} txid
77
+ * @param {number} vout
78
+ * @param {BigInt} blinding
79
+ * @returns {Promise<any>}
80
+ */
81
+ export function accept_transaction(consignment: string, txid: string, vout: number, blinding: BigInt): Promise<any>;
82
+ /**
83
+ * @param {string} network_str
84
+ */
85
+ export function switch_network(network_str: string): void;
86
+
87
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
88
+
89
+ export interface InitOutput {
90
+ readonly memory: WebAssembly.Memory;
91
+ readonly get_vault: (a: number, b: number) => number;
92
+ readonly get_mnemonic_seed: (a: number, b: number, c: number, d: number) => number;
93
+ readonly save_mnemonic_seed: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
94
+ readonly get_wallet_data: (a: number, b: number, c: number, d: number) => number;
95
+ readonly import_list_assets: () => number;
96
+ readonly import_asset: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
97
+ readonly send_sats: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
98
+ readonly send_tokens: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => number;
99
+ readonly send_tokens_full: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => number;
100
+ readonly validate_transaction: (a: number, b: number) => number;
101
+ readonly accept_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
102
+ readonly switch_network: (a: number, b: number) => void;
103
+ readonly set_blinded_utxos: () => number;
104
+ readonly rustsecp256k1_v0_4_1_context_create: (a: number) => number;
105
+ readonly rustsecp256k1_v0_4_1_context_destroy: (a: number) => void;
106
+ readonly rustsecp256k1_v0_4_1_default_illegal_callback_fn: (a: number, b: number) => void;
107
+ readonly rustsecp256k1_v0_4_1_default_error_callback_fn: (a: number, b: number) => void;
108
+ readonly __wbindgen_malloc: (a: number) => number;
109
+ readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
110
+ readonly __wbindgen_export_2: WebAssembly.Table;
111
+ readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8e5629126d5ed13d: (a: number, b: number, c: number) => void;
112
+ readonly __wbindgen_exn_store: (a: number) => void;
113
+ readonly __wbindgen_free: (a: number, b: number) => void;
114
+ readonly wasm_bindgen__convert__closures__invoke2_mut__h2898eda53b69fe19: (a: number, b: number, c: number, d: number) => void;
115
+ }
116
+
117
+ /**
118
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
119
+ * for everything else, calls `WebAssembly.instantiate` directly.
120
+ *
121
+ * @param {InitInput | Promise<InitInput>} module_or_path
122
+ *
123
+ * @returns {Promise<InitOutput>}
124
+ */
125
+ export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
@@ -0,0 +1,874 @@
1
+
2
+ let wasm;
3
+
4
+ const heap = new Array(32).fill(undefined);
5
+
6
+ heap.push(undefined, null, true, false);
7
+
8
+ function getObject(idx) { return heap[idx]; }
9
+
10
+ let heap_next = heap.length;
11
+
12
+ function dropObject(idx) {
13
+ if (idx < 36) return;
14
+ heap[idx] = heap_next;
15
+ heap_next = idx;
16
+ }
17
+
18
+ function takeObject(idx) {
19
+ const ret = getObject(idx);
20
+ dropObject(idx);
21
+ return ret;
22
+ }
23
+
24
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
25
+
26
+ cachedTextDecoder.decode();
27
+
28
+ let cachegetUint8Memory0 = null;
29
+ function getUint8Memory0() {
30
+ if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
31
+ cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
32
+ }
33
+ return cachegetUint8Memory0;
34
+ }
35
+
36
+ function getStringFromWasm0(ptr, len) {
37
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
38
+ }
39
+
40
+ function addHeapObject(obj) {
41
+ if (heap_next === heap.length) heap.push(heap.length + 1);
42
+ const idx = heap_next;
43
+ heap_next = heap[idx];
44
+
45
+ heap[idx] = obj;
46
+ return idx;
47
+ }
48
+
49
+ let WASM_VECTOR_LEN = 0;
50
+
51
+ let cachedTextEncoder = new TextEncoder('utf-8');
52
+
53
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
54
+ ? function (arg, view) {
55
+ return cachedTextEncoder.encodeInto(arg, view);
56
+ }
57
+ : function (arg, view) {
58
+ const buf = cachedTextEncoder.encode(arg);
59
+ view.set(buf);
60
+ return {
61
+ read: arg.length,
62
+ written: buf.length
63
+ };
64
+ });
65
+
66
+ function passStringToWasm0(arg, malloc, realloc) {
67
+
68
+ if (realloc === undefined) {
69
+ const buf = cachedTextEncoder.encode(arg);
70
+ const ptr = malloc(buf.length);
71
+ getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
72
+ WASM_VECTOR_LEN = buf.length;
73
+ return ptr;
74
+ }
75
+
76
+ let len = arg.length;
77
+ let ptr = malloc(len);
78
+
79
+ const mem = getUint8Memory0();
80
+
81
+ let offset = 0;
82
+
83
+ for (; offset < len; offset++) {
84
+ const code = arg.charCodeAt(offset);
85
+ if (code > 0x7F) break;
86
+ mem[ptr + offset] = code;
87
+ }
88
+
89
+ if (offset !== len) {
90
+ if (offset !== 0) {
91
+ arg = arg.slice(offset);
92
+ }
93
+ ptr = realloc(ptr, len, len = offset + arg.length * 3);
94
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
95
+ const ret = encodeString(arg, view);
96
+
97
+ offset += ret.written;
98
+ }
99
+
100
+ WASM_VECTOR_LEN = offset;
101
+ return ptr;
102
+ }
103
+
104
+ let cachegetInt32Memory0 = null;
105
+ function getInt32Memory0() {
106
+ if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
107
+ cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
108
+ }
109
+ return cachegetInt32Memory0;
110
+ }
111
+
112
+ function isLikeNone(x) {
113
+ return x === undefined || x === null;
114
+ }
115
+
116
+ function debugString(val) {
117
+ // primitive types
118
+ const type = typeof val;
119
+ if (type == 'number' || type == 'boolean' || val == null) {
120
+ return `${val}`;
121
+ }
122
+ if (type == 'string') {
123
+ return `"${val}"`;
124
+ }
125
+ if (type == 'symbol') {
126
+ const description = val.description;
127
+ if (description == null) {
128
+ return 'Symbol';
129
+ } else {
130
+ return `Symbol(${description})`;
131
+ }
132
+ }
133
+ if (type == 'function') {
134
+ const name = val.name;
135
+ if (typeof name == 'string' && name.length > 0) {
136
+ return `Function(${name})`;
137
+ } else {
138
+ return 'Function';
139
+ }
140
+ }
141
+ // objects
142
+ if (Array.isArray(val)) {
143
+ const length = val.length;
144
+ let debug = '[';
145
+ if (length > 0) {
146
+ debug += debugString(val[0]);
147
+ }
148
+ for(let i = 1; i < length; i++) {
149
+ debug += ', ' + debugString(val[i]);
150
+ }
151
+ debug += ']';
152
+ return debug;
153
+ }
154
+ // Test for built-in
155
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
156
+ let className;
157
+ if (builtInMatches.length > 1) {
158
+ className = builtInMatches[1];
159
+ } else {
160
+ // Failed to match the standard '[object ClassName]'
161
+ return toString.call(val);
162
+ }
163
+ if (className == 'Object') {
164
+ // we're a user defined class or Object
165
+ // JSON.stringify avoids problems with cycles, and is generally much
166
+ // easier than looping through ownProperties of `val`.
167
+ try {
168
+ return 'Object(' + JSON.stringify(val) + ')';
169
+ } catch (_) {
170
+ return 'Object';
171
+ }
172
+ }
173
+ // errors
174
+ if (val instanceof Error) {
175
+ return `${val.name}: ${val.message}\n${val.stack}`;
176
+ }
177
+ // TODO we could test for more things here, like `Set`s and `Map`s.
178
+ return className;
179
+ }
180
+
181
+ function makeMutClosure(arg0, arg1, dtor, f) {
182
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
183
+ const real = (...args) => {
184
+ // First up with a closure we increment the internal reference
185
+ // count. This ensures that the Rust closure environment won't
186
+ // be deallocated while we're invoking it.
187
+ state.cnt++;
188
+ const a = state.a;
189
+ state.a = 0;
190
+ try {
191
+ return f(a, state.b, ...args);
192
+ } finally {
193
+ if (--state.cnt === 0) {
194
+ wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
195
+
196
+ } else {
197
+ state.a = a;
198
+ }
199
+ }
200
+ };
201
+ real.original = state;
202
+
203
+ return real;
204
+ }
205
+ function __wbg_adapter_28(arg0, arg1, arg2) {
206
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8e5629126d5ed13d(arg0, arg1, addHeapObject(arg2));
207
+ }
208
+
209
+ /**
210
+ * @param {string} password
211
+ * @returns {Promise<any>}
212
+ */
213
+ export function get_vault(password) {
214
+ var ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
215
+ var len0 = WASM_VECTOR_LEN;
216
+ var ret = wasm.get_vault(ptr0, len0);
217
+ return takeObject(ret);
218
+ }
219
+
220
+ /**
221
+ * @param {string} encryption_password
222
+ * @param {string} seed_password
223
+ * @returns {Promise<any>}
224
+ */
225
+ export function get_mnemonic_seed(encryption_password, seed_password) {
226
+ var ptr0 = passStringToWasm0(encryption_password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
227
+ var len0 = WASM_VECTOR_LEN;
228
+ var ptr1 = passStringToWasm0(seed_password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
229
+ var len1 = WASM_VECTOR_LEN;
230
+ var ret = wasm.get_mnemonic_seed(ptr0, len0, ptr1, len1);
231
+ return takeObject(ret);
232
+ }
233
+
234
+ /**
235
+ * @param {string} mnemonic
236
+ * @param {string} encryption_password
237
+ * @param {string} seed_password
238
+ * @returns {Promise<any>}
239
+ */
240
+ export function save_mnemonic_seed(mnemonic, encryption_password, seed_password) {
241
+ var ptr0 = passStringToWasm0(mnemonic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
242
+ var len0 = WASM_VECTOR_LEN;
243
+ var ptr1 = passStringToWasm0(encryption_password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
244
+ var len1 = WASM_VECTOR_LEN;
245
+ var ptr2 = passStringToWasm0(seed_password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
246
+ var len2 = WASM_VECTOR_LEN;
247
+ var ret = wasm.save_mnemonic_seed(ptr0, len0, ptr1, len1, ptr2, len2);
248
+ return takeObject(ret);
249
+ }
250
+
251
+ /**
252
+ * @param {string} descriptor
253
+ * @param {string} change_descriptor
254
+ * @returns {Promise<any>}
255
+ */
256
+ export function get_wallet_data(descriptor, change_descriptor) {
257
+ var ptr0 = passStringToWasm0(descriptor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
258
+ var len0 = WASM_VECTOR_LEN;
259
+ var ptr1 = passStringToWasm0(change_descriptor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
260
+ var len1 = WASM_VECTOR_LEN;
261
+ var ret = wasm.get_wallet_data(ptr0, len0, ptr1, len1);
262
+ return takeObject(ret);
263
+ }
264
+
265
+ /**
266
+ * @returns {Promise<any>}
267
+ */
268
+ export function import_list_assets() {
269
+ var ret = wasm.import_list_assets();
270
+ return takeObject(ret);
271
+ }
272
+
273
+ /**
274
+ * @param {string} descriptor
275
+ * @param {string} change_descriptor
276
+ * @param {string | undefined} asset
277
+ * @param {string | undefined} genesis
278
+ * @returns {Promise<any>}
279
+ */
280
+ export function import_asset(descriptor, change_descriptor, asset, genesis) {
281
+ var ptr0 = passStringToWasm0(descriptor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
282
+ var len0 = WASM_VECTOR_LEN;
283
+ var ptr1 = passStringToWasm0(change_descriptor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
284
+ var len1 = WASM_VECTOR_LEN;
285
+ var ptr2 = isLikeNone(asset) ? 0 : passStringToWasm0(asset, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
286
+ var len2 = WASM_VECTOR_LEN;
287
+ var ptr3 = isLikeNone(genesis) ? 0 : passStringToWasm0(genesis, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
288
+ var len3 = WASM_VECTOR_LEN;
289
+ var ret = wasm.import_asset(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
290
+ return takeObject(ret);
291
+ }
292
+
293
+ /**
294
+ * @returns {Promise<any>}
295
+ */
296
+ export function set_blinded_utxos() {
297
+ var ret = wasm.set_blinded_utxos();
298
+ return takeObject(ret);
299
+ }
300
+
301
+ const u32CvtShim = new Uint32Array(2);
302
+
303
+ const uint64CvtShim = new BigUint64Array(u32CvtShim.buffer);
304
+ /**
305
+ * @param {string} descriptor
306
+ * @param {string} change_descriptor
307
+ * @param {string} address
308
+ * @param {BigInt} amount
309
+ * @returns {Promise<any>}
310
+ */
311
+ export function send_sats(descriptor, change_descriptor, address, amount) {
312
+ var ptr0 = passStringToWasm0(descriptor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
313
+ var len0 = WASM_VECTOR_LEN;
314
+ var ptr1 = passStringToWasm0(change_descriptor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
315
+ var len1 = WASM_VECTOR_LEN;
316
+ var ptr2 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
317
+ var len2 = WASM_VECTOR_LEN;
318
+ uint64CvtShim[0] = amount;
319
+ const low3 = u32CvtShim[0];
320
+ const high3 = u32CvtShim[1];
321
+ var ret = wasm.send_sats(ptr0, len0, ptr1, len1, ptr2, len2, low3, high3);
322
+ return takeObject(ret);
323
+ }
324
+
325
+ /**
326
+ * @param {string} descriptor
327
+ * @param {string} change_descriptor
328
+ * @param {string} blinded_utxo
329
+ * @param {BigInt} amount
330
+ * @param {string} asset
331
+ * @returns {Promise<any>}
332
+ */
333
+ export function send_tokens(descriptor, change_descriptor, blinded_utxo, amount, asset) {
334
+ var ptr0 = passStringToWasm0(descriptor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
335
+ var len0 = WASM_VECTOR_LEN;
336
+ var ptr1 = passStringToWasm0(change_descriptor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
337
+ var len1 = WASM_VECTOR_LEN;
338
+ var ptr2 = passStringToWasm0(blinded_utxo, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
339
+ var len2 = WASM_VECTOR_LEN;
340
+ uint64CvtShim[0] = amount;
341
+ const low3 = u32CvtShim[0];
342
+ const high3 = u32CvtShim[1];
343
+ var ptr4 = passStringToWasm0(asset, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
344
+ var len4 = WASM_VECTOR_LEN;
345
+ var ret = wasm.send_tokens(ptr0, len0, ptr1, len1, ptr2, len2, low3, high3, ptr4, len4);
346
+ return takeObject(ret);
347
+ }
348
+
349
+ /**
350
+ * @param {string} descriptor
351
+ * @param {string} change_descriptor
352
+ * @param {string} utxo
353
+ * @param {BigInt} amount
354
+ * @param {string} asset
355
+ * @returns {Promise<any>}
356
+ */
357
+ export function send_tokens_full(descriptor, change_descriptor, utxo, amount, asset) {
358
+ var ptr0 = passStringToWasm0(descriptor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
359
+ var len0 = WASM_VECTOR_LEN;
360
+ var ptr1 = passStringToWasm0(change_descriptor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
361
+ var len1 = WASM_VECTOR_LEN;
362
+ var ptr2 = passStringToWasm0(utxo, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
363
+ var len2 = WASM_VECTOR_LEN;
364
+ uint64CvtShim[0] = amount;
365
+ const low3 = u32CvtShim[0];
366
+ const high3 = u32CvtShim[1];
367
+ var ptr4 = passStringToWasm0(asset, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
368
+ var len4 = WASM_VECTOR_LEN;
369
+ var ret = wasm.send_tokens_full(ptr0, len0, ptr1, len1, ptr2, len2, low3, high3, ptr4, len4);
370
+ return takeObject(ret);
371
+ }
372
+
373
+ /**
374
+ * @param {string} consignment
375
+ * @returns {Promise<any>}
376
+ */
377
+ export function validate_transaction(consignment) {
378
+ var ptr0 = passStringToWasm0(consignment, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
379
+ var len0 = WASM_VECTOR_LEN;
380
+ var ret = wasm.validate_transaction(ptr0, len0);
381
+ return takeObject(ret);
382
+ }
383
+
384
+ /**
385
+ * @param {string} consignment
386
+ * @param {string} txid
387
+ * @param {number} vout
388
+ * @param {BigInt} blinding
389
+ * @returns {Promise<any>}
390
+ */
391
+ export function accept_transaction(consignment, txid, vout, blinding) {
392
+ var ptr0 = passStringToWasm0(consignment, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
393
+ var len0 = WASM_VECTOR_LEN;
394
+ var ptr1 = passStringToWasm0(txid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
395
+ var len1 = WASM_VECTOR_LEN;
396
+ uint64CvtShim[0] = blinding;
397
+ const low2 = u32CvtShim[0];
398
+ const high2 = u32CvtShim[1];
399
+ var ret = wasm.accept_transaction(ptr0, len0, ptr1, len1, vout, low2, high2);
400
+ return takeObject(ret);
401
+ }
402
+
403
+ /**
404
+ * @param {string} network_str
405
+ */
406
+ export function switch_network(network_str) {
407
+ var ptr0 = passStringToWasm0(network_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
408
+ var len0 = WASM_VECTOR_LEN;
409
+ wasm.switch_network(ptr0, len0);
410
+ }
411
+
412
+ function handleError(f, args) {
413
+ try {
414
+ return f.apply(this, args);
415
+ } catch (e) {
416
+ wasm.__wbindgen_exn_store(addHeapObject(e));
417
+ }
418
+ }
419
+
420
+ function getArrayU8FromWasm0(ptr, len) {
421
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
422
+ }
423
+
424
+ let cachegetUint32Memory0 = null;
425
+ function getUint32Memory0() {
426
+ if (cachegetUint32Memory0 === null || cachegetUint32Memory0.buffer !== wasm.memory.buffer) {
427
+ cachegetUint32Memory0 = new Uint32Array(wasm.memory.buffer);
428
+ }
429
+ return cachegetUint32Memory0;
430
+ }
431
+
432
+ function getArrayJsValueFromWasm0(ptr, len) {
433
+ const mem = getUint32Memory0();
434
+ const slice = mem.subarray(ptr / 4, ptr / 4 + len);
435
+ const result = [];
436
+ for (let i = 0; i < slice.length; i++) {
437
+ result.push(takeObject(slice[i]));
438
+ }
439
+ return result;
440
+ }
441
+ function __wbg_adapter_150(arg0, arg1, arg2, arg3) {
442
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h2898eda53b69fe19(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
443
+ }
444
+
445
+ async function load(module, imports) {
446
+ if (typeof Response === 'function' && module instanceof Response) {
447
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
448
+ try {
449
+ return await WebAssembly.instantiateStreaming(module, imports);
450
+
451
+ } catch (e) {
452
+ if (module.headers.get('Content-Type') != 'application/wasm') {
453
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
454
+
455
+ } else {
456
+ throw e;
457
+ }
458
+ }
459
+ }
460
+
461
+ const bytes = await module.arrayBuffer();
462
+ return await WebAssembly.instantiate(bytes, imports);
463
+
464
+ } else {
465
+ const instance = await WebAssembly.instantiate(module, imports);
466
+
467
+ if (instance instanceof WebAssembly.Instance) {
468
+ return { instance, module };
469
+
470
+ } else {
471
+ return instance;
472
+ }
473
+ }
474
+ }
475
+
476
+ async function init(input) {
477
+ if (typeof input === 'undefined') {
478
+ input = new URL('bitmask_core_bg.wasm', import.meta.url);
479
+ }
480
+ const imports = {};
481
+ imports.wbg = {};
482
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
483
+ takeObject(arg0);
484
+ };
485
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
486
+ var ret = getStringFromWasm0(arg0, arg1);
487
+ return addHeapObject(ret);
488
+ };
489
+ imports.wbg.__wbindgen_json_serialize = function(arg0, arg1) {
490
+ const obj = getObject(arg1);
491
+ var ret = JSON.stringify(obj === undefined ? null : obj);
492
+ var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
493
+ var len0 = WASM_VECTOR_LEN;
494
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
495
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
496
+ };
497
+ imports.wbg.__wbindgen_cb_drop = function(arg0) {
498
+ const obj = takeObject(arg0).original;
499
+ if (obj.cnt-- == 1) {
500
+ obj.a = 0;
501
+ return true;
502
+ }
503
+ var ret = false;
504
+ return ret;
505
+ };
506
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
507
+ const obj = getObject(arg1);
508
+ var ret = typeof(obj) === 'string' ? obj : undefined;
509
+ var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
510
+ var len0 = WASM_VECTOR_LEN;
511
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
512
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
513
+ };
514
+ imports.wbg.__wbg_randomFillSync_378e02b85af41ab6 = function() { return handleError(function (arg0, arg1, arg2) {
515
+ getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
516
+ }, arguments) };
517
+ imports.wbg.__wbg_getRandomValues_99bbe8a65f4aef87 = function() { return handleError(function (arg0, arg1) {
518
+ getObject(arg0).getRandomValues(getObject(arg1));
519
+ }, arguments) };
520
+ imports.wbg.__wbg_process_5729605ce9d34ea8 = function(arg0) {
521
+ var ret = getObject(arg0).process;
522
+ return addHeapObject(ret);
523
+ };
524
+ imports.wbg.__wbindgen_is_object = function(arg0) {
525
+ const val = getObject(arg0);
526
+ var ret = typeof(val) === 'object' && val !== null;
527
+ return ret;
528
+ };
529
+ imports.wbg.__wbg_versions_531e16e1a776ee97 = function(arg0) {
530
+ var ret = getObject(arg0).versions;
531
+ return addHeapObject(ret);
532
+ };
533
+ imports.wbg.__wbg_node_18b58a160b60d170 = function(arg0) {
534
+ var ret = getObject(arg0).node;
535
+ return addHeapObject(ret);
536
+ };
537
+ imports.wbg.__wbindgen_is_string = function(arg0) {
538
+ var ret = typeof(getObject(arg0)) === 'string';
539
+ return ret;
540
+ };
541
+ imports.wbg.__wbg_static_accessor_NODE_MODULE_bdc5ca9096c68aeb = function() {
542
+ var ret = module;
543
+ return addHeapObject(ret);
544
+ };
545
+ imports.wbg.__wbg_require_edfaedd93e302925 = function() { return handleError(function (arg0, arg1, arg2) {
546
+ var ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
547
+ return addHeapObject(ret);
548
+ }, arguments) };
549
+ imports.wbg.__wbg_crypto_2bc4d5b05161de5b = function(arg0) {
550
+ var ret = getObject(arg0).crypto;
551
+ return addHeapObject(ret);
552
+ };
553
+ imports.wbg.__wbg_msCrypto_d003eebe62c636a9 = function(arg0) {
554
+ var ret = getObject(arg0).msCrypto;
555
+ return addHeapObject(ret);
556
+ };
557
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
558
+ var ret = getObject(arg0);
559
+ return addHeapObject(ret);
560
+ };
561
+ imports.wbg.__wbg_log_06b7ffc63a0f8bee = function(arg0, arg1) {
562
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
563
+ wasm.__wbindgen_free(arg0, arg1 * 4);
564
+ console.log(...v0);
565
+ };
566
+ imports.wbg.__wbg_fetch_fb26f738d9707b16 = function(arg0) {
567
+ var ret = fetch(getObject(arg0));
568
+ return addHeapObject(ret);
569
+ };
570
+ imports.wbg.__wbg_instanceof_Window_434ce1849eb4e0fc = function(arg0) {
571
+ var ret = getObject(arg0) instanceof Window;
572
+ return ret;
573
+ };
574
+ imports.wbg.__wbg_localStorage_2b7091e6919605e2 = function() { return handleError(function (arg0) {
575
+ var ret = getObject(arg0).localStorage;
576
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
577
+ }, arguments) };
578
+ imports.wbg.__wbg_fetch_427498e0ccea81f4 = function(arg0, arg1) {
579
+ var ret = getObject(arg0).fetch(getObject(arg1));
580
+ return addHeapObject(ret);
581
+ };
582
+ imports.wbg.__wbg_fetch_fe54824ee845f6b4 = function(arg0, arg1) {
583
+ var ret = getObject(arg0).fetch(getObject(arg1));
584
+ return addHeapObject(ret);
585
+ };
586
+ imports.wbg.__wbg_instanceof_Response_ea36d565358a42f7 = function(arg0) {
587
+ var ret = getObject(arg0) instanceof Response;
588
+ return ret;
589
+ };
590
+ imports.wbg.__wbg_url_6e564c9e212456f8 = function(arg0, arg1) {
591
+ var ret = getObject(arg1).url;
592
+ var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
593
+ var len0 = WASM_VECTOR_LEN;
594
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
595
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
596
+ };
597
+ imports.wbg.__wbg_redirected_6e12d6561219acd3 = function(arg0) {
598
+ var ret = getObject(arg0).redirected;
599
+ return ret;
600
+ };
601
+ imports.wbg.__wbg_status_3a55bb50e744b834 = function(arg0) {
602
+ var ret = getObject(arg0).status;
603
+ return ret;
604
+ };
605
+ imports.wbg.__wbg_headers_e4204c6775f7b3b4 = function(arg0) {
606
+ var ret = getObject(arg0).headers;
607
+ return addHeapObject(ret);
608
+ };
609
+ imports.wbg.__wbg_bodyUsed_3eff36e699c14b1f = function(arg0) {
610
+ var ret = getObject(arg0).bodyUsed;
611
+ return ret;
612
+ };
613
+ imports.wbg.__wbg_arrayBuffer_0e2a43f68a8b3e49 = function() { return handleError(function (arg0) {
614
+ var ret = getObject(arg0).arrayBuffer();
615
+ return addHeapObject(ret);
616
+ }, arguments) };
617
+ imports.wbg.__wbg_json_4ab99130d1a5b3a9 = function() { return handleError(function (arg0) {
618
+ var ret = getObject(arg0).json();
619
+ return addHeapObject(ret);
620
+ }, arguments) };
621
+ imports.wbg.__wbg_text_aeba5a5bbfef7f15 = function() { return handleError(function (arg0) {
622
+ var ret = getObject(arg0).text();
623
+ return addHeapObject(ret);
624
+ }, arguments) };
625
+ imports.wbg.__wbg_getItem_f92ef607397e96b1 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
626
+ var ret = getObject(arg1).getItem(getStringFromWasm0(arg2, arg3));
627
+ var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
628
+ var len0 = WASM_VECTOR_LEN;
629
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
630
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
631
+ }, arguments) };
632
+ imports.wbg.__wbg_setItem_279b13e5ad0b82cb = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
633
+ getObject(arg0).setItem(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
634
+ }, arguments) };
635
+ imports.wbg.__wbg_new_226d109446575877 = function() { return handleError(function () {
636
+ var ret = new Headers();
637
+ return addHeapObject(ret);
638
+ }, arguments) };
639
+ imports.wbg.__wbg_append_4d85f35672cbffa7 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
640
+ getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
641
+ }, arguments) };
642
+ imports.wbg.__wbg_set_f9448486a94c9aef = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
643
+ getObject(arg0).set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
644
+ }, arguments) };
645
+ imports.wbg.__wbg_newwithstrandinit_c07f0662ece15bc6 = function() { return handleError(function (arg0, arg1, arg2) {
646
+ var ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
647
+ return addHeapObject(ret);
648
+ }, arguments) };
649
+ imports.wbg.__wbg_self_86b4b13392c7af56 = function() { return handleError(function () {
650
+ var ret = self.self;
651
+ return addHeapObject(ret);
652
+ }, arguments) };
653
+ imports.wbg.__wbg_crypto_b8c92eaac23d0d80 = function(arg0) {
654
+ var ret = getObject(arg0).crypto;
655
+ return addHeapObject(ret);
656
+ };
657
+ imports.wbg.__wbg_msCrypto_9ad6677321a08dd8 = function(arg0) {
658
+ var ret = getObject(arg0).msCrypto;
659
+ return addHeapObject(ret);
660
+ };
661
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
662
+ var ret = getObject(arg0) === undefined;
663
+ return ret;
664
+ };
665
+ imports.wbg.__wbg_static_accessor_MODULE_452b4680e8614c81 = function() {
666
+ var ret = module;
667
+ return addHeapObject(ret);
668
+ };
669
+ imports.wbg.__wbg_require_f5521a5b85ad2542 = function(arg0, arg1, arg2) {
670
+ var ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
671
+ return addHeapObject(ret);
672
+ };
673
+ imports.wbg.__wbg_getRandomValues_dd27e6b0652b3236 = function(arg0) {
674
+ var ret = getObject(arg0).getRandomValues;
675
+ return addHeapObject(ret);
676
+ };
677
+ imports.wbg.__wbg_getRandomValues_e57c9b75ddead065 = function(arg0, arg1) {
678
+ getObject(arg0).getRandomValues(getObject(arg1));
679
+ };
680
+ imports.wbg.__wbg_randomFillSync_d2ba53160aec6aba = function(arg0, arg1, arg2) {
681
+ getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
682
+ };
683
+ imports.wbg.__wbg_get_f45dff51f52d7222 = function(arg0, arg1) {
684
+ var ret = getObject(arg0)[arg1 >>> 0];
685
+ return addHeapObject(ret);
686
+ };
687
+ imports.wbg.__wbindgen_is_function = function(arg0) {
688
+ var ret = typeof(getObject(arg0)) === 'function';
689
+ return ret;
690
+ };
691
+ imports.wbg.__wbg_newnoargs_f579424187aa1717 = function(arg0, arg1) {
692
+ var ret = new Function(getStringFromWasm0(arg0, arg1));
693
+ return addHeapObject(ret);
694
+ };
695
+ imports.wbg.__wbg_next_c7a2a6b012059a5e = function(arg0) {
696
+ var ret = getObject(arg0).next;
697
+ return addHeapObject(ret);
698
+ };
699
+ imports.wbg.__wbg_next_dd1a890d37e38d73 = function() { return handleError(function (arg0) {
700
+ var ret = getObject(arg0).next();
701
+ return addHeapObject(ret);
702
+ }, arguments) };
703
+ imports.wbg.__wbg_done_982b1c7ac0cbc69d = function(arg0) {
704
+ var ret = getObject(arg0).done;
705
+ return ret;
706
+ };
707
+ imports.wbg.__wbg_value_2def2d1fb38b02cd = function(arg0) {
708
+ var ret = getObject(arg0).value;
709
+ return addHeapObject(ret);
710
+ };
711
+ imports.wbg.__wbg_iterator_4b9cedbeda0c0e30 = function() {
712
+ var ret = Symbol.iterator;
713
+ return addHeapObject(ret);
714
+ };
715
+ imports.wbg.__wbg_get_8bbb82393651dd9c = function() { return handleError(function (arg0, arg1) {
716
+ var ret = Reflect.get(getObject(arg0), getObject(arg1));
717
+ return addHeapObject(ret);
718
+ }, arguments) };
719
+ imports.wbg.__wbg_call_89558c3e96703ca1 = function() { return handleError(function (arg0, arg1) {
720
+ var ret = getObject(arg0).call(getObject(arg1));
721
+ return addHeapObject(ret);
722
+ }, arguments) };
723
+ imports.wbg.__wbg_new_d3138911a89329b0 = function() {
724
+ var ret = new Object();
725
+ return addHeapObject(ret);
726
+ };
727
+ imports.wbg.__wbg_instanceof_Error_4287ce7d75f0e3a2 = function(arg0) {
728
+ var ret = getObject(arg0) instanceof Error;
729
+ return ret;
730
+ };
731
+ imports.wbg.__wbg_message_1dfe93b595be8811 = function(arg0) {
732
+ var ret = getObject(arg0).message;
733
+ return addHeapObject(ret);
734
+ };
735
+ imports.wbg.__wbg_name_66305ab387468967 = function(arg0) {
736
+ var ret = getObject(arg0).name;
737
+ return addHeapObject(ret);
738
+ };
739
+ imports.wbg.__wbg_toString_3e854a6a919f2996 = function(arg0) {
740
+ var ret = getObject(arg0).toString();
741
+ return addHeapObject(ret);
742
+ };
743
+ imports.wbg.__wbg_call_94697a95cb7e239c = function() { return handleError(function (arg0, arg1, arg2) {
744
+ var ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
745
+ return addHeapObject(ret);
746
+ }, arguments) };
747
+ imports.wbg.__wbg_entries_3b7c6644b64ed009 = function(arg0) {
748
+ var ret = getObject(arg0).entries();
749
+ return addHeapObject(ret);
750
+ };
751
+ imports.wbg.__wbg_now_e6c39c10a5e8aec7 = function() {
752
+ var ret = Date.now();
753
+ return ret;
754
+ };
755
+ imports.wbg.__wbg_new_4beacc9c71572250 = function(arg0, arg1) {
756
+ try {
757
+ var state0 = {a: arg0, b: arg1};
758
+ var cb0 = (arg0, arg1) => {
759
+ const a = state0.a;
760
+ state0.a = 0;
761
+ try {
762
+ return __wbg_adapter_150(a, state0.b, arg0, arg1);
763
+ } finally {
764
+ state0.a = a;
765
+ }
766
+ };
767
+ var ret = new Promise(cb0);
768
+ return addHeapObject(ret);
769
+ } finally {
770
+ state0.a = state0.b = 0;
771
+ }
772
+ };
773
+ imports.wbg.__wbg_resolve_4f8f547f26b30b27 = function(arg0) {
774
+ var ret = Promise.resolve(getObject(arg0));
775
+ return addHeapObject(ret);
776
+ };
777
+ imports.wbg.__wbg_then_a6860c82b90816ca = function(arg0, arg1) {
778
+ var ret = getObject(arg0).then(getObject(arg1));
779
+ return addHeapObject(ret);
780
+ };
781
+ imports.wbg.__wbg_then_58a04e42527f52c6 = function(arg0, arg1, arg2) {
782
+ var ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
783
+ return addHeapObject(ret);
784
+ };
785
+ imports.wbg.__wbg_self_e23d74ae45fb17d1 = function() { return handleError(function () {
786
+ var ret = self.self;
787
+ return addHeapObject(ret);
788
+ }, arguments) };
789
+ imports.wbg.__wbg_window_b4be7f48b24ac56e = function() { return handleError(function () {
790
+ var ret = window.window;
791
+ return addHeapObject(ret);
792
+ }, arguments) };
793
+ imports.wbg.__wbg_globalThis_d61b1f48a57191ae = function() { return handleError(function () {
794
+ var ret = globalThis.globalThis;
795
+ return addHeapObject(ret);
796
+ }, arguments) };
797
+ imports.wbg.__wbg_global_e7669da72fd7f239 = function() { return handleError(function () {
798
+ var ret = global.global;
799
+ return addHeapObject(ret);
800
+ }, arguments) };
801
+ imports.wbg.__wbg_buffer_5e74a88a1424a2e0 = function(arg0) {
802
+ var ret = getObject(arg0).buffer;
803
+ return addHeapObject(ret);
804
+ };
805
+ imports.wbg.__wbg_newwithbyteoffsetandlength_278ec7532799393a = function(arg0, arg1, arg2) {
806
+ var ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
807
+ return addHeapObject(ret);
808
+ };
809
+ imports.wbg.__wbg_new_e3b800e570795b3c = function(arg0) {
810
+ var ret = new Uint8Array(getObject(arg0));
811
+ return addHeapObject(ret);
812
+ };
813
+ imports.wbg.__wbg_set_5b8081e9d002f0df = function(arg0, arg1, arg2) {
814
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
815
+ };
816
+ imports.wbg.__wbg_length_30803400a8f15c59 = function(arg0) {
817
+ var ret = getObject(arg0).length;
818
+ return ret;
819
+ };
820
+ imports.wbg.__wbg_newwithlength_5f4ce114a24dfe1e = function(arg0) {
821
+ var ret = new Uint8Array(arg0 >>> 0);
822
+ return addHeapObject(ret);
823
+ };
824
+ imports.wbg.__wbg_subarray_a68f835ca2af506f = function(arg0, arg1, arg2) {
825
+ var ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
826
+ return addHeapObject(ret);
827
+ };
828
+ imports.wbg.__wbg_has_3850edde6df9191b = function() { return handleError(function (arg0, arg1) {
829
+ var ret = Reflect.has(getObject(arg0), getObject(arg1));
830
+ return ret;
831
+ }, arguments) };
832
+ imports.wbg.__wbg_set_c42875065132a932 = function() { return handleError(function (arg0, arg1, arg2) {
833
+ var ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
834
+ return ret;
835
+ }, arguments) };
836
+ imports.wbg.__wbg_stringify_f8bfc9e2d1e8b6a0 = function() { return handleError(function (arg0) {
837
+ var ret = JSON.stringify(getObject(arg0));
838
+ return addHeapObject(ret);
839
+ }, arguments) };
840
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
841
+ var ret = debugString(getObject(arg1));
842
+ var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
843
+ var len0 = WASM_VECTOR_LEN;
844
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
845
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
846
+ };
847
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
848
+ throw new Error(getStringFromWasm0(arg0, arg1));
849
+ };
850
+ imports.wbg.__wbindgen_memory = function() {
851
+ var ret = wasm.memory;
852
+ return addHeapObject(ret);
853
+ };
854
+ imports.wbg.__wbindgen_closure_wrapper2548 = function(arg0, arg1, arg2) {
855
+ var ret = makeMutClosure(arg0, arg1, 795, __wbg_adapter_28);
856
+ return addHeapObject(ret);
857
+ };
858
+
859
+ if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
860
+ input = fetch(input);
861
+ }
862
+
863
+
864
+
865
+ const { instance, module } = await load(await input, imports);
866
+
867
+ wasm = instance.exports;
868
+ init.__wbindgen_wasm_module = module;
869
+
870
+ return wasm;
871
+ }
872
+
873
+ export default init;
874
+
Binary file
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "bitmask-core",
3
+ "collaborators": [
4
+ "Jose D Robles <jd.robles@gmail.com>",
5
+ "Hunter Trujillo <cryptoquick@pm.me>"
6
+ ],
7
+ "description": "Core functionality for the BitMask wallet",
8
+ "version": "0.1.1",
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/rgb-products/bitmask-core"
13
+ },
14
+ "files": [
15
+ "bitmask_core_bg.wasm",
16
+ "bitmask_core.js",
17
+ "bitmask_core.d.ts",
18
+ "LICENSE-MIT",
19
+ "LICENSE-APACHE"
20
+ ],
21
+ "module": "bitmask_core.js",
22
+ "homepage": "https://bitmask.app",
23
+ "types": "bitmask_core.d.ts",
24
+ "sideEffects": false
25
+ }