diff --git a/.env b/.env new file mode 100644 index 0000000..6f809cc --- /dev/null +++ b/.env @@ -0,0 +1 @@ +SKIP_PREFLIGHT_CHECK=true diff --git a/package.json b/package.json index b2ea2d2..0e529e9 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,9 @@ "dependencies": { "@emotion/react": "^11.8.1", "@emotion/styled": "^11.8.1", - "@fortawesome/fontawesome-svg-core": "^1.3.0", - "@fortawesome/free-solid-svg-icons": "^6.0.0", - "@fortawesome/react-fontawesome": "^0.1.17", + "@fortawesome/fontawesome-svg-core": "^6.1.1", + "@fortawesome/free-solid-svg-icons": "^6.1.1", + "@fortawesome/react-fontawesome": "^0.1.18", "@metamask/legacy-web3": "^2.0.0", "@mui/material": "^5.4.4", "@testing-library/jest-dom": "^5.16.2", @@ -22,6 +22,7 @@ "@types/uuid": "^8.3.4", "axios": "^0.26.0", "classnames": "^2.3.1", + "eslint": "^7.11.0", "identicon.js": "^2.3.3", "react": "^17.0.2", "react-dom": "^17.0.1", diff --git a/src/api/localAPI.ts b/src/api/localAPI.ts index 019483e..70390e3 100644 --- a/src/api/localAPI.ts +++ b/src/api/localAPI.ts @@ -76,8 +76,17 @@ export const localAPI = { hydroAddress = hydroAddresses.forBsc break } + case chainIDs.moonriverMainnet: { + hydroAddress = hydroAddresses.forMoonriver + break + } + case chainIDs.coinex: { + hydroAddress = hydroAddresses.forCoinex + break + } case chainIDs.mumbaiTest: case chainIDs.rinkebyTest: + case chainIDs.moonbeamAlphaTestnet: case chainIDs.coinExTest: { hydroAddress = hydroAddresses.forTestNets break @@ -154,14 +163,14 @@ type ErrorType = { code: number } -export type ConversionWayType = 'coinexSmartChainTestnet' | 'mumbaiTestnet' | 'rinkebyTestnet' | 'eth' | 'bsc' | 'polygon' +export type ConversionWayType = 'coinexSmartChainTestnet' | 'mumbaiTestnet' | 'rinkebyTestnet' | 'eth' | 'bsc' | 'polygon' | 'moonbeamAlphaTestnet' | 'moonriverMainnet' | 'coinex' type connectToMetamaskReturnType = { status: boolean account: string chainID: number } -export type ChainIdType = chainIDs.eth | chainIDs.bsc | chainIDs.polygon | chainIDs.mumbaiTest | chainIDs.rinkebyTest | chainIDs.coinExTest +export type ChainIdType = chainIDs.eth | chainIDs.bsc | chainIDs.polygon | chainIDs.mumbaiTest | chainIDs.rinkebyTest | chainIDs.coinExTest | chainIDs.moonbeamAlphaTestnet | chainIDs.moonriverMainnet | chainIDs.coinex export type ReceiptedType = { transactionHash: string diff --git a/src/api/serverAPI.ts b/src/api/serverAPI.ts index 7e8bbda..9ce3825 100644 --- a/src/api/serverAPI.ts +++ b/src/api/serverAPI.ts @@ -2,9 +2,9 @@ import axios from 'axios' import {ReceiptedType} from './localAPI' const instance = axios.create({ - // baseURL: 'http://localhost:3000/api/1.0.0/', + // baseURL: 'https://hydro-bridgev2.herokuapp.com/api/1.0.0/', baseURL: 'https://hydro-bridge.org/api/1.0.0/', - withCredentials: true, + withCredentials: false, }) export const serverApi = { @@ -76,6 +76,10 @@ export type ChainType = | 'rinkebyTestnet' | 'coinexTestNetwork' | 'rinkeby' + | 'moonbeamAlphaTestnet' + | 'moonriverMainnet' + | 'coinex' + type GetHydroBalanceResponseType = { data: { tokenBalance: string diff --git a/src/assets/chains.ts b/src/assets/chains.ts index d41278b..40ae240 100644 --- a/src/assets/chains.ts +++ b/src/assets/chains.ts @@ -83,6 +83,43 @@ export const chains: any = { ], blockExplorerUrls: ["https://testnet.coinex.net"] }, + [chainIDs.moonriverMainnet]: { + chainId: `0x${Number(chainIDs.moonriverMainnet).toString(16)}`, + chainName: chainsNames.moonriverMainnet, + nativeCurrency: { + name: 'Moonriver Chain Native Token', + symbol: "MOVR", + decimals: 18 + }, + rpcUrls: [ + "https://moonriver.blastapi.io/16f8b680-4719-4e0f-aabd-5af382c399b1", + "wss://wss.api.moonbeam.network" + ], + blockExplorerUrls: ["https://moonbeam.moonscan.io"] + }, + [chainIDs.coinex]: { + chainId: `0x${Number(chainIDs.coinex).toString(16)}`, + chainName: chainsNames.coinex, + rpcUrls: [ + "https://rpc.coinex.net" + ], + faucets: [], + nativeCurrency: { + name: "CoinEx Chain Native Token", + symbol: "CET", + decimals: 18 + }, + infoURL: "https://www.coinex.org/", + shortName: "CET", + networkId: 52, + explorers: [ + { + "name": "coinexscan", + "url": "https://www.coinex.net", + "standard": "none" + } + ] + }, }; type chainsType = { diff --git a/src/assets/images/chainSymbols/moonriver.svg b/src/assets/images/chainSymbols/moonriver.svg new file mode 100644 index 0000000..2b68a98 --- /dev/null +++ b/src/assets/images/chainSymbols/moonriver.svg @@ -0,0 +1,26 @@ + + + + + moonriver-logo-movr_freelogovectors.net + + + + + + + + + + + + + diff --git a/src/common/common.ts b/src/common/common.ts index 55f9de2..e0ca61d 100644 --- a/src/common/common.ts +++ b/src/common/common.ts @@ -2,10 +2,11 @@ import binanceBNB from '../assets/images/chainSymbols/binanceBNB.png' import coinexCETT from '../assets/images/chainSymbols/coinexCett.png' import ethereumETH from '../assets/images/chainSymbols/ethereumETH.png' import polygonMatic from '../assets/images/chainSymbols/polygonMatic.png' +import moonriverMVR from '../assets/images/chainSymbols/moonriver.svg' // === IMPORTANT: === // export const addressForWeb3 = 'https://hydroblockchain.github.io/hydro-bridge-ui' // for github.io -export const addressForWeb3 = 'http://127.0.0.1:3001' +export const addressForWeb3 = 'https://hydro-bridge.org/' // export const isTestChains = true // === === @@ -17,6 +18,9 @@ export enum chainIDs { mumbaiTest = 80001, rinkebyTest = 4, coinExTest = 53, + moonbeamAlphaTestnet = 1287, + moonriverMainnet = 1285, + coinex = 52, } export const chainsPictures = { @@ -26,7 +30,10 @@ export const chainsPictures = { [chainIDs.polygon]: polygonMatic, [chainIDs.mumbaiTest]: polygonMatic, [chainIDs.rinkebyTest]: ethereumETH, - [chainIDs.coinExTest]: coinexCETT + [chainIDs.coinExTest]: coinexCETT, + [chainIDs.moonbeamAlphaTestnet]: ethereumETH, + [chainIDs.moonriverMainnet]: moonriverMVR, + [chainIDs.coinex]: coinexCETT } export const chainsNationalSymbols: ChainsNationalSymbolsType = { @@ -35,7 +42,10 @@ export const chainsNationalSymbols: ChainsNationalSymbolsType = { [chainIDs.polygon]: 'MATIC', [chainIDs.mumbaiTest]: 'MATIC', [chainIDs.rinkebyTest]: 'ETH', - [chainIDs.coinExTest]: 'CETT' + [chainIDs.coinExTest]: 'CETT', + [chainIDs.moonbeamAlphaTestnet]: 'DEV', + [chainIDs.moonriverMainnet]: 'MOVR', + [chainIDs.coinex]: 'CET', } export type RealizedChainsRightType = @@ -45,6 +55,9 @@ export type RealizedChainsRightType = | 80001 | 4 | 53 + | 1287 + | 1285 + | 52 export const chainNamesForGetHydroBalance = { [chainIDs.eth]: 'ethereum', @@ -53,6 +66,9 @@ export const chainNamesForGetHydroBalance = { [chainIDs.mumbaiTest]: 'polygonTestnet', [chainIDs.rinkebyTest]: 'rinkebyTestnet', [chainIDs.coinExTest]: 'coinexTestNetwork', + [chainIDs.moonbeamAlphaTestnet]: 'moonbeamAlphaTestnet', + [chainIDs.moonriverMainnet]: 'moonriverMainnet', + [chainIDs.coinex]: 'coinex', } @@ -65,21 +81,29 @@ export enum chainsNames { mumbaiTest = 'Mumbai Testnet', rinkebyTest = 'Rinkeby Test Network', coinExTest = 'CoinEx Smart Chain Testnet', + moonbeamAlphaTestnet = 'Moonbeam Alpha Testnet', + moonriverMainnet = 'Moonriver Network', + coinex = 'Coinex Smart Chain', } export const hydroAddresses = { forEth: '0x946112efaB61C3636CBD52DE2E1392D7A75A6f01', forBsc: '0xf3DBB49999B25c9D6641a9423C7ad84168D00071', - forPolygon: '0x946112efaB61C3636CBD52DE2E1392D7A75A6f01 ', + forPolygon: '0x946112efaB61C3636CBD52DE2E1392D7A75A6f01', + forMoonriver: '0x946112efaB61C3636CBD52DE2E1392D7A75A6f01', + forCoinex: '0x946112efaB61C3636CBD52DE2E1392D7A75A6f01', forTestNets: '0x9477B2d4442FCd35368c029a0016e6800437BAe2' } export const swapContractAddresses = { eth: '0xfa41d158Ea48265443799CF720a120BFE77e41ca', bsc: '0x7f00F1B8825064B109Dcc85aAd1f074652D97AAd', polygon: '0xc8ea800fb6c6f8419758741b3ea1b85dddf2c5b8', - coinexSmartChainTestnet: '0x1500D17ECa72d87331db5f5dd634d755D73a0041', + coinexSmartChainTestnet: '0x0ca32D03C30F9911a93E6516272EB6635387261d', mumbaiTestnet: '0x1500D17ECa72d87331db5f5dd634d755D73a0041', rinkebyTestnet: '0xFBCf060541596047e47Db0ddcf37818D2B2eD4c0', + moonbeamAlphaTestnet: '0xC62cfE5c4780b9f9d24209036BA0764B43C0F279', + moonriverMainnet: '0x7f45Fd12651F397Db4916d32762bc9ce01740e3C', + coinex: '0x7f45Fd12651F397Db4916d32762bc9ce01740e3C', } // for dark and light theme switch diff --git a/src/components/Menu/Menu.tsx b/src/components/Menu/Menu.tsx index 7c890f9..d9ea536 100644 --- a/src/components/Menu/Menu.tsx +++ b/src/components/Menu/Menu.tsx @@ -54,8 +54,8 @@ export const Menu = () => { const checkIsChainIdSupported = (chainID: chainIDs) => { const chainIDsActive = isTestNets - ? [chainIDs.notSelected, chainIDs.mumbaiTest, chainIDs.rinkebyTest, chainIDs.coinExTest] - : [chainIDs.notSelected, chainIDs.eth, chainIDs.bsc, chainIDs.polygon] + ? [chainIDs.notSelected, chainIDs.mumbaiTest, chainIDs.rinkebyTest, chainIDs.coinExTest, chainIDs.moonbeamAlphaTestnet] + : [chainIDs.notSelected, chainIDs.eth, chainIDs.bsc, chainIDs.polygon, chainIDs.moonriverMainnet, chainIDs.coinex] return chainIDsActive.includes(chainID) } @@ -83,6 +83,12 @@ export const Menu = () => { setSwapWay('mumbaiTestnet') } else if (leftChainId === chainIDs.rinkebyTest) { setSwapWay('rinkebyTestnet') + } else if (leftChainId === chainIDs.moonbeamAlphaTestnet) { + setSwapWay('moonbeamAlphaTestnet') + } else if (leftChainId === chainIDs.moonriverMainnet) { + setSwapWay('moonriverMainnet') + } else if (leftChainId === chainIDs.coinex) { + setSwapWay('coinex') } else setSwapWay(undefined) if (leftChainId !== chainIDs.notSelected && diff --git a/src/components/Menu/NetworkElement/NetworkElement.tsx b/src/components/Menu/NetworkElement/NetworkElement.tsx index 4196f98..30956a7 100644 --- a/src/components/Menu/NetworkElement/NetworkElement.tsx +++ b/src/components/Menu/NetworkElement/NetworkElement.tsx @@ -30,11 +30,14 @@ export const NetworkElement = (props: PropsType) => { {value: chainIDs.mumbaiTest, label: chainsNames.mumbaiTest}, {value: chainIDs.rinkebyTest, label: chainsNames.rinkebyTest}, {value: chainIDs.coinExTest, label: chainsNames.coinExTest}, + {value: chainIDs.moonbeamAlphaTestnet, label: chainsNames.moonbeamAlphaTestnet}, ] : [ {value: chainIDs.eth, label: chainsNames.eth}, {value: chainIDs.bsc, label: chainsNames.bsc}, {value: chainIDs.polygon, label: chainsNames.polygon}, + {value: chainIDs.moonriverMainnet, label: chainsNames.moonriverMainnet}, + {value: chainIDs.coinex, label: chainsNames.coinex}, ] const selectByArrowColor = isLightTheme ? menuColorLight : menuColor diff --git a/src/components/Menu/Swapper/Swapper.tsx b/src/components/Menu/Swapper/Swapper.tsx index 7721cad..b10b9cf 100644 --- a/src/components/Menu/Swapper/Swapper.tsx +++ b/src/components/Menu/Swapper/Swapper.tsx @@ -24,7 +24,8 @@ export const Swapper = (props: PropsType) => { onClick={() => { if (!props.isDisable && !isSwapperDisabled ) props.onClick() }} - > + > + ) } diff --git a/src/components/Navbar/Navbar.tsx b/src/components/Navbar/Navbar.tsx index 9465cd5..b518090 100644 --- a/src/components/Navbar/Navbar.tsx +++ b/src/components/Navbar/Navbar.tsx @@ -33,6 +33,12 @@ export const Navbar = () => { return chainsNames.rinkebyTest case chainIDs.coinExTest: return chainsNames.coinExTest + case chainIDs.moonriverMainnet: + return chainsNames.moonriverMainnet + case chainIDs.moonbeamAlphaTestnet: + return chainsNames.moonbeamAlphaTestnet + case chainIDs.coinex: + return chainsNames.coinex default: return 'Metamask network is not supported yet.' }