flutter_web3 icon indicating copy to clipboard operation
flutter_web3 copied to clipboard

Invalid object key when sending transaction

Open 4xMafole opened this issue 2 years ago • 0 comments

Describe the bug I get this problem when I create a custom transaction request and try to send it using the provider's signer.

To Reproduce Steps to reproduce the behavior:

  1. Create a custom transaction request
     final TransactionRequest transactionRequest = TransactionRequest(
      to: null,
      from: await provider!.getSigner().getAddress(),
      data: data,
      gasLimit: BigInt.from(2000000),
      maxFeePerGas: null,
      maxPriorityFeePerGas: null,
    );
  1. send the transaction using the current provider's signer
    final transaction =
        await provider!.getSigner().sendTransaction(transactionRequest);

    final signature = await transaction.wait();

    return signature.transactionHash;
  1. Error You'll end up having this error on the console:
Error: EthersException: INVALID_ARGUMENT invalid object key - maxFeePerGas
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49  throw_
packages/flutter_web3/src/ethers/signer.dart 72:13                                                                         sendTransaction

Expected behavior The expectation is to send the transaction and return the appropriate transaction hash.

Additional context I did a research about the problem and found out this issue here on ethers.js repository. As the solution is to add a field named type but seems the TransactionRequest class does not have that field.

4xMafole avatar Dec 26 '22 21:12 4xMafole