Skip to content

Commit

Permalink
feat(suite): ContractAddressWithTooltip in TokenSelect
Browse files Browse the repository at this point in the history
  • Loading branch information
enjojoy committed Oct 24, 2024
1 parent 31c9aef commit f0543b1
Showing 1 changed file with 39 additions and 31 deletions.
70 changes: 39 additions & 31 deletions packages/suite/src/views/wallet/send/Outputs/Amount/TokenSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import { getContractAddressForNetwork } from '@suite-common/wallet-utils';
import { Card } from '@trezor/components';
import { spacings } from '@trezor/theme';
import { Text } from '@trezor/components';
import { CoinBalance, FormattedCryptoAmount, Translation } from 'src/components/suite';
import { ContractAddressWithTooltip } from '@trezor/components';
import { CoinBalance } from 'src/components/suite';
import { ContractAddressWithTooltip } from 'src/components/wallet/ContractAddressWithTooltip';

export const buildTokenOptions = (
accountTokens: Account['tokens'],
Expand Down Expand Up @@ -63,35 +63,37 @@ export const buildTokenOptions = (
});
});

if (tokens.hiddenWithBalance.length) {
tokens.hiddenWithBalance.forEach(token => {
result.push({
type: 'currency',
symbol: token.symbol ?? symbol,
networkSymbol: symbol,
hidden: true,
coingeckoId: getCoingeckoId(symbol) ?? '',
contractAddress: token.contract,
cryptoName: token.name,
balance: token.balance,
});
});
}
// Right now we dont want to show hidden or unverified tokens, left for the future use

if (tokens.unverifiedWithBalance.length) {
tokens.unverifiedWithBalance.forEach(token => {
result.push({
type: 'currency',
unverified: true,
symbol: token.symbol ?? symbol,
networkSymbol: symbol,
coingeckoId: getCoingeckoId(symbol) ?? '',
contractAddress: token.contract,
cryptoName: token.name,
balance: token.balance,
});
});
}
// if (tokens.hiddenWithBalance.length) {
// tokens.hiddenWithBalance.forEach(token => {
// result.push({
// type: 'currency',
// symbol: token.symbol ?? symbol,
// networkSymbol: symbol,
// hidden: true,
// coingeckoId: getCoingeckoId(symbol) ?? '',
// contractAddress: token.contract,
// cryptoName: token.name,
// balance: token.balance,
// });
// });
// }

// if (tokens.unverifiedWithBalance.length) {
// tokens.unverifiedWithBalance.forEach(token => {
// result.push({
// type: 'currency',
// unverified: true,
// symbol: token.symbol ?? symbol,
// networkSymbol: symbol,
// coingeckoId: getCoingeckoId(symbol) ?? '',
// contractAddress: token.contract,
// cryptoName: token.name,
// balance: token.balance,
// });
// });
// }
}

return result;
Expand Down Expand Up @@ -272,12 +274,18 @@ export const TokenSelect = ({ outputId }: TokenSelectProps) => {
</Text>
</Row>
<Row justifyContent="flex-start">
{option.contractAddress && (
{option.contractAddress && option.cryptoName && (
<ContractAddressWithTooltip
contractAddress={option.contractAddress}
tooltipTextTypographyStyle="label"
variant="tertiary"
gap={spacings.xxxs}
cryptoName={option.cryptoName}
networkName={
networks[
option.networkSymbol as NetworkSymbol
].name
}
/>
)}
</Row>
Expand Down

0 comments on commit f0543b1

Please sign in to comment.