Search in sources :

Example 6 with ResponseType

use of com.hederahashgraph.api.proto.java.ResponseType 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 7 with ResponseType

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

the class GetLiveHashAnswer method responseGiven.

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

Example 8 with ResponseType

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

the class GetStakersAnswer method responseGiven.

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

Example 9 with ResponseType

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

the class GetExecTimeAnswer method responseGiven.

@Override
public Response responseGiven(Query query, StateView view, ResponseCodeEnum validity, long cost) {
    var op = query.getNetworkGetExecutionTime();
    var response = NetworkGetExecutionTimeResponse.newBuilder();
    ResponseType type = op.getHeader().getResponseType();
    if (validity != OK) {
        response.setHeader(header(validity, type, cost));
    } else {
        if (type == COST_ANSWER) {
            response.setHeader(costAnswerHeader(OK, cost));
        } else {
            boolean failed = false;
            final List<Long> ans = new ArrayList<>();
            for (var txnId : op.getTransactionIdsList()) {
                final var execNanos = executionTimeTracker.getExecNanosIfPresentFor(txnId);
                if (execNanos != null) {
                    ans.add(execNanos);
                } else {
                    response.setHeader(answerOnlyHeader(INVALID_TRANSACTION_ID));
                    failed = true;
                    break;
                }
            }
            if (!failed) {
                response.addAllExecutionTimes(ans);
                response.setHeader(answerOnlyHeader(OK));
            }
        }
    }
    return Response.newBuilder().setNetworkGetExecutionTime(response).build();
}
Also used : ArrayList(java.util.ArrayList) ResponseType(com.hederahashgraph.api.proto.java.ResponseType)

Example 10 with ResponseType

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

the class GetAccountNftInfosAnswer method responseGiven.

@Override
public Response responseGiven(Query query, StateView view, ResponseCodeEnum validity, long cost) {
    TokenGetAccountNftInfosQuery op = query.getTokenGetAccountNftInfos();
    TokenGetAccountNftInfosResponse.Builder response = TokenGetAccountNftInfosResponse.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().setTokenGetAccountNftInfos(response).build();
}
Also used : TokenGetAccountNftInfosResponse(com.hederahashgraph.api.proto.java.TokenGetAccountNftInfosResponse) TokenGetAccountNftInfosQuery(com.hederahashgraph.api.proto.java.TokenGetAccountNftInfosQuery) ResponseType(com.hederahashgraph.api.proto.java.ResponseType)

Aggregations

ResponseType (com.hederahashgraph.api.proto.java.ResponseType)12 AccountID (com.hederahashgraph.api.proto.java.AccountID)1 ConsensusGetTopicInfoQuery (com.hederahashgraph.api.proto.java.ConsensusGetTopicInfoQuery)1 ConsensusGetTopicInfoResponse (com.hederahashgraph.api.proto.java.ConsensusGetTopicInfoResponse)1 ContractGetRecordsQuery (com.hederahashgraph.api.proto.java.ContractGetRecordsQuery)1 ContractGetRecordsResponse (com.hederahashgraph.api.proto.java.ContractGetRecordsResponse)1 CryptoGetInfoQuery (com.hederahashgraph.api.proto.java.CryptoGetInfoQuery)1 CryptoGetInfoResponse (com.hederahashgraph.api.proto.java.CryptoGetInfoResponse)1 CryptoGetLiveHashQuery (com.hederahashgraph.api.proto.java.CryptoGetLiveHashQuery)1 CryptoGetLiveHashResponse (com.hederahashgraph.api.proto.java.CryptoGetLiveHashResponse)1 CryptoGetStakersQuery (com.hederahashgraph.api.proto.java.CryptoGetStakersQuery)1 CryptoGetStakersResponse (com.hederahashgraph.api.proto.java.CryptoGetStakersResponse)1 FileGetContentsResponse (com.hederahashgraph.api.proto.java.FileGetContentsResponse)1 FileGetInfoResponse (com.hederahashgraph.api.proto.java.FileGetInfoResponse)1 GetBySolidityIDQuery (com.hederahashgraph.api.proto.java.GetBySolidityIDQuery)1 GetBySolidityIDResponse (com.hederahashgraph.api.proto.java.GetBySolidityIDResponse)1 TokenGetAccountNftInfosQuery (com.hederahashgraph.api.proto.java.TokenGetAccountNftInfosQuery)1 TokenGetAccountNftInfosResponse (com.hederahashgraph.api.proto.java.TokenGetAccountNftInfosResponse)1 TokenGetNftInfosQuery (com.hederahashgraph.api.proto.java.TokenGetNftInfosQuery)1 TokenGetNftInfosResponse (com.hederahashgraph.api.proto.java.TokenGetNftInfosResponse)1