xclud / web3dart

Ethereum library, written in Dart.
https://pub.dev/packages/web3dart
MIT License
170 stars 94 forks source link

RPCError: got code -32000 with msg "under min gas price". #131

Open Asadu43 opened 7 months ago

Asadu43 commented 7 months ago

I have Signed Transaction Like this

var response = await client.sendTransaction( credentials, chainId: chainId, Transaction( from: address, to: EthereumAddress.fromHex(_recieverAddressController.text.trim()), gasPrice: EtherAmount.inWei(BigInt.one), maxGas: 100000, value: EtherAmount.inWei(BigInt.from(weiUnit)), ), );

reasje commented 4 months ago

There are some problems with your code :

  1. gas price (Gas price per unit of gas) is not a static number, Please send that as null or try to get the gas price with getGasPrice() web3dart function.
  2. Amount of max gas is also static which is not recommended since that is going to differ from tx to tx depending on the kind of tx, You can also get gas estimation with estimateGas() function by passing tx details.
  3. Value also seems to be unknown type or value plz check that too