@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
|
@@ -1,50 +1,17 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
5
|
-
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
6
|
-
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
7
|
-
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
8
|
-
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
9
|
-
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
10
|
-
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
11
|
-
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
12
|
-
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
13
|
-
export const wasmrootwalletkeys_with_derivation_prefixes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
14
4
|
export const __wbg_addressnamespace_free: (a: number, b: number) => void;
|
|
15
|
-
export const
|
|
16
|
-
export const __wbg_wasmbip32_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
17
6
|
export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
|
|
18
|
-
export const
|
|
7
|
+
export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
|
|
19
8
|
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
20
9
|
export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
|
|
21
10
|
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
|
22
11
|
export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
23
12
|
export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
24
|
-
export const
|
|
25
|
-
export const
|
|
26
|
-
export const wasmbip32_chain_code: (a: number) => number;
|
|
27
|
-
export const wasmbip32_depth: (a: number) => number;
|
|
28
|
-
export const wasmbip32_derive: (a: number, b: number, c: number) => void;
|
|
29
|
-
export const wasmbip32_derive_hardened: (a: number, b: number, c: number) => void;
|
|
30
|
-
export const wasmbip32_derive_path: (a: number, b: number, c: number, d: number) => void;
|
|
31
|
-
export const wasmbip32_equals: (a: number, b: number) => number;
|
|
32
|
-
export const wasmbip32_fingerprint: (a: number) => number;
|
|
33
|
-
export const wasmbip32_from_base58: (a: number, b: number, c: number) => void;
|
|
34
|
-
export const wasmbip32_from_bip32_interface: (a: number, b: number) => void;
|
|
35
|
-
export const wasmbip32_from_seed: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
36
|
-
export const wasmbip32_from_seed_sha256: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
37
|
-
export const wasmbip32_from_xprv: (a: number, b: number, c: number) => void;
|
|
38
|
-
export const wasmbip32_from_xpub: (a: number, b: number, c: number) => void;
|
|
39
|
-
export const wasmbip32_identifier: (a: number) => number;
|
|
40
|
-
export const wasmbip32_index: (a: number) => number;
|
|
41
|
-
export const wasmbip32_is_neutered: (a: number) => number;
|
|
42
|
-
export const wasmbip32_neutered: (a: number) => number;
|
|
43
|
-
export const wasmbip32_parent_fingerprint: (a: number) => number;
|
|
44
|
-
export const wasmbip32_private_key: (a: number) => number;
|
|
45
|
-
export const wasmbip32_public_key: (a: number) => number;
|
|
46
|
-
export const wasmbip32_to_base58: (a: number, b: number) => void;
|
|
47
|
-
export const wasmbip32_to_wif: (a: number, b: number) => void;
|
|
13
|
+
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
14
|
+
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
48
15
|
export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
49
16
|
export const wasmdashtransaction_get_inputs: (a: number, b: number) => void;
|
|
50
17
|
export const wasmdashtransaction_get_outputs: (a: number, b: number) => void;
|
|
@@ -55,16 +22,21 @@ export const wasmdashtransaction_lock_time: (a: number) => number;
|
|
|
55
22
|
export const wasmdashtransaction_output_count: (a: number) => number;
|
|
56
23
|
export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
|
|
57
24
|
export const wasmdashtransaction_version: (a: number) => number;
|
|
58
|
-
export const
|
|
59
|
-
export const
|
|
60
|
-
export const
|
|
61
|
-
export const
|
|
62
|
-
export const
|
|
63
|
-
export const
|
|
64
|
-
export const
|
|
65
|
-
export const
|
|
66
|
-
export const
|
|
67
|
-
export const
|
|
25
|
+
export const wasmdimensions_empty: () => number;
|
|
26
|
+
export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
27
|
+
export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
|
|
28
|
+
export const wasmdimensions_from_output_script_length: (a: number) => number;
|
|
29
|
+
export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
|
|
30
|
+
export const wasmdimensions_from_psbt: (a: number, b: number) => void;
|
|
31
|
+
export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
|
|
32
|
+
export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
|
|
33
|
+
export const wasmdimensions_get_output_vsize: (a: number) => number;
|
|
34
|
+
export const wasmdimensions_get_output_weight: (a: number) => number;
|
|
35
|
+
export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
|
|
36
|
+
export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
|
|
37
|
+
export const wasmdimensions_has_segwit: (a: number) => number;
|
|
38
|
+
export const wasmdimensions_plus: (a: number, b: number) => number;
|
|
39
|
+
export const wasmdimensions_times: (a: number, b: number) => number;
|
|
68
40
|
export const wasmtransaction_add_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
69
41
|
export const wasmtransaction_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
70
42
|
export const wasmtransaction_add_output: (a: number, b: number, c: number, d: bigint) => number;
|
|
@@ -122,7 +94,6 @@ export const wrappsbt_update_input_with_descriptor: (a: number, b: number, c: nu
|
|
|
122
94
|
export const wrappsbt_update_output_with_descriptor: (a: number, b: number, c: number, d: number) => void;
|
|
123
95
|
export const wrappsbt_validate_signature_at_input: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
124
96
|
export const wrappsbt_verify_signature_with_key: (a: number, b: number, c: number, d: number) => void;
|
|
125
|
-
export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
126
97
|
export const wasmtransaction_input_count: (a: number) => number;
|
|
127
98
|
export const wasmtransaction_output_count: (a: number) => number;
|
|
128
99
|
export const wasmzcashtransaction_input_count: (a: number) => number;
|
|
@@ -155,10 +126,8 @@ export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
|
155
126
|
export const __wbg_bip322namespace_free: (a: number, b: number) => void;
|
|
156
127
|
export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
|
|
157
128
|
export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
|
|
158
|
-
export const
|
|
159
|
-
export const
|
|
160
|
-
export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
|
|
161
|
-
export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
|
|
129
|
+
export const __wbg_wasmbip32_free: (a: number, b: number) => void;
|
|
130
|
+
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
162
131
|
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;
|
|
163
132
|
export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
|
|
164
133
|
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;
|
|
@@ -195,8 +164,10 @@ export const bitgopsbt_finalize_all_inputs: (a: number, b: number) => void;
|
|
|
195
164
|
export const bitgopsbt_from_bytes: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
196
165
|
export const bitgopsbt_from_half_signed_legacy_transaction: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
197
166
|
export const bitgopsbt_from_half_signed_legacy_transaction_dash: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
198
|
-
export const
|
|
199
|
-
export const
|
|
167
|
+
export const bitgopsbt_from_network_format: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
168
|
+
export const bitgopsbt_from_network_format_dash: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
169
|
+
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;
|
|
170
|
+
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;
|
|
200
171
|
export const bitgopsbt_generate_musig2_nonces: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
201
172
|
export const bitgopsbt_get_global_xpubs: (a: number) => number;
|
|
202
173
|
export const bitgopsbt_get_input_kv: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -243,33 +214,64 @@ export const fixedscriptwalletnamespace_output_script_with_network_str: (a: numb
|
|
|
243
214
|
export const fixedscriptwalletnamespace_p2sh_p2pk_output_script: (a: number, b: number, c: number) => void;
|
|
244
215
|
export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
245
216
|
export const fixedscriptwalletnamespace_to_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
217
|
+
export const wasmbip32_chain_code: (a: number) => number;
|
|
218
|
+
export const wasmbip32_depth: (a: number) => number;
|
|
219
|
+
export const wasmbip32_derive: (a: number, b: number, c: number) => void;
|
|
220
|
+
export const wasmbip32_derive_hardened: (a: number, b: number, c: number) => void;
|
|
221
|
+
export const wasmbip32_derive_path: (a: number, b: number, c: number, d: number) => void;
|
|
222
|
+
export const wasmbip32_equals: (a: number, b: number) => number;
|
|
223
|
+
export const wasmbip32_fingerprint: (a: number) => number;
|
|
224
|
+
export const wasmbip32_from_base58: (a: number, b: number, c: number) => void;
|
|
225
|
+
export const wasmbip32_from_bip32_interface: (a: number, b: number) => void;
|
|
226
|
+
export const wasmbip32_from_seed: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
227
|
+
export const wasmbip32_from_seed_sha256: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
228
|
+
export const wasmbip32_from_xprv: (a: number, b: number, c: number) => void;
|
|
229
|
+
export const wasmbip32_from_xpub: (a: number, b: number, c: number) => void;
|
|
230
|
+
export const wasmbip32_identifier: (a: number) => number;
|
|
231
|
+
export const wasmbip32_index: (a: number) => number;
|
|
232
|
+
export const wasmbip32_is_neutered: (a: number) => number;
|
|
233
|
+
export const wasmbip32_neutered: (a: number) => number;
|
|
234
|
+
export const wasmbip32_parent_fingerprint: (a: number) => number;
|
|
235
|
+
export const wasmbip32_private_key: (a: number) => number;
|
|
236
|
+
export const wasmbip32_public_key: (a: number) => number;
|
|
237
|
+
export const wasmbip32_to_base58: (a: number, b: number) => void;
|
|
238
|
+
export const wasmbip32_to_wif: (a: number, b: number) => void;
|
|
239
|
+
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
240
|
+
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
241
|
+
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
242
|
+
export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
243
|
+
export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
|
|
244
|
+
export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
|
|
245
|
+
export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
|
|
246
|
+
export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
|
|
247
|
+
export const __wbg_messagenamespace_free: (a: number, b: number) => void;
|
|
248
|
+
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
249
|
+
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
250
|
+
export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
|
|
251
|
+
export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
252
|
+
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;
|
|
246
253
|
export const isInspectEnabled: () => number;
|
|
247
254
|
export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
|
|
248
255
|
export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
249
256
|
export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
250
|
-
export const
|
|
251
|
-
export const
|
|
252
|
-
export const
|
|
253
|
-
export const
|
|
254
|
-
export const
|
|
255
|
-
export const
|
|
256
|
-
export const
|
|
257
|
-
export const
|
|
258
|
-
export const
|
|
259
|
-
export const
|
|
260
|
-
export const
|
|
261
|
-
export const
|
|
262
|
-
export const
|
|
263
|
-
export const
|
|
264
|
-
export const
|
|
265
|
-
export const wasmdimensions_plus: (a: number, b: number) => number;
|
|
266
|
-
export const wasmdimensions_times: (a: number, b: number) => number;
|
|
257
|
+
export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
|
|
258
|
+
export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
|
|
259
|
+
export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
|
|
260
|
+
export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
|
|
261
|
+
export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
|
|
262
|
+
export const wasmecpair_private_key: (a: number) => number;
|
|
263
|
+
export const wasmecpair_public_key: (a: number) => number;
|
|
264
|
+
export const wasmecpair_to_wif: (a: number, b: number) => void;
|
|
265
|
+
export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
|
|
266
|
+
export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
|
|
267
|
+
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
268
|
+
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
269
|
+
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
270
|
+
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
271
|
+
export const wasmrootwalletkeys_with_derivation_prefixes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
267
272
|
export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
|
|
268
|
-
export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
|
|
269
273
|
export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
270
274
|
export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
271
|
-
export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
|
|
272
|
-
export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
|
|
273
275
|
export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
|
|
274
276
|
export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
|
|
275
277
|
export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: 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
|
*
|