bitmask-core 0.7.0-beta.4 → 0.7.0-beta.7

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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} secret_key
5
+ * @param {string} name
6
+ * @param {Uint8Array} data
7
+ * @param {boolean} force
8
+ * @param {Uint8Array | undefined} metadata
9
+ * @returns {Promise<any>}
10
+ */
11
+ export function store(secret_key: string, name: string, data: Uint8Array, force: boolean, metadata?: Uint8Array): Promise<any>;
12
+ /**
13
+ * @param {string} secret_key
14
+ * @param {string} name
15
+ * @returns {Promise<any>}
16
+ */
17
+ export function retrieve(secret_key: string, name: string): Promise<any>;
18
+ /**
19
+ * @param {string} secret_key
20
+ * @param {string} name
21
+ * @returns {Promise<any>}
22
+ */
23
+ export function retrieve_metadata(secret_key: string, name: string): Promise<any>;
24
+ /**
25
+ * @param {Uint8Array} bytes
26
+ * @returns {string}
27
+ */
28
+ export function encode_hex(bytes: Uint8Array): string;
29
+ /**
30
+ * @param {Uint8Array} bytes
31
+ * @returns {string}
32
+ */
33
+ export function encode_base64(bytes: Uint8Array): string;
34
+ /**
35
+ * @param {string} string
36
+ * @returns {Uint8Array}
37
+ */
38
+ export function decode_hex(string: string): Uint8Array;
39
+ /**
40
+ * @param {string} string
41
+ * @returns {Uint8Array}
42
+ */
43
+ export function decode_base64(string: string): Uint8Array;
44
+ /**
4
45
  * @returns {Promise<any>}
5
46
  */
6
47
  export function get_network(): Promise<any>;
@@ -26,6 +67,18 @@ export function set_env(key: string, value: string): Promise<any>;
26
67
  */
27
68
  export function sleep(ms: number): Promise<any>;
28
69
  /**
70
+ * @param {string} pubkey
71
+ * @param {string} token
72
+ * @returns {Promise<any>}
73
+ */
74
+ export function new_nostr_pubkey(pubkey: string, token: string): Promise<any>;
75
+ /**
76
+ * @param {string} pubkey
77
+ * @param {string} token
78
+ * @returns {Promise<any>}
79
+ */
80
+ export function update_nostr_pubkey(pubkey: string, token: string): Promise<any>;
81
+ /**
29
82
  * @param {string} password
30
83
  * @returns {string}
31
84
  */
@@ -163,47 +216,6 @@ export function swap_btc_ln(token: string, ln_address?: string): Promise<any>;
163
216
  */
164
217
  export function swap_ln_btc(address: string, amount: bigint, token: string): Promise<any>;
165
218
  /**
166
- * @param {string} secret_key
167
- * @param {string} name
168
- * @param {Uint8Array} data
169
- * @param {boolean} force
170
- * @param {Uint8Array | undefined} metadata
171
- * @returns {Promise<any>}
172
- */
173
- export function store(secret_key: string, name: string, data: Uint8Array, force: boolean, metadata?: Uint8Array): Promise<any>;
174
- /**
175
- * @param {string} secret_key
176
- * @param {string} name
177
- * @returns {Promise<any>}
178
- */
179
- export function retrieve(secret_key: string, name: string): Promise<any>;
180
- /**
181
- * @param {string} secret_key
182
- * @param {string} name
183
- * @returns {Promise<any>}
184
- */
185
- export function retrieve_metadata(secret_key: string, name: string): Promise<any>;
186
- /**
187
- * @param {Uint8Array} bytes
188
- * @returns {string}
189
- */
190
- export function encode_hex(bytes: Uint8Array): string;
191
- /**
192
- * @param {Uint8Array} bytes
193
- * @returns {string}
194
- */
195
- export function encode_base64(bytes: Uint8Array): string;
196
- /**
197
- * @param {string} string
198
- * @returns {Uint8Array}
199
- */
200
- export function decode_hex(string: string): Uint8Array;
201
- /**
202
- * @param {string} string
203
- * @returns {Uint8Array}
204
- */
205
- export function decode_base64(string: string): Uint8Array;
206
- /**
207
219
  * @param {string} nostr_hex_sk
208
220
  * @param {any} request
209
221
  * @returns {Promise<any>}
@@ -437,36 +449,34 @@ export function import_consignments(request: any): Promise<any>;
437
449
  */
438
450
  export function get_consignment(consig_or_receipt_id: string): Promise<any>;
439
451
  /**
440
- * @param {any} request
441
- * @returns {Promise<any>}
442
- */
443
- export function import_media(request: any): Promise<any>;
444
- /**
445
452
  * @param {string} media_id
446
453
  * @returns {Promise<any>}
447
454
  */
448
- export function get_media(media_id: string): Promise<any>;
449
- /**
450
- * @param {string} pubkey
451
- * @param {string} token
452
- * @returns {Promise<any>}
453
- */
454
- export function new_nostr_pubkey(pubkey: string, token: string): Promise<any>;
455
+ export function get_media_metadata(media_id: string): Promise<any>;
455
456
  /**
456
- * @param {string} pubkey
457
- * @param {string} token
457
+ * @param {any} request
458
458
  * @returns {Promise<any>}
459
459
  */
460
- export function update_nostr_pubkey(pubkey: string, token: string): Promise<any>;
460
+ export function import_uda_data(request: any): Promise<any>;
461
461
 
462
462
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
463
463
 
464
464
  export interface InitOutput {
465
465
  readonly memory: WebAssembly.Memory;
466
+ readonly store: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
467
+ readonly retrieve: (a: number, b: number, c: number, d: number) => number;
468
+ readonly retrieve_metadata: (a: number, b: number, c: number, d: number) => number;
469
+ readonly encode_hex: (a: number, b: number, c: number) => void;
470
+ readonly encode_base64: (a: number, b: number, c: number) => void;
471
+ readonly decode_hex: (a: number, b: number, c: number) => void;
472
+ readonly decode_base64: (a: number, b: number, c: number) => void;
466
473
  readonly switch_network: (a: number, b: number) => number;
467
474
  readonly get_env: (a: number, b: number) => number;
468
475
  readonly set_env: (a: number, b: number, c: number, d: number) => number;
469
476
  readonly sleep: (a: number) => number;
477
+ readonly get_network: () => number;
478
+ readonly new_nostr_pubkey: (a: number, b: number, c: number, d: number) => number;
479
+ readonly update_nostr_pubkey: (a: number, b: number, c: number, d: number) => number;
470
480
  readonly hash_password: (a: number, b: number, c: number) => void;
471
481
  readonly new_mnemonic: (a: number, b: number) => number;
472
482
  readonly decrypt_wallet: (a: number, b: number, c: number, d: number) => number;
@@ -488,14 +498,6 @@ export interface InitOutput {
488
498
  readonly check_payment: (a: number, b: number) => number;
489
499
  readonly swap_btc_ln: (a: number, b: number, c: number, d: number) => number;
490
500
  readonly swap_ln_btc: (a: number, b: number, c: number, d: number, e: number) => number;
491
- readonly store: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
492
- readonly retrieve: (a: number, b: number, c: number, d: number) => number;
493
- readonly retrieve_metadata: (a: number, b: number, c: number, d: number) => number;
494
- readonly encode_hex: (a: number, b: number, c: number) => void;
495
- readonly encode_base64: (a: number, b: number, c: number) => void;
496
- readonly decode_hex: (a: number, b: number, c: number) => void;
497
- readonly decode_base64: (a: number, b: number, c: number) => void;
498
- readonly get_network: () => number;
499
501
  readonly sync_wallets: () => number;
500
502
  readonly issue_contract: (a: number, b: number, c: number) => number;
501
503
  readonly reissue_contract: (a: number, b: number, c: number) => number;
@@ -536,11 +538,9 @@ export interface InitOutput {
536
538
  readonly my_offers: (a: number, b: number) => number;
537
539
  readonly my_bids: (a: number, b: number) => number;
538
540
  readonly get_consignment: (a: number, b: number) => number;
539
- readonly get_media: (a: number, b: number) => number;
540
- readonly new_nostr_pubkey: (a: number, b: number, c: number, d: number) => number;
541
- readonly update_nostr_pubkey: (a: number, b: number, c: number, d: number) => number;
541
+ readonly get_media_metadata: (a: number, b: number) => number;
542
542
  readonly import_consignments: (a: number) => number;
543
- readonly import_media: (a: number) => number;
543
+ readonly import_uda_data: (a: number) => number;
544
544
  readonly rustsecp256k1zkp_v0_8_0_default_illegal_callback_fn: (a: number, b: number) => void;
545
545
  readonly rustsecp256k1zkp_v0_8_0_default_error_callback_fn: (a: number, b: number) => void;
546
546
  readonly rustsecp256k1_v0_8_1_context_create: (a: number) => number;