Skip to content

Commit

Permalink
Update components using FastCoinIcon to pass network instead of asset…
Browse files Browse the repository at this point in the history
…Type
  • Loading branch information
jinchung committed Oct 26, 2023
1 parent c4b72c7 commit 4fc812d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const MemoizedBalanceCoinRow = React.memo(
<View style={[sx.container]}>
<FastCoinIcon
address={item.address}
assetType={item.type}
network={item.network}
mainnetAddress={item.mainnet_address}
symbol={item.symbol}
theme={theme}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import FastCoinIcon from './FastCoinIcon';
import ContextMenuButton from '@/components/native-context-menu/contextMenu';
import { Text } from '@/design-system';
import { isNativeAsset } from '@/handlers/assets';
import { Network } from '@/helpers';
import { Network } from '@/networks/types';
import { useAccountAsset } from '@/hooks';
import { colors, fonts, fontWithWidth, getFontSize } from '@/styles';
import { deviceUtils, ethereumUtils } from '@/utils';
Expand Down Expand Up @@ -151,7 +151,7 @@ export default React.memo(function FastCurrencySelectionRow({
<View style={sx.rootContainer}>
<FastCoinIcon
address={address || item?.address}
assetType={type ?? item?.type}
network={network}
mainnetAddress={mainnet_address ?? item?.mainnet_address}
symbol={symbol ?? item?.symbol}
theme={theme}
Expand Down
15 changes: 13 additions & 2 deletions src/components/coin-icon/CoinIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import { Network } from '@/networks/types';
import { useColorForAsset } from '@/hooks';
import { ImgixImage } from '@/components/images';
import styled from '@/styled-thing';
import { isETH, magicMemo, CoinIcon as ReactCoinIcon } from '@/utils';
import {
ethereumUtils,
isETH,
magicMemo,
CoinIcon as ReactCoinIcon,
} from '@/utils';
import { ChainBadgeType } from '@/components/coin-icon/ChainBadgeSizeConfigs';

export const CoinIconSize = 40;
Expand Down Expand Up @@ -62,6 +67,12 @@ const CoinIcon: React.FC<Props> = ({

const theme = useTheme();

const network = mainnet_address
? Network.mainnet
: type
? ethereumUtils.getNetworkFromType(type)
: Network.mainnet;

return (
<View>
{isNotContractInteraction ? (
Expand All @@ -78,7 +89,7 @@ const CoinIcon: React.FC<Props> = ({
}
size={size}
symbol={symbol}
network={mainnet_address ? Network.mainnet : type}
network={network}
theme={theme}
/>
) : (
Expand Down
4 changes: 2 additions & 2 deletions src/components/coin-row/FastTransactionCoinRow.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useMemo } from 'react';
import React, { useCallback } from 'react';
import { StyleSheet, View } from 'react-native';
import { ButtonPressAnimation } from '../animations';
import FastCoinIcon from '../asset-list/RecyclerAssetList2/FastComponents/FastCoinIcon';
Expand Down Expand Up @@ -154,7 +154,7 @@ export default React.memo(function TransactionCoinRow({
) : (
<FastCoinIcon
address={mainnetAddress || item.address}
assetType={item.network}
network={item.network}
mainnetAddress={mainnetAddress}
symbol={item.symbol}
theme={theme}
Expand Down
4 changes: 2 additions & 2 deletions src/components/exchange/ExchangeTokenRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import isEqual from 'react-fast-compare';
import { Box, Column, Columns, Inline, Stack, Text } from '@/design-system';
import { isNativeAsset } from '@/handlers/assets';
import { Network } from '@/helpers';
import { Network } from '@/networks/types';
import { useAccountAsset, useDimensions } from '@/hooks';
import { ethereumUtils } from '@/utils';
import FastCoinIcon from '../asset-list/RecyclerAssetList2/FastComponents/FastCoinIcon';
Expand Down Expand Up @@ -69,7 +69,7 @@ export default React.memo(function ExchangeTokenRow({
<Box
as={FastCoinIcon}
address={address || item?.address}
assetType={type ?? item?.type}
network={network}
mainnetAddress={mainnet_address ?? item?.mainnet_address}
symbol={symbol ?? item?.symbol}
theme={theme}
Expand Down

0 comments on commit 4fc812d

Please sign in to comment.