From 4f1d065c65c59a258dc793bbe9c0cd82c46b4dd8 Mon Sep 17 00:00:00 2001 From: Nilesh Gupta Date: Wed, 27 Mar 2024 15:25:48 +0530 Subject: [PATCH 1/4] Enabled browser notif feature again --- src/App.tsx | 3 + src/api/index.js | 38 +++-- src/config/config-dev.js | 153 +++++++++--------- src/config/config-prod.js | 100 ++++++------ src/config/config-staging.js | 151 ++++++++--------- src/firebase.js | 42 +++-- src/helpers/CaipHelper.ts | 13 +- src/helpers/RoutesHelper.ts | 25 +-- src/hooks/useBrowserNotification.ts | 61 ++++--- src/services/deliveryNode/index.ts | 1 + .../deliveryNode/registerDeviceToken.ts | 26 +++ src/services/index.ts | 11 +- 12 files changed, 335 insertions(+), 289 deletions(-) create mode 100644 src/services/deliveryNode/index.ts create mode 100644 src/services/deliveryNode/registerDeviceToken.ts diff --git a/src/App.tsx b/src/App.tsx index 37e02c7b06..66c8aabb1e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -30,6 +30,7 @@ import AppLogin from './AppLogin'; import { SectionV2 } from './components/reusables/SharedStylingV2'; import { ErrorContext } from './contexts/ErrorContext'; import { setIndex, setRun, setWelcomeNotifsEmpty } from './redux/slices/userJourneySlice'; +import { useBrowserNotification } from 'hooks/useBrowserNotification'; // Internal Configs import { appConfig } from 'config'; @@ -145,6 +146,8 @@ export default function App() { setcurrentTime(now); }, []); + useBrowserNotification(); + useEffect(() => { if (!account) return; dispatch(resetSpamSlice()); diff --git a/src/api/index.js b/src/api/index.js index 6d911e1092..99c3c1f361 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1,12 +1,13 @@ // External Packages -import axios from "axios"; +import axios from 'axios'; // Internal Configs -import { appConfig } from "config"; +import { appConfig } from 'config'; // Constants -const BASE_URL = appConfig.apiUrl -const TOOLING_BASE_URL = appConfig.toolingApiUrl +const BASE_URL = appConfig.apiUrl; +const TOOLING_BASE_URL = appConfig.toolingApiUrl; +const DELIVERY_NODE_BASE_URL = appConfig.deliveryNodeApiUrl; /** * A function used to make get requests throughout the entire application @@ -14,13 +15,13 @@ const TOOLING_BASE_URL = appConfig.toolingApiUrl * @returns {Promise} */ export const getReq = async (path) => { - try { - const response = await axios.get(BASE_URL + path); - return response; - } catch (error) { - throw error; - } - }; + try { + const response = await axios.get(BASE_URL + path); + return response; + } catch (error) { + throw error; + } +}; /** * A function used to make post requests to the backend @@ -55,5 +56,18 @@ export const toolingPostReq = async (path, obj) => { } }; -export * from './ipfs'; +export const deliveryNodePostReq = async (path, obj) => { + try { + const response = await axios.post(DELIVERY_NODE_BASE_URL + path, obj, { + headers: { + 'Content-Type': 'application/json', + }, + }); + return response; + } catch (error) { + console.error(error.response.data); + throw error.response.data; + } +}; +export * from './ipfs'; diff --git a/src/config/config-dev.js b/src/config/config-dev.js index b7be278a0b..898b1f0be0 100644 --- a/src/config/config-dev.js +++ b/src/config/config-dev.js @@ -1,11 +1,11 @@ // environmental configurations for the dapp for different environments export const config = { - /** + /** * Push Nodes Environment - can be dev, staging or prod - important to keep one on one connection */ pushNodesEnv: 'dev', - - /** + + /** * API Calls Related */ appEnv: 'dev', @@ -14,11 +14,12 @@ export const config = { apiUrl: 'https://backend-dev.epns.io/apis', w2wApiUrl: 'https://backend-dev.epns.io/apis', toolingApiUrl: 'https://tooling.epns.io/apis', + deliveryNodeApiUrl: 'https://delivery-dev.epns.io/apis', ipfsInfuraAPIKey: process.env.REACT_APP_IPFS_INFURA_API_KEY || '22rfiNb1J645FdehoqbKMpLbF6V', ipfsInfuraAPISecret: process.env.REACT_APP_IPFS_INFURA_API_SECRET || 'a757597f020425c3ae532e6be84de552', - /** + /** * Allowed Networks */ allowedNetworks: [ @@ -29,26 +30,26 @@ export const config = { 420, // optimism goerli testnet 1442, // polygon zkevm testnet 421613, // arbitrum testnet - 123 // fuse testnet + 123, // fuse 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', - mainnetCoreRPC: "https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a", + coreRPC: 'https://sepolia.infura.io/v3/fffaf09bf68e4c4e8f8c5dcfc9383295', + mainnetCoreRPC: 'https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a', mainnetCoreContractChain: 1, aliasRPC: { - 80001: "https://polygon-mumbai.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9", - 97: "https://data-seed-prebsc-1-s1.binance.org:8545", - 420: "https://opt-goerli.g.alchemy.com/v2/98vFj7OCg4vbGKvCDpj6pOAMSBVC7rzm", - 1442: "https://rpc.public.zkevm-test.net", - 421613: "https://goerli-rollup.arbitrum.io/rpc" + 80001: 'https://polygon-mumbai.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9', + 97: 'https://data-seed-prebsc-1-s1.binance.org:8545', + 420: 'https://opt-goerli.g.alchemy.com/v2/98vFj7OCg4vbGKvCDpj6pOAMSBVC7rzm', + 1442: 'https://rpc.public.zkevm-test.net', + 421613: 'https://goerli-rollup.arbitrum.io/rpc', }, infuraApiUrl: 'https:/infura-ipfs.io/ipfs/', - /** + /** * Analaytics + Firebase */ googleAnalyticsId: 'UA-165415629-5', @@ -64,7 +65,7 @@ export const config = { measurementId: 'G-ZJH2T7R9S1', }, - /** + /** * External links */ links: { @@ -73,109 +74,105 @@ export const config = { extension: 'https://chrome.google.com/webstore/detail/epns-staging-protocol-alp/bjiennpmhdcandkpigcploafccldlakj', howto: 'https://push.org/docs', }, -} +}; /** * Smart Contract Related */ export const addresses = { - ceaErc20: "0xc1C0472c0C80bCcDC7F5D01A376Bd97a734B8815", - epnscore: "0x5AB1520E2bd519BDab2e1347EEe81C00a77f4946", - epnsEthComm: "0x9dDCD7ed7151afab43044E4D694FA064742C428c", - epnsPolyComm: "0xAf55BE8e6b0d6107891bA76eADeEa032ef8A4504", // the ploygon comm contract - pushToken: "0x37c779a1564DCc0e3914aB130e0e787d93e21804", //address for push token - pushChannelAdmin: "0xfA47d7EaEC85eE8db2cBFF7d18AC407d1A556Dc2", - aDai: "0x31f30d9A5627eAfeC4433Ae2886Cf6cc3D25E772", - epnsToken: "0x37c779a1564DCc0e3914aB130e0e787d93e21804", - epnsLPToken: "0x1f094Bd8c260D0C3fC79157096015990885af4d2", - rockstar: "0x3f8C2152b79276b78315CAF66cCF951780580A8a", - batchMintNFT: "0xCf733D547B9f7F87c1B1f63f45c197C007F8eedf", - NFTRewards: "0xc4708BB6EC3B797344f123126171302e4e3E68E2", - distributor: "0x5B548D33874DeABaC2F683A6E1864795E09932F0", - rockstarV2: "0xA2b885e7065EA59a3251489715ca80DE5Ff642f8", //mainnet address - NFTRewardsV2: "0xdc66567a990B7fa10730459537620857c9e03287", //mainnet address + ceaErc20: '0xc1C0472c0C80bCcDC7F5D01A376Bd97a734B8815', + epnscore: '0x5AB1520E2bd519BDab2e1347EEe81C00a77f4946', + epnsEthComm: '0x9dDCD7ed7151afab43044E4D694FA064742C428c', + epnsPolyComm: '0xAf55BE8e6b0d6107891bA76eADeEa032ef8A4504', // the ploygon comm contract + pushToken: '0x37c779a1564DCc0e3914aB130e0e787d93e21804', //address for push token + pushChannelAdmin: '0xfA47d7EaEC85eE8db2cBFF7d18AC407d1A556Dc2', + aDai: '0x31f30d9A5627eAfeC4433Ae2886Cf6cc3D25E772', + epnsToken: '0x37c779a1564DCc0e3914aB130e0e787d93e21804', + epnsLPToken: '0x1f094Bd8c260D0C3fC79157096015990885af4d2', + rockstar: '0x3f8C2152b79276b78315CAF66cCF951780580A8a', + batchMintNFT: '0xCf733D547B9f7F87c1B1f63f45c197C007F8eedf', + NFTRewards: '0xc4708BB6EC3B797344f123126171302e4e3E68E2', + distributor: '0x5B548D33874DeABaC2F683A6E1864795E09932F0', + rockstarV2: '0xA2b885e7065EA59a3251489715ca80DE5Ff642f8', //mainnet address + NFTRewardsV2: '0xdc66567a990B7fa10730459537620857c9e03287', //mainnet address //For Yield Farm V1(Deprecated) - staking: "0xAECb9074e222e8F06f8034140A3F86610E4d3c3E", // deprecated staking addresses - depYieldFarmPUSH: "0x6EA019f7FE2640A55154DdC36Bfd21275De388BD", // deprecated YieldFarm Push address - depYieldFarmLP:"0xc2886D0e7DAd16cc92b1156Dc9A0b0D3F047FD15", + staking: '0xAECb9074e222e8F06f8034140A3F86610E4d3c3E', // deprecated staking addresses + depYieldFarmPUSH: '0x6EA019f7FE2640A55154DdC36Bfd21275De388BD', // deprecated YieldFarm Push address + depYieldFarmLP: '0xc2886D0e7DAd16cc92b1156Dc9A0b0D3F047FD15', - pushToken: "0x37c779a1564DCc0e3914aB130e0e787d93e21804", + pushToken: '0x37c779a1564DCc0e3914aB130e0e787d93e21804', // For Sepolia - pushToken: "0x37c779a1564DCc0e3914aB130e0e787d93e21804", + pushToken: '0x37c779a1564DCc0e3914aB130e0e787d93e21804', // pushCoreV2: "0x8a965286c0752DFE821868312025091f60BD902A", // 15 min epoch - pushCoreV2: "0x5AB1520E2bd519BDab2e1347EEe81C00a77f4946", //21 days epoch - uniV2LPToken: "0x2333609Cc527a9309Cdad16E0742a3C6DC1C551b", - uniswapV2Router02: "0xC532a74256D3Db42D0Bf7a0400fEFDbad7694008", - WETHAddress: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9", - USDTAddress: "0x7169D38820dfd117C3FA1f22a697dBA58d90BA06", + pushCoreV2: '0x5AB1520E2bd519BDab2e1347EEe81C00a77f4946', //21 days epoch + uniV2LPToken: '0x2333609Cc527a9309Cdad16E0742a3C6DC1C551b', + uniswapV2Router02: '0xC532a74256D3Db42D0Bf7a0400fEFDbad7694008', + WETHAddress: '0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9', + USDTAddress: '0x7169D38820dfd117C3FA1f22a697dBA58d90BA06', //For 30 mins epoch // stakingV2: "0xCa02F3FdF3794aF08CADb98b0E4504261cB8c302", // yieldFarmLP: "0x22C1dBC8975c23De9e2219C0fC3E03b404577512", //For 21 days Epoch - stakingV2: "0xFf13FBc1dE7FBF300059FE56495c82bBa2F986c6", - yieldFarmLP: "0xAB531bD9D39c492a05de65Eee85F6C712c05ea0b", - - - - alphaAccessNft: "0x39f77Db4d5d3e85c213233D5Af02C46a85Cf1Db4" + stakingV2: '0xFf13FBc1dE7FBF300059FE56495c82bBa2F986c6', + yieldFarmLP: '0xAB531bD9D39c492a05de65Eee85F6C712c05ea0b', - -} + alphaAccessNft: '0x39f77Db4d5d3e85c213233D5Af02C46a85Cf1Db4', +}; export const CHAIN_DETAILS = { 11155111: { - label: "Ethereum Sepolia", - name: "ETH_TEST_SEPOLIA", + label: 'Ethereum Sepolia', + name: 'ETH_TEST_SEPOLIA', chainId: 11155111, - rpcUrl: "https://sepolia.infura.io/v3/5524d420b29f4f7a8d8d2f582a0d43f7", - commAddress: "0x28709649Dfda9baDEbb61dBF7a8D199cfC8EcF2e", - network: "sepolia", - }, + rpcUrl: 'https://sepolia.infura.io/v3/5524d420b29f4f7a8d8d2f582a0d43f7', + commAddress: '0x28709649Dfda9baDEbb61dBF7a8D199cfC8EcF2e', + network: 'sepolia', + }, 80001: { - label: "Polygon Mumbai", - name: "POLYGON_TEST_MUMBAI", + label: 'Polygon Mumbai', + name: 'POLYGON_TEST_MUMBAI', chainId: 80001, - rpcUrl: "https://polygon-mumbai.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9", - commAddress: "0xAf55BE8e6b0d6107891bA76eADeEa032ef8A4504", - network: "polygon-mumbai", + rpcUrl: 'https://polygon-mumbai.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9', + commAddress: '0xAf55BE8e6b0d6107891bA76eADeEa032ef8A4504', + network: 'polygon-mumbai', }, 97: { - label: "BNB Testnet", - name: "BNB_TESTNET", + label: 'BNB Testnet', + name: 'BNB_TESTNET', chainId: 97, - rpcUrl: "https://data-seed-prebsc-1-s1.binance.org:8545", - commAddress: "0x4132061E3349ff36cFfCadA460E10Bd4f31F7ea8" + rpcUrl: 'https://data-seed-prebsc-1-s1.binance.org:8545', + commAddress: '0x4132061E3349ff36cFfCadA460E10Bd4f31F7ea8', }, 420: { - label: "Optimism Goerli", - name: "OPTIMISM_TESTNET", + label: 'Optimism Goerli', + name: 'OPTIMISM_TESTNET', chainId: 420, rpcUrl: 'https://opt-goerli.g.alchemy.com/v2/98vFj7OCg4vbGKvCDpj6pOAMSBVC7rzm', - commAddress: '0x4305D572F2bf38Fc2AE8D0172055b1EFd18F57a6' + commAddress: '0x4305D572F2bf38Fc2AE8D0172055b1EFd18F57a6', }, 1442: { - label: "Polygon zkEVM Testnet", - name: "POLYGON_ZK_EVM_TESTNET", + label: 'Polygon zkEVM Testnet', + name: 'POLYGON_ZK_EVM_TESTNET', chainId: 1442, rpcUrl: 'https://rpc.public.zkevm-test.net', - commAddress: '0x630b152e4185c63D7177c656b56b26f878C61572' + commAddress: '0x630b152e4185c63D7177c656b56b26f878C61572', }, 421613: { - label: "Arbitrum Testnet", - name: "ARBITRUM_TESTNET", + label: 'Arbitrum Testnet', + name: 'ARBITRUM_TESTNET', chainId: 421613, rpcUrl: '', - commAddress: '0x2f6aE0907116A2c50D712e78b48D874fadeB6850' + commAddress: '0x2f6aE0907116A2c50D712e78b48D874fadeB6850', }, 123: { - label: "Fuse Testnet", - name: "FUSE_TESTNET", + label: 'Fuse Testnet', + name: 'FUSE_TESTNET', chainId: 123, rpcUrl: 'https://rpc.fusespark.io', - commAddress: '0x7eBb54D86CF928115965DB596a3E600404dD8039' - } -} \ No newline at end of file + commAddress: '0x7eBb54D86CF928115965DB596a3E600404dD8039', + }, +}; diff --git a/src/config/config-prod.js b/src/config/config-prod.js index 7f3e885b32..caf8031f1d 100644 --- a/src/config/config-prod.js +++ b/src/config/config-prod.js @@ -14,6 +14,7 @@ export const config = { apiUrl: 'https://backend.epns.io/apis', w2wApiUrl: 'https://backend.epns.io/apis', toolingApiUrl: 'https://tooling.epns.io/apis', + deliveryNodeApiUrl: 'https://delivery-prod.epns.io/apis', ipfsInfuraAPIKey: process.env.REACT_APP_IPFS_INFURA_API_KEY || '22rfiNb1J645FdehoqbKMpLbF6V', ipfsInfuraAPISecret: process.env.REACT_APP_IPFS_INFURA_API_SECRET || 'a757597f020425c3ae532e6be84de552', @@ -39,10 +40,10 @@ export const config = { mainnetCoreRPC: 'https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a', mainnetCoreContractChain: 1, aliasRPC: { - 137: "https://polygon-mainnet.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9", - 56: "https://bsc-dataseed.binance.org/", - 10: "https://opt-mainnet.g.alchemy.com/v2/JYW0UaSC5Zd0hrI6vE2K9VN1wJupoY5B", - 42161: "https://arb1.arbitrum.io/rpc", + 137: 'https://polygon-mainnet.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9', + 56: 'https://bsc-dataseed.binance.org/', + 10: 'https://opt-mainnet.g.alchemy.com/v2/JYW0UaSC5Zd0hrI6vE2K9VN1wJupoY5B', + 42161: 'https://arb1.arbitrum.io/rpc', 1101: 'https://rpc.polygon-zkevm.gateway.fm', }, infuraApiUrl: 'https:/infura-ipfs.io/ipfs/', @@ -53,14 +54,14 @@ export const config = { googleAnalyticsId: 'UA-165415629-1', vapidKey: 'BFRmmAEEXOhk31FIsooph5CxlXKh6N0_NocUWHzvtpoUEvqQTwLXu6XtwkrH7ckyr2CvVz1ll-8q4oo6-ZqFJPY', firebaseConfig: { - apiKey: 'AIzaSyClOk4qP0ttFW-BPnXy7WT920xfdXSbFu8', - authDomain: 'epns-internal.firebaseapp.com', - databaseURL: 'https://epns-internal.firebaseio.com', - projectId: 'epns-internal', - storageBucket: 'epns-internal.appspot.com', - messagingSenderId: '755180533582', - appId: '1:755180533582:web:752ff8db31905506b7d01f', - measurementId: 'G-ZJH2T7R9S1', + apiKey: 'AIzaSyBrzkFPyNmVDFzGY7dKz2HocUO4m-ni-Fc', + authDomain: 'epns-ethereum-push-service.firebaseapp.com', + databaseURL: 'https://epns-ethereum-push-service.firebaseio.com', + projectId: 'epns-ethereum-push-service', + storageBucket: 'epns-ethereum-push-service.appspot.com', + messagingSenderId: '915758146133', + appId: '1:915758146133:web:2de388356233f5c22f2adc', + measurementId: 'G-X1L5P2E4EP', }, /** @@ -83,7 +84,7 @@ export const addresses = { epnsEthComm: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', // mainnet address eth comm epnsPolyComm: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', // mainnet address polygon comm pushToken: '0xf418588522d5dd018b425E472991E52EBBeEEEEE', // mainnet address - pushChannelAdmin: "0x65193c896eC400f731712D4f71046CeDd11Bff27", // mainnet push core admin + pushChannelAdmin: '0x65193c896eC400f731712D4f71046CeDd11Bff27', // mainnet push core admin aDai: '0xcB1Fe6F440c49E9290c3eb7f158534c2dC374201', // mainnet address staking: '0xB72ff1e675117beDefF05a7D0a472c3844cfec85', // mainnet address yieldFarmPUSH: '0x6019B84E2eE9EB62BC42E32AB6375A7095886366', // mainnet address @@ -101,70 +102,69 @@ export const addresses = { NFTRewardsV2: '0xdc66567a990B7fa10730459537620857c9e03287', //mainnet address //For Yield Farm V1(Deprecated) - staking: "0xB72ff1e675117beDefF05a7D0a472c3844cfec85", // deprecated staking mainnet addresses - depYieldFarmPUSH: "0x6019B84E2eE9EB62BC42E32AB6375A7095886366", // deprecated YieldFarmPUSH mainnet address - depYieldFarmLP:"0xbB2A70e67770D0A7F5f42d883C5BBE9b85e0DcD6",// deprecated YieldFarmLP mainnet addresses + staking: '0xB72ff1e675117beDefF05a7D0a472c3844cfec85', // deprecated staking mainnet addresses + depYieldFarmPUSH: '0x6019B84E2eE9EB62BC42E32AB6375A7095886366', // deprecated YieldFarmPUSH mainnet address + depYieldFarmLP: '0xbB2A70e67770D0A7F5f42d883C5BBE9b85e0DcD6', // deprecated YieldFarmLP mainnet addresses //For Yield Farm V2 - stakingV2:"0x9D2513F5b539DC774C66b28ACEc94e4bD00105C2",//mainnet address - yieldFarmLP: "0x9af118D9fA1eFEa5b5a792847554960217DEdb04",//mainnet address - uniV2LPToken: "0xaf31fd9c3b0350424bf96e551d2d1264d8466205",//same as epnsLPToken - pushCoreV2: "0x66329Fdd4042928BfCAB60b179e1538D56eeeeeE",//not upgraded - - alphaAccessNft: "0x87d34d40EFaF2d594A7eD9B1126F15Cb3fc721ef" + stakingV2: '0x9D2513F5b539DC774C66b28ACEc94e4bD00105C2', //mainnet address + yieldFarmLP: '0x9af118D9fA1eFEa5b5a792847554960217DEdb04', //mainnet address + uniV2LPToken: '0xaf31fd9c3b0350424bf96e551d2d1264d8466205', //same as epnsLPToken + pushCoreV2: '0x66329Fdd4042928BfCAB60b179e1538D56eeeeeE', //not upgraded + alphaAccessNft: '0x87d34d40EFaF2d594A7eD9B1126F15Cb3fc721ef', }; export const CHAIN_DETAILS = { 1: { - label: "Ethereum Mainnet", - name: "ETH_MAINNET", + label: 'Ethereum Mainnet', + name: 'ETH_MAINNET', chainId: 1, - rpcUrl: "https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a", - commAddress: "0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa", - network: "mainnet", - }, + rpcUrl: 'https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a', + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + network: 'mainnet', + }, 137: { - label: "Polygon Mainnet", - name: "POLYGON_MAINNET", + label: 'Polygon Mainnet', + name: 'POLYGON_MAINNET', chainId: 137, - rpcUrl: "https://polygon-mainnet.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9", - commAddress: "0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa", - network: "polygon-mainnet", + rpcUrl: 'https://polygon-mainnet.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9', + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + network: 'polygon-mainnet', }, 56: { - label: "BNB Mainnet", - name: "BNB_MAINNET", + label: 'BNB Mainnet', + name: 'BNB_MAINNET', chainId: 56, - rpcUrl: "https://bsc-dataseed.binance.org/", - commAddress: "0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa" + rpcUrl: 'https://bsc-dataseed.binance.org/', + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', }, 10: { - label: "Optimism Mainnet", - name: "OPTIMISM_MAINNET", + label: 'Optimism Mainnet', + name: 'OPTIMISM_MAINNET', chainId: 10, rpcUrl: 'https://opt-mainnet.g.alchemy.com/v2/JYW0UaSC5Zd0hrI6vE2K9VN1wJupoY5B', - commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa' + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', }, 1101: { - label: "Polygon zkEVM Mainnet", - name: "POLYGON_ZK_EVM_MAINNET", + label: 'Polygon zkEVM Mainnet', + name: 'POLYGON_ZK_EVM_MAINNET', chainId: 1101, rpcUrl: 'https://rpc.polygon-zkevm.gateway.fm', - commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa' + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', }, 42161: { - label: "Arbitrum Mainnet", - name: "ARBITRUMONE_MAINNET", + label: 'Arbitrum Mainnet', + name: 'ARBITRUMONE_MAINNET', chainId: 42161, rpcUrl: 'https://arb1.arbitrum.io/rpc', - commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa' + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', }, 122: { - label: "Fuse Mainnet", - name: "FUSE_MAINNET", + label: 'Fuse Mainnet', + name: 'FUSE_MAINNET', chainId: 122, rpcUrl: 'https://rpc.fuse.io', - commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa' + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', }, -} \ No newline at end of file +}; diff --git a/src/config/config-staging.js b/src/config/config-staging.js index d9b3f57b60..09bda73c34 100644 --- a/src/config/config-staging.js +++ b/src/config/config-staging.js @@ -1,24 +1,25 @@ // environmental configurations for the dapp for different environments export const config = { - /** + /** * Push Nodes Environment - can be dev, staging or prod - important to keep one on one connection */ pushNodesEnv: 'staging', - - /** + + /** * API Calls Related */ appEnv: 'staging', // helps in deciding some text, links, etc, DO NOT CHANGE - + pushNodeApiVersion: 1, apiUrl: 'https://backend-staging.epns.io/apis', w2wApiUrl: 'https://backend-staging.epns.io/apis', toolingApiUrl: 'https://staging-tooling.epns.io/apis', + deliveryNodeApiUrl: 'https://delivery-staging.epns.io/apis', ipfsInfuraAPIKey: process.env.REACT_APP_IPFS_INFURA_API_KEY || '22rfiNb1J645FdehoqbKMpLbF6V', ipfsInfuraAPISecret: process.env.REACT_APP_IPFS_INFURA_API_SECRET || 'a757597f020425c3ae532e6be84de552', - /** + /** * Allowed Networks */ allowedNetworks: [ @@ -30,26 +31,26 @@ export const config = { 420, // optimism goerli testnet 1442, // polygon zkevm testnet 421613, // arbitrum testnet - 123 // fuse testnet + 123, // fuse 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', - mainnetCoreRPC: "https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a", + coreRPC: 'https://sepolia.infura.io/v3/5524d420b29f4f7a8d8d2f582a0d43f7', + mainnetCoreRPC: 'https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a', mainnetCoreContractChain: 1, aliasRPC: { - 80001: "https://polygon-mumbai.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9", - 97: "https://data-seed-prebsc-1-s1.binance.org:8545", - 420: "https://opt-goerli.g.alchemy.com/v2/98vFj7OCg4vbGKvCDpj6pOAMSBVC7rzm", - 1442: "https://rpc.public.zkevm-test.net", - 421613: "https://goerli-rollup.arbitrum.io/rpc" + 80001: 'https://polygon-mumbai.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9', + 97: 'https://data-seed-prebsc-1-s1.binance.org:8545', + 420: 'https://opt-goerli.g.alchemy.com/v2/98vFj7OCg4vbGKvCDpj6pOAMSBVC7rzm', + 1442: 'https://rpc.public.zkevm-test.net', + 421613: 'https://goerli-rollup.arbitrum.io/rpc', }, infuraApiUrl: 'https:/infura-ipfs.io/ipfs/', - /** + /** * Analaytics + Firebase */ googleAnalyticsId: 'UA-165415629-5', @@ -65,7 +66,7 @@ export const config = { measurementId: 'G-ZJH2T7R9S1', }, - /** + /** * External links */ links: { @@ -74,100 +75,100 @@ export const config = { extension: 'https://chrome.google.com/webstore/detail/epns-staging-protocol-alp/bjiennpmhdcandkpigcploafccldlakj', howto: 'https://push.org/docs', }, -} +}; /** * Smart Contract Related */ export const addresses = { - ceaErc20: "0xc1C0472c0C80bCcDC7F5D01A376Bd97a734B8815", - epnscore: "0x9d65129223451fbd58fc299c635cd919baf2564c", - epnsEthComm: "0x0c34d54a09cfe75bccd878a469206ae77e0fe6e7", // the core contract - epnsPolyComm: "0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa", // the ploygon comm contract - pushToken: "0x37c779a1564DCc0e3914aB130e0e787d93e21804", //address for push token - aDai: "0x31f30d9A5627eAfeC4433Ae2886Cf6cc3D25E772", - pushChannelAdmin: "0x0c97B7B7D14FBBfe726bF85c992db02E8E7D0fC6", + ceaErc20: '0xc1C0472c0C80bCcDC7F5D01A376Bd97a734B8815', + epnscore: '0x9d65129223451fbd58fc299c635cd919baf2564c', + epnsEthComm: '0x0c34d54a09cfe75bccd878a469206ae77e0fe6e7', // the core contract + epnsPolyComm: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', // the ploygon comm contract + pushToken: '0x37c779a1564DCc0e3914aB130e0e787d93e21804', //address for push token + aDai: '0x31f30d9A5627eAfeC4433Ae2886Cf6cc3D25E772', + pushChannelAdmin: '0x0c97B7B7D14FBBfe726bF85c992db02E8E7D0fC6', // staking: "0xAECb9074e222e8F06f8034140A3F86610E4d3c3E", // deprecated staking addresses // yieldFarmPUSH: "0xb41cd6760d3b1d0d216851f63fda9573b04dd46e", // yieldFarmLP: "0x604f629A6b5E85805D57f39493BBC2856cE8A540", - epnsToken: "0x37c779a1564DCc0e3914aB130e0e787d93e21804", - epnsLPToken: "0x1f094Bd8c260D0C3fC79157096015990885af4d2", - uniV2LPToken:"0x698839247E5b83572fFF6ccdcf386CC37e60bEf5",// for new staking V2 Contract on staging - rockstar: "0x3f8C2152b79276b78315CAF66cCF951780580A8a", - batchMintNFT: "0xCf733D547B9f7F87c1B1f63f45c197C007F8eedf", - NFTRewards: "0xc4708BB6EC3B797344f123126171302e4e3E68E2", - distributor: "0x5B548D33874DeABaC2F683A6E1864795E09932F0", - uniswapV2Router02: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D", - WETHAddress: "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6", - USDTAddress: "0x11fe4b6ae13d2a6055c8d9cf65c55bac32b5d844", - rockstarV2:"0xA2b885e7065EA59a3251489715ca80DE5Ff642f8",//mainnet address - NFTRewardsV2: "0xdc66567a990B7fa10730459537620857c9e03287", //mainnet address + epnsToken: '0x37c779a1564DCc0e3914aB130e0e787d93e21804', + epnsLPToken: '0x1f094Bd8c260D0C3fC79157096015990885af4d2', + uniV2LPToken: '0x698839247E5b83572fFF6ccdcf386CC37e60bEf5', // for new staking V2 Contract on staging + rockstar: '0x3f8C2152b79276b78315CAF66cCF951780580A8a', + batchMintNFT: '0xCf733D547B9f7F87c1B1f63f45c197C007F8eedf', + NFTRewards: '0xc4708BB6EC3B797344f123126171302e4e3E68E2', + distributor: '0x5B548D33874DeABaC2F683A6E1864795E09932F0', + uniswapV2Router02: '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', + WETHAddress: '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', + USDTAddress: '0x11fe4b6ae13d2a6055c8d9cf65c55bac32b5d844', + rockstarV2: '0xA2b885e7065EA59a3251489715ca80DE5Ff642f8', //mainnet address + NFTRewardsV2: '0xdc66567a990B7fa10730459537620857c9e03287', //mainnet address //For Yield Farm v1(deprecated) - staking: "0xAECb9074e222e8F06f8034140A3F86610E4d3c3E", // deprecated staking addresses - depYieldFarmPUSH: "0x6EA019f7FE2640A55154DdC36Bfd21275De388BD", // deprecated YieldFarm Push address - depYieldFarmLP:"0xc2886D0e7DAd16cc92b1156Dc9A0b0D3F047FD15", // deprecated YieldFarm LP address + staking: '0xAECb9074e222e8F06f8034140A3F86610E4d3c3E', // deprecated staking addresses + depYieldFarmPUSH: '0x6EA019f7FE2640A55154DdC36Bfd21275De388BD', // deprecated YieldFarm Push address + depYieldFarmLP: '0xc2886D0e7DAd16cc92b1156Dc9A0b0D3F047FD15', // deprecated YieldFarm LP address //For Yield Farm V2 - stakingV2:"0xA99dE35dce05f59fF87ae393a7576B8Ce5881416", - yieldFarmLP: "0xeE543C5bC1b6EB647CfC23fe95D3C5877945Ad21", - pushCoreV2: "0x9d65129223451fbd58fc299c635cd919baf2564c",//not upgraded - uniV2LPToken: "0x698839247E5b83572fFF6ccdcf386CC37e60bEf5", - pushToken: "0x37c779a1564DCc0e3914aB130e0e787d93e21804", + stakingV2: '0xA99dE35dce05f59fF87ae393a7576B8Ce5881416', + yieldFarmLP: '0xeE543C5bC1b6EB647CfC23fe95D3C5877945Ad21', + pushCoreV2: '0x9d65129223451fbd58fc299c635cd919baf2564c', //not upgraded + uniV2LPToken: '0x698839247E5b83572fFF6ccdcf386CC37e60bEf5', + pushToken: '0x37c779a1564DCc0e3914aB130e0e787d93e21804', - alphaAccessNft: "0x39f77Db4d5d3e85c213233D5Af02C46a85Cf1Db4" -} + alphaAccessNft: '0x39f77Db4d5d3e85c213233D5Af02C46a85Cf1Db4', +}; export const CHAIN_DETAILS = { 11155111: { - label: "Ethereum Sepolia", - name: "ETH_TEST_SEPOLIA", + label: 'Ethereum Sepolia', + name: 'ETH_TEST_SEPOLIA', chainId: 11155111, - rpcUrl: "https://sepolia.infura.io/v3/5524d420b29f4f7a8d8d2f582a0d43f7", - commAddress: "0x0c34d54a09cfe75bccd878a469206ae77e0fe6e7", - network: "sepolia", - }, + rpcUrl: 'https://sepolia.infura.io/v3/5524d420b29f4f7a8d8d2f582a0d43f7', + commAddress: '0x0c34d54a09cfe75bccd878a469206ae77e0fe6e7', + network: 'sepolia', + }, 80001: { - label: "Polygon Mumbai", - name: "POLYGON_TEST_MUMBAI", + label: 'Polygon Mumbai', + name: 'POLYGON_TEST_MUMBAI', chainId: 80001, - rpcUrl: "https://polygon-mumbai.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9", - commAddress: "0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa", - network: "polygon-mumbai", + rpcUrl: 'https://polygon-mumbai.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9', + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + network: 'polygon-mumbai', }, 97: { - label: "BNB Testnet", - name: "BNB_TESTNET", + label: 'BNB Testnet', + name: 'BNB_TESTNET', chainId: 97, - rpcUrl: "https://data-seed-prebsc-1-s1.binance.org:8545", - commAddress: "0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa" + rpcUrl: 'https://data-seed-prebsc-1-s1.binance.org:8545', + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', }, 420: { - label: "Optimism Goerli", - name: "OPTIMISM_TESTNET", + label: 'Optimism Goerli', + name: 'OPTIMISM_TESTNET', chainId: 420, rpcUrl: 'https://opt-goerli.g.alchemy.com/v2/98vFj7OCg4vbGKvCDpj6pOAMSBVC7rzm', - commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa' + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', }, 1442: { - label: "Polygon zkEVM Testnet", - name: "POLYGON_ZK_EVM_TESTNET", + label: 'Polygon zkEVM Testnet', + name: 'POLYGON_ZK_EVM_TESTNET', chainId: 1442, rpcUrl: 'https://rpc.public.zkevm-test.net', - commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa' + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', }, 421613: { - label: "Arbitrum Testnet", - name: "ARBITRUM_TESTNET", + label: 'Arbitrum Testnet', + name: 'ARBITRUM_TESTNET', chainId: 421613, rpcUrl: '', - commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa' + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', }, 123: { - label: "Fuse Testnet", - name: "FUSE_TESTNET", + label: 'Fuse Testnet', + name: 'FUSE_TESTNET', chainId: 123, rpcUrl: 'https://rpc.fusespark.io', - commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa' - } -} \ No newline at end of file + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + }, +}; diff --git a/src/firebase.js b/src/firebase.js index 67f350de4b..3beb51405e 100644 --- a/src/firebase.js +++ b/src/firebase.js @@ -1,17 +1,17 @@ // External Packages -import { initializeApp } from "@firebase/app"; -import { getMessaging, getToken, onMessage } from "@firebase/messaging"; +import { initializeApp } from '@firebase/app'; +import { getMessaging, getToken, onMessage } from '@firebase/messaging'; // Internal Components -import { postReq } from "api"; +import { registerDeviceToken } from './services'; // Internal Configs -import { appConfig } from "config"; +import { appConfig } from 'config'; // Initialize the Firebase app in the service worker by passing the generated config var firebaseConfig = { ...appConfig.firebaseConfig }; -const TOKEN_KEY = "EPNS_BASE_PUSH_TOKEN"; -const CACHEPREFIX = "PUSH_TOKEN_"; +const TOKEN_KEY = 'EPNS_BASE_PUSH_TOKEN'; +const CACHEPREFIX = 'PUSH_TOKEN_'; const firebaseApp = initializeApp(firebaseConfig); const messaging = getMessaging(firebaseApp); @@ -22,7 +22,7 @@ const setLocalToken = (token) => localStorage.setItem(TOKEN_KEY, token); export const getPushToken = async () => { try { let token = getLocalToken(TOKEN_KEY); - if(!token){ + if (!token) { token = await getToken(messaging, { vapidKey: appConfig.vapidKey, }); @@ -30,9 +30,7 @@ export const getPushToken = async () => { } return token; } catch (err) { - console.log('\n\n\n\n') - console.error("An error occurred while retrieving token. ", err); - console.log('\n\n\n\n') + console.error('An error occurred while retrieving token. ', err); } }; @@ -41,25 +39,23 @@ export const onMessageListener = () => onMessage(messaging, (payload) => { resolve(payload); }); -}); + }); -export const browserFunction = async(account)=>{ - try{ +export const browserFunction = async (account) => { + try { const tokenKey = `${CACHEPREFIX}${account}`; const tokenExists = localStorage.getItem(tokenKey) || localStorage.getItem(CACHEPREFIX); //temp to prevent more than 1 account to register if (!tokenExists) { const response = await getPushToken(); - const object = { - op: 'register', - wallet: account.toLowerCase(), - device_token: response, - platform: 'dapp', - }; - await postReq('/pushtokens/_register_no_auth', object); + + await registerDeviceToken({ + token: response, + account: account, + }); localStorage.setItem(tokenKey, response); localStorage.setItem(CACHEPREFIX, 'response'); //temp to prevent more than 1 account to register } - }catch(e){ - console.error("Error setting up the browser notification",e); + } catch (e) { + console.error('Error setting up the browser notification', e); } -} +}; diff --git a/src/helpers/CaipHelper.ts b/src/helpers/CaipHelper.ts index 3f177da32e..d50632201d 100644 --- a/src/helpers/CaipHelper.ts +++ b/src/helpers/CaipHelper.ts @@ -1,7 +1,9 @@ // Internal Configs import { appConfig } from '../config'; -export const Eip155EnabledIds: Array = [1, 56, 137, 10, 1101, 42161, 11155111, 97, 80001, 420, 1442, 421613, 122, 123]; +export const Eip155EnabledIds: Array = [ + 1, 56, 137, 10, 1101, 42161, 11155111, 97, 80001, 420, 1442, 421613, 122, 123, +]; // Types type CAIPProps = { @@ -32,13 +34,14 @@ export const getCAIP = (chainId: number): string | null => { } }; -export const convertAddressToAddrCaip = ( - userAddress: string, - chainId: number -): string => { +export const convertAddressToAddrCaip = (userAddress: string, chainId: number): string => { return `eip155:${chainId}:${userAddress}`; }; +export const convertAddressToPartialCaip = (userAddress: string): string => { + return `eip155:${userAddress}`; +}; + export const convertAddrCaipToAddress = (addressInCaip: string): string => { const caipArr: string[] = addressInCaip.split(':'); if (caipArr.length == 3 && caipArr[0] == 'eip155') { diff --git a/src/helpers/RoutesHelper.ts b/src/helpers/RoutesHelper.ts index 8511838dfa..8b93386b9c 100644 --- a/src/helpers/RoutesHelper.ts +++ b/src/helpers/RoutesHelper.ts @@ -1,23 +1,28 @@ // Internal Configs -import { appConfig } from "../config"; +import { appConfig } from '../config'; // Constants const apiVersion: number = appConfig.pushNodeApiVersion; const channelsRoute: string = `/v${apiVersion}/channels`; const usersRoute: string = `/v${apiVersion}/users`; const ipfsRoute: string = `/v${apiVersion}/ipfs`; +const deliveryNodeRoute: string = `/v${apiVersion}`; export const usersServiceEndpoints = { - userSubscriptions: (userAddressInCAIP: string):string => `${usersRoute}/${userAddressInCAIP}/subscriptions`, - userDelegations: (userAddressInCAIP: string):string => `${usersRoute}/${userAddressInCAIP}/delegations` -} + userSubscriptions: (userAddressInCAIP: string): string => `${usersRoute}/${userAddressInCAIP}/subscriptions`, + userDelegations: (userAddressInCAIP: string): string => `${usersRoute}/${userAddressInCAIP}/delegations`, +}; export const channelsServiceEndpoints = { - channelsInfo: (queryParams?: string):string => `${channelsRoute}?${queryParams}`, - channelsSearch: (queryParams: string):string => `${channelsRoute}/search?${queryParams}`, - channelDelegates: (channelAddressInCAIP: string):string => `${channelsRoute}/${channelAddressInCAIP}/delegates` -} + channelsInfo: (queryParams?: string): string => `${channelsRoute}?${queryParams}`, + channelsSearch: (queryParams: string): string => `${channelsRoute}/search?${queryParams}`, + channelDelegates: (channelAddressInCAIP: string): string => `${channelsRoute}/${channelAddressInCAIP}/delegates`, +}; export const ipfsServiceEndpoints = { - ipfsUpload: ():string => `${ipfsRoute}/upload` -} \ No newline at end of file + ipfsUpload: (): string => `${ipfsRoute}/upload`, +}; + +export const deliveryNodeServiceEndpoints = { + registerDeviceToken: (): string => `${deliveryNodeRoute}/pushtokens/register`, +}; diff --git a/src/hooks/useBrowserNotification.ts b/src/hooks/useBrowserNotification.ts index b37c524e56..96dbb98707 100644 --- a/src/hooks/useBrowserNotification.ts +++ b/src/hooks/useBrowserNotification.ts @@ -1,35 +1,33 @@ // React + Web3 Essentials -import { useEffect, useState } from 'react'; +import { useContext, useEffect, useState } from 'react'; // External Packages -import { toast } from "react-toastify"; +import { useAccount } from './useAccount'; +import { GlobalContext } from 'contexts/GlobalContext'; -export function useBrowserNotification(account){ - const [triggerNotification, setTriggerNotification] = useState(false); - - useEffect(() => { - if (!("serviceWorker" in navigator)) return - if (!account) return; - (async function () { - const {browserFunction} = require('firebase') - await browserFunction(account); - })(); - }, [account]); - - useEffect(() => { - if (!("serviceWorker" in navigator)) return - const {onMessageListener} = require("firebase") - onMessageListener().then(payload => { - if (!("Notification" in window)) { - toast.dark(`${payload.notification.body} from: ${payload.notification.title}`, { - type: toast.TYPE.DARK, - autoClose: 5000, - position: "top-right" - }); +export function useBrowserNotification() { + const { account } = useAccount(); + const { readOnlyWallet } = useContext(GlobalContext); + const [triggerNotification, setTriggerNotification] = useState(false); + + useEffect(() => { + if (!('serviceWorker' in navigator)) return; + if (!account || account == readOnlyWallet) return; + (async function () { + const { browserFunction } = require('firebase'); + await browserFunction(account); + })(); + }, [account]); + + useEffect(() => { + if (!('serviceWorker' in navigator)) return; + const { onMessageListener } = require('firebase'); + onMessageListener() + .then((payload) => { + if (!('Notification' in window)) { + // useStream handles this case of showing in page notif (if showing notifs is not allowed) } else { - console.info('\n\n\n\n\n') - console.info("revieced push notification") - console.info('\n\n\n\n\n') + console.info('received push notification'); const notificationTitle = payload.notification.title; const notificationOptions = { title: payload.data.app, @@ -42,7 +40,8 @@ export function useBrowserNotification(account){ }; var notification = new Notification(notificationTitle, notificationOptions); } - }).catch(err => console.error('failed: ', err)) - .finally(() => setTriggerNotification(!triggerNotification)); //retrigger the listener after it has been used once - }, [triggerNotification]); - } \ No newline at end of file + }) + .catch((err) => console.error('failed: ', err)) + .finally(() => setTriggerNotification(!triggerNotification)); //retrigger the listener after it has been used once + }, [triggerNotification]); +} diff --git a/src/services/deliveryNode/index.ts b/src/services/deliveryNode/index.ts new file mode 100644 index 0000000000..20d88dba38 --- /dev/null +++ b/src/services/deliveryNode/index.ts @@ -0,0 +1 @@ +export * from './registerDeviceToken'; diff --git a/src/services/deliveryNode/registerDeviceToken.ts b/src/services/deliveryNode/registerDeviceToken.ts new file mode 100644 index 0000000000..449b686932 --- /dev/null +++ b/src/services/deliveryNode/registerDeviceToken.ts @@ -0,0 +1,26 @@ +// Internal Components +import { deliveryNodePostReq } from 'api'; +import { convertAddressToPartialCaip } from 'helpers/CaipHelper'; +import { deliveryNodeServiceEndpoints } from 'helpers/RoutesHelper'; + +// Types +type Props = { + token: string; + account: string; +}; + +export const registerDeviceToken = async ({ token, account }: Props) => { + const reqEndpoint = deliveryNodeServiceEndpoints.registerDeviceToken(); + console.log(reqEndpoint); + try { + const data = { + wallet: convertAddressToPartialCaip(account.toLowerCase()), + device_token: token, + platform: 'web', + }; + const response = await deliveryNodePostReq(reqEndpoint, data); + } catch (err) { + console.error(err); + throw new Error(err.message); + } +}; diff --git a/src/services/index.ts b/src/services/index.ts index 735e68702d..942e78d437 100644 --- a/src/services/index.ts +++ b/src/services/index.ts @@ -1,5 +1,6 @@ -export * from "./channels"; -export * from "./chats"; -export * from "./ipfs"; -export * from "./users"; -export * from "./alias"; \ No newline at end of file +export * from './channels'; +export * from './chats'; +export * from './ipfs'; +export * from './users'; +export * from './alias'; +export * from './deliveryNode'; From 994c88ef26be38f5c7b140373c9b10e32fdaec0c Mon Sep 17 00:00:00 2001 From: Nilesh Gupta Date: Thu, 28 Mar 2024 16:18:54 +0530 Subject: [PATCH 2/4] Updated firebase project details --- src/config/config-dev.js | 17 ++++++++--------- src/config/config-prod.js | 2 +- src/config/config-staging.js | 2 +- src/firebase.js | 1 + 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/config/config-dev.js b/src/config/config-dev.js index 898b1f0be0..91cf6a700a 100644 --- a/src/config/config-dev.js +++ b/src/config/config-dev.js @@ -53,16 +53,15 @@ export const config = { * Analaytics + Firebase */ googleAnalyticsId: 'UA-165415629-5', - vapidKey: 'BFRmmAEEXOhk31FIsooph5CxlXKh6N0_NocUWHzvtpoUEvqQTwLXu6XtwkrH7ckyr2CvVz1ll-8q4oo6-ZqFJPY', + vapidKey: 'BJYsH1MYRqzfuzduyHLNaUfZCYdAahcJXsdWzdTqleWox0vOLaycyVPdy_J9XWzSIKvRu0xkwxo75mhDiVJhNnw', firebaseConfig: { - apiKey: 'AIzaSyClOk4qP0ttFW-BPnXy7WT920xfdXSbFu8', - authDomain: 'epns-internal.firebaseapp.com', - databaseURL: 'https://epns-internal.firebaseio.com', - projectId: 'epns-internal', - storageBucket: 'epns-internal.appspot.com', - messagingSenderId: '755180533582', - appId: '1:755180533582:web:752ff8db31905506b7d01f', - measurementId: 'G-ZJH2T7R9S1', + apiKey: 'AIzaSyB4aXx2pJ9T5sw0Q1bba3jI1EAGp0Z5kBI', + authDomain: 'push-dev-a6a63.firebaseapp.com', + projectId: 'push-dev-a6a63', + storageBucket: 'push-dev-a6a63.appspot.com', + messagingSenderId: '974364469170', + appId: '1:974364469170:web:47fd6304c6cf36b5bfe6ab', + measurementId: 'G-5YR8N35DY4', }, /** diff --git a/src/config/config-prod.js b/src/config/config-prod.js index caf8031f1d..0e97cac3a0 100644 --- a/src/config/config-prod.js +++ b/src/config/config-prod.js @@ -52,7 +52,7 @@ export const config = { * Analaytics + Firebase */ googleAnalyticsId: 'UA-165415629-1', - vapidKey: 'BFRmmAEEXOhk31FIsooph5CxlXKh6N0_NocUWHzvtpoUEvqQTwLXu6XtwkrH7ckyr2CvVz1ll-8q4oo6-ZqFJPY', + vapidKey: 'BOMOB--KihZkwM8SQ_OrPEsuu8UcSYiRB9AvMjsWil3WJDmxBEcDex8g4d5rFGgA8U-7esfRM5pvR98jaE1nX0M', firebaseConfig: { apiKey: 'AIzaSyBrzkFPyNmVDFzGY7dKz2HocUO4m-ni-Fc', authDomain: 'epns-ethereum-push-service.firebaseapp.com', diff --git a/src/config/config-staging.js b/src/config/config-staging.js index 09bda73c34..a9427e6373 100644 --- a/src/config/config-staging.js +++ b/src/config/config-staging.js @@ -54,7 +54,7 @@ export const config = { * Analaytics + Firebase */ googleAnalyticsId: 'UA-165415629-5', - vapidKey: 'BFRmmAEEXOhk31FIsooph5CxlXKh6N0_NocUWHzvtpoUEvqQTwLXu6XtwkrH7ckyr2CvVz1ll-8q4oo6-ZqFJPY', + vapidKey: 'BO-oYHtENkaP1nRQMmXAmjbkyWz_4sms1Z5OzE8B7h5gmuXiePvLmbXRiJNA233WtzzEo83yWZAVX1blsJQkNFg', firebaseConfig: { apiKey: 'AIzaSyClOk4qP0ttFW-BPnXy7WT920xfdXSbFu8', authDomain: 'epns-internal.firebaseapp.com', diff --git a/src/firebase.js b/src/firebase.js index 3beb51405e..7b46878467 100644 --- a/src/firebase.js +++ b/src/firebase.js @@ -31,6 +31,7 @@ export const getPushToken = async () => { return token; } catch (err) { console.error('An error occurred while retrieving token. ', err); + throw err; } }; From abaf3544c72ab3041146b5823599812b934ba4f2 Mon Sep 17 00:00:00 2001 From: Hritik Singh Date: Mon, 1 Apr 2024 19:00:21 +0530 Subject: [PATCH 3/4] fix: undefined values and removed logs --- src/hooks/useBrowserNotification.ts | 7 +++---- src/services/deliveryNode/registerDeviceToken.ts | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/hooks/useBrowserNotification.ts b/src/hooks/useBrowserNotification.ts index 96dbb98707..daeb17e723 100644 --- a/src/hooks/useBrowserNotification.ts +++ b/src/hooks/useBrowserNotification.ts @@ -27,12 +27,11 @@ export function useBrowserNotification() { if (!('Notification' in window)) { // useStream handles this case of showing in page notif (if showing notifs is not allowed) } else { - console.info('received push notification'); const notificationTitle = payload.notification.title; const notificationOptions = { - title: payload.data.app, - body: payload.notification.body, - image: payload.data.aimg, + title: payload?.notification?.title, + body: payload?.notification?.body, + image: payload?.data?.aimg, icon: payload?.data?.icon, data: { url: payload?.data?.acta || payload?.data?.url, diff --git a/src/services/deliveryNode/registerDeviceToken.ts b/src/services/deliveryNode/registerDeviceToken.ts index 449b686932..53b1a413be 100644 --- a/src/services/deliveryNode/registerDeviceToken.ts +++ b/src/services/deliveryNode/registerDeviceToken.ts @@ -11,7 +11,6 @@ type Props = { export const registerDeviceToken = async ({ token, account }: Props) => { const reqEndpoint = deliveryNodeServiceEndpoints.registerDeviceToken(); - console.log(reqEndpoint); try { const data = { wallet: convertAddressToPartialCaip(account.toLowerCase()), From 023d8d7365abbaf44ab71406dd17f39d73119349 Mon Sep 17 00:00:00 2001 From: harshrajat Date: Wed, 3 Apr 2024 02:12:05 +0400 Subject: [PATCH 4/4] added config for alpha and localhost --- src/config/config-alpha.js | 84 +++++++++++++------------ src/config/config-localhost.js | 109 +++++++++++++++++---------------- 2 files changed, 96 insertions(+), 97 deletions(-) diff --git a/src/config/config-alpha.js b/src/config/config-alpha.js index c278d73804..aac904178c 100644 --- a/src/config/config-alpha.js +++ b/src/config/config-alpha.js @@ -14,6 +14,7 @@ export const config = { apiUrl: 'https://backend.epns.io/apis', w2wApiUrl: 'https://backend.epns.io/apis', toolingApiUrl: 'https://tooling.epns.io/apis', + deliveryNodeApiUrl: 'https://delivery-prod.epns.io/apis', ipfsInfuraAPIKey: process.env.REACT_APP_IPFS_INFURA_API_KEY || '22rfiNb1J645FdehoqbKMpLbF6V', ipfsInfuraAPISecret: process.env.REACT_APP_IPFS_INFURA_API_SECRET || 'a757597f020425c3ae532e6be84de552', @@ -39,10 +40,10 @@ export const config = { mainnetCoreRPC: 'https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a', mainnetCoreContractChain: 1, aliasRPC: { - 137: "https://polygon-mainnet.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9", - 56: "https://bsc-dataseed.binance.org/", - 10: "https://opt-mainnet.g.alchemy.com/v2/JYW0UaSC5Zd0hrI6vE2K9VN1wJupoY5B", - 42161: "https://arb1.arbitrum.io/rpc", + 137: 'https://polygon-mainnet.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9', + 56: 'https://bsc-dataseed.binance.org/', + 10: 'https://opt-mainnet.g.alchemy.com/v2/JYW0UaSC5Zd0hrI6vE2K9VN1wJupoY5B', + 42161: 'https://arb1.arbitrum.io/rpc', 1101: 'https://rpc.polygon-zkevm.gateway.fm', }, infuraApiUrl: 'https:/infura-ipfs.io/ipfs/', @@ -83,7 +84,7 @@ export const addresses = { epnsEthComm: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', // mainnet address eth comm epnsPolyComm: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', // mainnet address polygon comm pushToken: '0xf418588522d5dd018b425E472991E52EBBeEEEEE', // mainnet address - pushChannelAdmin: "0x65193c896eC400f731712D4f71046CeDd11Bff27", // mainnet push core admin + pushChannelAdmin: '0x65193c896eC400f731712D4f71046CeDd11Bff27', // mainnet push core admin aDai: '0xcB1Fe6F440c49E9290c3eb7f158534c2dC374201', // mainnet address staking: '0xB72ff1e675117beDefF05a7D0a472c3844cfec85', // mainnet address yieldFarmPUSH: '0x6019B84E2eE9EB62BC42E32AB6375A7095886366', // mainnet address @@ -101,70 +102,67 @@ export const addresses = { NFTRewardsV2: '0xdc66567a990B7fa10730459537620857c9e03287', //mainnet address //For Yield Farm V1(Deprecated) - staking: "0xB72ff1e675117beDefF05a7D0a472c3844cfec85", // deprecated staking mainnet addresses - depYieldFarmPUSH: "0x6019B84E2eE9EB62BC42E32AB6375A7095886366", // deprecated YieldFarmPUSH mainnet address - depYieldFarmLP:"0xbB2A70e67770D0A7F5f42d883C5BBE9b85e0DcD6",// deprecated YieldFarmLP mainnet addresses + staking: '0xB72ff1e675117beDefF05a7D0a472c3844cfec85', // deprecated staking mainnet addresses + depYieldFarmPUSH: '0x6019B84E2eE9EB62BC42E32AB6375A7095886366', // deprecated YieldFarmPUSH mainnet address + depYieldFarmLP: '0xbB2A70e67770D0A7F5f42d883C5BBE9b85e0DcD6', // deprecated YieldFarmLP mainnet addresses //For Yield Farm V2 - stakingV2:"0x9D2513F5b539DC774C66b28ACEc94e4bD00105C2",//mainnet address - yieldFarmLP: "0x9af118D9fA1eFEa5b5a792847554960217DEdb04",//mainnet address - uniV2LPToken: "0xaf31fd9c3b0350424bf96e551d2d1264d8466205",//same as epnsLPToken - pushCoreV2: "0x66329Fdd4042928BfCAB60b179e1538D56eeeeeE",//not upgraded - - - + stakingV2: '0x9D2513F5b539DC774C66b28ACEc94e4bD00105C2', //mainnet address + yieldFarmLP: '0x9af118D9fA1eFEa5b5a792847554960217DEdb04', //mainnet address + uniV2LPToken: '0xaf31fd9c3b0350424bf96e551d2d1264d8466205', //same as epnsLPToken + pushCoreV2: '0x66329Fdd4042928BfCAB60b179e1538D56eeeeeE', //not upgraded }; export const CHAIN_DETAILS = { 1: { - label: "Ethereum Mainnet", - name: "ETH_MAINNET", + label: 'Ethereum Mainnet', + name: 'ETH_MAINNET', chainId: 1, - rpcUrl: "https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a", - commAddress: "0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa", - network: "mainnet", - }, + rpcUrl: 'https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a', + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + network: 'mainnet', + }, 137: { - label: "Polygon Mainnet", - name: "POLYGON_MAINNET", + label: 'Polygon Mainnet', + name: 'POLYGON_MAINNET', chainId: 137, - rpcUrl: "https://polygon-mainnet.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9", - commAddress: "0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa", - network: "polygon-mainnet", + rpcUrl: 'https://polygon-mainnet.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9', + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + network: 'polygon-mainnet', }, 56: { - label: "BNB Mainnet", - name: "BNB_MAINNET", + label: 'BNB Mainnet', + name: 'BNB_MAINNET', chainId: 56, - rpcUrl: "https://bsc-dataseed.binance.org/", - commAddress: "0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa" + rpcUrl: 'https://bsc-dataseed.binance.org/', + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', }, 10: { - label: "Optimism Mainnet", - name: "OPTIMISM_MAINNET", + label: 'Optimism Mainnet', + name: 'OPTIMISM_MAINNET', chainId: 10, rpcUrl: 'https://opt-mainnet.g.alchemy.com/v2/JYW0UaSC5Zd0hrI6vE2K9VN1wJupoY5B', - commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa' + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', }, 1101: { - label: "Polygon zkEVM Mainnet", - name: "POLYGON_ZK_EVM_MAINNET", + label: 'Polygon zkEVM Mainnet', + name: 'POLYGON_ZK_EVM_MAINNET', chainId: 1101, rpcUrl: 'https://rpc.polygon-zkevm.gateway.fm', - commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa' + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', }, 42161: { - label: "Arbitrum Mainnet", - name: "ARBITRUMONE_MAINNET", + label: 'Arbitrum Mainnet', + name: 'ARBITRUMONE_MAINNET', chainId: 42161, rpcUrl: 'https://arb1.arbitrum.io/rpc', - commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa' + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', }, 122: { - label: "Fuse Mainnet", - name: "FUSE_MAINNET", + label: 'Fuse Mainnet', + name: 'FUSE_MAINNET', chainId: 122, rpcUrl: 'https://rpc.fuse.io', - commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa' + commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', }, -} \ No newline at end of file +}; diff --git a/src/config/config-localhost.js b/src/config/config-localhost.js index 6e92ccbc76..a58037f2b2 100644 --- a/src/config/config-localhost.js +++ b/src/config/config-localhost.js @@ -14,6 +14,7 @@ export const config = { apiUrl: 'http://localhost:4000/apis', w2wApiUrl: 'http://localhost:4000/apis', toolingApiUrl: 'https://tooling.epns.io/apis', + deliveryNodeApiUrl: 'https://delivery-dev.epns.io/apis', ipfsInfuraAPIKey: process.env.REACT_APP_IPFS_INFURA_API_KEY || '22rfiNb1J645FdehoqbKMpLbF6V', ipfsInfuraAPISecret: process.env.REACT_APP_IPFS_INFURA_API_SECRET || 'a757597f020425c3ae532e6be84de552', @@ -21,26 +22,26 @@ export const config = { /** * Allowed Networks */ - allowedNetworks: [ + allowedNetworks: [ 5, // for eth goerli 80001, //for mumbai polygon 97, // bnb testnet - 420 // optimism goerli testnet + 420, // optimism goerli testnet ], /** * Core Network Related Data */ - coreContractChain: 5, //the chain id of the network which the core contract relies on - coreRPC: 'https://goerli.infura.io/v3/4ff53a5254144d988a8318210b56f47a', - mainnetCoreRPC: "https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a", - mainnetCoreContractChain: 1, - aliasRPC: { - 80001: "https://polygon-mumbai.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9", - 97: "https://data-seed-prebsc-1-s1.binance.org:8545", - 420: "https://opt-goerli.g.alchemy.com/v2/98vFj7OCg4vbGKvCDpj6pOAMSBVC7rzm" - }, - infuraApiUrl: 'https:/infura-ipfs.io/ipfs/', + coreContractChain: 5, //the chain id of the network which the core contract relies on + coreRPC: 'https://goerli.infura.io/v3/4ff53a5254144d988a8318210b56f47a', + mainnetCoreRPC: 'https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a', + mainnetCoreContractChain: 1, + aliasRPC: { + 80001: 'https://polygon-mumbai.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9', + 97: 'https://data-seed-prebsc-1-s1.binance.org:8545', + 420: 'https://opt-goerli.g.alchemy.com/v2/98vFj7OCg4vbGKvCDpj6pOAMSBVC7rzm', + }, + infuraApiUrl: 'https:/infura-ipfs.io/ipfs/', /** * Analaytics + Firebase @@ -72,58 +73,58 @@ export const config = { /** * Smart Contract Related */ - export const addresses = { - ceaErc20: "0xc1C0472c0C80bCcDC7F5D01A376Bd97a734B8815", - epnscore: "0x23346b732d56d34ec4e890419fbfb8548216a799", - epnsEthComm: "0xc064F30bac07e84500c97A04D21a9d1bfFC72Ec0", - epnsPolyComm: "0xAf55BE8e6b0d6107891bA76eADeEa032ef8A4504", // the ploygon comm contract - pushToken: "0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33", //address for push token - aDai: "0x31f30d9A5627eAfeC4433Ae2886Cf6cc3D25E772", - staking: "0x8e129EF695F8761922F1AA38588292f8d8817bA5", - yieldFarmPUSH: "0xb41cd6760d3b1d0d216851f63fda9573b04dd46e", - yieldFarmLP: "0x604f629A6b5E85805D57f39493BBC2856cE8A540", - epnsToken: "0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33", - epnsLPToken: "0x1f094Bd8c260D0C3fC79157096015990885af4d2", - rockstar: "0x3f8C2152b79276b78315CAF66cCF951780580A8a", - batchMintNFT: "0xCf733D547B9f7F87c1B1f63f45c197C007F8eedf", - NFTRewards: "0xc4708BB6EC3B797344f123126171302e4e3E68E2", - distributor: "0x5B548D33874DeABaC2F683A6E1864795E09932F0", - uniswapV2Router02: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D", //n - WETHAddress: "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6", // mainnet address //n - USDTAddress: "0x13512979ade267ab5100878e2e0f485b568328a4", // mainnet address //n - rockstarV2: "0xA2b885e7065EA59a3251489715ca80DE5Ff642f8", //mainnet address - NFTRewardsV2: "0xdc66567a990B7fa10730459537620857c9e03287", //mainnet address -} +export const addresses = { + ceaErc20: '0xc1C0472c0C80bCcDC7F5D01A376Bd97a734B8815', + epnscore: '0x23346b732d56d34ec4e890419fbfb8548216a799', + epnsEthComm: '0xc064F30bac07e84500c97A04D21a9d1bfFC72Ec0', + epnsPolyComm: '0xAf55BE8e6b0d6107891bA76eADeEa032ef8A4504', // the ploygon comm contract + pushToken: '0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', //address for push token + aDai: '0x31f30d9A5627eAfeC4433Ae2886Cf6cc3D25E772', + staking: '0x8e129EF695F8761922F1AA38588292f8d8817bA5', + yieldFarmPUSH: '0xb41cd6760d3b1d0d216851f63fda9573b04dd46e', + yieldFarmLP: '0x604f629A6b5E85805D57f39493BBC2856cE8A540', + epnsToken: '0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', + epnsLPToken: '0x1f094Bd8c260D0C3fC79157096015990885af4d2', + rockstar: '0x3f8C2152b79276b78315CAF66cCF951780580A8a', + batchMintNFT: '0xCf733D547B9f7F87c1B1f63f45c197C007F8eedf', + NFTRewards: '0xc4708BB6EC3B797344f123126171302e4e3E68E2', + distributor: '0x5B548D33874DeABaC2F683A6E1864795E09932F0', + uniswapV2Router02: '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', //n + WETHAddress: '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', // mainnet address //n + USDTAddress: '0x13512979ade267ab5100878e2e0f485b568328a4', // mainnet address //n + rockstarV2: '0xA2b885e7065EA59a3251489715ca80DE5Ff642f8', //mainnet address + NFTRewardsV2: '0xdc66567a990B7fa10730459537620857c9e03287', //mainnet address +}; export const CHAIN_DETAILS = { 5: { - label: "Ethereum Goerli", - name: "ETH_TEST_GOERLI", + label: 'Ethereum Goerli', + name: 'ETH_TEST_GOERLI', chainId: 5, - rpcUrl: "https://goerli.infura.io/v3/4ff53a5254144d988a8318210b56f47a", - commAddress: "0xc064F30bac07e84500c97A04D21a9d1bfFC72Ec0", - network: "goerli", - }, + rpcUrl: 'https://goerli.infura.io/v3/4ff53a5254144d988a8318210b56f47a', + commAddress: '0xc064F30bac07e84500c97A04D21a9d1bfFC72Ec0', + network: 'goerli', + }, 80001: { - label: "Polygon Mumbai", - name: "POLYGON_TEST_MUMBAI", + label: 'Polygon Mumbai', + name: 'POLYGON_TEST_MUMBAI', chainId: 80001, - rpcUrl: "https://polygon-mumbai.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9", - commAddress: "0xAf55BE8e6b0d6107891bA76eADeEa032ef8A4504", - network: "polygon-mumbai", + rpcUrl: 'https://polygon-mumbai.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9', + commAddress: '0xAf55BE8e6b0d6107891bA76eADeEa032ef8A4504', + network: 'polygon-mumbai', }, 97: { - label: "BNB Testnet", - name: "BNB_TESTNET", + label: 'BNB Testnet', + name: 'BNB_TESTNET', chainId: 97, - rpcUrl: "https://data-seed-prebsc-1-s1.binance.org:8545", - commAddress: "0x4132061E3349ff36cFfCadA460E10Bd4f31F7ea8" + rpcUrl: 'https://data-seed-prebsc-1-s1.binance.org:8545', + commAddress: '0x4132061E3349ff36cFfCadA460E10Bd4f31F7ea8', }, 420: { - label: "Optimism Goerli", - name: "OPTIMISM_TESTNET", + label: 'Optimism Goerli', + name: 'OPTIMISM_TESTNET', chainId: 420, rpcUrl: 'https://opt-goerli.g.alchemy.com/v2/98vFj7OCg4vbGKvCDpj6pOAMSBVC7rzm', - commAddress: '0x4305D572F2bf38Fc2AE8D0172055b1EFd18F57a6' - } -} + commAddress: '0x4305D572F2bf38Fc2AE8D0172055b1EFd18F57a6', + }, +};