klaytn / klaytn-dev-sandbox

MIT License
9 stars 13 forks source link

8-wallet connection bug #11

Closed chloe-klatyn closed 2 years ago

chloe-klatyn commented 2 years ago

Proposed changes

This PR resolves the issue of 'Out of Gas' error, which appears when:

  1. you are on the /contracts page
  2. the deployed contracts that the frontend is trying to instantiate are on a different network from the currently connected wallet.

Solution: used the .getCode() function from web3.js on the deployed contract address to check if it is a valid contract on the network that the user is currently connected to, then display the necessary error messages to alert the user if they do not match.

Types of changes

Please put an x in the boxes related to your change.

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

Related issues

This PR resolve issue #8 , as well as point 3 in issue #9.

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you proposed and what alternatives you have considered, etc.