bitmask-core 1.0.7-beta.16 → 1.0.7-beta.18
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 +6 -6
- package/bitcoin.js +63 -103
- package/bitmask_core.d.ts +105 -105
- package/bitmask_core.js +652 -652
- package/bitmask_core_bg.wasm +0 -0
- package/bitmask_core_bg.wasm.d.ts +55 -55
- package/bp.d.ts +1 -1
- package/bp.js +13 -38
- package/carbonado.d.ts +1 -1
- package/carbonado.js +8 -31
- package/constants.js +86 -119
- package/index.d.ts +1 -1
- package/index.js +14 -28
- package/lightning.d.ts +1 -1
- package/lightning.js +16 -39
- package/nostr.js +9 -32
- package/package.json +1 -1
- package/rgb.d.ts +6 -16
- package/rgb.js +43 -68
- package/wallet.js +14 -37
package/bitcoin.d.ts
CHANGED
|
@@ -4,13 +4,13 @@ export declare const upgradeWallet: (hash: string, encryptedDescriptors: string,
|
|
|
4
4
|
export declare const syncWallets: () => Promise<void>;
|
|
5
5
|
export declare const newWallet: (hash: string, seedPassword: string) => Promise<string>;
|
|
6
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>;
|
|
7
|
+
export declare const getWalletData: (descriptor: string, changeDescriptor?: string | undefined) => Promise<WalletData>;
|
|
8
|
+
export declare const getNewAddress: (descriptor: string, changeDescriptor?: string | undefined) => Promise<string>;
|
|
9
9
|
export declare const sendSats: (descriptor: string, changeDescriptor: string, address: string, amount: bigint, broadcast: boolean, feeRate: number) => Promise<TransactionData>;
|
|
10
|
-
export declare const fundVault: (descriptor: string, changeDescriptor: string, rgbAddress: string, broadcast: boolean, feeRate?: number) => Promise<FundVaultDetails>;
|
|
10
|
+
export declare const fundVault: (descriptor: string, changeDescriptor: string, rgbAddress: string, broadcast: boolean, feeRate?: number | undefined) => Promise<FundVaultDetails>;
|
|
11
11
|
export declare const getAssetsVault: (rgbDescriptorXpub: string) => Promise<FundVaultDetails>;
|
|
12
|
-
export declare const drainWallet: (destination: string, descriptor: string, changeDescriptor?: string, feeRate?: number) => Promise<TransactionData>;
|
|
13
|
-
export declare const bumpFee: (txid: string, feeRate: number, broadcast: boolean, descriptor: string, changeDescriptor?: string) => Promise<TransactionData>;
|
|
12
|
+
export declare const drainWallet: (destination: string, descriptor: string, changeDescriptor?: string | undefined, feeRate?: number | undefined) => Promise<TransactionData>;
|
|
13
|
+
export declare const bumpFee: (txid: string, feeRate: number, broadcast: boolean, descriptor: string, changeDescriptor?: string | undefined) => Promise<TransactionData>;
|
|
14
14
|
export interface PrivateWalletData {
|
|
15
15
|
xprvkh: string;
|
|
16
16
|
btcDescriptorXprv: string;
|
|
@@ -115,7 +115,7 @@ export interface FundVaultDetails {
|
|
|
115
115
|
fundTxid?: string;
|
|
116
116
|
fundFee?: number;
|
|
117
117
|
}
|
|
118
|
-
export type FeeEstimates = Record<string, number>;
|
|
118
|
+
export declare type FeeEstimates = Record<string, number>;
|
|
119
119
|
export declare function fetchFeeEstimates(): Promise<FeeEstimates>;
|
|
120
120
|
export declare function feeFromRate(vbytes: number, satPerVb: number): number;
|
|
121
121
|
/**
|
package/bitcoin.js
CHANGED
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
// https://github.com/diba-io/bitmask-core/blob/development/src/web.rs
|
|
4
4
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
5
|
if (k2 === undefined) k2 = k;
|
|
6
|
-
|
|
7
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
-
}
|
|
10
|
-
Object.defineProperty(o, k2, desc);
|
|
6
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
11
7
|
}) : (function(o, m, k, k2) {
|
|
12
8
|
if (k2 === undefined) k2 = k;
|
|
13
9
|
o[k2] = m[k];
|
|
@@ -17,38 +13,15 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
17
13
|
}) : function(o, v) {
|
|
18
14
|
o["default"] = v;
|
|
19
15
|
});
|
|
20
|
-
var __importStar = (this && this.__importStar) ||
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
return ownKeys(o);
|
|
28
|
-
};
|
|
29
|
-
return function (mod) {
|
|
30
|
-
if (mod && mod.__esModule) return mod;
|
|
31
|
-
var result = {};
|
|
32
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
33
|
-
__setModuleDefault(result, mod);
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
|
-
})();
|
|
37
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
38
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
39
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
40
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
41
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
42
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
43
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
44
|
-
});
|
|
16
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
17
|
+
if (mod && mod.__esModule) return mod;
|
|
18
|
+
var result = {};
|
|
19
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
20
|
+
__setModuleDefault(result, mod);
|
|
21
|
+
return result;
|
|
45
22
|
};
|
|
46
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
-
exports.bumpFee = exports.drainWallet = exports.getAssetsVault = exports.fundVault = exports.sendSats = exports.getNewAddress = exports.getWalletData = exports.encryptWallet = exports.newWallet = exports.syncWallets = exports.upgradeWallet = exports.decryptWallet = exports.hashPassword = void 0;
|
|
48
|
-
exports.fetchFeeEstimates = fetchFeeEstimates;
|
|
49
|
-
exports.feeFromRate = feeFromRate;
|
|
50
|
-
exports.guessSwapVbytes = guessSwapVbytes;
|
|
51
|
-
exports.quoteSwapFeeSats = quoteSwapFeeSats;
|
|
24
|
+
exports.quoteSwapFeeSats = exports.guessSwapVbytes = exports.feeFromRate = exports.fetchFeeEstimates = exports.bumpFee = exports.drainWallet = exports.getAssetsVault = exports.fundVault = exports.sendSats = exports.getNewAddress = exports.getWalletData = exports.encryptWallet = exports.newWallet = exports.syncWallets = exports.upgradeWallet = exports.decryptWallet = exports.hashPassword = void 0;
|
|
52
25
|
const BMC = __importStar(require("./bitmask_core"));
|
|
53
26
|
const constants_1 = require("./constants");
|
|
54
27
|
const hashPassword = (password) => {
|
|
@@ -58,81 +31,69 @@ const hashPassword = (password) => {
|
|
|
58
31
|
return BMC.hash_password(password);
|
|
59
32
|
};
|
|
60
33
|
exports.hashPassword = hashPassword;
|
|
61
|
-
const decryptWallet = (
|
|
62
|
-
return JSON.parse(yield BMC.decrypt_wallet(hash, encryptedDescriptors, seedPassword));
|
|
63
|
-
});
|
|
34
|
+
const decryptWallet = async (hash, encryptedDescriptors, seedPassword = "") => JSON.parse(await BMC.decrypt_wallet(hash, encryptedDescriptors, seedPassword));
|
|
64
35
|
exports.decryptWallet = decryptWallet;
|
|
65
|
-
const upgradeWallet = (
|
|
66
|
-
return JSON.parse(yield BMC.upgrade_wallet(hash, encryptedDescriptors, seedPassword));
|
|
67
|
-
});
|
|
36
|
+
const upgradeWallet = async (hash, encryptedDescriptors, seedPassword = "") => JSON.parse(await BMC.upgrade_wallet(hash, encryptedDescriptors, seedPassword));
|
|
68
37
|
exports.upgradeWallet = upgradeWallet;
|
|
69
|
-
const syncWallets = () =>
|
|
38
|
+
const syncWallets = async () => BMC.sync_wallets();
|
|
70
39
|
exports.syncWallets = syncWallets;
|
|
71
|
-
const newWallet = (hash, seedPassword) =>
|
|
40
|
+
const newWallet = async (hash, seedPassword) => JSON.parse(await BMC.new_wallet(hash, seedPassword));
|
|
72
41
|
exports.newWallet = newWallet;
|
|
73
|
-
const encryptWallet = (mnemonic, hash, seedPassword) =>
|
|
42
|
+
const encryptWallet = async (mnemonic, hash, seedPassword) => JSON.parse(await BMC.encrypt_wallet(mnemonic, hash, seedPassword));
|
|
74
43
|
exports.encryptWallet = encryptWallet;
|
|
75
|
-
const getWalletData = (descriptor, changeDescriptor) =>
|
|
44
|
+
const getWalletData = async (descriptor, changeDescriptor) => JSON.parse(await BMC.get_wallet_data(descriptor, changeDescriptor));
|
|
76
45
|
exports.getWalletData = getWalletData;
|
|
77
|
-
const getNewAddress = (descriptor, changeDescriptor) =>
|
|
46
|
+
const getNewAddress = async (descriptor, changeDescriptor) => JSON.parse(await BMC.get_new_address(descriptor, changeDescriptor));
|
|
78
47
|
exports.getNewAddress = getNewAddress;
|
|
79
|
-
const sendSats = (descriptor, changeDescriptor, address, amount, broadcast, feeRate) =>
|
|
80
|
-
return JSON.parse(yield BMC.send_sats(descriptor, changeDescriptor, address, amount, broadcast, feeRate));
|
|
81
|
-
});
|
|
48
|
+
const sendSats = async (descriptor, changeDescriptor, address, amount, broadcast, feeRate) => JSON.parse(await BMC.send_sats(descriptor, changeDescriptor, address, amount, broadcast, feeRate));
|
|
82
49
|
exports.sendSats = sendSats;
|
|
83
|
-
const fundVault = (descriptor, changeDescriptor, rgbAddress, broadcast, feeRate) =>
|
|
84
|
-
return JSON.parse(yield BMC.fund_vault(descriptor, changeDescriptor, rgbAddress, broadcast, feeRate));
|
|
85
|
-
});
|
|
50
|
+
const fundVault = async (descriptor, changeDescriptor, rgbAddress, broadcast, feeRate) => JSON.parse(await BMC.fund_vault(descriptor, changeDescriptor, rgbAddress, broadcast, feeRate));
|
|
86
51
|
exports.fundVault = fundVault;
|
|
87
|
-
const getAssetsVault = (rgbDescriptorXpub) =>
|
|
52
|
+
const getAssetsVault = async (rgbDescriptorXpub) => JSON.parse(await BMC.get_assets_vault(rgbDescriptorXpub));
|
|
88
53
|
exports.getAssetsVault = getAssetsVault;
|
|
89
|
-
const drainWallet = (destination, descriptor, changeDescriptor, feeRate) =>
|
|
90
|
-
return JSON.parse(yield BMC.drain_wallet(destination, descriptor, changeDescriptor, feeRate));
|
|
91
|
-
});
|
|
54
|
+
const drainWallet = async (destination, descriptor, changeDescriptor, feeRate) => JSON.parse(await BMC.drain_wallet(destination, descriptor, changeDescriptor, feeRate));
|
|
92
55
|
exports.drainWallet = drainWallet;
|
|
93
|
-
const bumpFee = (txid, feeRate, broadcast, descriptor, changeDescriptor) =>
|
|
94
|
-
return JSON.parse(yield BMC.bump_fee(txid, feeRate, descriptor, changeDescriptor, broadcast));
|
|
95
|
-
});
|
|
56
|
+
const bumpFee = async (txid, feeRate, broadcast, descriptor, changeDescriptor) => JSON.parse(await BMC.bump_fee(txid, feeRate, descriptor, changeDescriptor, broadcast));
|
|
96
57
|
exports.bumpFee = bumpFee;
|
|
97
|
-
function fetchFeeEstimates() {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
return (yield resp.json());
|
|
131
|
-
});
|
|
58
|
+
async function fetchFeeEstimates() {
|
|
59
|
+
const net = await (0, constants_1.getNetwork)();
|
|
60
|
+
let envKey;
|
|
61
|
+
switch (net) {
|
|
62
|
+
case "bitcoin":
|
|
63
|
+
envKey = "BITCOIN_EXPLORER_API_MAINNET";
|
|
64
|
+
break;
|
|
65
|
+
case "testnet":
|
|
66
|
+
envKey = "BITCOIN_EXPLORER_API_TESTNET";
|
|
67
|
+
break;
|
|
68
|
+
case "signet":
|
|
69
|
+
envKey = "BITCOIN_EXPLORER_API_SIGNET";
|
|
70
|
+
break;
|
|
71
|
+
case "regtest":
|
|
72
|
+
envKey = "BITCOIN_EXPLORER_API_REGTEST";
|
|
73
|
+
break;
|
|
74
|
+
default:
|
|
75
|
+
// Fallback to signet if unknown string is returned
|
|
76
|
+
envKey = "BITCOIN_EXPLORER_API_SIGNET";
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
const base = await (0, constants_1.getEnv)(envKey);
|
|
80
|
+
if (!base) {
|
|
81
|
+
throw new Error(`fee-estimates: missing env ${envKey} for network ${net}`);
|
|
82
|
+
}
|
|
83
|
+
const baseUrl = (base || "").replace(/\/$/, "");
|
|
84
|
+
const url = `${baseUrl}/fee-estimates`;
|
|
85
|
+
const resp = await fetch(url, { method: "GET" });
|
|
86
|
+
if (!resp.ok) {
|
|
87
|
+
const text = await resp.text().catch(() => "");
|
|
88
|
+
throw new Error(`fee-estimates fetch failed ${resp.status}: ${text}`);
|
|
89
|
+
}
|
|
90
|
+
return (await resp.json());
|
|
132
91
|
}
|
|
92
|
+
exports.fetchFeeEstimates = fetchFeeEstimates;
|
|
133
93
|
function feeFromRate(vbytes, satPerVb) {
|
|
134
94
|
return Math.ceil(vbytes * satPerVb);
|
|
135
95
|
}
|
|
96
|
+
exports.feeFromRate = feeFromRate;
|
|
136
97
|
/**
|
|
137
98
|
* Rough vbytes guesser for swap/bid PSBTs when you don't yet know exact inputs/outputs.
|
|
138
99
|
* Prefer passing a conservative bound to avoid underpaying relays:
|
|
@@ -151,19 +112,18 @@ function guessSwapVbytes(inputs = 2, outputs = 3, taprootHeavy = true) {
|
|
|
151
112
|
const est = inputs * perIn + outputs * perOut + overhead;
|
|
152
113
|
return Math.max(est, 300);
|
|
153
114
|
}
|
|
115
|
+
exports.guessSwapVbytes = guessSwapVbytes;
|
|
154
116
|
/**
|
|
155
117
|
* Convenience: get a safe absolute fee quote for a swap given a target confirmation bucket.
|
|
156
118
|
* - bucket can be "1","2","3","6","144", etc., matching Esplora keys.
|
|
157
119
|
* - vbytesEstimate can be computed via guessSwapVbytes() or a tighter UI estimate.
|
|
158
120
|
* - Adds a small 10% safety margin on the feerate to reduce min-relay rejections.
|
|
159
121
|
*/
|
|
160
|
-
function quoteSwapFeeSats(bucket, vbytesEstimate) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const fee = feeFromRate(vbytesEstimate, paddedRate);
|
|
167
|
-
return { rate: paddedRate, fee };
|
|
168
|
-
});
|
|
122
|
+
async function quoteSwapFeeSats(bucket, vbytesEstimate) {
|
|
123
|
+
const estimates = await fetchFeeEstimates();
|
|
124
|
+
const satPerVb = estimates[bucket] ?? estimates["6"] ?? 1.0;
|
|
125
|
+
const paddedRate = Math.max(1.0, satPerVb * 1.1); // 10% headroom
|
|
126
|
+
const fee = feeFromRate(vbytesEstimate, paddedRate);
|
|
127
|
+
return { rate: paddedRate, fee };
|
|
169
128
|
}
|
|
129
|
+
exports.quoteSwapFeeSats = quoteSwapFeeSats;
|
package/bitmask_core.d.ts
CHANGED
|
@@ -1,55 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
export function get_network(): Promise<any>;
|
|
4
|
-
export function switch_network(network_str: string): Promise<any>;
|
|
5
|
-
export function get_env(key: string): Promise<any>;
|
|
6
|
-
export function set_env(key: string, value: string): Promise<any>;
|
|
7
|
-
export function sleep(ms: number): Promise<any>;
|
|
8
|
-
export function hash_password(password: string): string;
|
|
9
|
-
export function new_mnemonic(password: string): Promise<any>;
|
|
10
|
-
export function save_mnemonic(seed: string, password: string): Promise<any>;
|
|
11
|
-
export function decrypt_wallet(hash: string, encrypted_descriptors: string, seed_password: string): Promise<any>;
|
|
12
|
-
export function upgrade_wallet(hash: string, encrypted_descriptors: string, seed_password: string): Promise<any>;
|
|
13
|
-
export function new_wallet(hash: string, seed_password: string): Promise<any>;
|
|
14
|
-
export function encrypt_wallet(mnemonic: string, hash: string, seed_password: string): Promise<any>;
|
|
15
|
-
export function get_wallet_data(descriptor: string, change_descriptor?: string | null): Promise<any>;
|
|
16
|
-
export function sync_wallets(): Promise<any>;
|
|
17
|
-
export function get_new_address(descriptor: string, change_descriptor?: string | null): Promise<any>;
|
|
18
|
-
export function send_sats(descriptor: string, change_descriptor: string, destination: string, amount: bigint, broadcast: boolean, fee_rate?: number | null): Promise<any>;
|
|
19
|
-
export function fund_vault(descriptor: string, change_descriptor: string, rgb_address: string, broadcast: boolean, fee_rate?: number | null): Promise<any>;
|
|
20
|
-
export function get_assets_vault(rgb_descriptor_xpub: string): Promise<any>;
|
|
21
|
-
export function drain_wallet(destination: string, descriptor: string, change_descriptor?: string | null, fee_rate?: number | null): Promise<any>;
|
|
22
|
-
export function bump_fee(txid: string, fee_rate: number, descriptor: string, change_descriptor: string | null | undefined, broadcast: boolean): Promise<any>;
|
|
23
|
-
export function psbt_sign_and_publish_file(request: any): Promise<any>;
|
|
24
|
-
export function psbt_publish_file(request: any): Promise<any>;
|
|
25
|
-
export function fund_rgb_vault(sk: string, fee_rate: number, secrets: any, broadcast: boolean, fund_value: bigint | null | undefined, coordinator_fee: boolean): Promise<any>;
|
|
26
|
-
export function transfer_sats(sk: string, address: string, sats: bigint, fee_rate: number, secrets: any): Promise<any>;
|
|
27
|
-
export function get_btc_wallet(sk: string): Promise<any>;
|
|
28
|
-
export function backup_btc_data(nostr_hex_sk: string): Promise<any>;
|
|
29
|
-
export function recover_funds_from_bad_wallets(seed: string, pass_phrase: string, recover_address: string): Promise<any>;
|
|
30
|
-
export function restore_btc_data(nostr_hex_sk: string): Promise<any>;
|
|
31
|
-
export function create_wallet(username: string, password: string): Promise<any>;
|
|
32
|
-
export function auth(username: string, password: string): Promise<any>;
|
|
33
|
-
export function ln_create_invoice(description: string, amount: number, token: string): Promise<any>;
|
|
34
|
-
export function get_balance(token: string): Promise<any>;
|
|
35
|
-
export function get_txs(token: string): Promise<any>;
|
|
36
|
-
export function pay_invoice(payment_request: string, token: string): Promise<any>;
|
|
37
|
-
export function check_payment(payment_hash: string): Promise<any>;
|
|
38
|
-
export function swap_btc_ln(token: string, ln_address?: string | null): Promise<any>;
|
|
39
|
-
export function swap_ln_btc(address: string, amount: bigint, token: string): Promise<any>;
|
|
40
|
-
export function create_watcher(nostr_hex_sk: string, request: any): Promise<any>;
|
|
41
|
-
export function recover_watcher(nostr_hex_sk: string, request: any): Promise<any>;
|
|
42
|
-
export function destroy_watcher(nostr_hex_sk: string): Promise<any>;
|
|
43
|
-
export function destroy_recover_watcher(nostr_hex_sk: string): Promise<any>;
|
|
44
|
-
export function check_watcher(nostr_hex_sk: string): Promise<any>;
|
|
45
|
-
export function watcher_next_address(nostr_hex_sk: string, request: string): Promise<any>;
|
|
46
|
-
export function watcher_next_utxo(nostr_hex_sk: string, request: string): Promise<any>;
|
|
47
|
-
export function watcher_unspent_utxos(nostr_hex_sk: string, request: string): Promise<any>;
|
|
48
|
-
export function convert_contract_amount_raw(decimal: string, precision: number): string;
|
|
49
|
-
export function convert_contract_amount_string(amount: bigint, precision: number): string;
|
|
50
|
-
export function parse_contract_amount(amount: string): any;
|
|
51
|
-
export function parse_contract_amount_precision(amount: string, precision: number): string;
|
|
52
|
-
export function version(): any;
|
|
53
3
|
export function get_rgb_version(): string;
|
|
54
4
|
export function get_rgb_wallet(nostr_hex_sk: string): Promise<any>;
|
|
55
5
|
export function get_btc_wallet_data(nostr_hex_sk: string): Promise<any>;
|
|
@@ -99,6 +49,56 @@ export function encode_hex(bytes: Uint8Array): string;
|
|
|
99
49
|
export function encode_base64(bytes: Uint8Array): string;
|
|
100
50
|
export function decode_hex(string: string): Uint8Array;
|
|
101
51
|
export function decode_base64(string: string): Uint8Array;
|
|
52
|
+
export function create_wallet(username: string, password: string): Promise<any>;
|
|
53
|
+
export function auth(username: string, password: string): Promise<any>;
|
|
54
|
+
export function ln_create_invoice(description: string, amount: number, token: string): Promise<any>;
|
|
55
|
+
export function get_balance(token: string): Promise<any>;
|
|
56
|
+
export function get_txs(token: string): Promise<any>;
|
|
57
|
+
export function pay_invoice(payment_request: string, token: string): Promise<any>;
|
|
58
|
+
export function check_payment(payment_hash: string): Promise<any>;
|
|
59
|
+
export function swap_btc_ln(token: string, ln_address?: string | null): Promise<any>;
|
|
60
|
+
export function swap_ln_btc(address: string, amount: bigint, token: string): Promise<any>;
|
|
61
|
+
export function get_network(): Promise<any>;
|
|
62
|
+
export function switch_network(network_str: string): Promise<any>;
|
|
63
|
+
export function get_env(key: string): Promise<any>;
|
|
64
|
+
export function set_env(key: string, value: string): Promise<any>;
|
|
65
|
+
export function sleep(ms: number): Promise<any>;
|
|
66
|
+
export function fund_rgb_vault(sk: string, fee_rate: number, secrets: any, broadcast: boolean, fund_value: bigint | null | undefined, coordinator_fee: boolean): Promise<any>;
|
|
67
|
+
export function transfer_sats(sk: string, address: string, sats: bigint, fee_rate: number, secrets: any): Promise<any>;
|
|
68
|
+
export function get_btc_wallet(sk: string): Promise<any>;
|
|
69
|
+
export function backup_btc_data(nostr_hex_sk: string): Promise<any>;
|
|
70
|
+
export function recover_funds_from_bad_wallets(seed: string, pass_phrase: string, recover_address: string): Promise<any>;
|
|
71
|
+
export function restore_btc_data(nostr_hex_sk: string): Promise<any>;
|
|
72
|
+
export function convert_contract_amount_raw(decimal: string, precision: number): string;
|
|
73
|
+
export function convert_contract_amount_string(amount: bigint, precision: number): string;
|
|
74
|
+
export function parse_contract_amount(amount: string): any;
|
|
75
|
+
export function parse_contract_amount_precision(amount: string, precision: number): string;
|
|
76
|
+
export function version(): any;
|
|
77
|
+
export function hash_password(password: string): string;
|
|
78
|
+
export function new_mnemonic(password: string): Promise<any>;
|
|
79
|
+
export function save_mnemonic(seed: string, password: string): Promise<any>;
|
|
80
|
+
export function decrypt_wallet(hash: string, encrypted_descriptors: string, seed_password: string): Promise<any>;
|
|
81
|
+
export function upgrade_wallet(hash: string, encrypted_descriptors: string, seed_password: string): Promise<any>;
|
|
82
|
+
export function new_wallet(hash: string, seed_password: string): Promise<any>;
|
|
83
|
+
export function encrypt_wallet(mnemonic: string, hash: string, seed_password: string): Promise<any>;
|
|
84
|
+
export function get_wallet_data(descriptor: string, change_descriptor?: string | null): Promise<any>;
|
|
85
|
+
export function sync_wallets(): Promise<any>;
|
|
86
|
+
export function get_new_address(descriptor: string, change_descriptor?: string | null): Promise<any>;
|
|
87
|
+
export function send_sats(descriptor: string, change_descriptor: string, destination: string, amount: bigint, broadcast: boolean, fee_rate?: number | null): Promise<any>;
|
|
88
|
+
export function fund_vault(descriptor: string, change_descriptor: string, rgb_address: string, broadcast: boolean, fee_rate?: number | null): Promise<any>;
|
|
89
|
+
export function get_assets_vault(rgb_descriptor_xpub: string): Promise<any>;
|
|
90
|
+
export function drain_wallet(destination: string, descriptor: string, change_descriptor?: string | null, fee_rate?: number | null): Promise<any>;
|
|
91
|
+
export function bump_fee(txid: string, fee_rate: number, descriptor: string, change_descriptor: string | null | undefined, broadcast: boolean): Promise<any>;
|
|
92
|
+
export function psbt_sign_and_publish_file(request: any): Promise<any>;
|
|
93
|
+
export function psbt_publish_file(request: any): Promise<any>;
|
|
94
|
+
export function create_watcher(nostr_hex_sk: string, request: any): Promise<any>;
|
|
95
|
+
export function recover_watcher(nostr_hex_sk: string, request: any): Promise<any>;
|
|
96
|
+
export function destroy_watcher(nostr_hex_sk: string): Promise<any>;
|
|
97
|
+
export function destroy_recover_watcher(nostr_hex_sk: string): Promise<any>;
|
|
98
|
+
export function check_watcher(nostr_hex_sk: string): Promise<any>;
|
|
99
|
+
export function watcher_next_address(nostr_hex_sk: string, request: string): Promise<any>;
|
|
100
|
+
export function watcher_next_utxo(nostr_hex_sk: string, request: string): Promise<any>;
|
|
101
|
+
export function watcher_unspent_utxos(nostr_hex_sk: string, request: string): Promise<any>;
|
|
102
102
|
export function new_nostr_pubkey(pubkey: string, token: string): Promise<any>;
|
|
103
103
|
export function update_nostr_pubkey(pubkey: string, token: string): Promise<any>;
|
|
104
104
|
|
|
@@ -106,56 +106,6 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
106
106
|
|
|
107
107
|
export interface InitOutput {
|
|
108
108
|
readonly memory: WebAssembly.Memory;
|
|
109
|
-
readonly get_network: () => any;
|
|
110
|
-
readonly switch_network: (a: number, b: number) => any;
|
|
111
|
-
readonly get_env: (a: number, b: number) => any;
|
|
112
|
-
readonly set_env: (a: number, b: number, c: number, d: number) => any;
|
|
113
|
-
readonly sleep: (a: number) => any;
|
|
114
|
-
readonly hash_password: (a: number, b: number) => [number, number];
|
|
115
|
-
readonly new_mnemonic: (a: number, b: number) => any;
|
|
116
|
-
readonly save_mnemonic: (a: number, b: number, c: number, d: number) => any;
|
|
117
|
-
readonly decrypt_wallet: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
|
|
118
|
-
readonly upgrade_wallet: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
|
|
119
|
-
readonly new_wallet: (a: number, b: number, c: number, d: number) => any;
|
|
120
|
-
readonly encrypt_wallet: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
|
|
121
|
-
readonly get_wallet_data: (a: number, b: number, c: number, d: number) => any;
|
|
122
|
-
readonly sync_wallets: () => any;
|
|
123
|
-
readonly get_new_address: (a: number, b: number, c: number, d: number) => any;
|
|
124
|
-
readonly send_sats: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number) => any;
|
|
125
|
-
readonly fund_vault: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => any;
|
|
126
|
-
readonly get_assets_vault: (a: number, b: number) => any;
|
|
127
|
-
readonly drain_wallet: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
|
|
128
|
-
readonly bump_fee: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => any;
|
|
129
|
-
readonly psbt_sign_and_publish_file: (a: any) => any;
|
|
130
|
-
readonly psbt_publish_file: (a: any) => any;
|
|
131
|
-
readonly fund_rgb_vault: (a: number, b: number, c: number, d: any, e: number, f: number, g: bigint, h: number) => any;
|
|
132
|
-
readonly transfer_sats: (a: number, b: number, c: number, d: number, e: bigint, f: number, g: any) => any;
|
|
133
|
-
readonly get_btc_wallet: (a: number, b: number) => any;
|
|
134
|
-
readonly backup_btc_data: (a: number, b: number) => any;
|
|
135
|
-
readonly recover_funds_from_bad_wallets: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
|
|
136
|
-
readonly restore_btc_data: (a: number, b: number) => any;
|
|
137
|
-
readonly create_wallet: (a: number, b: number, c: number, d: number) => any;
|
|
138
|
-
readonly auth: (a: number, b: number, c: number, d: number) => any;
|
|
139
|
-
readonly ln_create_invoice: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
140
|
-
readonly get_balance: (a: number, b: number) => any;
|
|
141
|
-
readonly get_txs: (a: number, b: number) => any;
|
|
142
|
-
readonly pay_invoice: (a: number, b: number, c: number, d: number) => any;
|
|
143
|
-
readonly check_payment: (a: number, b: number) => any;
|
|
144
|
-
readonly swap_btc_ln: (a: number, b: number, c: number, d: number) => any;
|
|
145
|
-
readonly swap_ln_btc: (a: number, b: number, c: bigint, d: number, e: number) => any;
|
|
146
|
-
readonly create_watcher: (a: number, b: number, c: any) => any;
|
|
147
|
-
readonly recover_watcher: (a: number, b: number, c: any) => any;
|
|
148
|
-
readonly destroy_watcher: (a: number, b: number) => any;
|
|
149
|
-
readonly destroy_recover_watcher: (a: number, b: number) => any;
|
|
150
|
-
readonly check_watcher: (a: number, b: number) => any;
|
|
151
|
-
readonly watcher_next_address: (a: number, b: number, c: number, d: number) => any;
|
|
152
|
-
readonly watcher_next_utxo: (a: number, b: number, c: number, d: number) => any;
|
|
153
|
-
readonly watcher_unspent_utxos: (a: number, b: number, c: number, d: number) => any;
|
|
154
|
-
readonly convert_contract_amount_raw: (a: number, b: number, c: number) => [number, number];
|
|
155
|
-
readonly convert_contract_amount_string: (a: bigint, b: number) => [number, number];
|
|
156
|
-
readonly parse_contract_amount: (a: number, b: number) => any;
|
|
157
|
-
readonly parse_contract_amount_precision: (a: number, b: number, c: number) => [number, number];
|
|
158
|
-
readonly version: () => any;
|
|
159
109
|
readonly get_rgb_version: () => [number, number];
|
|
160
110
|
readonly get_rgb_wallet: (a: number, b: number) => any;
|
|
161
111
|
readonly get_btc_wallet_data: (a: number, b: number) => any;
|
|
@@ -201,6 +151,56 @@ export interface InitOutput {
|
|
|
201
151
|
readonly encode_base64: (a: number, b: number) => [number, number];
|
|
202
152
|
readonly decode_hex: (a: number, b: number) => [number, number, number, number];
|
|
203
153
|
readonly decode_base64: (a: number, b: number) => [number, number, number, number];
|
|
154
|
+
readonly create_wallet: (a: number, b: number, c: number, d: number) => any;
|
|
155
|
+
readonly auth: (a: number, b: number, c: number, d: number) => any;
|
|
156
|
+
readonly ln_create_invoice: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
157
|
+
readonly get_balance: (a: number, b: number) => any;
|
|
158
|
+
readonly get_txs: (a: number, b: number) => any;
|
|
159
|
+
readonly pay_invoice: (a: number, b: number, c: number, d: number) => any;
|
|
160
|
+
readonly check_payment: (a: number, b: number) => any;
|
|
161
|
+
readonly swap_btc_ln: (a: number, b: number, c: number, d: number) => any;
|
|
162
|
+
readonly swap_ln_btc: (a: number, b: number, c: bigint, d: number, e: number) => any;
|
|
163
|
+
readonly get_network: () => any;
|
|
164
|
+
readonly switch_network: (a: number, b: number) => any;
|
|
165
|
+
readonly get_env: (a: number, b: number) => any;
|
|
166
|
+
readonly set_env: (a: number, b: number, c: number, d: number) => any;
|
|
167
|
+
readonly sleep: (a: number) => any;
|
|
168
|
+
readonly fund_rgb_vault: (a: number, b: number, c: number, d: any, e: number, f: number, g: bigint, h: number) => any;
|
|
169
|
+
readonly transfer_sats: (a: number, b: number, c: number, d: number, e: bigint, f: number, g: any) => any;
|
|
170
|
+
readonly get_btc_wallet: (a: number, b: number) => any;
|
|
171
|
+
readonly backup_btc_data: (a: number, b: number) => any;
|
|
172
|
+
readonly recover_funds_from_bad_wallets: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
|
|
173
|
+
readonly restore_btc_data: (a: number, b: number) => any;
|
|
174
|
+
readonly convert_contract_amount_raw: (a: number, b: number, c: number) => [number, number];
|
|
175
|
+
readonly convert_contract_amount_string: (a: bigint, b: number) => [number, number];
|
|
176
|
+
readonly parse_contract_amount: (a: number, b: number) => any;
|
|
177
|
+
readonly parse_contract_amount_precision: (a: number, b: number, c: number) => [number, number];
|
|
178
|
+
readonly version: () => 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 create_watcher: (a: number, b: number, c: any) => any;
|
|
197
|
+
readonly recover_watcher: (a: number, b: number, c: any) => any;
|
|
198
|
+
readonly destroy_watcher: (a: number, b: number) => any;
|
|
199
|
+
readonly destroy_recover_watcher: (a: number, b: number) => any;
|
|
200
|
+
readonly check_watcher: (a: number, b: number) => any;
|
|
201
|
+
readonly watcher_next_address: (a: number, b: number, c: number, d: number) => any;
|
|
202
|
+
readonly watcher_next_utxo: (a: number, b: number, c: number, d: number) => any;
|
|
203
|
+
readonly watcher_unspent_utxos: (a: number, b: number, c: number, d: number) => any;
|
|
204
204
|
readonly new_nostr_pubkey: (a: number, b: number, c: number, d: number) => any;
|
|
205
205
|
readonly update_nostr_pubkey: (a: number, b: number, c: number, d: number) => any;
|
|
206
206
|
readonly rustsecp256k1_v0_9_2_context_create: (a: number) => number;
|
|
@@ -228,12 +228,12 @@ export interface InitOutput {
|
|
|
228
228
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
229
229
|
readonly __wbindgen_export_7: WebAssembly.Table;
|
|
230
230
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
231
|
-
readonly
|
|
232
|
-
readonly
|
|
233
|
-
readonly
|
|
231
|
+
readonly closure1291_externref_shim: (a: number, b: number, c: any) => void;
|
|
232
|
+
readonly closure2752_externref_shim: (a: number, b: number, c: any) => void;
|
|
233
|
+
readonly closure2783_externref_shim: (a: number, b: number, c: any) => void;
|
|
234
234
|
readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h7ceba1bc0c075797: (a: number, b: number) => void;
|
|
235
|
-
readonly
|
|
236
|
-
readonly
|
|
235
|
+
readonly closure3963_externref_shim: (a: number, b: number, c: any) => void;
|
|
236
|
+
readonly closure4255_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
237
237
|
readonly __wbindgen_start: () => void;
|
|
238
238
|
}
|
|
239
239
|
|