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

Allow multiple target networks #599

Closed
1 task done
wbt opened this issue Nov 8, 2023 · 1 comment · Fixed by #615
Closed
1 task done

Allow multiple target networks #599

wbt opened this issue Nov 8, 2023 · 1 comment · Fixed by #615
Assignees

Comments

@wbt
Copy link

wbt commented Nov 8, 2023

Is there an existing issue for this?

Current Behavior

In scaffold.config.ts, object scaffoldConfig.targetNetwork is a single value. When the user is using a non-default wallet (e.g. MetaMask) and connected to a network that is not targetNetwork, a "Wrong Network" error is displayed, even if the dApp is deployed on the network the user is currently connected to.

Expected Behavior

The targetNetwork value can be an array. If the network the user is currently connected to is in the array, the dApp behavior is the same as if that network were the single value, and the dApp works. When the user changes to another network where the contracts are also deployed, the dApp continues to work as if that new network were the value of targetNetwork.

For backwards compatibility, if a single value is provided, it is interpreted as a single-element array. The sample code is also updated to make the default network a single-element array to more easily communicate how this can be expanded as the dApp is deployed on additional networks.

Steps To Reproduce

  1. Do rapid development with the default Hardhat network.
  2. Deploy to a public chain.
  3. Switch to that chain and test to verify correct operation.
  4. Want to switch back and forth between chains quickly for demo purposes.
  5. Find that doing so requires editing the config file.

Anything else?

This will not change the one-network-at-a-time contract deployment workflow, only simplify use.

@sverps
Copy link
Collaborator

sverps commented Nov 15, 2023

Hey @wbt, thanks for your feedback. This would indeed be nice, and would make it simpler to deploy one front-end that can interface with multiple networks. I'll look into it and how complex it would be to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants