use updated token icon api

This commit is contained in:
Barry Gitarts 2019-12-19 14:11:44 -05:00 committed by Barry G
parent 866d7f7531
commit a7e0cfcbbb
4 changed files with 10 additions and 7 deletions

View File

@ -4,8 +4,9 @@ import TextField from '@material-ui/core/TextField'
import MenuItem from '@material-ui/core/MenuItem'
import FormControlLabel from '@material-ui/core/FormControlLabel'
import Switch from '@material-ui/core/Switch'
import { TOKEN_ICON_API } from '../../utils/currencies'
import { NEW_TOKEN_ICON_API } from '../../utils/currencies'
import { toEther } from '../../utils/conversions'
import { checksumAddress } from '../../utils/address'
import { getLpAllowance, standardTokenApproval } from '../../utils/initialize'
import { FundingContext } from '../../context'
@ -102,7 +103,7 @@ function CurrencySelect({
<MenuItem style={{display: 'flex', alignItems: 'center'}} key={option.value} value={option.value}>
<div style={{display: 'flex', alignItems: 'center'}}>
{option.icon || <img
src={option.img || `${TOKEN_ICON_API}/${option.value}.png`}
src={option.img || `${NEW_TOKEN_ICON_API}/${checksumAddress(option.value)}/logo.png`}
style={{width: option.width, marginRight: '1rem'}}
/>}
{option.label}

View File

@ -2,12 +2,13 @@
import ERC20 from '../embarkArtifacts/contracts/ERC20'
import { isNil } from 'ramda'
import {
TOKEN_API,
NEW_TOKEN_ICON_API,
generateHumanReadibleFn,
generateChainReadibleFn,
getLpAllowance,
generateSetApprovalFn
} from '../utils/currencies'
import { checksumAddress } from '../utils/address'
function createERC20Instance(address) {
return new web3.eth.Contract(ERC20._jsonInterface, address)
@ -23,7 +24,7 @@ function mapToCurrencyFormat(currency) {
return {
value: address,
label: symbol,
img: imageUrls[symbol] || `${TOKEN_API}/${id}.png`,
img: imageUrls[symbol] || `${NEW_TOKEN_ICON_API}/${checksumAddress(id)}/logo.png`,
width: '2rem',
contract,
humanReadibleFn: generateHumanReadibleFn(decimals),

View File

@ -1 +1,4 @@
/*global web3*/
export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
export const checksumAddress = address => web3.utils.toChecksumAddress(address)

View File

@ -1,9 +1,7 @@
/*global web3*/
import SNT from '../embarkArtifacts/contracts/SNT'
import cDAI from '../embarkArtifacts/contracts/cDAI'
import cETH from '../embarkArtifacts/contracts/cETH'
import SwapProxy from '../embarkArtifacts/contracts/SwapProxy'
import { toEther, toWei, compoundWhole, compoundToChain } from './conversions'
import { toEther, toWei } from './conversions'
export const TOKEN_ICON_API = 'https://raw.githubusercontent.com/TrustWallet/tokens/master/images'
export const TOKEN_COIN_API = 'https://raw.githubusercontent.com/TrustWallet/tokens/master/coins'