Skip to content

Commit

Permalink
load env var and use it as network name on addchain
Browse files Browse the repository at this point in the history
  • Loading branch information
manfioLP committed Dec 3, 2024
1 parent 7c9dc94 commit 46efeee
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export const getChains = ({
rpcUrl: string;
};
}): Promise<[EthereumChain, ZkEVMChain]> => {
let networkName = ""
const ethereumProvider = new StaticJsonRpcProvider(ethereum.rpcUrl);
const polygonZkEVMProvider = new StaticJsonRpcProvider(polygonZkEVM.rpcUrl);
const poeContract = ProofOfEfficiency__factory.connect(
Expand All @@ -112,6 +113,9 @@ export const getChains = ({
if (import.meta.env.VITE_CHAIN_ICON_PATH) {
polygonZkEVM.iconUrl = import.meta.env.VITE_CHAIN_ICON_PATH;
}
if (import.meta.env.VITE_NETWORK_NAME) {
networkName = import.meta.env.VITE_NETWORK_NAME || ""
}

return Promise.all([
ethereumProvider.getNetwork().catch(() => Promise.reject(ProviderError.Ethereum)),
Expand Down Expand Up @@ -156,7 +160,7 @@ export const getChains = ({
explorerUrl: polygonZkEVM.explorerUrl,
Icon: polygonZkEVM.iconUrl ? L2Icon(polygonZkEVM.iconUrl) : PolygonZkEVMChainIcon,
key: "polygon-zkevm",
name: polygonZkEVMNetworkName,
name: networkName || polygonZkEVMNetworkName,
nativeCurrency: {
decimals: metadata.decimals,
name: metadata.name,
Expand Down

0 comments on commit 46efeee

Please sign in to comment.