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();
}
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();
}
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();
}
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();
}
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();
}
Aggregations