-
Notifications
You must be signed in to change notification settings - Fork 134
Closed
Labels
discussionLet's figure out an approachLet's figure out an approachenhancementNew feature or requestNew feature or request
Description
public final class QueryResponse<T> {
// This field is null-able because not all queries require a payment
// e.g. `AccountBalanceQuery` and `TransactionReceiptQuery`
// and for those queries the payment is an empty protobuf `Transaction`
@Nullable
public final TransactionResponse paymentTransaction;
// This field will be 0 for free queries
public final Hbar cost;
// The ID of the node that returned the response
public final AccountId nodeId;
// The response for the query, e.g. `AccountInfo`, `AccountBalance`, `Uint8Array`, `List<TransactionRecord>`
public final T response;
}Reason for implementing this type is it doesn't make sense that you can't access the node, cost, or payment transaction itself for a query you've executed. I think it'd benefit users to be able to access this information. This would also allow a user to get the receipt for a payment transaction if that's something they want to do.
Another benefit is extensibility. Having an SDK owned type be returned from all queries would allow us to extend the query responses without breaking changes. Unlike right now where FileContentsQuery, ContractBytecodeQuery, AccountRecordsQuery, and AccountStakersQuery return non-extensible types.
Metadata
Metadata
Assignees
Labels
discussionLet's figure out an approachLet's figure out an approachenhancementNew feature or requestNew feature or request