@@ -42,11 +42,13 @@ import { findContractTokenNameUsingContract, findTokenNameByContract, getAddress
42
42
import {
43
43
AddressDetails ,
44
44
NativeStxBalance ,
45
+ RecoveryInfo ,
45
46
RecoveryOptions ,
46
47
RecoveryTransaction ,
47
48
SingleFungibleTokenBalance ,
48
49
StxNonceResponse ,
49
50
StxTxnFeeEstimationResponse ,
51
+ TxData ,
50
52
} from './lib/iface' ;
51
53
import { TransferBuilder } from './lib/transferBuilder' ;
52
54
import { FungibleTokenTransferBuilder } from './lib/fungibleTokenTransferBuilder' ;
@@ -667,9 +669,9 @@ export class Stx extends BaseCoin {
667
669
* @param {String } params.bitgoKey - encrypted bitgo public key
668
670
* @param {String } params.walletPassphrase - wallet password
669
671
* @param {String } params.contractId - contract id of the token (mandatory for token recovery)
670
- * @returns {Promise<RecoveryTransaction> } RecoveryTransaction.txHex - hex of serialized transaction (signed or unsigned)
672
+ * @returns {Promise<RecoveryInfo| RecoveryTransaction> } RecoveryTransaction.txHex - hex of serialized transaction (signed or unsigned)
671
673
*/
672
- async recover ( params : RecoveryOptions ) : Promise < RecoveryTransaction > {
674
+ async recover ( params : RecoveryOptions ) : Promise < RecoveryInfo | RecoveryTransaction > {
673
675
if ( ! this . isValidAddress ( params . rootAddress ) ) {
674
676
throw new Error ( 'invalid root address!' ) ;
675
677
}
@@ -716,9 +718,15 @@ export class Stx extends BaseCoin {
716
718
const serializedTx : string = tx . toBroadcastFormat ( ) ;
717
719
718
720
if ( isUnsignedSweep ) {
719
- return {
721
+ const txJson : TxData = tx . toJson ( ) ;
722
+ const transactionExplanation : RecoveryInfo = ( await this . explainTransaction ( {
720
723
txHex : serializedTx ,
721
- } ;
724
+ feeInfo : { fee : txJson . fee } ,
725
+ } ) ) as RecoveryInfo ;
726
+ transactionExplanation . coin = this . getChain ( ) ;
727
+ transactionExplanation . feeInfo = { fee : txJson . fee } ;
728
+ transactionExplanation . txHex = serializedTx ;
729
+ return transactionExplanation ;
722
730
}
723
731
// check the private key & sign
724
732
if ( ! keys [ 0 ] . privateKey ) {
0 commit comments