flutter_web3
flutter_web3 copied to clipboard
Invalid object key when sending transaction
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:
- 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,
);
- send the transaction using the current provider's signer
final transaction =
await provider!.getSigner().sendTransaction(transactionRequest);
final signature = await transaction.wait();
return signature.transactionHash;
- 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.