Details: the method eth_sendTransaction is not available Version: [email protected] #1452
-
Coming across the below error when trying to write to contract. Details: the method eth_sendTransaction is not available Version: [email protected]
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
What transport are you using for your wallet client? You'll need to make sure that the transport supports the |
Beta Was this translation helpful? Give feedback.
-
I had the same error, instead you had to use I suppose you are using an ankr RPC, using Infura you recieve a sendTransaction is not supported/implemented, so the problem is not related to the RPC, and is about the method you are using to send. Viem should have a alternative for the writeContract using ONLY sendTransaction. And I believe this happens because wagmi is mostly used in the front, but viem is rising in the nodeJs enviroment, specially in the back. |
Beta Was this translation helpful? Give feedback.
-
You need to pass import { privateKeyToAccount } from 'viem/accounts'
const account = privateKeyToAccount(PRIVATE_KEY)
const hash = await client.writeContract({
abi,
address: contractAddress,
functionName: 'rebalance',
args: [someargs],
account,
}) and not just an address. After that it will work as intended. |
Beta Was this translation helpful? Give feedback.
You need to pass
account
to writeContract derived as:and not just an address. After that it will work as intended.