Having issues using Goerli network with GoerliETH

Hello,

Is it possible to test with Goerli ETH? I have no issues connecting to the network by swapping the chainIds. However, web3auth keeps reading the balance of my ETH in Mainnet, not Goerli. There is a smart contract transaction I am trying to test that requires GoerliETH, but web3auth is not correctly reading my balance.

Since Base Goerli is a EVM compatible chain, you may choose CHAIN_NAMESPACES.EIP155 as the chainNamespace while initializing Web3Auth with the OpenloginAdapter , you need to add the privateKeyProvider to the OpenLogin instance. Code snippet below:

const chainConfig = {
  chainNamespace: CHAIN_NAMESPACES.EIP155,
  chainId: "0x14a33",   //chain ID in hex for Base Goerli Testnet
  rpcTarget: "https://goerli.base.org", //You can visit https://chainlist.org/chain/84531 for Base Goerli Testnet RPC List
  displayName: "Base Goerli Testnet", 
  blockExplorer: "https://goerli.basescan.org/",
  ticker: "ETH",
  tickerName: "Goerli Ether",
};

const web3auth = new Web3Auth({
  clientId: " ",  // Get your Client ID from Web3Auth Dashboard,
  chainConfig,
  web3AuthNetwork: "cyan",
});

const privateKeyProvider = new EthereumPrivateKeyProvider({
  config: { chainConfig },
});

const openloginAdapter = new OpenloginAdapter({
  privateKeyProvider,
  adapterSettings: {...},
  mfaSettings: {...},
  loginSettings: {...},
});
web3auth.configureAdapter(openloginAdapter);

provider = await web3auth.connectTo(
  WALLET_ADAPTERS.OPENLOGIN,
  {
    loginProvider: "google",
  }
);

Have you configured the chainID this way? Could you share what your code is?

Thank you, I will give this a try. I truly appreciate the response.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.