diff --git a/.github/workflows/push-docker-main.yml b/.github/workflows/push-docker-main.yml index 07688708..27988623 100644 --- a/.github/workflows/push-docker-main.yml +++ b/.github/workflows/push-docker-main.yml @@ -28,4 +28,4 @@ jobs: with: platforms: linux/amd64,linux/arm64 push: true - tags: gatewayfm/zkevm-bridge-ui-generic:1.0.0 + tags: gatewayfm/zkevm-bridge-ui-generic:1.0.1 diff --git a/src/adapters/env.ts b/src/adapters/env.ts index 8bf5163e..44c75e58 100644 --- a/src/adapters/env.ts +++ b/src/adapters/env.ts @@ -20,6 +20,7 @@ interface Env { VITE_FIAT_EXCHANGE_RATES_API_KEY?: string; VITE_FIAT_EXCHANGE_RATES_API_URL?: string; VITE_FIAT_EXCHANGE_RATES_ETHEREUM_USDC_ADDRESS?: string; + VITE_ICON_PATH?: string; VITE_LOGO_PATH?: string; VITE_NETWORK_NAME?: string; VITE_NETWORK_SYMBOL?: string; @@ -173,6 +174,7 @@ const envToDomain = ({ VITE_FIAT_EXCHANGE_RATES_API_KEY, VITE_FIAT_EXCHANGE_RATES_API_URL, VITE_FIAT_EXCHANGE_RATES_ETHEREUM_USDC_ADDRESS, + VITE_ICON_PATH, VITE_LOGO_PATH, VITE_NETWORK_NAME, VITE_NETWORK_SYMBOL, @@ -198,6 +200,7 @@ const envToDomain = ({ ); const bridgeApiUrl = VITE_BRIDGE_API_URL; const logoPath = VITE_LOGO_PATH; + const iconPath = VITE_ICON_PATH ?? logoPath; const faviconPath = VITE_FAVICON_PATH; const networkName = VITE_NETWORK_NAME; const networkSymbol = VITE_NETWORK_SYMBOL; @@ -226,6 +229,7 @@ const envToDomain = ({ polygonZkEVM: { bridgeContractAddress: VITE_POLYGON_ZK_EVM_BRIDGE_CONTRACT_ADDRESS, explorerUrl: VITE_POLYGON_ZK_EVM_EXPLORER_URL, + iconUrl: iconPath, networkId: polygonZkEVMNetworkId, rpcUrl: VITE_POLYGON_ZK_EVM_RPC_URL, }, @@ -282,6 +286,7 @@ const envParser = StrictSchema()( VITE_FIAT_EXCHANGE_RATES_API_KEY: z.string().optional(), VITE_FIAT_EXCHANGE_RATES_API_URL: z.string().url().optional(), VITE_FIAT_EXCHANGE_RATES_ETHEREUM_USDC_ADDRESS: z.string().length(42).optional(), + VITE_ICON_PATH: z.string().optional(), VITE_LOGO_PATH: z.string().optional(), VITE_NETWORK_NAME: z.string().optional(), VITE_NETWORK_SYMBOL: z.string().optional(), diff --git a/src/assets/network-icon.tsx b/src/assets/network-icon.tsx new file mode 100644 index 00000000..777c6483 --- /dev/null +++ b/src/assets/network-icon.tsx @@ -0,0 +1,8 @@ +export const L2Icon = (url: string) => { + return () => { + return ( + + ) + + } +} \ No newline at end of file diff --git a/src/constants.ts b/src/constants.ts index f32678b9..9ec2432f 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -2,6 +2,7 @@ import { StaticJsonRpcProvider } from "@ethersproject/providers"; import { ethers } from "ethers"; import { defaultAbiCoder } from "ethers/lib/utils"; +import { L2Icon } from "./assets/network-icon"; import { ReactComponent as EthChainIcon } from "src/assets/icons/chains/ethereum.svg"; import { ReactComponent as PolygonZkEVMChainIcon } from "src/assets/icons/chains/polygon-zkevm.svg"; import { Chain, Currency, EthereumChain, ProviderError, Token, ZkEVMChain } from "src/domain"; @@ -93,6 +94,7 @@ export const getChains = ({ polygonZkEVM: { bridgeContractAddress: string; explorerUrl: string; + iconUrl?: string; networkId: number; rpcUrl: string; }; @@ -107,10 +109,6 @@ export const getChains = ({ polygonZkEVM.bridgeContractAddress, polygonZkEVMProvider ); - // const bridgeEthereumContract = Bridge__factory.connect( - // ethereum.bridgeContractAddress, - // ethereumProvider - // ); return Promise.all([ ethereumProvider.getNetwork().catch(() => Promise.reject(ProviderError.Ethereum)), @@ -153,7 +151,7 @@ export const getChains = ({ bridgeContractAddress: polygonZkEVM.bridgeContractAddress, chainId: polygonZkEVMNetwork.chainId, explorerUrl: polygonZkEVM.explorerUrl, - Icon: PolygonZkEVMChainIcon, + Icon: polygonZkEVM.iconUrl ? L2Icon(polygonZkEVM.iconUrl) : PolygonZkEVMChainIcon, key: "polygon-zkevm", name: polygonZkEVMNetworkName, nativeCurrency: {