Web3AuthNoModal failing - failing and asking for rpcTarget param to be specified when it already is

Please provide the following details too when asking for help in this category:

  • SDK Version: ^6.1.1

  • Platform: Remix.js/React.js

  • Browser Console Screenshots:

  • Related to Custom Authentication? Please provide the following info too: (Optional)

    • Verifier Name:
    • JWKS Endpoint:
    • Sample idToken(JWT)

Please provide the Web3Auth initialization and login code snippet below:
Example from your documentation at Wallet Connect V2 Adapter | Documentation | Web3Auth

Attempted this:

  const web3auth = new Web3AuthNoModal({
    clientId: WEB_3_AUTH_CLIENT_ID,
        chainConfig: {
          chainNamespace: CHAIN_NAMESPACES.EIP155,
          chainId: `0x${Number(getDefaultChainId()).toString(16)}`,
          rpcTarget:
            'https://<subdomain>.quiknode.pro/<slug>/',
        },
  });

  useEffect(() => {
    (async () => {
      const defaultWcSettings = await getWalletConnectV2Settings(
        'eip155',
        [1, 5, 137],
        'project_id'
      );
      console.log('web3auth');
      const walletConnectV2Adapter = new WalletConnectV2Adapter({
        ...defaultWcSettings,
      });
      console.log('web3auth');
      // //
      web3auth.configureAdapter(walletConnectV2Adapter);
      await web3auth.init();
    })();
  }, []);

and this:
Attempted this:

  const web3auth = new Web3AuthNoModal({
    clientId: WEB_3_AUTH_CLIENT_ID,
  chainConfig: {
    chainNamespace: CHAIN_NAMESPACES.EIP155,
    chainId: `0x${Number(getDefaultChainId()).toString(16)}`,
    rpcTarget:
      'https://<subdomain>.quiknode.pro/<slug>/',
  },
  });

  useEffect(() => {
    (async () => {
      const defaultWcSettings = await getWalletConnectV2Settings(
        'eip155',
        [1, 5, 137],
        'project_id'
      );
      console.log('web3auth');
      const walletConnectV2Adapter = new WalletConnectV2Adapter({
        ...defaultWcSettings,
        chainConfig: { //<-- passing in chainConfig as error suggests
          chainNamespace: CHAIN_NAMESPACES.EIP155,
          chainId: `0x${Number(getDefaultChainId()).toString(16)}`,
          rpcTarget:
            'https://<subdomain>.quiknode.pro/<slug>/',
        },
      });
      console.log('web3auth');
      // //
      web3auth.configureAdapter(walletConnectV2Adapter);
      await web3auth.init();
    })();
  }, []);

Same result.

Please update your docs, or provide guidance, this crashes the whole flow which prevents other connectors from working properly

I went through the flow of the .init call, that’s where it seems to be failing.

Couple of things:

  • i noticed the WalletConnectV2 provider fetches the defaultWcSettings internally to the .init call, perhaps manually calling getWalletConnectV2Settings should not be necessary
  • i noticed the .init call iterates over all adapters’ .init calls, and passes in its own chainOptions containing the chainConfig

there’s clearly somewhere not passing in the chainConfig properly

FYI
removing all code related to WalletConnectV2 makes the other adapters work - so it’s clearly something around the WalletConnectV2 init flow

@jeanlouis Thanks for reaching out.

Your issue has been forwarded to our team and we will get back with further updates.

Hey @jeanlouis

Web3Auth No-Modal requires a privateKeyProvider during initialization.

check the announcement note for more details.

Also, refer to any no-modal example here for reference.

understood - however, im not using an OpenLoginAdapter, only Metamask, Coinbase and WalletConnect; the note in the anouncement you’re referring to mentions the privateKeyProvider only if using open-login (which im not); additionally, when removing wallet connect adapter code, the NoModal initializer works without a privateKeyProvider so i don’t believe the NoModal sdk requires one just for logging-in users

i’ve isolated the issue in your SDK,

in this code snippet:

chainConfig somehow does not get applied properly

when this is passed in, I’m not seeing neither my values from options.chainConfig, neither your default values from getChainConfig

I checked the esm.js code this generates, and the spread operator function generated to handle this spread block is pretty thick to decypher

I’d recommend your team look into this part