@@ -115,6 +115,15 @@ export type AddWalletOutputOptions = {
115115 value : bigint ;
116116} ;
117117
118+ export type ParseTransactionOptions = {
119+ replayProtection : ReplayProtectionArg ;
120+ payGoPubkeys ?: ECPairArg [ ] ;
121+ } ;
122+
123+ export type ParseOutputsOptions = {
124+ payGoPubkeys ?: ECPairArg [ ] ;
125+ } ;
126+
118127export class BitGoPsbt implements IPsbtIntrospectionWithAddress {
119128 protected constructor ( protected _wasm : WasmBitGoPsbt ) { }
120129
@@ -424,18 +433,18 @@ export class BitGoPsbt implements IPsbtIntrospectionWithAddress {
424433 /**
425434 * Parse transaction with wallet keys to identify wallet inputs/outputs
426435 * @param walletKeys - The wallet keys to use for identification
427- * @param replayProtection - Scripts that are allowed as inputs without wallet validation
428- * @param payGoPubkeys - Optional public keys for PayGo attestation verification
436+ * @param options - Options for parsing
437+ * @param options.replayProtection - Scripts that are allowed as inputs without wallet validation
438+ * @param options.payGoPubkeys - Optional public keys for PayGo attestation verification
429439 * @returns Parsed transaction information
430440 */
431441 parseTransactionWithWalletKeys (
432442 walletKeys : WalletKeysArg ,
433- replayProtection : ReplayProtectionArg ,
434- payGoPubkeys ?: ECPairArg [ ] ,
443+ options : ParseTransactionOptions ,
435444 ) : ParsedTransaction {
436445 const keys = RootWalletKeys . from ( walletKeys ) ;
437- const rp = ReplayProtection . from ( replayProtection , this . _wasm . network ( ) ) ;
438- const pubkeys = payGoPubkeys ?. map ( ( arg ) => ECPair . from ( arg ) . wasm ) ;
446+ const rp = ReplayProtection . from ( options . replayProtection , this . _wasm . network ( ) ) ;
447+ const pubkeys = options . payGoPubkeys ?. map ( ( arg ) => ECPair . from ( arg ) . wasm ) ;
439448 return this . _wasm . parse_transaction_with_wallet_keys (
440449 keys . wasm ,
441450 rp . wasm ,
@@ -451,16 +460,17 @@ export class BitGoPsbt implements IPsbtIntrospectionWithAddress {
451460 * wallet than the inputs.
452461 *
453462 * @param walletKeys - The wallet keys to use for identification
454- * @param payGoPubkeys - Optional public keys for PayGo attestation verification
463+ * @param options - Optional options for parsing
464+ * @param options.payGoPubkeys - Optional public keys for PayGo attestation verification
455465 * @returns Array of parsed outputs
456466 * @note This method does NOT validate wallet inputs. It only parses outputs.
457467 */
458468 parseOutputsWithWalletKeys (
459469 walletKeys : WalletKeysArg ,
460- payGoPubkeys ?: ECPairArg [ ] ,
470+ options ?: ParseOutputsOptions ,
461471 ) : ParsedOutput [ ] {
462472 const keys = RootWalletKeys . from ( walletKeys ) ;
463- const pubkeys = payGoPubkeys ?. map ( ( arg ) => ECPair . from ( arg ) . wasm ) ;
473+ const pubkeys = options ?. payGoPubkeys ?. map ( ( arg ) => ECPair . from ( arg ) . wasm ) ;
464474 return this . _wasm . parse_outputs_with_wallet_keys ( keys . wasm , pubkeys ) as ParsedOutput [ ] ;
465475 }
466476
@@ -719,7 +729,7 @@ export class BitGoPsbt implements IPsbtIntrospectionWithAddress {
719729 * const counterpartyPsbt = BitGoPsbt.fromBytes(counterpartyPsbtBytes, network);
720730 * psbt.combineMusig2Nonces(counterpartyPsbt);
721731 * // Sign MuSig2 key path inputs
722- * const parsed = psbt.parseTransactionWithWalletKeys(walletKeys, replayProtection);
732+ * const parsed = psbt.parseTransactionWithWalletKeys(walletKeys, { replayProtection } );
723733 * for (let i = 0; i < parsed.inputs.length; i++) {
724734 * if (parsed.inputs[i].scriptType === "p2trMusig2KeyPath") {
725735 * psbt.sign(i, userXpriv);
0 commit comments