@@ -258,17 +258,11 @@ function getTxInputSignaturesCount<TNumber extends number | bigint>(
258258 * Decompose a raw psbt into useful information, such as the total amounts,
259259 * change amounts, and transaction outputs.
260260 */
261- export function explainPsbt < TNumber extends number | bigint > (
261+ export function explainPsbt < TNumber extends number | bigint , Tx extends bitgo . UtxoTransaction < bigint > > (
262+ psbt : bitgo . UtxoPsbt < Tx > ,
262263 params : ExplainTransactionOptions < TNumber > ,
263264 network : utxolib . Network
264265) : TransactionExplanation {
265- const { txHex } = params ;
266- let psbt : bitgo . UtxoPsbt ;
267- try {
268- psbt = bitgo . createPsbtFromHex ( txHex , network ) ;
269- } catch ( e ) {
270- throw new Error ( 'failed to parse psbt hex' ) ;
271- }
272266 const txOutputs = psbt . txOutputs ;
273267
274268 function getChainAndIndexFromBip32Derivations ( output : bitgo . PsbtOutput ) {
@@ -346,18 +340,12 @@ export function explainPsbt<TNumber extends number | bigint>(
346340 * change amounts, and transaction outputs.
347341 */
348342export function explainTx < TNumber extends number | bigint > (
343+ tx : bitgo . UtxoTransaction < TNumber > ,
349344 params : ExplainTransactionOptions < TNumber > ,
350- coin : AbstractUtxoCoin
345+ network : utxolib . Network
351346) : TransactionExplanation {
352- const { txHex } = params ;
353- let tx ;
354- try {
355- tx = coin . createTransactionFromHex ( txHex ) ;
356- } catch ( e ) {
357- throw new Error ( 'failed to parse transaction hex' ) ;
358- }
359- const common = explainCommon ( tx , params , coin . network ) ;
360- const inputSignaturesCount = getTxInputSignaturesCount ( tx , params , coin . network ) ;
347+ const common = explainCommon ( tx , params , network ) ;
348+ const inputSignaturesCount = getTxInputSignaturesCount ( tx , params , network ) ;
361349 return {
362350 ...common ,
363351 inputSignatures : inputSignaturesCount ,
0 commit comments