Closed sequencerr closed 4 months ago
Hi @sequencerr thanks for submitting this! right, the method that its sending should be eth_requestAccounts
no eth_accounts
, the devs will look into this, thank u!
Looks like the network https://cloudflare-eth.com/
does not support eth_accounts
method. Check their documentation for available RPC methods. @sequencerr
if you need to send RPC that doesn't exists inside web3js. You can send it using this code
web3.requestManager.send({
method: 'eth_requestAccounts', // method name
params: [....], // method params
});
https://developers.cloudflare.com/web3/ethereum-gateway/reference/supported-api-methods
Can I leave all in wagmi client.transport but change to some other Ethereum JSON-RPC API node Gateway url?
export function clientToWeb3js(client?: Client<Transport, Chain>) {
if (!client) {
return new Web3()
}
const {transport} = client
if (transport.type === 'fallback') {
return new Web3(transport.transports[0].value.url) // <== HERE
}
return new Web3(transport) // <== HERE
}
actually, yes you can set any URL you want But, I think using Wagmi it is better to set the correct chain in Wagmi config https://wagmi.sh/core/api/chains
import { mainnet } from '@wagmi/core/chains';
(mainnet.rpcUrls.default.http as unknown as string[]) = ['https://some-eth-rpc.com']; // or maybe better with defineChain()
Thank you!
the docs page with example: https://docs.web3js.org/guides/wagmi_usage/wagmi/#reference-implementation
code
error: