bitmask-core 0.4.3 → 0.5.0-rc.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
@@ -43,3 +43,26 @@ Then run `bitmaskd`.
43
43
  Parts of this application are built with conditional compilation statements for wasm32 support. This is a helpful command for checking linting and correctness while also developing on desktop platforms:
44
44
 
45
45
  `cargo clippy --target wasm32-unknown-unknown --no-default-features --release`
46
+
47
+ ## Docker
48
+
49
+ For running bitmask-core tests in regtest, please follow the steps bellow:
50
+
51
+ 1. Build bitcoin node + electrum: `docker compose build`
52
+ 2. Up and running containers: `docker compose up -d node1`
53
+ 3. Load the command line: `source .commands`
54
+ 4. Send some coins to main wallet address: `node1 sendtoaddress {ADDRESS} 1`
55
+ 5. Mine a block: `node1 -generate`
56
+ 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`
57
+
58
+ ### Troubleshooting
59
+
60
+ #### **1. After restarting the container**
61
+
62
+ **A.The bitcoin node does not work?**
63
+
64
+ Check if your wallet is loaded. For that, run the command `node1 loadwallet default`.
65
+
66
+ **B.The electrs node does not work?**
67
+
68
+ To stop the electrs freeze, run `node1 -generate`.
package/bitmask_core.d.ts CHANGED
@@ -28,10 +28,9 @@ export function get_wallet_data(descriptor: string, change_descriptor?: string):
28
28
  /**
29
29
  * @param {string} asset
30
30
  * @param {string} utxo
31
- * @param {string} blinded
32
31
  * @returns {Promise<any>}
33
32
  */
34
- export function import_asset(asset: string, utxo: string, blinded: string): Promise<any>;
33
+ export function import_asset(asset: string, utxo: string): Promise<any>;
35
34
  /**
36
35
  * @param {string} utxo_string
37
36
  * @returns {Promise<any>}
@@ -73,18 +72,6 @@ export function get_assets_vault(rgb_assets_descriptor_xpub: string, rgb_udas_de
73
72
  */
74
73
  export function create_asset(ticker: string, name: string, precision: number, supply: bigint, utxo: string): Promise<any>;
75
74
  /**
76
- * @param {string} btc_descriptor_xprv
77
- * @param {string} btc_change_descriptor_xprv
78
- * @param {string} rgb_assets_descriptor_xprv
79
- * @param {string} rgb_assets_descriptor_xpub
80
- * @param {string} blinded_utxo
81
- * @param {bigint} amount
82
- * @param {string} asset_contract
83
- * @param {number} fee_rate
84
- * @returns {Promise<any>}
85
- */
86
- 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>;
87
- /**
88
75
  * @param {string} consignment
89
76
  * @param {string} blinding_factor
90
77
  * @param {string} outpoint
@@ -1,41 +1,13 @@
1
1
  import * as wasm from './bitmask_core_bg.wasm';
2
2
 
3
- const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
4
-
5
- let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
6
-
7
- cachedTextDecoder.decode();
8
-
9
- let cachedUint8Memory0 = new Uint8Array();
10
-
11
- function getUint8Memory0() {
12
- if (cachedUint8Memory0.byteLength === 0) {
13
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
14
- }
15
- return cachedUint8Memory0;
16
- }
17
-
18
- function getStringFromWasm0(ptr, len) {
19
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
20
- }
21
-
22
3
  const heap = new Array(32).fill(undefined);
23
4
 
24
5
  heap.push(undefined, null, true, false);
25
6
 
26
- let heap_next = heap.length;
27
-
28
- function addHeapObject(obj) {
29
- if (heap_next === heap.length) heap.push(heap.length + 1);
30
- const idx = heap_next;
31
- heap_next = heap[idx];
32
-
33
- heap[idx] = obj;
34
- return idx;
35
- }
36
-
37
7
  function getObject(idx) { return heap[idx]; }
38
8
 
9
+ let heap_next = heap.length;
10
+
39
11
  function dropObject(idx) {
40
12
  if (idx < 36) return;
41
13
  heap[idx] = heap_next;
@@ -50,6 +22,15 @@ function takeObject(idx) {
50
22
 
51
23
  let WASM_VECTOR_LEN = 0;
52
24
 
25
+ let cachedUint8Memory0 = new Uint8Array();
26
+
27
+ function getUint8Memory0() {
28
+ if (cachedUint8Memory0.byteLength === 0) {
29
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
30
+ }
31
+ return cachedUint8Memory0;
32
+ }
33
+
53
34
  const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
54
35
 
55
36
  let cachedTextEncoder = new lTextEncoder('utf-8');
@@ -118,6 +99,25 @@ function getInt32Memory0() {
118
99
  return cachedInt32Memory0;
119
100
  }
120
101
 
102
+ const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
103
+
104
+ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
105
+
106
+ cachedTextDecoder.decode();
107
+
108
+ function getStringFromWasm0(ptr, len) {
109
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
110
+ }
111
+
112
+ function addHeapObject(obj) {
113
+ if (heap_next === heap.length) heap.push(heap.length + 1);
114
+ const idx = heap_next;
115
+ heap_next = heap[idx];
116
+
117
+ heap[idx] = obj;
118
+ return idx;
119
+ }
120
+
121
121
  function debugString(val) {
122
122
  // primitive types
123
123
  const type = typeof val;
@@ -207,8 +207,8 @@ function makeMutClosure(arg0, arg1, dtor, f) {
207
207
 
208
208
  return real;
209
209
  }
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__h57d3c75528372ef2(arg0, arg1, addHeapObject(arg2));
210
+ function __wbg_adapter_26(arg0, arg1, arg2) {
211
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hbe3df01c3df2952a(arg0, arg1, addHeapObject(arg2));
212
212
  }
213
213
 
214
214
  /**
@@ -273,17 +273,14 @@ export function get_wallet_data(descriptor, change_descriptor) {
273
273
  /**
274
274
  * @param {string} asset
275
275
  * @param {string} utxo
276
- * @param {string} blinded
277
276
  * @returns {Promise<any>}
278
277
  */
279
- export function import_asset(asset, utxo, blinded) {
278
+ export function import_asset(asset, utxo) {
280
279
  const ptr0 = passStringToWasm0(asset, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
281
280
  const len0 = WASM_VECTOR_LEN;
282
281
  const ptr1 = passStringToWasm0(utxo, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
283
282
  const len1 = WASM_VECTOR_LEN;
284
- const ptr2 = passStringToWasm0(blinded, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
285
- const len2 = WASM_VECTOR_LEN;
286
- const ret = wasm.import_asset(ptr0, len0, ptr1, len1, ptr2, len2);
283
+ const ret = wasm.import_asset(ptr0, len0, ptr1, len1);
287
284
  return takeObject(ret);
288
285
  }
289
286
 
@@ -373,34 +370,6 @@ export function create_asset(ticker, name, precision, supply, utxo) {
373
370
  return takeObject(ret);
374
371
  }
375
372
 
376
- /**
377
- * @param {string} btc_descriptor_xprv
378
- * @param {string} btc_change_descriptor_xprv
379
- * @param {string} rgb_assets_descriptor_xprv
380
- * @param {string} rgb_assets_descriptor_xpub
381
- * @param {string} blinded_utxo
382
- * @param {bigint} amount
383
- * @param {string} asset_contract
384
- * @param {number} fee_rate
385
- * @returns {Promise<any>}
386
- */
387
- export function send_assets(btc_descriptor_xprv, btc_change_descriptor_xprv, rgb_assets_descriptor_xprv, rgb_assets_descriptor_xpub, blinded_utxo, amount, asset_contract, fee_rate) {
388
- const ptr0 = passStringToWasm0(btc_descriptor_xprv, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
389
- const len0 = WASM_VECTOR_LEN;
390
- const ptr1 = passStringToWasm0(btc_change_descriptor_xprv, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
391
- const len1 = WASM_VECTOR_LEN;
392
- const ptr2 = passStringToWasm0(rgb_assets_descriptor_xprv, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
393
- const len2 = WASM_VECTOR_LEN;
394
- const ptr3 = passStringToWasm0(rgb_assets_descriptor_xpub, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
395
- const len3 = WASM_VECTOR_LEN;
396
- const ptr4 = passStringToWasm0(blinded_utxo, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
397
- const len4 = WASM_VECTOR_LEN;
398
- const ptr5 = passStringToWasm0(asset_contract, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
399
- const len5 = WASM_VECTOR_LEN;
400
- const ret = wasm.send_assets(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, amount, ptr5, len5, fee_rate);
401
- return takeObject(ret);
402
- }
403
-
404
373
  /**
405
374
  * @param {string} consignment
406
375
  * @param {string} blinding_factor
@@ -568,26 +537,17 @@ function handleError(f, args) {
568
537
  function getArrayU8FromWasm0(ptr, len) {
569
538
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
570
539
  }
571
- function __wbg_adapter_137(arg0, arg1, arg2, arg3) {
572
- wasm.wasm_bindgen__convert__closures__invoke2_mut__hc589e029f5d654e1(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
540
+ function __wbg_adapter_118(arg0, arg1, arg2, arg3) {
541
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h2c2191a3f795eba0(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
573
542
  }
574
543
 
575
- export function __wbindgen_string_new(arg0, arg1) {
576
- const ret = getStringFromWasm0(arg0, arg1);
577
- return addHeapObject(ret);
578
- };
579
-
580
544
  export function __wbindgen_object_drop_ref(arg0) {
581
545
  takeObject(arg0);
582
546
  };
583
547
 
584
- export function __wbindgen_cb_drop(arg0) {
585
- const obj = takeObject(arg0).original;
586
- if (obj.cnt-- == 1) {
587
- obj.a = 0;
588
- return true;
589
- }
590
- const ret = false;
548
+ export function __wbindgen_is_object(arg0) {
549
+ const val = getObject(arg0);
550
+ const ret = typeof(val) === 'object' && val !== null;
591
551
  return ret;
592
552
  };
593
553
 
@@ -600,6 +560,31 @@ export function __wbindgen_string_get(arg0, arg1) {
600
560
  getInt32Memory0()[arg0 / 4 + 0] = ptr0;
601
561
  };
602
562
 
563
+ export function __wbindgen_cb_drop(arg0) {
564
+ const obj = takeObject(arg0).original;
565
+ if (obj.cnt-- == 1) {
566
+ obj.a = 0;
567
+ return true;
568
+ }
569
+ const ret = false;
570
+ return ret;
571
+ };
572
+
573
+ export function __wbindgen_string_new(arg0, arg1) {
574
+ const ret = getStringFromWasm0(arg0, arg1);
575
+ return addHeapObject(ret);
576
+ };
577
+
578
+ export function __wbindgen_is_undefined(arg0) {
579
+ const ret = getObject(arg0) === undefined;
580
+ return ret;
581
+ };
582
+
583
+ export function __wbindgen_object_clone_ref(arg0) {
584
+ const ret = getObject(arg0);
585
+ return addHeapObject(ret);
586
+ };
587
+
603
588
  export function __wbg_new_abda76e883ba8a5f() {
604
589
  const ret = new Error();
605
590
  return addHeapObject(ret);
@@ -639,108 +624,6 @@ export function __wbg_trace_fe50dc146726736b(arg0, arg1) {
639
624
  console.trace(...v0);
640
625
  };
641
626
 
642
- export function __wbg_crypto_e1d53a1d73fb10b8(arg0) {
643
- const ret = getObject(arg0).crypto;
644
- return addHeapObject(ret);
645
- };
646
-
647
- export function __wbindgen_is_object(arg0) {
648
- const val = getObject(arg0);
649
- const ret = typeof(val) === 'object' && val !== null;
650
- return ret;
651
- };
652
-
653
- export function __wbg_process_038c26bf42b093f8(arg0) {
654
- const ret = getObject(arg0).process;
655
- return addHeapObject(ret);
656
- };
657
-
658
- export function __wbg_versions_ab37218d2f0b24a8(arg0) {
659
- const ret = getObject(arg0).versions;
660
- return addHeapObject(ret);
661
- };
662
-
663
- export function __wbg_node_080f4b19d15bc1fe(arg0) {
664
- const ret = getObject(arg0).node;
665
- return addHeapObject(ret);
666
- };
667
-
668
- export function __wbindgen_is_string(arg0) {
669
- const ret = typeof(getObject(arg0)) === 'string';
670
- return ret;
671
- };
672
-
673
- export function __wbg_msCrypto_6e7d3e1f92610cbb(arg0) {
674
- const ret = getObject(arg0).msCrypto;
675
- return addHeapObject(ret);
676
- };
677
-
678
- export function __wbg_require_78a3dcfbdba9cbce() { return handleError(function () {
679
- const ret = module.require;
680
- return addHeapObject(ret);
681
- }, arguments) };
682
-
683
- export function __wbindgen_is_function(arg0) {
684
- const ret = typeof(getObject(arg0)) === 'function';
685
- return ret;
686
- };
687
-
688
- export function __wbg_getRandomValues_805f1c3d65988a5a() { return handleError(function (arg0, arg1) {
689
- getObject(arg0).getRandomValues(getObject(arg1));
690
- }, arguments) };
691
-
692
- export function __wbg_randomFillSync_6894564c2c334c42() { return handleError(function (arg0, arg1, arg2) {
693
- getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
694
- }, arguments) };
695
-
696
- export function __wbg_self_7eede1f4488bf346() { return handleError(function () {
697
- const ret = self.self;
698
- return addHeapObject(ret);
699
- }, arguments) };
700
-
701
- export function __wbg_crypto_c909fb428dcbddb6(arg0) {
702
- const ret = getObject(arg0).crypto;
703
- return addHeapObject(ret);
704
- };
705
-
706
- export function __wbg_msCrypto_511eefefbfc70ae4(arg0) {
707
- const ret = getObject(arg0).msCrypto;
708
- return addHeapObject(ret);
709
- };
710
-
711
- export function __wbindgen_is_undefined(arg0) {
712
- const ret = getObject(arg0) === undefined;
713
- return ret;
714
- };
715
-
716
- export function __wbg_static_accessor_MODULE_ef3aa2eb251158a5() {
717
- const ret = module;
718
- return addHeapObject(ret);
719
- };
720
-
721
- export function __wbg_require_900d5c3984fe7703(arg0, arg1, arg2) {
722
- const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
723
- return addHeapObject(ret);
724
- };
725
-
726
- export function __wbg_getRandomValues_307049345d0bd88c(arg0) {
727
- const ret = getObject(arg0).getRandomValues;
728
- return addHeapObject(ret);
729
- };
730
-
731
- export function __wbg_getRandomValues_cd175915511f705e(arg0, arg1) {
732
- getObject(arg0).getRandomValues(getObject(arg1));
733
- };
734
-
735
- export function __wbg_randomFillSync_85b3f4c52c56c313(arg0, arg1, arg2) {
736
- getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
737
- };
738
-
739
- export function __wbindgen_object_clone_ref(arg0) {
740
- const ret = getObject(arg0);
741
- return addHeapObject(ret);
742
- };
743
-
744
627
  export function __wbg_fetch_3894579f6e2af3be(arg0) {
745
628
  const ret = fetch(getObject(arg0));
746
629
  return addHeapObject(ret);
@@ -804,6 +687,54 @@ export function __wbg_newwithstrandinit_05d7180788420c40() { return handleError(
804
687
  return addHeapObject(ret);
805
688
  }, arguments) };
806
689
 
690
+ export function __wbg_crypto_e1d53a1d73fb10b8(arg0) {
691
+ const ret = getObject(arg0).crypto;
692
+ return addHeapObject(ret);
693
+ };
694
+
695
+ export function __wbg_process_038c26bf42b093f8(arg0) {
696
+ const ret = getObject(arg0).process;
697
+ return addHeapObject(ret);
698
+ };
699
+
700
+ export function __wbg_versions_ab37218d2f0b24a8(arg0) {
701
+ const ret = getObject(arg0).versions;
702
+ return addHeapObject(ret);
703
+ };
704
+
705
+ export function __wbg_node_080f4b19d15bc1fe(arg0) {
706
+ const ret = getObject(arg0).node;
707
+ return addHeapObject(ret);
708
+ };
709
+
710
+ export function __wbindgen_is_string(arg0) {
711
+ const ret = typeof(getObject(arg0)) === 'string';
712
+ return ret;
713
+ };
714
+
715
+ export function __wbg_msCrypto_6e7d3e1f92610cbb(arg0) {
716
+ const ret = getObject(arg0).msCrypto;
717
+ return addHeapObject(ret);
718
+ };
719
+
720
+ export function __wbg_require_78a3dcfbdba9cbce() { return handleError(function () {
721
+ const ret = module.require;
722
+ return addHeapObject(ret);
723
+ }, arguments) };
724
+
725
+ export function __wbindgen_is_function(arg0) {
726
+ const ret = typeof(getObject(arg0)) === 'function';
727
+ return ret;
728
+ };
729
+
730
+ export function __wbg_getRandomValues_805f1c3d65988a5a() { return handleError(function (arg0, arg1) {
731
+ getObject(arg0).getRandomValues(getObject(arg1));
732
+ }, arguments) };
733
+
734
+ export function __wbg_randomFillSync_6894564c2c334c42() { return handleError(function (arg0, arg1, arg2) {
735
+ getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
736
+ }, arguments) };
737
+
807
738
  export function __wbg_newnoargs_b5b063fc6c2f0376(arg0, arg1) {
808
739
  const ret = new Function(getStringFromWasm0(arg0, arg1));
809
740
  return addHeapObject(ret);
@@ -886,7 +817,7 @@ export function __wbg_new_9962f939219f1820(arg0, arg1) {
886
817
  const a = state0.a;
887
818
  state0.a = 0;
888
819
  try {
889
- return __wbg_adapter_137(a, state0.b, arg0, arg1);
820
+ return __wbg_adapter_118(a, state0.b, arg0, arg1);
890
821
  } finally {
891
822
  state0.a = a;
892
823
  }
@@ -962,49 +893,6 @@ export function __wbg_stringify_d6471d300ded9b68() { return handleError(function
962
893
  return addHeapObject(ret);
963
894
  }, arguments) };
964
895
 
965
- export function __wbg_new_d87f272aec784ec0(arg0, arg1) {
966
- const ret = new Function(getStringFromWasm0(arg0, arg1));
967
- return addHeapObject(ret);
968
- };
969
-
970
- export function __wbg_call_eae29933372a39be(arg0, arg1) {
971
- const ret = getObject(arg0).call(getObject(arg1));
972
- return addHeapObject(ret);
973
- };
974
-
975
- export function __wbindgen_jsval_eq(arg0, arg1) {
976
- const ret = getObject(arg0) === getObject(arg1);
977
- return ret;
978
- };
979
-
980
- export function __wbg_self_e0b3266d2d9eba1a(arg0) {
981
- const ret = getObject(arg0).self;
982
- return addHeapObject(ret);
983
- };
984
-
985
- export function __wbg_crypto_e95a6e54c5c2e37f(arg0) {
986
- const ret = getObject(arg0).crypto;
987
- return addHeapObject(ret);
988
- };
989
-
990
- export function __wbg_getRandomValues_dc67302a7bd1aec5(arg0) {
991
- const ret = getObject(arg0).getRandomValues;
992
- return addHeapObject(ret);
993
- };
994
-
995
- export function __wbg_require_0993fe224bf8e202(arg0, arg1) {
996
- const ret = require(getStringFromWasm0(arg0, arg1));
997
- return addHeapObject(ret);
998
- };
999
-
1000
- export function __wbg_randomFillSync_dd2297de5917c74e(arg0, arg1, arg2) {
1001
- getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
1002
- };
1003
-
1004
- export function __wbg_getRandomValues_02639197c8166a96(arg0, arg1, arg2) {
1005
- getObject(arg0).getRandomValues(getArrayU8FromWasm0(arg1, arg2));
1006
- };
1007
-
1008
896
  export function __wbindgen_debug_string(arg0, arg1) {
1009
897
  const ret = debugString(getObject(arg1));
1010
898
  const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -1022,8 +910,8 @@ export function __wbindgen_memory() {
1022
910
  return addHeapObject(ret);
1023
911
  };
1024
912
 
1025
- export function __wbindgen_closure_wrapper3047(arg0, arg1, arg2) {
1026
- const ret = makeMutClosure(arg0, arg1, 953, __wbg_adapter_28);
913
+ export function __wbindgen_closure_wrapper2801(arg0, arg1, arg2) {
914
+ const ret = makeMutClosure(arg0, arg1, 900, __wbg_adapter_26);
1027
915
  return addHeapObject(ret);
1028
916
  };
1029
917
 
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.4.3",
9
+ "version": "0.5.0-rc.1",
10
10
  "license": "MIT",
11
11
  "repository": {
12
12
  "type": "git",