Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUMP SDK IN DAPP] DAPP-1914 Infura key fixes #1916

Merged
merged 19 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ export default function App() {
<ChatUIProvider
user={userPushSDKInstance}
theme={darkMode && darkChatTheme}
debug={false}
debug={true}
mishramonalisha76 marked this conversation as resolved.
Show resolved Hide resolved
uiConfig={{
suppressToast: false,
}}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Profile() {
const { account } = useAccount();
const { authError } = useContext(ErrorContext);

useResolveWeb3Name(account);
// useResolveWeb3Name(account);

// get ens name from context
const ensName = web3NameList[account];
Expand Down
13 changes: 6 additions & 7 deletions src/components/chat/chatsnap/ChatSnap.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// React + Web3 Essentials
import React,{useContext} from 'react';
import React, { useContext } from 'react';
import { ethers } from 'ethers';

// External Packages
Expand Down Expand Up @@ -35,17 +35,17 @@ interface ChatSnapPropsI {

// Other Information section
const ChatSnap = ({ pfp, username, chatSnapMsg, timestamp, selected, onClick, isGroup }: ChatSnapPropsI) => {
const { web3NameList }:AppContextType=useContext(AppContext);
const { web3NameList }: AppContextType = useContext(AppContext);
let ensName = '';

// get theme
const theme = useTheme();

// resolve web3 names
useResolveWeb3Name(!isGroup ? username : null);
// useResolveWeb3Name(!isGroup ? username : null);

// get ens name from context
if(!isGroup){
if (!isGroup) {
if (username?.includes(':nft')) {
// to match "eip155:" followed by any chainId and replace it with "eip155:" and split the string at ':nft' and keep the part before it
username = username.replace(/eip155:\d+:/, 'eip155:').split(':nft')[0];
Expand Down Expand Up @@ -108,11 +108,10 @@ const ChatSnap = ({ pfp, username, chatSnapMsg, timestamp, selected, onClick, is

let date = null;
if (timestamp) {

if (typeof timestamp === "string" && timestamp?.includes('Z')) {
if (typeof timestamp === 'string' && timestamp?.includes('Z')) {
timestamp = timestamp.replace('Z', '');
}

date = convertTimestampToDateDayTime(new Date(timestamp));
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/chat/w2wChat/chatBox/ChatBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const ChatBox = ({ triggerChatParticipant }): JSX.Element => {
useClickAway(groupInfoRef, () => setShowGroupInfo(false));

//resolve web3 names
useResolveWeb3Name(!isGroup ? currentChat?.wallets?.split(',')[0].toString() : null);
// useResolveWeb3Name(!isGroup ? currentChat?.wallets?.split(',')[0].toString() : null);

// get web3 name
let ensName = '';
Expand Down
2 changes: 1 addition & 1 deletion src/components/chat/w2wChat/chats/Chats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function Chats({ msg, caip10, messageBeingSent, ApproveIntent, is
msg.messageType = 'TwitterFeedLink';
}
const walletAddress = shortenText(caip10ToWallet(msg?.fromCAIP10)?.toLowerCase(), 6);
useResolveWeb3Name(msg?.fromCAIP10);
// useResolveWeb3Name(msg?.fromCAIP10);

const walletLowercase = caip10ToWallet(msg?.fromCAIP10)?.toLowerCase();
const checksumWallet = walletLowercase ? ethers.utils.getAddress(walletLowercase) : null;
Expand Down
2 changes: 1 addition & 1 deletion src/components/chat/w2wChat/profile/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Profile = ({ setActiveTab, showQR, setShowQR }: any): JSX.Element => {
const theme = useTheme();

// resolve web3 name
useResolveWeb3Name(account);
// useResolveWeb3Name(account);

const ensName = web3NameList[account];

Expand Down
15 changes: 10 additions & 5 deletions src/config/config-alpha.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// environmental configurations for the dapp for different environments
const infuraProjectId =
window.location.hostname == 'localhost'
? import.meta.env.VITE_APP_INFURA_PROJECT_ID
: 'dd262cc008764b29bd6a15249db4772e';
export const config = {
/**
* Push Nodes Environment - can be dev, staging or prod - important to keep one on one connection
Expand Down Expand Up @@ -37,12 +41,13 @@ export const config = {
/**
* Core Network Related Data
*/
infuraAPIKey: infuraProjectId,
coreContractChain: 1, //the chain id of the network which the core contract relies on
coreRPC: 'https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a',
mainnetCoreRPC: 'https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a',
coreRPC: `https://mainnet.infura.io/v3/${infuraProjectId}`,
mainnetCoreRPC: `https://mainnet.infura.io/v3/${infuraProjectId}`,
mainnetCoreContractChain: 1,
aliasRPC: {
137: 'https://polygon-mainnet.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9',
137: `https://polygon-mainnet.infura.io/v3/${infuraProjectId}`,
56: 'https://bsc-dataseed.binance.org/',
10: 'https://opt-mainnet.g.alchemy.com/v2/JYW0UaSC5Zd0hrI6vE2K9VN1wJupoY5B',
42161: 'https://arb1.arbitrum.io/rpc',
Expand Down Expand Up @@ -120,15 +125,15 @@ export const CHAIN_DETAILS = {
label: 'Ethereum Mainnet',
name: 'ETH_MAINNET',
chainId: 1,
rpcUrl: 'https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a',
rpcUrl: `https://mainnet.infura.io/v3/${infuraProjectId}`,
commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa',
network: 'mainnet',
},
137: {
label: 'Polygon Mainnet',
name: 'POLYGON_MAINNET',
chainId: 137,
rpcUrl: 'https://polygon-mainnet.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9',
rpcUrl: `https://polygon-mainnet.infura.io/v3/${infuraProjectId}`,
commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa',
network: 'polygon-mainnet',
},
Expand Down
25 changes: 15 additions & 10 deletions src/config/config-dev.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// environmental configurations for the dapp for different environments
const infuraProjectId =
window.location.hostname == 'localhost'
? import.meta.env.VITE_APP_INFURA_PROJECT_ID
: 'be75cf427a5c41f9badb591994019d22';
export const config = {
/**
* Push Nodes Environment - can be dev, staging or prod - important to keep one on one connection
Expand Down Expand Up @@ -39,16 +43,17 @@ export const config = {
/**
* Core Network Related Data
*/
infuraAPIKey: infuraProjectId,
coreContractChain: 11155111, //the chain id of the network which the core contract relies on
coreRPC: 'https://ethereum-sepolia-rpc.publicnode.com',
mainnetCoreRPC: 'https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a',
coreRPC: `https://sepolia.infura.io/v3/${infuraProjectId}`,
mainnetCoreRPC: `https://mainnet.infura.io/v3/${infuraProjectId}`,
mainnetCoreContractChain: 1,
aliasRPC: {
80002: 'https://polygon-amoy.infura.io/v3/5524d420b29f4f7a8d8d2f582a0d43f7',
97: 'https://data-seed-prebsc-1-s1.binance.org:8545',
11155420: 'https://optimism-sepolia.infura.io/v3/5524d420b29f4f7a8d8d2f582a0d43f7',
80002: `https://polygon-amoy.infura.io/v3/${infuraProjectId}`,
97: `https://data-seed-prebsc-1-s1.binance.org:8545`,
11155420: `https://optimism-sepolia.infura.io/v3/${infuraProjectId}`,
2442: 'https://rpc.cardona.zkevm-rpc.com',
421614: 'https://arbitrum-sepolia.infura.io/v3/5524d420b29f4f7a8d8d2f582a0d43f7',
421614: `https://arbitrum-sepolia.infura.io/v3/${infuraProjectId}`,
},
infuraApiUrl: 'https:/infura-ipfs.io/ipfs/',

Expand Down Expand Up @@ -130,15 +135,15 @@ export const CHAIN_DETAILS = {
label: 'Ethereum Sepolia',
name: 'ETH_TEST_SEPOLIA',
chainId: 11155111,
rpcUrl: 'https://sepolia.infura.io/v3/5524d420b29f4f7a8d8d2f582a0d43f7',
rpcUrl: `https://sepolia.infura.io/v3/${config.infuraAPIKey}`,
commAddress: '0x28709649Dfda9baDEbb61dBF7a8D199cfC8EcF2e',
network: 'sepolia',
},
80002: {
label: 'Polygon Amoy',
name: 'POLYGON_TEST_AMOY',
chainId: 80002,
rpcUrl: 'https://polygon-amoy.infura.io/v3/5524d420b29f4f7a8d8d2f582a0d43f7',
rpcUrl: `https://polygon-amoy.infura.io/v3/${config.infuraAPIKey}`,
commAddress: '0x9cb3bd7550b5c92baa056fc0f08132f49508145f',
network: 'polygon-amoy',
},
Expand All @@ -153,7 +158,7 @@ export const CHAIN_DETAILS = {
label: 'Optimism Sepolia',
name: 'OPTIMISM_TESTNET',
chainId: 11155420,
rpcUrl: 'https://optimism-sepolia.infura.io/v3/5524d420b29f4f7a8d8d2f582a0d43f7',
rpcUrl: `https://optimism-sepolia.infura.io/v3/${config.infuraAPIKey}`,
commAddress: '0x754787358fac861ef904c92d54f7adb659779317',
},
2442: {
Expand All @@ -167,7 +172,7 @@ export const CHAIN_DETAILS = {
label: 'Arbitrum Testnet',
name: 'ARBITRUM_TESTNET',
chainId: 421614,
rpcUrl: 'https://arbitrum-sepolia.infura.io/v3/5524d420b29f4f7a8d8d2f582a0d43f7',
rpcUrl: `https://arbitrum-sepolia.infura.io/v3/${config.infuraAPIKey}`,
commAddress: '0x754787358fac861ef904c92d54f7adb659779317',
},
123: {
Expand Down
53 changes: 22 additions & 31 deletions src/config/config-general.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,25 @@
// environmental configurations for the dapp for different environments
export const config = {
/**
* API Calls Related
*/
// infuraAPIKey: 'e214e9781e104829bc93941508a45b58'
infuraAPIKey: '1afc24a3e4c443a0990d6e5efc2ecde5',

}

// Internal Components
import daiAbi from "./abis/dai";
import epnsTokenAbi from "./abis/EPNS.json";
import epnsCommAbi from "./abis/epnsCommunicator.json";
import epnscoreAbi from "./abis/epnscore";
import erc20Abi from "./abis/erc20";
import ec721Abi from "./abis/ERC721.json";
import MerkleDistributorAbi from "./abis/MerkleDistributor.json";
import NFTRewards from "./abis/NFTRewards.json";
import NFTRewardsV2 from "./abis/NFTRewardsV2.json";
import ownableAbi from "./abis/ownable";
import rockstarAbi from "./abis/Rockstar.json";
import rockstarV2Abi from "./abis/RockstarV2.json";
import stakingAbi from "./abis/Staking.json";
import UniswapV2Router02Abi from "./abis/UniswapV2Router02.json";
import yieldFarmingAbi from "./abis/YieldFarm.json";
import pushTokenAbi from "./abis/pushToken.json";
import stakingV2Abi from "./abis/StakingV2.json"; // for new staking V2 Contract on staging
import uniV2LpTokenAbi from "./abis/UniV2LPToken.json";// for new staking V2 Contract on staging
import PushCoreV2 from "./abis/PushCoreV2.json";
import PushRevealAbi from "./abis/PushReveal.json";
import daiAbi from './abis/dai';
import epnsTokenAbi from './abis/EPNS.json';
import epnsCommAbi from './abis/epnsCommunicator.json';
import epnscoreAbi from './abis/epnscore';
import erc20Abi from './abis/erc20';
import ec721Abi from './abis/ERC721.json';
import MerkleDistributorAbi from './abis/MerkleDistributor.json';
import NFTRewards from './abis/NFTRewards.json';
import NFTRewardsV2 from './abis/NFTRewardsV2.json';
import ownableAbi from './abis/ownable';
import rockstarAbi from './abis/Rockstar.json';
import rockstarV2Abi from './abis/RockstarV2.json';
import stakingAbi from './abis/Staking.json';
import UniswapV2Router02Abi from './abis/UniswapV2Router02.json';
import yieldFarmingAbi from './abis/YieldFarm.json';
import pushTokenAbi from './abis/pushToken.json';
import stakingV2Abi from './abis/StakingV2.json'; // for new staking V2 Contract on staging
import uniV2LpTokenAbi from './abis/UniV2LPToken.json'; // for new staking V2 Contract on staging
import PushCoreV2 from './abis/PushCoreV2.json';
import PushRevealAbi from './abis/PushReveal.json';
import { InfuraAPIKey } from '@pushprotocol/uiweb';

export const abis = {
erc20: erc20Abi,
Expand All @@ -51,5 +42,5 @@ export const abis = {
stakingV2: stakingV2Abi,
uniV2LpToken: uniV2LpTokenAbi,
pushCoreV2: PushCoreV2,
pushReveal: PushRevealAbi
pushReveal: PushRevealAbi,
};
11 changes: 6 additions & 5 deletions src/config/config-localhost.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ export const config = {
/**
* Core Network Related Data
*/
infuraAPIKey: import.meta.env.VITE_APP_INFURA_PROJECT_ID,
mishramonalisha76 marked this conversation as resolved.
Show resolved Hide resolved
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',
coreRPC: `https://goerli.infura.io/v3/${import.meta.env.VITE_APP_INFURA_PROJECT_ID}`,
mainnetCoreRPC: `https://mainnet.infura.io/v3/${import.meta.env.VITE_APP_INFURA_PROJECT_ID}`,
mainnetCoreContractChain: 1,
aliasRPC: {
80002: 'https://polygon-amoy.infura.io/v3/5524d420b29f4f7a8d8d2f582a0d43f7',
Expand Down Expand Up @@ -99,15 +100,15 @@ export const CHAIN_DETAILS = {
label: 'Ethereum Goerli',
name: 'ETH_TEST_GOERLI',
chainId: 5,
rpcUrl: 'https://goerli.infura.io/v3/4ff53a5254144d988a8318210b56f47a',
rpcUrl: `https://goerli.infura.io/v3/${import.meta.env.VITE_APP_INFURA_PROJECT_ID}`,
commAddress: '0xc064F30bac07e84500c97A04D21a9d1bfFC72Ec0',
network: 'goerli',
},
80002: {
label: 'Polygon Amoy',
name: 'POLYGON_TEST_AMOY',
chainId: 80002,
rpcUrl: 'https://polygon-amoy.infura.io/v3/5524d420b29f4f7a8d8d2f582a0d43f7',
rpcUrl: `https://polygon-amoy.infura.io/v3/${import.meta.env.VITE_APP_INFURA_PROJECT_ID}`,
commAddress: '0x9cb3bd7550b5c92baa056fc0f08132f49508145f',
network: 'polygon-amoy',
},
Expand All @@ -122,7 +123,7 @@ export const CHAIN_DETAILS = {
label: 'Optimism Sepolia',
name: 'OPTIMISM_TESTNET',
chainId: 11155420,
rpcUrl: 'https://optimism-sepolia.infura.io/v3/5524d420b29f4f7a8d8d2f582a0d43f7',
rpcUrl: `https://optimism-sepolia.infura.io/v3/${import.meta.env.VITE_APP_INFURA_PROJECT_ID}`,
commAddress: '0x9Dc25996ba72A2FD7E64e7a674232a683f406F1A',
},
};
15 changes: 10 additions & 5 deletions src/config/config-prod.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// environmental configurations for the dapp for different environments
const infuraProjectId =
window.location.hostname == 'localhost'
? import.meta.env.VITE_APP_INFURA_PROJECT_ID
: 'dd262cc008764b29bd6a15249db4772e';
export const config = {
/**
* Push Nodes Environment - can be dev, staging or prod - important to keep one on one connection
Expand Down Expand Up @@ -38,12 +42,13 @@ export const config = {
/**
* Core Network Related Data
*/
infuraAPIKey: infuraProjectId,
coreContractChain: 1, //the chain id of the network which the core contract relies on
coreRPC: 'https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a',
mainnetCoreRPC: 'https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a',
coreRPC: `https://mainnet.infura.io/v3/${infuraProjectId}`,
mainnetCoreRPC: `https://mainnet.infura.io/v3/${infuraProjectId}`,
mainnetCoreContractChain: 1,
aliasRPC: {
137: 'https://polygon-mainnet.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9',
137: `https://polygon-mainnet.infura.io/v3/${infuraProjectId}`,
56: 'https://bsc-dataseed.binance.org/',
10: 'https://opt-mainnet.g.alchemy.com/v2/JYW0UaSC5Zd0hrI6vE2K9VN1wJupoY5B',
42161: 'https://arb1.arbitrum.io/rpc',
Expand Down Expand Up @@ -123,15 +128,15 @@ export const CHAIN_DETAILS = {
label: 'Ethereum Mainnet',
name: 'ETH_MAINNET',
chainId: 1,
rpcUrl: 'https://mainnet.infura.io/v3/4ff53a5254144d988a8318210b56f47a',
rpcUrl: `https://mainnet.infura.io/v3/${config.infuraAPIKey}`,
commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa',
network: 'mainnet',
},
137: {
label: 'Polygon Mainnet',
name: 'POLYGON_MAINNET',
chainId: 137,
rpcUrl: 'https://polygon-mainnet.infura.io/v3/150f25623ae64d08ab7ec7dd0c6b6ee9',
rpcUrl: `https://polygon-mainnet.infura.io/v3/${config.infuraAPIKey}`,
commAddress: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa',
network: 'polygon-mainnet',
},
Expand Down
Loading
Loading