celo-ethers-wrapper icon indicating copy to clipboard operation
celo-ethers-wrapper copied to clipboard

Unable to send transaction

Open raslegion opened this issue 4 years ago • 1 comments
trafficstars

I am trying to send 1 Celo on Baklava, but keep getting an insufficient funds error when using this library. It works perfectly fine when I try the same with @celo/ contractkit. There is sufficient balance (100+ Celo) in the account and I am following the exact same steps as in the documentation. What could be going wrong?

Code

import {
     CeloProvider,
     CeloTransactionRequest,
     CeloWallet,
 } from '@celo-tools/celo-ethers-wrapper'
 import { utils } from 'ethers'
 
 const provider = new CeloProvider('https://baklava-forno.celo-testnet.org')
 await provider.ready
 
 const wallet = new CeloWallet(PRIVATE_KEY_HERE, provider)
 const amount = utils.parseEther('1')
 
 const txResponse = await wallet.sendTransaction({
         chainId: 62320,
         to: 'ADDRESS_HERE',
         value: amount,
     })
 
 const txReceipt = await txResponse.wait()

Error

Unhandled Rejection at Promise: [object Promise]. Reason: Error: insufficient funds for intrinsic transaction cost (error={"reason":"processing response error","code":"SERVER_ERROR","body":"{\"jsonrpc\":\"2.0\",\"id\":49,\"error\":{\"code\":-32000,\"message\":\"insufficient funds for transfer (after fees)\"}}\n","error":{"code":-32000},"requestBody":"{\"method\":\"eth_estimateGas\",\"params\":[{\"gasPrice\":\"0x1dcd6500\",\"value\":\"0xde0b6b3a7640000\",\"to\":\"ADDRESS\"}],\"id\":49,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","url":"https://baklava-forno.celo-testnet.org"}, method="estimateGas", transaction={"gasPrice":{"type":"BigNumber","hex":"0x1dcd6500"},"to":"ADDRESS","value":{"type":"BigNumber","hex":"0x0de0b6b3a7640000"},"accessList":null}, code=INSUFFICIENT_FUNDS, version=providers/5.1.2)

raslegion avatar Jun 05 '21 14:06 raslegion

@raslegion found a solution for this or an alternative?

codemaster101 avatar Sep 23 '21 11:09 codemaster101