@bitgo/wasm-utxo 1.44.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,20 +1,48 @@
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;
5
- 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;
8
- export const wasmrootwalletkeys_backup_key: (a: number) => number;
9
- export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
10
- export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
11
- export const wasmrootwalletkeys_user_key: (a: number) => number;
12
- 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;
4
+ export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
5
+ export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
6
+ export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
7
+ export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
8
+ export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
9
+ export const wasmdashtransaction_get_txid: (a: number, b: number) => void;
10
+ export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
11
+ export const wasmtransaction_add_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
12
+ export const wasmtransaction_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
13
+ export const wasmtransaction_add_output: (a: number, b: number, c: number, d: bigint) => number;
14
+ export const wasmtransaction_add_output_at_index: (a: number, b: number, c: number, d: number, e: number, f: bigint) => void;
15
+ export const wasmtransaction_create: () => number;
16
+ export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
17
+ export const wasmtransaction_get_txid: (a: number, b: number) => void;
18
+ export const wasmtransaction_get_vsize: (a: number) => number;
19
+ export const wasmtransaction_to_bytes: (a: number, b: number) => void;
20
+ export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
21
+ export const wasmzcashtransaction_get_txid: (a: number, b: number) => void;
22
+ export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
23
+ export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
24
+ export const wrapdescriptor_descType: (a: number, b: number) => void;
25
+ export const wrapdescriptor_encode: (a: number, b: number) => void;
26
+ export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
27
+ export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
28
+ export const wrapdescriptor_hasWildcard: (a: number) => number;
29
+ export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
30
+ export const wrapdescriptor_node: (a: number, b: number) => void;
31
+ export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
32
+ export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
33
+ export const wrapdescriptor_toString: (a: number, b: number) => void;
13
34
  export const __wbg_addressnamespace_free: (a: number, b: number) => void;
35
+ export const __wbg_messagenamespace_free: (a: number, b: number) => void;
36
+ export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
14
37
  export const __wbg_wasmecpair_free: (a: number, b: number) => void;
38
+ export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
15
39
  export const __wbg_wrappsbt_free: (a: number, b: number) => void;
16
40
  export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
17
41
  export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
42
+ export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
43
+ export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
44
+ export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
45
+ export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
18
46
  export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
19
47
  export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
20
48
  export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
@@ -25,8 +53,16 @@ export const wasmecpair_public_key: (a: number) => number;
25
53
  export const wasmecpair_to_wif: (a: number, b: number) => void;
26
54
  export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
27
55
  export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
56
+ export const wrapminiscript_encode: (a: number, b: number) => void;
57
+ export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
58
+ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
59
+ export const wrapminiscript_node: (a: number, b: number) => void;
60
+ export const wrapminiscript_toAsmString: (a: number, b: number) => void;
61
+ export const wrapminiscript_toString: (a: number, b: number) => void;
28
62
  export const wrappsbt_addInput: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number) => void;
63
+ 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
64
  export const wrappsbt_addOutput: (a: number, b: number, c: number, d: bigint) => number;
65
+ export const wrappsbt_addOutputAtIndex: (a: number, b: number, c: number, d: number, e: number, f: bigint) => void;
30
66
  export const wrappsbt_clone: (a: number) => number;
31
67
  export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
32
68
  export const wrappsbt_extractTransaction: (a: number, b: number) => void;
@@ -41,6 +77,8 @@ export const wrappsbt_inputCount: (a: number) => number;
41
77
  export const wrappsbt_lockTime: (a: number) => number;
42
78
  export const wrappsbt_new: (a: number, b: number) => number;
43
79
  export const wrappsbt_outputCount: (a: number) => number;
80
+ export const wrappsbt_removeInput: (a: number, b: number, c: number) => void;
81
+ export const wrappsbt_removeOutput: (a: number, b: number, c: number) => void;
44
82
  export const wrappsbt_serialize: (a: number, b: number) => void;
45
83
  export const wrappsbt_signAll: (a: number, b: number, c: number) => void;
46
84
  export const wrappsbt_signAllWithEcpair: (a: number, b: number, c: number) => void;
@@ -52,56 +90,42 @@ export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: numb
52
90
  export const wrappsbt_validateSignatureAtInput: (a: number, b: number, c: number, d: number, e: number) => void;
53
91
  export const wrappsbt_verifySignatureWithKey: (a: number, b: number, c: number, d: number) => void;
54
92
  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;
57
- export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
58
- 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;
76
- export const wasmtransaction_add_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
77
- export const wasmtransaction_add_output: (a: number, b: number, c: number, d: bigint) => number;
78
- export const wasmtransaction_create: () => number;
79
- export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
80
- export const wasmtransaction_get_txid: (a: number, b: number) => void;
81
- export const wasmtransaction_get_vsize: (a: number) => number;
82
- export const wasmtransaction_to_bytes: (a: number, b: number) => void;
83
- export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
84
- export const wasmzcashtransaction_get_txid: (a: number, b: number) => void;
85
- export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
93
+ export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
94
+ export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
95
+ export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
96
+ export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
97
+ 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;
98
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
99
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
100
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
101
+ export const wasmrootwalletkeys_backup_key: (a: number) => number;
102
+ export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
103
+ export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
104
+ export const wasmrootwalletkeys_user_key: (a: number) => number;
105
+ 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;
86
106
  export const __wbg_bip322namespace_free: (a: number, b: number) => void;
87
107
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
88
108
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
89
- export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
90
109
  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;
110
+ export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
93
111
  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
112
  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
113
  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
114
  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
115
  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
116
  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;
117
+ 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
118
  export const bitgopsbt_add_output: (a: number, b: number, c: number, d: number, e: bigint) => void;
119
+ export const bitgopsbt_add_output_at_index: (a: number, b: number, c: number, d: number, e: number, f: bigint) => void;
100
120
  export const bitgopsbt_add_output_with_address: (a: number, b: number, c: number, d: number, e: bigint) => void;
121
+ export const bitgopsbt_add_output_with_address_at_index: (a: number, b: number, c: number, d: number, e: number, f: bigint) => void;
101
122
  export const bitgopsbt_add_paygo_attestation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
102
123
  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;
124
+ 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
125
  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;
126
+ 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
127
  export const bitgopsbt_add_wallet_output: (a: number, b: number, c: number, d: number, e: bigint, f: number) => void;
128
+ export const bitgopsbt_add_wallet_output_at_index: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number) => void;
105
129
  export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number) => void;
106
130
  export const bitgopsbt_create_empty: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
107
131
  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;
@@ -126,6 +150,8 @@ export const bitgopsbt_network: (a: number, b: number) => void;
126
150
  export const bitgopsbt_output_count: (a: number) => number;
127
151
  export const bitgopsbt_parse_outputs_with_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
128
152
  export const bitgopsbt_parse_transaction_with_wallet_keys: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
153
+ export const bitgopsbt_remove_input: (a: number, b: number, c: number) => void;
154
+ export const bitgopsbt_remove_output: (a: number, b: number, c: number) => void;
129
155
  export const bitgopsbt_serialize: (a: number, b: number) => void;
130
156
  export const bitgopsbt_sign_all_musig2_inputs: (a: number, b: number, c: number) => void;
131
157
  export const bitgopsbt_sign_all_replay_protection_inputs: (a: number, b: number, c: number) => void;
@@ -149,8 +175,6 @@ export const fixedscriptwalletnamespace_output_script: (a: number, b: number, c:
149
175
  export const fixedscriptwalletnamespace_output_script_with_network_str: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
150
176
  export const fixedscriptwalletnamespace_p2sh_p2pk_output_script: (a: number, b: number, c: number) => void;
151
177
  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
178
  export const isInspectEnabled: () => number;
155
179
  export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
156
180
  export const wasmbip32_chain_code: (a: number) => number;
@@ -175,37 +199,27 @@ export const wasmbip32_private_key: (a: number) => number;
175
199
  export const wasmbip32_public_key: (a: number) => number;
176
200
  export const wasmbip32_to_base58: (a: number, b: number) => void;
177
201
  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;
202
+ export const wasmdimensions_empty: () => number;
203
+ export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
204
+ export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
205
+ export const wasmdimensions_from_output_script_length: (a: number) => number;
206
+ export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
207
+ export const wasmdimensions_from_psbt: (a: number, b: number) => void;
208
+ export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
209
+ export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
210
+ export const wasmdimensions_get_output_vsize: (a: number) => number;
211
+ export const wasmdimensions_get_output_weight: (a: number) => number;
212
+ export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
213
+ export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
214
+ export const wasmdimensions_has_segwit: (a: number) => number;
215
+ export const wasmdimensions_plus: (a: number, b: number) => number;
216
+ export const wasmdimensions_times: (a: number, b: number) => number;
184
217
  export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
185
218
  export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
186
219
  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
220
  export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
189
221
  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;
222
+ export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
209
223
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
210
224
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
211
225
  export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
@@ -1,5 +1,5 @@
1
1
  import { BitGoPsbt as WasmBitGoPsbt, type PsbtInputData, type PsbtOutputData, type PsbtOutputDataWithAddress } from "../wasm/wasm_utxo.js";
2
- import type { IPsbtIntrospectionWithAddress } from "../psbt.js";
2
+ import type { IPsbtWithAddress } from "../psbt.js";
3
3
  import { type WalletKeysArg } from "./RootWalletKeys.js";
4
4
  import { type ReplayProtectionArg } from "./ReplayProtection.js";
5
5
  import { type BIP32Arg } from "../bip32.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
  *
@@ -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
  /**
@@ -82,6 +82,10 @@ declare module "./wasm/wasm_utxo.js" {
82
82
  validateSignatureAtInput(inputIndex: number, pubkey: Uint8Array): boolean;
83
83
  verifySignatureWithKey(inputIndex: number, key: WasmBIP32): boolean;
84
84
  extractTransaction(): WasmTransaction;
85
+ addInputAtIndex(index: number, txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number): number;
86
+ addOutputAtIndex(index: number, script: Uint8Array, value: bigint): number;
87
+ removeInput(index: number): void;
88
+ removeOutput(index: number): void;
85
89
  unsignedTxId(): string;
86
90
  lockTime(): number;
87
91
  version(): number;
@@ -91,4 +95,4 @@ export { WrapDescriptor as Descriptor } from "./wasm/wasm_utxo.js";
91
95
  export { WrapMiniscript as Miniscript } from "./wasm/wasm_utxo.js";
92
96
  export { WrapPsbt as Psbt } from "./wasm/wasm_utxo.js";
93
97
  export { DashTransaction, Transaction, ZcashTransaction } from "./transaction.js";
94
- export { hasPsbtMagic, type IPsbtIntrospection, type IPsbtIntrospectionWithAddress, } from "./psbt.js";
98
+ 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";
@@ -1,13 +1,20 @@
1
1
  import type { PsbtInputData, PsbtOutputData, PsbtOutputDataWithAddress } from "./wasm/wasm_utxo.js";
2
- /** Common interface for PSBT introspection methods */
3
- export interface IPsbtIntrospection {
4
- readonly inputCount: number;
5
- readonly outputCount: number;
2
+ /** Common interface for PSBT types */
3
+ export interface IPsbt {
4
+ inputCount(): number;
5
+ outputCount(): number;
6
6
  getInputs(): PsbtInputData[];
7
7
  getOutputs(): PsbtOutputData[];
8
+ version(): number;
9
+ lockTime(): number;
10
+ unsignedTxId(): string;
11
+ addInputAtIndex(index: number, txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number): number;
12
+ addOutputAtIndex(index: number, script: Uint8Array, value: bigint): number;
13
+ removeInput(index: number): void;
14
+ removeOutput(index: number): void;
8
15
  }
9
- /** Extended introspection with address resolution (no coin parameter needed) */
10
- export interface IPsbtIntrospectionWithAddress extends IPsbtIntrospection {
16
+ /** Extended PSBT with address resolution (no coin parameter needed) */
17
+ export interface IPsbtWithAddress extends IPsbt {
11
18
  getOutputsWithAddress(): PsbtOutputDataWithAddress[];
12
19
  }
13
20
  /**
@@ -30,13 +30,9 @@ export declare class Transaction implements ITransaction {
30
30
  * @param sequence - Optional sequence number (default: 0xFFFFFFFF)
31
31
  * @returns The index of the newly added input
32
32
  */
33
+ addInputAtIndex(index: number, txid: string, vout: number, sequence?: number): number;
33
34
  addInput(txid: string, vout: number, sequence?: number): number;
34
- /**
35
- * Add an output to the transaction
36
- * @param script - Output script (scriptPubKey)
37
- * @param value - Value in satoshis
38
- * @returns The index of the newly added output
39
- */
35
+ addOutputAtIndex(index: number, script: Uint8Array, value: bigint): number;
40
36
  addOutput(script: Uint8Array, value: bigint): number;
41
37
  toBytes(): Uint8Array;
42
38
  /**
@@ -31,15 +31,15 @@ export class Transaction {
31
31
  * @param sequence - Optional sequence number (default: 0xFFFFFFFF)
32
32
  * @returns The index of the newly added input
33
33
  */
34
+ addInputAtIndex(index, txid, vout, sequence) {
35
+ return this._wasm.add_input_at_index(index, txid, vout, sequence);
36
+ }
34
37
  addInput(txid, vout, sequence) {
35
38
  return this._wasm.add_input(txid, vout, sequence);
36
39
  }
37
- /**
38
- * Add an output to the transaction
39
- * @param script - Output script (scriptPubKey)
40
- * @param value - Value in satoshis
41
- * @returns The index of the newly added output
42
- */
40
+ addOutputAtIndex(index, script, value) {
41
+ return this._wasm.add_output_at_index(index, script, value);
42
+ }
43
43
  addOutput(script, value) {
44
44
  return this._wasm.add_output(script, value);
45
45
  }