Open CAPtheorem opened 3 years ago
ToDo -
1/ best practices for helping people to navigate multiple chains
2/ Metamask integration - how do we make chain switching as natural as possible?
3/ What changes are needed to networkServices
to support on-the-fly choice of changes on a per action level?
Example - this is how we send the correct L2 chain parameters to MetaMask right now:
async addL2Network() {
const nw = getAllNetworks();
const chainParam = {
chainId: '0x' + nw.rinkeby.L2.chainId.toString(16),
chainName: "OMGX L2",
rpcUrls: [nw.rinkeby.L2.rpcUrl]
}
this.provider = await web3Modal.connect();
this.web3Provider = new Web3Provider(this.provider);
this.web3Provider.jsonRpcFetchFunc(
'wallet_addEthereumChain',
[chainParam, this.account],
);
}
I understand why this is, but there has got to be a better, more user-friendly solution. For example, when someone selects an action that's on the other chain - fire up a popup that says -
To do this you need to change chains. Click here to switch to {otherChain}