bitmask-core 0.5.2 → 0.6.0-beta.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/README.md CHANGED
@@ -52,15 +52,24 @@ Upon a new release, follow these steps:
52
52
  1. Run `cargo +nightly udeps` to see if there are any unused dependencies.
53
53
 
54
54
  ## Docker
55
+ For running bitmask-core tests in Regtest Mode, please follow the steps below:
55
56
 
56
- For running bitmask-core tests in regtest, please follow the steps bellow:
57
-
58
- 1. Build bitcoin node + electrum: `docker compose build`
59
- 2. Up and running containers: `docker compose up -d node1`
57
+ ### Initial Setup
58
+ 1. Build bitcoin node + electrum: `docker-compose build`.
59
+ 2. Up and running Docker containers: `docker-compose up -d node1`.
60
60
  3. Load the command line: `source .commands`
61
- 4. Send some coins to main wallet address: `node1 sendtoaddress {ADDRESS} 10`
62
- 5. Mine a block: `node1 -generate`
63
- 6. Running the tests: `TEST_WALLET_SEED="replace with a 12 word mnemonic for a wallet containing testnet sats" cargo test allow_transfer -- --test-threads 1`
61
+ 4. Download and install BDK cli: `cargo install bdk-cli`. We will use BDK to generate the mnemonic.
62
+ 5. Generate a new mnemonic: `bdk-cli generate`.
63
+ 6. Create an environment variable called **TEST_WALLET_SEED** with mnemonic generated in the **step 5**.
64
+ 7. Run the test to get main address: `cargo test --test wallet -- create_wallet --exact`.
65
+ 8. Load your wallet in the bitcoin node: `node1 loadwallet default`.
66
+ 9. Generate new first 500 blocks: `node1 -generate 500`.
67
+ 10. Send some coins to the main wallet address: `node1 sendtoaddress {ADDRESS} 10`. Change `{ADDRESS}` with the address generated in the **step 7**.
68
+ 11. Mine a new block: `node1 -generate 1`
69
+ 12. Run the test to check the balance: `cargo test --test wallet -- get_wallet_balance --exact`.
70
+
71
+ ### Running the tests
72
+ Running the tests: `cargo test --test-threads 1`
64
73
 
65
74
  ### Troubleshooting
66
75
 
package/bitmask_core.d.ts CHANGED
@@ -1,6 +1,66 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
+ * @param {string} nostr_hex_sk
5
+ * @param {string} ticker
6
+ * @param {string} name
7
+ * @param {string} description
8
+ * @param {number} precision
9
+ * @param {bigint} supply
10
+ * @param {string} seal
11
+ * @param {string} iface
12
+ * @returns {Promise<any>}
13
+ */
14
+ export function issue_contract(nostr_hex_sk: string, ticker: string, name: string, description: string, precision: number, supply: bigint, seal: string, iface: string): Promise<any>;
15
+ /**
16
+ * @param {string} nostr_hex_sk
17
+ * @param {string} contract_id
18
+ * @param {string} iface
19
+ * @param {bigint} amount
20
+ * @param {string} seal
21
+ * @returns {Promise<any>}
22
+ */
23
+ export function rgb_create_invoice(nostr_hex_sk: string, contract_id: string, iface: string, amount: bigint, seal: string): Promise<any>;
24
+ /**
25
+ * @param {string} nostr_hex_sk
26
+ * @param {any} request
27
+ * @returns {Promise<any>}
28
+ */
29
+ export function create_psbt(nostr_hex_sk: string, request: any): Promise<any>;
30
+ /**
31
+ * @param {string} nostr_hex_sk
32
+ * @param {any} request
33
+ * @returns {Promise<any>}
34
+ */
35
+ export function pay_asset(nostr_hex_sk: string, request: any): Promise<any>;
36
+ /**
37
+ * @param {string} nostr_hex_sk
38
+ * @param {any} request
39
+ * @returns {Promise<any>}
40
+ */
41
+ export function accept_transfer(nostr_hex_sk: string, request: any): Promise<any>;
42
+ /**
43
+ * @param {string} nostr_hex_sk
44
+ * @returns {Promise<any>}
45
+ */
46
+ export function list_contracts(nostr_hex_sk: string): Promise<any>;
47
+ /**
48
+ * @param {string} nostr_hex_sk
49
+ * @returns {Promise<any>}
50
+ */
51
+ export function list_interfaces(nostr_hex_sk: string): Promise<any>;
52
+ /**
53
+ * @param {string} nostr_hex_sk
54
+ * @returns {Promise<any>}
55
+ */
56
+ export function list_schemas(nostr_hex_sk: string): Promise<any>;
57
+ /**
58
+ * @param {string} nostr_hex_sk
59
+ * @param {any} request
60
+ * @returns {Promise<any>}
61
+ */
62
+ export function _import(nostr_hex_sk: string, request: any): Promise<any>;
63
+ /**
4
64
  * @param {string} password
5
65
  * @param {string} encrypted_descriptors
6
66
  * @returns {Promise<any>}
@@ -26,17 +86,6 @@ export function save_mnemonic_seed(mnemonic: string, encryption_password: string
26
86
  */
27
87
  export function get_wallet_data(descriptor: string, change_descriptor?: string): Promise<any>;
28
88
  /**
29
- * @param {string} asset
30
- * @param {string} utxo
31
- * @returns {Promise<any>}
32
- */
33
- export function import_asset(asset: string, utxo: string): Promise<any>;
34
- /**
35
- * @param {string} utxo_string
36
- * @returns {Promise<any>}
37
- */
38
- export function get_blinded_utxo(utxo_string: string): Promise<any>;
39
- /**
40
89
  * @param {string} descriptor
41
90
  * @param {string} change_descriptor
42
91
  * @param {string} destination
@@ -63,33 +112,18 @@ export function fund_vault(descriptor: string, change_descriptor: string, addres
63
112
  */
64
113
  export function get_assets_vault(rgb_assets_descriptor_xpub: string, rgb_udas_descriptor_xpub: string): Promise<any>;
65
114
  /**
66
- * @param {string} ticker
115
+ * @param {string} secret_key
67
116
  * @param {string} name
68
- * @param {number} precision
69
- * @param {bigint} supply
70
- * @param {string} utxo
117
+ * @param {Uint8Array} data
71
118
  * @returns {Promise<any>}
72
119
  */
73
- export function create_asset(ticker: string, name: string, precision: number, supply: bigint, utxo: string): Promise<any>;
120
+ export function store(secret_key: string, name: string, data: Uint8Array): Promise<any>;
74
121
  /**
75
- * @param {any} request
76
- * @returns {Promise<any>}
77
- */
78
- export function transfer_assets(request: any): Promise<any>;
79
- /**
80
- * @param {string} rgb_descriptor_xprv
81
- * @param {string} psbt
82
- * @returns {Promise<any>}
83
- */
84
- export function sign_psbt(rgb_descriptor_xprv: string, psbt: string): Promise<any>;
85
- /**
86
- * @param {string} consignment
87
- * @param {string} blinding_factor
88
- * @param {string} outpoint
89
- * @param {string} blinded
122
+ * @param {string} secret_key
123
+ * @param {string} name
90
124
  * @returns {Promise<any>}
91
125
  */
92
- export function accept_transfer(consignment: string, blinding_factor: string, outpoint: string, blinded: string): Promise<any>;
126
+ export function retrieve(secret_key: string, name: string): Promise<any>;
93
127
  /**
94
128
  * @returns {Promise<any>}
95
129
  */
@@ -100,27 +134,28 @@ export function get_network(): Promise<any>;
100
134
  */
101
135
  export function switch_network(network_str: string): Promise<any>;
102
136
  /**
103
- * @param {string} path
137
+ * @param {string} key
104
138
  * @returns {Promise<any>}
105
139
  */
106
- export function get_endpoint(path: string): Promise<any>;
140
+ export function get_env(key: string): Promise<any>;
107
141
  /**
108
- * @param {string} host
142
+ * @param {string} key
143
+ * @param {string} value
109
144
  * @returns {Promise<any>}
110
145
  */
111
- export function switch_host(host: string): Promise<any>;
146
+ export function set_env(key: string, value: string): Promise<any>;
112
147
  /**
113
148
  * @param {string} username
114
149
  * @param {string} password
115
150
  * @returns {Promise<any>}
116
151
  */
117
- export function ln_create_wallet(username: string, password: string): Promise<any>;
152
+ export function create_wallet(username: string, password: string): Promise<any>;
118
153
  /**
119
154
  * @param {string} username
120
155
  * @param {string} password
121
156
  * @returns {Promise<any>}
122
157
  */
123
- export function ln_auth(username: string, password: string): Promise<any>;
158
+ export function auth(username: string, password: string): Promise<any>;
124
159
  /**
125
160
  * @param {string} description
126
161
  * @param {number} amount
@@ -132,20 +167,20 @@ export function ln_create_invoice(description: string, amount: number, token: st
132
167
  * @param {string} token
133
168
  * @returns {Promise<any>}
134
169
  */
135
- export function ln_get_balance(token: string): Promise<any>;
170
+ export function get_balance(token: string): Promise<any>;
136
171
  /**
137
172
  * @param {string} token
138
173
  * @returns {Promise<any>}
139
174
  */
140
- export function ln_get_txs(token: string): Promise<any>;
175
+ export function get_txs(token: string): Promise<any>;
141
176
  /**
142
177
  * @param {string} payment_request
143
178
  * @param {string} token
144
179
  * @returns {Promise<any>}
145
180
  */
146
- export function ln_pay_invoice(payment_request: string, token: string): Promise<any>;
181
+ export function pay_invoice(payment_request: string, token: string): Promise<any>;
147
182
  /**
148
183
  * @param {string} payment_hash
149
184
  * @returns {Promise<any>}
150
185
  */
151
- export function ln_check_payment(payment_hash: string): Promise<any>;
186
+ export function check_payment(payment_hash: string): Promise<any>;
@@ -10,25 +10,7 @@ heap.push(undefined, null, true, false);
10
10
 
11
11
  function getObject(idx) { return heap[idx]; }
12
12
 
13
- let heap_next = heap.length;
14
-
15
- function dropObject(idx) {
16
- if (idx < 132) return;
17
- heap[idx] = heap_next;
18
- heap_next = idx;
19
- }
20
-
21
- function takeObject(idx) {
22
- const ret = getObject(idx);
23
- dropObject(idx);
24
- return ret;
25
- }
26
-
27
- const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
28
-
29
- let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
30
-
31
- cachedTextDecoder.decode();
13
+ let WASM_VECTOR_LEN = 0;
32
14
 
33
15
  let cachedUint8Memory0 = null;
34
16
 
@@ -39,21 +21,6 @@ function getUint8Memory0() {
39
21
  return cachedUint8Memory0;
40
22
  }
41
23
 
42
- function getStringFromWasm0(ptr, len) {
43
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
44
- }
45
-
46
- function addHeapObject(obj) {
47
- if (heap_next === heap.length) heap.push(heap.length + 1);
48
- const idx = heap_next;
49
- heap_next = heap[idx];
50
-
51
- heap[idx] = obj;
52
- return idx;
53
- }
54
-
55
- let WASM_VECTOR_LEN = 0;
56
-
57
24
  const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
58
25
 
59
26
  let cachedTextEncoder = new lTextEncoder('utf-8');
@@ -122,6 +89,39 @@ function getInt32Memory0() {
122
89
  return cachedInt32Memory0;
123
90
  }
124
91
 
92
+ let heap_next = heap.length;
93
+
94
+ function dropObject(idx) {
95
+ if (idx < 132) return;
96
+ heap[idx] = heap_next;
97
+ heap_next = idx;
98
+ }
99
+
100
+ function takeObject(idx) {
101
+ const ret = getObject(idx);
102
+ dropObject(idx);
103
+ return ret;
104
+ }
105
+
106
+ const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
107
+
108
+ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
109
+
110
+ cachedTextDecoder.decode();
111
+
112
+ function getStringFromWasm0(ptr, len) {
113
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
114
+ }
115
+
116
+ function addHeapObject(obj) {
117
+ if (heap_next === heap.length) heap.push(heap.length + 1);
118
+ const idx = heap_next;
119
+ heap_next = heap[idx];
120
+
121
+ heap[idx] = obj;
122
+ return idx;
123
+ }
124
+
125
125
  let cachedFloat64Memory0 = null;
126
126
 
127
127
  function getFloat64Memory0() {
@@ -230,7 +230,137 @@ function makeMutClosure(arg0, arg1, dtor, f) {
230
230
  return real;
231
231
  }
232
232
  function __wbg_adapter_44(arg0, arg1, arg2) {
233
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3fdc624b1171a008(arg0, arg1, addHeapObject(arg2));
233
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hcacd31037c41b0a2(arg0, arg1, addHeapObject(arg2));
234
+ }
235
+
236
+ /**
237
+ * @param {string} nostr_hex_sk
238
+ * @param {string} ticker
239
+ * @param {string} name
240
+ * @param {string} description
241
+ * @param {number} precision
242
+ * @param {bigint} supply
243
+ * @param {string} seal
244
+ * @param {string} iface
245
+ * @returns {Promise<any>}
246
+ */
247
+ export function issue_contract(nostr_hex_sk, ticker, name, description, precision, supply, seal, iface) {
248
+ const ptr0 = passStringToWasm0(nostr_hex_sk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
249
+ const len0 = WASM_VECTOR_LEN;
250
+ const ptr1 = passStringToWasm0(ticker, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
251
+ const len1 = WASM_VECTOR_LEN;
252
+ const ptr2 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
253
+ const len2 = WASM_VECTOR_LEN;
254
+ const ptr3 = passStringToWasm0(description, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
255
+ const len3 = WASM_VECTOR_LEN;
256
+ const ptr4 = passStringToWasm0(seal, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
257
+ const len4 = WASM_VECTOR_LEN;
258
+ const ptr5 = passStringToWasm0(iface, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
259
+ const len5 = WASM_VECTOR_LEN;
260
+ const ret = wasm.issue_contract(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, precision, supply, ptr4, len4, ptr5, len5);
261
+ return takeObject(ret);
262
+ }
263
+
264
+ /**
265
+ * @param {string} nostr_hex_sk
266
+ * @param {string} contract_id
267
+ * @param {string} iface
268
+ * @param {bigint} amount
269
+ * @param {string} seal
270
+ * @returns {Promise<any>}
271
+ */
272
+ export function rgb_create_invoice(nostr_hex_sk, contract_id, iface, amount, seal) {
273
+ const ptr0 = passStringToWasm0(nostr_hex_sk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
274
+ const len0 = WASM_VECTOR_LEN;
275
+ const ptr1 = passStringToWasm0(contract_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
276
+ const len1 = WASM_VECTOR_LEN;
277
+ const ptr2 = passStringToWasm0(iface, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
278
+ const len2 = WASM_VECTOR_LEN;
279
+ const ptr3 = passStringToWasm0(seal, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
280
+ const len3 = WASM_VECTOR_LEN;
281
+ const ret = wasm.rgb_create_invoice(ptr0, len0, ptr1, len1, ptr2, len2, amount, ptr3, len3);
282
+ return takeObject(ret);
283
+ }
284
+
285
+ /**
286
+ * @param {string} nostr_hex_sk
287
+ * @param {any} request
288
+ * @returns {Promise<any>}
289
+ */
290
+ export function create_psbt(nostr_hex_sk, request) {
291
+ const ptr0 = passStringToWasm0(nostr_hex_sk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
292
+ const len0 = WASM_VECTOR_LEN;
293
+ const ret = wasm.create_psbt(ptr0, len0, addHeapObject(request));
294
+ return takeObject(ret);
295
+ }
296
+
297
+ /**
298
+ * @param {string} nostr_hex_sk
299
+ * @param {any} request
300
+ * @returns {Promise<any>}
301
+ */
302
+ export function pay_asset(nostr_hex_sk, request) {
303
+ const ptr0 = passStringToWasm0(nostr_hex_sk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
304
+ const len0 = WASM_VECTOR_LEN;
305
+ const ret = wasm.pay_asset(ptr0, len0, addHeapObject(request));
306
+ return takeObject(ret);
307
+ }
308
+
309
+ /**
310
+ * @param {string} nostr_hex_sk
311
+ * @param {any} request
312
+ * @returns {Promise<any>}
313
+ */
314
+ export function accept_transfer(nostr_hex_sk, request) {
315
+ const ptr0 = passStringToWasm0(nostr_hex_sk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
316
+ const len0 = WASM_VECTOR_LEN;
317
+ const ret = wasm.accept_transfer(ptr0, len0, addHeapObject(request));
318
+ return takeObject(ret);
319
+ }
320
+
321
+ /**
322
+ * @param {string} nostr_hex_sk
323
+ * @returns {Promise<any>}
324
+ */
325
+ export function list_contracts(nostr_hex_sk) {
326
+ const ptr0 = passStringToWasm0(nostr_hex_sk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
327
+ const len0 = WASM_VECTOR_LEN;
328
+ const ret = wasm.list_contracts(ptr0, len0);
329
+ return takeObject(ret);
330
+ }
331
+
332
+ /**
333
+ * @param {string} nostr_hex_sk
334
+ * @returns {Promise<any>}
335
+ */
336
+ export function list_interfaces(nostr_hex_sk) {
337
+ const ptr0 = passStringToWasm0(nostr_hex_sk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
338
+ const len0 = WASM_VECTOR_LEN;
339
+ const ret = wasm.list_interfaces(ptr0, len0);
340
+ return takeObject(ret);
341
+ }
342
+
343
+ /**
344
+ * @param {string} nostr_hex_sk
345
+ * @returns {Promise<any>}
346
+ */
347
+ export function list_schemas(nostr_hex_sk) {
348
+ const ptr0 = passStringToWasm0(nostr_hex_sk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
349
+ const len0 = WASM_VECTOR_LEN;
350
+ const ret = wasm.list_schemas(ptr0, len0);
351
+ return takeObject(ret);
352
+ }
353
+
354
+ /**
355
+ * @param {string} nostr_hex_sk
356
+ * @param {any} request
357
+ * @returns {Promise<any>}
358
+ */
359
+ export function _import(nostr_hex_sk, request) {
360
+ const ptr0 = passStringToWasm0(nostr_hex_sk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
361
+ const len0 = WASM_VECTOR_LEN;
362
+ const ret = wasm._import(ptr0, len0, addHeapObject(request));
363
+ return takeObject(ret);
234
364
  }
235
365
 
236
366
  /**
@@ -292,31 +422,6 @@ export function get_wallet_data(descriptor, change_descriptor) {
292
422
  return takeObject(ret);
293
423
  }
294
424
 
295
- /**
296
- * @param {string} asset
297
- * @param {string} utxo
298
- * @returns {Promise<any>}
299
- */
300
- export function import_asset(asset, utxo) {
301
- const ptr0 = passStringToWasm0(asset, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
302
- const len0 = WASM_VECTOR_LEN;
303
- const ptr1 = passStringToWasm0(utxo, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
304
- const len1 = WASM_VECTOR_LEN;
305
- const ret = wasm.import_asset(ptr0, len0, ptr1, len1);
306
- return takeObject(ret);
307
- }
308
-
309
- /**
310
- * @param {string} utxo_string
311
- * @returns {Promise<any>}
312
- */
313
- export function get_blinded_utxo(utxo_string) {
314
- const ptr0 = passStringToWasm0(utxo_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
315
- const len0 = WASM_VECTOR_LEN;
316
- const ret = wasm.get_blinded_utxo(ptr0, len0);
317
- return takeObject(ret);
318
- }
319
-
320
425
  /**
321
426
  * @param {string} descriptor
322
427
  * @param {string} change_descriptor
@@ -373,65 +478,40 @@ export function get_assets_vault(rgb_assets_descriptor_xpub, rgb_udas_descriptor
373
478
  return takeObject(ret);
374
479
  }
375
480
 
481
+ function passArray8ToWasm0(arg, malloc) {
482
+ const ptr = malloc(arg.length * 1);
483
+ getUint8Memory0().set(arg, ptr / 1);
484
+ WASM_VECTOR_LEN = arg.length;
485
+ return ptr;
486
+ }
376
487
  /**
377
- * @param {string} ticker
488
+ * @param {string} secret_key
378
489
  * @param {string} name
379
- * @param {number} precision
380
- * @param {bigint} supply
381
- * @param {string} utxo
490
+ * @param {Uint8Array} data
382
491
  * @returns {Promise<any>}
383
492
  */
384
- export function create_asset(ticker, name, precision, supply, utxo) {
385
- const ptr0 = passStringToWasm0(ticker, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
493
+ export function store(secret_key, name, data) {
494
+ const ptr0 = passStringToWasm0(secret_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
386
495
  const len0 = WASM_VECTOR_LEN;
387
496
  const ptr1 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
388
497
  const len1 = WASM_VECTOR_LEN;
389
- const ptr2 = passStringToWasm0(utxo, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
498
+ const ptr2 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
390
499
  const len2 = WASM_VECTOR_LEN;
391
- const ret = wasm.create_asset(ptr0, len0, ptr1, len1, precision, supply, ptr2, len2);
392
- return takeObject(ret);
393
- }
394
-
395
- /**
396
- * @param {any} request
397
- * @returns {Promise<any>}
398
- */
399
- export function transfer_assets(request) {
400
- const ret = wasm.transfer_assets(addHeapObject(request));
500
+ const ret = wasm.store(ptr0, len0, ptr1, len1, ptr2, len2);
401
501
  return takeObject(ret);
402
502
  }
403
503
 
404
504
  /**
405
- * @param {string} rgb_descriptor_xprv
406
- * @param {string} psbt
407
- * @returns {Promise<any>}
408
- */
409
- export function sign_psbt(rgb_descriptor_xprv, psbt) {
410
- const ptr0 = passStringToWasm0(rgb_descriptor_xprv, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
411
- const len0 = WASM_VECTOR_LEN;
412
- const ptr1 = passStringToWasm0(psbt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
413
- const len1 = WASM_VECTOR_LEN;
414
- const ret = wasm.sign_psbt(ptr0, len0, ptr1, len1);
415
- return takeObject(ret);
416
- }
417
-
418
- /**
419
- * @param {string} consignment
420
- * @param {string} blinding_factor
421
- * @param {string} outpoint
422
- * @param {string} blinded
505
+ * @param {string} secret_key
506
+ * @param {string} name
423
507
  * @returns {Promise<any>}
424
508
  */
425
- export function accept_transfer(consignment, blinding_factor, outpoint, blinded) {
426
- const ptr0 = passStringToWasm0(consignment, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
509
+ export function retrieve(secret_key, name) {
510
+ const ptr0 = passStringToWasm0(secret_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
427
511
  const len0 = WASM_VECTOR_LEN;
428
- const ptr1 = passStringToWasm0(blinding_factor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
512
+ const ptr1 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
429
513
  const len1 = WASM_VECTOR_LEN;
430
- const ptr2 = passStringToWasm0(outpoint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
431
- const len2 = WASM_VECTOR_LEN;
432
- const ptr3 = passStringToWasm0(blinded, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
433
- const len3 = WASM_VECTOR_LEN;
434
- const ret = wasm.accept_transfer(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
514
+ const ret = wasm.retrieve(ptr0, len0, ptr1, len1);
435
515
  return takeObject(ret);
436
516
  }
437
517
 
@@ -455,24 +535,27 @@ export function switch_network(network_str) {
455
535
  }
456
536
 
457
537
  /**
458
- * @param {string} path
538
+ * @param {string} key
459
539
  * @returns {Promise<any>}
460
540
  */
461
- export function get_endpoint(path) {
462
- const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
541
+ export function get_env(key) {
542
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
463
543
  const len0 = WASM_VECTOR_LEN;
464
- const ret = wasm.get_endpoint(ptr0, len0);
544
+ const ret = wasm.get_env(ptr0, len0);
465
545
  return takeObject(ret);
466
546
  }
467
547
 
468
548
  /**
469
- * @param {string} host
549
+ * @param {string} key
550
+ * @param {string} value
470
551
  * @returns {Promise<any>}
471
552
  */
472
- export function switch_host(host) {
473
- const ptr0 = passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
553
+ export function set_env(key, value) {
554
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
474
555
  const len0 = WASM_VECTOR_LEN;
475
- const ret = wasm.switch_host(ptr0, len0);
556
+ const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
557
+ const len1 = WASM_VECTOR_LEN;
558
+ const ret = wasm.set_env(ptr0, len0, ptr1, len1);
476
559
  return takeObject(ret);
477
560
  }
478
561
 
@@ -481,12 +564,12 @@ export function switch_host(host) {
481
564
  * @param {string} password
482
565
  * @returns {Promise<any>}
483
566
  */
484
- export function ln_create_wallet(username, password) {
567
+ export function create_wallet(username, password) {
485
568
  const ptr0 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
486
569
  const len0 = WASM_VECTOR_LEN;
487
570
  const ptr1 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
488
571
  const len1 = WASM_VECTOR_LEN;
489
- const ret = wasm.ln_create_wallet(ptr0, len0, ptr1, len1);
572
+ const ret = wasm.create_wallet(ptr0, len0, ptr1, len1);
490
573
  return takeObject(ret);
491
574
  }
492
575
 
@@ -495,12 +578,12 @@ export function ln_create_wallet(username, password) {
495
578
  * @param {string} password
496
579
  * @returns {Promise<any>}
497
580
  */
498
- export function ln_auth(username, password) {
581
+ export function auth(username, password) {
499
582
  const ptr0 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
500
583
  const len0 = WASM_VECTOR_LEN;
501
584
  const ptr1 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
502
585
  const len1 = WASM_VECTOR_LEN;
503
- const ret = wasm.ln_auth(ptr0, len0, ptr1, len1);
586
+ const ret = wasm.auth(ptr0, len0, ptr1, len1);
504
587
  return takeObject(ret);
505
588
  }
506
589
 
@@ -523,10 +606,10 @@ export function ln_create_invoice(description, amount, token) {
523
606
  * @param {string} token
524
607
  * @returns {Promise<any>}
525
608
  */
526
- export function ln_get_balance(token) {
609
+ export function get_balance(token) {
527
610
  const ptr0 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
528
611
  const len0 = WASM_VECTOR_LEN;
529
- const ret = wasm.ln_get_balance(ptr0, len0);
612
+ const ret = wasm.get_balance(ptr0, len0);
530
613
  return takeObject(ret);
531
614
  }
532
615
 
@@ -534,10 +617,10 @@ export function ln_get_balance(token) {
534
617
  * @param {string} token
535
618
  * @returns {Promise<any>}
536
619
  */
537
- export function ln_get_txs(token) {
620
+ export function get_txs(token) {
538
621
  const ptr0 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
539
622
  const len0 = WASM_VECTOR_LEN;
540
- const ret = wasm.ln_get_txs(ptr0, len0);
623
+ const ret = wasm.get_txs(ptr0, len0);
541
624
  return takeObject(ret);
542
625
  }
543
626
 
@@ -546,12 +629,12 @@ export function ln_get_txs(token) {
546
629
  * @param {string} token
547
630
  * @returns {Promise<any>}
548
631
  */
549
- export function ln_pay_invoice(payment_request, token) {
632
+ export function pay_invoice(payment_request, token) {
550
633
  const ptr0 = passStringToWasm0(payment_request, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
551
634
  const len0 = WASM_VECTOR_LEN;
552
635
  const ptr1 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
553
636
  const len1 = WASM_VECTOR_LEN;
554
- const ret = wasm.ln_pay_invoice(ptr0, len0, ptr1, len1);
637
+ const ret = wasm.pay_invoice(ptr0, len0, ptr1, len1);
555
638
  return takeObject(ret);
556
639
  }
557
640
 
@@ -559,10 +642,10 @@ export function ln_pay_invoice(payment_request, token) {
559
642
  * @param {string} payment_hash
560
643
  * @returns {Promise<any>}
561
644
  */
562
- export function ln_check_payment(payment_hash) {
645
+ export function check_payment(payment_hash) {
563
646
  const ptr0 = passStringToWasm0(payment_hash, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
564
647
  const len0 = WASM_VECTOR_LEN;
565
- const ret = wasm.ln_check_payment(ptr0, len0);
648
+ const ret = wasm.check_payment(ptr0, len0);
566
649
  return takeObject(ret);
567
650
  }
568
651
 
@@ -592,14 +675,19 @@ function handleError(f, args) {
592
675
  wasm.__wbindgen_exn_store(addHeapObject(e));
593
676
  }
594
677
  }
595
-
596
- function getArrayU8FromWasm0(ptr, len) {
597
- return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
598
- }
599
- function __wbg_adapter_157(arg0, arg1, arg2, arg3) {
600
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h3e61d16b57f4f2a2(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
678
+ function __wbg_adapter_166(arg0, arg1, arg2, arg3) {
679
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h0241322dea79832f(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
601
680
  }
602
681
 
682
+ export function __wbindgen_string_get(arg0, arg1) {
683
+ const obj = getObject(arg1);
684
+ const ret = typeof(obj) === 'string' ? obj : undefined;
685
+ var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
686
+ var len0 = WASM_VECTOR_LEN;
687
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
688
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
689
+ };
690
+
603
691
  export function __wbindgen_object_drop_ref(arg0) {
604
692
  takeObject(arg0);
605
693
  };
@@ -609,13 +697,14 @@ export function __wbindgen_string_new(arg0, arg1) {
609
697
  return addHeapObject(ret);
610
698
  };
611
699
 
612
- export function __wbindgen_string_get(arg0, arg1) {
613
- const obj = getObject(arg1);
614
- const ret = typeof(obj) === 'string' ? obj : undefined;
615
- var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
616
- var len0 = WASM_VECTOR_LEN;
617
- getInt32Memory0()[arg0 / 4 + 1] = len0;
618
- getInt32Memory0()[arg0 / 4 + 0] = ptr0;
700
+ export function __wbindgen_cb_drop(arg0) {
701
+ const obj = takeObject(arg0).original;
702
+ if (obj.cnt-- == 1) {
703
+ obj.a = 0;
704
+ return true;
705
+ }
706
+ const ret = false;
707
+ return ret;
619
708
  };
620
709
 
621
710
  export function __wbindgen_error_new(arg0, arg1) {
@@ -623,6 +712,11 @@ export function __wbindgen_error_new(arg0, arg1) {
623
712
  return addHeapObject(ret);
624
713
  };
625
714
 
715
+ export function __wbindgen_is_string(arg0) {
716
+ const ret = typeof(getObject(arg0)) === 'string';
717
+ return ret;
718
+ };
719
+
626
720
  export function __wbindgen_is_object(arg0) {
627
721
  const val = getObject(arg0);
628
722
  const ret = typeof(val) === 'object' && val !== null;
@@ -654,16 +748,6 @@ export function __wbindgen_jsval_eq(arg0, arg1) {
654
748
  return ret;
655
749
  };
656
750
 
657
- export function __wbindgen_cb_drop(arg0) {
658
- const obj = takeObject(arg0).original;
659
- if (obj.cnt-- == 1) {
660
- obj.a = 0;
661
- return true;
662
- }
663
- const ret = false;
664
- return ret;
665
- };
666
-
667
751
  export function __wbindgen_jsval_loose_eq(arg0, arg1) {
668
752
  const ret = getObject(arg0) == getObject(arg1);
669
753
  return ret;
@@ -687,7 +771,7 @@ export function __wbindgen_object_clone_ref(arg0) {
687
771
  return addHeapObject(ret);
688
772
  };
689
773
 
690
- export function __wbg_getwithrefkey_15c62c2b8546208d(arg0, arg1) {
774
+ export function __wbg_getwithrefkey_5e6d9547403deab8(arg0, arg1) {
691
775
  const ret = getObject(arg0)[getObject(arg1)];
692
776
  return addHeapObject(ret);
693
777
  };
@@ -719,6 +803,12 @@ export function __wbg_debug_783a3d4910bc24c7(arg0, arg1) {
719
803
  console.debug(...v0);
720
804
  };
721
805
 
806
+ export function __wbg_error_71d6845bf00a930f(arg0, arg1) {
807
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
808
+ wasm.__wbindgen_free(arg0, arg1 * 4);
809
+ console.error(...v0);
810
+ };
811
+
722
812
  export function __wbg_info_0d469cecacab90cb(arg0, arg1) {
723
813
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
724
814
  wasm.__wbindgen_free(arg0, arg1 * 4);
@@ -731,11 +821,21 @@ export function __wbg_trace_fe50dc146726736b(arg0, arg1) {
731
821
  console.trace(...v0);
732
822
  };
733
823
 
734
- export function __wbg_fetch_243cc97689681079(arg0) {
824
+ export function __wbg_fetch_cf75ae0b20981e3e(arg0) {
735
825
  const ret = fetch(getObject(arg0));
736
826
  return addHeapObject(ret);
737
827
  };
738
828
 
829
+ export function __wbg_newwithstrandinit_c45f0dc6da26fd03() { return handleError(function (arg0, arg1, arg2) {
830
+ const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
831
+ return addHeapObject(ret);
832
+ }, arguments) };
833
+
834
+ export function __wbg_fetch_661ffba2a4f2519c(arg0, arg1) {
835
+ const ret = getObject(arg0).fetch(getObject(arg1));
836
+ return addHeapObject(ret);
837
+ };
838
+
739
839
  export function __wbg_signal_686bf5a4acff74a1(arg0) {
740
840
  const ret = getObject(arg0).signal;
741
841
  return addHeapObject(ret);
@@ -750,11 +850,6 @@ export function __wbg_abort_5f06bf3b2954cf33(arg0) {
750
850
  getObject(arg0).abort();
751
851
  };
752
852
 
753
- export function __wbg_fetch_661ffba2a4f2519c(arg0, arg1) {
754
- const ret = getObject(arg0).fetch(getObject(arg1));
755
- return addHeapObject(ret);
756
- };
757
-
758
853
  export function __wbg_instanceof_Response_fb3a4df648c1859b(arg0) {
759
854
  let result;
760
855
  try {
@@ -803,50 +898,32 @@ export function __wbg_append_1be1d651f9ecf2eb() { return handleError(function (a
803
898
  getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
804
899
  }, arguments) };
805
900
 
806
- export function __wbg_newwithstrandinit_c45f0dc6da26fd03() { return handleError(function (arg0, arg1, arg2) {
807
- const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
808
- return addHeapObject(ret);
809
- }, arguments) };
810
-
811
- export function __wbg_randomFillSync_6894564c2c334c42() { return handleError(function (arg0, arg1, arg2) {
812
- getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
813
- }, arguments) };
814
-
815
- export function __wbg_getRandomValues_805f1c3d65988a5a() { return handleError(function (arg0, arg1) {
816
- getObject(arg0).getRandomValues(getObject(arg1));
817
- }, arguments) };
818
-
819
- export function __wbg_crypto_e1d53a1d73fb10b8(arg0) {
901
+ export function __wbg_crypto_70a96de3b6b73dac(arg0) {
820
902
  const ret = getObject(arg0).crypto;
821
903
  return addHeapObject(ret);
822
904
  };
823
905
 
824
- export function __wbg_process_038c26bf42b093f8(arg0) {
906
+ export function __wbg_process_dd1577445152112e(arg0) {
825
907
  const ret = getObject(arg0).process;
826
908
  return addHeapObject(ret);
827
909
  };
828
910
 
829
- export function __wbg_versions_ab37218d2f0b24a8(arg0) {
911
+ export function __wbg_versions_58036bec3add9e6f(arg0) {
830
912
  const ret = getObject(arg0).versions;
831
913
  return addHeapObject(ret);
832
914
  };
833
915
 
834
- export function __wbg_node_080f4b19d15bc1fe(arg0) {
916
+ export function __wbg_node_6a9d28205ed5b0d8(arg0) {
835
917
  const ret = getObject(arg0).node;
836
918
  return addHeapObject(ret);
837
919
  };
838
920
 
839
- export function __wbindgen_is_string(arg0) {
840
- const ret = typeof(getObject(arg0)) === 'string';
841
- return ret;
842
- };
843
-
844
- export function __wbg_msCrypto_6e7d3e1f92610cbb(arg0) {
921
+ export function __wbg_msCrypto_adbc770ec9eca9c7(arg0) {
845
922
  const ret = getObject(arg0).msCrypto;
846
923
  return addHeapObject(ret);
847
924
  };
848
925
 
849
- export function __wbg_require_78a3dcfbdba9cbce() { return handleError(function () {
926
+ export function __wbg_require_f05d779769764e82() { return handleError(function () {
850
927
  const ret = module.require;
851
928
  return addHeapObject(ret);
852
929
  }, arguments) };
@@ -856,6 +933,14 @@ export function __wbindgen_is_function(arg0) {
856
933
  return ret;
857
934
  };
858
935
 
936
+ export function __wbg_getRandomValues_3774744e221a22ad() { return handleError(function (arg0, arg1) {
937
+ getObject(arg0).getRandomValues(getObject(arg1));
938
+ }, arguments) };
939
+
940
+ export function __wbg_randomFillSync_e950366c42764a07() { return handleError(function (arg0, arg1) {
941
+ getObject(arg0).randomFillSync(takeObject(arg1));
942
+ }, arguments) };
943
+
859
944
  export function __wbg_get_27fe3dac1c4d0224(arg0, arg1) {
860
945
  const ret = getObject(arg0)[arg1 >>> 0];
861
946
  return addHeapObject(ret);
@@ -962,6 +1047,11 @@ export function __wbg_now_931686b195a14f9d() {
962
1047
  return ret;
963
1048
  };
964
1049
 
1050
+ export function __wbg_entries_4e1315b774245952(arg0) {
1051
+ const ret = Object.entries(getObject(arg0));
1052
+ return addHeapObject(ret);
1053
+ };
1054
+
965
1055
  export function __wbg_new_9d3a9ce4282a18a8(arg0, arg1) {
966
1056
  try {
967
1057
  var state0 = {a: arg0, b: arg1};
@@ -969,7 +1059,7 @@ export function __wbg_new_9d3a9ce4282a18a8(arg0, arg1) {
969
1059
  const a = state0.a;
970
1060
  state0.a = 0;
971
1061
  try {
972
- return __wbg_adapter_157(a, state0.b, arg0, arg1);
1062
+ return __wbg_adapter_166(a, state0.b, arg0, arg1);
973
1063
  } finally {
974
1064
  state0.a = a;
975
1065
  }
@@ -1080,8 +1170,8 @@ export function __wbindgen_memory() {
1080
1170
  return addHeapObject(ret);
1081
1171
  };
1082
1172
 
1083
- export function __wbindgen_closure_wrapper3211(arg0, arg1, arg2) {
1084
- const ret = makeMutClosure(arg0, arg1, 1105, __wbg_adapter_44);
1173
+ export function __wbindgen_closure_wrapper10293(arg0, arg1, arg2) {
1174
+ const ret = makeMutClosure(arg0, arg1, 2517, __wbg_adapter_44);
1085
1175
  return addHeapObject(ret);
1086
1176
  };
1087
1177
 
Binary file
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "Francisco Calderón <francisco@diba.io>"
7
7
  ],
8
8
  "description": "Core functionality for the BitMask wallet",
9
- "version": "0.5.2",
9
+ "version": "0.6.0-beta.1",
10
10
  "license": "MIT",
11
11
  "repository": {
12
12
  "type": "git",