simolus3 / web3dart

Ethereum library, written in Dart.
MIT License
441 stars 270 forks source link

Unhandled Exception: Invalid argument(s): Client is required to perform network actions #216

Closed sayhellotogithub closed 2 years ago

sayhellotogithub commented 2 years ago

flutter environment: sdk: ">=2.12.0 <3.0.0"

provider: ^6.0.1 web3dart: ^2.3.2 http: ^0.13.4 web_socket_channel: ^2.1.0

==================================================================================================== [VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: Invalid argument(s): Client is required to perform network actions

0 _fillMissingData (package:web3dart/src/core/transaction_signer.dart:32:5)

#1 Web3Client.signTransaction (package:web3dart/src/core/client.dart:316:26) #2 Web3Client.sendTransaction (package:web3dart/src/core/client.dart:285:18) #3 ContractLinking.addData (package:population/contract_linking.dart:98:5) **This if condition have a problem.** ` if (client == null && (transaction.nonce == null || transaction.maxGas == null || loadChainIdFromNetwork) || (!transaction.isEIP1559 && gasPrice == null)) { throw ArgumentError('Client is required to perform network actions'); } if (!transaction.isEIP1559 && gasPrice == null) { gasPrice = await client!.getGasPrice(); } `
simolus3 commented 2 years ago

Can you post your call to sendTransaction? This may be an issue in your code as well.

sayhellotogithub commented 2 years ago

(!transaction.isEIP1559 && gasPrice == null) this condition is the same with below

if (!transaction.isEIP1559 && gasPrice == null) { gasPrice = await client!.getGasPrice(); }

so below can't run .

vinicentus commented 2 years ago

I'm getting this as well since upgrade to 2.3.2. The same code works when rolling back to 2.3.1.

thgehr commented 2 years ago

I'm getting this as well since upgrade to 2.3.2. The same code works when rolling back to 2.3.1.

Same here, my code works on version 2.3.1 but not on 2.3.2

tionx3na commented 2 years ago

Any update on this problem?

ludowkm commented 2 years ago

The above code snippet is normal because we need the client to retrieve more information for transaction if missing, i used it without any error

seungbok3240 commented 2 years ago

I'm getting this as well since upgrade to 2.3.2. The same code works when rolling back to 2.3.1.

Same here, my code works on version 2.3.1 but not on 2.3.2

my code do not works on version 2.3.1 and 2.3.2

vinicentus commented 2 years ago

Thank you for the fix @simolus3 🙂