diff --git a/package.json b/package.json index bafd647dbd..5583d8e4fe 100644 --- a/package.json +++ b/package.json @@ -39,9 +39,9 @@ "@mui/icons-material": "^5.8.4", "@mui/lab": "^5.0.0-alpha.72", "@mui/material": "^5.5.0", - "@pushprotocol/restapi": "1.7.17", + "@pushprotocol/restapi": "1.7.18", "@pushprotocol/socket": "0.5.3", - "@pushprotocol/uiweb": "1.3.2", + "@pushprotocol/uiweb": "1.3.5", "@reduxjs/toolkit": "^1.7.1", "@testing-library/dom": "^9.0.1", "@testing-library/jest-dom": "^4.2.4", diff --git a/public/svg/Cyber.svg b/public/svg/Cyber.svg new file mode 100644 index 0000000000..6447cfadb7 --- /dev/null +++ b/public/svg/Cyber.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/components/Faucets.jsx b/src/components/Faucets.jsx deleted file mode 100644 index 7084e3f84b..0000000000 --- a/src/components/Faucets.jsx +++ /dev/null @@ -1,180 +0,0 @@ -// React + Web3 Essentials -import React, { useRef } from "react"; - -// External Packages -import styled, { useTheme } from 'styled-components'; - -// Internal Components -import { useClickAway } from "hooks/useClickAway"; -import { Image, Item, ItemH } from '../primaries/SharedStyling'; -import Dropdown from "./Dropdown"; - -// Faucet URLs -const Faucets = () => { - const theme = useTheme(); - const toggleArrowRef = useRef(null); - const dropdownRef = useRef(null); - - const [showDropdown, setShowDropdown] = React.useState(false); - - useClickAway(toggleArrowRef,dropdownRef, () => { - setShowDropdown(false); - }); - - const dropdownValues = [ - { - id: "11155111", - value: "Sepolia", - title: "Sepolia Faucet", - function: () => {}, - link: "https://sepoliafaucet.com/", - }, - { - id: "80002", - value: "Polygon", - title: "Amoy Faucet", - function: () => {}, - link: "https://faucet.polygon.technology/", - }, - { - id: "97", - value: "BNB", - title: "BNB Faucet", - function: () => {}, - link: "https://testnet.bnbchain.org/faucet-smart", - }, - { - id: "11155420", - value: "Optimism", - title: "Optimism Sepolia Faucet", - function: () => {}, - link: "https://faucet.quicknode.com/optimism/sepolia", - }, - { - id: "2442", - value: "Polygon zkEVM", - title: "Polygon zkEVM Bridge", - function: () => {}, - link: "https://faucet.polygon.technology/" - }, - { - id: "421614", - value: "Arbitrum", - title: "Arbitrum Testnet Faucet", - function: () => {}, - link: "https://faucet.quicknode.com/arbitrum/sepolia" - }, - { - id: "123", - value: "Fuse", - title: "Fuse Sparknet Faucet", - function: () => {}, - link: "https://chaindrop.org/?chainid=123&token=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" - } - ]; - - // render - return ( - - setShowDropdown(!showDropdown)} ref={toggleArrowRef}> - - faucet - - Testnet Faucets - - arrow - - - {showDropdown && ( - - - - )} - - ); -} - -// Export Default -export default Faucets; - -// css styles -const Container = styled.button` - position:relative; - margin: 0; - padding: 0; - background: none; - border: 0; - outline: 0; - min-width: 230px; - - @media (max-width: 768px) - { - width: 100%; - // padding: 0 0px 0px 0px; - } -` - -const ItemHBar = styled.div` - padding: 0 20px 0 0px; -` -const Faucet = styled.div` - margin: 0px 10px; - padding: 5px 15px; - display: flex; - flex-direction: row; - align-items: center; - justify-content: center; - font-weight: 400; - border: 1px solid ${props => props.theme.faucetBorder}; - font-size: 15px; - background: ${props => props.theme.faucetBg}; - color: ${props => props.theme.faucetText}; - border-radius: 20px; - &:hover { - opacity: 0.9; - cursor: pointer; - pointer: hand; - } - &:active { - opacity: 0.75; - cursor: pointer; - pointer: hand; - } - - @media (max-width: 768px){ - border-radius: 37px; - flex: 1; - justify-content: flex-start; - } -` -const ToggleArrowImg = styled.div` - margin-left: auto; - filter: ${props => props.theme.faucetFilter}; - &:hover { - cursor: pointer; - } - .down { - transform: rotate(-180deg); - transition: transform 0.25s; - } - - .up { - transform: rotate(-360deg); - transition: transform 0.25s; - } -`; diff --git a/src/components/Faucets.tsx b/src/components/Faucets.tsx new file mode 100644 index 0000000000..d61bb36196 --- /dev/null +++ b/src/components/Faucets.tsx @@ -0,0 +1,203 @@ +// React + Web3 Essentials +import React, { useRef } from 'react'; + +// External Packages +import styled, { useTheme } from 'styled-components'; + +// Internal Components +import { useClickAway } from 'hooks/useClickAway'; +import { Image, Item } from '../primaries/SharedStyling'; +import Dropdown from './Dropdown'; + +type FaucetListType = { + id: string; + value: string; + title: string; + function: VoidFunction; + link: string; +}; + +// Faucet URLs +const Faucets = () => { + const theme = useTheme(); + const toggleArrowRef = useRef(null); + const dropdownRef = useRef(null); + + const [showDropdown, setShowDropdown] = React.useState(false); + + useClickAway(toggleArrowRef, dropdownRef, () => { + setShowDropdown(false); + }); + + const faucetList: FaucetListType[] = [ + { + id: '11155111', + value: 'Sepolia', + title: 'Sepolia Faucet', + function: () => {}, + link: 'https://sepoliafaucet.com/', + }, + { + id: '80002', + value: 'Polygon', + title: 'Amoy Faucet', + function: () => {}, + link: 'https://faucet.polygon.technology/', + }, + { + id: '97', + value: 'BNB', + title: 'BNB Faucet', + function: () => {}, + link: 'https://testnet.bnbchain.org/faucet-smart', + }, + { + id: '11155420', + value: 'Optimism', + title: 'Optimism Sepolia Faucet', + function: () => {}, + link: 'https://faucet.quicknode.com/optimism/sepolia', + }, + { + id: '2442', + value: 'Polygon zkEVM', + title: 'Polygon zkEVM Bridge', + function: () => {}, + link: 'https://faucet.polygon.technology/', + }, + { + id: '421614', + value: 'Arbitrum', + title: 'Arbitrum Testnet Faucet', + function: () => {}, + link: 'https://faucet.quicknode.com/arbitrum/sepolia', + }, + { + id: '123', + value: 'Fuse', + title: 'Fuse Sparknet Faucet', + function: () => {}, + link: 'https://chaindrop.org/?chainid=123&token=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', + }, + { + id: '111557560', + value: 'Cyber', + title: 'Cyber Faucet', + function: () => {}, + link: 'https://cyber-testnet.testnets.rollbridge.app/', + }, + ]; + + // render + return ( + + setShowDropdown(!showDropdown)} + ref={toggleArrowRef} + > + + faucet + + Testnet Faucets + + arrow + + + {showDropdown && ( + + + + )} + + ); +}; + +// Export Default +export default Faucets; + +// css styles +const Container = styled.button` + position: relative; + margin: 0; + padding: 0; + background: none; + border: 0; + outline: 0; + min-width: 230px; + + @media (max-width: 768px) { + width: 100%; + // padding: 0 0px 0px 0px; + } +`; + +const ItemHBar = styled.div` + padding: 0 20px 0 0px; +`; +const Faucet = styled.div` + margin: 0px 10px; + padding: 5px 15px; + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + font-weight: 400; + border: 1px solid ${(props) => props.theme.faucetBorder}; + font-size: 15px; + background: ${(props) => props.theme.faucetBg}; + color: ${(props) => props.theme.faucetText}; + border-radius: 20px; + &:hover { + opacity: 0.9; + cursor: pointer; + pointer: hand; + } + &:active { + opacity: 0.75; + cursor: pointer; + pointer: hand; + } + + @media (max-width: 768px) { + border-radius: 37px; + flex: 1; + justify-content: flex-start; + } +`; +const ToggleArrowImg = styled.div` + margin-left: auto; + filter: ${(props) => props.theme.faucetFilter}; + &:hover { + cursor: pointer; + } + .down { + transform: rotate(-180deg); + transition: transform 0.25s; + } + + .up { + transform: rotate(-360deg); + transition: transform 0.25s; + } +`; diff --git a/src/components/VerifyAlias.jsx b/src/components/VerifyAlias.tsx similarity index 61% rename from src/components/VerifyAlias.jsx rename to src/components/VerifyAlias.tsx index 58476b9ef3..787b827fb5 100644 --- a/src/components/VerifyAlias.jsx +++ b/src/components/VerifyAlias.tsx @@ -17,7 +17,16 @@ import { useAccount } from 'hooks'; // Internal Configs import { abis, appConfig, CHAIN_DETAILS } from 'config/index.js'; -import GLOBALS from "config/Globals"; +import GLOBALS from 'config/Globals'; + +type FaucetType = { + label: string; + url: string; +}; + +type FaucetsInfo = { + [key: number]: FaucetType; +}; const VerifyAlias = ({ aliasEthAccount, setAliasVerified }) => { const theme = useTheme(); @@ -31,32 +40,36 @@ const VerifyAlias = ({ aliasEthAccount, setAliasVerified }) => { const [success, setSuccess] = useState(false); const mainAddress = aliasEthAccount; - const Faucets = { + const Faucets: FaucetsInfo = { 80002: { - label: "Amoy MATIC", - url: "https://faucet.polygon.technology/" + label: 'Amoy MATIC', + url: 'https://faucet.polygon.technology/', }, 97: { - label: "Testnet BNB", - url: "https://testnet.bnbchain.org/faucet-smart" + label: 'Testnet BNB', + url: 'https://testnet.bnbchain.org/faucet-smart', }, 11155420: { - label: "Sepolia OpETH", - url: "https://faucet.quicknode.com/optimism/sepolia" + label: 'Sepolia OpETH', + url: 'https://faucet.quicknode.com/optimism/sepolia', }, 2442: { - label: "Polygon zkEVM ETH", - url: "https://faucet.polygon.technology/" + label: 'Polygon zkEVM ETH', + url: 'https://faucet.polygon.technology/', }, 421614: { - label: "Sepolia ArbETH", - url: "https://faucet.quicknode.com/arbitrum/sepolia" + label: 'Sepolia ArbETH', + url: 'https://faucet.quicknode.com/arbitrum/sepolia', }, 123: { - label: "Fuse SPARK", - url: "https://chaindrop.org/?chainid=123&token=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" - } - } + label: 'Fuse SPARK', + url: 'https://chaindrop.org/?chainid=123&token=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', + }, + 111557560: { + label: 'Cyber ETH', + url: 'https://cyber-testnet.testnets.rollbridge.app/', + }, + }; const checkAlias = async () => { if (mainAddress == aliasEthAccount) { @@ -65,7 +78,7 @@ const VerifyAlias = ({ aliasEthAccount, setAliasVerified }) => { }; const checkAliasVerification = async () => { - const { aliasVerified } = await getAliasDetails({account,chainId}).then(( data ) => { + const { aliasVerified } = await getAliasDetails({ account, chainId }).then((data) => { if (data) { dispatch(setAliasVerified(data.is_alias_verified)); return { aliasVerified: data['is_alias_verified'] }; @@ -112,7 +125,12 @@ const VerifyAlias = ({ aliasEthAccount, setAliasVerified }) => { }; return ( - + { color={theme.default.secondaryColor} > You will need{' '} - + {Faucets[chainId].label} {' '} to proceed. @@ -158,17 +179,51 @@ const VerifyAlias = ({ aliasEthAccount, setAliasVerified }) => { {!success && (loading ? ( - - + + - + {loading} ) : ( - - @@ -176,9 +231,24 @@ const VerifyAlias = ({ aliasEthAccount, setAliasVerified }) => { ))} {success && ( - - - + + + Verification Complete diff --git a/src/config/config-dev.js b/src/config/config-dev.js index 7a4c5a4098..2446a52d61 100644 --- a/src/config/config-dev.js +++ b/src/config/config-dev.js @@ -30,13 +30,14 @@ export const config = { 2442, // polygon zkevm cardona testnet 421614, // arbitrum testnet 123, // fuse testnet + 111557560, // Cyber testnet ], /** * Core Network Related Data */ coreContractChain: 11155111, //the chain id of the network which the core contract relies on - coreRPC: 'https://sepolia.infura.io/v3/5524d420b29f4f7a8d8d2f582a0d43f7', + coreRPC: 'https://ethereum-sepolia-rpc.publicnode.com', mainnetCoreRPC: 'https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a', mainnetCoreContractChain: 1, aliasRPC: { @@ -174,4 +175,11 @@ export const CHAIN_DETAILS = { rpcUrl: 'https://rpc.fusespark.io', commAddress: '0x7eBb54D86CF928115965DB596a3E600404dD8039', }, + 111557560: { + label: 'Cyber Testnet', + name: 'CYBER_TESTNET', + chainid: 111557560, + rpcUrl: 'https://cyber-testnet.alt.technology/', + commAddress: '0x9cb3bd7550B5c92baA056Fc0F08132f49508145F', + }, }; diff --git a/src/config/config-prod.js b/src/config/config-prod.js index 7d9e2cd0c9..aea4beaab2 100644 --- a/src/config/config-prod.js +++ b/src/config/config-prod.js @@ -29,6 +29,7 @@ export const config = { 42161, // arbitrum mainnet 1101, // polygon zkevm mainnet 122, // fuse mainnet + 7560, // Cyber mainnet ], /** @@ -166,4 +167,11 @@ export const CHAIN_DETAILS = { rpcUrl: 'https://rpc.fuse.io', commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', }, + 7560: { + label: 'Cyber Mainnet', + name: 'CYBER_MAINNET', + chainid: 7560, + rpcUrl: 'https://cyber.alt.technology/', + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + }, }; diff --git a/src/config/config-staging.js b/src/config/config-staging.js index af6d605119..54af695579 100644 --- a/src/config/config-staging.js +++ b/src/config/config-staging.js @@ -31,13 +31,14 @@ export const config = { 2442, // polygon zkevm cardona testnet 421614, // arbitrum testnet 123, // fuse testnet + 111557560, // Cyber testnet ], /** * Core Network Related Data */ coreContractChain: 11155111, //the chain id of the network which the core contract relies on - coreRPC: 'https://sepolia.infura.io/v3/49f638cc25a94ddb86b7aefd612f11ab', + coreRPC: 'https://ethereum-sepolia-rpc.publicnode.com', mainnetCoreRPC: 'https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a', mainnetCoreContractChain: 1, aliasRPC: { @@ -170,4 +171,11 @@ export const CHAIN_DETAILS = { rpcUrl: 'https://rpc.fusespark.io', commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', }, + 111557560: { + label: 'Cyber Testnet', + name: 'CYBER_TESTNET', + chainid: 111557560, + rpcUrl: 'https://cyber-testnet.alt.technology/', + commAddress: '0x6e489B7af21cEb969f49A90E481274966ce9D74d', + }, }; diff --git a/src/connectors/chains.ts b/src/connectors/chains.ts index 11fa81ba76..557a8b4136 100644 --- a/src/connectors/chains.ts +++ b/src/connectors/chains.ts @@ -124,6 +124,12 @@ export const MAINNET_CHAINS: ChainConfig = { nativeCurrency: FUSE, blockExplorerUrls: ['https://explorer.fuse.io/'], }, + 7560: { + name: 'Cyber Mainnet', + urls: ['https://cyber.alt.technology/'], + nativeCurrency: ETH, + blockExplorerUrls: ['https://cyberscan.co/'], + }, }; export const TESTNET_CHAINS: ChainConfig = { @@ -180,6 +186,12 @@ export const TESTNET_CHAINS: ChainConfig = { nativeCurrency: SPARK, blockExplorerUrls: ['https://explorer.fusespark.io/'], }, + 111557560: { + name: 'Cyber Testnet', + urls: ['https://cyber-testnet.alt.technology/'], + nativeCurrency: ETH, + blockExplorerUrls: ['https://testnet.cyberscan.co/'], + }, }; export const CHAINS: ChainConfig = { diff --git a/src/helpers/CaipHelper.ts b/src/helpers/CaipHelper.ts index 454bcea288..e2c9128ed6 100644 --- a/src/helpers/CaipHelper.ts +++ b/src/helpers/CaipHelper.ts @@ -2,7 +2,7 @@ import { appConfig } from '../config/index.js'; export const Eip155EnabledIds: Array = [ - 1, 56, 137, 10, 1101, 42161, 11155111, 97, 80002, 11155420, 2442, 421614, 122, 123, + 1, 56, 137, 10, 1101, 42161, 11155111, 97, 80002, 11155420, 2442, 421614, 122, 123, 111557560, 7560, ]; // Types diff --git a/src/helpers/UtilityHelper.ts b/src/helpers/UtilityHelper.ts index a495cd482e..7966e03c78 100644 --- a/src/helpers/UtilityHelper.ts +++ b/src/helpers/UtilityHelper.ts @@ -18,7 +18,8 @@ const UtilityHelper = { chainId === 1101 || chainId === 10 || chainId === 42161 || - chainId === 122 + chainId === 122 || + chainId === 7560 ) { return true; } @@ -59,6 +60,8 @@ export const MaskedAliasChannels: { 421614: {}, 122: {}, 123: {}, + 111557560: {}, + 7560: {}, }; export const findObject = (data: any, parentArray: any[], property: string): boolean => { @@ -121,6 +124,8 @@ export const networkName = { 421614: 'Arbitrum Testnet', 122: 'Fuse Mainnet', 123: 'Fuse Testnet', + 111557560: 'Cyber Testnet', + 7560: 'Cyber Mainnet', }; export const chainNameBackendStandard = { @@ -144,6 +149,8 @@ export const aliasChainIdToChainName = { 2442: 'POLYGONZKEVM', 122: 'FUSE', 123: 'FUSE', + 111557560: 'CYBERCONNECT', + 7560: 'CYBERCONNECT', }; export const aliasChainIdsMapping = { @@ -238,6 +245,20 @@ export const NETWORK_DETAILS = { rpcUrls: ['https://rpc.fuse.io'], blockExplorerUrls: [' https://explorer.fuse.io/'], }, + CYBER_TESTNET: { + chainId: utils.hexValue(111557560), + chainName: 'Cyber Testnet', + nativeCurrency: { name: 'ETH', symbol: 'ETH', decimals: 18 }, + rpcUrls: ['https://cyber-testnet.alt.technology/'], + blockExplorerUrls: [' https://testnet.cyberscan.co/'], + }, + CYBER_MAINNET: { + chainId: utils.hexValue(7560), + chainName: 'Cyber Mainnet', + nativeCurrency: { name: 'ETH', symbol: 'ETH', decimals: 18 }, + rpcUrls: ['https://cyber.alt.technology/'], + blockExplorerUrls: [' https://.cyberscan.co/'], + }, }; export const CORE_CHAIN_ID: number = appConfig.coreContractChain; @@ -260,6 +281,8 @@ export const LOGO_FROM_CHAIN_ID: { 11155111: 'Ethereum.svg', 122: 'Fuse.svg', 123: 'Fuse.svg', + 111557560: 'Cyber.svg', + 7560: 'Cyber.svg', }; export type getAliasResponseType = { diff --git a/yarn.lock b/yarn.lock index bb20dee867..b178ac839e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4150,9 +4150,9 @@ __metadata: languageName: node linkType: hard -"@pushprotocol/restapi@npm:1.7.17": - version: 1.7.17 - resolution: "@pushprotocol/restapi@npm:1.7.17" +"@pushprotocol/restapi@npm:1.7.18": + version: 1.7.18 + resolution: "@pushprotocol/restapi@npm:1.7.18" dependencies: "@metamask/eth-sig-util": ^5.0.2 axios: ^0.27.2 @@ -4175,7 +4175,7 @@ __metadata: peerDependenciesMeta: ethers: optional: true - checksum: 3e3601db6b3d5ea147ab903036ca6a57ac6615874d12c4ba400e414183385c0feff7c375a7e7ad92615efc22b991f133e6b22558936c6352d6353b7e9f944ed4 + checksum: 97a9be60c3407eef8e597b198c2d5afafe29ae9c082987d81cd12d43731f5013f6c5c462ae030d4b0d98a9fa81ead4ff9d8ba3c904fbbf03eff085e08f60fa80 languageName: node linkType: hard @@ -4191,9 +4191,9 @@ __metadata: languageName: node linkType: hard -"@pushprotocol/uiweb@npm:1.3.2": - version: 1.3.2 - resolution: "@pushprotocol/uiweb@npm:1.3.2" +"@pushprotocol/uiweb@npm:1.3.5": + version: 1.3.5 + resolution: "@pushprotocol/uiweb@npm:1.3.5" dependencies: "@livekit/components-react": ^1.2.2 "@livekit/components-styles": ^1.0.6 @@ -4234,7 +4234,7 @@ __metadata: react-dom: 17.0.2 styled-components: ^6.0.8 viem: ^1.3.0 - checksum: 10b2d1f0d1bee8204ea73557db6f8649d83b0f1a96c141ca6bfcb15995b08a66b8983e10990d010a7baf6c66364b58f44fb807408afe649d3e2418d8b9f2b77b + checksum: 2020c254cf27a724a309cfdb1552f96a848b2feb54dd1c93b6bac2dfffe04afba3e593bf45f8d3e0b42a0ee1cbbbe12e6c91f565f0b855a9d098e7d8feb93ffc languageName: node linkType: hard @@ -19252,9 +19252,9 @@ __metadata: "@mui/icons-material": ^5.8.4 "@mui/lab": ^5.0.0-alpha.72 "@mui/material": ^5.5.0 - "@pushprotocol/restapi": 1.7.17 + "@pushprotocol/restapi": 1.7.18 "@pushprotocol/socket": 0.5.3 - "@pushprotocol/uiweb": 1.3.2 + "@pushprotocol/uiweb": 1.3.5 "@reduxjs/toolkit": ^1.7.1 "@testing-library/dom": ^9.0.1 "@testing-library/jest-dom": ^4.2.4