feat: add full support of Query API (pre-rc.20
)
#201
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Queries
Context
Existing Query API implementation in Iroha JS is not complete:
query_id
andcursor
retrieve more results.Solution
The new API looks like this:
The
response
is a enumeration of possible query responses:Iter
for iterable query response. This is a live query, and it contains a handle to fetch subsequent batches of data. As in the example above, there is a helper method.all(): Promise<Value[]>
that simply fetches all batches and collects them into a single array.Value
for singular query response. This is returned by queries that return only a single result.Failure
with decodedValidationFail
reason.computeTransactionHash
While investigating #200, I found that the transaction hash emitted by pipeline events is different from the hash used for querying transactions: the first is
HashOf<TransactionPayload>
, and the second isHashOf<SignedTransaction>
.To reduce this ambiguity for SDK users, I soft-deprecated
computeTransactionHash
and added new helpers:computeTransactionPayloadHash
andcomputeSignedTransactionHash
.