use of com.hederahashgraph.api.proto.java.Query in project hedera-services by hashgraph.
the class HapiContractCallLocal method submitWith.
@Override
protected void submitWith(HapiApiSpec spec, Transaction payment) {
Query query = getContractCallLocal(spec, payment, false);
response = spec.clients().getScSvcStub(targetNodeFor(spec), useTls).contractCallLocalMethod(query);
if (verboseLoggingOn) {
log.info(spec.logPrefix() + this + " result = " + response.getContractCallLocal().getFunctionResult());
}
final var rawResult = response.getContractCallLocal().getFunctionResult().getContractCallResult();
saveResultToEntry.ifPresent(s -> spec.registry().saveBytes(s, rawResult));
if (typedResultsObs.isPresent()) {
final var function = CallTransaction.Function.fromJsonInterface(abi);
final var typedResult = function.decodeResult(rawResult.toByteArray());
typedResultsObs.get().accept(typedResult);
}
}
use of com.hederahashgraph.api.proto.java.Query in project hedera-services by hashgraph.
the class HapiGetContractBytecode method submitWith.
@Override
protected void submitWith(HapiApiSpec spec, Transaction payment) throws Throwable {
Query query = getContractBytecodeQuery(spec, payment, false);
response = spec.clients().getScSvcStub(targetNodeFor(spec), useTls).contractGetBytecode(query);
final var code = response.getContractGetBytecodeResponse().getBytecode();
saveResultToEntry.ifPresent(s -> spec.registry().saveBytes(s, code));
bytecodeObs.ifPresent(obs -> obs.accept(code.toByteArray()));
}
use of com.hederahashgraph.api.proto.java.Query in project hedera-services by hashgraph.
the class HapiGetContractInfo method lookupCostWith.
@Override
protected long lookupCostWith(HapiApiSpec spec, Transaction payment) throws Throwable {
Query query = getContractInfoQuery(spec, payment, true);
Response response = spec.clients().getScSvcStub(targetNodeFor(spec), useTls).getContractInfo(query);
return costFrom(response);
}
use of com.hederahashgraph.api.proto.java.Query in project hedera-services by hashgraph.
the class HapiGetContractRecords method submitWith.
@Override
protected void submitWith(HapiApiSpec spec, Transaction payment) throws Throwable {
Query query = getContractRecordsQuery(spec, payment, false);
response = spec.clients().getScSvcStub(targetNodeFor(spec), useTls).getTxRecordByContractID(query);
List<TransactionRecord> records = response.getContractGetRecordsResponse().getRecordsList();
if (verboseLoggingOn) {
if (customLog.isPresent()) {
customLog.get().accept(log, records);
} else {
log.info(records);
}
}
if (snapshotDirPath.isPresent()) {
saveSnapshots(spec, records);
}
if (saveRecordNum.isPresent()) {
spec.registry().saveIntValue(saveRecordNum.get(), records.size());
}
if (expectationsDirPath.isPresent()) {
checkExpectations(spec, records);
}
}
use of com.hederahashgraph.api.proto.java.Query in project hedera-services by hashgraph.
the class HapiGetContractRecords method lookupCostWith.
@Override
protected long lookupCostWith(HapiApiSpec spec, Transaction payment) throws Throwable {
Query query = getContractRecordsQuery(spec, payment, true);
Response response = spec.clients().getScSvcStub(targetNodeFor(spec), useTls).getTxRecordByContractID(query);
return costFrom(response);
}
Aggregations