You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to support both JSON-RPC and local accounts in my application. I'm using some other legacy libraries which use Ethers, so I need to convert between a viem WalletClient and ethers Provider/Signer.
This example from the docs works for JSON-RPC accounts, but fails for local accounts.
export function clientToProvider(client: Client<Transport, Chain, Account>) {
const { chain, transport } = client
const network = {
chainId: chain.id,
name: chain.name,
ensAddress: chain.contracts?.ensRegistry?.address,
}
return new BrowserProvider(transport, network)
}
The problem with local accounts is the resulting provider attempts to call eth_accounts via the public RPC endpoint, which obviously does nothing. I need some way to implement a JSON-RPC provider that uses a local account signer. Is this possible?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I need to support both JSON-RPC and local accounts in my application. I'm using some other legacy libraries which use Ethers, so I need to convert between a viem WalletClient and ethers Provider/Signer.
This example from the docs works for JSON-RPC accounts, but fails for local accounts.
The problem with local accounts is the resulting provider attempts to call
eth_accounts
via the public RPC endpoint, which obviously does nothing. I need some way to implement a JSON-RPC provider that uses a local account signer. Is this possible?Beta Was this translation helpful? Give feedback.
All reactions