Ethers.js support with network switcher #25
evgenykuzyakov
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We want to enable Ethers.js support for the VM. It may be done similarly to NearSocial/viewer#130
To enable Ethers.js we need to get the Provider. In the PR above it was injected using from a hook into a Widget and then given to the VM instance. The hook used a singleton to store the current provider which was coming from the Web3Onboard.
The VM itself shouldn't be enforcing the wallet selection, so it may expect the provider be injected using a singleton like
initNear
call. Another option is a React context which would wrap the root Widget and provide it this way.Network switcher
The network switcher is wallet specific. The PR used Web3Onboard and it has its own API to change chainID. For the VM we should expose a new method through the provider hook that would request a wallet to change the network. The viewer is going to be responsible for the implementation of such callback.
Beta Was this translation helpful? Give feedback.
All reactions