Skip to content

Commit

Permalink
Merge branch 'fix1127' into wenty/wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
wenty22 committed Nov 27, 2024
2 parents 8d3b6d1 + 4889a4c commit 319f1c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { sortTokens } from '@/modules/aggregator/shared/sortTokens';
import { useTronWeb } from '@/core/hooks/useTronWeb';
import { useSolanaAccount } from '@/modules/wallet/hooks/useSolanaAccount';
import { useTronAccount } from '@/modules/wallet/hooks/useTronAccount';
import { isSameAddress } from '@/core/utils/address';

export function useSelection() {
const { getFromChains, getToChains, getTokens, getToToken, adapters } = useAggregator();
Expand Down Expand Up @@ -58,7 +59,7 @@ export function useSelection() {
const newToken = getTokens({
fromChainId: tmpFromChain?.id,
toChainId: tmpToChain?.id,
}).find((t) => t.displaySymbol?.toUpperCase() === tmpToken?.displaySymbol?.toUpperCase());
}).find((t) => isSameAddress(t.address, tmpToken?.address));

const newFromChain = getFromChains({
toChainId: tmpToChain?.id,
Expand Down Expand Up @@ -101,9 +102,7 @@ export function useSelection() {

const newToken =
tmpTokens.find(
(t) =>
isChainOrTokenCompatible(t) &&
t.displaySymbol.toUpperCase() === selectedToken?.displaySymbol.toUpperCase(),
(t) => isChainOrTokenCompatible(t) && isSameAddress(t.address, selectedToken?.address),
) ?? tmpTokens.find((t) => isChainOrTokenCompatible(t));

updateSelectedInfo({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function aggregateTokens({ adapters, params }: IAggregateTokensParams) {
chainId: fromChainId,
token: fromToken,
});
let bridgeToken = tokenMap.get(baseInfo.displaySymbol.toUpperCase());
let bridgeToken = tokenMap.get(baseInfo.address.toLowerCase());

const isMatched = matchedTokens.has(baseInfo.symbol.toUpperCase());
const isCompatible = compatibleTokens.has(baseInfo.symbol.toUpperCase());
Expand Down Expand Up @@ -70,7 +70,7 @@ export function aggregateTokens({ adapters, params }: IAggregateTokensParams) {
};
}

tokenMap.set(baseInfo.displaySymbol.toUpperCase(), bridgeToken);
tokenMap.set(baseInfo.address.toLowerCase(), bridgeToken);
});
});

Expand Down

0 comments on commit 319f1c8

Please sign in to comment.