Skip to content

Commit

Permalink
Merge pull request #1110 from yieldprotocol/feat/ChainColors
Browse files Browse the repository at this point in the history
adding in colors for different chains
  • Loading branch information
jacobryas4 authored Feb 16, 2023
2 parents c0f6589 + 6880209 commit ff42dae
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/NetworkBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const NetworkBanner = () => {
if (!ethBalance || !currentChainInfo || (ethBalance && ethBalance.gt(ZERO_BN))) return null;

return SHOWABLE_CHAINS.includes(chain.id) && show ? (
<StyledBox pad="small" background={{ opacity: 0.9 }} round gap="small">
<StyledBox pad="small" background={{ color: chain.iconBackground, opacity: 0.9 }} round gap="small">
<Box direction="row" justify="between">
<Box>Yield on {chain.name}</Box>
<Button onClick={() => setShow(false)}>
Expand Down
14 changes: 14 additions & 0 deletions src/config/customChains.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Chain } from '@rainbow-me/rainbowkit'
import { mainnet, arbitrum } from 'wagmi/chains'

export const defaultChains: Chain[] = [
{
...mainnet,
iconBackground: '#29b6af'
},
{
...arbitrum,
iconBackground: '#1F2937'
}
]

4 changes: 2 additions & 2 deletions src/contexts/ProviderContext.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { WagmiConfig, createClient, configureChains } from 'wagmi';
import { mainnet, arbitrum } from 'wagmi/chains';
import { alchemyProvider } from 'wagmi/providers/alchemy';
import { jsonRpcProvider } from 'wagmi/providers/jsonRpc';
import { ReactNode, useContext } from 'react';
import { SettingsContext } from './SettingsContext';
import { defaultChains } from '../config/customChains';

import {
darkTheme,
Expand Down Expand Up @@ -58,7 +58,7 @@ const ProviderContext = ({ children }: { children: ReactNode }) => {

// Two popular providers are Alchemy (alchemy.com) and Infura (infura.io)
const { chains, provider } = configureChains(
[mainnet, arbitrum], // [chain.mainnet, chain.arbitrum, chain.localhost, chain.foundry],
defaultChains, // [chain.mainnet, chain.arbitrum, chain.localhost, chain.foundry],
[...chainConfig] // , publicProvider() ] // defaults to public if all else fails
);

Expand Down

0 comments on commit ff42dae

Please sign in to comment.