Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting transactions with eth_getBlockByNumber #2

Open
alexeyinkin opened this issue Feb 24, 2022 · 0 comments
Open

Getting transactions with eth_getBlockByNumber #2

alexeyinkin opened this issue Feb 24, 2022 · 0 comments

Comments

@alexeyinkin
Copy link

eth_getBlockByNumber returns either transaction hashes or full transactions depending on the second boolean argument. For this we have Web3Client.getBlockInformation that also has an optional boolean argument which is sent but the transactions from the response are never parsed.

I need to parse them and so to add this functionality. We need to decide on Dart data structure because it is a bad practice to use List<dynamic> for this.

I suggest to:

  1. Subclass BlockInformation with BlockInformationWithTransactions and BlockInformationWithTransactionHashes. The subclasses would have transactions field of corresponding list type. The base class would not have this field.

  2. Add 2 methods to Web3Client: getBlockByNumberWithTransactions, getBlockByNumberWithTransactionHashes. They would return the corresponding block types. Their names are chosen to more closely match the RPC names. They would accept BlockNum as the first argument instead of String that getBlockInformation currently accepts, this is for consistency across other methods and for ease of calling.

  3. Deprecate the existing getBlockInformation method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant