-
const collToken = new ethers.Contract( How to get this signer |
Beta Was this translation helpful? Give feedback.
Answered by
Lakszy
Sep 28, 2024
Replies: 1 comment 2 replies
-
This is working earlier in the previous versions This too (not working now): |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks
But please could be more specific
import { providers } from 'ethers'
import { useMemo } from 'react'
import type { Account, Chain, Client, Transport } from 'viem'
import { Config, useConnectorClient } from 'wagmi'
export function clientToSigner(client: Client<Transport, Chain, Account>) {
const { account, chain, transport } = client
const network = {
chainId: chain.id,
name: chain.name,
ensAddress: chain.contracts?.ensRegistry?.address,
}
const provider = new providers.Web3Provider(transport, network)
const signer = provider.getSigner(account.address)
return signer
}
/** Hook to convert a Viem Client to an ethers.js Signer. */
…