simolus3 / web3dart

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

custom _jsonRpc #197

Closed ttb-inc closed 2 years ago

ttb-inc commented 2 years ago

Hi, I want to use custom _jsonRpc of Web3Client class. So, I want to set _operations, _filters member after Web3Client.custom(...). Is there any way?

Thank you.

simolus3 commented 2 years ago

At the moment there isn't, but we could consider making _jsonRpc public. Just out of interest, what do you need it for? If it's a public RPC call not yet supported by web3dart, I'd appreciate a PR or feedback adding that to this library.

ttb-inc commented 2 years ago

Thank you for answer. Some provider urls may require an option when making a url request. For example, add a value to the header. So, I want to override the JsonRPC class and use it. It can be used in Web3Client.custom(), but it seems that _operations and _filters members need to be set. Thank you.

simolus3 commented 2 years ago

For example, add a value to the header.

You can also do this by writing a custom BaseClient from the http package and then pass that to the regular Web3Client constructor.

It can be used in Web3Client.custom(), but it seems that _operations and _filters members need to be set.

Good catch! I've fixed this in 3889857d479930b4d0ebf3c4c89fcd3014b3151e. Can you try that version and let me know whether it fixes your problem? If it does, I can release it to pub.

ttb-inc commented 2 years ago

Thank you for your help. I have not yet applied, but I am the code I want. :) I LOVE it very much. Thank you.

ttb-inc commented 2 years ago

web3dart: git: url: git://github.com/simolus3/web3dart.git

I checked. It works GREAT. Thank you very much.

simolus3 commented 2 years ago

I've just published version 2.3.1 which contains the fix. Thanks for the report!