@bitgo/wasm-utxo 1.25.0 → 1.26.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/fixedScriptWallet/Dimensions.d.ts +12 -1
- package/dist/cjs/js/fixedScriptWallet/Dimensions.js +5 -3
- package/dist/cjs/js/fixedScriptWallet/address.d.ts +10 -3
- package/dist/cjs/js/fixedScriptWallet/address.js +17 -3
- package/dist/cjs/js/wasm/wasm_utxo.d.ts +6 -2
- package/dist/cjs/js/wasm/wasm_utxo.js +73 -4
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +53 -51
- package/dist/esm/js/fixedScriptWallet/Dimensions.d.ts +12 -1
- package/dist/esm/js/fixedScriptWallet/Dimensions.js +5 -3
- package/dist/esm/js/fixedScriptWallet/address.d.ts +10 -3
- package/dist/esm/js/fixedScriptWallet/address.js +17 -3
- package/dist/esm/js/wasm/wasm_utxo.d.ts +6 -2
- package/dist/esm/js/wasm/wasm_utxo_bg.js +73 -4
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +53 -51
- package/package.json +2 -1
|
@@ -7,6 +7,16 @@ type FromInputParams = {
|
|
|
7
7
|
} | {
|
|
8
8
|
scriptType: InputScriptType;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Options for input dimension calculation
|
|
12
|
+
*/
|
|
13
|
+
export type FromInputOptions = {
|
|
14
|
+
/**
|
|
15
|
+
* When true, use @bitgo/unspents-compatible signature sizes (72 bytes)
|
|
16
|
+
* for the "max" calculation instead of true maximum (73 bytes).
|
|
17
|
+
*/
|
|
18
|
+
utxolibCompat?: boolean;
|
|
19
|
+
};
|
|
10
20
|
/**
|
|
11
21
|
* Dimensions class for estimating transaction virtual size.
|
|
12
22
|
*
|
|
@@ -34,8 +44,9 @@ export declare class Dimensions {
|
|
|
34
44
|
* Create dimensions for a single input
|
|
35
45
|
*
|
|
36
46
|
* @param params - Either `{ chain, signPath? }` or `{ scriptType }`
|
|
47
|
+
* @param options - Optional settings like `{ utxolibCompat: true }` for @bitgo/unspents-compatible sizing
|
|
37
48
|
*/
|
|
38
|
-
static fromInput(params: FromInputParams): Dimensions;
|
|
49
|
+
static fromInput(params: FromInputParams, options?: FromInputOptions): Dimensions;
|
|
39
50
|
/**
|
|
40
51
|
* Create dimensions for a single output from script bytes
|
|
41
52
|
*/
|
|
@@ -36,12 +36,14 @@ class Dimensions {
|
|
|
36
36
|
* Create dimensions for a single input
|
|
37
37
|
*
|
|
38
38
|
* @param params - Either `{ chain, signPath? }` or `{ scriptType }`
|
|
39
|
+
* @param options - Optional settings like `{ utxolibCompat: true }` for @bitgo/unspents-compatible sizing
|
|
39
40
|
*/
|
|
40
|
-
static fromInput(params) {
|
|
41
|
+
static fromInput(params, options) {
|
|
42
|
+
const compat = options?.utxolibCompat;
|
|
41
43
|
if ("scriptType" in params) {
|
|
42
|
-
return new Dimensions(wasm_utxo_js_1.WasmDimensions.from_input_script_type(params.scriptType));
|
|
44
|
+
return new Dimensions(wasm_utxo_js_1.WasmDimensions.from_input_script_type(params.scriptType, compat));
|
|
43
45
|
}
|
|
44
|
-
return new Dimensions(wasm_utxo_js_1.WasmDimensions.from_input(params.chain, params.signPath?.signer, params.signPath?.cosigner));
|
|
46
|
+
return new Dimensions(wasm_utxo_js_1.WasmDimensions.from_input(params.chain, params.signPath?.signer, params.signPath?.cosigner, compat));
|
|
45
47
|
}
|
|
46
48
|
static fromOutput(params, network) {
|
|
47
49
|
if (typeof params === "string") {
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import { type WalletKeysArg } from "./RootWalletKeys.js";
|
|
2
2
|
import type { UtxolibNetwork } from "../utxolibCompat.js";
|
|
3
|
+
import type { UtxolibName } from "../utxolibCompat.js";
|
|
4
|
+
import type { CoinName } from "../coinName.js";
|
|
3
5
|
import { AddressFormat } from "../address.js";
|
|
6
|
+
export type NetworkName = UtxolibName | CoinName;
|
|
4
7
|
/**
|
|
5
8
|
* Create the output script for a given wallet keys and chain and index
|
|
9
|
+
* @param keys - The wallet keys to use
|
|
10
|
+
* @param chain - The chain to use
|
|
11
|
+
* @param index - The index to use
|
|
12
|
+
* @param network - The network to use. Can be a network name string (e.g., "btc", "bitcoin", "testnet") or a UtxolibNetwork object
|
|
6
13
|
*/
|
|
7
|
-
export declare function outputScript(keys: WalletKeysArg, chain: number, index: number, network: UtxolibNetwork): Uint8Array;
|
|
14
|
+
export declare function outputScript(keys: WalletKeysArg, chain: number, index: number, network: NetworkName | UtxolibNetwork): Uint8Array;
|
|
8
15
|
/**
|
|
9
16
|
* Create the address for a given wallet keys and chain and index and network.
|
|
10
17
|
* Wrapper for outputScript that also encodes the script to an address.
|
|
11
18
|
* @param keys - The wallet keys to use.
|
|
12
19
|
* @param chain - The chain to use.
|
|
13
20
|
* @param index - The index to use.
|
|
14
|
-
* @param network - The network to use.
|
|
21
|
+
* @param network - The network to use. Can be a network name string (e.g., "btc", "bitcoin", "testnet") or a UtxolibNetwork object
|
|
15
22
|
* @param addressFormat - The address format to use.
|
|
16
23
|
* Only relevant for Bitcoin Cash and eCash networks, where:
|
|
17
24
|
* - "default" means base58check,
|
|
18
25
|
* - "cashaddr" means cashaddr.
|
|
19
26
|
*/
|
|
20
|
-
export declare function address(keys: WalletKeysArg, chain: number, index: number, network: UtxolibNetwork, addressFormat?: AddressFormat): string;
|
|
27
|
+
export declare function address(keys: WalletKeysArg, chain: number, index: number, network: NetworkName | UtxolibNetwork, addressFormat?: AddressFormat): string;
|
|
@@ -6,10 +6,19 @@ const wasm_utxo_js_1 = require("../wasm/wasm_utxo.js");
|
|
|
6
6
|
const RootWalletKeys_js_1 = require("./RootWalletKeys.js");
|
|
7
7
|
/**
|
|
8
8
|
* Create the output script for a given wallet keys and chain and index
|
|
9
|
+
* @param keys - The wallet keys to use
|
|
10
|
+
* @param chain - The chain to use
|
|
11
|
+
* @param index - The index to use
|
|
12
|
+
* @param network - The network to use. Can be a network name string (e.g., "btc", "bitcoin", "testnet") or a UtxolibNetwork object
|
|
9
13
|
*/
|
|
10
14
|
function outputScript(keys, chain, index, network) {
|
|
11
15
|
const walletKeys = RootWalletKeys_js_1.RootWalletKeys.from(keys);
|
|
12
|
-
|
|
16
|
+
if (typeof network === "string") {
|
|
17
|
+
return wasm_utxo_js_1.FixedScriptWalletNamespace.output_script_with_network_str(walletKeys.wasm, chain, index, network);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return wasm_utxo_js_1.FixedScriptWalletNamespace.output_script(walletKeys.wasm, chain, index, network);
|
|
21
|
+
}
|
|
13
22
|
}
|
|
14
23
|
/**
|
|
15
24
|
* Create the address for a given wallet keys and chain and index and network.
|
|
@@ -17,7 +26,7 @@ function outputScript(keys, chain, index, network) {
|
|
|
17
26
|
* @param keys - The wallet keys to use.
|
|
18
27
|
* @param chain - The chain to use.
|
|
19
28
|
* @param index - The index to use.
|
|
20
|
-
* @param network - The network to use.
|
|
29
|
+
* @param network - The network to use. Can be a network name string (e.g., "btc", "bitcoin", "testnet") or a UtxolibNetwork object
|
|
21
30
|
* @param addressFormat - The address format to use.
|
|
22
31
|
* Only relevant for Bitcoin Cash and eCash networks, where:
|
|
23
32
|
* - "default" means base58check,
|
|
@@ -25,5 +34,10 @@ function outputScript(keys, chain, index, network) {
|
|
|
25
34
|
*/
|
|
26
35
|
function address(keys, chain, index, network, addressFormat) {
|
|
27
36
|
const walletKeys = RootWalletKeys_js_1.RootWalletKeys.from(keys);
|
|
28
|
-
|
|
37
|
+
if (typeof network === "string") {
|
|
38
|
+
return wasm_utxo_js_1.FixedScriptWalletNamespace.address_with_network_str(walletKeys.wasm, chain, index, network, addressFormat);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
return wasm_utxo_js_1.FixedScriptWalletNamespace.address(walletKeys.wasm, chain, index, network, addressFormat);
|
|
42
|
+
}
|
|
29
43
|
}
|
|
@@ -504,6 +504,8 @@ export class FixedScriptWalletNamespace {
|
|
|
504
504
|
* - Dogecoin only supports legacy scripts (p2sh)
|
|
505
505
|
*/
|
|
506
506
|
static supports_script_type(coin: string, script_type: string): boolean;
|
|
507
|
+
static address_with_network_str(keys: WasmRootWalletKeys, chain: number, index: number, network: string, address_format?: string | null): string;
|
|
508
|
+
static output_script_with_network_str(keys: WasmRootWalletKeys, chain: number, index: number, network: string): Uint8Array;
|
|
507
509
|
static address(keys: WasmRootWalletKeys, chain: number, index: number, network: any, address_format?: string | null): string;
|
|
508
510
|
}
|
|
509
511
|
|
|
@@ -685,8 +687,9 @@ export class WasmDimensions {
|
|
|
685
687
|
* * `chain` - Chain code (0/1=p2sh, 10/11=p2shP2wsh, 20/21=p2wsh, 30/31=p2tr, 40/41=p2trMusig2)
|
|
686
688
|
* * `signer` - Optional signer key ("user", "backup", "bitgo")
|
|
687
689
|
* * `cosigner` - Optional cosigner key ("user", "backup", "bitgo")
|
|
690
|
+
* * `compat` - When true, use 72-byte signatures for max (matches @bitgo/unspents)
|
|
688
691
|
*/
|
|
689
|
-
static from_input(chain: number, signer?: string | null, cosigner?: string | null): WasmDimensions;
|
|
692
|
+
static from_input(chain: number, signer?: string | null, cosigner?: string | null, compat?: boolean | null): WasmDimensions;
|
|
690
693
|
/**
|
|
691
694
|
* Get total weight (min or max)
|
|
692
695
|
*
|
|
@@ -726,8 +729,9 @@ export class WasmDimensions {
|
|
|
726
729
|
* # Arguments
|
|
727
730
|
* * `script_type` - One of: "p2sh", "p2shP2wsh", "p2wsh", "p2trLegacy",
|
|
728
731
|
* "p2trMusig2KeyPath", "p2trMusig2ScriptPath", "p2shP2pk"
|
|
732
|
+
* * `compat` - When true, use 72-byte signatures for max (matches @bitgo/unspents)
|
|
729
733
|
*/
|
|
730
|
-
static from_input_script_type(script_type: string): WasmDimensions;
|
|
734
|
+
static from_input_script_type(script_type: string, compat?: boolean | null): WasmDimensions;
|
|
731
735
|
/**
|
|
732
736
|
* Create dimensions for a single output from script type string
|
|
733
737
|
*
|
|
@@ -1573,6 +1573,71 @@ class FixedScriptWalletNamespace {
|
|
|
1573
1573
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1574
1574
|
}
|
|
1575
1575
|
}
|
|
1576
|
+
/**
|
|
1577
|
+
* @param {WasmRootWalletKeys} keys
|
|
1578
|
+
* @param {number} chain
|
|
1579
|
+
* @param {number} index
|
|
1580
|
+
* @param {string} network
|
|
1581
|
+
* @param {string | null} [address_format]
|
|
1582
|
+
* @returns {string}
|
|
1583
|
+
*/
|
|
1584
|
+
static address_with_network_str(keys, chain, index, network, address_format) {
|
|
1585
|
+
let deferred4_0;
|
|
1586
|
+
let deferred4_1;
|
|
1587
|
+
try {
|
|
1588
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1589
|
+
_assertClass(keys, WasmRootWalletKeys);
|
|
1590
|
+
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1591
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1592
|
+
var ptr1 = isLikeNone(address_format) ? 0 : passStringToWasm0(address_format, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1593
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1594
|
+
wasm.fixedscriptwalletnamespace_address_with_network_str(retptr, keys.__wbg_ptr, chain, index, ptr0, len0, ptr1, len1);
|
|
1595
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1596
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1597
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1598
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1599
|
+
var ptr3 = r0;
|
|
1600
|
+
var len3 = r1;
|
|
1601
|
+
if (r3) {
|
|
1602
|
+
ptr3 = 0; len3 = 0;
|
|
1603
|
+
throw takeObject(r2);
|
|
1604
|
+
}
|
|
1605
|
+
deferred4_0 = ptr3;
|
|
1606
|
+
deferred4_1 = len3;
|
|
1607
|
+
return getStringFromWasm0(ptr3, len3);
|
|
1608
|
+
} finally {
|
|
1609
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1610
|
+
wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
/**
|
|
1614
|
+
* @param {WasmRootWalletKeys} keys
|
|
1615
|
+
* @param {number} chain
|
|
1616
|
+
* @param {number} index
|
|
1617
|
+
* @param {string} network
|
|
1618
|
+
* @returns {Uint8Array}
|
|
1619
|
+
*/
|
|
1620
|
+
static output_script_with_network_str(keys, chain, index, network) {
|
|
1621
|
+
try {
|
|
1622
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1623
|
+
_assertClass(keys, WasmRootWalletKeys);
|
|
1624
|
+
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1625
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1626
|
+
wasm.fixedscriptwalletnamespace_output_script_with_network_str(retptr, keys.__wbg_ptr, chain, index, ptr0, len0);
|
|
1627
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1628
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1629
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1630
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1631
|
+
if (r3) {
|
|
1632
|
+
throw takeObject(r2);
|
|
1633
|
+
}
|
|
1634
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
1635
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1636
|
+
return v2;
|
|
1637
|
+
} finally {
|
|
1638
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1576
1641
|
/**
|
|
1577
1642
|
* @param {WasmRootWalletKeys} keys
|
|
1578
1643
|
* @param {number} chain
|
|
@@ -2256,19 +2321,21 @@ class WasmDimensions {
|
|
|
2256
2321
|
* * `chain` - Chain code (0/1=p2sh, 10/11=p2shP2wsh, 20/21=p2wsh, 30/31=p2tr, 40/41=p2trMusig2)
|
|
2257
2322
|
* * `signer` - Optional signer key ("user", "backup", "bitgo")
|
|
2258
2323
|
* * `cosigner` - Optional cosigner key ("user", "backup", "bitgo")
|
|
2324
|
+
* * `compat` - When true, use 72-byte signatures for max (matches @bitgo/unspents)
|
|
2259
2325
|
* @param {number} chain
|
|
2260
2326
|
* @param {string | null} [signer]
|
|
2261
2327
|
* @param {string | null} [cosigner]
|
|
2328
|
+
* @param {boolean | null} [compat]
|
|
2262
2329
|
* @returns {WasmDimensions}
|
|
2263
2330
|
*/
|
|
2264
|
-
static from_input(chain, signer, cosigner) {
|
|
2331
|
+
static from_input(chain, signer, cosigner, compat) {
|
|
2265
2332
|
try {
|
|
2266
2333
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2267
2334
|
var ptr0 = isLikeNone(signer) ? 0 : passStringToWasm0(signer, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2268
2335
|
var len0 = WASM_VECTOR_LEN;
|
|
2269
2336
|
var ptr1 = isLikeNone(cosigner) ? 0 : passStringToWasm0(cosigner, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2270
2337
|
var len1 = WASM_VECTOR_LEN;
|
|
2271
|
-
wasm.wasmdimensions_from_input(retptr, chain, ptr0, len0, ptr1, len1);
|
|
2338
|
+
wasm.wasmdimensions_from_input(retptr, chain, ptr0, len0, ptr1, len1, isLikeNone(compat) ? 0xFFFFFF : compat ? 1 : 0);
|
|
2272
2339
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2273
2340
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2274
2341
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -2352,15 +2419,17 @@ class WasmDimensions {
|
|
|
2352
2419
|
* # Arguments
|
|
2353
2420
|
* * `script_type` - One of: "p2sh", "p2shP2wsh", "p2wsh", "p2trLegacy",
|
|
2354
2421
|
* "p2trMusig2KeyPath", "p2trMusig2ScriptPath", "p2shP2pk"
|
|
2422
|
+
* * `compat` - When true, use 72-byte signatures for max (matches @bitgo/unspents)
|
|
2355
2423
|
* @param {string} script_type
|
|
2424
|
+
* @param {boolean | null} [compat]
|
|
2356
2425
|
* @returns {WasmDimensions}
|
|
2357
2426
|
*/
|
|
2358
|
-
static from_input_script_type(script_type) {
|
|
2427
|
+
static from_input_script_type(script_type, compat) {
|
|
2359
2428
|
try {
|
|
2360
2429
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2361
2430
|
const ptr0 = passStringToWasm0(script_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2362
2431
|
const len0 = WASM_VECTOR_LEN;
|
|
2363
|
-
wasm.wasmdimensions_from_input_script_type(retptr, ptr0, len0);
|
|
2432
|
+
wasm.wasmdimensions_from_input_script_type(retptr, ptr0, len0, isLikeNone(compat) ? 0xFFFFFF : compat ? 1 : 0);
|
|
2364
2433
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2365
2434
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2366
2435
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
Binary file
|
|
@@ -1,53 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
|
|
5
|
-
export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
|
|
6
|
-
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
7
|
-
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
8
|
-
export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
|
|
9
|
-
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
10
|
-
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
11
|
-
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
|
12
|
-
export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
13
|
-
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;
|
|
14
|
-
export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
15
|
-
export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
|
|
16
|
-
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
17
|
-
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
18
|
-
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
19
|
-
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
20
|
-
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;
|
|
21
|
-
export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
22
|
-
export const wasmtransaction_get_vsize: (a: number) => number;
|
|
23
|
-
export const wasmtransaction_to_bytes: (a: number, b: number) => void;
|
|
24
|
-
export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
25
|
-
export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
|
|
26
|
-
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
27
|
-
export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
28
|
-
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
29
|
-
export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
30
|
-
export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
|
|
31
|
-
export const wrapdescriptor_hasWildcard: (a: number) => number;
|
|
32
|
-
export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
|
|
33
|
-
export const wrapdescriptor_node: (a: number, b: number) => void;
|
|
34
|
-
export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
|
|
35
|
-
export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
|
|
36
|
-
export const wrapdescriptor_toString: (a: number, b: number) => void;
|
|
37
|
-
export const wrapminiscript_encode: (a: number, b: number) => void;
|
|
38
|
-
export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
39
|
-
export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
40
|
-
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
41
|
-
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
42
|
-
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
43
|
-
export const wrappsbt_clone: (a: number) => number;
|
|
44
|
-
export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
|
|
45
|
-
export const wrappsbt_finalize: (a: number, b: number) => void;
|
|
46
|
-
export const wrappsbt_serialize: (a: number, b: number) => void;
|
|
47
|
-
export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
|
|
48
|
-
export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
|
|
49
|
-
export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
50
|
-
export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
51
4
|
export const __wbg_addressnamespace_free: (a: number, b: number) => void;
|
|
52
5
|
export const __wbg_bip322namespace_free: (a: number, b: number) => void;
|
|
53
6
|
export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
|
|
@@ -56,7 +9,7 @@ export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
|
56
9
|
export const __wbg_wasmbip32_free: (a: number, b: number) => void;
|
|
57
10
|
export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
|
|
58
11
|
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
59
|
-
export const
|
|
12
|
+
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
60
13
|
export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
61
14
|
export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
62
15
|
export const bip322namespace_add_bip322_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
|
|
@@ -94,8 +47,10 @@ export const bitgopsbt_verify_signature_with_xpub: (a: number, b: number, c: num
|
|
|
94
47
|
export const bitgopsbt_version: (a: number) => number;
|
|
95
48
|
export const bitgopsbt_version_group_id: (a: number) => number;
|
|
96
49
|
export const fixedscriptwalletnamespace_address: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
50
|
+
export const fixedscriptwalletnamespace_address_with_network_str: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
97
51
|
export const fixedscriptwalletnamespace_chain_code_table: () => number;
|
|
98
52
|
export const fixedscriptwalletnamespace_output_script: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
53
|
+
export const fixedscriptwalletnamespace_output_script_with_network_str: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
99
54
|
export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
100
55
|
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
101
56
|
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
@@ -120,8 +75,8 @@ export const wasmbip32_public_key: (a: number) => number;
|
|
|
120
75
|
export const wasmbip32_to_base58: (a: number, b: number) => void;
|
|
121
76
|
export const wasmbip32_to_wif: (a: number, b: number) => void;
|
|
122
77
|
export const wasmdimensions_empty: () => number;
|
|
123
|
-
export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
124
|
-
export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number) => void;
|
|
78
|
+
export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
79
|
+
export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
|
|
125
80
|
export const wasmdimensions_from_output_script_length: (a: number) => number;
|
|
126
81
|
export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
|
|
127
82
|
export const wasmdimensions_from_psbt: (a: number, b: number) => void;
|
|
@@ -144,10 +99,57 @@ export const wasmecpair_public_key: (a: number) => number;
|
|
|
144
99
|
export const wasmecpair_to_wif: (a: number, b: number) => void;
|
|
145
100
|
export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
|
|
146
101
|
export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
|
|
102
|
+
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
103
|
+
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
104
|
+
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
105
|
+
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
106
|
+
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;
|
|
107
|
+
export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
108
|
+
export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
|
|
109
|
+
export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
|
|
110
|
+
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
111
|
+
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
112
|
+
export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
|
|
113
|
+
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
114
|
+
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
115
|
+
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
|
116
|
+
export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
117
|
+
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;
|
|
118
|
+
export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
119
|
+
export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
|
|
147
120
|
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
148
121
|
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
149
122
|
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
150
|
-
export const
|
|
123
|
+
export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
124
|
+
export const wasmtransaction_get_vsize: (a: number) => number;
|
|
125
|
+
export const wasmtransaction_to_bytes: (a: number, b: number) => void;
|
|
126
|
+
export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
127
|
+
export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
|
|
128
|
+
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
129
|
+
export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
130
|
+
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
131
|
+
export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
132
|
+
export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
|
|
133
|
+
export const wrapdescriptor_hasWildcard: (a: number) => number;
|
|
134
|
+
export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
|
|
135
|
+
export const wrapdescriptor_node: (a: number, b: number) => void;
|
|
136
|
+
export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
|
|
137
|
+
export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
|
|
138
|
+
export const wrapdescriptor_toString: (a: number, b: number) => void;
|
|
139
|
+
export const wrapminiscript_encode: (a: number, b: number) => void;
|
|
140
|
+
export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
141
|
+
export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
142
|
+
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
143
|
+
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
144
|
+
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
145
|
+
export const wrappsbt_clone: (a: number) => number;
|
|
146
|
+
export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
|
|
147
|
+
export const wrappsbt_finalize: (a: number, b: number) => void;
|
|
148
|
+
export const wrappsbt_serialize: (a: number, b: number) => void;
|
|
149
|
+
export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
|
|
150
|
+
export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
|
|
151
|
+
export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
152
|
+
export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
151
153
|
export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
|
|
152
154
|
export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
|
|
153
155
|
export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
|
|
@@ -7,6 +7,16 @@ type FromInputParams = {
|
|
|
7
7
|
} | {
|
|
8
8
|
scriptType: InputScriptType;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Options for input dimension calculation
|
|
12
|
+
*/
|
|
13
|
+
export type FromInputOptions = {
|
|
14
|
+
/**
|
|
15
|
+
* When true, use @bitgo/unspents-compatible signature sizes (72 bytes)
|
|
16
|
+
* for the "max" calculation instead of true maximum (73 bytes).
|
|
17
|
+
*/
|
|
18
|
+
utxolibCompat?: boolean;
|
|
19
|
+
};
|
|
10
20
|
/**
|
|
11
21
|
* Dimensions class for estimating transaction virtual size.
|
|
12
22
|
*
|
|
@@ -34,8 +44,9 @@ export declare class Dimensions {
|
|
|
34
44
|
* Create dimensions for a single input
|
|
35
45
|
*
|
|
36
46
|
* @param params - Either `{ chain, signPath? }` or `{ scriptType }`
|
|
47
|
+
* @param options - Optional settings like `{ utxolibCompat: true }` for @bitgo/unspents-compatible sizing
|
|
37
48
|
*/
|
|
38
|
-
static fromInput(params: FromInputParams): Dimensions;
|
|
49
|
+
static fromInput(params: FromInputParams, options?: FromInputOptions): Dimensions;
|
|
39
50
|
/**
|
|
40
51
|
* Create dimensions for a single output from script bytes
|
|
41
52
|
*/
|
|
@@ -33,12 +33,14 @@ export class Dimensions {
|
|
|
33
33
|
* Create dimensions for a single input
|
|
34
34
|
*
|
|
35
35
|
* @param params - Either `{ chain, signPath? }` or `{ scriptType }`
|
|
36
|
+
* @param options - Optional settings like `{ utxolibCompat: true }` for @bitgo/unspents-compatible sizing
|
|
36
37
|
*/
|
|
37
|
-
static fromInput(params) {
|
|
38
|
+
static fromInput(params, options) {
|
|
39
|
+
const compat = options?.utxolibCompat;
|
|
38
40
|
if ("scriptType" in params) {
|
|
39
|
-
return new Dimensions(WasmDimensions.from_input_script_type(params.scriptType));
|
|
41
|
+
return new Dimensions(WasmDimensions.from_input_script_type(params.scriptType, compat));
|
|
40
42
|
}
|
|
41
|
-
return new Dimensions(WasmDimensions.from_input(params.chain, params.signPath?.signer, params.signPath?.cosigner));
|
|
43
|
+
return new Dimensions(WasmDimensions.from_input(params.chain, params.signPath?.signer, params.signPath?.cosigner, compat));
|
|
42
44
|
}
|
|
43
45
|
static fromOutput(params, network) {
|
|
44
46
|
if (typeof params === "string") {
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import { type WalletKeysArg } from "./RootWalletKeys.js";
|
|
2
2
|
import type { UtxolibNetwork } from "../utxolibCompat.js";
|
|
3
|
+
import type { UtxolibName } from "../utxolibCompat.js";
|
|
4
|
+
import type { CoinName } from "../coinName.js";
|
|
3
5
|
import { AddressFormat } from "../address.js";
|
|
6
|
+
export type NetworkName = UtxolibName | CoinName;
|
|
4
7
|
/**
|
|
5
8
|
* Create the output script for a given wallet keys and chain and index
|
|
9
|
+
* @param keys - The wallet keys to use
|
|
10
|
+
* @param chain - The chain to use
|
|
11
|
+
* @param index - The index to use
|
|
12
|
+
* @param network - The network to use. Can be a network name string (e.g., "btc", "bitcoin", "testnet") or a UtxolibNetwork object
|
|
6
13
|
*/
|
|
7
|
-
export declare function outputScript(keys: WalletKeysArg, chain: number, index: number, network: UtxolibNetwork): Uint8Array;
|
|
14
|
+
export declare function outputScript(keys: WalletKeysArg, chain: number, index: number, network: NetworkName | UtxolibNetwork): Uint8Array;
|
|
8
15
|
/**
|
|
9
16
|
* Create the address for a given wallet keys and chain and index and network.
|
|
10
17
|
* Wrapper for outputScript that also encodes the script to an address.
|
|
11
18
|
* @param keys - The wallet keys to use.
|
|
12
19
|
* @param chain - The chain to use.
|
|
13
20
|
* @param index - The index to use.
|
|
14
|
-
* @param network - The network to use.
|
|
21
|
+
* @param network - The network to use. Can be a network name string (e.g., "btc", "bitcoin", "testnet") or a UtxolibNetwork object
|
|
15
22
|
* @param addressFormat - The address format to use.
|
|
16
23
|
* Only relevant for Bitcoin Cash and eCash networks, where:
|
|
17
24
|
* - "default" means base58check,
|
|
18
25
|
* - "cashaddr" means cashaddr.
|
|
19
26
|
*/
|
|
20
|
-
export declare function address(keys: WalletKeysArg, chain: number, index: number, network: UtxolibNetwork, addressFormat?: AddressFormat): string;
|
|
27
|
+
export declare function address(keys: WalletKeysArg, chain: number, index: number, network: NetworkName | UtxolibNetwork, addressFormat?: AddressFormat): string;
|
|
@@ -2,10 +2,19 @@ import { FixedScriptWalletNamespace } from "../wasm/wasm_utxo.js";
|
|
|
2
2
|
import { RootWalletKeys } from "./RootWalletKeys.js";
|
|
3
3
|
/**
|
|
4
4
|
* Create the output script for a given wallet keys and chain and index
|
|
5
|
+
* @param keys - The wallet keys to use
|
|
6
|
+
* @param chain - The chain to use
|
|
7
|
+
* @param index - The index to use
|
|
8
|
+
* @param network - The network to use. Can be a network name string (e.g., "btc", "bitcoin", "testnet") or a UtxolibNetwork object
|
|
5
9
|
*/
|
|
6
10
|
export function outputScript(keys, chain, index, network) {
|
|
7
11
|
const walletKeys = RootWalletKeys.from(keys);
|
|
8
|
-
|
|
12
|
+
if (typeof network === "string") {
|
|
13
|
+
return FixedScriptWalletNamespace.output_script_with_network_str(walletKeys.wasm, chain, index, network);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return FixedScriptWalletNamespace.output_script(walletKeys.wasm, chain, index, network);
|
|
17
|
+
}
|
|
9
18
|
}
|
|
10
19
|
/**
|
|
11
20
|
* Create the address for a given wallet keys and chain and index and network.
|
|
@@ -13,7 +22,7 @@ export function outputScript(keys, chain, index, network) {
|
|
|
13
22
|
* @param keys - The wallet keys to use.
|
|
14
23
|
* @param chain - The chain to use.
|
|
15
24
|
* @param index - The index to use.
|
|
16
|
-
* @param network - The network to use.
|
|
25
|
+
* @param network - The network to use. Can be a network name string (e.g., "btc", "bitcoin", "testnet") or a UtxolibNetwork object
|
|
17
26
|
* @param addressFormat - The address format to use.
|
|
18
27
|
* Only relevant for Bitcoin Cash and eCash networks, where:
|
|
19
28
|
* - "default" means base58check,
|
|
@@ -21,5 +30,10 @@ export function outputScript(keys, chain, index, network) {
|
|
|
21
30
|
*/
|
|
22
31
|
export function address(keys, chain, index, network, addressFormat) {
|
|
23
32
|
const walletKeys = RootWalletKeys.from(keys);
|
|
24
|
-
|
|
33
|
+
if (typeof network === "string") {
|
|
34
|
+
return FixedScriptWalletNamespace.address_with_network_str(walletKeys.wasm, chain, index, network, addressFormat);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return FixedScriptWalletNamespace.address(walletKeys.wasm, chain, index, network, addressFormat);
|
|
38
|
+
}
|
|
25
39
|
}
|
|
@@ -504,6 +504,8 @@ export class FixedScriptWalletNamespace {
|
|
|
504
504
|
* - Dogecoin only supports legacy scripts (p2sh)
|
|
505
505
|
*/
|
|
506
506
|
static supports_script_type(coin: string, script_type: string): boolean;
|
|
507
|
+
static address_with_network_str(keys: WasmRootWalletKeys, chain: number, index: number, network: string, address_format?: string | null): string;
|
|
508
|
+
static output_script_with_network_str(keys: WasmRootWalletKeys, chain: number, index: number, network: string): Uint8Array;
|
|
507
509
|
static address(keys: WasmRootWalletKeys, chain: number, index: number, network: any, address_format?: string | null): string;
|
|
508
510
|
}
|
|
509
511
|
|
|
@@ -685,8 +687,9 @@ export class WasmDimensions {
|
|
|
685
687
|
* * `chain` - Chain code (0/1=p2sh, 10/11=p2shP2wsh, 20/21=p2wsh, 30/31=p2tr, 40/41=p2trMusig2)
|
|
686
688
|
* * `signer` - Optional signer key ("user", "backup", "bitgo")
|
|
687
689
|
* * `cosigner` - Optional cosigner key ("user", "backup", "bitgo")
|
|
690
|
+
* * `compat` - When true, use 72-byte signatures for max (matches @bitgo/unspents)
|
|
688
691
|
*/
|
|
689
|
-
static from_input(chain: number, signer?: string | null, cosigner?: string | null): WasmDimensions;
|
|
692
|
+
static from_input(chain: number, signer?: string | null, cosigner?: string | null, compat?: boolean | null): WasmDimensions;
|
|
690
693
|
/**
|
|
691
694
|
* Get total weight (min or max)
|
|
692
695
|
*
|
|
@@ -726,8 +729,9 @@ export class WasmDimensions {
|
|
|
726
729
|
* # Arguments
|
|
727
730
|
* * `script_type` - One of: "p2sh", "p2shP2wsh", "p2wsh", "p2trLegacy",
|
|
728
731
|
* "p2trMusig2KeyPath", "p2trMusig2ScriptPath", "p2shP2pk"
|
|
732
|
+
* * `compat` - When true, use 72-byte signatures for max (matches @bitgo/unspents)
|
|
729
733
|
*/
|
|
730
|
-
static from_input_script_type(script_type: string): WasmDimensions;
|
|
734
|
+
static from_input_script_type(script_type: string, compat?: boolean | null): WasmDimensions;
|
|
731
735
|
/**
|
|
732
736
|
* Create dimensions for a single output from script type string
|
|
733
737
|
*
|
|
@@ -1579,6 +1579,71 @@ export class FixedScriptWalletNamespace {
|
|
|
1579
1579
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1580
1580
|
}
|
|
1581
1581
|
}
|
|
1582
|
+
/**
|
|
1583
|
+
* @param {WasmRootWalletKeys} keys
|
|
1584
|
+
* @param {number} chain
|
|
1585
|
+
* @param {number} index
|
|
1586
|
+
* @param {string} network
|
|
1587
|
+
* @param {string | null} [address_format]
|
|
1588
|
+
* @returns {string}
|
|
1589
|
+
*/
|
|
1590
|
+
static address_with_network_str(keys, chain, index, network, address_format) {
|
|
1591
|
+
let deferred4_0;
|
|
1592
|
+
let deferred4_1;
|
|
1593
|
+
try {
|
|
1594
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1595
|
+
_assertClass(keys, WasmRootWalletKeys);
|
|
1596
|
+
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1597
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1598
|
+
var ptr1 = isLikeNone(address_format) ? 0 : passStringToWasm0(address_format, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1599
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1600
|
+
wasm.fixedscriptwalletnamespace_address_with_network_str(retptr, keys.__wbg_ptr, chain, index, ptr0, len0, ptr1, len1);
|
|
1601
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1602
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1603
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1604
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1605
|
+
var ptr3 = r0;
|
|
1606
|
+
var len3 = r1;
|
|
1607
|
+
if (r3) {
|
|
1608
|
+
ptr3 = 0; len3 = 0;
|
|
1609
|
+
throw takeObject(r2);
|
|
1610
|
+
}
|
|
1611
|
+
deferred4_0 = ptr3;
|
|
1612
|
+
deferred4_1 = len3;
|
|
1613
|
+
return getStringFromWasm0(ptr3, len3);
|
|
1614
|
+
} finally {
|
|
1615
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1616
|
+
wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
/**
|
|
1620
|
+
* @param {WasmRootWalletKeys} keys
|
|
1621
|
+
* @param {number} chain
|
|
1622
|
+
* @param {number} index
|
|
1623
|
+
* @param {string} network
|
|
1624
|
+
* @returns {Uint8Array}
|
|
1625
|
+
*/
|
|
1626
|
+
static output_script_with_network_str(keys, chain, index, network) {
|
|
1627
|
+
try {
|
|
1628
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1629
|
+
_assertClass(keys, WasmRootWalletKeys);
|
|
1630
|
+
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1631
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1632
|
+
wasm.fixedscriptwalletnamespace_output_script_with_network_str(retptr, keys.__wbg_ptr, chain, index, ptr0, len0);
|
|
1633
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1634
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1635
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1636
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1637
|
+
if (r3) {
|
|
1638
|
+
throw takeObject(r2);
|
|
1639
|
+
}
|
|
1640
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
1641
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1642
|
+
return v2;
|
|
1643
|
+
} finally {
|
|
1644
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1582
1647
|
/**
|
|
1583
1648
|
* @param {WasmRootWalletKeys} keys
|
|
1584
1649
|
* @param {number} chain
|
|
@@ -2257,19 +2322,21 @@ export class WasmDimensions {
|
|
|
2257
2322
|
* * `chain` - Chain code (0/1=p2sh, 10/11=p2shP2wsh, 20/21=p2wsh, 30/31=p2tr, 40/41=p2trMusig2)
|
|
2258
2323
|
* * `signer` - Optional signer key ("user", "backup", "bitgo")
|
|
2259
2324
|
* * `cosigner` - Optional cosigner key ("user", "backup", "bitgo")
|
|
2325
|
+
* * `compat` - When true, use 72-byte signatures for max (matches @bitgo/unspents)
|
|
2260
2326
|
* @param {number} chain
|
|
2261
2327
|
* @param {string | null} [signer]
|
|
2262
2328
|
* @param {string | null} [cosigner]
|
|
2329
|
+
* @param {boolean | null} [compat]
|
|
2263
2330
|
* @returns {WasmDimensions}
|
|
2264
2331
|
*/
|
|
2265
|
-
static from_input(chain, signer, cosigner) {
|
|
2332
|
+
static from_input(chain, signer, cosigner, compat) {
|
|
2266
2333
|
try {
|
|
2267
2334
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2268
2335
|
var ptr0 = isLikeNone(signer) ? 0 : passStringToWasm0(signer, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2269
2336
|
var len0 = WASM_VECTOR_LEN;
|
|
2270
2337
|
var ptr1 = isLikeNone(cosigner) ? 0 : passStringToWasm0(cosigner, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2271
2338
|
var len1 = WASM_VECTOR_LEN;
|
|
2272
|
-
wasm.wasmdimensions_from_input(retptr, chain, ptr0, len0, ptr1, len1);
|
|
2339
|
+
wasm.wasmdimensions_from_input(retptr, chain, ptr0, len0, ptr1, len1, isLikeNone(compat) ? 0xFFFFFF : compat ? 1 : 0);
|
|
2273
2340
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2274
2341
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2275
2342
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -2353,15 +2420,17 @@ export class WasmDimensions {
|
|
|
2353
2420
|
* # Arguments
|
|
2354
2421
|
* * `script_type` - One of: "p2sh", "p2shP2wsh", "p2wsh", "p2trLegacy",
|
|
2355
2422
|
* "p2trMusig2KeyPath", "p2trMusig2ScriptPath", "p2shP2pk"
|
|
2423
|
+
* * `compat` - When true, use 72-byte signatures for max (matches @bitgo/unspents)
|
|
2356
2424
|
* @param {string} script_type
|
|
2425
|
+
* @param {boolean | null} [compat]
|
|
2357
2426
|
* @returns {WasmDimensions}
|
|
2358
2427
|
*/
|
|
2359
|
-
static from_input_script_type(script_type) {
|
|
2428
|
+
static from_input_script_type(script_type, compat) {
|
|
2360
2429
|
try {
|
|
2361
2430
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2362
2431
|
const ptr0 = passStringToWasm0(script_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2363
2432
|
const len0 = WASM_VECTOR_LEN;
|
|
2364
|
-
wasm.wasmdimensions_from_input_script_type(retptr, ptr0, len0);
|
|
2433
|
+
wasm.wasmdimensions_from_input_script_type(retptr, ptr0, len0, isLikeNone(compat) ? 0xFFFFFF : compat ? 1 : 0);
|
|
2365
2434
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2366
2435
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2367
2436
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
Binary file
|
|
@@ -1,53 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
|
|
5
|
-
export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
|
|
6
|
-
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
7
|
-
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
8
|
-
export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
|
|
9
|
-
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
10
|
-
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
11
|
-
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
|
12
|
-
export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
13
|
-
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;
|
|
14
|
-
export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
15
|
-
export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
|
|
16
|
-
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
17
|
-
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
18
|
-
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
19
|
-
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
20
|
-
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;
|
|
21
|
-
export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
22
|
-
export const wasmtransaction_get_vsize: (a: number) => number;
|
|
23
|
-
export const wasmtransaction_to_bytes: (a: number, b: number) => void;
|
|
24
|
-
export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
25
|
-
export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
|
|
26
|
-
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
27
|
-
export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
28
|
-
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
29
|
-
export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
30
|
-
export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
|
|
31
|
-
export const wrapdescriptor_hasWildcard: (a: number) => number;
|
|
32
|
-
export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
|
|
33
|
-
export const wrapdescriptor_node: (a: number, b: number) => void;
|
|
34
|
-
export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
|
|
35
|
-
export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
|
|
36
|
-
export const wrapdescriptor_toString: (a: number, b: number) => void;
|
|
37
|
-
export const wrapminiscript_encode: (a: number, b: number) => void;
|
|
38
|
-
export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
39
|
-
export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
40
|
-
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
41
|
-
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
42
|
-
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
43
|
-
export const wrappsbt_clone: (a: number) => number;
|
|
44
|
-
export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
|
|
45
|
-
export const wrappsbt_finalize: (a: number, b: number) => void;
|
|
46
|
-
export const wrappsbt_serialize: (a: number, b: number) => void;
|
|
47
|
-
export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
|
|
48
|
-
export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
|
|
49
|
-
export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
50
|
-
export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
51
4
|
export const __wbg_addressnamespace_free: (a: number, b: number) => void;
|
|
52
5
|
export const __wbg_bip322namespace_free: (a: number, b: number) => void;
|
|
53
6
|
export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
|
|
@@ -56,7 +9,7 @@ export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
|
56
9
|
export const __wbg_wasmbip32_free: (a: number, b: number) => void;
|
|
57
10
|
export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
|
|
58
11
|
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
59
|
-
export const
|
|
12
|
+
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
60
13
|
export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
61
14
|
export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
62
15
|
export const bip322namespace_add_bip322_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
|
|
@@ -94,8 +47,10 @@ export const bitgopsbt_verify_signature_with_xpub: (a: number, b: number, c: num
|
|
|
94
47
|
export const bitgopsbt_version: (a: number) => number;
|
|
95
48
|
export const bitgopsbt_version_group_id: (a: number) => number;
|
|
96
49
|
export const fixedscriptwalletnamespace_address: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
50
|
+
export const fixedscriptwalletnamespace_address_with_network_str: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
97
51
|
export const fixedscriptwalletnamespace_chain_code_table: () => number;
|
|
98
52
|
export const fixedscriptwalletnamespace_output_script: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
53
|
+
export const fixedscriptwalletnamespace_output_script_with_network_str: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
99
54
|
export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
100
55
|
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
101
56
|
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
@@ -120,8 +75,8 @@ export const wasmbip32_public_key: (a: number) => number;
|
|
|
120
75
|
export const wasmbip32_to_base58: (a: number, b: number) => void;
|
|
121
76
|
export const wasmbip32_to_wif: (a: number, b: number) => void;
|
|
122
77
|
export const wasmdimensions_empty: () => number;
|
|
123
|
-
export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
124
|
-
export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number) => void;
|
|
78
|
+
export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
79
|
+
export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
|
|
125
80
|
export const wasmdimensions_from_output_script_length: (a: number) => number;
|
|
126
81
|
export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
|
|
127
82
|
export const wasmdimensions_from_psbt: (a: number, b: number) => void;
|
|
@@ -144,10 +99,57 @@ export const wasmecpair_public_key: (a: number) => number;
|
|
|
144
99
|
export const wasmecpair_to_wif: (a: number, b: number) => void;
|
|
145
100
|
export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
|
|
146
101
|
export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
|
|
102
|
+
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
103
|
+
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
104
|
+
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
105
|
+
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
106
|
+
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;
|
|
107
|
+
export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
108
|
+
export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
|
|
109
|
+
export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
|
|
110
|
+
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
111
|
+
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
112
|
+
export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
|
|
113
|
+
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
114
|
+
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
115
|
+
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
|
116
|
+
export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
117
|
+
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;
|
|
118
|
+
export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
119
|
+
export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
|
|
147
120
|
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
148
121
|
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
149
122
|
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
150
|
-
export const
|
|
123
|
+
export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
124
|
+
export const wasmtransaction_get_vsize: (a: number) => number;
|
|
125
|
+
export const wasmtransaction_to_bytes: (a: number, b: number) => void;
|
|
126
|
+
export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
127
|
+
export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
|
|
128
|
+
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
129
|
+
export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
130
|
+
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
131
|
+
export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
132
|
+
export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
|
|
133
|
+
export const wrapdescriptor_hasWildcard: (a: number) => number;
|
|
134
|
+
export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
|
|
135
|
+
export const wrapdescriptor_node: (a: number, b: number) => void;
|
|
136
|
+
export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
|
|
137
|
+
export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
|
|
138
|
+
export const wrapdescriptor_toString: (a: number, b: number) => void;
|
|
139
|
+
export const wrapminiscript_encode: (a: number, b: number) => void;
|
|
140
|
+
export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
141
|
+
export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
142
|
+
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
143
|
+
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
144
|
+
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
145
|
+
export const wrappsbt_clone: (a: number) => number;
|
|
146
|
+
export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
|
|
147
|
+
export const wrappsbt_finalize: (a: number, b: number) => void;
|
|
148
|
+
export const wrappsbt_serialize: (a: number, b: number) => void;
|
|
149
|
+
export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
|
|
150
|
+
export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
|
|
151
|
+
export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
152
|
+
export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
151
153
|
export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
|
|
152
154
|
export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
|
|
153
155
|
export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitgo/wasm-utxo",
|
|
3
3
|
"description": "WebAssembly wrapper for rust-bitcoin (beta)",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.26.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"lint:fix": "eslint . --fix"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
+
"@bitgo/unspents": "^0.50.13",
|
|
55
56
|
"@bitgo/utxo-lib": "^10.1.0",
|
|
56
57
|
"@eslint/js": "^9.17.0",
|
|
57
58
|
"@types/mocha": "^10.0.7",
|