@@ -562,8 +562,11 @@ export namespace TokenTransfer {
562
562
lookup . address as UniversalAddress ,
563
563
) ;
564
564
const destWrappedNative = await dstTb . getWrappedNative ( ) ;
565
- if ( canonicalAddress ( { chain : dstChain . chain , address : destWrappedNative } ) === canonicalAddress ( { chain : dstChain . chain , address : nativeAddress } ) ) {
566
- return { chain : dstChain . chain , address : 'native' }
565
+ if (
566
+ canonicalAddress ( { chain : dstChain . chain , address : destWrappedNative } ) ===
567
+ canonicalAddress ( { chain : dstChain . chain , address : nativeAddress } )
568
+ ) {
569
+ return { chain : dstChain . chain , address : "native" } ;
567
570
}
568
571
return { chain : dstChain . chain , address : nativeAddress } ;
569
572
}
@@ -744,7 +747,7 @@ export namespace TokenTransfer {
744
747
if ( ! transfer . automatic ) {
745
748
return {
746
749
sourceToken : {
747
- token : srcTokenId ,
750
+ token : transfer . token ,
748
751
amount : amount . units ( srcAmountTruncated ) ,
749
752
} ,
750
753
destinationToken : { token : dstToken , amount : amount . units ( dstAmountReceivable ) } ,
@@ -821,10 +824,8 @@ export namespace TokenTransfer {
821
824
// or the transaction could fail if the account does not have enough lamports
822
825
if ( dstToken . chain === "Solana" ) {
823
826
const nativeWrappedTokenId = await dstChain . getNativeWrappedTokenId ( ) ;
824
- const isNativeSol = ( isNative ( dstToken . address ) || isSameToken ( dstToken , nativeWrappedTokenId ) ) ;
825
- if (
826
- isNativeSol && destAmountLessFee < solanaMinBalanceForRentExemptAccount
827
- ) {
827
+ const isNativeSol = isNative ( dstToken . address ) || isSameToken ( dstToken , nativeWrappedTokenId ) ;
828
+ if ( isNativeSol && destAmountLessFee < solanaMinBalanceForRentExemptAccount ) {
828
829
throw new Error (
829
830
`Destination amount must be at least ${ solanaMinBalanceForRentExemptAccount } lamports` ,
830
831
) ;
@@ -833,11 +834,11 @@ export namespace TokenTransfer {
833
834
834
835
return {
835
836
sourceToken : {
836
- token : srcTokenId ,
837
+ token : transfer . token ,
837
838
amount : amount . units ( srcAmountTruncated ) ,
838
839
} ,
839
840
destinationToken : { token : dstToken , amount : destAmountLessFee } ,
840
- relayFee : { token : srcTokenId , amount : fee } ,
841
+ relayFee : { token : dstToken , amount : amount . units ( feeAmountDest ) } ,
841
842
destinationNativeGas,
842
843
warnings : warnings . length > 0 ? warnings : undefined ,
843
844
eta,
@@ -863,9 +864,15 @@ export namespace TokenTransfer {
863
864
) ;
864
865
if ( isNative ( destinationToken . address ) ) {
865
866
const nativeWrappedTokenId = await dstChain . getNativeWrappedTokenId ( ) ;
866
- _transfer . to = await dstChain . getTokenAccount ( _transfer . to . address , nativeWrappedTokenId . address ) ;
867
+ _transfer . to = await dstChain . getTokenAccount (
868
+ _transfer . to . address ,
869
+ nativeWrappedTokenId . address ,
870
+ ) ;
867
871
} else {
868
- _transfer . to = await dstChain . getTokenAccount ( _transfer . to . address , destinationToken . address )
872
+ _transfer . to = await dstChain . getTokenAccount (
873
+ _transfer . to . address ,
874
+ destinationToken . address ,
875
+ ) ;
869
876
}
870
877
}
871
878
0 commit comments