@@ -67,6 +67,7 @@ import { AbstractEthLikeCoin } from './abstractEthLikeCoin';
6767import { EthLikeToken } from './ethLikeToken' ;
6868import {
6969 calculateForwarderV1Address ,
70+ decodeTransferData ,
7071 ERC1155TransferBuilder ,
7172 ERC721TransferBuilder ,
7273 getBufferedByteCode ,
@@ -1570,6 +1571,30 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
15701571 } ;
15711572 }
15721573
1574+ /**
1575+ * Extract recipients from transaction hex
1576+ * @param txHex - The transaction hex string
1577+ * @returns Array of recipients with address and amount
1578+ */
1579+ private async extractRecipientsFromTxHex ( txHex : string ) : Promise < Array < { address : string ; amount : string } > > {
1580+ const txBuffer = optionalDeps . ethUtil . toBuffer ( txHex ) ;
1581+ const decodedTx = optionalDeps . EthTx . TransactionFactory . fromSerializedData ( txBuffer ) ;
1582+ const recipients : Array < { address : string ; amount : string } > = [ ] ;
1583+
1584+ if ( decodedTx . data && decodedTx . data . length > 0 ) {
1585+ const dataHex = optionalDeps . ethUtil . bufferToHex ( decodedTx . data ) ;
1586+ const transferData = decodeTransferData ( dataHex ) ;
1587+ if ( transferData . to ) {
1588+ recipients . push ( {
1589+ address : transferData . to ,
1590+ amount : transferData . amount ,
1591+ } ) ;
1592+ }
1593+ }
1594+
1595+ return recipients ;
1596+ }
1597+
15731598 async sendCrossChainRecoveryTransaction (
15741599 params : SendCrossChainRecoveryOptions
15751600 ) : Promise < { coin : string ; txHex ?: string ; txid : string } > {
@@ -1617,15 +1642,22 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
16171642 } ;
16181643 }
16191644
1620- async buildCrossChainRecoveryTransaction (
1621- recoveryId : string
1622- ) : Promise < { coin : string ; txHex : string ; txid : string ; walletVersion ?: number } > {
1645+ async buildCrossChainRecoveryTransaction ( recoveryId : string ) : Promise < {
1646+ coin : string ;
1647+ txHex : string ;
1648+ txid : string ;
1649+ walletVersion ?: number ;
1650+ recipients : Array < { address : string ; amount : string } > ;
1651+ } > {
16231652 const res = await this . bitgo . get ( this . bitgo . microservicesUrl ( `/api/recovery/v1/crosschain/${ recoveryId } /buildtx` ) ) ;
1653+ // Extract recipients from the transaction hex
1654+ const recipients = await this . extractRecipientsFromTxHex ( res . body . txHex ) ;
16241655 return {
16251656 coin : res . body . coin ,
16261657 txHex : res . body . txHex ,
16271658 txid : res . body . txid ,
16281659 walletVersion : res . body . walletVersion ,
1660+ recipients,
16291661 } ;
16301662 }
16311663
0 commit comments