Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

Fix contracts not loading properly if the user is on a diff network #108

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/react-app/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ function Home() {
}
// handle other "switch" errors
}
setTimeout(() => {
window.location.reload();
}, [1000]);
};
const cancelRef = React.useRef();
const [inputEmail, setInputEmail] = useState("");
Expand Down Expand Up @@ -123,6 +126,10 @@ function Home() {
if (context.injectedProvider && context.injectedProvider.getSigner()) {
try {
const signer = context.injectedProvider.getSigner();
const { chainId } = await context.injectedProvider.getNetwork();
if (chainId !== context.targetNetwork.chainId) {
throw new Error("Incorrect network");
}
const contract = await loadDRecruitV1Contract(context.targetNetwork, signer);
const tokenAddress = await contract.token();
const tokenContract = await loadTokenContract(tokenAddress, signer);
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3779,10 +3779,10 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"

"@nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers":
version "0.3.0-beta.10"
resolved "https://registry.yarnpkg.com/hardhat-deploy-ethers/-/hardhat-deploy-ethers-0.3.0-beta.10.tgz#bccfcf635d380bbab3638960f6739fe4d396fc5f"
integrity sha512-TeyriUshRZ7XVHOjMsDtTozIrdwLf3Bw+oZRYNhXdG/eut5HeDhjUFPfRlG7TI1lSLvkcB5dt7OxOtPYKDOxTg==
"@nomiclabs/hardhat-ethers@^2.0.2":
version "2.0.3"
resolved "https://registry.yarnpkg.com/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.3.tgz#06e20a57274f6ce3148132910e723948a711edf1"
integrity sha512-IJ0gBotVtO7YyLZyHNgbxzskUtFok+JkRlKPo8YELqj1ms9XL6Qm3vsfsGdZr22wnJeVEF5TQPotKuwQk21Dag==

"@nomiclabs/hardhat-etherscan@^2.1.7":
version "2.1.7"
Expand Down