Skip to content

Commit

Permalink
feat: add chain and currency consts
Browse files Browse the repository at this point in the history
  • Loading branch information
aramalipoor committed Dec 24, 2022
1 parent e808aa6 commit 90b577e
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 2 deletions.
41 changes: 41 additions & 0 deletions packages/common/src/constants/chain-id.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
export enum ChainId {
ETHEREUM_MAINNET = 1,
ETHEREUM_GOERLI = 5,
ETHEREUM_SEPOLIA = 11155111,
ARBITRUM_ONE = 42161,
ARBITRUM_NOVA = 42170,
ARBITRUM_GOERLI = 421613,
OPTIMISM = 10,
OPTIMISM_GOERLI = 420,
POLYGON_MATIC = 137,
POLYGON_MUMBAI = 80001,
BINANCE_CHAIN_MAINNET = 56,
BINANCE_CHAIN_TESTNET = 97,
AVALANCHE_C_CHAIN = 43114,
AVALANCHE_FUJI_TESTNET = 43113,
FANTOM_MAINNET = 250,
FANTOM_TESTNET = 4002,
MOONBEAM = 1284,
MOONRIVER = 1285,
OKC_MAINNET = 66,
THETA_MAINNET = 361,
TELOS_MAINNET = 40,
TELOS_TESTNET = 41,
OASIS_EMERALD_MAINNET = 42262,
CELO_MAINNET = 42220,
CELO_ALFAJORES = 44787,
CRONOS_MAINNET = 25,
CRONOS_TESTNET = 338,
EVMOS_MAINNET = 9001,
EVMOS_TESTNET = 9000,
FUSE_MAINNET = 122,
FUSE_SPARKNET = 123,
NEON_DEVNET = 245022926,
NEON_TESTNET = 245022940,
NEON_MAINNET = 245022934,
HARMONY_TESTNET = 1666700000,
HARMONY_MAINNET = 1666600000,
AURORA_MAINNET = 1313161554,
AURORA_TESTNET = 1313161555,
AURORA_BETANET = 1313161556,
}
1 change: 1 addition & 0 deletions packages/common/src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './chain-id';
export * from './erc20s';
33 changes: 33 additions & 0 deletions packages/react/src/core/crypto-currency/constants/currencies.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,49 @@
import { ChainId } from '@flair-sdk/common';

import { BaseCurrency, CryptoCurrency } from '../types';

export const KNOWN_BASE_CURRENCIES: BaseCurrency[] = ['USD'];

export const KNOWN_CRYPTO_CURRENCIES: CryptoCurrency[] = [
{
nativeChainIds: [
ChainId.ETHEREUM_MAINNET,
ChainId.ETHEREUM_GOERLI,
ChainId.ETHEREUM_SEPOLIA,
ChainId.ARBITRUM_ONE,
ChainId.ARBITRUM_NOVA,
ChainId.ARBITRUM_GOERLI,
ChainId.OPTIMISM,
ChainId.OPTIMISM_GOERLI,
],
symbol: 'ETH',
name: 'Ethereum',
icon: 'ETH',
coinGeckoId: 'ethereum',
coinMarketCapSymbol: 'ETH',
},
{
nativeChainIds: [ChainId.POLYGON_MATIC, ChainId.POLYGON_MUMBAI],
symbol: 'MATIC',
name: 'Matic',
icon: 'MATIC',
coinGeckoId: 'matic-network',
coinMarketCapSymbol: 'MATIC',
},
{
nativeChainIds: [ChainId.AVALANCHE_C_CHAIN, ChainId.AVALANCHE_FUJI_TESTNET],
symbol: 'AVAX',
name: 'AVAX',
icon: 'AVAX',
coinGeckoId: 'avalanche-2',
coinMarketCapSymbol: 'AVAX',
},
{
nativeChainIds: [
ChainId.NEON_MAINNET,
ChainId.NEON_TESTNET,
ChainId.NEON_DEVNET,
],
symbol: 'NEON',
name: 'NEON',
icon: 'NEON',
Expand All @@ -39,76 +58,90 @@ export const KNOWN_CRYPTO_CURRENCIES: CryptoCurrency[] = [
coinMarketCapSymbol: 'NEAR',
},
{
nativeChainIds: [ChainId.FANTOM_MAINNET, ChainId.FANTOM_TESTNET],
symbol: 'FTM',
name: 'FTM',
icon: 'FTM',
coinGeckoId: 'fantom',
coinMarketCapSymbol: 'FTM',
},
{
nativeChainIds: [ChainId.EVMOS_MAINNET, ChainId.EVMOS_TESTNET],
symbol: 'EVMOS',
name: 'EVMOS',
icon: 'EVMOS',
coinGeckoId: 'evmos',
coinMarketCapSymbol: 'EVMOS',
},
{
nativeChainIds: [ChainId.MOONBEAM],
symbol: 'GLMR',
name: 'GLMR',
icon: 'GLMR',
coinGeckoId: 'moonbeam',
coinMarketCapSymbol: 'GLMR',
},
{
nativeChainIds: [ChainId.MOONRIVER],
symbol: 'MOVR',
name: 'MOVR',
icon: 'MOVR',
coinGeckoId: 'moonriver',
coinMarketCapSymbol: 'MOVR',
},
{
nativeChainIds: [
ChainId.BINANCE_CHAIN_MAINNET,
ChainId.BINANCE_CHAIN_TESTNET,
],
symbol: 'BNB',
name: 'BNB',
icon: 'BNB',
coinGeckoId: 'binancecoin',
coinMarketCapSymbol: 'BNB',
},
{
nativeChainIds: [ChainId.FUSE_MAINNET, ChainId.FUSE_SPARKNET],
symbol: 'FUSE',
name: 'FUSE',
icon: 'FUSE',
coinGeckoId: 'fuse',
coinMarketCapSymbol: 'FUSE',
},
{
nativeChainIds: [ChainId.TELOS_MAINNET, ChainId.TELOS_TESTNET],
symbol: 'TLOS',
name: 'TELOS',
icon: 'TLOS',
coinGeckoId: 'telos',
coinMarketCapSymbol: 'TLOS',
},
{
nativeChainIds: [ChainId.OKC_MAINNET],
symbol: 'OKT',
name: 'OKT',
icon: 'OKT',
coinGeckoId: 'okc-token',
coinMarketCapSymbol: 'OKT',
},
{
nativeChainIds: [ChainId.OASIS_EMERALD_MAINNET],
symbol: 'ROSE',
name: 'ROSE',
icon: 'ROSE',
coinGeckoId: 'oasis-network',
coinMarketCapSymbol: 'ROSE',
},
{
nativeChainIds: [ChainId.CELO_MAINNET, ChainId.CELO_ALFAJORES],
symbol: 'CELO',
name: 'CELO',
icon: 'CELO',
coinGeckoId: 'celo',
coinMarketCapSymbol: 'CELO',
},
{
nativeChainIds: [ChainId.CRONOS_MAINNET, ChainId.CRONOS_TESTNET],
symbol: 'CRO',
name: 'CRO',
icon: 'CRO',
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/core/crypto-currency/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from './types';
export * from './components';
export * from './constants';
export * from './hooks';
export * from './components';
export * from './providers';
export * from './types';
3 changes: 3 additions & 0 deletions packages/react/src/core/crypto-currency/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { ChainId } from '@flair-sdk/common';

export type CryptoSymbol = 'ETH' | 'MATIC' | string;

export type CryptoCurrency = {
symbol: CryptoSymbol;
name: string;
nativeChainIds?: ChainId[];
icon?: React.ReactNode;
coinGeckoId?: string;
coinMarketCapSymbol?: string;
Expand Down

0 comments on commit 90b577e

Please sign in to comment.