bitmask-core 0.4.1 → 0.4.3

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
@@ -3,13 +3,11 @@ Core functionality for the BitMask wallet - <https://bitmask.app>
3
3
 
4
4
  **BitMask** is a bitcoin wallet and a browser extension for accessing decentralized web applications on the Bitcoin blokchain. It is designed to support UTXO based smart contracting protocols such as RGB, with planned support for Omni layer, TARO and many others.
5
5
 
6
-
7
- [![Build Status](https://img.shields.io/github/workflow/status/diba-io/bitmask-core/Rust?style=flat-square)](https://github.com/diba-io/bitmask-core/actions/workflows/Rust.yml)
6
+ [![Build status](https://img.shields.io/github/actions/workflow/status/diba-io/bitmask-core/rust.yaml?branch=development&style=flat-square)](https://github.com/diba-io/bitmask-core/actions/workflows/rust.yaml)
8
7
  [![Crates.io](https://img.shields.io/crates/v/bitmask-core?style=flat-square)](https://docs.rs/bitmask-core/latest/bitmask-core/)
9
8
  [![npm: bitmask-core](https://img.shields.io/npm/v/bitmask-core?style=flat-square)](https://www.npmjs.com/package/bitmask-core)
10
9
  [![License: MIT+APACHE](https://img.shields.io/crates/l/bitmask-core?style=flat-square)](https://mit-license.org)
11
- ![Lines of code](https://img.shields.io/tokei/lines/github/diba-io/bitmask-core?style=flat-square)
12
- [![Telegram: rust_in_bitcoin](https://img.shields.io/badge/telegram-rust_in_bitcoin-blue?style=flat-square)](https://t.me/rust_in_bitcoin)
10
+ [![Telegram](https://img.shields.io/badge/telegram-invite-blue?style=flat-square)](https://t.me/+eQk5aQ5--iUxYzVk)
13
11
 
14
12
  ## Uses
15
13
 
@@ -25,6 +23,8 @@ Some environment variables may be needed in order to compile on macos-aarch64, f
25
23
 
26
24
  If there are issues compiling, be sure to check you're compiling with the latest Rust version.
27
25
 
26
+ To build this as a NodeJS module, use: `wasm-pack build --release --target bundler`
27
+
28
28
  ## Test
29
29
 
30
30
  1. Lint against wasm32: `cargo clippy --target wasm32-unknown-unknown`
@@ -37,3 +37,9 @@ To run the bitmaskd node with REST server, either for testing the web wallet, or
37
37
  `cargo install --features=server --path .`
38
38
 
39
39
  Then run `bitmaskd`.
40
+
41
+ ## Development
42
+
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
+
45
+ `cargo clippy --target wasm32-unknown-unknown --no-default-features --release`
package/bitmask_core.d.ts CHANGED
@@ -27,10 +27,11 @@ export function save_mnemonic_seed(mnemonic: string, encryption_password: string
27
27
  export function get_wallet_data(descriptor: string, change_descriptor?: string): Promise<any>;
28
28
  /**
29
29
  * @param {string} asset
30
- * @param {string} rgb_descriptor_xpub
30
+ * @param {string} utxo
31
+ * @param {string} blinded
31
32
  * @returns {Promise<any>}
32
33
  */
33
- export function import_asset(asset: string, rgb_descriptor_xpub: string): Promise<any>;
34
+ export function import_asset(asset: string, utxo: string, blinded: string): Promise<any>;
34
35
  /**
35
36
  * @param {string} utxo_string
36
37
  * @returns {Promise<any>}
@@ -110,28 +111,24 @@ export function get_endpoint(path: string): Promise<any>;
110
111
  */
111
112
  export function switch_host(host: string): Promise<any>;
112
113
  /**
114
+ * @param {string} username
115
+ * @param {string} password
113
116
  * @returns {Promise<any>}
114
117
  */
115
- export function ln_create_wallet(): Promise<any>;
118
+ export function ln_create_wallet(username: string, password: string): Promise<any>;
116
119
  /**
117
- * @param {string} login
120
+ * @param {string} username
118
121
  * @param {string} password
119
122
  * @returns {Promise<any>}
120
123
  */
121
- export function ln_auth(login: string, password: string): Promise<any>;
124
+ export function ln_auth(username: string, password: string): Promise<any>;
122
125
  /**
123
126
  * @param {string} description
124
- * @param {bigint} amount
125
- * @param {string} token
126
- * @returns {Promise<any>}
127
- */
128
- export function ln_create_invoice(description: string, amount: bigint, token: string): Promise<any>;
129
- /**
130
- * @param {string} invoice
127
+ * @param {number} amount
131
128
  * @param {string} token
132
129
  * @returns {Promise<any>}
133
130
  */
134
- export function ln_decode_invoice(invoice: string, token: string): Promise<any>;
131
+ export function ln_create_invoice(description: string, amount: number, token: string): Promise<any>;
135
132
  /**
136
133
  * @param {string} token
137
134
  * @returns {Promise<any>}
@@ -139,14 +136,12 @@ export function ln_decode_invoice(invoice: string, token: string): Promise<any>;
139
136
  export function ln_get_balance(token: string): Promise<any>;
140
137
  /**
141
138
  * @param {string} token
142
- * @param {number} limit
143
- * @param {number} offset
144
139
  * @returns {Promise<any>}
145
140
  */
146
- export function ln_get_txs(token: string, limit: number, offset: number): Promise<any>;
141
+ export function ln_get_txs(token: string): Promise<any>;
147
142
  /**
148
- * @param {string} invoice
143
+ * @param {string} payment_request
149
144
  * @param {string} token
150
145
  * @returns {Promise<any>}
151
146
  */
152
- export function ln_pay_invoice(invoice: string, token: string): Promise<any>;
147
+ export function ln_pay_invoice(payment_request: string, token: string): Promise<any>;
@@ -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__he216dadcc2c1c2c1(arg0, arg1, addHeapObject(arg2));
211
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h57d3c75528372ef2(arg0, arg1, addHeapObject(arg2));
212
212
  }
213
213
 
214
214
  /**
@@ -272,15 +272,18 @@ export function get_wallet_data(descriptor, change_descriptor) {
272
272
 
273
273
  /**
274
274
  * @param {string} asset
275
- * @param {string} rgb_descriptor_xpub
275
+ * @param {string} utxo
276
+ * @param {string} blinded
276
277
  * @returns {Promise<any>}
277
278
  */
278
- export function import_asset(asset, rgb_descriptor_xpub) {
279
+ export function import_asset(asset, utxo, blinded) {
279
280
  const ptr0 = passStringToWasm0(asset, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
280
281
  const len0 = WASM_VECTOR_LEN;
281
- const ptr1 = passStringToWasm0(rgb_descriptor_xpub, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
282
+ const ptr1 = passStringToWasm0(utxo, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
282
283
  const len1 = WASM_VECTOR_LEN;
283
- const ret = wasm.import_asset(ptr0, len0, ptr1, len1);
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);
284
287
  return takeObject(ret);
285
288
  }
286
289
 
@@ -457,20 +460,26 @@ export function switch_host(host) {
457
460
  }
458
461
 
459
462
  /**
463
+ * @param {string} username
464
+ * @param {string} password
460
465
  * @returns {Promise<any>}
461
466
  */
462
- export function ln_create_wallet() {
463
- const ret = wasm.ln_create_wallet();
467
+ export function ln_create_wallet(username, password) {
468
+ const ptr0 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
469
+ const len0 = WASM_VECTOR_LEN;
470
+ const ptr1 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
471
+ const len1 = WASM_VECTOR_LEN;
472
+ const ret = wasm.ln_create_wallet(ptr0, len0, ptr1, len1);
464
473
  return takeObject(ret);
465
474
  }
466
475
 
467
476
  /**
468
- * @param {string} login
477
+ * @param {string} username
469
478
  * @param {string} password
470
479
  * @returns {Promise<any>}
471
480
  */
472
- export function ln_auth(login, password) {
473
- const ptr0 = passStringToWasm0(login, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
481
+ export function ln_auth(username, password) {
482
+ const ptr0 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
474
483
  const len0 = WASM_VECTOR_LEN;
475
484
  const ptr1 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
476
485
  const len1 = WASM_VECTOR_LEN;
@@ -480,7 +489,7 @@ export function ln_auth(login, password) {
480
489
 
481
490
  /**
482
491
  * @param {string} description
483
- * @param {bigint} amount
492
+ * @param {number} amount
484
493
  * @param {string} token
485
494
  * @returns {Promise<any>}
486
495
  */
@@ -493,20 +502,6 @@ export function ln_create_invoice(description, amount, token) {
493
502
  return takeObject(ret);
494
503
  }
495
504
 
496
- /**
497
- * @param {string} invoice
498
- * @param {string} token
499
- * @returns {Promise<any>}
500
- */
501
- export function ln_decode_invoice(invoice, token) {
502
- const ptr0 = passStringToWasm0(invoice, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
503
- const len0 = WASM_VECTOR_LEN;
504
- const ptr1 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
505
- const len1 = WASM_VECTOR_LEN;
506
- const ret = wasm.ln_decode_invoice(ptr0, len0, ptr1, len1);
507
- return takeObject(ret);
508
- }
509
-
510
505
  /**
511
506
  * @param {string} token
512
507
  * @returns {Promise<any>}
@@ -520,24 +515,22 @@ export function ln_get_balance(token) {
520
515
 
521
516
  /**
522
517
  * @param {string} token
523
- * @param {number} limit
524
- * @param {number} offset
525
518
  * @returns {Promise<any>}
526
519
  */
527
- export function ln_get_txs(token, limit, offset) {
520
+ export function ln_get_txs(token) {
528
521
  const ptr0 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
529
522
  const len0 = WASM_VECTOR_LEN;
530
- const ret = wasm.ln_get_txs(ptr0, len0, limit, offset);
523
+ const ret = wasm.ln_get_txs(ptr0, len0);
531
524
  return takeObject(ret);
532
525
  }
533
526
 
534
527
  /**
535
- * @param {string} invoice
528
+ * @param {string} payment_request
536
529
  * @param {string} token
537
530
  * @returns {Promise<any>}
538
531
  */
539
- export function ln_pay_invoice(invoice, token) {
540
- const ptr0 = passStringToWasm0(invoice, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
532
+ export function ln_pay_invoice(payment_request, token) {
533
+ const ptr0 = passStringToWasm0(payment_request, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
541
534
  const len0 = WASM_VECTOR_LEN;
542
535
  const ptr1 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
543
536
  const len1 = WASM_VECTOR_LEN;
@@ -575,8 +568,8 @@ function handleError(f, args) {
575
568
  function getArrayU8FromWasm0(ptr, len) {
576
569
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
577
570
  }
578
- function __wbg_adapter_138(arg0, arg1, arg2, arg3) {
579
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h1c65fdf212299b92(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
571
+ function __wbg_adapter_137(arg0, arg1, arg2, arg3) {
572
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__hc589e029f5d654e1(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
580
573
  }
581
574
 
582
575
  export function __wbindgen_string_new(arg0, arg1) {
@@ -646,14 +639,6 @@ export function __wbg_trace_fe50dc146726736b(arg0, arg1) {
646
639
  console.trace(...v0);
647
640
  };
648
641
 
649
- export function __wbg_randomFillSync_6894564c2c334c42() { return handleError(function (arg0, arg1, arg2) {
650
- getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
651
- }, arguments) };
652
-
653
- export function __wbg_getRandomValues_805f1c3d65988a5a() { return handleError(function (arg0, arg1) {
654
- getObject(arg0).getRandomValues(getObject(arg1));
655
- }, arguments) };
656
-
657
642
  export function __wbg_crypto_e1d53a1d73fb10b8(arg0) {
658
643
  const ret = getObject(arg0).crypto;
659
644
  return addHeapObject(ret);
@@ -700,13 +685,13 @@ export function __wbindgen_is_function(arg0) {
700
685
  return ret;
701
686
  };
702
687
 
703
- export function __wbg_randomFillSync_85b3f4c52c56c313(arg0, arg1, arg2) {
704
- getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
705
- };
706
-
707
- export function __wbg_getRandomValues_cd175915511f705e(arg0, arg1) {
688
+ export function __wbg_getRandomValues_805f1c3d65988a5a() { return handleError(function (arg0, arg1) {
708
689
  getObject(arg0).getRandomValues(getObject(arg1));
709
- };
690
+ }, arguments) };
691
+
692
+ export function __wbg_randomFillSync_6894564c2c334c42() { return handleError(function (arg0, arg1, arg2) {
693
+ getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
694
+ }, arguments) };
710
695
 
711
696
  export function __wbg_self_7eede1f4488bf346() { return handleError(function () {
712
697
  const ret = self.self;
@@ -743,6 +728,14 @@ export function __wbg_getRandomValues_307049345d0bd88c(arg0) {
743
728
  return addHeapObject(ret);
744
729
  };
745
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
+
746
739
  export function __wbindgen_object_clone_ref(arg0) {
747
740
  const ret = getObject(arg0);
748
741
  return addHeapObject(ret);
@@ -893,7 +886,7 @@ export function __wbg_new_9962f939219f1820(arg0, arg1) {
893
886
  const a = state0.a;
894
887
  state0.a = 0;
895
888
  try {
896
- return __wbg_adapter_138(a, state0.b, arg0, arg1);
889
+ return __wbg_adapter_137(a, state0.b, arg0, arg1);
897
890
  } finally {
898
891
  state0.a = a;
899
892
  }
@@ -969,14 +962,6 @@ export function __wbg_stringify_d6471d300ded9b68() { return handleError(function
969
962
  return addHeapObject(ret);
970
963
  }, arguments) };
971
964
 
972
- export function __wbg_getRandomValues_02639197c8166a96(arg0, arg1, arg2) {
973
- getObject(arg0).getRandomValues(getArrayU8FromWasm0(arg1, arg2));
974
- };
975
-
976
- export function __wbg_randomFillSync_dd2297de5917c74e(arg0, arg1, arg2) {
977
- getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
978
- };
979
-
980
965
  export function __wbg_new_d87f272aec784ec0(arg0, arg1) {
981
966
  const ret = new Function(getStringFromWasm0(arg0, arg1));
982
967
  return addHeapObject(ret);
@@ -1012,6 +997,14 @@ export function __wbg_require_0993fe224bf8e202(arg0, arg1) {
1012
997
  return addHeapObject(ret);
1013
998
  };
1014
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
+
1015
1008
  export function __wbindgen_debug_string(arg0, arg1) {
1016
1009
  const ret = debugString(getObject(arg1));
1017
1010
  const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -1029,8 +1022,8 @@ export function __wbindgen_memory() {
1029
1022
  return addHeapObject(ret);
1030
1023
  };
1031
1024
 
1032
- export function __wbindgen_closure_wrapper3075(arg0, arg1, arg2) {
1033
- const ret = makeMutClosure(arg0, arg1, 968, __wbg_adapter_28);
1025
+ export function __wbindgen_closure_wrapper3047(arg0, arg1, arg2) {
1026
+ const ret = makeMutClosure(arg0, arg1, 953, __wbg_adapter_28);
1034
1027
  return addHeapObject(ret);
1035
1028
  };
1036
1029
 
Binary file
package/package.json CHANGED
@@ -6,11 +6,11 @@
6
6
  "Francisco Calderón <francisco@diba.io>"
7
7
  ],
8
8
  "description": "Core functionality for the BitMask wallet",
9
- "version": "0.4.1",
9
+ "version": "0.4.3",
10
10
  "license": "MIT",
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "https://github.com/rgb-products/bitmask-core"
13
+ "url": "https://github.com/diba-io/bitmask-core"
14
14
  },
15
15
  "files": [
16
16
  "bitmask_core_bg.wasm",