onflow / onflow/flow-cli

Refactor similar types for query

Open
#1,020 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Improvement
Dominant language
Go
Stars
209
Forks
87
Avg merge
1d 17h
Merged PRs (30d)
3

Description

We should make sure we don't define similar types, one example is BlockQuery and ScriptQuery. They can both be represented by BlockQuery. Another maybe better approach would be to introduce builder parameters. So we could call a function like so: ExecuteScript(ctx, script, AtHeight(100)) or ExecuteScript(ctx, script) (for latest).

The other problem with the current implementation no matter the above-taken approach is that it doesn't provide sensible defaults. That should be improved, and with functional arguments can be done as in the example.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in flowkit/flowkit.go, at BlockQuery and ScriptQuery, and trace their query call sites. Compare consolidating the types with introducing builder or functional parameters, including the requested latest-value defaults. Done means similar query types are no longer duplicated and query execution has sensible defaults, but the issue does not identify tests to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.