-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1b3b609
commit 671bf71
Showing
3 changed files
with
58 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,63 @@ | ||
export const getChainColor = (chainId: number, mode: 'dark' | 'light' = 'light') => { | ||
import { networks, ChainId } from '@0xsequence/network' | ||
|
||
export const getNetworkColor = (chainId: number, mode: 'dark' | 'light' = 'light') => { | ||
switch (chainId) { | ||
case 1: | ||
case ChainId.MAINNET: | ||
return mode === 'light' ? '#abf' : '#abf' | ||
case 137: | ||
case ChainId.POLYGON: | ||
return mode === 'light' ? '#c7a6ff' : '#c7a6ff' | ||
case 42161: | ||
case ChainId.ARBITRUM: | ||
return mode === 'light' ? '#52A7E6' : '#52A7E6' | ||
case 10: | ||
case ChainId.OPTIMISM: | ||
return mode === 'light' ? '#DB3132' : '#DB3132' | ||
case 56: | ||
case ChainId.BSC: | ||
return mode === 'light' ? '#CB9C1D' : '#EEB445' | ||
case 43114: | ||
case ChainId.AVALANCHE: | ||
return mode === 'light' ? '#E84142' : '#E84142' | ||
case 100: | ||
case ChainId.GNOSIS: | ||
return mode === 'light' ? '#00193C' : '#D8E8FF' | ||
case 5: | ||
case ChainId.GOERLI: | ||
return mode === 'light' ? '#A77A00' : '#FFA700' | ||
case 80001: | ||
case ChainId.POLYGON_MUMBAI: | ||
case ChainId.POLYGON_AMOY: | ||
return mode === 'light' ? '#D68828' : '#FFA700' | ||
default: | ||
return mode === 'light' ? '#abf' : '#abf' | ||
} | ||
} | ||
|
||
export const getChainBGColor = (chainId: number, mode: 'dark' | 'light' = 'light') => { | ||
export const getNetworkBackgroundColor = (chainId: number, mode: 'dark' | 'light' = 'light') => { | ||
switch (chainId) { | ||
case 1: | ||
case ChainId.MAINNET: | ||
return mode === 'light' ? '#132362' : '#132362' | ||
case 137: | ||
case ChainId.POLYGON: | ||
return mode === 'light' ? '#350881' : '#350881' | ||
case 42161: | ||
case ChainId.ARBITRUM: | ||
return mode === 'light' ? '#EDF7FF' : '#0C3754' | ||
case 10: | ||
case ChainId.OPTIMISM: | ||
return mode === 'light' ? '#FFEAE9' : '#390B0C' | ||
case 56: | ||
case ChainId.BSC: | ||
return mode === 'light' ? '#FFE8AB' : '#554018' | ||
case 43114: | ||
case ChainId.AVALANCHE: | ||
return mode === 'light' ? '#FBDFDF' : '#390B0C' | ||
case 100: | ||
case ChainId.GNOSIS: | ||
return mode === 'light' ? '#D8E8FF' : '#00193C' | ||
case 5: | ||
case ChainId.GOERLI: | ||
return mode === 'light' ? '#FFD871' : '#554018' | ||
case 80001: | ||
case ChainId.POLYGON_MUMBAI: | ||
case ChainId.POLYGON_AMOY: | ||
return mode === 'light' ? '#FFE8CD' : '#554018' | ||
default: | ||
return mode === 'light' ? '#132362' : '#132362' | ||
} | ||
} | ||
|
||
export const getNetwork = (chainId: number) => { | ||
const network = networks[chainId as ChainId] | ||
|
||
if (!network) { | ||
throw new Error(`Unknown network chainId: ${chainId}`) | ||
} | ||
|
||
return network | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters