Search in sources :

Example 81 with Query

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

the class HapiGetScheduleInfo method submitWith.

@Override
protected void submitWith(HapiApiSpec spec, Transaction payment) throws Throwable {
    Query query = getScheduleInfoQuery(spec, payment, false);
    response = spec.clients().getScheduleSvcStub(targetNodeFor(spec), useTls).getScheduleInfo(query);
    if (verboseLoggingOn) {
        log.info("Info for '" + schedule + "': " + response.getScheduleGetInfo().getScheduleInfo());
    }
}
Also used : Query(com.hederahashgraph.api.proto.java.Query) ScheduleGetInfoQuery(com.hederahashgraph.api.proto.java.ScheduleGetInfoQuery)

Example 82 with Query

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

the class HapiGetVersionInfo method submitWith.

@Override
protected void submitWith(HapiApiSpec spec, Transaction payment) {
    Query query = getVersionInfoQuery(spec, payment, false);
    response = spec.clients().getNetworkSvcStub(targetNodeFor(spec), useTls).getVersionInfo(query);
    var info = response.getNetworkGetVersionInfo();
    if (verboseLoggingOn) {
        log.info("Versions :: HAPI protobufs @ " + asReadable(info.getHapiProtoVersion()) + ", Hedera Services @ " + asReadable(info.getHederaServicesVersion()));
    }
    if (yahcliLogger) {
        COMMON_MESSAGES.info("Versions :: HAPI protobufs @ " + asReadable(info.getHapiProtoVersion()) + ", Hedera Services @ " + asReadable(info.getHederaServicesVersion()));
    }
}
Also used : Query(com.hederahashgraph.api.proto.java.Query) NetworkGetVersionInfoQuery(com.hederahashgraph.api.proto.java.NetworkGetVersionInfoQuery)

Example 83 with Query

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

the class HapiGetVersionInfo method lookupCostWith.

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

Example 84 with Query

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

the class UsageBasedFeeCalculatorTest method setup.

@BeforeEach
private void setup() throws Throwable {
    view = mock(StateView.class);
    query = mock(Query.class);
    payerKey = complexKey.asJKey();
    exchange = mock(HbarCentExchange.class);
    signedTxn = newSignedCryptoCreate().balance(balance).payerKt(complexKey).txnValidStart(at).get();
    accessor = new SignedTxnAccessor(signedTxn);
    usagePrices = mock(UsagePricesProvider.class);
    given(usagePrices.activePrices(accessor)).willReturn(currentPrices);
    correctOpEstimator = mock(TxnResourceUsageEstimator.class);
    incorrectOpEstimator = mock(TxnResourceUsageEstimator.class);
    correctQueryEstimator = mock(QueryResourceUsageEstimator.class);
    incorrectQueryEstimator = mock(QueryResourceUsageEstimator.class);
    autoRenewCalcs = mock(AutoRenewCalcs.class);
    pricedUsageCalculator = mock(PricedUsageCalculator.class);
    txnUsageEstimators = (Map<HederaFunctionality, List<TxnResourceUsageEstimator>>) mock(Map.class);
    subject = new UsageBasedFeeCalculator(autoRenewCalcs, exchange, mock(AutoCreationLogic.class), usagePrices, new NestedMultiplierSource(), pricedUsageCalculator, Set.of(incorrectQueryEstimator, correctQueryEstimator), txnUsageEstimators);
}
Also used : HederaFunctionality(com.hederahashgraph.api.proto.java.HederaFunctionality) Query(com.hederahashgraph.api.proto.java.Query) StateView(com.hedera.services.context.primitives.StateView) SignedTxnAccessor(com.hedera.services.utils.SignedTxnAccessor) HbarCentExchange(com.hedera.services.fees.HbarCentExchange) List(java.util.List) PricedUsageCalculator(com.hedera.services.fees.calculation.utils.PricedUsageCalculator) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 85 with Query

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

the class HapiGetTopicInfo method lookupCostWith.

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

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