@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.
@@ -116,6 +116,7 @@ export class BitGoPsbt {
116
116
  private constructor();
117
117
  free(): void;
118
118
  [Symbol.dispose](): void;
119
+ add_input(txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null, prev_tx?: Uint8Array | null): number;
119
120
  /**
120
121
  * Add an input to the PSBT
121
122
  *
@@ -129,29 +130,11 @@ export class BitGoPsbt {
129
130
  * # Returns
130
131
  * The index of the newly added input
131
132
  */
132
- add_input(txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null, prev_tx?: Uint8Array | null): number;
133
- /**
134
- * Add an output to the PSBT
135
- *
136
- * # Arguments
137
- * * `script` - The output script (scriptPubKey)
138
- * * `value` - The value in satoshis
139
- *
140
- * # Returns
141
- * The index of the newly added output
142
- */
133
+ add_input_at_index(index: number, txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null, prev_tx?: Uint8Array | null): number;
143
134
  add_output(script: Uint8Array, value: bigint): number;
144
- /**
145
- * Add an output to the PSBT by address
146
- *
147
- * # Arguments
148
- * * `address` - The destination address
149
- * * `value` - The value in satoshis
150
- *
151
- * # Returns
152
- * The index of the newly added output
153
- */
135
+ add_output_at_index(index: number, script: Uint8Array, value: bigint): number;
154
136
  add_output_with_address(address: string, value: bigint): number;
137
+ add_output_with_address_at_index(index: number, address: string, value: bigint): number;
155
138
  /**
156
139
  * Add a PayGo attestation to a PSBT output
157
140
  *
@@ -165,61 +148,12 @@ export class BitGoPsbt {
165
148
  * - `Err(WasmUtxoError)` if the output index is out of bounds or entropy is invalid
166
149
  */
167
150
  add_paygo_attestation(output_index: number, entropy: Uint8Array, signature: Uint8Array): void;
168
- /**
169
- * Add a replay protection input to the PSBT
170
- *
171
- * Replay protection inputs are P2SH-P2PK inputs used on forked networks to prevent
172
- * transaction replay attacks. They use a simple pubkey script without wallet derivation.
173
- *
174
- * # Arguments
175
- * * `ecpair` - The ECPair containing the public key for the replay protection input
176
- * * `txid` - The transaction ID (hex string) of the output being spent
177
- * * `vout` - The output index being spent
178
- * * `value` - The value in satoshis
179
- * * `sequence` - Optional sequence number (default: 0xFFFFFFFE for RBF)
180
- *
181
- * # Returns
182
- * The index of the newly added input
183
- */
184
151
  add_replay_protection_input(ecpair: WasmECPair, txid: string, vout: number, value: bigint, sequence?: number | null, prev_tx?: Uint8Array | null): number;
185
- /**
186
- * Add a wallet input with full PSBT metadata
187
- *
188
- * This is a higher-level method that adds an input and populates all required
189
- * PSBT fields (scripts, derivation info, etc.) based on the wallet's chain type.
190
- *
191
- * # Arguments
192
- * * `txid` - The transaction ID (hex string)
193
- * * `vout` - The output index being spent
194
- * * `value` - The value in satoshis
195
- * * `chain` - The chain code (0/1=p2sh, 10/11=p2shP2wsh, 20/21=p2wsh, 30/31=p2tr, 40/41=p2trMusig2)
196
- * * `index` - The derivation index
197
- * * `wallet_keys` - The root wallet keys
198
- * * `signer` - The key that will sign ("user", "backup", or "bitgo") - required for p2tr/p2trMusig2
199
- * * `cosigner` - The key that will co-sign - required for p2tr/p2trMusig2
200
- * * `sequence` - Optional sequence number (default: 0xFFFFFFFE for RBF)
201
- * * `prev_tx` - Optional full previous transaction bytes (for non-segwit)
202
- *
203
- * # Returns
204
- * The index of the newly added input
205
- */
152
+ add_replay_protection_input_at_index(index: number, ecpair: WasmECPair, txid: string, vout: number, value: bigint, sequence?: number | null, prev_tx?: Uint8Array | null): number;
206
153
  add_wallet_input(txid: string, vout: number, value: bigint, wallet_keys: WasmRootWalletKeys, chain: number, index: number, signer?: string | null, cosigner?: string | null, sequence?: number | null, prev_tx?: Uint8Array | null): number;
207
- /**
208
- * Add a wallet output with full PSBT metadata
209
- *
210
- * This creates a verifiable wallet output (typically for change) with all required
211
- * PSBT fields (scripts, derivation info) based on the wallet's chain type.
212
- *
213
- * # Arguments
214
- * * `chain` - The chain code (0/1=p2sh, 10/11=p2shP2wsh, 20/21=p2wsh, 30/31=p2tr, 40/41=p2trMusig2)
215
- * * `index` - The derivation index
216
- * * `value` - The value in satoshis
217
- * * `wallet_keys` - The root wallet keys
218
- *
219
- * # Returns
220
- * The index of the newly added output
221
- */
154
+ add_wallet_input_at_index(index: number, txid: string, vout: number, value: bigint, wallet_keys: WasmRootWalletKeys, chain: number, derivation_index: number, signer?: string | null, cosigner?: string | null, sequence?: number | null, prev_tx?: Uint8Array | null): number;
222
155
  add_wallet_output(chain: number, index: number, value: bigint, wallet_keys: WasmRootWalletKeys): number;
156
+ add_wallet_output_at_index(index: number, chain: number, derivation_index: number, value: bigint, wallet_keys: WasmRootWalletKeys): number;
223
157
  /**
224
158
  * Combine/merge data from another PSBT into this one
225
159
  *
@@ -452,6 +386,8 @@ export class BitGoPsbt {
452
386
  * Parse transaction with wallet keys to identify wallet inputs/outputs
453
387
  */
454
388
  parse_transaction_with_wallet_keys(wallet_keys: WasmRootWalletKeys, replay_protection: WasmReplayProtection, paygo_pubkeys?: WasmECPair[] | null): any;
389
+ remove_input(index: number): void;
390
+ remove_output(index: number): void;
455
391
  /**
456
392
  * Serialize the PSBT to bytes
457
393
  *
@@ -1230,6 +1166,7 @@ export class WasmTransaction {
1230
1166
  private constructor();
1231
1167
  free(): void;
1232
1168
  [Symbol.dispose](): void;
1169
+ add_input(txid: string, vout: number, sequence?: number | null): number;
1233
1170
  /**
1234
1171
  * Add an input to the transaction
1235
1172
  *
@@ -1241,18 +1178,9 @@ export class WasmTransaction {
1241
1178
  * # Returns
1242
1179
  * The index of the newly added input
1243
1180
  */
1244
- add_input(txid: string, vout: number, sequence?: number | null): number;
1245
- /**
1246
- * Add an output to the transaction
1247
- *
1248
- * # Arguments
1249
- * * `script` - The output script (scriptPubKey)
1250
- * * `value` - The value in satoshis
1251
- *
1252
- * # Returns
1253
- * The index of the newly added output
1254
- */
1181
+ add_input_at_index(index: number, txid: string, vout: number, sequence?: number | null): number;
1255
1182
  add_output(script: Uint8Array, value: bigint): number;
1183
+ add_output_at_index(index: number, script: Uint8Array, value: bigint): number;
1256
1184
  /**
1257
1185
  * Create an empty transaction (version 1, locktime 0)
1258
1186
  */
@@ -1373,6 +1301,7 @@ export class WrapMiniscript {
1373
1301
  export class WrapPsbt {
1374
1302
  free(): void;
1375
1303
  [Symbol.dispose](): void;
1304
+ addInput(txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null): number;
1376
1305
  /**
1377
1306
  * Add an input to the PSBT
1378
1307
  *
@@ -1386,7 +1315,8 @@ export class WrapPsbt {
1386
1315
  * # Returns
1387
1316
  * The index of the newly added input
1388
1317
  */
1389
- addInput(txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null): number;
1318
+ addInputAtIndex(index: number, txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null): number;
1319
+ addOutput(script: Uint8Array, value: bigint): number;
1390
1320
  /**
1391
1321
  * Add an output to the PSBT
1392
1322
  *
@@ -1397,7 +1327,7 @@ export class WrapPsbt {
1397
1327
  * # Returns
1398
1328
  * The index of the newly added output
1399
1329
  */
1400
- addOutput(script: Uint8Array, value: bigint): number;
1330
+ addOutputAtIndex(index: number, script: Uint8Array, value: bigint): number;
1401
1331
  clone(): WrapPsbt;
1402
1332
  static deserialize(psbt: Uint8Array): WrapPsbt;
1403
1333
  /**
@@ -1469,6 +1399,8 @@ export class WrapPsbt {
1469
1399
  * Get the number of outputs in the PSBT
1470
1400
  */
1471
1401
  outputCount(): number;
1402
+ removeInput(index: number): void;
1403
+ removeOutput(index: number): void;
1472
1404
  serialize(): Uint8Array;
1473
1405
  /**
1474
1406
  * Sign all inputs with a WasmBIP32 key