@@ -87,7 +87,7 @@ import {
8787import { assertFixedScriptWalletAddress } from './address/fixedScript' ;
8888import { isSdkBackend , ParsedTransaction , SdkBackend } from './transaction/types' ;
8989import { decodePsbtWith , encodeTransaction , stringToBufferTryFormats } from './transaction/decode' ;
90- import { toBip32Triple , UtxoKeychain } from './keychains' ;
90+ import { fetchKeychains , toBip32Triple , UtxoKeychain } from './keychains' ;
9191import { verifyKeySignature , verifyUserPublicKey } from './verifyKey' ;
9292import { getPolicyForEnv } from './descriptor/validatePolicy' ;
9393import { signTransaction } from './transaction/signTransaction' ;
@@ -875,8 +875,16 @@ export abstract class AbstractUtxoCoin
875875 * @param params
876876 */
877877 override async explainTransaction < TNumber extends number | bigint = number > (
878- params : ExplainTransactionOptions < TNumber >
878+ params : ExplainTransactionOptions < TNumber > ,
879+ wallet ?: IWallet
879880 ) : Promise < TransactionExplanation > {
881+ if ( ! params . pubs ) {
882+ // if no pubs are provided, opportunistically fetch the keychains from the wallet
883+ if ( wallet ) {
884+ const keychains = await fetchKeychains ( this , wallet ) ;
885+ params . pubs = toBip32Triple ( keychains ) . map ( ( k ) => k . neutered ( ) . toBase58 ( ) ) as Triple < string > ;
886+ }
887+ }
880888 return explainTx ( this . decodeTransactionFromPrebuild ( params ) , params , this . name ) ;
881889 }
882890
0 commit comments