@bitgo/wasm-utxo 4.8.1 → 4.10.0
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/dist/cjs/js/coinName.d.ts +1 -1
- package/dist/cjs/js/coinName.js +4 -0
- package/dist/cjs/js/index.d.ts +10 -0
- package/dist/cjs/js/utxolibCompat.d.ts +1 -1
- package/dist/cjs/js/wasm/wasm_utxo.js +52 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +27 -26
- package/dist/esm/js/coinName.d.ts +1 -1
- package/dist/esm/js/coinName.js +4 -0
- package/dist/esm/js/index.d.ts +10 -0
- package/dist/esm/js/utxolibCompat.d.ts +1 -1
- package/dist/esm/js/wasm/wasm_utxo_bg.js +52 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +27 -26
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const coinNames: readonly ["btc", "tbtc", "tbtc4", "tbtcsig", "tbtcbgsig", "bch", "tbch", "bcha", "tbcha", "btg", "tbtg", "bsv", "tbsv", "dash", "tdash", "doge", "tdoge", "ltc", "tltc", "zec", "tzec"];
|
|
1
|
+
export declare const coinNames: readonly ["btc", "tbtc", "tbtc4", "tbtcsig", "tbtcbgsig", "tbtcreg", "bch", "tbch", "bcha", "tbcha", "btg", "tbtg", "bsv", "tbsv", "dash", "tdash", "doge", "tdoge", "ltc", "tltc", "zec", "tzec"];
|
|
2
2
|
export type CoinName = (typeof coinNames)[number];
|
|
3
3
|
export declare function getMainnet(name: CoinName): CoinName;
|
|
4
4
|
export declare function isMainnet(name: CoinName): boolean;
|
package/dist/cjs/js/coinName.js
CHANGED
|
@@ -13,6 +13,7 @@ exports.coinNames = [
|
|
|
13
13
|
"tbtc4",
|
|
14
14
|
"tbtcsig",
|
|
15
15
|
"tbtcbgsig",
|
|
16
|
+
"tbtcreg",
|
|
16
17
|
"bch",
|
|
17
18
|
"tbch",
|
|
18
19
|
"bcha",
|
|
@@ -36,6 +37,7 @@ function getMainnet(name) {
|
|
|
36
37
|
case "tbtc4":
|
|
37
38
|
case "tbtcsig":
|
|
38
39
|
case "tbtcbgsig":
|
|
40
|
+
case "tbtcreg":
|
|
39
41
|
return "btc";
|
|
40
42
|
case "tbch":
|
|
41
43
|
return "bch";
|
|
@@ -79,6 +81,8 @@ function toCoinName(name) {
|
|
|
79
81
|
return "tbtcsig";
|
|
80
82
|
case "bitcoinBitGoSignet":
|
|
81
83
|
return "tbtcbgsig";
|
|
84
|
+
case "bitcoinRegtest":
|
|
85
|
+
return "tbtcreg";
|
|
82
86
|
case "bitcoincash":
|
|
83
87
|
return "bch";
|
|
84
88
|
case "bitcoincashTestnet":
|
package/dist/cjs/js/index.d.ts
CHANGED
|
@@ -22,6 +22,15 @@ export type { AddressFormat } from "./address.js";
|
|
|
22
22
|
export type { TapLeafScript, PreparedInscriptionRevealData } from "./inscriptions.js";
|
|
23
23
|
export type DescriptorPkType = "derivable" | "definite" | "string";
|
|
24
24
|
export type ScriptContext = "tap" | "segwitv0" | "legacy";
|
|
25
|
+
export interface ExtParamsConfig {
|
|
26
|
+
drop?: boolean;
|
|
27
|
+
topUnsafe?: boolean;
|
|
28
|
+
resourceLimitations?: boolean;
|
|
29
|
+
timelockMixing?: boolean;
|
|
30
|
+
malleability?: boolean;
|
|
31
|
+
repeatedPk?: boolean;
|
|
32
|
+
rawPkh?: boolean;
|
|
33
|
+
}
|
|
25
34
|
declare module "./wasm/wasm_utxo.js" {
|
|
26
35
|
interface WrapDescriptor {
|
|
27
36
|
/** These are not the same types of nodes as in the ast module */
|
|
@@ -30,6 +39,7 @@ declare module "./wasm/wasm_utxo.js" {
|
|
|
30
39
|
namespace WrapDescriptor {
|
|
31
40
|
function fromString(descriptor: string, pkType: DescriptorPkType): WrapDescriptor;
|
|
32
41
|
function fromStringDetectType(descriptor: string): WrapDescriptor;
|
|
42
|
+
function fromStringExt(descriptor: string, pkType: "definite", extParams: ExtParamsConfig): WrapDescriptor;
|
|
33
43
|
}
|
|
34
44
|
interface WrapMiniscript {
|
|
35
45
|
/** These are not the same types of nodes as in the ast module */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AddressFormat } from "./address.js";
|
|
2
|
-
export type UtxolibName = "bitcoin" | "testnet" | "bitcoinTestnet4" | "bitcoinPublicSignet" | "bitcoinBitGoSignet" | "bitcoincash" | "bitcoincashTestnet" | "ecash" | "ecashTest" | "bitcoingold" | "bitcoingoldTestnet" | "bitcoinsv" | "bitcoinsvTestnet" | "dash" | "dashTest" | "dogecoin" | "dogecoinTest" | "litecoin" | "litecoinTest" | "zcash" | "zcashTest";
|
|
2
|
+
export type UtxolibName = "bitcoin" | "testnet" | "bitcoinTestnet4" | "bitcoinPublicSignet" | "bitcoinBitGoSignet" | "bitcoinRegtest" | "bitcoincash" | "bitcoincashTestnet" | "ecash" | "ecashTest" | "bitcoingold" | "bitcoingoldTestnet" | "bitcoinsv" | "bitcoinsvTestnet" | "dash" | "dashTest" | "dogecoin" | "dogecoinTest" | "litecoin" | "litecoinTest" | "zcash" | "zcashTest";
|
|
3
3
|
export type UtxolibNetwork = {
|
|
4
4
|
pubKeyHash: number;
|
|
5
5
|
scriptHash: number;
|
|
@@ -4872,6 +4872,53 @@ class WrapDescriptor {
|
|
|
4872
4872
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4873
4873
|
}
|
|
4874
4874
|
}
|
|
4875
|
+
/**
|
|
4876
|
+
* Parse a descriptor string with custom ExtParams for taproot leaf validation.
|
|
4877
|
+
*
|
|
4878
|
+
* This allows control over which miniscript analysis checks are applied to
|
|
4879
|
+
* taproot leaves. The `drop` flag is always enabled; other flags default to false.
|
|
4880
|
+
*
|
|
4881
|
+
* # Arguments
|
|
4882
|
+
* * `descriptor` - A string containing the descriptor to parse
|
|
4883
|
+
* * `pk_type` - The type of public key ("definite" only for now)
|
|
4884
|
+
* * `ext_params_config` - JavaScript object with optional boolean flags:
|
|
4885
|
+
* - `drop`: Allow drop operations (r: wrapper) — always enabled
|
|
4886
|
+
* - `topUnsafe`: Allow scripts without signatures on all paths
|
|
4887
|
+
* - `resourceLimitations`: Allow scripts exceeding resource limits
|
|
4888
|
+
* - `timelockMixing`: Allow CSV + CLTV mixing
|
|
4889
|
+
* - `malleability`: Allow malleable scripts
|
|
4890
|
+
* - `repeatedPk`: Allow repeated public keys
|
|
4891
|
+
* - `rawPkh`: Allow raw pubkey hash fragments
|
|
4892
|
+
*
|
|
4893
|
+
* # Example
|
|
4894
|
+
* ```javascript
|
|
4895
|
+
* // r:older() is always allowed; add extra flags as needed
|
|
4896
|
+
* Descriptor.fromStringExt(desc, "definite", { malleability: true })
|
|
4897
|
+
* ```
|
|
4898
|
+
* @param {string} descriptor
|
|
4899
|
+
* @param {string} pk_type
|
|
4900
|
+
* @param {any} ext_params_config
|
|
4901
|
+
* @returns {WrapDescriptor}
|
|
4902
|
+
*/
|
|
4903
|
+
static fromStringExt(descriptor, pk_type, ext_params_config) {
|
|
4904
|
+
try {
|
|
4905
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4906
|
+
const ptr0 = passStringToWasm0(descriptor, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
4907
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4908
|
+
const ptr1 = passStringToWasm0(pk_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
4909
|
+
const len1 = WASM_VECTOR_LEN;
|
|
4910
|
+
wasm.wrapdescriptor_fromStringExt(retptr, ptr0, len0, ptr1, len1, addHeapObject(ext_params_config));
|
|
4911
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4912
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4913
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4914
|
+
if (r2) {
|
|
4915
|
+
throw takeObject(r1);
|
|
4916
|
+
}
|
|
4917
|
+
return WrapDescriptor.__wrap(r0);
|
|
4918
|
+
} finally {
|
|
4919
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4920
|
+
}
|
|
4921
|
+
}
|
|
4875
4922
|
/**
|
|
4876
4923
|
* @returns {boolean}
|
|
4877
4924
|
*/
|
|
@@ -6128,6 +6175,11 @@ function __wbg_get_imports() {
|
|
|
6128
6175
|
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
6129
6176
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
6130
6177
|
},
|
|
6178
|
+
__wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {
|
|
6179
|
+
const v = getObject(arg0);
|
|
6180
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
6181
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
6182
|
+
},
|
|
6131
6183
|
__wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
|
|
6132
6184
|
const ret = debugString(getObject(arg1));
|
|
6133
6185
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
Binary file
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
|
|
5
|
+
export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
|
|
4
6
|
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
5
7
|
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
6
8
|
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
@@ -8,6 +10,7 @@ export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
|
8
10
|
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
9
11
|
export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
10
12
|
export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
|
|
13
|
+
export const wrapdescriptor_fromStringExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
11
14
|
export const wrapdescriptor_hasWildcard: (a: number) => number;
|
|
12
15
|
export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
|
|
13
16
|
export const wrapdescriptor_node: (a: number, b: number) => void;
|
|
@@ -20,6 +23,29 @@ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: num
|
|
|
20
23
|
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
21
24
|
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
22
25
|
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
26
|
+
export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
|
|
27
|
+
export const __wbg_messagenamespace_free: (a: number, b: number) => void;
|
|
28
|
+
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
29
|
+
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
30
|
+
export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
31
|
+
export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
|
|
32
|
+
export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
|
|
33
|
+
export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
34
|
+
export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
|
|
35
|
+
export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
|
|
36
|
+
export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
|
|
37
|
+
export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
|
|
38
|
+
export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
|
|
39
|
+
export const wasmecpair_private_key: (a: number) => number;
|
|
40
|
+
export const wasmecpair_public_key: (a: number) => number;
|
|
41
|
+
export const wasmecpair_to_wif: (a: number, b: number) => void;
|
|
42
|
+
export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
|
|
43
|
+
export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
|
|
44
|
+
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
45
|
+
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
46
|
+
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
47
|
+
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
48
|
+
export const wasmrootwalletkeys_with_derivation_prefixes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
23
49
|
export const __wbg_bip322namespace_free: (a: number, b: number) => void;
|
|
24
50
|
export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
|
|
25
51
|
export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
|
|
@@ -140,40 +166,15 @@ export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
|
140
166
|
export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
|
|
141
167
|
export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
|
|
142
168
|
export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
|
|
143
|
-
export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
|
|
144
|
-
export const __wbg_messagenamespace_free: (a: number, b: number) => void;
|
|
145
|
-
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
146
|
-
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
147
|
-
export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
148
|
-
export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
|
|
149
|
-
export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
|
|
150
|
-
export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
151
|
-
export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
|
|
152
|
-
export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
|
|
153
|
-
export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
|
|
154
|
-
export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
|
|
155
|
-
export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
|
|
156
|
-
export const wasmecpair_private_key: (a: number) => number;
|
|
157
|
-
export const wasmecpair_public_key: (a: number) => number;
|
|
158
|
-
export const wasmecpair_to_wif: (a: number, b: number) => void;
|
|
159
|
-
export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
|
|
160
|
-
export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
|
|
161
|
-
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
162
|
-
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
163
|
-
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
164
|
-
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
165
|
-
export const wasmrootwalletkeys_with_derivation_prefixes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
166
169
|
export const __wbg_addressnamespace_free: (a: number, b: number) => void;
|
|
167
170
|
export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
168
171
|
export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
|
|
169
172
|
export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
|
|
170
173
|
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
171
|
-
export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
|
|
172
174
|
export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
|
|
173
175
|
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
|
174
176
|
export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
175
177
|
export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
176
|
-
export const isInspectEnabled: () => number;
|
|
177
178
|
export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
178
179
|
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
179
180
|
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
@@ -214,7 +215,6 @@ export const wasmtransaction_get_outputs_with_address: (a: number, b: number, c:
|
|
|
214
215
|
export const wasmtransaction_get_txid: (a: number, b: number) => void;
|
|
215
216
|
export const wasmtransaction_get_vsize: (a: number) => number;
|
|
216
217
|
export const wasmtransaction_to_bytes: (a: number, b: number) => void;
|
|
217
|
-
export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
|
|
218
218
|
export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
219
219
|
export const wasmzcashtransaction_get_inputs: (a: number, b: number) => void;
|
|
220
220
|
export const wasmzcashtransaction_get_outputs: (a: number, b: number) => void;
|
|
@@ -264,6 +264,7 @@ export const wasmtransaction_input_count: (a: number) => number;
|
|
|
264
264
|
export const wasmtransaction_output_count: (a: number) => number;
|
|
265
265
|
export const wasmzcashtransaction_input_count: (a: number) => number;
|
|
266
266
|
export const wasmzcashtransaction_output_count: (a: number) => number;
|
|
267
|
+
export const isInspectEnabled: () => number;
|
|
267
268
|
export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
268
269
|
export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
269
270
|
export const wasmtransaction_lock_time: (a: number) => number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const coinNames: readonly ["btc", "tbtc", "tbtc4", "tbtcsig", "tbtcbgsig", "bch", "tbch", "bcha", "tbcha", "btg", "tbtg", "bsv", "tbsv", "dash", "tdash", "doge", "tdoge", "ltc", "tltc", "zec", "tzec"];
|
|
1
|
+
export declare const coinNames: readonly ["btc", "tbtc", "tbtc4", "tbtcsig", "tbtcbgsig", "tbtcreg", "bch", "tbch", "bcha", "tbcha", "btg", "tbtg", "bsv", "tbsv", "dash", "tdash", "doge", "tdoge", "ltc", "tltc", "zec", "tzec"];
|
|
2
2
|
export type CoinName = (typeof coinNames)[number];
|
|
3
3
|
export declare function getMainnet(name: CoinName): CoinName;
|
|
4
4
|
export declare function isMainnet(name: CoinName): boolean;
|
package/dist/esm/js/coinName.js
CHANGED
|
@@ -5,6 +5,7 @@ export const coinNames = [
|
|
|
5
5
|
"tbtc4",
|
|
6
6
|
"tbtcsig",
|
|
7
7
|
"tbtcbgsig",
|
|
8
|
+
"tbtcreg",
|
|
8
9
|
"bch",
|
|
9
10
|
"tbch",
|
|
10
11
|
"bcha",
|
|
@@ -28,6 +29,7 @@ export function getMainnet(name) {
|
|
|
28
29
|
case "tbtc4":
|
|
29
30
|
case "tbtcsig":
|
|
30
31
|
case "tbtcbgsig":
|
|
32
|
+
case "tbtcreg":
|
|
31
33
|
return "btc";
|
|
32
34
|
case "tbch":
|
|
33
35
|
return "bch";
|
|
@@ -71,6 +73,8 @@ export function toCoinName(name) {
|
|
|
71
73
|
return "tbtcsig";
|
|
72
74
|
case "bitcoinBitGoSignet":
|
|
73
75
|
return "tbtcbgsig";
|
|
76
|
+
case "bitcoinRegtest":
|
|
77
|
+
return "tbtcreg";
|
|
74
78
|
case "bitcoincash":
|
|
75
79
|
return "bch";
|
|
76
80
|
case "bitcoincashTestnet":
|
package/dist/esm/js/index.d.ts
CHANGED
|
@@ -22,6 +22,15 @@ export type { AddressFormat } from "./address.js";
|
|
|
22
22
|
export type { TapLeafScript, PreparedInscriptionRevealData } from "./inscriptions.js";
|
|
23
23
|
export type DescriptorPkType = "derivable" | "definite" | "string";
|
|
24
24
|
export type ScriptContext = "tap" | "segwitv0" | "legacy";
|
|
25
|
+
export interface ExtParamsConfig {
|
|
26
|
+
drop?: boolean;
|
|
27
|
+
topUnsafe?: boolean;
|
|
28
|
+
resourceLimitations?: boolean;
|
|
29
|
+
timelockMixing?: boolean;
|
|
30
|
+
malleability?: boolean;
|
|
31
|
+
repeatedPk?: boolean;
|
|
32
|
+
rawPkh?: boolean;
|
|
33
|
+
}
|
|
25
34
|
declare module "./wasm/wasm_utxo.js" {
|
|
26
35
|
interface WrapDescriptor {
|
|
27
36
|
/** These are not the same types of nodes as in the ast module */
|
|
@@ -30,6 +39,7 @@ declare module "./wasm/wasm_utxo.js" {
|
|
|
30
39
|
namespace WrapDescriptor {
|
|
31
40
|
function fromString(descriptor: string, pkType: DescriptorPkType): WrapDescriptor;
|
|
32
41
|
function fromStringDetectType(descriptor: string): WrapDescriptor;
|
|
42
|
+
function fromStringExt(descriptor: string, pkType: "definite", extParams: ExtParamsConfig): WrapDescriptor;
|
|
33
43
|
}
|
|
34
44
|
interface WrapMiniscript {
|
|
35
45
|
/** These are not the same types of nodes as in the ast module */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AddressFormat } from "./address.js";
|
|
2
|
-
export type UtxolibName = "bitcoin" | "testnet" | "bitcoinTestnet4" | "bitcoinPublicSignet" | "bitcoinBitGoSignet" | "bitcoincash" | "bitcoincashTestnet" | "ecash" | "ecashTest" | "bitcoingold" | "bitcoingoldTestnet" | "bitcoinsv" | "bitcoinsvTestnet" | "dash" | "dashTest" | "dogecoin" | "dogecoinTest" | "litecoin" | "litecoinTest" | "zcash" | "zcashTest";
|
|
2
|
+
export type UtxolibName = "bitcoin" | "testnet" | "bitcoinTestnet4" | "bitcoinPublicSignet" | "bitcoinBitGoSignet" | "bitcoinRegtest" | "bitcoincash" | "bitcoincashTestnet" | "ecash" | "ecashTest" | "bitcoingold" | "bitcoingoldTestnet" | "bitcoinsv" | "bitcoinsvTestnet" | "dash" | "dashTest" | "dogecoin" | "dogecoinTest" | "litecoin" | "litecoinTest" | "zcash" | "zcashTest";
|
|
3
3
|
export type UtxolibNetwork = {
|
|
4
4
|
pubKeyHash: number;
|
|
5
5
|
scriptHash: number;
|
|
@@ -4854,6 +4854,53 @@ export class WrapDescriptor {
|
|
|
4854
4854
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4855
4855
|
}
|
|
4856
4856
|
}
|
|
4857
|
+
/**
|
|
4858
|
+
* Parse a descriptor string with custom ExtParams for taproot leaf validation.
|
|
4859
|
+
*
|
|
4860
|
+
* This allows control over which miniscript analysis checks are applied to
|
|
4861
|
+
* taproot leaves. The `drop` flag is always enabled; other flags default to false.
|
|
4862
|
+
*
|
|
4863
|
+
* # Arguments
|
|
4864
|
+
* * `descriptor` - A string containing the descriptor to parse
|
|
4865
|
+
* * `pk_type` - The type of public key ("definite" only for now)
|
|
4866
|
+
* * `ext_params_config` - JavaScript object with optional boolean flags:
|
|
4867
|
+
* - `drop`: Allow drop operations (r: wrapper) — always enabled
|
|
4868
|
+
* - `topUnsafe`: Allow scripts without signatures on all paths
|
|
4869
|
+
* - `resourceLimitations`: Allow scripts exceeding resource limits
|
|
4870
|
+
* - `timelockMixing`: Allow CSV + CLTV mixing
|
|
4871
|
+
* - `malleability`: Allow malleable scripts
|
|
4872
|
+
* - `repeatedPk`: Allow repeated public keys
|
|
4873
|
+
* - `rawPkh`: Allow raw pubkey hash fragments
|
|
4874
|
+
*
|
|
4875
|
+
* # Example
|
|
4876
|
+
* ```javascript
|
|
4877
|
+
* // r:older() is always allowed; add extra flags as needed
|
|
4878
|
+
* Descriptor.fromStringExt(desc, "definite", { malleability: true })
|
|
4879
|
+
* ```
|
|
4880
|
+
* @param {string} descriptor
|
|
4881
|
+
* @param {string} pk_type
|
|
4882
|
+
* @param {any} ext_params_config
|
|
4883
|
+
* @returns {WrapDescriptor}
|
|
4884
|
+
*/
|
|
4885
|
+
static fromStringExt(descriptor, pk_type, ext_params_config) {
|
|
4886
|
+
try {
|
|
4887
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4888
|
+
const ptr0 = passStringToWasm0(descriptor, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
4889
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4890
|
+
const ptr1 = passStringToWasm0(pk_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
4891
|
+
const len1 = WASM_VECTOR_LEN;
|
|
4892
|
+
wasm.wrapdescriptor_fromStringExt(retptr, ptr0, len0, ptr1, len1, addHeapObject(ext_params_config));
|
|
4893
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4894
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4895
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4896
|
+
if (r2) {
|
|
4897
|
+
throw takeObject(r1);
|
|
4898
|
+
}
|
|
4899
|
+
return WrapDescriptor.__wrap(r0);
|
|
4900
|
+
} finally {
|
|
4901
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4902
|
+
}
|
|
4903
|
+
}
|
|
4857
4904
|
/**
|
|
4858
4905
|
* @returns {boolean}
|
|
4859
4906
|
*/
|
|
@@ -6099,6 +6146,11 @@ export function __wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2(arg0, arg1)
|
|
|
6099
6146
|
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
6100
6147
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
6101
6148
|
}
|
|
6149
|
+
export function __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25(arg0) {
|
|
6150
|
+
const v = getObject(arg0);
|
|
6151
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
6152
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
6153
|
+
}
|
|
6102
6154
|
export function __wbg___wbindgen_debug_string_0bc8482c6e3508ae(arg0, arg1) {
|
|
6103
6155
|
const ret = debugString(getObject(arg1));
|
|
6104
6156
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
Binary file
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
|
|
5
|
+
export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
|
|
4
6
|
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
5
7
|
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
6
8
|
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
@@ -8,6 +10,7 @@ export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
|
8
10
|
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
9
11
|
export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
10
12
|
export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
|
|
13
|
+
export const wrapdescriptor_fromStringExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
11
14
|
export const wrapdescriptor_hasWildcard: (a: number) => number;
|
|
12
15
|
export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
|
|
13
16
|
export const wrapdescriptor_node: (a: number, b: number) => void;
|
|
@@ -20,6 +23,29 @@ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: num
|
|
|
20
23
|
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
21
24
|
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
22
25
|
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
26
|
+
export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
|
|
27
|
+
export const __wbg_messagenamespace_free: (a: number, b: number) => void;
|
|
28
|
+
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
29
|
+
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
30
|
+
export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
31
|
+
export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
|
|
32
|
+
export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
|
|
33
|
+
export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
34
|
+
export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
|
|
35
|
+
export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
|
|
36
|
+
export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
|
|
37
|
+
export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
|
|
38
|
+
export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
|
|
39
|
+
export const wasmecpair_private_key: (a: number) => number;
|
|
40
|
+
export const wasmecpair_public_key: (a: number) => number;
|
|
41
|
+
export const wasmecpair_to_wif: (a: number, b: number) => void;
|
|
42
|
+
export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
|
|
43
|
+
export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
|
|
44
|
+
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
45
|
+
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
46
|
+
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
47
|
+
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
48
|
+
export const wasmrootwalletkeys_with_derivation_prefixes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
23
49
|
export const __wbg_bip322namespace_free: (a: number, b: number) => void;
|
|
24
50
|
export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
|
|
25
51
|
export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
|
|
@@ -140,40 +166,15 @@ export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
|
140
166
|
export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
|
|
141
167
|
export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
|
|
142
168
|
export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
|
|
143
|
-
export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
|
|
144
|
-
export const __wbg_messagenamespace_free: (a: number, b: number) => void;
|
|
145
|
-
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
146
|
-
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
147
|
-
export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
148
|
-
export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
|
|
149
|
-
export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
|
|
150
|
-
export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
151
|
-
export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
|
|
152
|
-
export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
|
|
153
|
-
export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
|
|
154
|
-
export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
|
|
155
|
-
export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
|
|
156
|
-
export const wasmecpair_private_key: (a: number) => number;
|
|
157
|
-
export const wasmecpair_public_key: (a: number) => number;
|
|
158
|
-
export const wasmecpair_to_wif: (a: number, b: number) => void;
|
|
159
|
-
export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
|
|
160
|
-
export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
|
|
161
|
-
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
162
|
-
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
163
|
-
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
164
|
-
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
165
|
-
export const wasmrootwalletkeys_with_derivation_prefixes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
166
169
|
export const __wbg_addressnamespace_free: (a: number, b: number) => void;
|
|
167
170
|
export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
168
171
|
export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
|
|
169
172
|
export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
|
|
170
173
|
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
171
|
-
export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
|
|
172
174
|
export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
|
|
173
175
|
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
|
174
176
|
export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
175
177
|
export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
176
|
-
export const isInspectEnabled: () => number;
|
|
177
178
|
export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
178
179
|
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
179
180
|
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
@@ -214,7 +215,6 @@ export const wasmtransaction_get_outputs_with_address: (a: number, b: number, c:
|
|
|
214
215
|
export const wasmtransaction_get_txid: (a: number, b: number) => void;
|
|
215
216
|
export const wasmtransaction_get_vsize: (a: number) => number;
|
|
216
217
|
export const wasmtransaction_to_bytes: (a: number, b: number) => void;
|
|
217
|
-
export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
|
|
218
218
|
export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
219
219
|
export const wasmzcashtransaction_get_inputs: (a: number, b: number) => void;
|
|
220
220
|
export const wasmzcashtransaction_get_outputs: (a: number, b: number) => void;
|
|
@@ -264,6 +264,7 @@ export const wasmtransaction_input_count: (a: number) => number;
|
|
|
264
264
|
export const wasmtransaction_output_count: (a: number) => number;
|
|
265
265
|
export const wasmzcashtransaction_input_count: (a: number) => number;
|
|
266
266
|
export const wasmzcashtransaction_output_count: (a: number) => number;
|
|
267
|
+
export const isInspectEnabled: () => number;
|
|
267
268
|
export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
268
269
|
export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
269
270
|
export const wasmtransaction_lock_time: (a: number) => number;
|