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

Add support for EIP1193 + test networks #41

Closed
pi0neerpat opened this issue Jul 13, 2020 · 3 comments
Closed

Add support for EIP1193 + test networks #41

pi0neerpat opened this issue Jul 13, 2020 · 3 comments

Comments

@pi0neerpat
Copy link

pi0neerpat commented Jul 13, 2020

Issue

  1. Test networks are not supported
  2. Cannot detect when the network is changed by the user (related to No network checking or alerts (danger!) #39 )

Code snippet

No matter what I do, I cannot seem to unlock the wallet using any network other than mainnet (homestead). And when switch networks in the app, the function is never called, which suggests that EIP1193 hasn't been implemented.

@walletconnect/web3-provider v1.0.13
walletlink ^2.0.2
Coinbase Wallet v22.3.307

import { Web3Provider } from "@ethersproject/providers";
import WalletLink from "walletlink";

export const unlockWalletLink = async ({
  infuraKey,
  debug,
  targetNetwork,
  onNetworkChange
}) => {
  const ETH_JSONRPC_URL = `https://mainnet.infura.io/v3/${infuraKey}`;
  try {
    const walletLink = new WalletLink({
      appName: APP_NAME,
      appLogoUrl: APP_LOGO_URL,
    });
    const ethereum = walletLink.makeWeb3Provider(
      ETH_JSONRPC_URL,
      42 // targetNetwork ? getIdFromName(targetNetwork) : 1
    );
    const walletProvider = new Web3Provider(ethereum);
    const accounts = await ethereum.enable();

    // Issue #1, this is always homestead
    const network = await walletProvider.getNetwork();

    // Issue #2, onNetworkChange is never called
    walletProvider.on("chainChanged", onNetworkChange);

Discussion

EIP1193 has already been implemented in MetaMask link and WalletConnect link

This update would be really helpful for testing purposes, and I appreciate your support

@pi0neerpat
Copy link
Author

I tried the legacy walletProvider.on("networkChanged", onNetworkChange); as well but no luck

@brendanww
Copy link
Contributor

we now support handling both addEthereumChain/switchEthereumChain requests to allow dapps to request network changes. the clients are also able to update the network via the settings menu.

@pi0neerpat
Copy link
Author

Sweet looking forward to trying this out soon!

bangtoven added a commit that referenced this issue Feb 29, 2024
* move/rename cipher stuff

* MWP message encryption

* ArrayBuffer can be transferred over postMessage

* inject KeyStorage

* cleanup

* cleanup

* cleanup

* separate out message conversion

* more granular processing so that host can reuse

* cleanup

* rename. handshake request to conform to Action

* host

* host implementation

* cleanup

* fix test

* fix errors
bangtoven added a commit that referenced this issue Feb 29, 2024
* move/rename cipher stuff

* MWP message encryption

* ArrayBuffer can be transferred over postMessage

* inject KeyStorage

* cleanup

* cleanup

* cleanup

* separate out message conversion

* more granular processing so that host can reuse

* cleanup

* rename. handshake request to conform to Action

* host

* host implementation

* cleanup

* fix test

* fix errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants