@bitgo/wasm-utxo 1.19.0 → 1.21.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.
@@ -5,12 +5,13 @@ import { type BIP32Arg } from "../bip32.js";
5
5
  import { type ECPairArg } from "../ecpair.js";
6
6
  import type { UtxolibName } from "../utxolibCompat.js";
7
7
  import type { CoinName } from "../coinName.js";
8
+ import type { InputScriptType } from "./scriptType.js";
9
+ export type { InputScriptType };
8
10
  export type NetworkName = UtxolibName | CoinName;
9
11
  export type ScriptId = {
10
12
  chain: number;
11
13
  index: number;
12
14
  };
13
- export type InputScriptType = "p2shP2pk" | "p2sh" | "p2shP2wsh" | "p2wsh" | "p2trLegacy" | "p2trMusig2ScriptPath" | "p2trMusig2KeyPath";
14
15
  export type OutPoint = {
15
16
  txid: string;
16
17
  vout: number;
@@ -57,10 +58,13 @@ export type AddInputOptions = {
57
58
  prevTx?: Uint8Array;
58
59
  };
59
60
  export type AddOutputOptions = {
60
- /** Output script (scriptPubKey) */
61
61
  script: Uint8Array;
62
62
  /** Value in satoshis */
63
63
  value: bigint;
64
+ } | {
65
+ address: string;
66
+ /** Value in satoshis */
67
+ value: bigint;
64
68
  };
65
69
  /** Key identifier for signing ("user", "backup", or "bitgo") */
66
70
  export type SignerKey = "user" | "backup" | "bitgo";
@@ -146,15 +150,48 @@ export declare class BitGoPsbt {
146
150
  /**
147
151
  * Add an output to the PSBT
148
152
  *
149
- * @param options - Output options (script, value)
153
+ * @param script - The output script (scriptPubKey)
154
+ * @param value - Value in satoshis
155
+ * @returns The index of the newly added output
156
+ *
157
+ * @example
158
+ * ```typescript
159
+ * const outputIndex = psbt.addOutput(outputScript, 50000n);
160
+ * ```
161
+ */
162
+ addOutput(script: Uint8Array, value: bigint): number;
163
+ /**
164
+ * Add an output to the PSBT by address
165
+ *
166
+ * @param address - The destination address
167
+ * @param value - Value in satoshis
168
+ * @returns The index of the newly added output
169
+ *
170
+ * @example
171
+ * ```typescript
172
+ * const outputIndex = psbt.addOutput("bc1q...", 50000n);
173
+ * ```
174
+ */
175
+ addOutput(address: string, value: bigint): number;
176
+ /**
177
+ * Add an output to the PSBT
178
+ *
179
+ * @param options - Output options (script or address, and value)
150
180
  * @returns The index of the newly added output
151
181
  *
152
182
  * @example
153
183
  * ```typescript
184
+ * // Using script
154
185
  * const outputIndex = psbt.addOutput({
155
186
  * script: outputScript,
156
187
  * value: 50000n,
157
188
  * });
189
+ *
190
+ * // Using address
191
+ * const outputIndex = psbt.addOutput({
192
+ * address: "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4",
193
+ * value: 50000n,
194
+ * });
158
195
  * ```
159
196
  */
160
197
  addOutput(options: AddOutputOptions): number;
@@ -77,22 +77,24 @@ class BitGoPsbt {
77
77
  addInput(options, script) {
78
78
  return this._wasm.add_input(options.txid, options.vout, options.value, script, options.sequence, options.prevTx);
79
79
  }
80
- /**
81
- * Add an output to the PSBT
82
- *
83
- * @param options - Output options (script, value)
84
- * @returns The index of the newly added output
85
- *
86
- * @example
87
- * ```typescript
88
- * const outputIndex = psbt.addOutput({
89
- * script: outputScript,
90
- * value: 50000n,
91
- * });
92
- * ```
93
- */
94
- addOutput(options) {
95
- return this._wasm.add_output(options.script, options.value);
80
+ addOutput(scriptOrOptions, value) {
81
+ if (scriptOrOptions instanceof Uint8Array || typeof scriptOrOptions === "string") {
82
+ if (value === undefined) {
83
+ throw new Error("Value is required when passing a script or address");
84
+ }
85
+ if (scriptOrOptions instanceof Uint8Array) {
86
+ return this._wasm.add_output(scriptOrOptions, value);
87
+ }
88
+ return this._wasm.add_output_with_address(scriptOrOptions, value);
89
+ }
90
+ const options = scriptOrOptions;
91
+ if ("script" in options) {
92
+ return this._wasm.add_output(options.script, options.value);
93
+ }
94
+ if ("address" in options) {
95
+ return this._wasm.add_output_with_address(options.address, options.value);
96
+ }
97
+ throw new Error("Invalid output options");
96
98
  }
97
99
  /**
98
100
  * Add a wallet input with full PSBT metadata
@@ -1,6 +1,35 @@
1
+ import type { CoinName } from "../coinName.js";
1
2
  export { RootWalletKeys, type WalletKeysArg, type IWalletKeys } from "./RootWalletKeys.js";
2
3
  export { ReplayProtection, type ReplayProtectionArg } from "./ReplayProtection.js";
3
4
  export { outputScript, address } from "./address.js";
4
5
  export { Dimensions } from "./Dimensions.js";
5
- export { BitGoPsbt, type NetworkName, type ScriptId, type InputScriptType, type ParsedInput, type ParsedOutput, type ParsedTransaction, type SignPath, type CreateEmptyOptions, type AddInputOptions, type AddOutputOptions, type AddWalletInputOptions, type AddWalletOutputOptions, } from "./BitGoPsbt.js";
6
+ export { type OutputScriptType, type InputScriptType, type ScriptType } from "./scriptType.js";
7
+ export { BitGoPsbt, type NetworkName, type ScriptId, type ParsedInput, type ParsedOutput, type ParsedTransaction, type SignPath, type CreateEmptyOptions, type AddInputOptions, type AddOutputOptions, type AddWalletInputOptions, type AddWalletOutputOptions, } from "./BitGoPsbt.js";
6
8
  export { ZcashBitGoPsbt, type ZcashNetworkName, type CreateEmptyZcashOptions, } from "./ZcashBitGoPsbt.js";
9
+ import type { ScriptType } from "./scriptType.js";
10
+ /**
11
+ * Check if a network supports a given fixed-script wallet script type
12
+ *
13
+ * @param coin - Coin name (e.g., "btc", "ltc", "doge")
14
+ * @param scriptType - Output script type or input script type to check
15
+ * @returns `true` if the network supports the script type, `false` otherwise
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * // Bitcoin supports all script types
20
+ * supportsScriptType("btc", "p2tr"); // true
21
+ *
22
+ * // Litecoin supports segwit but not taproot
23
+ * supportsScriptType("ltc", "p2wsh"); // true
24
+ * supportsScriptType("ltc", "p2tr"); // false
25
+ *
26
+ * // Dogecoin only supports legacy scripts
27
+ * supportsScriptType("doge", "p2sh"); // true
28
+ * supportsScriptType("doge", "p2wsh"); // false
29
+ *
30
+ * // Also works with input script types
31
+ * supportsScriptType("btc", "p2trMusig2KeyPath"); // true
32
+ * supportsScriptType("doge", "p2trLegacy"); // false
33
+ * ```
34
+ */
35
+ export declare function supportsScriptType(coin: CoinName, scriptType: ScriptType): boolean;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ZcashBitGoPsbt = exports.BitGoPsbt = exports.Dimensions = exports.address = exports.outputScript = exports.ReplayProtection = exports.RootWalletKeys = void 0;
4
+ exports.supportsScriptType = supportsScriptType;
5
+ const wasm_utxo_js_1 = require("../wasm/wasm_utxo.js");
4
6
  var RootWalletKeys_js_1 = require("./RootWalletKeys.js");
5
7
  Object.defineProperty(exports, "RootWalletKeys", { enumerable: true, get: function () { return RootWalletKeys_js_1.RootWalletKeys; } });
6
8
  var ReplayProtection_js_1 = require("./ReplayProtection.js");
@@ -16,3 +18,31 @@ Object.defineProperty(exports, "BitGoPsbt", { enumerable: true, get: function ()
16
18
  // Zcash-specific PSBT subclass
17
19
  var ZcashBitGoPsbt_js_1 = require("./ZcashBitGoPsbt.js");
18
20
  Object.defineProperty(exports, "ZcashBitGoPsbt", { enumerable: true, get: function () { return ZcashBitGoPsbt_js_1.ZcashBitGoPsbt; } });
21
+ /**
22
+ * Check if a network supports a given fixed-script wallet script type
23
+ *
24
+ * @param coin - Coin name (e.g., "btc", "ltc", "doge")
25
+ * @param scriptType - Output script type or input script type to check
26
+ * @returns `true` if the network supports the script type, `false` otherwise
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * // Bitcoin supports all script types
31
+ * supportsScriptType("btc", "p2tr"); // true
32
+ *
33
+ * // Litecoin supports segwit but not taproot
34
+ * supportsScriptType("ltc", "p2wsh"); // true
35
+ * supportsScriptType("ltc", "p2tr"); // false
36
+ *
37
+ * // Dogecoin only supports legacy scripts
38
+ * supportsScriptType("doge", "p2sh"); // true
39
+ * supportsScriptType("doge", "p2wsh"); // false
40
+ *
41
+ * // Also works with input script types
42
+ * supportsScriptType("btc", "p2trMusig2KeyPath"); // true
43
+ * supportsScriptType("doge", "p2trLegacy"); // false
44
+ * ```
45
+ */
46
+ function supportsScriptType(coin, scriptType) {
47
+ return wasm_utxo_js_1.FixedScriptWalletNamespace.supports_script_type(coin, scriptType);
48
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Fixed-script wallet output script types (2-of-3 multisig)
3
+ *
4
+ * This type represents the abstract script type, independent of chain (external/internal).
5
+ * Use this for checking network support or when you need the script type without derivation info.
6
+ */
7
+ export type OutputScriptType = "p2sh" | "p2shP2wsh" | "p2wsh" | "p2tr" | "p2trLegacy" | "p2trMusig2";
8
+ /**
9
+ * Input script types for fixed-script wallets
10
+ *
11
+ * These are more specific than output types and include single-sig and taproot variants.
12
+ */
13
+ export type InputScriptType = "p2shP2pk" | "p2sh" | "p2shP2wsh" | "p2wsh" | "p2trLegacy" | "p2trMusig2ScriptPath" | "p2trMusig2KeyPath";
14
+ /**
15
+ * Union of all script types that can be checked for network support
16
+ */
17
+ export type ScriptType = OutputScriptType | InputScriptType;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -225,6 +225,17 @@ export class BitGoPsbt {
225
225
  * generated for security. Custom session_id is only allowed on testnets for testing purposes.
226
226
  */
227
227
  generate_musig2_nonces(xpriv: WasmBIP32, session_id_bytes?: Uint8Array | null): void;
228
+ /**
229
+ * Add an output to the PSBT by address
230
+ *
231
+ * # Arguments
232
+ * * `address` - The destination address
233
+ * * `value` - The value in satoshis
234
+ *
235
+ * # Returns
236
+ * The index of the newly added output
237
+ */
238
+ add_output_with_address(address: string, value: bigint): number;
228
239
  /**
229
240
  * Verify if a valid signature exists for a given ECPair key at the specified input index
230
241
  *
@@ -368,6 +379,22 @@ export class FixedScriptWalletNamespace {
368
379
  free(): void;
369
380
  [Symbol.dispose](): void;
370
381
  static output_script(keys: WasmRootWalletKeys, chain: number, index: number, network: any): Uint8Array;
382
+ /**
383
+ * Check if a network supports a given fixed-script wallet script type
384
+ *
385
+ * # Arguments
386
+ * * `coin` - Coin name (e.g., "btc", "ltc", "doge")
387
+ * * `script_type` - Script type name: "p2sh", "p2shP2wsh", "p2wsh", "p2tr", "p2trMusig2"
388
+ *
389
+ * # Returns
390
+ * `true` if the network supports the script type, `false` otherwise
391
+ *
392
+ * # Examples
393
+ * - Bitcoin supports all script types (p2sh, p2shP2wsh, p2wsh, p2tr, p2trMusig2)
394
+ * - Litecoin supports segwit but not taproot (p2sh, p2shP2wsh, p2wsh)
395
+ * - Dogecoin only supports legacy scripts (p2sh)
396
+ */
397
+ static supports_script_type(coin: string, script_type: string): boolean;
371
398
  static address(keys: WasmRootWalletKeys, chain: number, index: number, network: any, address_format?: string | null): string;
372
399
  }
373
400
 
@@ -800,6 +800,36 @@ class BitGoPsbt {
800
800
  wasm.__wbindgen_add_to_stack_pointer(16);
801
801
  }
802
802
  }
803
+ /**
804
+ * Add an output to the PSBT by address
805
+ *
806
+ * # Arguments
807
+ * * `address` - The destination address
808
+ * * `value` - The value in satoshis
809
+ *
810
+ * # Returns
811
+ * The index of the newly added output
812
+ * @param {string} address
813
+ * @param {bigint} value
814
+ * @returns {number}
815
+ */
816
+ add_output_with_address(address, value) {
817
+ try {
818
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
819
+ const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
820
+ const len0 = WASM_VECTOR_LEN;
821
+ wasm.bitgopsbt_add_output_with_address(retptr, this.__wbg_ptr, ptr0, len0, value);
822
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
823
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
824
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
825
+ if (r2) {
826
+ throw takeObject(r1);
827
+ }
828
+ return r0 >>> 0;
829
+ } finally {
830
+ wasm.__wbindgen_add_to_stack_pointer(16);
831
+ }
832
+ }
803
833
  /**
804
834
  * Verify if a valid signature exists for a given ECPair key at the specified input index
805
835
  *
@@ -1190,6 +1220,43 @@ class FixedScriptWalletNamespace {
1190
1220
  wasm.__wbindgen_add_to_stack_pointer(16);
1191
1221
  }
1192
1222
  }
1223
+ /**
1224
+ * Check if a network supports a given fixed-script wallet script type
1225
+ *
1226
+ * # Arguments
1227
+ * * `coin` - Coin name (e.g., "btc", "ltc", "doge")
1228
+ * * `script_type` - Script type name: "p2sh", "p2shP2wsh", "p2wsh", "p2tr", "p2trMusig2"
1229
+ *
1230
+ * # Returns
1231
+ * `true` if the network supports the script type, `false` otherwise
1232
+ *
1233
+ * # Examples
1234
+ * - Bitcoin supports all script types (p2sh, p2shP2wsh, p2wsh, p2tr, p2trMusig2)
1235
+ * - Litecoin supports segwit but not taproot (p2sh, p2shP2wsh, p2wsh)
1236
+ * - Dogecoin only supports legacy scripts (p2sh)
1237
+ * @param {string} coin
1238
+ * @param {string} script_type
1239
+ * @returns {boolean}
1240
+ */
1241
+ static supports_script_type(coin, script_type) {
1242
+ try {
1243
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1244
+ const ptr0 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1245
+ const len0 = WASM_VECTOR_LEN;
1246
+ const ptr1 = passStringToWasm0(script_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1247
+ const len1 = WASM_VECTOR_LEN;
1248
+ wasm.fixedscriptwalletnamespace_supports_script_type(retptr, ptr0, len0, ptr1, len1);
1249
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1250
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1251
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1252
+ if (r2) {
1253
+ throw takeObject(r1);
1254
+ }
1255
+ return r0 !== 0;
1256
+ } finally {
1257
+ wasm.__wbindgen_add_to_stack_pointer(16);
1258
+ }
1259
+ }
1193
1260
  /**
1194
1261
  * @param {WasmRootWalletKeys} keys
1195
1262
  * @param {number} chain
Binary file
@@ -1,62 +1,12 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
5
- export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
6
- export const __wbg_wasmreplayprotection_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 utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
13
- export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => 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 wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
17
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
18
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
19
- export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
20
- export const wasmtransaction_get_vsize: (a: number) => number;
21
- export const wasmtransaction_to_bytes: (a: number, b: number) => void;
22
- export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
23
- export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
24
- export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
25
- export const wrapdescriptor_descType: (a: number, b: number) => void;
26
- export const wrapdescriptor_encode: (a: number, b: number) => void;
27
- export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
28
- export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
29
- export const wrapdescriptor_hasWildcard: (a: number) => number;
30
- export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
31
- export const wrapdescriptor_node: (a: number, b: number) => void;
32
- export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
33
- export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
34
- export const wrapdescriptor_toString: (a: number, b: number) => void;
35
- export const wrapminiscript_encode: (a: number, b: number) => void;
36
- export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
37
- export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
38
- export const wrapminiscript_node: (a: number, b: number) => void;
39
- export const wrapminiscript_toAsmString: (a: number, b: number) => void;
40
- export const wrapminiscript_toString: (a: number, b: number) => void;
41
- export const wrappsbt_clone: (a: number) => number;
42
- export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
43
- export const wrappsbt_finalize: (a: number, b: number) => void;
44
- export const wrappsbt_serialize: (a: number, b: number) => void;
45
- export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
46
- export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
47
- export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
48
- export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
49
- export const __wbg_addressnamespace_free: (a: number, b: number) => void;
50
4
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
51
5
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
52
6
  export const __wbg_wasmbip32_free: (a: number, b: number) => void;
53
- export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
54
- export const __wbg_wasmecpair_free: (a: number, b: number) => void;
55
- export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
56
- export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
57
- export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
58
7
  export const bitgopsbt_add_input: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number, j: number, k: number) => void;
59
8
  export const bitgopsbt_add_output: (a: number, b: number, c: number, d: number, e: bigint) => void;
9
+ export const bitgopsbt_add_output_with_address: (a: number, b: number, c: number, d: number, e: bigint) => void;
60
10
  export const bitgopsbt_add_paygo_attestation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
61
11
  export const bitgopsbt_add_replay_protection_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number) => void;
62
12
  export const bitgopsbt_add_wallet_input: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number) => void;
@@ -85,6 +35,7 @@ export const bitgopsbt_version: (a: number) => number;
85
35
  export const bitgopsbt_version_group_id: (a: number) => number;
86
36
  export const fixedscriptwalletnamespace_address: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
87
37
  export const fixedscriptwalletnamespace_output_script: (a: number, b: number, c: number, d: number, e: number) => void;
38
+ export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
88
39
  export const wasmbip32_chain_code: (a: number) => number;
89
40
  export const wasmbip32_depth: (a: number) => number;
90
41
  export const wasmbip32_derive: (a: number, b: number, c: number) => void;
@@ -105,15 +56,9 @@ export const wasmbip32_private_key: (a: number) => number;
105
56
  export const wasmbip32_public_key: (a: number) => number;
106
57
  export const wasmbip32_to_base58: (a: number, b: number) => void;
107
58
  export const wasmbip32_to_wif: (a: number, b: number) => void;
108
- export const wasmdimensions_empty: () => number;
109
- export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
110
- export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number) => void;
111
- export const wasmdimensions_from_output_script: (a: number, b: number) => number;
112
- export const wasmdimensions_from_psbt: (a: number, b: number) => void;
113
- export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
114
- export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
115
- export const wasmdimensions_has_segwit: (a: number) => number;
116
- export const wasmdimensions_plus: (a: number, b: number) => number;
59
+ export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
60
+ export const __wbg_wasmecpair_free: (a: number, b: number) => void;
61
+ export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
117
62
  export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
118
63
  export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
119
64
  export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
@@ -124,12 +69,69 @@ export const wasmecpair_public_key: (a: number) => number;
124
69
  export const wasmecpair_to_wif: (a: number, b: number) => void;
125
70
  export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
126
71
  export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
72
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
73
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
74
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
75
+ export const __wbg_addressnamespace_free: (a: number, b: number) => void;
76
+ export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
77
+ export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
78
+ export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
79
+ export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
80
+ export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
81
+ export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
82
+ export const __wbg_wrappsbt_free: (a: number, b: number) => void;
83
+ export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
84
+ export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
85
+ export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
86
+ export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
87
+ export const wasmdimensions_empty: () => number;
88
+ export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
89
+ export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number) => void;
90
+ export const wasmdimensions_from_output_script: (a: number, b: number) => number;
91
+ export const wasmdimensions_from_psbt: (a: number, b: number) => void;
92
+ export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
93
+ export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
94
+ export const wasmdimensions_has_segwit: (a: number) => number;
95
+ export const wasmdimensions_plus: (a: number, b: number) => number;
96
+ export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
97
+ export const wasmtransaction_get_vsize: (a: number) => number;
98
+ export const wasmtransaction_to_bytes: (a: number, b: number) => void;
99
+ export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
100
+ export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
101
+ export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
102
+ export const wrapdescriptor_descType: (a: number, b: number) => void;
103
+ export const wrapdescriptor_encode: (a: number, b: number) => void;
104
+ export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
105
+ export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
106
+ export const wrapdescriptor_hasWildcard: (a: number) => number;
107
+ export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
108
+ export const wrapdescriptor_node: (a: number, b: number) => void;
109
+ export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
110
+ export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
111
+ export const wrapdescriptor_toString: (a: number, b: number) => void;
112
+ export const wrapminiscript_encode: (a: number, b: number) => void;
113
+ export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
114
+ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
115
+ export const wrapminiscript_node: (a: number, b: number) => void;
116
+ export const wrapminiscript_toAsmString: (a: number, b: number) => void;
117
+ export const wrapminiscript_toString: (a: number, b: number) => void;
118
+ export const wrappsbt_clone: (a: number) => number;
119
+ export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
120
+ export const wrappsbt_finalize: (a: number, b: number) => void;
121
+ export const wrappsbt_serialize: (a: number, b: number) => void;
122
+ export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
123
+ export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
124
+ export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
125
+ export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
126
+ export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
127
127
  export const wasmrootwalletkeys_backup_key: (a: number) => number;
128
128
  export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
129
129
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
130
130
  export const wasmrootwalletkeys_user_key: (a: number) => number;
131
131
  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;
132
- export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
132
+ export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
133
+ export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
134
+ export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
133
135
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
134
136
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
135
137
  export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
@@ -5,12 +5,13 @@ import { type BIP32Arg } from "../bip32.js";
5
5
  import { type ECPairArg } from "../ecpair.js";
6
6
  import type { UtxolibName } from "../utxolibCompat.js";
7
7
  import type { CoinName } from "../coinName.js";
8
+ import type { InputScriptType } from "./scriptType.js";
9
+ export type { InputScriptType };
8
10
  export type NetworkName = UtxolibName | CoinName;
9
11
  export type ScriptId = {
10
12
  chain: number;
11
13
  index: number;
12
14
  };
13
- export type InputScriptType = "p2shP2pk" | "p2sh" | "p2shP2wsh" | "p2wsh" | "p2trLegacy" | "p2trMusig2ScriptPath" | "p2trMusig2KeyPath";
14
15
  export type OutPoint = {
15
16
  txid: string;
16
17
  vout: number;
@@ -57,10 +58,13 @@ export type AddInputOptions = {
57
58
  prevTx?: Uint8Array;
58
59
  };
59
60
  export type AddOutputOptions = {
60
- /** Output script (scriptPubKey) */
61
61
  script: Uint8Array;
62
62
  /** Value in satoshis */
63
63
  value: bigint;
64
+ } | {
65
+ address: string;
66
+ /** Value in satoshis */
67
+ value: bigint;
64
68
  };
65
69
  /** Key identifier for signing ("user", "backup", or "bitgo") */
66
70
  export type SignerKey = "user" | "backup" | "bitgo";
@@ -146,15 +150,48 @@ export declare class BitGoPsbt {
146
150
  /**
147
151
  * Add an output to the PSBT
148
152
  *
149
- * @param options - Output options (script, value)
153
+ * @param script - The output script (scriptPubKey)
154
+ * @param value - Value in satoshis
155
+ * @returns The index of the newly added output
156
+ *
157
+ * @example
158
+ * ```typescript
159
+ * const outputIndex = psbt.addOutput(outputScript, 50000n);
160
+ * ```
161
+ */
162
+ addOutput(script: Uint8Array, value: bigint): number;
163
+ /**
164
+ * Add an output to the PSBT by address
165
+ *
166
+ * @param address - The destination address
167
+ * @param value - Value in satoshis
168
+ * @returns The index of the newly added output
169
+ *
170
+ * @example
171
+ * ```typescript
172
+ * const outputIndex = psbt.addOutput("bc1q...", 50000n);
173
+ * ```
174
+ */
175
+ addOutput(address: string, value: bigint): number;
176
+ /**
177
+ * Add an output to the PSBT
178
+ *
179
+ * @param options - Output options (script or address, and value)
150
180
  * @returns The index of the newly added output
151
181
  *
152
182
  * @example
153
183
  * ```typescript
184
+ * // Using script
154
185
  * const outputIndex = psbt.addOutput({
155
186
  * script: outputScript,
156
187
  * value: 50000n,
157
188
  * });
189
+ *
190
+ * // Using address
191
+ * const outputIndex = psbt.addOutput({
192
+ * address: "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4",
193
+ * value: 50000n,
194
+ * });
158
195
  * ```
159
196
  */
160
197
  addOutput(options: AddOutputOptions): number;
@@ -74,22 +74,24 @@ export class BitGoPsbt {
74
74
  addInput(options, script) {
75
75
  return this._wasm.add_input(options.txid, options.vout, options.value, script, options.sequence, options.prevTx);
76
76
  }
77
- /**
78
- * Add an output to the PSBT
79
- *
80
- * @param options - Output options (script, value)
81
- * @returns The index of the newly added output
82
- *
83
- * @example
84
- * ```typescript
85
- * const outputIndex = psbt.addOutput({
86
- * script: outputScript,
87
- * value: 50000n,
88
- * });
89
- * ```
90
- */
91
- addOutput(options) {
92
- return this._wasm.add_output(options.script, options.value);
77
+ addOutput(scriptOrOptions, value) {
78
+ if (scriptOrOptions instanceof Uint8Array || typeof scriptOrOptions === "string") {
79
+ if (value === undefined) {
80
+ throw new Error("Value is required when passing a script or address");
81
+ }
82
+ if (scriptOrOptions instanceof Uint8Array) {
83
+ return this._wasm.add_output(scriptOrOptions, value);
84
+ }
85
+ return this._wasm.add_output_with_address(scriptOrOptions, value);
86
+ }
87
+ const options = scriptOrOptions;
88
+ if ("script" in options) {
89
+ return this._wasm.add_output(options.script, options.value);
90
+ }
91
+ if ("address" in options) {
92
+ return this._wasm.add_output_with_address(options.address, options.value);
93
+ }
94
+ throw new Error("Invalid output options");
93
95
  }
94
96
  /**
95
97
  * Add a wallet input with full PSBT metadata
@@ -1,6 +1,35 @@
1
+ import type { CoinName } from "../coinName.js";
1
2
  export { RootWalletKeys, type WalletKeysArg, type IWalletKeys } from "./RootWalletKeys.js";
2
3
  export { ReplayProtection, type ReplayProtectionArg } from "./ReplayProtection.js";
3
4
  export { outputScript, address } from "./address.js";
4
5
  export { Dimensions } from "./Dimensions.js";
5
- export { BitGoPsbt, type NetworkName, type ScriptId, type InputScriptType, type ParsedInput, type ParsedOutput, type ParsedTransaction, type SignPath, type CreateEmptyOptions, type AddInputOptions, type AddOutputOptions, type AddWalletInputOptions, type AddWalletOutputOptions, } from "./BitGoPsbt.js";
6
+ export { type OutputScriptType, type InputScriptType, type ScriptType } from "./scriptType.js";
7
+ export { BitGoPsbt, type NetworkName, type ScriptId, type ParsedInput, type ParsedOutput, type ParsedTransaction, type SignPath, type CreateEmptyOptions, type AddInputOptions, type AddOutputOptions, type AddWalletInputOptions, type AddWalletOutputOptions, } from "./BitGoPsbt.js";
6
8
  export { ZcashBitGoPsbt, type ZcashNetworkName, type CreateEmptyZcashOptions, } from "./ZcashBitGoPsbt.js";
9
+ import type { ScriptType } from "./scriptType.js";
10
+ /**
11
+ * Check if a network supports a given fixed-script wallet script type
12
+ *
13
+ * @param coin - Coin name (e.g., "btc", "ltc", "doge")
14
+ * @param scriptType - Output script type or input script type to check
15
+ * @returns `true` if the network supports the script type, `false` otherwise
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * // Bitcoin supports all script types
20
+ * supportsScriptType("btc", "p2tr"); // true
21
+ *
22
+ * // Litecoin supports segwit but not taproot
23
+ * supportsScriptType("ltc", "p2wsh"); // true
24
+ * supportsScriptType("ltc", "p2tr"); // false
25
+ *
26
+ * // Dogecoin only supports legacy scripts
27
+ * supportsScriptType("doge", "p2sh"); // true
28
+ * supportsScriptType("doge", "p2wsh"); // false
29
+ *
30
+ * // Also works with input script types
31
+ * supportsScriptType("btc", "p2trMusig2KeyPath"); // true
32
+ * supportsScriptType("doge", "p2trLegacy"); // false
33
+ * ```
34
+ */
35
+ export declare function supportsScriptType(coin: CoinName, scriptType: ScriptType): boolean;
@@ -1,3 +1,4 @@
1
+ import { FixedScriptWalletNamespace } from "../wasm/wasm_utxo.js";
1
2
  export { RootWalletKeys } from "./RootWalletKeys.js";
2
3
  export { ReplayProtection } from "./ReplayProtection.js";
3
4
  export { outputScript, address } from "./address.js";
@@ -6,3 +7,31 @@ export { Dimensions } from "./Dimensions.js";
6
7
  export { BitGoPsbt, } from "./BitGoPsbt.js";
7
8
  // Zcash-specific PSBT subclass
8
9
  export { ZcashBitGoPsbt, } from "./ZcashBitGoPsbt.js";
10
+ /**
11
+ * Check if a network supports a given fixed-script wallet script type
12
+ *
13
+ * @param coin - Coin name (e.g., "btc", "ltc", "doge")
14
+ * @param scriptType - Output script type or input script type to check
15
+ * @returns `true` if the network supports the script type, `false` otherwise
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * // Bitcoin supports all script types
20
+ * supportsScriptType("btc", "p2tr"); // true
21
+ *
22
+ * // Litecoin supports segwit but not taproot
23
+ * supportsScriptType("ltc", "p2wsh"); // true
24
+ * supportsScriptType("ltc", "p2tr"); // false
25
+ *
26
+ * // Dogecoin only supports legacy scripts
27
+ * supportsScriptType("doge", "p2sh"); // true
28
+ * supportsScriptType("doge", "p2wsh"); // false
29
+ *
30
+ * // Also works with input script types
31
+ * supportsScriptType("btc", "p2trMusig2KeyPath"); // true
32
+ * supportsScriptType("doge", "p2trLegacy"); // false
33
+ * ```
34
+ */
35
+ export function supportsScriptType(coin, scriptType) {
36
+ return FixedScriptWalletNamespace.supports_script_type(coin, scriptType);
37
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Fixed-script wallet output script types (2-of-3 multisig)
3
+ *
4
+ * This type represents the abstract script type, independent of chain (external/internal).
5
+ * Use this for checking network support or when you need the script type without derivation info.
6
+ */
7
+ export type OutputScriptType = "p2sh" | "p2shP2wsh" | "p2wsh" | "p2tr" | "p2trLegacy" | "p2trMusig2";
8
+ /**
9
+ * Input script types for fixed-script wallets
10
+ *
11
+ * These are more specific than output types and include single-sig and taproot variants.
12
+ */
13
+ export type InputScriptType = "p2shP2pk" | "p2sh" | "p2shP2wsh" | "p2wsh" | "p2trLegacy" | "p2trMusig2ScriptPath" | "p2trMusig2KeyPath";
14
+ /**
15
+ * Union of all script types that can be checked for network support
16
+ */
17
+ export type ScriptType = OutputScriptType | InputScriptType;
@@ -0,0 +1 @@
1
+ export {};
@@ -225,6 +225,17 @@ export class BitGoPsbt {
225
225
  * generated for security. Custom session_id is only allowed on testnets for testing purposes.
226
226
  */
227
227
  generate_musig2_nonces(xpriv: WasmBIP32, session_id_bytes?: Uint8Array | null): void;
228
+ /**
229
+ * Add an output to the PSBT by address
230
+ *
231
+ * # Arguments
232
+ * * `address` - The destination address
233
+ * * `value` - The value in satoshis
234
+ *
235
+ * # Returns
236
+ * The index of the newly added output
237
+ */
238
+ add_output_with_address(address: string, value: bigint): number;
228
239
  /**
229
240
  * Verify if a valid signature exists for a given ECPair key at the specified input index
230
241
  *
@@ -368,6 +379,22 @@ export class FixedScriptWalletNamespace {
368
379
  free(): void;
369
380
  [Symbol.dispose](): void;
370
381
  static output_script(keys: WasmRootWalletKeys, chain: number, index: number, network: any): Uint8Array;
382
+ /**
383
+ * Check if a network supports a given fixed-script wallet script type
384
+ *
385
+ * # Arguments
386
+ * * `coin` - Coin name (e.g., "btc", "ltc", "doge")
387
+ * * `script_type` - Script type name: "p2sh", "p2shP2wsh", "p2wsh", "p2tr", "p2trMusig2"
388
+ *
389
+ * # Returns
390
+ * `true` if the network supports the script type, `false` otherwise
391
+ *
392
+ * # Examples
393
+ * - Bitcoin supports all script types (p2sh, p2shP2wsh, p2wsh, p2tr, p2trMusig2)
394
+ * - Litecoin supports segwit but not taproot (p2sh, p2shP2wsh, p2wsh)
395
+ * - Dogecoin only supports legacy scripts (p2sh)
396
+ */
397
+ static supports_script_type(coin: string, script_type: string): boolean;
371
398
  static address(keys: WasmRootWalletKeys, chain: number, index: number, network: any, address_format?: string | null): string;
372
399
  }
373
400
 
@@ -808,6 +808,36 @@ export class BitGoPsbt {
808
808
  wasm.__wbindgen_add_to_stack_pointer(16);
809
809
  }
810
810
  }
811
+ /**
812
+ * Add an output to the PSBT by address
813
+ *
814
+ * # Arguments
815
+ * * `address` - The destination address
816
+ * * `value` - The value in satoshis
817
+ *
818
+ * # Returns
819
+ * The index of the newly added output
820
+ * @param {string} address
821
+ * @param {bigint} value
822
+ * @returns {number}
823
+ */
824
+ add_output_with_address(address, value) {
825
+ try {
826
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
827
+ const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
828
+ const len0 = WASM_VECTOR_LEN;
829
+ wasm.bitgopsbt_add_output_with_address(retptr, this.__wbg_ptr, ptr0, len0, value);
830
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
831
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
832
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
833
+ if (r2) {
834
+ throw takeObject(r1);
835
+ }
836
+ return r0 >>> 0;
837
+ } finally {
838
+ wasm.__wbindgen_add_to_stack_pointer(16);
839
+ }
840
+ }
811
841
  /**
812
842
  * Verify if a valid signature exists for a given ECPair key at the specified input index
813
843
  *
@@ -1197,6 +1227,43 @@ export class FixedScriptWalletNamespace {
1197
1227
  wasm.__wbindgen_add_to_stack_pointer(16);
1198
1228
  }
1199
1229
  }
1230
+ /**
1231
+ * Check if a network supports a given fixed-script wallet script type
1232
+ *
1233
+ * # Arguments
1234
+ * * `coin` - Coin name (e.g., "btc", "ltc", "doge")
1235
+ * * `script_type` - Script type name: "p2sh", "p2shP2wsh", "p2wsh", "p2tr", "p2trMusig2"
1236
+ *
1237
+ * # Returns
1238
+ * `true` if the network supports the script type, `false` otherwise
1239
+ *
1240
+ * # Examples
1241
+ * - Bitcoin supports all script types (p2sh, p2shP2wsh, p2wsh, p2tr, p2trMusig2)
1242
+ * - Litecoin supports segwit but not taproot (p2sh, p2shP2wsh, p2wsh)
1243
+ * - Dogecoin only supports legacy scripts (p2sh)
1244
+ * @param {string} coin
1245
+ * @param {string} script_type
1246
+ * @returns {boolean}
1247
+ */
1248
+ static supports_script_type(coin, script_type) {
1249
+ try {
1250
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1251
+ const ptr0 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1252
+ const len0 = WASM_VECTOR_LEN;
1253
+ const ptr1 = passStringToWasm0(script_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1254
+ const len1 = WASM_VECTOR_LEN;
1255
+ wasm.fixedscriptwalletnamespace_supports_script_type(retptr, ptr0, len0, ptr1, len1);
1256
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1257
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1258
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1259
+ if (r2) {
1260
+ throw takeObject(r1);
1261
+ }
1262
+ return r0 !== 0;
1263
+ } finally {
1264
+ wasm.__wbindgen_add_to_stack_pointer(16);
1265
+ }
1266
+ }
1200
1267
  /**
1201
1268
  * @param {WasmRootWalletKeys} keys
1202
1269
  * @param {number} chain
Binary file
@@ -1,62 +1,12 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
5
- export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
6
- export const __wbg_wasmreplayprotection_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 utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
13
- export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => 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 wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
17
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
18
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
19
- export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
20
- export const wasmtransaction_get_vsize: (a: number) => number;
21
- export const wasmtransaction_to_bytes: (a: number, b: number) => void;
22
- export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
23
- export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
24
- export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
25
- export const wrapdescriptor_descType: (a: number, b: number) => void;
26
- export const wrapdescriptor_encode: (a: number, b: number) => void;
27
- export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
28
- export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
29
- export const wrapdescriptor_hasWildcard: (a: number) => number;
30
- export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
31
- export const wrapdescriptor_node: (a: number, b: number) => void;
32
- export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
33
- export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
34
- export const wrapdescriptor_toString: (a: number, b: number) => void;
35
- export const wrapminiscript_encode: (a: number, b: number) => void;
36
- export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
37
- export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
38
- export const wrapminiscript_node: (a: number, b: number) => void;
39
- export const wrapminiscript_toAsmString: (a: number, b: number) => void;
40
- export const wrapminiscript_toString: (a: number, b: number) => void;
41
- export const wrappsbt_clone: (a: number) => number;
42
- export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
43
- export const wrappsbt_finalize: (a: number, b: number) => void;
44
- export const wrappsbt_serialize: (a: number, b: number) => void;
45
- export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
46
- export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
47
- export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
48
- export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
49
- export const __wbg_addressnamespace_free: (a: number, b: number) => void;
50
4
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
51
5
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
52
6
  export const __wbg_wasmbip32_free: (a: number, b: number) => void;
53
- export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
54
- export const __wbg_wasmecpair_free: (a: number, b: number) => void;
55
- export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
56
- export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
57
- export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
58
7
  export const bitgopsbt_add_input: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number, j: number, k: number) => void;
59
8
  export const bitgopsbt_add_output: (a: number, b: number, c: number, d: number, e: bigint) => void;
9
+ export const bitgopsbt_add_output_with_address: (a: number, b: number, c: number, d: number, e: bigint) => void;
60
10
  export const bitgopsbt_add_paygo_attestation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
61
11
  export const bitgopsbt_add_replay_protection_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number) => void;
62
12
  export const bitgopsbt_add_wallet_input: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number) => void;
@@ -85,6 +35,7 @@ export const bitgopsbt_version: (a: number) => number;
85
35
  export const bitgopsbt_version_group_id: (a: number) => number;
86
36
  export const fixedscriptwalletnamespace_address: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
87
37
  export const fixedscriptwalletnamespace_output_script: (a: number, b: number, c: number, d: number, e: number) => void;
38
+ export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
88
39
  export const wasmbip32_chain_code: (a: number) => number;
89
40
  export const wasmbip32_depth: (a: number) => number;
90
41
  export const wasmbip32_derive: (a: number, b: number, c: number) => void;
@@ -105,15 +56,9 @@ export const wasmbip32_private_key: (a: number) => number;
105
56
  export const wasmbip32_public_key: (a: number) => number;
106
57
  export const wasmbip32_to_base58: (a: number, b: number) => void;
107
58
  export const wasmbip32_to_wif: (a: number, b: number) => void;
108
- export const wasmdimensions_empty: () => number;
109
- export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
110
- export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number) => void;
111
- export const wasmdimensions_from_output_script: (a: number, b: number) => number;
112
- export const wasmdimensions_from_psbt: (a: number, b: number) => void;
113
- export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
114
- export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
115
- export const wasmdimensions_has_segwit: (a: number) => number;
116
- export const wasmdimensions_plus: (a: number, b: number) => number;
59
+ export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
60
+ export const __wbg_wasmecpair_free: (a: number, b: number) => void;
61
+ export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
117
62
  export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
118
63
  export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
119
64
  export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
@@ -124,12 +69,69 @@ export const wasmecpair_public_key: (a: number) => number;
124
69
  export const wasmecpair_to_wif: (a: number, b: number) => void;
125
70
  export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
126
71
  export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
72
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
73
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
74
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
75
+ export const __wbg_addressnamespace_free: (a: number, b: number) => void;
76
+ export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
77
+ export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
78
+ export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
79
+ export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
80
+ export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
81
+ export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
82
+ export const __wbg_wrappsbt_free: (a: number, b: number) => void;
83
+ export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
84
+ export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
85
+ export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
86
+ export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
87
+ export const wasmdimensions_empty: () => number;
88
+ export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
89
+ export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number) => void;
90
+ export const wasmdimensions_from_output_script: (a: number, b: number) => number;
91
+ export const wasmdimensions_from_psbt: (a: number, b: number) => void;
92
+ export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
93
+ export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
94
+ export const wasmdimensions_has_segwit: (a: number) => number;
95
+ export const wasmdimensions_plus: (a: number, b: number) => number;
96
+ export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
97
+ export const wasmtransaction_get_vsize: (a: number) => number;
98
+ export const wasmtransaction_to_bytes: (a: number, b: number) => void;
99
+ export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
100
+ export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
101
+ export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
102
+ export const wrapdescriptor_descType: (a: number, b: number) => void;
103
+ export const wrapdescriptor_encode: (a: number, b: number) => void;
104
+ export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
105
+ export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
106
+ export const wrapdescriptor_hasWildcard: (a: number) => number;
107
+ export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
108
+ export const wrapdescriptor_node: (a: number, b: number) => void;
109
+ export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
110
+ export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
111
+ export const wrapdescriptor_toString: (a: number, b: number) => void;
112
+ export const wrapminiscript_encode: (a: number, b: number) => void;
113
+ export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
114
+ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
115
+ export const wrapminiscript_node: (a: number, b: number) => void;
116
+ export const wrapminiscript_toAsmString: (a: number, b: number) => void;
117
+ export const wrapminiscript_toString: (a: number, b: number) => void;
118
+ export const wrappsbt_clone: (a: number) => number;
119
+ export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
120
+ export const wrappsbt_finalize: (a: number, b: number) => void;
121
+ export const wrappsbt_serialize: (a: number, b: number) => void;
122
+ export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
123
+ export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
124
+ export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
125
+ export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
126
+ export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
127
127
  export const wasmrootwalletkeys_backup_key: (a: number) => number;
128
128
  export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
129
129
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
130
130
  export const wasmrootwalletkeys_user_key: (a: number) => number;
131
131
  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;
132
- export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
132
+ export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
133
+ export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
134
+ export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
133
135
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
134
136
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
135
137
  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.19.0",
4
+ "version": "1.21.0",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",