Search in sources :

Example 86 with Query

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

the class HapiGetContractBytecode method lookupCostWith.

@Override
protected long lookupCostWith(HapiApiSpec spec, Transaction payment) throws Throwable {
    Query query = getContractBytecodeQuery(spec, payment, true);
    Response response = spec.clients().getScSvcStub(targetNodeFor(spec), useTls).contractGetBytecode(query);
    return costFrom(response);
}
Also used : Response(com.hederahashgraph.api.proto.java.Response) Query(com.hederahashgraph.api.proto.java.Query) ContractGetBytecodeQuery(com.hederahashgraph.api.proto.java.ContractGetBytecodeQuery)

Example 87 with Query

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

the class HapiGetContractInfo method submitWith.

@Override
protected void submitWith(HapiApiSpec spec, Transaction payment) throws Throwable {
    Query query = getContractInfoQuery(spec, payment, false);
    response = spec.clients().getScSvcStub(targetNodeFor(spec), useTls).getContractInfo(query);
    ContractInfo contractInfo = response.getContractGetInfo().getContractInfo();
    if (verboseLoggingOn) {
        log.info("Info: " + contractInfo);
    }
    if (contractInfoPath.isPresent()) {
        saveContractInfo(spec, contractInfo);
    }
    if (validateDirPath.isPresent()) {
        validateAgainst(spec, contractInfo);
    }
    if (registryEntry.isPresent()) {
        spec.registry().saveContractInfo(registryEntry.get(), contractInfo);
    }
}
Also used : ContractInfo(com.hederahashgraph.api.proto.java.ContractGetInfoResponse.ContractInfo) Query(com.hederahashgraph.api.proto.java.Query) ContractGetInfoQuery(com.hederahashgraph.api.proto.java.ContractGetInfoQuery)

Example 88 with Query

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

the class HapiGetAccountInfo method lookupCostWith.

@Override
protected long lookupCostWith(HapiApiSpec spec, Transaction payment) throws Throwable {
    Query query = getAccountInfoQuery(spec, payment, true);
    Response response = spec.clients().getCryptoSvcStub(targetNodeFor(spec), useTls).getAccountInfo(query);
    return costFrom(response);
}
Also used : Response(com.hederahashgraph.api.proto.java.Response) CryptoGetInfoQuery(com.hederahashgraph.api.proto.java.CryptoGetInfoQuery) Query(com.hederahashgraph.api.proto.java.Query)

Example 89 with Query

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

the class HapiGetAccountRecords method lookupCostWith.

@Override
protected long lookupCostWith(HapiApiSpec spec, Transaction payment) throws Throwable {
    Query query = getRecordsQuery(spec, payment, true);
    Response response = spec.clients().getCryptoSvcStub(targetNodeFor(spec), useTls).getAccountRecords(query);
    return costFrom(response);
}
Also used : Response(com.hederahashgraph.api.proto.java.Response) Query(com.hederahashgraph.api.proto.java.Query) CryptoGetAccountRecordsQuery(com.hederahashgraph.api.proto.java.CryptoGetAccountRecordsQuery)

Example 90 with Query

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

the class HapiGetFileContents method lookupCostWith.

@Override
protected long lookupCostWith(HapiApiSpec spec, Transaction payment) throws Throwable {
    Query query = getFileContentQuery(spec, payment, true);
    Response response = spec.clients().getFileSvcStub(targetNodeFor(spec), useTls).getFileContent(query);
    return costFrom(response);
}
Also used : Response(com.hederahashgraph.api.proto.java.Response) Query(com.hederahashgraph.api.proto.java.Query) FileGetContentsQuery(com.hederahashgraph.api.proto.java.FileGetContentsQuery)

Aggregations

Query (com.hederahashgraph.api.proto.java.Query)152 Test (org.junit.jupiter.api.Test)108 Response (com.hederahashgraph.api.proto.java.Response)95 ResponseCodeEnum (com.hederahashgraph.api.proto.java.ResponseCodeEnum)24 ContractCallLocalQuery (com.hederahashgraph.api.proto.java.ContractCallLocalQuery)13 TokenGetNftInfoQuery (com.hederahashgraph.api.proto.java.TokenGetNftInfoQuery)13 ContractGetInfoQuery (com.hederahashgraph.api.proto.java.ContractGetInfoQuery)11 ByteString (com.google.protobuf.ByteString)10 ConsensusGetTopicInfoQuery (com.hederahashgraph.api.proto.java.ConsensusGetTopicInfoQuery)10 ScheduleGetInfoQuery (com.hederahashgraph.api.proto.java.ScheduleGetInfoQuery)10 TokenGetInfoQuery (com.hederahashgraph.api.proto.java.TokenGetInfoQuery)10 CryptoGetAccountBalanceQuery (com.hederahashgraph.api.proto.java.CryptoGetAccountBalanceQuery)9 CryptoGetInfoQuery (com.hederahashgraph.api.proto.java.CryptoGetInfoQuery)9 FileGetInfoQuery (com.hederahashgraph.api.proto.java.FileGetInfoQuery)8 NetworkGetExecutionTimeQuery (com.hederahashgraph.api.proto.java.NetworkGetExecutionTimeQuery)8 HashMap (java.util.HashMap)8 ContractCallLocalResponse (com.hederahashgraph.api.proto.java.ContractCallLocalResponse)7 ContractGetBytecodeQuery (com.hederahashgraph.api.proto.java.ContractGetBytecodeQuery)7 FileGetContentsQuery (com.hederahashgraph.api.proto.java.FileGetContentsQuery)7 FileGetInfoResponse (com.hederahashgraph.api.proto.java.FileGetInfoResponse)7