bitmask-core 0.4.0-alpha.3 → 0.4.0-alpha.4

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/bitmask_core.d.ts CHANGED
@@ -26,12 +26,6 @@ export function save_mnemonic_seed(mnemonic: string, encryption_password: string
26
26
  */
27
27
  export function get_wallet_data(descriptor: string, change_descriptor?: string): Promise<any>;
28
28
  /**
29
- * @param {string} xpubkh
30
- * @param {string} encryption_secret
31
- * @returns {Promise<any>}
32
- */
33
- export function list_assets(xpubkh: string, encryption_secret: string): Promise<any>;
34
- /**
35
29
  * @param {string} asset
36
30
  * @param {string} rgb_descriptor_xpub
37
31
  * @returns {Promise<any>}
@@ -63,6 +57,15 @@ export function send_sats(descriptor: string, change_descriptor: string, address
63
57
  */
64
58
  export function fund_vault(descriptor: string, change_descriptor: string, address: string, uda_address: string, asset_amount: bigint, uda_amount: bigint, fee_rate?: number): Promise<any>;
65
59
  /**
60
+ * @param {string} ticker
61
+ * @param {string} name
62
+ * @param {number} precision
63
+ * @param {bigint} supply
64
+ * @param {string} utxo
65
+ * @returns {Promise<any>}
66
+ */
67
+ export function create_asset(ticker: string, name: string, precision: number, supply: bigint, utxo: string): Promise<any>;
68
+ /**
66
69
  * @param {string} btc_descriptor_xprv
67
70
  * @param {string} btc_change_descriptor_xprv
68
71
  * @param {string} rgb_assets_descriptor_xprv
@@ -75,13 +78,21 @@ export function fund_vault(descriptor: string, change_descriptor: string, addres
75
78
  */
76
79
  export function send_assets(btc_descriptor_xprv: string, btc_change_descriptor_xprv: string, rgb_assets_descriptor_xprv: string, rgb_assets_descriptor_xpub: string, blinded_utxo: string, amount: bigint, asset_contract: string, fee_rate: number): Promise<any>;
77
80
  /**
78
- * @param {string} utxo_string
79
81
  * @returns {Promise<any>}
80
82
  */
81
- export function validate_transfer(utxo_string: string): Promise<any>;
83
+ export function get_network(): Promise<any>;
84
+ /**
85
+ * @param {string} network_str
86
+ * @returns {Promise<any>}
87
+ */
88
+ export function switch_network(network_str: string): Promise<any>;
89
+ /**
90
+ * @param {string} path
91
+ * @returns {Promise<any>}
92
+ */
93
+ export function get_endpoint(path: string): Promise<any>;
82
94
  /**
83
- * @param {string} consignment
84
- * @param {string} blinding
95
+ * @param {string} host
85
96
  * @returns {Promise<any>}
86
97
  */
87
- export function accept_transfer(consignment: string, blinding: string): Promise<any>;
98
+ export function switch_host(host: string): Promise<any>;
@@ -1,5 +1,25 @@
1
1
  import * as wasm from './bitmask_core_bg.wasm';
2
2
 
3
+ const heap = new Array(32).fill(undefined);
4
+
5
+ heap.push(undefined, null, true, false);
6
+
7
+ function getObject(idx) { return heap[idx]; }
8
+
9
+ let heap_next = heap.length;
10
+
11
+ function dropObject(idx) {
12
+ if (idx < 36) return;
13
+ heap[idx] = heap_next;
14
+ heap_next = idx;
15
+ }
16
+
17
+ function takeObject(idx) {
18
+ const ret = getObject(idx);
19
+ dropObject(idx);
20
+ return ret;
21
+ }
22
+
3
23
  const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
4
24
 
5
25
  let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
@@ -19,12 +39,6 @@ function getStringFromWasm0(ptr, len) {
19
39
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
20
40
  }
21
41
 
22
- const heap = new Array(32).fill(undefined);
23
-
24
- heap.push(undefined, null, true, false);
25
-
26
- let heap_next = heap.length;
27
-
28
42
  function addHeapObject(obj) {
29
43
  if (heap_next === heap.length) heap.push(heap.length + 1);
30
44
  const idx = heap_next;
@@ -34,20 +48,6 @@ function addHeapObject(obj) {
34
48
  return idx;
35
49
  }
36
50
 
37
- function getObject(idx) { return heap[idx]; }
38
-
39
- function dropObject(idx) {
40
- if (idx < 36) return;
41
- heap[idx] = heap_next;
42
- heap_next = idx;
43
- }
44
-
45
- function takeObject(idx) {
46
- const ret = getObject(idx);
47
- dropObject(idx);
48
- return ret;
49
- }
50
-
51
51
  let WASM_VECTOR_LEN = 0;
52
52
 
53
53
  const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
@@ -208,7 +208,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
208
208
  return real;
209
209
  }
210
210
  function __wbg_adapter_28(arg0, arg1, arg2) {
211
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf882b845ad73e904(arg0, arg1, addHeapObject(arg2));
211
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha170fae5fa67bd5e(arg0, arg1, addHeapObject(arg2));
212
212
  }
213
213
 
214
214
  /**
@@ -270,20 +270,6 @@ export function get_wallet_data(descriptor, change_descriptor) {
270
270
  return takeObject(ret);
271
271
  }
272
272
 
273
- /**
274
- * @param {string} xpubkh
275
- * @param {string} encryption_secret
276
- * @returns {Promise<any>}
277
- */
278
- export function list_assets(xpubkh, encryption_secret) {
279
- const ptr0 = passStringToWasm0(xpubkh, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
280
- const len0 = WASM_VECTOR_LEN;
281
- const ptr1 = passStringToWasm0(encryption_secret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
282
- const len1 = WASM_VECTOR_LEN;
283
- const ret = wasm.list_assets(ptr0, len0, ptr1, len1);
284
- return takeObject(ret);
285
- }
286
-
287
273
  /**
288
274
  * @param {string} asset
289
275
  * @param {string} rgb_descriptor_xpub
@@ -351,6 +337,25 @@ export function fund_vault(descriptor, change_descriptor, address, uda_address,
351
337
  return takeObject(ret);
352
338
  }
353
339
 
340
+ /**
341
+ * @param {string} ticker
342
+ * @param {string} name
343
+ * @param {number} precision
344
+ * @param {bigint} supply
345
+ * @param {string} utxo
346
+ * @returns {Promise<any>}
347
+ */
348
+ export function create_asset(ticker, name, precision, supply, utxo) {
349
+ const ptr0 = passStringToWasm0(ticker, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
350
+ const len0 = WASM_VECTOR_LEN;
351
+ const ptr1 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
352
+ const len1 = WASM_VECTOR_LEN;
353
+ const ptr2 = passStringToWasm0(utxo, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
354
+ const len2 = WASM_VECTOR_LEN;
355
+ const ret = wasm.create_asset(ptr0, len0, ptr1, len1, precision, supply, ptr2, len2);
356
+ return takeObject(ret);
357
+ }
358
+
354
359
  /**
355
360
  * @param {string} btc_descriptor_xprv
356
361
  * @param {string} btc_change_descriptor_xprv
@@ -380,27 +385,43 @@ export function send_assets(btc_descriptor_xprv, btc_change_descriptor_xprv, rgb
380
385
  }
381
386
 
382
387
  /**
383
- * @param {string} utxo_string
384
388
  * @returns {Promise<any>}
385
389
  */
386
- export function validate_transfer(utxo_string) {
387
- const ptr0 = passStringToWasm0(utxo_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
390
+ export function get_network() {
391
+ const ret = wasm.get_network();
392
+ return takeObject(ret);
393
+ }
394
+
395
+ /**
396
+ * @param {string} network_str
397
+ * @returns {Promise<any>}
398
+ */
399
+ export function switch_network(network_str) {
400
+ const ptr0 = passStringToWasm0(network_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
388
401
  const len0 = WASM_VECTOR_LEN;
389
- const ret = wasm.validate_transfer(ptr0, len0);
402
+ const ret = wasm.switch_network(ptr0, len0);
390
403
  return takeObject(ret);
391
404
  }
392
405
 
393
406
  /**
394
- * @param {string} consignment
395
- * @param {string} blinding
407
+ * @param {string} path
396
408
  * @returns {Promise<any>}
397
409
  */
398
- export function accept_transfer(consignment, blinding) {
399
- const ptr0 = passStringToWasm0(consignment, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
410
+ export function get_endpoint(path) {
411
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
400
412
  const len0 = WASM_VECTOR_LEN;
401
- const ptr1 = passStringToWasm0(blinding, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
402
- const len1 = WASM_VECTOR_LEN;
403
- const ret = wasm.accept_transfer(ptr0, len0, ptr1, len1);
413
+ const ret = wasm.get_endpoint(ptr0, len0);
414
+ return takeObject(ret);
415
+ }
416
+
417
+ /**
418
+ * @param {string} host
419
+ * @returns {Promise<any>}
420
+ */
421
+ export function switch_host(host) {
422
+ const ptr0 = passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
423
+ const len0 = WASM_VECTOR_LEN;
424
+ const ret = wasm.switch_host(ptr0, len0);
404
425
  return takeObject(ret);
405
426
  }
406
427
 
@@ -434,15 +455,10 @@ function handleError(f, args) {
434
455
  function getArrayU8FromWasm0(ptr, len) {
435
456
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
436
457
  }
437
- function __wbg_adapter_151(arg0, arg1, arg2, arg3) {
438
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h5b601c5499c8b6c7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
458
+ function __wbg_adapter_159(arg0, arg1, arg2, arg3) {
459
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h18c6a056f8357172(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
439
460
  }
440
461
 
441
- export function __wbindgen_string_new(arg0, arg1) {
442
- const ret = getStringFromWasm0(arg0, arg1);
443
- return addHeapObject(ret);
444
- };
445
-
446
462
  export function __wbindgen_object_drop_ref(arg0) {
447
463
  takeObject(arg0);
448
464
  };
@@ -457,6 +473,11 @@ export function __wbindgen_cb_drop(arg0) {
457
473
  return ret;
458
474
  };
459
475
 
476
+ export function __wbindgen_string_new(arg0, arg1) {
477
+ const ret = getStringFromWasm0(arg0, arg1);
478
+ return addHeapObject(ret);
479
+ };
480
+
460
481
  export function __wbindgen_string_get(arg0, arg1) {
461
482
  const obj = getObject(arg1);
462
483
  const ret = typeof(obj) === 'string' ? obj : undefined;
@@ -466,6 +487,27 @@ export function __wbindgen_string_get(arg0, arg1) {
466
487
  getInt32Memory0()[arg0 / 4 + 0] = ptr0;
467
488
  };
468
489
 
490
+ export function __wbg_new_abda76e883ba8a5f() {
491
+ const ret = new Error();
492
+ return addHeapObject(ret);
493
+ };
494
+
495
+ export function __wbg_stack_658279fe44541cf6(arg0, arg1) {
496
+ const ret = getObject(arg1).stack;
497
+ const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
498
+ const len0 = WASM_VECTOR_LEN;
499
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
500
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
501
+ };
502
+
503
+ export function __wbg_error_f851667af71bcfc6(arg0, arg1) {
504
+ try {
505
+ console.error(getStringFromWasm0(arg0, arg1));
506
+ } finally {
507
+ wasm.__wbindgen_free(arg0, arg1);
508
+ }
509
+ };
510
+
469
511
  export function __wbg_debug_783a3d4910bc24c7(arg0, arg1) {
470
512
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
471
513
  wasm.__wbindgen_free(arg0, arg1 * 4);
@@ -607,6 +649,11 @@ export function __wbg_fetch_0fe04905cccfc2aa(arg0, arg1) {
607
649
  return addHeapObject(ret);
608
650
  };
609
651
 
652
+ export function __wbg_fetch_749a56934f95c96c(arg0, arg1) {
653
+ const ret = getObject(arg0).fetch(getObject(arg1));
654
+ return addHeapObject(ret);
655
+ };
656
+
610
657
  export function __wbg_instanceof_Response_eaa426220848a39e(arg0) {
611
658
  let result;
612
659
  try {
@@ -646,10 +693,18 @@ export function __wbg_text_1169d752cc697903() { return handleError(function (arg
646
693
  return addHeapObject(ret);
647
694
  }, arguments) };
648
695
 
649
- export function __wbg_fetch_749a56934f95c96c(arg0, arg1) {
650
- const ret = getObject(arg0).fetch(getObject(arg1));
696
+ export function __wbg_new_2d0053ee81e4dd2a() { return handleError(function () {
697
+ const ret = new Headers();
651
698
  return addHeapObject(ret);
652
- };
699
+ }, arguments) };
700
+
701
+ export function __wbg_append_de37df908812970d() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
702
+ getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
703
+ }, arguments) };
704
+
705
+ export function __wbg_set_992c1d31586b2957() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
706
+ getObject(arg0).set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
707
+ }, arguments) };
653
708
 
654
709
  export function __wbg_new_ca4d3a3eca340210() { return handleError(function () {
655
710
  const ret = new URLSearchParams();
@@ -691,19 +746,6 @@ export function __wbg_new_7d95b89914e4d377() { return handleError(function (arg0
691
746
  return addHeapObject(ret);
692
747
  }, arguments) };
693
748
 
694
- export function __wbg_new_2d0053ee81e4dd2a() { return handleError(function () {
695
- const ret = new Headers();
696
- return addHeapObject(ret);
697
- }, arguments) };
698
-
699
- export function __wbg_append_de37df908812970d() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
700
- getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
701
- }, arguments) };
702
-
703
- export function __wbg_set_992c1d31586b2957() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
704
- getObject(arg0).set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
705
- }, arguments) };
706
-
707
749
  export function __wbindgen_is_function(arg0) {
708
750
  const ret = typeof(getObject(arg0)) === 'function';
709
751
  return ret;
@@ -822,7 +864,7 @@ export function __wbg_new_9962f939219f1820(arg0, arg1) {
822
864
  const a = state0.a;
823
865
  state0.a = 0;
824
866
  try {
825
- return __wbg_adapter_151(a, state0.b, arg0, arg1);
867
+ return __wbg_adapter_159(a, state0.b, arg0, arg1);
826
868
  } finally {
827
869
  state0.a = a;
828
870
  }
@@ -958,8 +1000,8 @@ export function __wbindgen_memory() {
958
1000
  return addHeapObject(ret);
959
1001
  };
960
1002
 
961
- export function __wbindgen_closure_wrapper2910(arg0, arg1, arg2) {
962
- const ret = makeMutClosure(arg0, arg1, 905, __wbg_adapter_28);
1003
+ export function __wbindgen_closure_wrapper2979(arg0, arg1, arg2) {
1004
+ const ret = makeMutClosure(arg0, arg1, 932, __wbg_adapter_28);
963
1005
  return addHeapObject(ret);
964
1006
  };
965
1007
 
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Hunter Trujillo <cryptoquick@pm.me>"
6
6
  ],
7
7
  "description": "Core functionality for the BitMask wallet",
8
- "version": "0.4.0-alpha.3",
8
+ "version": "0.4.0-alpha.4",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",