Search in sources :

Example 1 with ContractGetRecordsQuery

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

the class GetContractRecordsAnswer method responseGiven.

@Override
public Response responseGiven(Query query, StateView view, ResponseCodeEnum validity, long cost) {
    ContractGetRecordsQuery op = query.getContractGetRecords();
    ContractGetRecordsResponse.Builder response = ContractGetRecordsResponse.newBuilder();
    ResponseType type = op.getHeader().getResponseType();
    if (type == COST_ANSWER) {
        response.setHeader(costAnswerHeader(NOT_SUPPORTED, 0L));
    } else {
        response.setHeader(answerOnlyHeader(NOT_SUPPORTED));
    }
    return Response.newBuilder().setContractGetRecordsResponse(response).build();
}
Also used : ContractGetRecordsResponse(com.hederahashgraph.api.proto.java.ContractGetRecordsResponse) ContractGetRecordsQuery(com.hederahashgraph.api.proto.java.ContractGetRecordsQuery) ResponseType(com.hederahashgraph.api.proto.java.ResponseType)

Example 2 with ContractGetRecordsQuery

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

the class HapiGetContractRecords method getContractRecordsQuery.

private Query getContractRecordsQuery(HapiApiSpec spec, Transaction payment, boolean costOnly) {
    var id = TxnUtils.asContractId(contract, spec);
    ContractGetRecordsQuery opQuery = ContractGetRecordsQuery.newBuilder().setHeader(costOnly ? answerCostHeader(payment) : answerHeader(payment)).setContractID(id).build();
    return Query.newBuilder().setContractGetRecords(opQuery).build();
}
Also used : ContractGetRecordsQuery(com.hederahashgraph.api.proto.java.ContractGetRecordsQuery)

Aggregations

ContractGetRecordsQuery (com.hederahashgraph.api.proto.java.ContractGetRecordsQuery)2 ContractGetRecordsResponse (com.hederahashgraph.api.proto.java.ContractGetRecordsResponse)1 ResponseType (com.hederahashgraph.api.proto.java.ResponseType)1