@bitgo/wasm-utxo 4.6.0 → 4.8.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/BitGoPsbt.d.ts +21 -2
- package/dist/cjs/js/fixedScriptWallet/BitGoPsbt.js +35 -2
- package/dist/cjs/js/fixedScriptWallet/ZcashBitGoPsbt.d.ts +23 -24
- package/dist/cjs/js/fixedScriptWallet/ZcashBitGoPsbt.js +34 -26
- package/dist/cjs/js/wasm/wasm_utxo.d.ts +26 -5
- package/dist/cjs/js/wasm/wasm_utxo.js +74 -7
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +30 -28
- package/dist/esm/js/fixedScriptWallet/BitGoPsbt.d.ts +21 -2
- package/dist/esm/js/fixedScriptWallet/BitGoPsbt.js +35 -2
- package/dist/esm/js/fixedScriptWallet/ZcashBitGoPsbt.d.ts +23 -24
- package/dist/esm/js/fixedScriptWallet/ZcashBitGoPsbt.js +34 -26
- package/dist/esm/js/wasm/wasm_utxo.d.ts +26 -5
- package/dist/esm/js/wasm/wasm_utxo_bg.js +74 -7
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +30 -28
- package/package.json +1 -1
|
@@ -147,21 +147,40 @@ export declare class BitGoPsbt extends PsbtBase<WasmBitGoPsbt> implements IPsbtW
|
|
|
147
147
|
/**
|
|
148
148
|
* Convert a half-signed legacy transaction to a psbt-lite.
|
|
149
149
|
*
|
|
150
|
+
* @deprecated Use `fromNetworkFormat()` instead. Signature-count enforcement
|
|
151
|
+
* (exactly 1 sig per wallet input) is moving to the caller.
|
|
152
|
+
*
|
|
150
153
|
* Extracts partial signatures from scriptSig/witness and creates a PSBT
|
|
151
154
|
* with proper wallet metadata (bip32Derivation, scripts, witnessUtxo).
|
|
152
155
|
* Only supports p2sh, p2shP2wsh, and p2wsh inputs (not taproot).
|
|
153
156
|
*
|
|
154
157
|
* Supports both Bitcoin-like coins (BTC, LTC, DOGE) and Dash (DASH).
|
|
155
|
-
* Zcash is NOT supported; use ZcashBitGoPsbt.
|
|
158
|
+
* Zcash is NOT supported; use ZcashBitGoPsbt.fromNetworkFormat instead.
|
|
156
159
|
*
|
|
157
160
|
* @param txBytesOrTx - Transaction bytes or decoded transaction instance (Bitcoin-like or Dash)
|
|
158
161
|
* @param network - Network name
|
|
159
162
|
* @param walletKeys - The wallet's root keys
|
|
160
163
|
* @param unspents - Chain, index, and value for each input
|
|
161
164
|
* @param _options - Reserved for future use and signature compatibility with subclasses
|
|
162
|
-
* @throws Error if transaction is Zcash (use ZcashBitGoPsbt.
|
|
165
|
+
* @throws Error if transaction is Zcash (use ZcashBitGoPsbt.fromNetworkFormat instead)
|
|
163
166
|
*/
|
|
164
167
|
static fromHalfSignedLegacyTransaction(txBytesOrTx: Uint8Array | Transaction | DashTransaction, network: NetworkName, walletKeys: WalletKeysArg, unspents: HydrationUnspent[], _options?: unknown): BitGoPsbt;
|
|
168
|
+
/**
|
|
169
|
+
* Convert a network-format transaction to a PSBT.
|
|
170
|
+
*
|
|
171
|
+
* Accepts both the half-signed legacy format (5-slot scriptSig/witness with OP_0
|
|
172
|
+
* placeholders) and the fully-signed network format (compact 4-item form). The
|
|
173
|
+
* resulting PSBT will contain all partial signatures present in the transaction.
|
|
174
|
+
*
|
|
175
|
+
* Use this when you don't know ahead of time whether the transaction is half-signed
|
|
176
|
+
* or fully-signed. For Zcash, use ZcashBitGoPsbt.fromNetworkFormat() instead.
|
|
177
|
+
*
|
|
178
|
+
* @param txBytesOrTx - Transaction bytes or decoded Transaction/DashTransaction
|
|
179
|
+
* @param network - Network name
|
|
180
|
+
* @param walletKeys - The wallet's root keys
|
|
181
|
+
* @param unspents - Chain, index, and value for each input
|
|
182
|
+
*/
|
|
183
|
+
static fromNetworkFormat(txBytesOrTx: Uint8Array | Transaction | DashTransaction, network: NetworkName, walletKeys: WalletKeysArg, unspents: HydrationUnspent[], _options?: unknown): BitGoPsbt;
|
|
165
184
|
/**
|
|
166
185
|
* Add an input to the PSBT
|
|
167
186
|
*
|
|
@@ -61,19 +61,22 @@ class BitGoPsbt extends psbtBase_js_1.PsbtBase {
|
|
|
61
61
|
/**
|
|
62
62
|
* Convert a half-signed legacy transaction to a psbt-lite.
|
|
63
63
|
*
|
|
64
|
+
* @deprecated Use `fromNetworkFormat()` instead. Signature-count enforcement
|
|
65
|
+
* (exactly 1 sig per wallet input) is moving to the caller.
|
|
66
|
+
*
|
|
64
67
|
* Extracts partial signatures from scriptSig/witness and creates a PSBT
|
|
65
68
|
* with proper wallet metadata (bip32Derivation, scripts, witnessUtxo).
|
|
66
69
|
* Only supports p2sh, p2shP2wsh, and p2wsh inputs (not taproot).
|
|
67
70
|
*
|
|
68
71
|
* Supports both Bitcoin-like coins (BTC, LTC, DOGE) and Dash (DASH).
|
|
69
|
-
* Zcash is NOT supported; use ZcashBitGoPsbt.
|
|
72
|
+
* Zcash is NOT supported; use ZcashBitGoPsbt.fromNetworkFormat instead.
|
|
70
73
|
*
|
|
71
74
|
* @param txBytesOrTx - Transaction bytes or decoded transaction instance (Bitcoin-like or Dash)
|
|
72
75
|
* @param network - Network name
|
|
73
76
|
* @param walletKeys - The wallet's root keys
|
|
74
77
|
* @param unspents - Chain, index, and value for each input
|
|
75
78
|
* @param _options - Reserved for future use and signature compatibility with subclasses
|
|
76
|
-
* @throws Error if transaction is Zcash (use ZcashBitGoPsbt.
|
|
79
|
+
* @throws Error if transaction is Zcash (use ZcashBitGoPsbt.fromNetworkFormat instead)
|
|
77
80
|
*/
|
|
78
81
|
static fromHalfSignedLegacyTransaction(txBytesOrTx, network, walletKeys, unspents,
|
|
79
82
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -93,6 +96,36 @@ class BitGoPsbt extends psbtBase_js_1.PsbtBase {
|
|
|
93
96
|
: wasm_utxo_js_1.BitGoPsbt.from_half_signed_legacy_transaction(tx.wasm, network, keys.wasm, unspents);
|
|
94
97
|
return new BitGoPsbt(wasm);
|
|
95
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Convert a network-format transaction to a PSBT.
|
|
101
|
+
*
|
|
102
|
+
* Accepts both the half-signed legacy format (5-slot scriptSig/witness with OP_0
|
|
103
|
+
* placeholders) and the fully-signed network format (compact 4-item form). The
|
|
104
|
+
* resulting PSBT will contain all partial signatures present in the transaction.
|
|
105
|
+
*
|
|
106
|
+
* Use this when you don't know ahead of time whether the transaction is half-signed
|
|
107
|
+
* or fully-signed. For Zcash, use ZcashBitGoPsbt.fromNetworkFormat() instead.
|
|
108
|
+
*
|
|
109
|
+
* @param txBytesOrTx - Transaction bytes or decoded Transaction/DashTransaction
|
|
110
|
+
* @param network - Network name
|
|
111
|
+
* @param walletKeys - The wallet's root keys
|
|
112
|
+
* @param unspents - Chain, index, and value for each input
|
|
113
|
+
*/
|
|
114
|
+
static fromNetworkFormat(txBytesOrTx, network, walletKeys, unspents,
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
116
|
+
_options) {
|
|
117
|
+
const keys = RootWalletKeys_js_1.RootWalletKeys.from(walletKeys);
|
|
118
|
+
const tx = txBytesOrTx instanceof Uint8Array
|
|
119
|
+
? transaction_js_1.Transaction.fromBytes(txBytesOrTx, (0, coinName_js_1.toCoinName)(network))
|
|
120
|
+
: txBytesOrTx;
|
|
121
|
+
if (tx instanceof transaction_js_1.ZcashTransaction) {
|
|
122
|
+
throw new Error("Use ZcashBitGoPsbt.fromNetworkFormat() for Zcash transactions");
|
|
123
|
+
}
|
|
124
|
+
const wasm = tx instanceof transaction_js_1.DashTransaction
|
|
125
|
+
? wasm_utxo_js_1.BitGoPsbt.from_network_format_dash(tx.wasm, network, keys.wasm, unspents)
|
|
126
|
+
: wasm_utxo_js_1.BitGoPsbt.from_network_format(tx.wasm, network, keys.wasm, unspents);
|
|
127
|
+
return new BitGoPsbt(wasm);
|
|
128
|
+
}
|
|
96
129
|
addInputAtIndex(index, txidOrOptions, voutOrScript, value, script, sequence) {
|
|
97
130
|
if (typeof txidOrOptions === "string") {
|
|
98
131
|
return this._wasm.add_input_at_index(index, txidOrOptions, voutOrScript, value, script, sequence);
|
|
@@ -102,11 +102,14 @@ export declare class ZcashBitGoPsbt extends BitGoPsbt {
|
|
|
102
102
|
*/
|
|
103
103
|
static fromBytes(bytes: Uint8Array, network: ZcashNetworkName): ZcashBitGoPsbt;
|
|
104
104
|
/**
|
|
105
|
-
* Reconstruct a Zcash PSBT from a half-signed
|
|
105
|
+
* Reconstruct a Zcash PSBT from a network-format transaction (unsigned, half-signed, or fully-signed).
|
|
106
106
|
*
|
|
107
|
-
* This is the
|
|
108
|
-
* format (which includes version_group_id, expiry_height, and sapling fields), extracts
|
|
109
|
-
* partial signatures, and reconstructs a proper Zcash PSBT with consensus metadata.
|
|
107
|
+
* This is the Zcash equivalent of `BitGoPsbt.fromNetworkFormat()`. It decodes the Zcash wire
|
|
108
|
+
* format (which includes version_group_id, expiry_height, and sapling fields), extracts any
|
|
109
|
+
* partial signatures present, and reconstructs a proper Zcash PSBT with consensus metadata.
|
|
110
|
+
*
|
|
111
|
+
* Use this as the modern replacement for `fromHalfSignedLegacyTransaction`. Signature-count
|
|
112
|
+
* discovery (unsigned / half-signed / fully-signed) is left to the caller.
|
|
110
113
|
*
|
|
111
114
|
* Supports two modes for determining consensus_branch_id:
|
|
112
115
|
* - **Recommended**: Pass `blockHeight` to auto-determine consensus_branch_id via network upgrade activation heights
|
|
@@ -118,28 +121,24 @@ export declare class ZcashBitGoPsbt extends BitGoPsbt {
|
|
|
118
121
|
* @param unspents - Chain, index, and value for each input
|
|
119
122
|
* @param options - Either `{ blockHeight: number }` or `{ consensusBranchId: number }`
|
|
120
123
|
* @returns A ZcashBitGoPsbt instance
|
|
124
|
+
*/
|
|
125
|
+
static fromNetworkFormat(txBytesOrTx: Uint8Array | ITransaction, network: ZcashNetworkName, walletKeys: WalletKeysArg, unspents: HydrationUnspent[], options: {
|
|
126
|
+
blockHeight: number;
|
|
127
|
+
} | {
|
|
128
|
+
consensusBranchId: number;
|
|
129
|
+
}): ZcashBitGoPsbt;
|
|
130
|
+
/**
|
|
131
|
+
* Reconstruct a Zcash PSBT from a half-signed legacy transaction.
|
|
121
132
|
*
|
|
122
|
-
* @
|
|
123
|
-
*
|
|
124
|
-
* // Round-trip with block height (recommended)
|
|
125
|
-
* const legacyBytes = psbt.getHalfSignedLegacyFormat();
|
|
126
|
-
* const reconstructed = ZcashBitGoPsbt.fromHalfSignedLegacyTransaction(
|
|
127
|
-
* legacyBytes,
|
|
128
|
-
* "zec",
|
|
129
|
-
* walletKeys,
|
|
130
|
-
* unspents,
|
|
131
|
-
* { blockHeight: 1687105 } // NU5 activation height
|
|
132
|
-
* );
|
|
133
|
+
* @deprecated Use `fromNetworkFormat()` instead. Signature-count enforcement
|
|
134
|
+
* (exactly 1 sig per wallet input) is moving to the caller.
|
|
133
135
|
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* { consensusBranchId: 0xC2D6D0B4 } // NU5 branch ID
|
|
141
|
-
* );
|
|
142
|
-
* ```
|
|
136
|
+
* @param txBytesOrTx - Either serialized Zcash transaction bytes or a decoded ZcashTransaction instance
|
|
137
|
+
* @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
|
|
138
|
+
* @param walletKeys - The wallet's root keys
|
|
139
|
+
* @param unspents - Chain, index, and value for each input
|
|
140
|
+
* @param options - Either `{ blockHeight: number }` or `{ consensusBranchId: number }`
|
|
141
|
+
* @returns A ZcashBitGoPsbt instance
|
|
143
142
|
*/
|
|
144
143
|
static fromHalfSignedLegacyTransaction(txBytesOrTx: Uint8Array | ITransaction, network: ZcashNetworkName, walletKeys: WalletKeysArg, unspents: HydrationUnspent[], options: {
|
|
145
144
|
blockHeight: number;
|
|
@@ -97,11 +97,14 @@ class ZcashBitGoPsbt extends BitGoPsbt_js_1.BitGoPsbt {
|
|
|
97
97
|
return new ZcashBitGoPsbt(wasm);
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
|
-
* Reconstruct a Zcash PSBT from a half-signed
|
|
100
|
+
* Reconstruct a Zcash PSBT from a network-format transaction (unsigned, half-signed, or fully-signed).
|
|
101
101
|
*
|
|
102
|
-
* This is the
|
|
103
|
-
* format (which includes version_group_id, expiry_height, and sapling fields), extracts
|
|
104
|
-
* partial signatures, and reconstructs a proper Zcash PSBT with consensus metadata.
|
|
102
|
+
* This is the Zcash equivalent of `BitGoPsbt.fromNetworkFormat()`. It decodes the Zcash wire
|
|
103
|
+
* format (which includes version_group_id, expiry_height, and sapling fields), extracts any
|
|
104
|
+
* partial signatures present, and reconstructs a proper Zcash PSBT with consensus metadata.
|
|
105
|
+
*
|
|
106
|
+
* Use this as the modern replacement for `fromHalfSignedLegacyTransaction`. Signature-count
|
|
107
|
+
* discovery (unsigned / half-signed / fully-signed) is left to the caller.
|
|
105
108
|
*
|
|
106
109
|
* Supports two modes for determining consensus_branch_id:
|
|
107
110
|
* - **Recommended**: Pass `blockHeight` to auto-determine consensus_branch_id via network upgrade activation heights
|
|
@@ -113,28 +116,33 @@ class ZcashBitGoPsbt extends BitGoPsbt_js_1.BitGoPsbt {
|
|
|
113
116
|
* @param unspents - Chain, index, and value for each input
|
|
114
117
|
* @param options - Either `{ blockHeight: number }` or `{ consensusBranchId: number }`
|
|
115
118
|
* @returns A ZcashBitGoPsbt instance
|
|
119
|
+
*/
|
|
120
|
+
static fromNetworkFormat(txBytesOrTx, network, walletKeys, unspents, options) {
|
|
121
|
+
const keys = RootWalletKeys_js_1.RootWalletKeys.from(walletKeys);
|
|
122
|
+
const tx = txBytesOrTx instanceof Uint8Array
|
|
123
|
+
? transaction_js_1.ZcashTransaction.fromBytes(txBytesOrTx)
|
|
124
|
+
: txBytesOrTx;
|
|
125
|
+
if ("blockHeight" in options) {
|
|
126
|
+
const wasm = wasm_utxo_js_1.BitGoPsbt.from_network_format_zcash_with_block_height(tx.wasm, network, keys.wasm, unspents, options.blockHeight);
|
|
127
|
+
return new ZcashBitGoPsbt(wasm);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
const wasm = wasm_utxo_js_1.BitGoPsbt.from_network_format_zcash_with_branch_id(tx.wasm, network, keys.wasm, unspents, options.consensusBranchId);
|
|
131
|
+
return new ZcashBitGoPsbt(wasm);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Reconstruct a Zcash PSBT from a half-signed legacy transaction.
|
|
116
136
|
*
|
|
117
|
-
* @
|
|
118
|
-
*
|
|
119
|
-
* // Round-trip with block height (recommended)
|
|
120
|
-
* const legacyBytes = psbt.getHalfSignedLegacyFormat();
|
|
121
|
-
* const reconstructed = ZcashBitGoPsbt.fromHalfSignedLegacyTransaction(
|
|
122
|
-
* legacyBytes,
|
|
123
|
-
* "zec",
|
|
124
|
-
* walletKeys,
|
|
125
|
-
* unspents,
|
|
126
|
-
* { blockHeight: 1687105 } // NU5 activation height
|
|
127
|
-
* );
|
|
137
|
+
* @deprecated Use `fromNetworkFormat()` instead. Signature-count enforcement
|
|
138
|
+
* (exactly 1 sig per wallet input) is moving to the caller.
|
|
128
139
|
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* { consensusBranchId: 0xC2D6D0B4 } // NU5 branch ID
|
|
136
|
-
* );
|
|
137
|
-
* ```
|
|
140
|
+
* @param txBytesOrTx - Either serialized Zcash transaction bytes or a decoded ZcashTransaction instance
|
|
141
|
+
* @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
|
|
142
|
+
* @param walletKeys - The wallet's root keys
|
|
143
|
+
* @param unspents - Chain, index, and value for each input
|
|
144
|
+
* @param options - Either `{ blockHeight: number }` or `{ consensusBranchId: number }`
|
|
145
|
+
* @returns A ZcashBitGoPsbt instance
|
|
138
146
|
*/
|
|
139
147
|
static fromHalfSignedLegacyTransaction(txBytesOrTx, network, walletKeys, unspents, options) {
|
|
140
148
|
const keys = RootWalletKeys_js_1.RootWalletKeys.from(walletKeys);
|
|
@@ -142,11 +150,11 @@ class ZcashBitGoPsbt extends BitGoPsbt_js_1.BitGoPsbt {
|
|
|
142
150
|
? transaction_js_1.ZcashTransaction.fromBytes(txBytesOrTx)
|
|
143
151
|
: txBytesOrTx;
|
|
144
152
|
if ("blockHeight" in options) {
|
|
145
|
-
const wasm = wasm_utxo_js_1.BitGoPsbt.
|
|
153
|
+
const wasm = wasm_utxo_js_1.BitGoPsbt.from_network_format_zcash_with_block_height(tx.wasm, network, keys.wasm, unspents, options.blockHeight);
|
|
146
154
|
return new ZcashBitGoPsbt(wasm);
|
|
147
155
|
}
|
|
148
156
|
else {
|
|
149
|
-
const wasm = wasm_utxo_js_1.BitGoPsbt.
|
|
157
|
+
const wasm = wasm_utxo_js_1.BitGoPsbt.from_network_format_zcash_with_branch_id(tx.wasm, network, keys.wasm, unspents, options.consensusBranchId);
|
|
150
158
|
return new ZcashBitGoPsbt(wasm);
|
|
151
159
|
}
|
|
152
160
|
}
|
|
@@ -318,8 +318,27 @@ export class BitGoPsbt {
|
|
|
318
318
|
*/
|
|
319
319
|
static from_half_signed_legacy_transaction_dash(tx: WasmDashTransaction, network: string, wallet_keys: WasmRootWalletKeys, unspents: any): BitGoPsbt;
|
|
320
320
|
/**
|
|
321
|
-
* Convert a half-signed
|
|
322
|
-
*
|
|
321
|
+
* Convert a network-format transaction (half-signed OR fully-signed) to a PSBT.
|
|
322
|
+
*
|
|
323
|
+
* Accepts both the half-signed legacy format (5 items with OP_0 placeholders) and
|
|
324
|
+
* the fully-signed network format (4 items, no placeholders). The PSBT will contain
|
|
325
|
+
* all partial signatures present in the transaction.
|
|
326
|
+
*
|
|
327
|
+
* # Arguments
|
|
328
|
+
* * `tx` - The decoded Bitcoin-like (non-Dash, non-Zcash) transaction
|
|
329
|
+
* * `network` - Network name (e.g., "bitcoin", "btc")
|
|
330
|
+
* * `wallet_keys` - The wallet's root keys
|
|
331
|
+
* * `unspents` - Array of `{ chain: number, index: number, value: bigint }` per input
|
|
332
|
+
*/
|
|
333
|
+
static from_network_format(tx: WasmTransaction, network: string, wallet_keys: WasmRootWalletKeys, unspents: any): BitGoPsbt;
|
|
334
|
+
/**
|
|
335
|
+
* Convert a network-format Dash transaction (half-signed OR fully-signed) to a PSBT.
|
|
336
|
+
*/
|
|
337
|
+
static from_network_format_dash(tx: WasmDashTransaction, network: string, wallet_keys: WasmRootWalletKeys, unspents: any): BitGoPsbt;
|
|
338
|
+
/**
|
|
339
|
+
* Convert a network-format Zcash transaction (0, 1, or 2 sigs) to a PSBT (with block height).
|
|
340
|
+
*
|
|
341
|
+
* Accepts unsigned, half-signed, and fully-signed Zcash transactions.
|
|
323
342
|
*
|
|
324
343
|
* # Arguments
|
|
325
344
|
* * `tx` - The decoded Zcash transaction
|
|
@@ -328,9 +347,11 @@ export class BitGoPsbt {
|
|
|
328
347
|
* * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
|
|
329
348
|
* * `block_height` - Block height to determine consensus branch ID
|
|
330
349
|
*/
|
|
331
|
-
static
|
|
350
|
+
static from_network_format_zcash_with_block_height(tx: WasmZcashTransaction, network: string, wallet_keys: WasmRootWalletKeys, unspents: any, block_height: number): BitGoPsbt;
|
|
332
351
|
/**
|
|
333
|
-
* Convert a
|
|
352
|
+
* Convert a network-format Zcash transaction (0, 1, or 2 sigs) to a PSBT (with consensus branch ID).
|
|
353
|
+
*
|
|
354
|
+
* Accepts unsigned, half-signed, and fully-signed Zcash transactions.
|
|
334
355
|
*
|
|
335
356
|
* # Arguments
|
|
336
357
|
* * `tx` - The decoded Zcash transaction
|
|
@@ -339,7 +360,7 @@ export class BitGoPsbt {
|
|
|
339
360
|
* * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
|
|
340
361
|
* * `consensus_branch_id` - Zcash consensus branch ID
|
|
341
362
|
*/
|
|
342
|
-
static
|
|
363
|
+
static from_network_format_zcash_with_branch_id(tx: WasmZcashTransaction, network: string, wallet_keys: WasmRootWalletKeys, unspents: any, consensus_branch_id: number): BitGoPsbt;
|
|
343
364
|
/**
|
|
344
365
|
* Generate and store MuSig2 nonces for all MuSig2 inputs
|
|
345
366
|
*
|
|
@@ -1225,8 +1225,73 @@ class BitGoPsbt {
|
|
|
1225
1225
|
}
|
|
1226
1226
|
}
|
|
1227
1227
|
/**
|
|
1228
|
-
* Convert a half-signed
|
|
1229
|
-
*
|
|
1228
|
+
* Convert a network-format transaction (half-signed OR fully-signed) to a PSBT.
|
|
1229
|
+
*
|
|
1230
|
+
* Accepts both the half-signed legacy format (5 items with OP_0 placeholders) and
|
|
1231
|
+
* the fully-signed network format (4 items, no placeholders). The PSBT will contain
|
|
1232
|
+
* all partial signatures present in the transaction.
|
|
1233
|
+
*
|
|
1234
|
+
* # Arguments
|
|
1235
|
+
* * `tx` - The decoded Bitcoin-like (non-Dash, non-Zcash) transaction
|
|
1236
|
+
* * `network` - Network name (e.g., "bitcoin", "btc")
|
|
1237
|
+
* * `wallet_keys` - The wallet's root keys
|
|
1238
|
+
* * `unspents` - Array of `{ chain: number, index: number, value: bigint }` per input
|
|
1239
|
+
* @param {WasmTransaction} tx
|
|
1240
|
+
* @param {string} network
|
|
1241
|
+
* @param {WasmRootWalletKeys} wallet_keys
|
|
1242
|
+
* @param {any} unspents
|
|
1243
|
+
* @returns {BitGoPsbt}
|
|
1244
|
+
*/
|
|
1245
|
+
static from_network_format(tx, network, wallet_keys, unspents) {
|
|
1246
|
+
try {
|
|
1247
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1248
|
+
_assertClass(tx, WasmTransaction);
|
|
1249
|
+
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1250
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1251
|
+
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
1252
|
+
wasm.bitgopsbt_from_network_format(retptr, tx.__wbg_ptr, ptr0, len0, wallet_keys.__wbg_ptr, addHeapObject(unspents));
|
|
1253
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1254
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1255
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1256
|
+
if (r2) {
|
|
1257
|
+
throw takeObject(r1);
|
|
1258
|
+
}
|
|
1259
|
+
return BitGoPsbt.__wrap(r0);
|
|
1260
|
+
} finally {
|
|
1261
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
/**
|
|
1265
|
+
* Convert a network-format Dash transaction (half-signed OR fully-signed) to a PSBT.
|
|
1266
|
+
* @param {WasmDashTransaction} tx
|
|
1267
|
+
* @param {string} network
|
|
1268
|
+
* @param {WasmRootWalletKeys} wallet_keys
|
|
1269
|
+
* @param {any} unspents
|
|
1270
|
+
* @returns {BitGoPsbt}
|
|
1271
|
+
*/
|
|
1272
|
+
static from_network_format_dash(tx, network, wallet_keys, unspents) {
|
|
1273
|
+
try {
|
|
1274
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1275
|
+
_assertClass(tx, WasmDashTransaction);
|
|
1276
|
+
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1277
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1278
|
+
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
1279
|
+
wasm.bitgopsbt_from_network_format_dash(retptr, tx.__wbg_ptr, ptr0, len0, wallet_keys.__wbg_ptr, addHeapObject(unspents));
|
|
1280
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1281
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1282
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1283
|
+
if (r2) {
|
|
1284
|
+
throw takeObject(r1);
|
|
1285
|
+
}
|
|
1286
|
+
return BitGoPsbt.__wrap(r0);
|
|
1287
|
+
} finally {
|
|
1288
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
/**
|
|
1292
|
+
* Convert a network-format Zcash transaction (0, 1, or 2 sigs) to a PSBT (with block height).
|
|
1293
|
+
*
|
|
1294
|
+
* Accepts unsigned, half-signed, and fully-signed Zcash transactions.
|
|
1230
1295
|
*
|
|
1231
1296
|
* # Arguments
|
|
1232
1297
|
* * `tx` - The decoded Zcash transaction
|
|
@@ -1241,14 +1306,14 @@ class BitGoPsbt {
|
|
|
1241
1306
|
* @param {number} block_height
|
|
1242
1307
|
* @returns {BitGoPsbt}
|
|
1243
1308
|
*/
|
|
1244
|
-
static
|
|
1309
|
+
static from_network_format_zcash_with_block_height(tx, network, wallet_keys, unspents, block_height) {
|
|
1245
1310
|
try {
|
|
1246
1311
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1247
1312
|
_assertClass(tx, WasmZcashTransaction);
|
|
1248
1313
|
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1249
1314
|
const len0 = WASM_VECTOR_LEN;
|
|
1250
1315
|
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
1251
|
-
wasm.
|
|
1316
|
+
wasm.bitgopsbt_from_network_format_zcash_with_block_height(retptr, tx.__wbg_ptr, ptr0, len0, wallet_keys.__wbg_ptr, addHeapObject(unspents), block_height);
|
|
1252
1317
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1253
1318
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1254
1319
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1261,7 +1326,9 @@ class BitGoPsbt {
|
|
|
1261
1326
|
}
|
|
1262
1327
|
}
|
|
1263
1328
|
/**
|
|
1264
|
-
* Convert a
|
|
1329
|
+
* Convert a network-format Zcash transaction (0, 1, or 2 sigs) to a PSBT (with consensus branch ID).
|
|
1330
|
+
*
|
|
1331
|
+
* Accepts unsigned, half-signed, and fully-signed Zcash transactions.
|
|
1265
1332
|
*
|
|
1266
1333
|
* # Arguments
|
|
1267
1334
|
* * `tx` - The decoded Zcash transaction
|
|
@@ -1276,14 +1343,14 @@ class BitGoPsbt {
|
|
|
1276
1343
|
* @param {number} consensus_branch_id
|
|
1277
1344
|
* @returns {BitGoPsbt}
|
|
1278
1345
|
*/
|
|
1279
|
-
static
|
|
1346
|
+
static from_network_format_zcash_with_branch_id(tx, network, wallet_keys, unspents, consensus_branch_id) {
|
|
1280
1347
|
try {
|
|
1281
1348
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1282
1349
|
_assertClass(tx, WasmZcashTransaction);
|
|
1283
1350
|
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1284
1351
|
const len0 = WASM_VECTOR_LEN;
|
|
1285
1352
|
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
1286
|
-
wasm.
|
|
1353
|
+
wasm.bitgopsbt_from_network_format_zcash_with_branch_id(retptr, tx.__wbg_ptr, ptr0, len0, wallet_keys.__wbg_ptr, addHeapObject(unspents), consensus_branch_id);
|
|
1287
1354
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1288
1355
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1289
1356
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
Binary file
|
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
6
|
+
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
7
|
+
export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
8
|
+
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
9
|
+
export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
10
|
+
export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
|
|
11
|
+
export const wrapdescriptor_hasWildcard: (a: number) => number;
|
|
12
|
+
export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
|
|
13
|
+
export const wrapdescriptor_node: (a: number, b: number) => void;
|
|
14
|
+
export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
|
|
15
|
+
export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
|
|
16
|
+
export const wrapdescriptor_toString: (a: number, b: number) => void;
|
|
17
|
+
export const wrapminiscript_encode: (a: number, b: number) => void;
|
|
18
|
+
export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
19
|
+
export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
20
|
+
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
21
|
+
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
22
|
+
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
4
23
|
export const __wbg_bip322namespace_free: (a: number, b: number) => void;
|
|
5
24
|
export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
|
|
6
25
|
export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
|
|
7
|
-
export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
|
|
8
26
|
export const __wbg_wasmbip32_free: (a: number, b: number) => void;
|
|
27
|
+
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
9
28
|
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;
|
|
10
29
|
export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
|
|
11
30
|
export const bip322namespace_verify_bip322_psbt_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
@@ -42,8 +61,10 @@ export const bitgopsbt_finalize_all_inputs: (a: number, b: number) => void;
|
|
|
42
61
|
export const bitgopsbt_from_bytes: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
43
62
|
export const bitgopsbt_from_half_signed_legacy_transaction: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
44
63
|
export const bitgopsbt_from_half_signed_legacy_transaction_dash: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
45
|
-
export const
|
|
46
|
-
export const
|
|
64
|
+
export const bitgopsbt_from_network_format: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
65
|
+
export const bitgopsbt_from_network_format_dash: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
66
|
+
export const bitgopsbt_from_network_format_zcash_with_block_height: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
67
|
+
export const bitgopsbt_from_network_format_zcash_with_branch_id: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
47
68
|
export const bitgopsbt_generate_musig2_nonces: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
48
69
|
export const bitgopsbt_get_global_xpubs: (a: number) => number;
|
|
49
70
|
export const bitgopsbt_get_input_kv: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -90,8 +111,6 @@ export const fixedscriptwalletnamespace_output_script_with_network_str: (a: numb
|
|
|
90
111
|
export const fixedscriptwalletnamespace_p2sh_p2pk_output_script: (a: number, b: number, c: number) => void;
|
|
91
112
|
export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
92
113
|
export const fixedscriptwalletnamespace_to_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
93
|
-
export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
94
|
-
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;
|
|
95
114
|
export const wasmbip32_chain_code: (a: number) => number;
|
|
96
115
|
export const wasmbip32_depth: (a: number) => number;
|
|
97
116
|
export const wasmbip32_derive: (a: number, b: number, c: number) => void;
|
|
@@ -114,33 +133,19 @@ export const wasmbip32_private_key: (a: number) => number;
|
|
|
114
133
|
export const wasmbip32_public_key: (a: number) => number;
|
|
115
134
|
export const wasmbip32_to_base58: (a: number, b: number) => void;
|
|
116
135
|
export const wasmbip32_to_wif: (a: number, b: number) => void;
|
|
136
|
+
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
137
|
+
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
138
|
+
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
117
139
|
export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
118
140
|
export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
|
|
119
141
|
export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
|
|
120
142
|
export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
|
|
121
|
-
export const
|
|
122
|
-
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
123
|
-
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
124
|
-
export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
125
|
-
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
126
|
-
export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
127
|
-
export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
|
|
128
|
-
export const wrapdescriptor_hasWildcard: (a: number) => number;
|
|
129
|
-
export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
|
|
130
|
-
export const wrapdescriptor_node: (a: number, b: number) => void;
|
|
131
|
-
export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
|
|
132
|
-
export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
|
|
133
|
-
export const wrapdescriptor_toString: (a: number, b: number) => void;
|
|
134
|
-
export const wrapminiscript_encode: (a: number, b: number) => void;
|
|
135
|
-
export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
136
|
-
export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
137
|
-
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
138
|
-
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
139
|
-
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
143
|
+
export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
|
|
140
144
|
export const __wbg_messagenamespace_free: (a: number, b: number) => void;
|
|
141
145
|
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
142
|
-
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
143
146
|
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
147
|
+
export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
148
|
+
export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
|
|
144
149
|
export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
|
|
145
150
|
export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
146
151
|
export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
|
|
@@ -153,9 +158,6 @@ export const wasmecpair_public_key: (a: number) => number;
|
|
|
153
158
|
export const wasmecpair_to_wif: (a: number, b: number) => void;
|
|
154
159
|
export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
|
|
155
160
|
export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
|
|
156
|
-
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
157
|
-
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
158
|
-
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
159
161
|
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
160
162
|
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
161
163
|
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -147,21 +147,40 @@ export declare class BitGoPsbt extends PsbtBase<WasmBitGoPsbt> implements IPsbtW
|
|
|
147
147
|
/**
|
|
148
148
|
* Convert a half-signed legacy transaction to a psbt-lite.
|
|
149
149
|
*
|
|
150
|
+
* @deprecated Use `fromNetworkFormat()` instead. Signature-count enforcement
|
|
151
|
+
* (exactly 1 sig per wallet input) is moving to the caller.
|
|
152
|
+
*
|
|
150
153
|
* Extracts partial signatures from scriptSig/witness and creates a PSBT
|
|
151
154
|
* with proper wallet metadata (bip32Derivation, scripts, witnessUtxo).
|
|
152
155
|
* Only supports p2sh, p2shP2wsh, and p2wsh inputs (not taproot).
|
|
153
156
|
*
|
|
154
157
|
* Supports both Bitcoin-like coins (BTC, LTC, DOGE) and Dash (DASH).
|
|
155
|
-
* Zcash is NOT supported; use ZcashBitGoPsbt.
|
|
158
|
+
* Zcash is NOT supported; use ZcashBitGoPsbt.fromNetworkFormat instead.
|
|
156
159
|
*
|
|
157
160
|
* @param txBytesOrTx - Transaction bytes or decoded transaction instance (Bitcoin-like or Dash)
|
|
158
161
|
* @param network - Network name
|
|
159
162
|
* @param walletKeys - The wallet's root keys
|
|
160
163
|
* @param unspents - Chain, index, and value for each input
|
|
161
164
|
* @param _options - Reserved for future use and signature compatibility with subclasses
|
|
162
|
-
* @throws Error if transaction is Zcash (use ZcashBitGoPsbt.
|
|
165
|
+
* @throws Error if transaction is Zcash (use ZcashBitGoPsbt.fromNetworkFormat instead)
|
|
163
166
|
*/
|
|
164
167
|
static fromHalfSignedLegacyTransaction(txBytesOrTx: Uint8Array | Transaction | DashTransaction, network: NetworkName, walletKeys: WalletKeysArg, unspents: HydrationUnspent[], _options?: unknown): BitGoPsbt;
|
|
168
|
+
/**
|
|
169
|
+
* Convert a network-format transaction to a PSBT.
|
|
170
|
+
*
|
|
171
|
+
* Accepts both the half-signed legacy format (5-slot scriptSig/witness with OP_0
|
|
172
|
+
* placeholders) and the fully-signed network format (compact 4-item form). The
|
|
173
|
+
* resulting PSBT will contain all partial signatures present in the transaction.
|
|
174
|
+
*
|
|
175
|
+
* Use this when you don't know ahead of time whether the transaction is half-signed
|
|
176
|
+
* or fully-signed. For Zcash, use ZcashBitGoPsbt.fromNetworkFormat() instead.
|
|
177
|
+
*
|
|
178
|
+
* @param txBytesOrTx - Transaction bytes or decoded Transaction/DashTransaction
|
|
179
|
+
* @param network - Network name
|
|
180
|
+
* @param walletKeys - The wallet's root keys
|
|
181
|
+
* @param unspents - Chain, index, and value for each input
|
|
182
|
+
*/
|
|
183
|
+
static fromNetworkFormat(txBytesOrTx: Uint8Array | Transaction | DashTransaction, network: NetworkName, walletKeys: WalletKeysArg, unspents: HydrationUnspent[], _options?: unknown): BitGoPsbt;
|
|
165
184
|
/**
|
|
166
185
|
* Add an input to the PSBT
|
|
167
186
|
*
|
|
@@ -57,19 +57,22 @@ export class BitGoPsbt extends PsbtBase {
|
|
|
57
57
|
/**
|
|
58
58
|
* Convert a half-signed legacy transaction to a psbt-lite.
|
|
59
59
|
*
|
|
60
|
+
* @deprecated Use `fromNetworkFormat()` instead. Signature-count enforcement
|
|
61
|
+
* (exactly 1 sig per wallet input) is moving to the caller.
|
|
62
|
+
*
|
|
60
63
|
* Extracts partial signatures from scriptSig/witness and creates a PSBT
|
|
61
64
|
* with proper wallet metadata (bip32Derivation, scripts, witnessUtxo).
|
|
62
65
|
* Only supports p2sh, p2shP2wsh, and p2wsh inputs (not taproot).
|
|
63
66
|
*
|
|
64
67
|
* Supports both Bitcoin-like coins (BTC, LTC, DOGE) and Dash (DASH).
|
|
65
|
-
* Zcash is NOT supported; use ZcashBitGoPsbt.
|
|
68
|
+
* Zcash is NOT supported; use ZcashBitGoPsbt.fromNetworkFormat instead.
|
|
66
69
|
*
|
|
67
70
|
* @param txBytesOrTx - Transaction bytes or decoded transaction instance (Bitcoin-like or Dash)
|
|
68
71
|
* @param network - Network name
|
|
69
72
|
* @param walletKeys - The wallet's root keys
|
|
70
73
|
* @param unspents - Chain, index, and value for each input
|
|
71
74
|
* @param _options - Reserved for future use and signature compatibility with subclasses
|
|
72
|
-
* @throws Error if transaction is Zcash (use ZcashBitGoPsbt.
|
|
75
|
+
* @throws Error if transaction is Zcash (use ZcashBitGoPsbt.fromNetworkFormat instead)
|
|
73
76
|
*/
|
|
74
77
|
static fromHalfSignedLegacyTransaction(txBytesOrTx, network, walletKeys, unspents,
|
|
75
78
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -89,6 +92,36 @@ export class BitGoPsbt extends PsbtBase {
|
|
|
89
92
|
: WasmBitGoPsbt.from_half_signed_legacy_transaction(tx.wasm, network, keys.wasm, unspents);
|
|
90
93
|
return new BitGoPsbt(wasm);
|
|
91
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Convert a network-format transaction to a PSBT.
|
|
97
|
+
*
|
|
98
|
+
* Accepts both the half-signed legacy format (5-slot scriptSig/witness with OP_0
|
|
99
|
+
* placeholders) and the fully-signed network format (compact 4-item form). The
|
|
100
|
+
* resulting PSBT will contain all partial signatures present in the transaction.
|
|
101
|
+
*
|
|
102
|
+
* Use this when you don't know ahead of time whether the transaction is half-signed
|
|
103
|
+
* or fully-signed. For Zcash, use ZcashBitGoPsbt.fromNetworkFormat() instead.
|
|
104
|
+
*
|
|
105
|
+
* @param txBytesOrTx - Transaction bytes or decoded Transaction/DashTransaction
|
|
106
|
+
* @param network - Network name
|
|
107
|
+
* @param walletKeys - The wallet's root keys
|
|
108
|
+
* @param unspents - Chain, index, and value for each input
|
|
109
|
+
*/
|
|
110
|
+
static fromNetworkFormat(txBytesOrTx, network, walletKeys, unspents,
|
|
111
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
112
|
+
_options) {
|
|
113
|
+
const keys = RootWalletKeys.from(walletKeys);
|
|
114
|
+
const tx = txBytesOrTx instanceof Uint8Array
|
|
115
|
+
? Transaction.fromBytes(txBytesOrTx, toCoinName(network))
|
|
116
|
+
: txBytesOrTx;
|
|
117
|
+
if (tx instanceof ZcashTransaction) {
|
|
118
|
+
throw new Error("Use ZcashBitGoPsbt.fromNetworkFormat() for Zcash transactions");
|
|
119
|
+
}
|
|
120
|
+
const wasm = tx instanceof DashTransaction
|
|
121
|
+
? WasmBitGoPsbt.from_network_format_dash(tx.wasm, network, keys.wasm, unspents)
|
|
122
|
+
: WasmBitGoPsbt.from_network_format(tx.wasm, network, keys.wasm, unspents);
|
|
123
|
+
return new BitGoPsbt(wasm);
|
|
124
|
+
}
|
|
92
125
|
addInputAtIndex(index, txidOrOptions, voutOrScript, value, script, sequence) {
|
|
93
126
|
if (typeof txidOrOptions === "string") {
|
|
94
127
|
return this._wasm.add_input_at_index(index, txidOrOptions, voutOrScript, value, script, sequence);
|
|
@@ -102,11 +102,14 @@ export declare class ZcashBitGoPsbt extends BitGoPsbt {
|
|
|
102
102
|
*/
|
|
103
103
|
static fromBytes(bytes: Uint8Array, network: ZcashNetworkName): ZcashBitGoPsbt;
|
|
104
104
|
/**
|
|
105
|
-
* Reconstruct a Zcash PSBT from a half-signed
|
|
105
|
+
* Reconstruct a Zcash PSBT from a network-format transaction (unsigned, half-signed, or fully-signed).
|
|
106
106
|
*
|
|
107
|
-
* This is the
|
|
108
|
-
* format (which includes version_group_id, expiry_height, and sapling fields), extracts
|
|
109
|
-
* partial signatures, and reconstructs a proper Zcash PSBT with consensus metadata.
|
|
107
|
+
* This is the Zcash equivalent of `BitGoPsbt.fromNetworkFormat()`. It decodes the Zcash wire
|
|
108
|
+
* format (which includes version_group_id, expiry_height, and sapling fields), extracts any
|
|
109
|
+
* partial signatures present, and reconstructs a proper Zcash PSBT with consensus metadata.
|
|
110
|
+
*
|
|
111
|
+
* Use this as the modern replacement for `fromHalfSignedLegacyTransaction`. Signature-count
|
|
112
|
+
* discovery (unsigned / half-signed / fully-signed) is left to the caller.
|
|
110
113
|
*
|
|
111
114
|
* Supports two modes for determining consensus_branch_id:
|
|
112
115
|
* - **Recommended**: Pass `blockHeight` to auto-determine consensus_branch_id via network upgrade activation heights
|
|
@@ -118,28 +121,24 @@ export declare class ZcashBitGoPsbt extends BitGoPsbt {
|
|
|
118
121
|
* @param unspents - Chain, index, and value for each input
|
|
119
122
|
* @param options - Either `{ blockHeight: number }` or `{ consensusBranchId: number }`
|
|
120
123
|
* @returns A ZcashBitGoPsbt instance
|
|
124
|
+
*/
|
|
125
|
+
static fromNetworkFormat(txBytesOrTx: Uint8Array | ITransaction, network: ZcashNetworkName, walletKeys: WalletKeysArg, unspents: HydrationUnspent[], options: {
|
|
126
|
+
blockHeight: number;
|
|
127
|
+
} | {
|
|
128
|
+
consensusBranchId: number;
|
|
129
|
+
}): ZcashBitGoPsbt;
|
|
130
|
+
/**
|
|
131
|
+
* Reconstruct a Zcash PSBT from a half-signed legacy transaction.
|
|
121
132
|
*
|
|
122
|
-
* @
|
|
123
|
-
*
|
|
124
|
-
* // Round-trip with block height (recommended)
|
|
125
|
-
* const legacyBytes = psbt.getHalfSignedLegacyFormat();
|
|
126
|
-
* const reconstructed = ZcashBitGoPsbt.fromHalfSignedLegacyTransaction(
|
|
127
|
-
* legacyBytes,
|
|
128
|
-
* "zec",
|
|
129
|
-
* walletKeys,
|
|
130
|
-
* unspents,
|
|
131
|
-
* { blockHeight: 1687105 } // NU5 activation height
|
|
132
|
-
* );
|
|
133
|
+
* @deprecated Use `fromNetworkFormat()` instead. Signature-count enforcement
|
|
134
|
+
* (exactly 1 sig per wallet input) is moving to the caller.
|
|
133
135
|
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* { consensusBranchId: 0xC2D6D0B4 } // NU5 branch ID
|
|
141
|
-
* );
|
|
142
|
-
* ```
|
|
136
|
+
* @param txBytesOrTx - Either serialized Zcash transaction bytes or a decoded ZcashTransaction instance
|
|
137
|
+
* @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
|
|
138
|
+
* @param walletKeys - The wallet's root keys
|
|
139
|
+
* @param unspents - Chain, index, and value for each input
|
|
140
|
+
* @param options - Either `{ blockHeight: number }` or `{ consensusBranchId: number }`
|
|
141
|
+
* @returns A ZcashBitGoPsbt instance
|
|
143
142
|
*/
|
|
144
143
|
static fromHalfSignedLegacyTransaction(txBytesOrTx: Uint8Array | ITransaction, network: ZcashNetworkName, walletKeys: WalletKeysArg, unspents: HydrationUnspent[], options: {
|
|
145
144
|
blockHeight: number;
|
|
@@ -94,11 +94,14 @@ export class ZcashBitGoPsbt extends BitGoPsbt {
|
|
|
94
94
|
return new ZcashBitGoPsbt(wasm);
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
|
-
* Reconstruct a Zcash PSBT from a half-signed
|
|
97
|
+
* Reconstruct a Zcash PSBT from a network-format transaction (unsigned, half-signed, or fully-signed).
|
|
98
98
|
*
|
|
99
|
-
* This is the
|
|
100
|
-
* format (which includes version_group_id, expiry_height, and sapling fields), extracts
|
|
101
|
-
* partial signatures, and reconstructs a proper Zcash PSBT with consensus metadata.
|
|
99
|
+
* This is the Zcash equivalent of `BitGoPsbt.fromNetworkFormat()`. It decodes the Zcash wire
|
|
100
|
+
* format (which includes version_group_id, expiry_height, and sapling fields), extracts any
|
|
101
|
+
* partial signatures present, and reconstructs a proper Zcash PSBT with consensus metadata.
|
|
102
|
+
*
|
|
103
|
+
* Use this as the modern replacement for `fromHalfSignedLegacyTransaction`. Signature-count
|
|
104
|
+
* discovery (unsigned / half-signed / fully-signed) is left to the caller.
|
|
102
105
|
*
|
|
103
106
|
* Supports two modes for determining consensus_branch_id:
|
|
104
107
|
* - **Recommended**: Pass `blockHeight` to auto-determine consensus_branch_id via network upgrade activation heights
|
|
@@ -110,28 +113,33 @@ export class ZcashBitGoPsbt extends BitGoPsbt {
|
|
|
110
113
|
* @param unspents - Chain, index, and value for each input
|
|
111
114
|
* @param options - Either `{ blockHeight: number }` or `{ consensusBranchId: number }`
|
|
112
115
|
* @returns A ZcashBitGoPsbt instance
|
|
116
|
+
*/
|
|
117
|
+
static fromNetworkFormat(txBytesOrTx, network, walletKeys, unspents, options) {
|
|
118
|
+
const keys = RootWalletKeys.from(walletKeys);
|
|
119
|
+
const tx = txBytesOrTx instanceof Uint8Array
|
|
120
|
+
? ZcashTransaction.fromBytes(txBytesOrTx)
|
|
121
|
+
: txBytesOrTx;
|
|
122
|
+
if ("blockHeight" in options) {
|
|
123
|
+
const wasm = WasmBitGoPsbt.from_network_format_zcash_with_block_height(tx.wasm, network, keys.wasm, unspents, options.blockHeight);
|
|
124
|
+
return new ZcashBitGoPsbt(wasm);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
const wasm = WasmBitGoPsbt.from_network_format_zcash_with_branch_id(tx.wasm, network, keys.wasm, unspents, options.consensusBranchId);
|
|
128
|
+
return new ZcashBitGoPsbt(wasm);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Reconstruct a Zcash PSBT from a half-signed legacy transaction.
|
|
113
133
|
*
|
|
114
|
-
* @
|
|
115
|
-
*
|
|
116
|
-
* // Round-trip with block height (recommended)
|
|
117
|
-
* const legacyBytes = psbt.getHalfSignedLegacyFormat();
|
|
118
|
-
* const reconstructed = ZcashBitGoPsbt.fromHalfSignedLegacyTransaction(
|
|
119
|
-
* legacyBytes,
|
|
120
|
-
* "zec",
|
|
121
|
-
* walletKeys,
|
|
122
|
-
* unspents,
|
|
123
|
-
* { blockHeight: 1687105 } // NU5 activation height
|
|
124
|
-
* );
|
|
134
|
+
* @deprecated Use `fromNetworkFormat()` instead. Signature-count enforcement
|
|
135
|
+
* (exactly 1 sig per wallet input) is moving to the caller.
|
|
125
136
|
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
* { consensusBranchId: 0xC2D6D0B4 } // NU5 branch ID
|
|
133
|
-
* );
|
|
134
|
-
* ```
|
|
137
|
+
* @param txBytesOrTx - Either serialized Zcash transaction bytes or a decoded ZcashTransaction instance
|
|
138
|
+
* @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
|
|
139
|
+
* @param walletKeys - The wallet's root keys
|
|
140
|
+
* @param unspents - Chain, index, and value for each input
|
|
141
|
+
* @param options - Either `{ blockHeight: number }` or `{ consensusBranchId: number }`
|
|
142
|
+
* @returns A ZcashBitGoPsbt instance
|
|
135
143
|
*/
|
|
136
144
|
static fromHalfSignedLegacyTransaction(txBytesOrTx, network, walletKeys, unspents, options) {
|
|
137
145
|
const keys = RootWalletKeys.from(walletKeys);
|
|
@@ -139,11 +147,11 @@ export class ZcashBitGoPsbt extends BitGoPsbt {
|
|
|
139
147
|
? ZcashTransaction.fromBytes(txBytesOrTx)
|
|
140
148
|
: txBytesOrTx;
|
|
141
149
|
if ("blockHeight" in options) {
|
|
142
|
-
const wasm = WasmBitGoPsbt.
|
|
150
|
+
const wasm = WasmBitGoPsbt.from_network_format_zcash_with_block_height(tx.wasm, network, keys.wasm, unspents, options.blockHeight);
|
|
143
151
|
return new ZcashBitGoPsbt(wasm);
|
|
144
152
|
}
|
|
145
153
|
else {
|
|
146
|
-
const wasm = WasmBitGoPsbt.
|
|
154
|
+
const wasm = WasmBitGoPsbt.from_network_format_zcash_with_branch_id(tx.wasm, network, keys.wasm, unspents, options.consensusBranchId);
|
|
147
155
|
return new ZcashBitGoPsbt(wasm);
|
|
148
156
|
}
|
|
149
157
|
}
|
|
@@ -318,8 +318,27 @@ export class BitGoPsbt {
|
|
|
318
318
|
*/
|
|
319
319
|
static from_half_signed_legacy_transaction_dash(tx: WasmDashTransaction, network: string, wallet_keys: WasmRootWalletKeys, unspents: any): BitGoPsbt;
|
|
320
320
|
/**
|
|
321
|
-
* Convert a half-signed
|
|
322
|
-
*
|
|
321
|
+
* Convert a network-format transaction (half-signed OR fully-signed) to a PSBT.
|
|
322
|
+
*
|
|
323
|
+
* Accepts both the half-signed legacy format (5 items with OP_0 placeholders) and
|
|
324
|
+
* the fully-signed network format (4 items, no placeholders). The PSBT will contain
|
|
325
|
+
* all partial signatures present in the transaction.
|
|
326
|
+
*
|
|
327
|
+
* # Arguments
|
|
328
|
+
* * `tx` - The decoded Bitcoin-like (non-Dash, non-Zcash) transaction
|
|
329
|
+
* * `network` - Network name (e.g., "bitcoin", "btc")
|
|
330
|
+
* * `wallet_keys` - The wallet's root keys
|
|
331
|
+
* * `unspents` - Array of `{ chain: number, index: number, value: bigint }` per input
|
|
332
|
+
*/
|
|
333
|
+
static from_network_format(tx: WasmTransaction, network: string, wallet_keys: WasmRootWalletKeys, unspents: any): BitGoPsbt;
|
|
334
|
+
/**
|
|
335
|
+
* Convert a network-format Dash transaction (half-signed OR fully-signed) to a PSBT.
|
|
336
|
+
*/
|
|
337
|
+
static from_network_format_dash(tx: WasmDashTransaction, network: string, wallet_keys: WasmRootWalletKeys, unspents: any): BitGoPsbt;
|
|
338
|
+
/**
|
|
339
|
+
* Convert a network-format Zcash transaction (0, 1, or 2 sigs) to a PSBT (with block height).
|
|
340
|
+
*
|
|
341
|
+
* Accepts unsigned, half-signed, and fully-signed Zcash transactions.
|
|
323
342
|
*
|
|
324
343
|
* # Arguments
|
|
325
344
|
* * `tx` - The decoded Zcash transaction
|
|
@@ -328,9 +347,11 @@ export class BitGoPsbt {
|
|
|
328
347
|
* * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
|
|
329
348
|
* * `block_height` - Block height to determine consensus branch ID
|
|
330
349
|
*/
|
|
331
|
-
static
|
|
350
|
+
static from_network_format_zcash_with_block_height(tx: WasmZcashTransaction, network: string, wallet_keys: WasmRootWalletKeys, unspents: any, block_height: number): BitGoPsbt;
|
|
332
351
|
/**
|
|
333
|
-
* Convert a
|
|
352
|
+
* Convert a network-format Zcash transaction (0, 1, or 2 sigs) to a PSBT (with consensus branch ID).
|
|
353
|
+
*
|
|
354
|
+
* Accepts unsigned, half-signed, and fully-signed Zcash transactions.
|
|
334
355
|
*
|
|
335
356
|
* # Arguments
|
|
336
357
|
* * `tx` - The decoded Zcash transaction
|
|
@@ -339,7 +360,7 @@ export class BitGoPsbt {
|
|
|
339
360
|
* * `unspents` - Array of `{ chain: number, index: number, value: bigint }` for each input
|
|
340
361
|
* * `consensus_branch_id` - Zcash consensus branch ID
|
|
341
362
|
*/
|
|
342
|
-
static
|
|
363
|
+
static from_network_format_zcash_with_branch_id(tx: WasmZcashTransaction, network: string, wallet_keys: WasmRootWalletKeys, unspents: any, consensus_branch_id: number): BitGoPsbt;
|
|
343
364
|
/**
|
|
344
365
|
* Generate and store MuSig2 nonces for all MuSig2 inputs
|
|
345
366
|
*
|
|
@@ -1221,8 +1221,73 @@ export class BitGoPsbt {
|
|
|
1221
1221
|
}
|
|
1222
1222
|
}
|
|
1223
1223
|
/**
|
|
1224
|
-
* Convert a half-signed
|
|
1225
|
-
*
|
|
1224
|
+
* Convert a network-format transaction (half-signed OR fully-signed) to a PSBT.
|
|
1225
|
+
*
|
|
1226
|
+
* Accepts both the half-signed legacy format (5 items with OP_0 placeholders) and
|
|
1227
|
+
* the fully-signed network format (4 items, no placeholders). The PSBT will contain
|
|
1228
|
+
* all partial signatures present in the transaction.
|
|
1229
|
+
*
|
|
1230
|
+
* # Arguments
|
|
1231
|
+
* * `tx` - The decoded Bitcoin-like (non-Dash, non-Zcash) transaction
|
|
1232
|
+
* * `network` - Network name (e.g., "bitcoin", "btc")
|
|
1233
|
+
* * `wallet_keys` - The wallet's root keys
|
|
1234
|
+
* * `unspents` - Array of `{ chain: number, index: number, value: bigint }` per input
|
|
1235
|
+
* @param {WasmTransaction} tx
|
|
1236
|
+
* @param {string} network
|
|
1237
|
+
* @param {WasmRootWalletKeys} wallet_keys
|
|
1238
|
+
* @param {any} unspents
|
|
1239
|
+
* @returns {BitGoPsbt}
|
|
1240
|
+
*/
|
|
1241
|
+
static from_network_format(tx, network, wallet_keys, unspents) {
|
|
1242
|
+
try {
|
|
1243
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1244
|
+
_assertClass(tx, WasmTransaction);
|
|
1245
|
+
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1246
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1247
|
+
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
1248
|
+
wasm.bitgopsbt_from_network_format(retptr, tx.__wbg_ptr, ptr0, len0, wallet_keys.__wbg_ptr, addHeapObject(unspents));
|
|
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 BitGoPsbt.__wrap(r0);
|
|
1256
|
+
} finally {
|
|
1257
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
/**
|
|
1261
|
+
* Convert a network-format Dash transaction (half-signed OR fully-signed) to a PSBT.
|
|
1262
|
+
* @param {WasmDashTransaction} tx
|
|
1263
|
+
* @param {string} network
|
|
1264
|
+
* @param {WasmRootWalletKeys} wallet_keys
|
|
1265
|
+
* @param {any} unspents
|
|
1266
|
+
* @returns {BitGoPsbt}
|
|
1267
|
+
*/
|
|
1268
|
+
static from_network_format_dash(tx, network, wallet_keys, unspents) {
|
|
1269
|
+
try {
|
|
1270
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1271
|
+
_assertClass(tx, WasmDashTransaction);
|
|
1272
|
+
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1273
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1274
|
+
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
1275
|
+
wasm.bitgopsbt_from_network_format_dash(retptr, tx.__wbg_ptr, ptr0, len0, wallet_keys.__wbg_ptr, addHeapObject(unspents));
|
|
1276
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1277
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1278
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1279
|
+
if (r2) {
|
|
1280
|
+
throw takeObject(r1);
|
|
1281
|
+
}
|
|
1282
|
+
return BitGoPsbt.__wrap(r0);
|
|
1283
|
+
} finally {
|
|
1284
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
/**
|
|
1288
|
+
* Convert a network-format Zcash transaction (0, 1, or 2 sigs) to a PSBT (with block height).
|
|
1289
|
+
*
|
|
1290
|
+
* Accepts unsigned, half-signed, and fully-signed Zcash transactions.
|
|
1226
1291
|
*
|
|
1227
1292
|
* # Arguments
|
|
1228
1293
|
* * `tx` - The decoded Zcash transaction
|
|
@@ -1237,14 +1302,14 @@ export class BitGoPsbt {
|
|
|
1237
1302
|
* @param {number} block_height
|
|
1238
1303
|
* @returns {BitGoPsbt}
|
|
1239
1304
|
*/
|
|
1240
|
-
static
|
|
1305
|
+
static from_network_format_zcash_with_block_height(tx, network, wallet_keys, unspents, block_height) {
|
|
1241
1306
|
try {
|
|
1242
1307
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1243
1308
|
_assertClass(tx, WasmZcashTransaction);
|
|
1244
1309
|
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1245
1310
|
const len0 = WASM_VECTOR_LEN;
|
|
1246
1311
|
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
1247
|
-
wasm.
|
|
1312
|
+
wasm.bitgopsbt_from_network_format_zcash_with_block_height(retptr, tx.__wbg_ptr, ptr0, len0, wallet_keys.__wbg_ptr, addHeapObject(unspents), block_height);
|
|
1248
1313
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1249
1314
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1250
1315
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -1257,7 +1322,9 @@ export class BitGoPsbt {
|
|
|
1257
1322
|
}
|
|
1258
1323
|
}
|
|
1259
1324
|
/**
|
|
1260
|
-
* Convert a
|
|
1325
|
+
* Convert a network-format Zcash transaction (0, 1, or 2 sigs) to a PSBT (with consensus branch ID).
|
|
1326
|
+
*
|
|
1327
|
+
* Accepts unsigned, half-signed, and fully-signed Zcash transactions.
|
|
1261
1328
|
*
|
|
1262
1329
|
* # Arguments
|
|
1263
1330
|
* * `tx` - The decoded Zcash transaction
|
|
@@ -1272,14 +1339,14 @@ export class BitGoPsbt {
|
|
|
1272
1339
|
* @param {number} consensus_branch_id
|
|
1273
1340
|
* @returns {BitGoPsbt}
|
|
1274
1341
|
*/
|
|
1275
|
-
static
|
|
1342
|
+
static from_network_format_zcash_with_branch_id(tx, network, wallet_keys, unspents, consensus_branch_id) {
|
|
1276
1343
|
try {
|
|
1277
1344
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1278
1345
|
_assertClass(tx, WasmZcashTransaction);
|
|
1279
1346
|
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1280
1347
|
const len0 = WASM_VECTOR_LEN;
|
|
1281
1348
|
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
1282
|
-
wasm.
|
|
1349
|
+
wasm.bitgopsbt_from_network_format_zcash_with_branch_id(retptr, tx.__wbg_ptr, ptr0, len0, wallet_keys.__wbg_ptr, addHeapObject(unspents), consensus_branch_id);
|
|
1283
1350
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1284
1351
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1285
1352
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
Binary file
|
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
6
|
+
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
7
|
+
export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
8
|
+
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
9
|
+
export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
10
|
+
export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
|
|
11
|
+
export const wrapdescriptor_hasWildcard: (a: number) => number;
|
|
12
|
+
export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
|
|
13
|
+
export const wrapdescriptor_node: (a: number, b: number) => void;
|
|
14
|
+
export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
|
|
15
|
+
export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
|
|
16
|
+
export const wrapdescriptor_toString: (a: number, b: number) => void;
|
|
17
|
+
export const wrapminiscript_encode: (a: number, b: number) => void;
|
|
18
|
+
export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
19
|
+
export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
20
|
+
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
21
|
+
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
22
|
+
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
4
23
|
export const __wbg_bip322namespace_free: (a: number, b: number) => void;
|
|
5
24
|
export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
|
|
6
25
|
export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
|
|
7
|
-
export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
|
|
8
26
|
export const __wbg_wasmbip32_free: (a: number, b: number) => void;
|
|
27
|
+
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
9
28
|
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;
|
|
10
29
|
export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
|
|
11
30
|
export const bip322namespace_verify_bip322_psbt_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
@@ -42,8 +61,10 @@ export const bitgopsbt_finalize_all_inputs: (a: number, b: number) => void;
|
|
|
42
61
|
export const bitgopsbt_from_bytes: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
43
62
|
export const bitgopsbt_from_half_signed_legacy_transaction: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
44
63
|
export const bitgopsbt_from_half_signed_legacy_transaction_dash: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
45
|
-
export const
|
|
46
|
-
export const
|
|
64
|
+
export const bitgopsbt_from_network_format: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
65
|
+
export const bitgopsbt_from_network_format_dash: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
66
|
+
export const bitgopsbt_from_network_format_zcash_with_block_height: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
67
|
+
export const bitgopsbt_from_network_format_zcash_with_branch_id: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
47
68
|
export const bitgopsbt_generate_musig2_nonces: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
48
69
|
export const bitgopsbt_get_global_xpubs: (a: number) => number;
|
|
49
70
|
export const bitgopsbt_get_input_kv: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -90,8 +111,6 @@ export const fixedscriptwalletnamespace_output_script_with_network_str: (a: numb
|
|
|
90
111
|
export const fixedscriptwalletnamespace_p2sh_p2pk_output_script: (a: number, b: number, c: number) => void;
|
|
91
112
|
export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
92
113
|
export const fixedscriptwalletnamespace_to_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
93
|
-
export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
94
|
-
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;
|
|
95
114
|
export const wasmbip32_chain_code: (a: number) => number;
|
|
96
115
|
export const wasmbip32_depth: (a: number) => number;
|
|
97
116
|
export const wasmbip32_derive: (a: number, b: number, c: number) => void;
|
|
@@ -114,33 +133,19 @@ export const wasmbip32_private_key: (a: number) => number;
|
|
|
114
133
|
export const wasmbip32_public_key: (a: number) => number;
|
|
115
134
|
export const wasmbip32_to_base58: (a: number, b: number) => void;
|
|
116
135
|
export const wasmbip32_to_wif: (a: number, b: number) => void;
|
|
136
|
+
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
137
|
+
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
138
|
+
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
117
139
|
export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
118
140
|
export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
|
|
119
141
|
export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
|
|
120
142
|
export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
|
|
121
|
-
export const
|
|
122
|
-
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
123
|
-
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
124
|
-
export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
125
|
-
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
126
|
-
export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
127
|
-
export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
|
|
128
|
-
export const wrapdescriptor_hasWildcard: (a: number) => number;
|
|
129
|
-
export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
|
|
130
|
-
export const wrapdescriptor_node: (a: number, b: number) => void;
|
|
131
|
-
export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
|
|
132
|
-
export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
|
|
133
|
-
export const wrapdescriptor_toString: (a: number, b: number) => void;
|
|
134
|
-
export const wrapminiscript_encode: (a: number, b: number) => void;
|
|
135
|
-
export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
136
|
-
export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
137
|
-
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
138
|
-
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
139
|
-
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
143
|
+
export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
|
|
140
144
|
export const __wbg_messagenamespace_free: (a: number, b: number) => void;
|
|
141
145
|
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
142
|
-
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
143
146
|
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
147
|
+
export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
148
|
+
export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
|
|
144
149
|
export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
|
|
145
150
|
export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
146
151
|
export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
|
|
@@ -153,9 +158,6 @@ export const wasmecpair_public_key: (a: number) => number;
|
|
|
153
158
|
export const wasmecpair_to_wif: (a: number, b: number) => void;
|
|
154
159
|
export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
|
|
155
160
|
export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
|
|
156
|
-
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
157
|
-
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
158
|
-
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
159
161
|
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
160
162
|
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
161
163
|
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|