@ibearua/bitmask-core-dev 1.0.0-beta.10

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/LICENSE ADDED
@@ -0,0 +1,14 @@
1
+ This software is licensed under [Apache 2.0](LICENSE-APACHE) or
2
+ [MIT](LICENSE-MIT), at your option.
3
+
4
+ Some files retain their own copyright notice, however, for full authorship
5
+ information, see version control history.
6
+
7
+ Except as otherwise noted in individual files, all files in this repository are
8
+ licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
9
+ http://www.apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
10
+ http://opensource.org/licenses/MIT>, at your option.
11
+
12
+ You may not use, copy, modify, merge, publish, distribute, sublicense, and/or
13
+ sell copies of this software or any files in this repository except in
14
+ accordance with one or both of these licenses.
package/LICENSE-APACHE ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
package/LICENSE-MIT ADDED
@@ -0,0 +1,25 @@
1
+ Copyright (c) 2022 DIBA Global, Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any
4
+ person obtaining a copy of this software and associated
5
+ documentation files (the "Software"), to deal in the
6
+ Software without restriction, including without
7
+ limitation the rights to use, copy, modify, merge,
8
+ publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software
10
+ is furnished to do so, subject to the following
11
+ conditions:
12
+
13
+ The above copyright notice and this permission notice
14
+ shall be included in all copies or substantial portions
15
+ of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
18
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19
+ TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
20
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
21
+ SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
24
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
+ DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # BitMask Core
2
+
3
+ Core functionality for the BitMask wallet - <https://bitmask.app>
4
+
5
+ **BitMask** is a Bitcoin-only web wallet and browser extension for accessing decentralized web applications on the Bitcoin timechain. It is designed to support UTXO-based smart contracting protocols such as [RGB](https://rgb.tech), in addition to Lightning payments.
6
+
7
+ [![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
+ [![Crates.io](https://img.shields.io/crates/v/bitmask-core?style=flat-square)](https://docs.rs/bitmask-core/latest/bitmask-core/)
9
+ [![npm: bitmask-core](https://img.shields.io/npm/v/bitmask-core?style=flat-square)](https://www.npmjs.com/package/bitmask-core)
10
+ [![License: MIT+APACHE](https://img.shields.io/crates/l/bitmask-core?style=flat-square)](https://mit-license.org)
11
+ [![Telegram](https://img.shields.io/badge/telegram-invite-blue?style=flat-square)](https://t.me/+eQk5aQ5--iUxYzVk)
12
+
13
+ ## Uses
14
+
15
+ - [bdk](https://github.com/bitcoindevkit/bdk) - Bitcoin Dev Kit
16
+ - [rgb-wallet](https://github.com/RGB-WG/rgb-wallet) - RGB Wallet
17
+ - [wasm-pack](https://github.com/rustwasm/wasm-pack) - WebAssembly
18
+ - [lndhubx](https://lndhubx.kollider.xyz) - Custodial Lightning
19
+ - [nostr-sdk](https://github.com/rust-nostr/nostr) - Nostr SDK
20
+ - [carbonado](https://github.com/diba-io/carbonado) - Carbonado e2ee decentralized storage
21
+
22
+ ## Build
23
+
24
+ This should work with either wasm-pack, [trunk](https://github.com/thedodd/trunk), or x86-64.
25
+
26
+ Some environment variables may be needed in order to compile on macos-aarch64, for more, [see this](https://github.com/sapio-lang/sapio/issues/146#issuecomment-960659800).
27
+
28
+ If there are issues compiling, be sure to check you're compiling with the latest Rust version.
29
+
30
+ To build this as a NodeJS module:
31
+
32
+ 1. Define rust flags: `export RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals'`
33
+ 2. Execute: `wasm-pack build --release --target bundler`
34
+
35
+ ## Test
36
+
37
+ 1. Lint against wasm32: `cargo clippy --target wasm32-unknown-unknown`
38
+ 2. Run tests in browser: `TEST_WALLET_SEED="replace with a 12 word mnemonic for a wallet containing testnet sats" wasm-pack test --headless --chrome`
39
+
40
+ ## Run
41
+
42
+ To run the bitmaskd node with REST server, either for testing the web wallet, or simply for increased privacy:
43
+
44
+ `cargo install --features=server --path .`
45
+
46
+ Then run `bitmaskd`.
47
+
48
+ ## Development
49
+
50
+ 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:
51
+
52
+ `cargo clippy --target wasm32-unknown-unknown --no-default-features --release`
53
+
54
+ ## Release
55
+
56
+ Upon a new release, follow these steps:
57
+
58
+ 1. Run `cargo update` to update to latest deps.
59
+ 1. Run `cargo +nightly udeps` to see if there are any unused dependencies.
60
+
61
+ ## Docker
62
+
63
+ For running bitmask-core tests in Regtest Mode, please follow the steps below:
64
+
65
+ ### Initial Setup
66
+
67
+ 1. Load the command line: `source .commands` or if using fish shell, `bass source .commands`
68
+ 2. Build bitcoin node + electrum: `docker-compose build`.
69
+ 3. Up and running Docker containers: `docker-compose up -d bitcoin1 electrs carbonado rgb-proxy`.
70
+ 4. Download and install BDK cli: `cargo install bdk-cli` (We will use BDK to generate the mnemonic).
71
+ 5. Generate a new mnemonic: `bdk-cli key generate`.
72
+ 6. Create an environment variable called **TEST_WALLET_SEED** with mnemonic generated in the **step 5** (only wasm32).
73
+ 7. Run the test to get regtest address for bitcoin and rgb: `cargo test --test wallet -- create_wallet --exact --nocapture`.
74
+ 8. Load your wallet in the bitcoin node: `bc1 loadwallet default`, or if using a new wallet, `bc1 createwallet default`.
75
+ 9. Generate new first 500 blocks: `bc1 -generate 500`.
76
+ 10. Send some coins to the main wallet address: `bc1 sendtoaddress {MAIN_VAULT_ADDRESS} 10`. Change `{MAIN_VAULT_ADDRESS}` with the address generated in the **step 7**.
77
+ 11. Mine a new block: `bc1 -generate 1`
78
+
79
+ ### Running the tests
80
+
81
+ Running the tests: `cargo test -- --test-threads 1`
82
+
83
+ ### Troubleshooting
84
+
85
+ #### **1. After restarting the container**
86
+
87
+ **A.The bitcoin node does not work?**
88
+
89
+ Check if your wallet is loaded. For that, run the command `bitcoin1 loadwallet default`.
90
+
91
+ **B.The electrs node does not work?**
92
+
93
+ To stop the electrs freeze, run `bitcoin1 -generate`.
@@ -0,0 +1,248 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export function store(secret_key: string, name: string, data: Uint8Array, force: boolean, metadata?: Uint8Array | null): Promise<any>;
4
+ export function retrieve(secret_key: string, name: string): Promise<any>;
5
+ export function retrieve_metadata(secret_key: string, name: string): Promise<any>;
6
+ export function encode_hex(bytes: Uint8Array): string;
7
+ export function encode_base64(bytes: Uint8Array): string;
8
+ export function decode_hex(string: string): Uint8Array;
9
+ export function decode_base64(string: string): Uint8Array;
10
+ export function create_watcher(nostr_hex_sk: string, request: any): Promise<any>;
11
+ export function recover_watcher(nostr_hex_sk: string, request: any): Promise<any>;
12
+ export function destroy_watcher(nostr_hex_sk: string): Promise<any>;
13
+ export function destroy_recover_watcher(nostr_hex_sk: string): Promise<any>;
14
+ export function check_watcher(nostr_hex_sk: string): Promise<any>;
15
+ export function watcher_next_address(nostr_hex_sk: string, request: string): Promise<any>;
16
+ export function watcher_next_utxo(nostr_hex_sk: string, request: string): Promise<any>;
17
+ export function watcher_unspent_utxos(nostr_hex_sk: string, request: string): Promise<any>;
18
+ export function get_rgb_version(): string;
19
+ export function get_rgb_wallet(nostr_hex_sk: string): Promise<any>;
20
+ export function get_contract(nostr_hex_sk: string, request: string): Promise<any>;
21
+ export function list_contracts(nostr_hex_sk: string, arg1: boolean): Promise<any>;
22
+ export function import_contract(nostr_hex_sk: string, request: string): Promise<any>;
23
+ export function issue_contract(nostr_hex_sk: string, request: any): Promise<any>;
24
+ export function issue_contract_proxy(nostr_hex_sk: string, request: any): Promise<any>;
25
+ export function create_rgb_invoice(nostr_hex_sk: string, request: any): Promise<any>;
26
+ export function remove_rgb_invoice(nostr_hex_sk: string, request: string): Promise<any>;
27
+ export function list_rgb_invoices(nostr_hex_sk: string): Promise<any>;
28
+ export function decode_rgb_invoice(invoice: string): Promise<any>;
29
+ export function can_create_transfer_contract(nostr_hex_sk: string, request: any): Promise<any>;
30
+ export function create_rgb_transfer(nostr_hex_sk: string, request: any): Promise<any>;
31
+ export function create_and_publish_rgb_transfer(nostr_hex_sk: string, request: any, secrets: any): Promise<any>;
32
+ export function psbt_sign_file(_nostr_hex_sk: string, request: any): Promise<any>;
33
+ export function accept_transfer(nostr_hex_sk: string, request: any): Promise<any>;
34
+ export function save_transfer(nostr_hex_sk: string, request: any): Promise<any>;
35
+ export function list_transfers(nostr_hex_sk: string): Promise<any>;
36
+ export function verify_transfers(nostr_hex_sk: string): Promise<any>;
37
+ export function list_offers(nostr_hex_sk: string): Promise<any>;
38
+ export function offers(nostr_hex_sk: string): Promise<any>;
39
+ export function bids(nostr_hex_sk: string): Promise<any>;
40
+ export function offer_swap_suppl(nostr_hex_sk: string, offer_id: string): Promise<any>;
41
+ export function bid_swap_suppl(nostr_hex_sk: string, bid_id: string): Promise<any>;
42
+ export function can_create_offer(nostr_hex_sk: string, request: any, secrets: any): Promise<any>;
43
+ export function create_offer(nostr_hex_sk: string, request: any, secrets: any): Promise<any>;
44
+ export function cancel_offer(nostr_hex_sk: string, request: any): Promise<any>;
45
+ export function can_create_bid(nostr_hex_sk: string, request: any, secrets: any): Promise<any>;
46
+ export function create_bid(nostr_hex_sk: string, request: any, secrets: any): Promise<any>;
47
+ export function cancel_bid(nostr_hex_sk: string, request: any): Promise<any>;
48
+ export function create_airdrop(nostr_hex_sk: string, request: any, secrets: any, fee: bigint, max_claim: string): Promise<any>;
49
+ export function create_airdrop_claim(nostr_hex_sk: string, request: any): Promise<any>;
50
+ export function close_airdrop(nostr_hex_sk: string, request: any): Promise<any>;
51
+ export function backup_rgb_data(nostr_hex_sk: string): Promise<any>;
52
+ export function restore_rgb_data(nostr_hex_sk: string): Promise<any>;
53
+ export function get_network(): Promise<any>;
54
+ export function switch_network(network_str: string): Promise<any>;
55
+ export function get_env(key: string): Promise<any>;
56
+ export function set_env(key: string, value: string): Promise<any>;
57
+ export function sleep(ms: number): Promise<any>;
58
+ export function convert_contract_amount_raw(decimal: string, precision: number): string;
59
+ export function convert_contract_amount_string(amount: bigint, precision: number): string;
60
+ export function parse_contract_amount(amount: string): any;
61
+ export function parse_contract_amount_precision(amount: string, precision: number): string;
62
+ export function version(): any;
63
+ export function create_wallet(username: string, password: string): Promise<any>;
64
+ export function auth(username: string, password: string): Promise<any>;
65
+ export function ln_create_invoice(description: string, amount: number, token: string): Promise<any>;
66
+ export function get_balance(token: string): Promise<any>;
67
+ export function get_txs(token: string): Promise<any>;
68
+ export function pay_invoice(payment_request: string, token: string): Promise<any>;
69
+ export function check_payment(payment_hash: string): Promise<any>;
70
+ export function swap_btc_ln(token: string, ln_address?: string | null): Promise<any>;
71
+ export function swap_ln_btc(address: string, amount: bigint, token: string): Promise<any>;
72
+ export function fund_rgb_vault(sk: string, fee_rate: number, secrets: any, broadcast: boolean, fund_value: bigint | null | undefined, coordinator_fee: boolean): Promise<any>;
73
+ export function transfer_sats(sk: string, address: string, sats: bigint, fee_rate: number, secrets: any): Promise<any>;
74
+ export function get_btc_wallet(sk: string): Promise<any>;
75
+ export function backup_btc_data(nostr_hex_sk: string): Promise<any>;
76
+ export function recover_funds_from_bad_wallets(seed: string, pass_phrase: string, recover_address: string): Promise<any>;
77
+ export function restore_btc_data(nostr_hex_sk: string): Promise<any>;
78
+ export function new_nostr_pubkey(pubkey: string, token: string): Promise<any>;
79
+ export function update_nostr_pubkey(pubkey: string, token: string): Promise<any>;
80
+ export function hash_password(password: string): string;
81
+ export function new_mnemonic(password: string): Promise<any>;
82
+ export function save_mnemonic(seed: string, password: string): Promise<any>;
83
+ export function decrypt_wallet(hash: string, encrypted_descriptors: string, seed_password: string): Promise<any>;
84
+ export function upgrade_wallet(hash: string, encrypted_descriptors: string, seed_password: string): Promise<any>;
85
+ export function new_wallet(hash: string, seed_password: string): Promise<any>;
86
+ export function encrypt_wallet(mnemonic: string, hash: string, seed_password: string): Promise<any>;
87
+ export function get_wallet_data(descriptor: string, change_descriptor?: string | null): Promise<any>;
88
+ export function sync_wallets(): Promise<any>;
89
+ export function get_new_address(descriptor: string, change_descriptor?: string | null): Promise<any>;
90
+ export function send_sats(descriptor: string, change_descriptor: string, destination: string, amount: bigint, broadcast: boolean, fee_rate?: number | null): Promise<any>;
91
+ export function fund_vault(descriptor: string, change_descriptor: string, rgb_address: string, broadcast: boolean, fee_rate?: number | null): Promise<any>;
92
+ export function get_assets_vault(rgb_descriptor_xpub: string): Promise<any>;
93
+ export function drain_wallet(destination: string, descriptor: string, change_descriptor?: string | null, fee_rate?: number | null): Promise<any>;
94
+ export function bump_fee(txid: string, fee_rate: number, descriptor: string, change_descriptor: string | null | undefined, broadcast: boolean): Promise<any>;
95
+ export function psbt_sign_and_publish_file(request: any): Promise<any>;
96
+ export function psbt_publish_file(request: any): Promise<any>;
97
+
98
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
99
+
100
+ export interface InitOutput {
101
+ readonly memory: WebAssembly.Memory;
102
+ readonly store: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => any;
103
+ readonly retrieve: (a: number, b: number, c: number, d: number) => any;
104
+ readonly retrieve_metadata: (a: number, b: number, c: number, d: number) => any;
105
+ readonly encode_hex: (a: number, b: number) => [number, number];
106
+ readonly encode_base64: (a: number, b: number) => [number, number];
107
+ readonly decode_hex: (a: number, b: number) => [number, number, number, number];
108
+ readonly decode_base64: (a: number, b: number) => [number, number, number, number];
109
+ readonly create_watcher: (a: number, b: number, c: any) => any;
110
+ readonly recover_watcher: (a: number, b: number, c: any) => any;
111
+ readonly destroy_watcher: (a: number, b: number) => any;
112
+ readonly destroy_recover_watcher: (a: number, b: number) => any;
113
+ readonly check_watcher: (a: number, b: number) => any;
114
+ readonly watcher_next_address: (a: number, b: number, c: number, d: number) => any;
115
+ readonly watcher_next_utxo: (a: number, b: number, c: number, d: number) => any;
116
+ readonly watcher_unspent_utxos: (a: number, b: number, c: number, d: number) => any;
117
+ readonly get_rgb_version: () => [number, number];
118
+ readonly get_rgb_wallet: (a: number, b: number) => any;
119
+ readonly get_contract: (a: number, b: number, c: number, d: number) => any;
120
+ readonly list_contracts: (a: number, b: number, c: number) => any;
121
+ readonly import_contract: (a: number, b: number, c: number, d: number) => any;
122
+ readonly issue_contract: (a: number, b: number, c: any) => any;
123
+ readonly issue_contract_proxy: (a: number, b: number, c: any) => any;
124
+ readonly create_rgb_invoice: (a: number, b: number, c: any) => any;
125
+ readonly remove_rgb_invoice: (a: number, b: number, c: number, d: number) => any;
126
+ readonly list_rgb_invoices: (a: number, b: number) => any;
127
+ readonly decode_rgb_invoice: (a: number, b: number) => any;
128
+ readonly can_create_transfer_contract: (a: number, b: number, c: any) => any;
129
+ readonly create_rgb_transfer: (a: number, b: number, c: any) => any;
130
+ readonly create_and_publish_rgb_transfer: (a: number, b: number, c: any, d: any) => any;
131
+ readonly psbt_sign_file: (a: number, b: number, c: any) => any;
132
+ readonly accept_transfer: (a: number, b: number, c: any) => any;
133
+ readonly save_transfer: (a: number, b: number, c: any) => any;
134
+ readonly list_transfers: (a: number, b: number) => any;
135
+ readonly verify_transfers: (a: number, b: number) => any;
136
+ readonly list_offers: (a: number, b: number) => any;
137
+ readonly offers: (a: number, b: number) => any;
138
+ readonly bids: (a: number, b: number) => any;
139
+ readonly offer_swap_suppl: (a: number, b: number, c: number, d: number) => any;
140
+ readonly bid_swap_suppl: (a: number, b: number, c: number, d: number) => any;
141
+ readonly can_create_offer: (a: number, b: number, c: any, d: any) => any;
142
+ readonly create_offer: (a: number, b: number, c: any, d: any) => any;
143
+ readonly cancel_offer: (a: number, b: number, c: any) => any;
144
+ readonly can_create_bid: (a: number, b: number, c: any, d: any) => any;
145
+ readonly create_bid: (a: number, b: number, c: any, d: any) => any;
146
+ readonly cancel_bid: (a: number, b: number, c: any) => any;
147
+ readonly create_airdrop: (a: number, b: number, c: any, d: any, e: bigint, f: number, g: number) => any;
148
+ readonly create_airdrop_claim: (a: number, b: number, c: any) => any;
149
+ readonly close_airdrop: (a: number, b: number, c: any) => any;
150
+ readonly backup_rgb_data: (a: number, b: number) => any;
151
+ readonly restore_rgb_data: (a: number, b: number) => any;
152
+ readonly get_network: () => any;
153
+ readonly switch_network: (a: number, b: number) => any;
154
+ readonly get_env: (a: number, b: number) => any;
155
+ readonly set_env: (a: number, b: number, c: number, d: number) => any;
156
+ readonly sleep: (a: number) => any;
157
+ readonly convert_contract_amount_raw: (a: number, b: number, c: number) => [number, number];
158
+ readonly convert_contract_amount_string: (a: bigint, b: number) => [number, number];
159
+ readonly parse_contract_amount: (a: number, b: number) => any;
160
+ readonly parse_contract_amount_precision: (a: number, b: number, c: number) => [number, number];
161
+ readonly version: () => any;
162
+ readonly create_wallet: (a: number, b: number, c: number, d: number) => any;
163
+ readonly auth: (a: number, b: number, c: number, d: number) => any;
164
+ readonly ln_create_invoice: (a: number, b: number, c: number, d: number, e: number) => any;
165
+ readonly get_balance: (a: number, b: number) => any;
166
+ readonly get_txs: (a: number, b: number) => any;
167
+ readonly pay_invoice: (a: number, b: number, c: number, d: number) => any;
168
+ readonly check_payment: (a: number, b: number) => any;
169
+ readonly swap_btc_ln: (a: number, b: number, c: number, d: number) => any;
170
+ readonly swap_ln_btc: (a: number, b: number, c: bigint, d: number, e: number) => any;
171
+ readonly fund_rgb_vault: (a: number, b: number, c: number, d: any, e: number, f: number, g: bigint, h: number) => any;
172
+ readonly transfer_sats: (a: number, b: number, c: number, d: number, e: bigint, f: number, g: any) => any;
173
+ readonly get_btc_wallet: (a: number, b: number) => any;
174
+ readonly backup_btc_data: (a: number, b: number) => any;
175
+ readonly recover_funds_from_bad_wallets: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
176
+ readonly restore_btc_data: (a: number, b: number) => any;
177
+ readonly new_nostr_pubkey: (a: number, b: number, c: number, d: number) => any;
178
+ readonly update_nostr_pubkey: (a: number, b: number, c: number, d: number) => any;
179
+ readonly hash_password: (a: number, b: number) => [number, number];
180
+ readonly new_mnemonic: (a: number, b: number) => any;
181
+ readonly save_mnemonic: (a: number, b: number, c: number, d: number) => any;
182
+ readonly decrypt_wallet: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
183
+ readonly upgrade_wallet: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
184
+ readonly new_wallet: (a: number, b: number, c: number, d: number) => any;
185
+ readonly encrypt_wallet: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
186
+ readonly get_wallet_data: (a: number, b: number, c: number, d: number) => any;
187
+ readonly sync_wallets: () => any;
188
+ readonly get_new_address: (a: number, b: number, c: number, d: number) => any;
189
+ readonly send_sats: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number) => any;
190
+ readonly fund_vault: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => any;
191
+ readonly get_assets_vault: (a: number, b: number) => any;
192
+ readonly drain_wallet: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
193
+ readonly bump_fee: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => any;
194
+ readonly psbt_sign_and_publish_file: (a: any) => any;
195
+ readonly psbt_publish_file: (a: any) => any;
196
+ readonly rustsecp256k1_v0_9_2_context_create: (a: number) => number;
197
+ readonly rustsecp256k1_v0_9_2_context_destroy: (a: number) => void;
198
+ readonly rustsecp256k1_v0_9_2_default_illegal_callback_fn: (a: number, b: number) => void;
199
+ readonly rustsecp256k1_v0_9_2_default_error_callback_fn: (a: number, b: number) => void;
200
+ readonly rustsecp256k1_v0_8_1_context_create: (a: number) => number;
201
+ readonly rustsecp256k1_v0_8_1_context_destroy: (a: number) => void;
202
+ readonly rustsecp256k1_v0_8_1_default_illegal_callback_fn: (a: number, b: number) => void;
203
+ readonly rustsecp256k1_v0_8_1_default_error_callback_fn: (a: number, b: number) => void;
204
+ readonly rustsecp256k1_v0_10_0_context_create: (a: number) => number;
205
+ readonly rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
206
+ readonly rustsecp256k1_v0_10_0_default_illegal_callback_fn: (a: number, b: number) => void;
207
+ readonly rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
208
+ readonly rustsecp256k1_v0_6_1_context_create: (a: number) => number;
209
+ readonly rustsecp256k1_v0_6_1_context_destroy: (a: number) => void;
210
+ readonly rustsecp256k1_v0_6_1_default_illegal_callback_fn: (a: number, b: number) => void;
211
+ readonly rustsecp256k1_v0_6_1_default_error_callback_fn: (a: number, b: number) => void;
212
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
213
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
214
+ readonly __wbindgen_exn_store: (a: number) => void;
215
+ readonly __externref_table_alloc: () => number;
216
+ readonly __wbindgen_export_4: WebAssembly.Table;
217
+ readonly __externref_drop_slice: (a: number, b: number) => void;
218
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
219
+ readonly __wbindgen_export_7: WebAssembly.Table;
220
+ readonly __externref_table_dealloc: (a: number) => void;
221
+ readonly closure1855_externref_shim: (a: number, b: number, c: any) => void;
222
+ readonly closure1997_externref_shim: (a: number, b: number, c: any) => void;
223
+ readonly closure2665_externref_shim: (a: number, b: number, c: any) => void;
224
+ readonly closure3825_externref_shim: (a: number, b: number, c: any) => void;
225
+ readonly closure4113_externref_shim: (a: number, b: number, c: any, d: any) => void;
226
+ readonly __wbindgen_start: () => void;
227
+ }
228
+
229
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
230
+ /**
231
+ * Instantiates the given `module`, which can either be bytes or
232
+ * a precompiled `WebAssembly.Module`.
233
+ *
234
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
235
+ *
236
+ * @returns {InitOutput}
237
+ */
238
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
239
+
240
+ /**
241
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
242
+ * for everything else, calls `WebAssembly.instantiate` directly.
243
+ *
244
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
245
+ *
246
+ * @returns {Promise<InitOutput>}
247
+ */
248
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;