bitmask-core 0.7.0-beta.3 → 0.7.0-beta.5

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/bitcoin.d.ts ADDED
@@ -0,0 +1,112 @@
1
+ export declare const hashPassword: (password: string) => string;
2
+ export declare const decryptWallet: (hash: string, encryptedDescriptors: string) => Promise<Vault>;
3
+ export declare const upgradeWallet: (hash: string, encryptedDescriptors: string, seedPassword?: string) => Promise<string>;
4
+ export declare const syncWallets: () => Promise<void>;
5
+ export declare const newWallet: (hash: string, seedPassword: string) => Promise<string>;
6
+ export declare const encryptWallet: (mnemonic: string, hash: string, seedPassword: string) => Promise<string>;
7
+ export declare const getWalletData: (descriptor: string, changeDescriptor?: string) => Promise<WalletData>;
8
+ export declare const getNewAddress: (descriptor: string, changeDescriptor?: string) => Promise<string>;
9
+ export declare const sendSats: (descriptor: string, changeDescriptor: string, address: string, amount: bigint, feeRate: number) => Promise<TransactionData>;
10
+ export declare const drainWallet: (destination: string, descriptor: string, changeDescriptor?: string, feeRate?: number) => Promise<TransactionData>;
11
+ export declare const fundVault: (descriptor: string, changeDescriptor: string, assetAddress1: string, udaAddress1: string, feeRate: number) => Promise<FundVaultDetails>;
12
+ export declare const getAssetsVault: (rgbAssetsDescriptorXpub: string, rgbUdasDescriptorXpub: string) => Promise<FundVaultDetails>;
13
+ export interface PrivateWalletData {
14
+ xprvkh: string;
15
+ btcDescriptorXprv: string;
16
+ btcChangeDescriptorXprv: string;
17
+ rgbAssetsDescriptorXprv: string;
18
+ rgbUdasDescriptorXprv: string;
19
+ nostrPrv: string;
20
+ nostrNsec: string;
21
+ }
22
+ export interface PublicWalletData {
23
+ xpub: string;
24
+ xpubkh: string;
25
+ watcherXpub: string;
26
+ btcDescriptorXpub: string;
27
+ btcChangeDescriptorXpub: string;
28
+ rgbAssetsDescriptorXpub: string;
29
+ rgbUdasDescriptorXpub: string;
30
+ nostrPub: string;
31
+ nostrNpub: string;
32
+ }
33
+ export interface Vault {
34
+ mnemonic: string;
35
+ private: PrivateWalletData;
36
+ public: PublicWalletData;
37
+ }
38
+ export interface Transaction {
39
+ amount: number;
40
+ asset?: string;
41
+ assetType: string;
42
+ fee: number;
43
+ message?: string;
44
+ note?: string;
45
+ }
46
+ export interface Activity extends Transaction {
47
+ id: string;
48
+ date: number;
49
+ action: string;
50
+ status: string;
51
+ lightning?: boolean;
52
+ sender?: {
53
+ name: string;
54
+ address: string;
55
+ };
56
+ recipient?: {
57
+ name: string;
58
+ address: string;
59
+ invoice: string;
60
+ };
61
+ }
62
+ export interface TransactionDetails extends Transaction {
63
+ sender: {
64
+ name: string;
65
+ address: string;
66
+ };
67
+ recipient: {
68
+ name: string;
69
+ address: string;
70
+ invoice: string;
71
+ };
72
+ }
73
+ export interface TransactionData {
74
+ transaction?: Transaction;
75
+ txid: string;
76
+ received: number;
77
+ sent: number;
78
+ fee: number;
79
+ confirmationTime?: ConfirmationTime;
80
+ confirmed?: boolean;
81
+ }
82
+ export interface ConfirmationTime {
83
+ height: number;
84
+ timestamp: number;
85
+ }
86
+ export interface WalletTransaction {
87
+ txid: string;
88
+ received: number;
89
+ sent: number;
90
+ fee: number;
91
+ confirmed: boolean;
92
+ confirmationTime: ConfirmationTime;
93
+ }
94
+ export interface WalletBalance {
95
+ immature: number;
96
+ trustedPending: number;
97
+ untrustedPending: number;
98
+ confirmed: number;
99
+ }
100
+ export interface WalletData {
101
+ wallet?: string;
102
+ name: string;
103
+ address: string;
104
+ balance: WalletBalance;
105
+ transactions: WalletTransaction[];
106
+ utxos: string[];
107
+ }
108
+ export interface FundVaultDetails {
109
+ assetsOutput?: string;
110
+ udasOutput?: string;
111
+ }
112
+ //# sourceMappingURL=bitcoin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bitcoin.d.ts","sourceRoot":"","sources":["bitcoin.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,aAAc,MAAM,WAAgC,CAAC;AAE9E,eAAO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b,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,aAAa,CAAC;IACvB,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
package/bitcoin.js CHANGED
@@ -62,8 +62,8 @@ const drainWallet = (destination, descriptor, changeDescriptor, feeRate) => __aw
62
62
  return JSON.parse(yield BMC.drain_wallet(destination, descriptor, changeDescriptor, feeRate));
63
63
  });
64
64
  exports.drainWallet = drainWallet;
65
- const fundVault = (descriptor, changeDescriptor, assetAddress1, assetAddress2, udaAddress1, udaAddress2, feeRate) => __awaiter(void 0, void 0, void 0, function* () {
66
- return JSON.parse(yield BMC.fund_vault(descriptor, changeDescriptor, assetAddress1, assetAddress2, udaAddress1, udaAddress2, feeRate));
65
+ const fundVault = (descriptor, changeDescriptor, assetAddress1, udaAddress1, feeRate) => __awaiter(void 0, void 0, void 0, function* () {
66
+ return JSON.parse(yield BMC.fund_vault(descriptor, changeDescriptor, assetAddress1, udaAddress1, feeRate));
67
67
  });
68
68
  exports.fundVault = fundVault;
69
69
  const getAssetsVault = (rgbAssetsDescriptorXpub, rgbUdasDescriptorXpub) => __awaiter(void 0, void 0, void 0, function* () {
package/bitcoin.ts CHANGED
@@ -71,9 +71,7 @@ export const fundVault = async (
71
71
  descriptor: string,
72
72
  changeDescriptor: string,
73
73
  assetAddress1: string,
74
- assetAddress2: string,
75
74
  udaAddress1: string,
76
- udaAddress2: string,
77
75
  feeRate: number
78
76
  ): Promise<FundVaultDetails> =>
79
77
  JSON.parse(
@@ -81,9 +79,7 @@ export const fundVault = async (
81
79
  descriptor,
82
80
  changeDescriptor,
83
81
  assetAddress1,
84
- assetAddress2,
85
82
  udaAddress1,
86
- udaAddress2,
87
83
  feeRate
88
84
  )
89
85
  );
@@ -207,7 +203,5 @@ export interface WalletData {
207
203
 
208
204
  export interface FundVaultDetails {
209
205
  assetsOutput?: string;
210
- assetsChangeOutput?: string;
211
206
  udasOutput?: string;
212
- udasChangeOutput?: string;
213
207
  }
package/bitmask_core.d.ts CHANGED
@@ -98,13 +98,11 @@ export function drain_wallet(destination: string, descriptor: string, change_des
98
98
  * @param {string} descriptor
99
99
  * @param {string} change_descriptor
100
100
  * @param {string} asset_address_1
101
- * @param {string} asset_address_2
102
101
  * @param {string} uda_address_1
103
- * @param {string} uda_address_2
104
102
  * @param {number | undefined} fee_rate
105
103
  * @returns {Promise<any>}
106
104
  */
107
- export function fund_vault(descriptor: string, change_descriptor: string, asset_address_1: string, asset_address_2: string, uda_address_1: string, uda_address_2: string, fee_rate?: number): Promise<any>;
105
+ export function fund_vault(descriptor: string, change_descriptor: string, asset_address_1: string, uda_address_1: string, fee_rate?: number): Promise<any>;
108
106
  /**
109
107
  * @param {string} rgb_assets_descriptor_xpub
110
108
  * @param {string} rgb_udas_descriptor_xpub
@@ -479,7 +477,7 @@ export interface InitOutput {
479
477
  readonly get_new_address: (a: number, b: number, c: number, d: number) => number;
480
478
  readonly send_sats: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
481
479
  readonly drain_wallet: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
482
- readonly fund_vault: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number) => number;
480
+ readonly fund_vault: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => number;
483
481
  readonly get_assets_vault: (a: number, b: number, c: number, d: number) => number;
484
482
  readonly create_wallet: (a: number, b: number, c: number, d: number) => number;
485
483
  readonly auth: (a: number, b: number, c: number, d: number) => number;
@@ -539,10 +537,10 @@ export interface InitOutput {
539
537
  readonly my_bids: (a: number, b: number) => number;
540
538
  readonly get_consignment: (a: number, b: number) => number;
541
539
  readonly get_media: (a: number, b: number) => number;
542
- readonly import_consignments: (a: number) => number;
543
- readonly import_media: (a: number) => number;
544
540
  readonly new_nostr_pubkey: (a: number, b: number, c: number, d: number) => number;
545
541
  readonly update_nostr_pubkey: (a: number, b: number, c: number, d: number) => number;
542
+ readonly import_consignments: (a: number) => number;
543
+ readonly import_media: (a: number) => number;
546
544
  readonly rustsecp256k1zkp_v0_8_0_default_illegal_callback_fn: (a: number, b: number) => void;
547
545
  readonly rustsecp256k1zkp_v0_8_0_default_error_callback_fn: (a: number, b: number) => void;
548
546
  readonly rustsecp256k1_v0_8_1_context_create: (a: number) => number;
package/bitmask_core.js CHANGED
@@ -452,26 +452,20 @@ export function drain_wallet(destination, descriptor, change_descriptor, fee_rat
452
452
  * @param {string} descriptor
453
453
  * @param {string} change_descriptor
454
454
  * @param {string} asset_address_1
455
- * @param {string} asset_address_2
456
455
  * @param {string} uda_address_1
457
- * @param {string} uda_address_2
458
456
  * @param {number | undefined} fee_rate
459
457
  * @returns {Promise<any>}
460
458
  */
461
- export function fund_vault(descriptor, change_descriptor, asset_address_1, asset_address_2, uda_address_1, uda_address_2, fee_rate) {
459
+ export function fund_vault(descriptor, change_descriptor, asset_address_1, uda_address_1, fee_rate) {
462
460
  const ptr0 = passStringToWasm0(descriptor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
463
461
  const len0 = WASM_VECTOR_LEN;
464
462
  const ptr1 = passStringToWasm0(change_descriptor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
465
463
  const len1 = WASM_VECTOR_LEN;
466
464
  const ptr2 = passStringToWasm0(asset_address_1, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
467
465
  const len2 = WASM_VECTOR_LEN;
468
- const ptr3 = passStringToWasm0(asset_address_2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
466
+ const ptr3 = passStringToWasm0(uda_address_1, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
469
467
  const len3 = WASM_VECTOR_LEN;
470
- const ptr4 = passStringToWasm0(uda_address_1, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
471
- const len4 = WASM_VECTOR_LEN;
472
- const ptr5 = passStringToWasm0(uda_address_2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
473
- const len5 = WASM_VECTOR_LEN;
474
- const ret = wasm.fund_vault(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, !isLikeNone(fee_rate), isLikeNone(fee_rate) ? 0 : fee_rate);
468
+ const ret = wasm.fund_vault(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, !isLikeNone(fee_rate), isLikeNone(fee_rate) ? 0 : fee_rate);
475
469
  return takeObject(ret);
476
470
  }
477
471
 
@@ -1384,6 +1378,10 @@ function __wbg_get_imports() {
1384
1378
  const ret = getStringFromWasm0(arg0, arg1);
1385
1379
  return addHeapObject(ret);
1386
1380
  };
1381
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
1382
+ const ret = getObject(arg0);
1383
+ return addHeapObject(ret);
1384
+ };
1387
1385
  imports.wbg.__wbindgen_number_new = function(arg0) {
1388
1386
  const ret = arg0;
1389
1387
  return addHeapObject(ret);
@@ -1396,14 +1394,19 @@ function __wbg_get_imports() {
1396
1394
  getInt32Memory0()[arg0 / 4 + 1] = len1;
1397
1395
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
1398
1396
  };
1399
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
1400
- const ret = getObject(arg0);
1401
- return addHeapObject(ret);
1402
- };
1403
1397
  imports.wbg.__wbindgen_is_undefined = function(arg0) {
1404
1398
  const ret = getObject(arg0) === undefined;
1405
1399
  return ret;
1406
1400
  };
1401
+ imports.wbg.__wbindgen_cb_drop = function(arg0) {
1402
+ const obj = takeObject(arg0).original;
1403
+ if (obj.cnt-- == 1) {
1404
+ obj.a = 0;
1405
+ return true;
1406
+ }
1407
+ const ret = false;
1408
+ return ret;
1409
+ };
1407
1410
  imports.wbg.__wbindgen_is_bigint = function(arg0) {
1408
1411
  const ret = typeof(getObject(arg0)) === 'bigint';
1409
1412
  return ret;
@@ -1429,17 +1432,17 @@ function __wbg_get_imports() {
1429
1432
  const ret = getObject(arg0) in getObject(arg1);
1430
1433
  return ret;
1431
1434
  };
1435
+ imports.wbg.__wbindgen_boolean_get = function(arg0) {
1436
+ const v = getObject(arg0);
1437
+ const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
1438
+ return ret;
1439
+ };
1432
1440
  imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
1433
1441
  const obj = getObject(arg1);
1434
1442
  const ret = typeof(obj) === 'number' ? obj : undefined;
1435
1443
  getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
1436
1444
  getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
1437
1445
  };
1438
- imports.wbg.__wbindgen_boolean_get = function(arg0) {
1439
- const v = getObject(arg0);
1440
- const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
1441
- return ret;
1442
- };
1443
1446
  imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
1444
1447
  const ret = BigInt.asUintN(64, arg0);
1445
1448
  return addHeapObject(ret);
@@ -1448,15 +1451,6 @@ function __wbg_get_imports() {
1448
1451
  const ret = new Error(getStringFromWasm0(arg0, arg1));
1449
1452
  return addHeapObject(ret);
1450
1453
  };
1451
- imports.wbg.__wbindgen_cb_drop = function(arg0) {
1452
- const obj = takeObject(arg0).original;
1453
- if (obj.cnt-- == 1) {
1454
- obj.a = 0;
1455
- return true;
1456
- }
1457
- const ret = false;
1458
- return ret;
1459
- };
1460
1454
  imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
1461
1455
  const ret = new Error();
1462
1456
  return addHeapObject(ret);
@@ -1932,7 +1926,7 @@ function __wbg_get_imports() {
1932
1926
  const ret = wasm.memory;
1933
1927
  return addHeapObject(ret);
1934
1928
  };
1935
- imports.wbg.__wbindgen_closure_wrapper14392 = function(arg0, arg1, arg2) {
1929
+ imports.wbg.__wbindgen_closure_wrapper14390 = function(arg0, arg1, arg2) {
1936
1930
  const ret = makeMutClosure(arg0, arg1, 3417, __wbg_adapter_48);
1937
1931
  return addHeapObject(ret);
1938
1932
  };