@@ -25,6 +25,7 @@ import {
25
25
canonicalAddress ,
26
26
deserialize ,
27
27
isNative ,
28
+ isSameToken ,
28
29
isTokenId ,
29
30
isTokenTransferDetails ,
30
31
isTransactionIdentifier ,
@@ -820,9 +821,9 @@ export namespace TokenTransfer {
820
821
// or the transaction could fail if the account does not have enough lamports
821
822
if ( dstToken . chain === "Solana" ) {
822
823
const nativeWrappedTokenId = await dstChain . getNativeWrappedTokenId ( ) ;
824
+ const isNativeSol = ( isNative ( dstToken . address ) || isSameToken ( dstToken , nativeWrappedTokenId ) ) ;
823
825
if (
824
- dstToken . address === nativeWrappedTokenId . address &&
825
- destAmountLessFee < solanaMinBalanceForRentExemptAccount
826
+ isNativeSol && destAmountLessFee < solanaMinBalanceForRentExemptAccount
826
827
) {
827
828
throw new Error (
828
829
`Destination amount must be at least ${ solanaMinBalanceForRentExemptAccount } lamports` ,
@@ -860,9 +861,12 @@ export namespace TokenTransfer {
860
861
dstChain ,
861
862
_transfer . token ,
862
863
) ;
863
- // TODO: If the token is native, no need to overwrite the destination address check for native
864
- //if (!destinationToken.address.equals((await dstChain.getNativeWrappedTokenId()).address))
865
- _transfer . to = await dstChain . getTokenAccount ( _transfer . to . address , destinationToken . address ) ;
864
+ if ( isNative ( destinationToken . address ) ) {
865
+ const nativeWrappedTokenId = await dstChain . getNativeWrappedTokenId ( ) ;
866
+ _transfer . to = await dstChain . getTokenAccount ( _transfer . to . address , nativeWrappedTokenId . address ) ;
867
+ } else {
868
+ _transfer . to = await dstChain . getTokenAccount ( _transfer . to . address , destinationToken . address )
869
+ }
866
870
}
867
871
868
872
if ( _transfer . to . chain === "Sei" ) {
0 commit comments