@bitgo/wasm-utxo 1.44.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/cjs/js/fixedScriptWallet/BitGoPsbt.d.ts +34 -50
  2. package/dist/cjs/js/fixedScriptWallet/BitGoPsbt.js +71 -32
  3. package/dist/cjs/js/fixedScriptWallet/RootWalletKeys.d.ts +5 -0
  4. package/dist/cjs/js/fixedScriptWallet/RootWalletKeys.js +7 -0
  5. package/dist/cjs/js/fixedScriptWallet/index.d.ts +1 -1
  6. package/dist/cjs/js/fixedScriptWallet/index.js +2 -1
  7. package/dist/cjs/js/index.d.ts +6 -1
  8. package/dist/cjs/js/psbt.d.ts +15 -6
  9. package/dist/cjs/js/transaction.d.ts +2 -6
  10. package/dist/cjs/js/transaction.js +6 -6
  11. package/dist/cjs/js/wasm/wasm_utxo.d.ts +32 -86
  12. package/dist/cjs/js/wasm/wasm_utxo.js +463 -81
  13. package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
  14. package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +71 -54
  15. package/dist/esm/js/fixedScriptWallet/BitGoPsbt.d.ts +34 -50
  16. package/dist/esm/js/fixedScriptWallet/BitGoPsbt.js +71 -33
  17. package/dist/esm/js/fixedScriptWallet/RootWalletKeys.d.ts +5 -0
  18. package/dist/esm/js/fixedScriptWallet/RootWalletKeys.js +7 -0
  19. package/dist/esm/js/fixedScriptWallet/index.d.ts +1 -1
  20. package/dist/esm/js/fixedScriptWallet/index.js +1 -1
  21. package/dist/esm/js/index.d.ts +6 -1
  22. package/dist/esm/js/index.js +1 -1
  23. package/dist/esm/js/psbt.d.ts +15 -6
  24. package/dist/esm/js/transaction.d.ts +2 -6
  25. package/dist/esm/js/transaction.js +6 -6
  26. package/dist/esm/js/wasm/wasm_utxo.d.ts +32 -86
  27. package/dist/esm/js/wasm/wasm_utxo_bg.js +463 -81
  28. package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
  29. package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +71 -54
  30. package/package.json +11 -4
Binary file
@@ -1,20 +1,31 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const __wbg_messagenamespace_free: (a: number, b: number) => void;
4
+ export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
5
+ export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
5
6
  export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
6
- export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
7
- export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
7
+ export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
8
+ 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;
9
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
10
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
11
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
8
12
  export const wasmrootwalletkeys_backup_key: (a: number) => number;
9
13
  export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
10
14
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
11
15
  export const wasmrootwalletkeys_user_key: (a: number) => number;
12
16
  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;
13
17
  export const __wbg_addressnamespace_free: (a: number, b: number) => void;
18
+ export const __wbg_messagenamespace_free: (a: number, b: number) => void;
19
+ export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
14
20
  export const __wbg_wasmecpair_free: (a: number, b: number) => void;
21
+ export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
15
22
  export const __wbg_wrappsbt_free: (a: number, b: number) => void;
16
23
  export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
17
24
  export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
25
+ export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
26
+ export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
27
+ export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
28
+ export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
18
29
  export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
19
30
  export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
20
31
  export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
@@ -25,12 +36,21 @@ export const wasmecpair_public_key: (a: number) => number;
25
36
  export const wasmecpair_to_wif: (a: number, b: number) => void;
26
37
  export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
27
38
  export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
39
+ export const wrapminiscript_encode: (a: number, b: number) => void;
40
+ export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
41
+ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
42
+ export const wrapminiscript_node: (a: number, b: number) => void;
43
+ export const wrapminiscript_toAsmString: (a: number, b: number) => void;
44
+ export const wrapminiscript_toString: (a: number, b: number) => void;
28
45
  export const wrappsbt_addInput: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number) => void;
46
+ export const wrappsbt_addInputAtIndex: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number, j: number) => void;
29
47
  export const wrappsbt_addOutput: (a: number, b: number, c: number, d: bigint) => number;
48
+ export const wrappsbt_addOutputAtIndex: (a: number, b: number, c: number, d: number, e: number, f: bigint) => void;
30
49
  export const wrappsbt_clone: (a: number) => number;
31
50
  export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
32
51
  export const wrappsbt_extractTransaction: (a: number, b: number) => void;
33
52
  export const wrappsbt_finalize: (a: number, b: number) => void;
53
+ export const wrappsbt_getGlobalXpubs: (a: number) => number;
34
54
  export const wrappsbt_getInputs: (a: number, b: number) => void;
35
55
  export const wrappsbt_getOutputs: (a: number, b: number) => void;
36
56
  export const wrappsbt_getOutputsWithAddress: (a: number, b: number, c: number, d: number) => void;
@@ -41,6 +61,8 @@ export const wrappsbt_inputCount: (a: number) => number;
41
61
  export const wrappsbt_lockTime: (a: number) => number;
42
62
  export const wrappsbt_new: (a: number, b: number) => number;
43
63
  export const wrappsbt_outputCount: (a: number) => number;
64
+ export const wrappsbt_removeInput: (a: number, b: number, c: number) => void;
65
+ export const wrappsbt_removeOutput: (a: number, b: number, c: number) => void;
44
66
  export const wrappsbt_serialize: (a: number, b: number) => void;
45
67
  export const wrappsbt_signAll: (a: number, b: number, c: number) => void;
46
68
  export const wrappsbt_signAllWithEcpair: (a: number, b: number, c: number) => void;
@@ -52,29 +74,17 @@ export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: numb
52
74
  export const wrappsbt_validateSignatureAtInput: (a: number, b: number, c: number, d: number, e: number) => void;
53
75
  export const wrappsbt_verifySignatureWithKey: (a: number, b: number, c: number, d: number) => void;
54
76
  export const wrappsbt_version: (a: number) => number;
55
- export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
56
- export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
77
+ export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
57
78
  export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
58
79
  export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
59
- export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
60
- export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
61
- export const wasmdimensions_empty: () => number;
62
- export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
63
- export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
64
- export const wasmdimensions_from_output_script_length: (a: number) => number;
65
- export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
66
- export const wasmdimensions_from_psbt: (a: number, b: number) => void;
67
- export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
68
- export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
69
- export const wasmdimensions_get_output_vsize: (a: number) => number;
70
- export const wasmdimensions_get_output_weight: (a: number) => number;
71
- export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
72
- export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
73
- export const wasmdimensions_has_segwit: (a: number) => number;
74
- export const wasmdimensions_plus: (a: number, b: number) => number;
75
- export const wasmdimensions_times: (a: number, b: number) => number;
80
+ export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
81
+ export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
82
+ export const wasmdashtransaction_get_txid: (a: number, b: number) => void;
83
+ export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
76
84
  export const wasmtransaction_add_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
85
+ export const wasmtransaction_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
77
86
  export const wasmtransaction_add_output: (a: number, b: number, c: number, d: bigint) => number;
87
+ export const wasmtransaction_add_output_at_index: (a: number, b: number, c: number, d: number, e: number, f: bigint) => void;
78
88
  export const wasmtransaction_create: () => number;
79
89
  export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
80
90
  export const wasmtransaction_get_txid: (a: number, b: number) => void;
@@ -83,25 +93,40 @@ export const wasmtransaction_to_bytes: (a: number, b: number) => void;
83
93
  export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
84
94
  export const wasmzcashtransaction_get_txid: (a: number, b: number) => void;
85
95
  export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
96
+ export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
97
+ export const wrapdescriptor_descType: (a: number, b: number) => void;
98
+ export const wrapdescriptor_encode: (a: number, b: number) => void;
99
+ export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
100
+ export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
101
+ export const wrapdescriptor_hasWildcard: (a: number) => number;
102
+ export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
103
+ export const wrapdescriptor_node: (a: number, b: number) => void;
104
+ export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
105
+ export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
106
+ export const wrapdescriptor_toString: (a: number, b: number) => void;
86
107
  export const __wbg_bip322namespace_free: (a: number, b: number) => void;
87
108
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
88
109
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
89
- export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
90
110
  export const __wbg_wasmbip32_free: (a: number, b: number) => void;
91
- export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
92
- export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
111
+ export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
93
112
  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;
94
113
  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;
95
114
  export const bip322namespace_verify_bip322_psbt_input_with_pubkeys: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
96
115
  export const bip322namespace_verify_bip322_tx_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) => void;
97
116
  export const bip322namespace_verify_bip322_tx_input_with_pubkeys: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
98
117
  export const bitgopsbt_add_input: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number, j: number, k: number) => void;
118
+ export const bitgopsbt_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number, j: number, k: number, l: number) => void;
99
119
  export const bitgopsbt_add_output: (a: number, b: number, c: number, d: number, e: bigint) => void;
120
+ export const bitgopsbt_add_output_at_index: (a: number, b: number, c: number, d: number, e: number, f: bigint) => void;
100
121
  export const bitgopsbt_add_output_with_address: (a: number, b: number, c: number, d: number, e: bigint) => void;
122
+ export const bitgopsbt_add_output_with_address_at_index: (a: number, b: number, c: number, d: number, e: number, f: bigint) => void;
101
123
  export const bitgopsbt_add_paygo_attestation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
102
124
  export const bitgopsbt_add_replay_protection_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number, j: number) => void;
125
+ export const bitgopsbt_add_replay_protection_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: bigint, i: number, j: number, k: number) => void;
103
126
  export const bitgopsbt_add_wallet_input: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number) => void;
127
+ export const bitgopsbt_add_wallet_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number) => void;
104
128
  export const bitgopsbt_add_wallet_output: (a: number, b: number, c: number, d: number, e: bigint, f: number) => void;
129
+ export const bitgopsbt_add_wallet_output_at_index: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number) => void;
105
130
  export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number) => void;
106
131
  export const bitgopsbt_create_empty: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
107
132
  export const bitgopsbt_create_empty_zcash: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
@@ -115,6 +140,7 @@ export const bitgopsbt_extract_zcash_transaction: (a: number, b: number) => void
115
140
  export const bitgopsbt_finalize_all_inputs: (a: number, b: number) => void;
116
141
  export const bitgopsbt_from_bytes: (a: number, b: number, c: number, d: number, e: number) => void;
117
142
  export const bitgopsbt_generate_musig2_nonces: (a: number, b: number, c: number, d: number, e: number) => void;
143
+ export const bitgopsbt_get_global_xpubs: (a: number) => number;
118
144
  export const bitgopsbt_get_inputs: (a: number, b: number) => void;
119
145
  export const bitgopsbt_get_network_type: (a: number, b: number) => void;
120
146
  export const bitgopsbt_get_outputs: (a: number, b: number) => void;
@@ -126,6 +152,8 @@ export const bitgopsbt_network: (a: number, b: number) => void;
126
152
  export const bitgopsbt_output_count: (a: number) => number;
127
153
  export const bitgopsbt_parse_outputs_with_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
128
154
  export const bitgopsbt_parse_transaction_with_wallet_keys: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
155
+ export const bitgopsbt_remove_input: (a: number, b: number, c: number) => void;
156
+ export const bitgopsbt_remove_output: (a: number, b: number, c: number) => void;
129
157
  export const bitgopsbt_serialize: (a: number, b: number) => void;
130
158
  export const bitgopsbt_sign_all_musig2_inputs: (a: number, b: number, c: number) => void;
131
159
  export const bitgopsbt_sign_all_replay_protection_inputs: (a: number, b: number, c: number) => void;
@@ -149,9 +177,7 @@ export const fixedscriptwalletnamespace_output_script: (a: number, b: number, c:
149
177
  export const fixedscriptwalletnamespace_output_script_with_network_str: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
150
178
  export const fixedscriptwalletnamespace_p2sh_p2pk_output_script: (a: number, b: number, c: number) => void;
151
179
  export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
152
- export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
153
- 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;
154
- export const isInspectEnabled: () => number;
180
+ export const fixedscriptwalletnamespace_to_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
155
181
  export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
156
182
  export const wasmbip32_chain_code: (a: number) => number;
157
183
  export const wasmbip32_depth: (a: number) => number;
@@ -175,37 +201,28 @@ export const wasmbip32_private_key: (a: number) => number;
175
201
  export const wasmbip32_public_key: (a: number) => number;
176
202
  export const wasmbip32_to_base58: (a: number, b: number) => void;
177
203
  export const wasmbip32_to_wif: (a: number, b: number) => void;
178
- export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
179
- export const wasmdashtransaction_get_txid: (a: number, b: number) => void;
180
- export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
181
- export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
182
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
183
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
204
+ export const wasmdimensions_empty: () => number;
205
+ export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
206
+ export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
207
+ export const wasmdimensions_from_output_script_length: (a: number) => number;
208
+ export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
209
+ export const wasmdimensions_from_psbt: (a: number, b: number) => void;
210
+ export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
211
+ export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
212
+ export const wasmdimensions_get_output_vsize: (a: number) => number;
213
+ export const wasmdimensions_get_output_weight: (a: number) => number;
214
+ export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
215
+ export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
216
+ export const wasmdimensions_has_segwit: (a: number) => number;
217
+ export const wasmdimensions_plus: (a: number, b: number) => number;
218
+ export const wasmdimensions_times: (a: number, b: number) => number;
184
219
  export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
220
+ export const isInspectEnabled: () => number;
185
221
  export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
186
222
  export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
187
- export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
188
223
  export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
189
224
  export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
190
- export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
191
- export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
192
- export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
193
- export const wrapdescriptor_descType: (a: number, b: number) => void;
194
- export const wrapdescriptor_encode: (a: number, b: number) => void;
195
- export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
196
- export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
197
- export const wrapdescriptor_hasWildcard: (a: number) => number;
198
- export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
199
- export const wrapdescriptor_node: (a: number, b: number) => void;
200
- export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
201
- export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
202
- export const wrapdescriptor_toString: (a: number, b: number) => void;
203
- export const wrapminiscript_encode: (a: number, b: number) => void;
204
- export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
205
- export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
206
- export const wrapminiscript_node: (a: number, b: number) => void;
207
- export const wrapminiscript_toAsmString: (a: number, b: number) => void;
208
- export const wrapminiscript_toString: (a: number, b: number) => void;
225
+ export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
209
226
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
210
227
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
211
228
  export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
@@ -1,8 +1,8 @@
1
1
  import { BitGoPsbt as WasmBitGoPsbt, type PsbtInputData, type PsbtOutputData, type PsbtOutputDataWithAddress } from "../wasm/wasm_utxo.js";
2
- import type { IPsbtIntrospectionWithAddress } from "../psbt.js";
3
- import { type WalletKeysArg } from "./RootWalletKeys.js";
2
+ import type { IPsbtWithAddress } from "../psbt.js";
3
+ import { type WalletKeysArg, RootWalletKeys } from "./RootWalletKeys.js";
4
4
  import { type ReplayProtectionArg } from "./ReplayProtection.js";
5
- import { type BIP32Arg } from "../bip32.js";
5
+ import { type BIP32Arg, BIP32 } from "../bip32.js";
6
6
  import { type ECPairArg } from "../ecpair.js";
7
7
  import type { UtxolibName } from "../utxolibCompat.js";
8
8
  import type { CoinName } from "../coinName.js";
@@ -98,7 +98,7 @@ export type ParseTransactionOptions = {
98
98
  export type ParseOutputsOptions = {
99
99
  payGoPubkeys?: ECPairArg[];
100
100
  };
101
- export declare class BitGoPsbt implements IPsbtIntrospectionWithAddress {
101
+ export declare class BitGoPsbt implements IPsbtWithAddress {
102
102
  protected _wasm: WasmBitGoPsbt;
103
103
  protected constructor(_wasm: WasmBitGoPsbt);
104
104
  /**
@@ -155,6 +155,8 @@ export declare class BitGoPsbt implements IPsbtIntrospectionWithAddress {
155
155
  * }, outputScript);
156
156
  * ```
157
157
  */
158
+ addInputAtIndex(index: number, txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number): number;
159
+ addInputAtIndex(index: number, options: AddInputOptions, script: Uint8Array): number;
158
160
  addInput(options: AddInputOptions, script: Uint8Array): number;
159
161
  /**
160
162
  * Add an output to the PSBT
@@ -168,41 +170,11 @@ export declare class BitGoPsbt implements IPsbtIntrospectionWithAddress {
168
170
  * const outputIndex = psbt.addOutput(outputScript, 50000n);
169
171
  * ```
170
172
  */
173
+ addOutputAtIndex(index: number, script: Uint8Array, value: bigint): number;
174
+ addOutputAtIndex(index: number, address: string, value: bigint): number;
175
+ addOutputAtIndex(index: number, options: AddOutputOptions): number;
171
176
  addOutput(script: Uint8Array, value: bigint): number;
172
- /**
173
- * Add an output to the PSBT by address
174
- *
175
- * @param address - The destination address
176
- * @param value - Value in satoshis
177
- * @returns The index of the newly added output
178
- *
179
- * @example
180
- * ```typescript
181
- * const outputIndex = psbt.addOutput("bc1q...", 50000n);
182
- * ```
183
- */
184
177
  addOutput(address: string, value: bigint): number;
185
- /**
186
- * Add an output to the PSBT
187
- *
188
- * @param options - Output options (script or address, and value)
189
- * @returns The index of the newly added output
190
- *
191
- * @example
192
- * ```typescript
193
- * // Using script
194
- * const outputIndex = psbt.addOutput({
195
- * script: outputScript,
196
- * value: 50000n,
197
- * });
198
- *
199
- * // Using address
200
- * const outputIndex = psbt.addOutput({
201
- * address: "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4",
202
- * value: 50000n,
203
- * });
204
- * ```
205
- */
206
178
  addOutput(options: AddOutputOptions): number;
207
179
  /**
208
180
  * Add a wallet input with full PSBT metadata
@@ -243,6 +215,7 @@ export declare class BitGoPsbt implements IPsbtIntrospectionWithAddress {
243
215
  * );
244
216
  * ```
245
217
  */
218
+ addWalletInputAtIndex(index: number, inputOptions: AddInputOptions, walletKeys: WalletKeysArg, walletOptions: AddWalletInputOptions): number;
246
219
  addWalletInput(inputOptions: AddInputOptions, walletKeys: WalletKeysArg, walletOptions: AddWalletInputOptions): number;
247
220
  /**
248
221
  * Add a wallet output with full PSBT metadata
@@ -274,6 +247,7 @@ export declare class BitGoPsbt implements IPsbtIntrospectionWithAddress {
274
247
  * });
275
248
  * ```
276
249
  */
250
+ addWalletOutputAtIndex(index: number, walletKeys: WalletKeysArg, options: AddWalletOutputOptions): number;
277
251
  addWalletOutput(walletKeys: WalletKeysArg, options: AddWalletOutputOptions): number;
278
252
  /**
279
253
  * Add a replay protection input to the PSBT
@@ -294,22 +268,21 @@ export declare class BitGoPsbt implements IPsbtIntrospectionWithAddress {
294
268
  * );
295
269
  * ```
296
270
  */
271
+ addReplayProtectionInputAtIndex(index: number, inputOptions: AddInputOptions, key: ECPairArg): number;
297
272
  addReplayProtectionInput(inputOptions: AddInputOptions, key: ECPairArg): number;
273
+ removeInput(index: number): void;
274
+ removeOutput(index: number): void;
298
275
  /**
299
276
  * Get the unsigned transaction ID
300
277
  * @returns The unsigned transaction ID
301
278
  */
302
- unsignedTxid(): string;
279
+ unsignedTxId(): string;
303
280
  /**
304
281
  * Get the transaction version
305
282
  * @returns The transaction version number
306
283
  */
307
- get version(): number;
308
- /**
309
- * Get the transaction lock time
310
- * @returns The transaction lock time
311
- */
312
- get lockTime(): number;
284
+ version(): number;
285
+ lockTime(): number;
313
286
  /**
314
287
  * Parse transaction with wallet keys to identify wallet inputs/outputs
315
288
  * @param walletKeys - The wallet keys to use for identification
@@ -584,12 +557,8 @@ export declare class BitGoPsbt implements IPsbtIntrospectionWithAddress {
584
557
  * Get the number of inputs in the PSBT
585
558
  * @returns The number of inputs
586
559
  */
587
- get inputCount(): number;
588
- /**
589
- * Get the number of outputs in the PSBT
590
- * @returns The number of outputs
591
- */
592
- get outputCount(): number;
560
+ inputCount(): number;
561
+ outputCount(): number;
593
562
  /**
594
563
  * Get all PSBT inputs as an array
595
564
  *
@@ -626,4 +595,19 @@ export declare class BitGoPsbt implements IPsbtIntrospectionWithAddress {
626
595
  * ```
627
596
  */
628
597
  getOutputsWithAddress(): PsbtOutputDataWithAddress[];
598
+ /**
599
+ * Returns the unordered global xpubs from this PSBT as BIP32 instances.
600
+ */
601
+ getGlobalXpubs(): BIP32[];
629
602
  }
603
+ /**
604
+ * Extract sorted wallet keys from a PSBT's global xpub fields.
605
+ *
606
+ * This should only be used in exceptional circumstances where the real wallet
607
+ * keys are not available — for example, legacy cold wallets where the PSBT
608
+ * was built with derived keys (from coldDerivationSeed) but the caller only
609
+ * has root xpubs. Prefer passing wallet keys explicitly wherever possible.
610
+ *
611
+ * @returns Sorted [user, backup, bitgo] RootWalletKeys
612
+ */
613
+ export declare function getWalletKeysFromPsbt(psbt: BitGoPsbt, xpubs: BIP32[]): RootWalletKeys;
@@ -1,4 +1,4 @@
1
- import { BitGoPsbt as WasmBitGoPsbt, } from "../wasm/wasm_utxo.js";
1
+ import { BitGoPsbt as WasmBitGoPsbt, FixedScriptWalletNamespace, } from "../wasm/wasm_utxo.js";
2
2
  import { RootWalletKeys } from "./RootWalletKeys.js";
3
3
  import { ReplayProtection } from "./ReplayProtection.js";
4
4
  import { BIP32, isBIP32Arg } from "../bip32.js";
@@ -53,28 +53,35 @@ export class BitGoPsbt {
53
53
  const wasm = WasmBitGoPsbt.from_bytes(bytes, network);
54
54
  return new BitGoPsbt(wasm);
55
55
  }
56
- /**
57
- * Add an input to the PSBT
58
- *
59
- * This adds a transaction input and corresponding PSBT input metadata.
60
- * The witness_utxo is automatically populated for modern signing compatibility.
61
- *
62
- * @param options - Input options (txid, vout, value, sequence)
63
- * @param script - Output script of the UTXO being spent
64
- * @returns The index of the newly added input
65
- *
66
- * @example
67
- * ```typescript
68
- * const inputIndex = psbt.addInput({
69
- * txid: "abc123...",
70
- * vout: 0,
71
- * value: 100000n,
72
- * }, outputScript);
73
- * ```
74
- */
56
+ addInputAtIndex(index, txidOrOptions, voutOrScript, value, script, sequence) {
57
+ if (typeof txidOrOptions === "string") {
58
+ return this._wasm.add_input_at_index(index, txidOrOptions, voutOrScript, value, script, sequence);
59
+ }
60
+ const options = txidOrOptions;
61
+ return this._wasm.add_input_at_index(index, options.txid, options.vout, options.value, voutOrScript, options.sequence, options.prevTx);
62
+ }
75
63
  addInput(options, script) {
76
64
  return this._wasm.add_input(options.txid, options.vout, options.value, script, options.sequence, options.prevTx);
77
65
  }
66
+ addOutputAtIndex(index, scriptOrOptions, value) {
67
+ if (scriptOrOptions instanceof Uint8Array || typeof scriptOrOptions === "string") {
68
+ if (value === undefined) {
69
+ throw new Error("Value is required when passing a script or address");
70
+ }
71
+ if (scriptOrOptions instanceof Uint8Array) {
72
+ return this._wasm.add_output_at_index(index, scriptOrOptions, value);
73
+ }
74
+ return this._wasm.add_output_with_address_at_index(index, scriptOrOptions, value);
75
+ }
76
+ const options = scriptOrOptions;
77
+ if ("script" in options) {
78
+ return this._wasm.add_output_at_index(index, options.script, options.value);
79
+ }
80
+ if ("address" in options) {
81
+ return this._wasm.add_output_with_address_at_index(index, options.address, options.value);
82
+ }
83
+ throw new Error("Invalid output options");
84
+ }
78
85
  addOutput(scriptOrOptions, value) {
79
86
  if (scriptOrOptions instanceof Uint8Array || typeof scriptOrOptions === "string") {
80
87
  if (value === undefined) {
@@ -133,6 +140,10 @@ export class BitGoPsbt {
133
140
  * );
134
141
  * ```
135
142
  */
143
+ addWalletInputAtIndex(index, inputOptions, walletKeys, walletOptions) {
144
+ const keys = RootWalletKeys.from(walletKeys);
145
+ return this._wasm.add_wallet_input_at_index(index, inputOptions.txid, inputOptions.vout, inputOptions.value, keys.wasm, walletOptions.scriptId.chain, walletOptions.scriptId.index, walletOptions.signPath?.signer, walletOptions.signPath?.cosigner, inputOptions.sequence, inputOptions.prevTx);
146
+ }
136
147
  addWalletInput(inputOptions, walletKeys, walletOptions) {
137
148
  const keys = RootWalletKeys.from(walletKeys);
138
149
  return this._wasm.add_wallet_input(inputOptions.txid, inputOptions.vout, inputOptions.value, keys.wasm, walletOptions.scriptId.chain, walletOptions.scriptId.index, walletOptions.signPath?.signer, walletOptions.signPath?.cosigner, inputOptions.sequence, inputOptions.prevTx);
@@ -167,6 +178,10 @@ export class BitGoPsbt {
167
178
  * });
168
179
  * ```
169
180
  */
181
+ addWalletOutputAtIndex(index, walletKeys, options) {
182
+ const keys = RootWalletKeys.from(walletKeys);
183
+ return this._wasm.add_wallet_output_at_index(index, options.chain, options.index, options.value, keys.wasm);
184
+ }
170
185
  addWalletOutput(walletKeys, options) {
171
186
  const keys = RootWalletKeys.from(walletKeys);
172
187
  return this._wasm.add_wallet_output(options.chain, options.index, options.value, keys.wasm);
@@ -190,29 +205,35 @@ export class BitGoPsbt {
190
205
  * );
191
206
  * ```
192
207
  */
208
+ addReplayProtectionInputAtIndex(index, inputOptions, key) {
209
+ const ecpair = ECPair.from(key);
210
+ return this._wasm.add_replay_protection_input_at_index(index, ecpair.wasm, inputOptions.txid, inputOptions.vout, inputOptions.value, inputOptions.sequence, inputOptions.prevTx);
211
+ }
193
212
  addReplayProtectionInput(inputOptions, key) {
194
213
  const ecpair = ECPair.from(key);
195
214
  return this._wasm.add_replay_protection_input(ecpair.wasm, inputOptions.txid, inputOptions.vout, inputOptions.value, inputOptions.sequence, inputOptions.prevTx);
196
215
  }
216
+ removeInput(index) {
217
+ this._wasm.remove_input(index);
218
+ }
219
+ removeOutput(index) {
220
+ this._wasm.remove_output(index);
221
+ }
197
222
  /**
198
223
  * Get the unsigned transaction ID
199
224
  * @returns The unsigned transaction ID
200
225
  */
201
- unsignedTxid() {
226
+ unsignedTxId() {
202
227
  return this._wasm.unsigned_txid();
203
228
  }
204
229
  /**
205
230
  * Get the transaction version
206
231
  * @returns The transaction version number
207
232
  */
208
- get version() {
233
+ version() {
209
234
  return this._wasm.version();
210
235
  }
211
- /**
212
- * Get the transaction lock time
213
- * @returns The transaction lock time
214
- */
215
- get lockTime() {
236
+ lockTime() {
216
237
  return this._wasm.lock_time();
217
238
  }
218
239
  /**
@@ -538,14 +559,10 @@ export class BitGoPsbt {
538
559
  * Get the number of inputs in the PSBT
539
560
  * @returns The number of inputs
540
561
  */
541
- get inputCount() {
562
+ inputCount() {
542
563
  return this._wasm.input_count();
543
564
  }
544
- /**
545
- * Get the number of outputs in the PSBT
546
- * @returns The number of outputs
547
- */
548
- get outputCount() {
565
+ outputCount() {
549
566
  return this._wasm.output_count();
550
567
  }
551
568
  /**
@@ -590,4 +607,25 @@ export class BitGoPsbt {
590
607
  getOutputsWithAddress() {
591
608
  return this._wasm.get_outputs_with_address();
592
609
  }
610
+ /**
611
+ * Returns the unordered global xpubs from this PSBT as BIP32 instances.
612
+ */
613
+ getGlobalXpubs() {
614
+ const result = this._wasm.get_global_xpubs();
615
+ return result.map((w) => BIP32.fromWasm(w));
616
+ }
617
+ }
618
+ /**
619
+ * Extract sorted wallet keys from a PSBT's global xpub fields.
620
+ *
621
+ * This should only be used in exceptional circumstances where the real wallet
622
+ * keys are not available — for example, legacy cold wallets where the PSBT
623
+ * was built with derived keys (from coldDerivationSeed) but the caller only
624
+ * has root xpubs. Prefer passing wallet keys explicitly wherever possible.
625
+ *
626
+ * @returns Sorted [user, backup, bitgo] RootWalletKeys
627
+ */
628
+ export function getWalletKeysFromPsbt(psbt, xpubs) {
629
+ const wasmKeys = FixedScriptWalletNamespace.to_wallet_keys(psbt.wasm, xpubs[0].wasm, xpubs[1].wasm, xpubs[2].wasm);
630
+ return RootWalletKeys.fromWasm(wasmKeys);
593
631
  }
@@ -23,6 +23,11 @@ Triple<string>
23
23
  export declare class RootWalletKeys {
24
24
  private _wasm;
25
25
  private constructor();
26
+ /**
27
+ * Create a RootWalletKeys instance from a WasmRootWalletKeys instance (internal use)
28
+ * @internal
29
+ */
30
+ static fromWasm(wasm: WasmRootWalletKeys): RootWalletKeys;
26
31
  /**
27
32
  * Create a RootWalletKeys from various input formats
28
33
  * @param keys - Can be a triple of xpub strings, an IWalletKeys object, or another RootWalletKeys instance
@@ -32,6 +32,13 @@ export class RootWalletKeys {
32
32
  constructor(_wasm) {
33
33
  this._wasm = _wasm;
34
34
  }
35
+ /**
36
+ * Create a RootWalletKeys instance from a WasmRootWalletKeys instance (internal use)
37
+ * @internal
38
+ */
39
+ static fromWasm(wasm) {
40
+ return new RootWalletKeys(wasm);
41
+ }
35
42
  /**
36
43
  * Create a RootWalletKeys from various input formats
37
44
  * @param keys - Can be a triple of xpub strings, an IWalletKeys object, or another RootWalletKeys instance
@@ -5,7 +5,7 @@ export { outputScript, address } from "./address.js";
5
5
  export { Dimensions } from "./Dimensions.js";
6
6
  export { outputScriptTypes, inputScriptTypes, type OutputScriptType, type InputScriptType, type ScriptType, } from "./scriptType.js";
7
7
  export { ChainCode, chainCodes, assertChainCode, type Scope } from "./chains.js";
8
- export { BitGoPsbt, type NetworkName, type ScriptId, type ParsedInput, type ParsedOutput, type ParsedTransaction, type SignPath, type CreateEmptyOptions, type AddInputOptions, type AddOutputOptions, type AddWalletInputOptions, type AddWalletOutputOptions, type ParseTransactionOptions, type ParseOutputsOptions, } from "./BitGoPsbt.js";
8
+ export { BitGoPsbt, getWalletKeysFromPsbt, type NetworkName, type ScriptId, type ParsedInput, type ParsedOutput, type ParsedTransaction, type SignPath, type CreateEmptyOptions, type AddInputOptions, type AddOutputOptions, type AddWalletInputOptions, type AddWalletOutputOptions, type ParseTransactionOptions, type ParseOutputsOptions, } from "./BitGoPsbt.js";
9
9
  export { ZcashBitGoPsbt, type ZcashNetworkName, type CreateEmptyZcashOptions, } from "./ZcashBitGoPsbt.js";
10
10
  export type { PsbtBip32Derivation, PsbtInputData, PsbtOutputData, PsbtOutputDataWithAddress, PsbtWitnessUtxo, } from "../wasm/wasm_utxo.js";
11
11
  import type { ScriptType } from "./scriptType.js";
@@ -6,7 +6,7 @@ export { Dimensions } from "./Dimensions.js";
6
6
  export { outputScriptTypes, inputScriptTypes, } from "./scriptType.js";
7
7
  export { ChainCode, chainCodes, assertChainCode } from "./chains.js";
8
8
  // Bitcoin-like PSBT (for all non-Zcash networks)
9
- export { BitGoPsbt, } from "./BitGoPsbt.js";
9
+ export { BitGoPsbt, getWalletKeysFromPsbt, } from "./BitGoPsbt.js";
10
10
  // Zcash-specific PSBT subclass
11
11
  export { ZcashBitGoPsbt, } from "./ZcashBitGoPsbt.js";
12
12
  /**
@@ -74,6 +74,7 @@ declare module "./wasm/wasm_utxo.js" {
74
74
  getInputs(): PsbtInputData[];
75
75
  getOutputs(): PsbtOutputData[];
76
76
  getOutputsWithAddress(coin: import("./coinName.js").CoinName): PsbtOutputDataWithAddress[];
77
+ getGlobalXpubs(): WasmBIP32[];
77
78
  getPartialSignatures(inputIndex: number): Array<{
78
79
  pubkey: Uint8Array;
79
80
  signature: Uint8Array;
@@ -82,6 +83,10 @@ declare module "./wasm/wasm_utxo.js" {
82
83
  validateSignatureAtInput(inputIndex: number, pubkey: Uint8Array): boolean;
83
84
  verifySignatureWithKey(inputIndex: number, key: WasmBIP32): boolean;
84
85
  extractTransaction(): WasmTransaction;
86
+ addInputAtIndex(index: number, txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number): number;
87
+ addOutputAtIndex(index: number, script: Uint8Array, value: bigint): number;
88
+ removeInput(index: number): void;
89
+ removeOutput(index: number): void;
85
90
  unsignedTxId(): string;
86
91
  lockTime(): number;
87
92
  version(): number;
@@ -91,4 +96,4 @@ export { WrapDescriptor as Descriptor } from "./wasm/wasm_utxo.js";
91
96
  export { WrapMiniscript as Miniscript } from "./wasm/wasm_utxo.js";
92
97
  export { WrapPsbt as Psbt } from "./wasm/wasm_utxo.js";
93
98
  export { DashTransaction, Transaction, ZcashTransaction } from "./transaction.js";
94
- export { hasPsbtMagic, type IPsbtIntrospection, type IPsbtIntrospectionWithAddress, } from "./psbt.js";
99
+ export { hasPsbtMagic, type IPsbt, type IPsbtWithAddress } from "./psbt.js";
@@ -23,4 +23,4 @@ export { WrapDescriptor as Descriptor } from "./wasm/wasm_utxo.js";
23
23
  export { WrapMiniscript as Miniscript } from "./wasm/wasm_utxo.js";
24
24
  export { WrapPsbt as Psbt } from "./wasm/wasm_utxo.js";
25
25
  export { DashTransaction, Transaction, ZcashTransaction } from "./transaction.js";
26
- export { hasPsbtMagic, } from "./psbt.js";
26
+ export { hasPsbtMagic } from "./psbt.js";