diff --git a/package.json b/package.json index ac6b944d33..aafb5622fc 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "safe-wallet-web", "homepage": "https://github.com/safe-global/safe-wallet-web", "license": "GPL-3.0", + "type": "module", "version": "1.19.1", "scripts": { "dev": "next dev", @@ -18,7 +19,7 @@ "routes": "node scripts/generate-routes.js > src/config/routes.ts && prettier -w src/config/routes.ts && cat src/config/routes.ts", "css-vars": "ts-node-esm ./scripts/css-vars.ts > ./src/styles/vars.css && prettier -w src/styles/vars.css", "generate-types": "typechain --target ethers-v5 --out-dir src/types/contracts ./node_modules/@safe-global/safe-deployments/dist/assets/**/*.json ./node_modules/@safe-global/safe-modules-deployments/dist/assets/**/*.json ./node_modules/@openzeppelin/contracts/build/contracts/ERC20.json ./node_modules/@openzeppelin/contracts/build/contracts/ERC721.json", - "after-install": "yarn patch-package && yarn generate-types", + "after-install": "yarn patch-package && yarn generate-types && yarn css-vars", "postinstall": "yarn after-install", "analyze": "cross-env ANALYZE=true yarn build", "cypress:open": "cross-env TZ=UTC cypress open --e2e", @@ -132,10 +133,5 @@ "typescript": "4.9.4", "typescript-plugin-css-modules": "^4.2.2", "webpack": "^5.88.2" - }, - "tsconfig": { - "compilerOptions": { - "esModuleInterop": true - } } } diff --git a/src/components/common/TokenIcon/index.tsx b/src/components/common/TokenIcon/index.tsx index a3a64d80ae..d7df8e4225 100644 --- a/src/components/common/TokenIcon/index.tsx +++ b/src/components/common/TokenIcon/index.tsx @@ -4,6 +4,16 @@ import css from './styles.module.css' const FALLBACK_ICON = '/images/common/token-placeholder.svg' +const CUSTOM_LOGO_MAP: Record = { + BNB: `https://www.bnbchainlist.org/static/images/rsz_bnb.svg`, + TCBNB: `https://www.bnbchainlist.org/static/images/rsz_bnb.svg`, + BTC: `https://raw.githubusercontent.com/bnb-chain/opbnb-bridge-tokens/main/data/BTCB/logo.svg`, + BTCB: `https://raw.githubusercontent.com/bnb-chain/opbnb-bridge-tokens/main/data/BTCB/logo.svg`, + USDT: `https://raw.githubusercontent.com/bnb-chain/opbnb-bridge-tokens/main/data/USDT/logo.svg`, + FDUSD: `https://raw.githubusercontent.com/bnb-chain/opbnb-bridge-tokens/main/data/FDUSD/logo.jpeg`, + ETH: `https://raw.githubusercontent.com/bnb-chain/opbnb-bridge-tokens/main/data/ETH/logo.svg`, +} + const TokenIcon = ({ logoUri, tokenSymbol, @@ -15,9 +25,14 @@ const TokenIcon = ({ size?: number fallbackSrc?: string }): ReactElement => { + let logoURL = logoUri + if (tokenSymbol && CUSTOM_LOGO_MAP[tokenSymbol]) { + logoURL = CUSTOM_LOGO_MAP[tokenSymbol] + } + return ( { const walletChainId = wallet?.chainId && configs.some(({ chainId }) => chainId === wallet.chainId) ? wallet.chainId : undefined - return urlChainId || walletChainId || session.lastChainId || defaultChainId + return defaultChainId || urlChainId || walletChainId || session.lastChainId } export default useChainId