Skip to content

Commit

Permalink
tokens refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
rastajpa committed Sep 30, 2022
1 parent 43d4e4a commit 9d2c065
Show file tree
Hide file tree
Showing 29 changed files with 396 additions and 379 deletions.
4 changes: 3 additions & 1 deletion src/components/list/ContactRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {Column} from '../styled/Containers';
import {H5, ListItemSubText} from '../styled/Text';
import AngleRight from '../../../assets/img/angle-right.svg';
import ContactIcon from '../../navigation/tabs/contacts/components/ContactIcon';
import {getCurrencyAbbreviation} from '../../utils/helper-methods';

const ContactContainer = styled.TouchableHighlight`
padding: 10px 0px;
Expand Down Expand Up @@ -48,7 +49,8 @@ interface Props {
const ContactRow = ({contact, onPress}: Props) => {
const theme = useTheme();
const underlayColor = theme.dark ? '#121212' : '#fbfbff';
const {coin, name, email, address, chain} = contact;
const {coin: _coin, name, email, address, chain} = contact;
const coin = getCurrencyAbbreviation(_coin, chain);
return (
<ContactContainer underlayColor={underlayColor} onPress={onPress}>
<RowContainer>
Expand Down
36 changes: 18 additions & 18 deletions src/constants/SupportedCurrencyOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ export const CurrencyListIcons: {
doge: props => <DogeIcon {...props} />,
ltc: props => <LtcIcon {...props} />,
xrp: props => <XrpIcon {...props} />,
usdc: props => <UsdcIcon {...props} />,
gusd: props => <GusdIcon {...props} />,
busd: props => <BusdIcon {...props} />,
dai: props => <DaiIcon {...props} />,
usdp: props => <UsdpIcon {...props} />,
wbtc: props => <WbtcIcon {...props} />,
shib: props => <ShibIcon {...props} />,
ape: props => <ApeIcon {...props} />,
euroc: props => <EurocIcon {...props} />,
usdc_e: props => <UsdcIcon {...props} />,
gusd_e: props => <GusdIcon {...props} />,
busd_e: props => <BusdIcon {...props} />,
dai_e: props => <DaiIcon {...props} />,
usdp_e: props => <UsdpIcon {...props} />,
wbtc_e: props => <WbtcIcon {...props} />,
shib_e: props => <ShibIcon {...props} />,
ape_e: props => <ApeIcon {...props} />,
euroc_e: props => <EurocIcon {...props} />,
};

export const SupportedUtxoCurrencyOptions: Array<SupportedCurrencyOption> = [
Expand Down Expand Up @@ -104,7 +104,7 @@ export const SupportedEvmCurrencyOptions: Array<SupportedCurrencyOption> = [
export const SupportedTokenOptions: Array<SupportedCurrencyOption> = [
{
id: Math.random().toString(),
img: CurrencyListIcons.usdc,
img: CurrencyListIcons.usdc_e,
currencyName: 'USD Coin',
currencyAbbreviation: 'usdc',
isToken: true,
Expand All @@ -114,7 +114,7 @@ export const SupportedTokenOptions: Array<SupportedCurrencyOption> = [
},
{
id: Math.random().toString(),
img: CurrencyListIcons.ape,
img: CurrencyListIcons.ape_e,
currencyName: 'ApeCoin',
currencyAbbreviation: 'ape',
isToken: true,
Expand All @@ -124,7 +124,7 @@ export const SupportedTokenOptions: Array<SupportedCurrencyOption> = [
},
{
id: Math.random().toString(),
img: CurrencyListIcons.euroc,
img: CurrencyListIcons.euroc_e,
currencyName: 'Euro Coin',
currencyAbbreviation: 'euroc',
isToken: true,
Expand All @@ -134,7 +134,7 @@ export const SupportedTokenOptions: Array<SupportedCurrencyOption> = [
},
{
id: Math.random().toString(),
img: CurrencyListIcons.shib,
img: CurrencyListIcons.shib_e,
currencyName: 'Shiba Inu',
currencyAbbreviation: 'shib',
isToken: true,
Expand All @@ -144,7 +144,7 @@ export const SupportedTokenOptions: Array<SupportedCurrencyOption> = [
},
{
id: Math.random().toString(),
img: CurrencyListIcons.gusd,
img: CurrencyListIcons.gusd_e,
currencyName: 'Gemini Dollar',
currencyAbbreviation: 'gusd',
isToken: true,
Expand All @@ -154,7 +154,7 @@ export const SupportedTokenOptions: Array<SupportedCurrencyOption> = [
},
{
id: Math.random().toString(),
img: CurrencyListIcons.busd,
img: CurrencyListIcons.busd_e,
currencyName: 'Binance USD Coin',
currencyAbbreviation: 'busd',
isToken: true,
Expand All @@ -164,7 +164,7 @@ export const SupportedTokenOptions: Array<SupportedCurrencyOption> = [
},
{
id: Math.random().toString(),
img: CurrencyListIcons.dai,
img: CurrencyListIcons.dai_e,
currencyName: 'Dai',
currencyAbbreviation: 'dai',
isToken: true,
Expand All @@ -174,7 +174,7 @@ export const SupportedTokenOptions: Array<SupportedCurrencyOption> = [
},
{
id: Math.random().toString(),
img: CurrencyListIcons.usdp,
img: CurrencyListIcons.usdp_e,
currencyName: 'Pax Dollar',
currencyAbbreviation: 'usdp',
isToken: true,
Expand All @@ -184,7 +184,7 @@ export const SupportedTokenOptions: Array<SupportedCurrencyOption> = [
},
{
id: Math.random().toString(),
img: CurrencyListIcons.wbtc,
img: CurrencyListIcons.wbtc_e,
currencyName: 'Wrapped Bitcoin',
currencyAbbreviation: 'wbtc',
isToken: true,
Expand Down
7 changes: 7 additions & 0 deletions src/constants/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,10 @@ export const TWO_FACTOR_EMAIL_POLL_TIMEOUT = 1000 * 60 * 5;
export const COINGECKO_BLOCKCHAIN_NETWORK = {
eth: 'ethereum',
};

// 1Inch
export const ONEINCH_BLOCKCHAIN_ID: {[key in string]: number} = {
eth: 1,
// TODO MATIC
// matic: 137,
};
56 changes: 32 additions & 24 deletions src/constants/currencies.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export type SupportedCoins = 'btc' | 'bch' | 'ltc' | 'doge' | 'eth';
export type SupportedEthereumTokens =
| 'usdc'
| 'gusd'
| 'usdp'
| 'pax' // backward compatibility
| 'busd'
| 'dai'
| 'wbtc'
| 'shib'
| 'ape'
| 'euroc';
| 'usdc_e'
| 'gusd_e'
| 'usdp_e'
| 'pax_e' // backward compatibility
| 'busd_e'
| 'dai_e'
| 'wbtc_e'
| 'shib_e'
| 'ape_e'
| 'euroc_e';
export type SupportedCurrencies = SupportedCoins | SupportedEthereumTokens;
export type EVM_CHAINS = 'eth';
export type UTXO_CHAINS = 'btc' | 'bch' | 'doge' | 'ltc';
Expand Down Expand Up @@ -61,7 +61,7 @@ export interface CurrencyOpts {
}

export const BitpaySupportedEthereumTokens: {[key in string]: CurrencyOpts} = {
busd: {
busd_e: {
name: 'Binance USD Coin',
chain: 'eth',
coin: 'busd',
Expand Down Expand Up @@ -98,7 +98,7 @@ export const BitpaySupportedEthereumTokens: {[key in string]: CurrencyOpts} = {
gradientBackgroundColor: 'rgba(30,144,255, 0.2)',
},
},
usdp: {
usdp_e: {
name: 'Paxos Dollar',
chain: 'eth',
coin: 'usdp',
Expand Down Expand Up @@ -135,7 +135,7 @@ export const BitpaySupportedEthereumTokens: {[key in string]: CurrencyOpts} = {
gradientBackgroundColor: '#00845d',
},
},
pax: {
pax_e: {
// backward compatibility
name: 'Paxos Standard',
chain: 'eth',
Expand Down Expand Up @@ -173,7 +173,7 @@ export const BitpaySupportedEthereumTokens: {[key in string]: CurrencyOpts} = {
gradientBackgroundColor: '#00845d',
},
},
usdc: {
usdc_e: {
name: 'USD Coin',
chain: 'eth',
coin: 'usdc',
Expand Down Expand Up @@ -210,7 +210,7 @@ export const BitpaySupportedEthereumTokens: {[key in string]: CurrencyOpts} = {
gradientBackgroundColor: '#2775c9',
},
},
gusd: {
gusd_e: {
name: 'Gemini Dollar',
chain: 'eth',
coin: 'gusd',
Expand Down Expand Up @@ -247,7 +247,7 @@ export const BitpaySupportedEthereumTokens: {[key in string]: CurrencyOpts} = {
gradientBackgroundColor: '#00dcfa',
},
},
dai: {
dai_e: {
name: 'DAI',
chain: 'eth',
coin: 'dai',
Expand Down Expand Up @@ -284,7 +284,7 @@ export const BitpaySupportedEthereumTokens: {[key in string]: CurrencyOpts} = {
gradientBackgroundColor: '#F5AC37',
},
},
wbtc: {
wbtc_e: {
name: 'Wrapped Bitcoin',
chain: 'eth',
coin: 'wbtc',
Expand Down Expand Up @@ -321,7 +321,7 @@ export const BitpaySupportedEthereumTokens: {[key in string]: CurrencyOpts} = {
gradientBackgroundColor: '#282A47',
},
},
shib: {
shib_e: {
name: 'SHIBA INU',
chain: 'eth',
coin: 'shib',
Expand Down Expand Up @@ -359,7 +359,7 @@ export const BitpaySupportedEthereumTokens: {[key in string]: CurrencyOpts} = {
gradientBackgroundColor: '#F00500',
},
},
ape: {
ape_e: {
name: 'ApeCoin',
chain: 'eth',
coin: 'ape',
Expand Down Expand Up @@ -397,7 +397,7 @@ export const BitpaySupportedEthereumTokens: {[key in string]: CurrencyOpts} = {
gradientBackgroundColor: '#0054F9',
},
},
euroc: {
euroc_e: {
name: 'Euro Coin',
chain: 'eth',
coin: 'euroc',
Expand Down Expand Up @@ -665,11 +665,21 @@ export const BitpaySupportedEvmCoins: {[key in string]: CurrencyOpts} = {
},
};

export const BitpaySupportedTokens: {[key in string]: CurrencyOpts} = {
...BitpaySupportedEthereumTokens,
// TODO MATIC
};

export const BitpaySupportedCoins: {[key in string]: CurrencyOpts} = {
...BitpaySupportedUtxoCoins,
...BitpaySupportedEvmCoins,
};

export const BitpaySupportedCurrencies: {[key in string]: CurrencyOpts} = {
...BitpaySupportedCoins,
...BitpaySupportedTokens,
};

export const POPULAR_TOKENS = [
'UNI',
'SUSHI',
Expand Down Expand Up @@ -698,8 +708,6 @@ export const SUPPORTED_EVM_COINS = Object.keys(BitpaySupportedEvmCoins);
export const SUPPORTED_ETHEREUM_TOKENS = Object.keys(
BitpaySupportedEthereumTokens,
);
// TODO MATIC
export const SUPPORTED_COINS = Object.keys(BitpaySupportedCoins);
export const SUPPORTED_CURRENCIES = [
...SUPPORTED_COINS,
...SUPPORTED_ETHEREUM_TOKENS,
];
export const SUPPORTED_CURRENCIES = Object.keys(BitpaySupportedCurrencies);
Loading

0 comments on commit 9d2c065

Please sign in to comment.