Skip to content

Commit

Permalink
remove filtering and soring of default token
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrkonowrocki committed Mar 27, 2024
1 parent 6f40970 commit a70a76f
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions features/omni-kit/components/sidebars/OmniInputSwap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,27 @@ export const OmniInputSwap: FC<OmniInputSwapProps> = ({
const scrollRef = useRef<HTMLDivElement>(null)

const tokensList = useMemo(
() =>
[
{
address: defaultTokenAddress,
balance: defaultTokenBalance,
precision: defaultTokenPrecision,
price: defaultTokenPrice,
token: defaultToken,
},
...(settings[`${type}Tokens`]?.[networkId] ?? [])
.filter((token) => token !== defaultToken)
.map((token) => ({
address: getNetworkContracts(networkId).tokens[token].address,
balance: extraTokensData[token].balance,
digits: getToken(token).digits,
precision: getToken(token).precision,
price: extraTokensData[token].price,
token,
})),
]
() => [
{
address: defaultTokenAddress,
balance: defaultTokenBalance,
precision: defaultTokenPrecision,
price: defaultTokenPrice,
token: defaultToken,
},
...(settings[`${type}Tokens`]?.[networkId] ?? [])
.filter((token) => token !== defaultToken)
.map((token) => ({
address: getNetworkContracts(networkId).tokens[token].address,
balance: extraTokensData[token].balance,
digits: getToken(token).digits,
precision: getToken(token).precision,
price: extraTokensData[token].price,
token,
}))
.filter(({ balance }) => !balance.isZero())
.sort((a, b) => b.balance.times(b.price).minus(a.balance.times(a.price)).toNumber()),
],
[
defaultToken,
defaultTokenAddress,
Expand Down

0 comments on commit a70a76f

Please sign in to comment.