Can't use the no-modal SDK = unsupported operation = eth_requestAccounts

When asking for help in this category, please make sure to provide the following details:

I have a ethereum composable that generalizes some of the wallet connectors logic, so i created this connector for the Web3Auth, that’s how i am using:

import { Web3AuthNoModal } from '@web3auth/no-modal'
import { CHAIN_NAMESPACES, WALLET_ADAPTERS, WEB3AUTH_NETWORK } from '@web3auth/base'
import { EthereumPrivateKeyProvider } from '@web3auth/ethereum-provider'
import { WalletConnector, type ChainId, numberToHex, ChainIds } from '@ryze-blockchain/ethereum'
// import { BrowserProvider, JsonRpcProvider, Wallet } from 'ethers'
import { AuthAdapter } from '@web3auth/auth-adapter'
// import { CommonJRPCProvider } from '@web3auth/base-provider'

export class Web3AuthConnector extends WalletConnector {
    public readonly id: string = 'web3auth'
    public readonly name: string = 'Login with Google'

    private chainConfig = {
        chainNamespace: CHAIN_NAMESPACES.EIP155,
        chainId: numberToHex(ChainIds.BNB_TESTNET),
        rpcTarget: 'https://data-seed-prebsc-1-s1.binance.org:8545/',
        displayName: 'Binance Smart Chain Testnet',
        blockExplorerUrl: 'https://testnet.bscscan.com/',
        ticker: 'BNB',
        tickerName: 'Binance Coin',
        logo: '/images/chains/binance.svg',
    }

    private clientId = 'BPS1KO7rAWwv_KdX9df1aMZFpCnJW4PgnpG0i2yGz9esEGoJLklJPveg02gampc_nr4_fR1pJJQZGOtlS22-jcA'

    private static web3auth: Web3AuthNoModal

    private static initialized = false

    constructor() {
        super()

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

        Web3AuthConnector.web3auth = new Web3AuthNoModal({
            clientId: this.clientId,
            web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_DEVNET,
            privateKeyProvider,
        })

        Web3AuthConnector.web3auth.configureAdapter(new AuthAdapter({
            privateKeyProvider,
        }))
    }

    public async getProvider() {
        console.log('Entered getProvider')

        if (!Web3AuthConnector.initialized) {
            Web3AuthConnector.initialized = true
            await Web3AuthConnector.web3auth.init()
        }

        console.log('init done')

        if (!Web3AuthConnector.web3auth.connected) {
            await Web3AuthConnector.web3auth.connectTo(WALLET_ADAPTERS.AUTH, {
                loginProvider: 'google',
            })
        }

        console.log('here')

        const web3authProvider = Web3AuthConnector.web3auth.provider

        if (!web3authProvider)
            throw new Error('Failed to connect to Web3Auth')
        console.log('web3auth provider: ', web3authProvider)

        return web3authProvider
    }

Hi Matheus! Thanks for reaching out for support.

I see you are encountering an issue with the @web3auth/no-modal SDK version ^8.12.4 while using Nuxt. The error suggests that the eth_requestAccounts operation is unsupported. To help our support team assist you better, here’s the information you’ve provided:

Web3Auth Initialization & Login Code Snippets: You provided a code example with details about your Web3AuthConnector, which is very helpful.

Please check the following:

  • Ensure that the wallet adapter you are using supports the eth_requestAccounts method. Some adapters may not implement this method depending on the chain and configuration.
  • If you are using a custom authentication with a specific verifier or login method, let us know that as well!

If you have additional context or specific scenarios in which the error occurs, feel free to share that too! Our support team will look into this issue promptly.

Note: This response was generated by an AI bot and may require further verification. The Web3Auth support team has tracked this issue and will be responding as soon as possible.

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