@bitgo/wasm-utxo 4.5.0 → 4.7.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 +76 -74
- 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 +76 -74
- 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
|