Search in sources :

Example 1 with TransactionGetRecordQuery

use of com.hederahashgraph.api.proto.java.TransactionGetRecordQuery in project hedera-services by hashgraph.

the class HapiGetTxnRecord method getRecordQuery.

private Query getRecordQuery(HapiApiSpec spec, Transaction payment, boolean costOnly) {
    TransactionID txnId = useDefaultTxnId ? defaultTxnId : explicitTxnId.orElseGet(() -> spec.registry().getTxnId(txn));
    if (lookupScheduledFromRegistryId) {
        txnId = spec.registry().getTxnId(correspondingScheduledTxnId(creationName.get()));
    } else {
        if (scheduled) {
            txnId = txnId.toBuilder().setScheduled(true).build();
        }
    }
    QueryHeader header;
    if (costOnly && omitPaymentHeaderOnCostAnswer) {
        header = QueryHeader.newBuilder().setResponseType(COST_ANSWER).build();
    } else {
        header = costOnly ? answerCostHeader(payment) : answerHeader(payment);
    }
    TransactionGetRecordQuery getRecordQuery = TransactionGetRecordQuery.newBuilder().setHeader(header).setTransactionID(txnId).setIncludeDuplicates(requestDuplicates).setIncludeChildRecords(requestChildRecords).build();
    return Query.newBuilder().setTransactionGetRecord(getRecordQuery).build();
}
Also used : QueryHeader(com.hederahashgraph.api.proto.java.QueryHeader) TransactionGetRecordQuery(com.hederahashgraph.api.proto.java.TransactionGetRecordQuery) TransactionID(com.hederahashgraph.api.proto.java.TransactionID)

Aggregations

QueryHeader (com.hederahashgraph.api.proto.java.QueryHeader)1 TransactionGetRecordQuery (com.hederahashgraph.api.proto.java.TransactionGetRecordQuery)1 TransactionID (com.hederahashgraph.api.proto.java.TransactionID)1