Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SKIP_PREFLIGHT_CHECK=true
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
13 changes: 11 additions & 2 deletions src/api/localAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions src/api/serverAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -76,6 +76,10 @@ export type ChainType =
| 'rinkebyTestnet'
| 'coinexTestNetwork'
| 'rinkeby'
| 'moonbeamAlphaTestnet'
| 'moonriverMainnet'
| 'coinex'

type GetHydroBalanceResponseType = {
data: {
tokenBalance: string
Expand Down
37 changes: 37 additions & 0 deletions src/assets/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
26 changes: 26 additions & 0 deletions src/assets/images/chainSymbols/moonriver.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 29 additions & 5 deletions src/common/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
// === ===

Expand All @@ -17,6 +18,9 @@ export enum chainIDs {
mumbaiTest = 80001,
rinkebyTest = 4,
coinExTest = 53,
moonbeamAlphaTestnet = 1287,
moonriverMainnet = 1285,
coinex = 52,
}

export const chainsPictures = {
Expand All @@ -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 = {
Expand All @@ -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 =
Expand All @@ -45,6 +55,9 @@ export type RealizedChainsRightType =
| 80001
| 4
| 53
| 1287
| 1285
| 52

export const chainNamesForGetHydroBalance = {
[chainIDs.eth]: 'ethereum',
Expand All @@ -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',
}


Expand All @@ -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
Expand Down
10 changes: 8 additions & 2 deletions src/components/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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 &&
Expand Down
3 changes: 3 additions & 0 deletions src/components/Menu/NetworkElement/NetworkElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/components/Menu/Swapper/Swapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export const Swapper = (props: PropsType) => {
onClick={() => {
if (!props.isDisable && !isSwapperDisabled ) props.onClick()
}}
><FontAwesomeIcon icon={faArrowRightArrowLeft} className={s.icon}/>
>
<FontAwesomeIcon icon={faArrowRightArrowLeft} className={s.icon}/>
</div>
)
}
Expand Down
6 changes: 6 additions & 0 deletions src/components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
}
Expand Down