@bitgo/wasm-utxo 2.0.0 → 3.0.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.
Files changed (43) hide show
  1. package/dist/cjs/js/coinName.d.ts +3 -0
  2. package/dist/cjs/js/coinName.js +49 -0
  3. package/dist/cjs/js/descriptorWallet/Psbt.d.ts +49 -0
  4. package/dist/cjs/js/descriptorWallet/Psbt.js +126 -0
  5. package/dist/cjs/js/descriptorWallet/index.d.ts +1 -0
  6. package/dist/cjs/js/descriptorWallet/index.js +4 -0
  7. package/dist/cjs/js/fixedScriptWallet/BitGoPsbt.d.ts +17 -2
  8. package/dist/cjs/js/fixedScriptWallet/BitGoPsbt.js +22 -0
  9. package/dist/cjs/js/fixedScriptWallet/RootWalletKeys.d.ts +5 -0
  10. package/dist/cjs/js/fixedScriptWallet/RootWalletKeys.js +7 -0
  11. package/dist/cjs/js/fixedScriptWallet/index.d.ts +1 -1
  12. package/dist/cjs/js/fixedScriptWallet/index.js +2 -1
  13. package/dist/cjs/js/index.d.ts +1 -30
  14. package/dist/cjs/js/index.js +2 -2
  15. package/dist/cjs/js/psbt.d.ts +2 -0
  16. package/dist/cjs/js/testutils/AcidTest.d.ts +3 -3
  17. package/dist/cjs/js/testutils/AcidTest.js +79 -80
  18. package/dist/cjs/js/wasm/wasm_utxo.d.ts +34 -103
  19. package/dist/cjs/js/wasm/wasm_utxo.js +99 -93
  20. package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
  21. package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +73 -70
  22. package/dist/esm/js/coinName.d.ts +3 -0
  23. package/dist/esm/js/coinName.js +48 -0
  24. package/dist/esm/js/descriptorWallet/Psbt.d.ts +49 -0
  25. package/dist/esm/js/descriptorWallet/Psbt.js +122 -0
  26. package/dist/esm/js/descriptorWallet/index.d.ts +1 -0
  27. package/dist/esm/js/descriptorWallet/index.js +2 -0
  28. package/dist/esm/js/fixedScriptWallet/BitGoPsbt.d.ts +17 -2
  29. package/dist/esm/js/fixedScriptWallet/BitGoPsbt.js +22 -1
  30. package/dist/esm/js/fixedScriptWallet/RootWalletKeys.d.ts +5 -0
  31. package/dist/esm/js/fixedScriptWallet/RootWalletKeys.js +7 -0
  32. package/dist/esm/js/fixedScriptWallet/index.d.ts +1 -1
  33. package/dist/esm/js/fixedScriptWallet/index.js +1 -1
  34. package/dist/esm/js/index.d.ts +1 -30
  35. package/dist/esm/js/index.js +1 -1
  36. package/dist/esm/js/psbt.d.ts +2 -0
  37. package/dist/esm/js/testutils/AcidTest.d.ts +3 -3
  38. package/dist/esm/js/testutils/AcidTest.js +80 -81
  39. package/dist/esm/js/wasm/wasm_utxo.d.ts +34 -103
  40. package/dist/esm/js/wasm/wasm_utxo_bg.js +99 -93
  41. package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
  42. package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +73 -70
  43. package/package.json +1 -1
@@ -4,3 +4,6 @@ export declare function getMainnet(name: CoinName): CoinName;
4
4
  export declare function isMainnet(name: CoinName): boolean;
5
5
  export declare function isTestnet(name: CoinName): boolean;
6
6
  export declare function isCoinName(v: string): v is CoinName;
7
+ import type { UtxolibName } from "./utxolibCompat.js";
8
+ /** Convert a CoinName or UtxolibName to CoinName */
9
+ export declare function toCoinName(name: CoinName | UtxolibName): CoinName;
@@ -5,6 +5,7 @@ exports.getMainnet = getMainnet;
5
5
  exports.isMainnet = isMainnet;
6
6
  exports.isTestnet = isTestnet;
7
7
  exports.isCoinName = isCoinName;
8
+ exports.toCoinName = toCoinName;
8
9
  // BitGo coin names (from Network::from_coin_name in src/networks.rs)
9
10
  exports.coinNames = [
10
11
  "btc",
@@ -65,3 +66,51 @@ function isTestnet(name) {
65
66
  function isCoinName(v) {
66
67
  return exports.coinNames.includes(v);
67
68
  }
69
+ /** Convert a CoinName or UtxolibName to CoinName */
70
+ function toCoinName(name) {
71
+ switch (name) {
72
+ case "bitcoin":
73
+ return "btc";
74
+ case "testnet":
75
+ return "tbtc";
76
+ case "bitcoinTestnet4":
77
+ return "tbtc4";
78
+ case "bitcoinPublicSignet":
79
+ return "tbtcsig";
80
+ case "bitcoinBitGoSignet":
81
+ return "tbtcbgsig";
82
+ case "bitcoincash":
83
+ return "bch";
84
+ case "bitcoincashTestnet":
85
+ return "tbch";
86
+ case "ecash":
87
+ return "bcha";
88
+ case "ecashTest":
89
+ return "tbcha";
90
+ case "bitcoingold":
91
+ return "btg";
92
+ case "bitcoingoldTestnet":
93
+ return "tbtg";
94
+ case "bitcoinsv":
95
+ return "bsv";
96
+ case "bitcoinsvTestnet":
97
+ return "tbsv";
98
+ case "dashTest":
99
+ return "tdash";
100
+ case "dogecoin":
101
+ return "doge";
102
+ case "dogecoinTest":
103
+ return "tdoge";
104
+ case "litecoin":
105
+ return "ltc";
106
+ case "litecoinTest":
107
+ return "tltc";
108
+ case "zcash":
109
+ return "zec";
110
+ case "zcashTest":
111
+ return "tzec";
112
+ default:
113
+ // CoinName values pass through (including "dash" which is both CoinName and UtxolibName)
114
+ return name;
115
+ }
116
+ }
@@ -0,0 +1,49 @@
1
+ import { WrapPsbt as WasmPsbt, type WasmBIP32, type WasmECPair, type WrapDescriptor, type PsbtInputData, type PsbtOutputData, type PsbtOutputDataWithAddress } from "../wasm/wasm_utxo.js";
2
+ import type { IPsbt } from "../psbt.js";
3
+ import type { CoinName } from "../coinName.js";
4
+ import type { BIP32 } from "../bip32.js";
5
+ import { Transaction } from "../transaction.js";
6
+ export type SignPsbtResult = {
7
+ [inputIndex: number]: [pubkey: string][];
8
+ };
9
+ export declare class Psbt implements IPsbt {
10
+ private _wasm;
11
+ constructor(versionOrWasm?: number | WasmPsbt, lockTime?: number);
12
+ /** @internal Access the underlying WASM instance */
13
+ get wasm(): WasmPsbt;
14
+ static create(version?: number, lockTime?: number): Psbt;
15
+ static deserialize(bytes: Uint8Array): Psbt;
16
+ serialize(): Uint8Array;
17
+ clone(): Psbt;
18
+ inputCount(): number;
19
+ outputCount(): number;
20
+ version(): number;
21
+ lockTime(): number;
22
+ unsignedTxId(): string;
23
+ getInputs(): PsbtInputData[];
24
+ getOutputs(): PsbtOutputData[];
25
+ getGlobalXpubs(): BIP32[];
26
+ getOutputsWithAddress(coin: CoinName): PsbtOutputDataWithAddress[];
27
+ addInputAtIndex(index: number, txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number): number;
28
+ addInput(txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number): number;
29
+ addOutputAtIndex(index: number, script: Uint8Array, value: bigint): number;
30
+ addOutput(script: Uint8Array, value: bigint): number;
31
+ removeInput(index: number): void;
32
+ removeOutput(index: number): void;
33
+ updateInputWithDescriptor(inputIndex: number, descriptor: WrapDescriptor): void;
34
+ updateOutputWithDescriptor(outputIndex: number, descriptor: WrapDescriptor): void;
35
+ signWithXprv(xprv: string): SignPsbtResult;
36
+ signWithPrv(prv: Uint8Array): SignPsbtResult;
37
+ signAll(key: WasmBIP32): SignPsbtResult;
38
+ signAllWithEcpair(key: WasmECPair): SignPsbtResult;
39
+ getPartialSignatures(inputIndex: number): Array<{
40
+ pubkey: Uint8Array;
41
+ signature: Uint8Array;
42
+ }>;
43
+ hasPartialSignatures(inputIndex: number): boolean;
44
+ validateSignatureAtInput(inputIndex: number, pubkey: Uint8Array): boolean;
45
+ verifySignatureWithKey(inputIndex: number, key: WasmBIP32): boolean;
46
+ getUnsignedTx(): Uint8Array;
47
+ finalize(): void;
48
+ extractTransaction(): Transaction;
49
+ }
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Psbt = void 0;
4
+ const wasm_utxo_js_1 = require("../wasm/wasm_utxo.js");
5
+ const transaction_js_1 = require("../transaction.js");
6
+ class Psbt {
7
+ _wasm;
8
+ constructor(versionOrWasm, lockTime) {
9
+ if (versionOrWasm instanceof wasm_utxo_js_1.WrapPsbt) {
10
+ this._wasm = versionOrWasm;
11
+ }
12
+ else {
13
+ this._wasm = new wasm_utxo_js_1.WrapPsbt(versionOrWasm, lockTime);
14
+ }
15
+ }
16
+ /** @internal Access the underlying WASM instance */
17
+ get wasm() {
18
+ return this._wasm;
19
+ }
20
+ // -- Static / Factory --
21
+ static create(version, lockTime) {
22
+ return new Psbt(new wasm_utxo_js_1.WrapPsbt(version, lockTime));
23
+ }
24
+ static deserialize(bytes) {
25
+ return new Psbt(wasm_utxo_js_1.WrapPsbt.deserialize(bytes));
26
+ }
27
+ // -- Serialization --
28
+ serialize() {
29
+ return this._wasm.serialize();
30
+ }
31
+ clone() {
32
+ return new Psbt(this._wasm.clone());
33
+ }
34
+ // -- IPsbt: introspection --
35
+ inputCount() {
36
+ return this._wasm.input_count();
37
+ }
38
+ outputCount() {
39
+ return this._wasm.output_count();
40
+ }
41
+ version() {
42
+ return this._wasm.version();
43
+ }
44
+ lockTime() {
45
+ return this._wasm.lock_time();
46
+ }
47
+ unsignedTxId() {
48
+ return this._wasm.unsigned_tx_id();
49
+ }
50
+ getInputs() {
51
+ return this._wasm.get_inputs();
52
+ }
53
+ getOutputs() {
54
+ return this._wasm.get_outputs();
55
+ }
56
+ getGlobalXpubs() {
57
+ return this._wasm.get_global_xpubs();
58
+ }
59
+ getOutputsWithAddress(coin) {
60
+ return this._wasm.get_outputs_with_address(coin);
61
+ }
62
+ // -- IPsbt: mutation --
63
+ addInputAtIndex(index, txid, vout, value, script, sequence) {
64
+ return this._wasm.add_input_at_index(index, txid, vout, value, script, sequence);
65
+ }
66
+ addInput(txid, vout, value, script, sequence) {
67
+ return this._wasm.add_input(txid, vout, value, script, sequence);
68
+ }
69
+ addOutputAtIndex(index, script, value) {
70
+ return this._wasm.add_output_at_index(index, script, value);
71
+ }
72
+ addOutput(script, value) {
73
+ return this._wasm.add_output(script, value);
74
+ }
75
+ removeInput(index) {
76
+ this._wasm.remove_input(index);
77
+ }
78
+ removeOutput(index) {
79
+ this._wasm.remove_output(index);
80
+ }
81
+ // -- Descriptor updates --
82
+ updateInputWithDescriptor(inputIndex, descriptor) {
83
+ this._wasm.update_input_with_descriptor(inputIndex, descriptor);
84
+ }
85
+ updateOutputWithDescriptor(outputIndex, descriptor) {
86
+ this._wasm.update_output_with_descriptor(outputIndex, descriptor);
87
+ }
88
+ // -- Signing --
89
+ signWithXprv(xprv) {
90
+ return this._wasm.sign_with_xprv(xprv);
91
+ }
92
+ signWithPrv(prv) {
93
+ return this._wasm.sign_with_prv(prv);
94
+ }
95
+ signAll(key) {
96
+ return this._wasm.sign_all(key);
97
+ }
98
+ signAllWithEcpair(key) {
99
+ return this._wasm.sign_all_with_ecpair(key);
100
+ }
101
+ // -- Signature introspection --
102
+ getPartialSignatures(inputIndex) {
103
+ return this._wasm.get_partial_signatures(inputIndex);
104
+ }
105
+ hasPartialSignatures(inputIndex) {
106
+ return this._wasm.has_partial_signatures(inputIndex);
107
+ }
108
+ // -- Validation --
109
+ validateSignatureAtInput(inputIndex, pubkey) {
110
+ return this._wasm.validate_signature_at_input(inputIndex, pubkey);
111
+ }
112
+ verifySignatureWithKey(inputIndex, key) {
113
+ return this._wasm.verify_signature_with_key(inputIndex, key);
114
+ }
115
+ // -- Transaction extraction --
116
+ getUnsignedTx() {
117
+ return this._wasm.get_unsigned_tx();
118
+ }
119
+ finalize() {
120
+ this._wasm.finalize_mut();
121
+ }
122
+ extractTransaction() {
123
+ return transaction_js_1.Transaction.fromWasm(this._wasm.extract_transaction());
124
+ }
125
+ }
126
+ exports.Psbt = Psbt;
@@ -40,4 +40,5 @@ export * from "./DescriptorOutput.js";
40
40
  export * from "./address.js";
41
41
  export * from "./VirtualSize.js";
42
42
  export * from "./psbt/index.js";
43
+ export { Psbt, type SignPsbtResult } from "./Psbt.js";
43
44
  export * from "./parse/PatternMatcher.js";
@@ -49,6 +49,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
49
49
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
50
50
  };
51
51
  Object.defineProperty(exports, "__esModule", { value: true });
52
+ exports.Psbt = void 0;
52
53
  // Core types and utilities
53
54
  __exportStar(require("./Output.js"), exports);
54
55
  __exportStar(require("./DescriptorMap.js"), exports);
@@ -58,5 +59,8 @@ __exportStar(require("./address.js"), exports);
58
59
  __exportStar(require("./VirtualSize.js"), exports);
59
60
  // PSBT utilities
60
61
  __exportStar(require("./psbt/index.js"), exports);
62
+ // PSBT wrapper
63
+ var Psbt_js_1 = require("./Psbt.js");
64
+ Object.defineProperty(exports, "Psbt", { enumerable: true, get: function () { return Psbt_js_1.Psbt; } });
61
65
  // Pattern matching
62
66
  __exportStar(require("./parse/PatternMatcher.js"), exports);
@@ -1,8 +1,8 @@
1
1
  import { BitGoPsbt as WasmBitGoPsbt, type PsbtInputData, type PsbtOutputData, type PsbtOutputDataWithAddress } from "../wasm/wasm_utxo.js";
2
2
  import type { IPsbtWithAddress } from "../psbt.js";
3
- import { type WalletKeysArg } from "./RootWalletKeys.js";
3
+ import { type WalletKeysArg, RootWalletKeys } from "./RootWalletKeys.js";
4
4
  import { type ReplayProtectionArg } from "./ReplayProtection.js";
5
- import { type BIP32Arg } from "../bip32.js";
5
+ import { type BIP32Arg, BIP32 } from "../bip32.js";
6
6
  import { type ECPairArg } from "../ecpair.js";
7
7
  import type { UtxolibName } from "../utxolibCompat.js";
8
8
  import type { CoinName } from "../coinName.js";
@@ -595,4 +595,19 @@ export declare class BitGoPsbt implements IPsbtWithAddress {
595
595
  * ```
596
596
  */
597
597
  getOutputsWithAddress(): PsbtOutputDataWithAddress[];
598
+ /**
599
+ * Returns the unordered global xpubs from this PSBT as BIP32 instances.
600
+ */
601
+ getGlobalXpubs(): BIP32[];
598
602
  }
603
+ /**
604
+ * Extract sorted wallet keys from a PSBT's global xpub fields.
605
+ *
606
+ * This should only be used in exceptional circumstances where the real wallet
607
+ * keys are not available — for example, legacy cold wallets where the PSBT
608
+ * was built with derived keys (from coldDerivationSeed) but the caller only
609
+ * has root xpubs. Prefer passing wallet keys explicitly wherever possible.
610
+ *
611
+ * @returns Sorted [user, backup, bitgo] RootWalletKeys
612
+ */
613
+ export declare function getWalletKeysFromPsbt(psbt: BitGoPsbt, xpubs: BIP32[]): RootWalletKeys;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BitGoPsbt = void 0;
4
+ exports.getWalletKeysFromPsbt = getWalletKeysFromPsbt;
4
5
  const wasm_utxo_js_1 = require("../wasm/wasm_utxo.js");
5
6
  const RootWalletKeys_js_1 = require("./RootWalletKeys.js");
6
7
  const ReplayProtection_js_1 = require("./ReplayProtection.js");
@@ -610,5 +611,26 @@ class BitGoPsbt {
610
611
  getOutputsWithAddress() {
611
612
  return this._wasm.get_outputs_with_address();
612
613
  }
614
+ /**
615
+ * Returns the unordered global xpubs from this PSBT as BIP32 instances.
616
+ */
617
+ getGlobalXpubs() {
618
+ const result = this._wasm.get_global_xpubs();
619
+ return result.map((w) => bip32_js_1.BIP32.fromWasm(w));
620
+ }
613
621
  }
614
622
  exports.BitGoPsbt = BitGoPsbt;
623
+ /**
624
+ * Extract sorted wallet keys from a PSBT's global xpub fields.
625
+ *
626
+ * This should only be used in exceptional circumstances where the real wallet
627
+ * keys are not available — for example, legacy cold wallets where the PSBT
628
+ * was built with derived keys (from coldDerivationSeed) but the caller only
629
+ * has root xpubs. Prefer passing wallet keys explicitly wherever possible.
630
+ *
631
+ * @returns Sorted [user, backup, bitgo] RootWalletKeys
632
+ */
633
+ function getWalletKeysFromPsbt(psbt, xpubs) {
634
+ const wasmKeys = wasm_utxo_js_1.FixedScriptWalletNamespace.to_wallet_keys(psbt.wasm, xpubs[0].wasm, xpubs[1].wasm, xpubs[2].wasm);
635
+ return RootWalletKeys_js_1.RootWalletKeys.fromWasm(wasmKeys);
636
+ }
@@ -23,6 +23,11 @@ Triple<string>
23
23
  export declare class RootWalletKeys {
24
24
  private _wasm;
25
25
  private constructor();
26
+ /**
27
+ * Create a RootWalletKeys instance from a WasmRootWalletKeys instance (internal use)
28
+ * @internal
29
+ */
30
+ static fromWasm(wasm: WasmRootWalletKeys): RootWalletKeys;
26
31
  /**
27
32
  * Create a RootWalletKeys from various input formats
28
33
  * @param keys - Can be a triple of xpub strings, an IWalletKeys object, or another RootWalletKeys instance
@@ -35,6 +35,13 @@ class RootWalletKeys {
35
35
  constructor(_wasm) {
36
36
  this._wasm = _wasm;
37
37
  }
38
+ /**
39
+ * Create a RootWalletKeys instance from a WasmRootWalletKeys instance (internal use)
40
+ * @internal
41
+ */
42
+ static fromWasm(wasm) {
43
+ return new RootWalletKeys(wasm);
44
+ }
38
45
  /**
39
46
  * Create a RootWalletKeys from various input formats
40
47
  * @param keys - Can be a triple of xpub strings, an IWalletKeys object, or another RootWalletKeys instance
@@ -5,7 +5,7 @@ export { outputScript, address } from "./address.js";
5
5
  export { Dimensions } from "./Dimensions.js";
6
6
  export { outputScriptTypes, inputScriptTypes, type OutputScriptType, type InputScriptType, type ScriptType, } from "./scriptType.js";
7
7
  export { ChainCode, chainCodes, assertChainCode, type Scope } from "./chains.js";
8
- export { BitGoPsbt, type NetworkName, type ScriptId, type ParsedInput, type ParsedOutput, type ParsedTransaction, type SignPath, type CreateEmptyOptions, type AddInputOptions, type AddOutputOptions, type AddWalletInputOptions, type AddWalletOutputOptions, type ParseTransactionOptions, type ParseOutputsOptions, } from "./BitGoPsbt.js";
8
+ export { BitGoPsbt, getWalletKeysFromPsbt, type NetworkName, type ScriptId, type ParsedInput, type ParsedOutput, type ParsedTransaction, type SignPath, type CreateEmptyOptions, type AddInputOptions, type AddOutputOptions, type AddWalletInputOptions, type AddWalletOutputOptions, type ParseTransactionOptions, type ParseOutputsOptions, } from "./BitGoPsbt.js";
9
9
  export { ZcashBitGoPsbt, type ZcashNetworkName, type CreateEmptyZcashOptions, } from "./ZcashBitGoPsbt.js";
10
10
  export type { PsbtBip32Derivation, PsbtInputData, PsbtOutputData, PsbtOutputDataWithAddress, PsbtWitnessUtxo, } from "../wasm/wasm_utxo.js";
11
11
  import type { ScriptType } from "./scriptType.js";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ZcashBitGoPsbt = exports.BitGoPsbt = exports.assertChainCode = exports.chainCodes = exports.ChainCode = exports.inputScriptTypes = exports.outputScriptTypes = exports.Dimensions = exports.address = exports.outputScript = exports.ReplayProtection = exports.RootWalletKeys = void 0;
3
+ exports.ZcashBitGoPsbt = exports.getWalletKeysFromPsbt = exports.BitGoPsbt = exports.assertChainCode = exports.chainCodes = exports.ChainCode = exports.inputScriptTypes = exports.outputScriptTypes = exports.Dimensions = exports.address = exports.outputScript = exports.ReplayProtection = exports.RootWalletKeys = void 0;
4
4
  exports.supportsScriptType = supportsScriptType;
5
5
  exports.createOpReturnScript = createOpReturnScript;
6
6
  exports.p2shP2pkOutputScript = p2shP2pkOutputScript;
@@ -24,6 +24,7 @@ Object.defineProperty(exports, "assertChainCode", { enumerable: true, get: funct
24
24
  // Bitcoin-like PSBT (for all non-Zcash networks)
25
25
  var BitGoPsbt_js_1 = require("./BitGoPsbt.js");
26
26
  Object.defineProperty(exports, "BitGoPsbt", { enumerable: true, get: function () { return BitGoPsbt_js_1.BitGoPsbt; } });
27
+ Object.defineProperty(exports, "getWalletKeysFromPsbt", { enumerable: true, get: function () { return BitGoPsbt_js_1.getWalletKeysFromPsbt; } });
27
28
  // Zcash-specific PSBT subclass
28
29
  var ZcashBitGoPsbt_js_1 = require("./ZcashBitGoPsbt.js");
29
30
  Object.defineProperty(exports, "ZcashBitGoPsbt", { enumerable: true, get: function () { return ZcashBitGoPsbt_js_1.ZcashBitGoPsbt; } });
@@ -17,9 +17,6 @@ export type { AddressFormat } from "./address.js";
17
17
  export type { TapLeafScript, PreparedInscriptionRevealData } from "./inscriptions.js";
18
18
  export type DescriptorPkType = "derivable" | "definite" | "string";
19
19
  export type ScriptContext = "tap" | "segwitv0" | "legacy";
20
- export type SignPsbtResult = {
21
- [inputIndex: number]: [pubkey: string][];
22
- };
23
20
  declare module "./wasm/wasm_utxo.js" {
24
21
  interface WrapDescriptor {
25
22
  /** These are not the same types of nodes as in the ast module */
@@ -64,35 +61,9 @@ declare module "./wasm/wasm_utxo.js" {
64
61
  interface PsbtOutputDataWithAddress extends PsbtOutputData {
65
62
  address: string;
66
63
  }
67
- interface WrapPsbt {
68
- signWithXprv(this: WrapPsbt, xprv: string): SignPsbtResult;
69
- signWithPrv(this: WrapPsbt, prv: Uint8Array): SignPsbtResult;
70
- signAll(this: WrapPsbt, key: WasmBIP32): SignPsbtResult;
71
- signAllWithEcpair(this: WrapPsbt, key: WasmECPair): SignPsbtResult;
72
- inputCount(): number;
73
- outputCount(): number;
74
- getInputs(): PsbtInputData[];
75
- getOutputs(): PsbtOutputData[];
76
- getOutputsWithAddress(coin: import("./coinName.js").CoinName): PsbtOutputDataWithAddress[];
77
- getPartialSignatures(inputIndex: number): Array<{
78
- pubkey: Uint8Array;
79
- signature: Uint8Array;
80
- }>;
81
- hasPartialSignatures(inputIndex: number): boolean;
82
- validateSignatureAtInput(inputIndex: number, pubkey: Uint8Array): boolean;
83
- verifySignatureWithKey(inputIndex: number, key: WasmBIP32): boolean;
84
- extractTransaction(): WasmTransaction;
85
- addInputAtIndex(index: number, txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number): number;
86
- addOutputAtIndex(index: number, script: Uint8Array, value: bigint): number;
87
- removeInput(index: number): void;
88
- removeOutput(index: number): void;
89
- unsignedTxId(): string;
90
- lockTime(): number;
91
- version(): number;
92
- }
93
64
  }
94
65
  export { WrapDescriptor as Descriptor } from "./wasm/wasm_utxo.js";
95
66
  export { WrapMiniscript as Miniscript } from "./wasm/wasm_utxo.js";
96
- export { WrapPsbt as Psbt } from "./wasm/wasm_utxo.js";
67
+ export { Psbt } from "./descriptorWallet/Psbt.js";
97
68
  export { DashTransaction, Transaction, ZcashTransaction } from "./transaction.js";
98
69
  export { hasPsbtMagic, type IPsbt, type IPsbtWithAddress } from "./psbt.js";
@@ -66,8 +66,8 @@ var wasm_utxo_js_1 = require("./wasm/wasm_utxo.js");
66
66
  Object.defineProperty(exports, "Descriptor", { enumerable: true, get: function () { return wasm_utxo_js_1.WrapDescriptor; } });
67
67
  var wasm_utxo_js_2 = require("./wasm/wasm_utxo.js");
68
68
  Object.defineProperty(exports, "Miniscript", { enumerable: true, get: function () { return wasm_utxo_js_2.WrapMiniscript; } });
69
- var wasm_utxo_js_3 = require("./wasm/wasm_utxo.js");
70
- Object.defineProperty(exports, "Psbt", { enumerable: true, get: function () { return wasm_utxo_js_3.WrapPsbt; } });
69
+ var Psbt_js_1 = require("./descriptorWallet/Psbt.js");
70
+ Object.defineProperty(exports, "Psbt", { enumerable: true, get: function () { return Psbt_js_1.Psbt; } });
71
71
  var transaction_js_1 = require("./transaction.js");
72
72
  Object.defineProperty(exports, "DashTransaction", { enumerable: true, get: function () { return transaction_js_1.DashTransaction; } });
73
73
  Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return transaction_js_1.Transaction; } });
@@ -1,10 +1,12 @@
1
1
  import type { PsbtInputData, PsbtOutputData, PsbtOutputDataWithAddress } from "./wasm/wasm_utxo.js";
2
+ import type { BIP32 } from "./bip32.js";
2
3
  /** Common interface for PSBT types */
3
4
  export interface IPsbt {
4
5
  inputCount(): number;
5
6
  outputCount(): number;
6
7
  getInputs(): PsbtInputData[];
7
8
  getOutputs(): PsbtOutputData[];
9
+ getGlobalXpubs(): BIP32[];
8
10
  version(): number;
9
11
  lockTime(): number;
10
12
  unsignedTxId(): string;
@@ -94,7 +94,7 @@ export { inputScriptTypes, outputScriptTypes };
94
94
  * - psbt-lite: Only witness_utxo (no non_witness_utxo)
95
95
  */
96
96
  export declare class AcidTest {
97
- readonly network: CoinName;
97
+ readonly coin: CoinName;
98
98
  readonly signStage: SignStage;
99
99
  readonly txFormat: TxFormat;
100
100
  readonly rootWalletKeys: RootWalletKeys;
@@ -104,11 +104,11 @@ export declare class AcidTest {
104
104
  private readonly userXprv;
105
105
  private readonly backupXprv;
106
106
  private readonly bitgoXprv;
107
- constructor(network: CoinName, signStage: SignStage, txFormat: TxFormat, rootWalletKeys: RootWalletKeys, otherWalletKeys: RootWalletKeys, inputs: Input[], outputs: Output[], xprvTriple: Triple<BIP32>);
107
+ constructor(coin: CoinName, signStage: SignStage, txFormat: TxFormat, rootWalletKeys: RootWalletKeys, otherWalletKeys: RootWalletKeys, inputs: Input[], outputs: Output[], xprvTriple: Triple<BIP32>);
108
108
  /**
109
109
  * Create an AcidTest with specific configuration
110
110
  */
111
- static withConfig(network: CoinName, signStage: SignStage, txFormat: TxFormat, suiteConfig?: SuiteConfig): AcidTest;
111
+ static withConfig(coin: CoinName, signStage: SignStage, txFormat: TxFormat, suiteConfig?: SuiteConfig): AcidTest;
112
112
  /**
113
113
  * Get a human-readable name for this test configuration
114
114
  */