Skip to content
This repository was archived by the owner on May 16, 2024. It is now read-only.
This repository was archived by the owner on May 16, 2024. It is now read-only.

Trying to connect with web3modal - is it possible? #33

Closed

Description

@dataexcess

I am not sure if it is possible but I would like to have web3Modal as my provider in my nuxt 3 project.
So far I have this plugin (plugins/use-wagmi.js):

import { UseWagmiPlugin, configureChains, createConfig, mainnet, sepolia } from 'use-wagmi'
import { w3mConnectors, w3mProvider } from '@web3modal/ethereum'

export default defineNuxtPlugin((nuxtApp) => {
    const config = useRuntimeConfig()
    const projectId = config.public.walletConnectProjectId
    const chains = [mainnet, sepolia]

    const { publicClient, webSocketPublicClient } = configureChains(chains, [w3mProvider({ projectId })])
    const wagmiConfig = createConfig({
        autoConnect: true,
        connectors: w3mConnectors({ projectId, chains }),
        publicClient,
        webSocketPublicClient
    })

    nuxtApp.vueApp.use(UseWagmiPlugin, wagmiConfig)
})

But I am unsure how to proceed since actually web3Modal requires an Ethereum client like so:

const ethereumClient = new EthereumClient(wagmiConfig, chains)
const web3modal = new Web3Modal({ projectId }, ethereumClient)

I should then call

const connect = () => { web3modal.openModal() }
to make the modal appear.

How would you recommend me to continue?

Activity

  1. unicape commented on Jul 13, 2023

    @unicape
    Owner
  2. Repository owner locked and limited conversation to collaborators on Jul 13, 2023
  3. converted this issue into a discussion #34 on Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions