Search in sources :

Example 31 with Response

use of com.hederahashgraph.api.proto.java.Response 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);
}
Also used : Response(com.hederahashgraph.api.proto.java.Response) Query(com.hederahashgraph.api.proto.java.Query) ContractGetInfoQuery(com.hederahashgraph.api.proto.java.ContractGetInfoQuery)

Example 32 with Response

use of com.hederahashgraph.api.proto.java.Response 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);
}
Also used : Response(com.hederahashgraph.api.proto.java.Response) ContractGetRecordsQuery(com.hederahashgraph.api.proto.java.ContractGetRecordsQuery) Query(com.hederahashgraph.api.proto.java.Query)

Example 33 with Response

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

the class HapiGetExecTime method lookupCostWith.

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

Example 34 with Response

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

the class HapiGetFileInfo method lookupCostWith.

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

Example 35 with Response

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

the class ContractCallLocalAnswerTest method noCopyPasteErrors.

@Test
void noCopyPasteErrors() throws Throwable {
    // given:
    Query query = validQuery(COST_ANSWER, fee);
    // when:
    Response response = subject.responseGiven(query, view, INSUFFICIENT_TX_FEE, fee);
    // then:
    assertEquals(HederaFunctionality.ContractCallLocal, subject.canonicalFunction());
    assertEquals(paymentTxn, subject.extractPaymentFrom(query).get().getSignedTxnWrapper());
    assertTrue(subject.needsAnswerOnlyCost(query));
    assertFalse(subject.requiresNodePayment(query));
    assertEquals(INSUFFICIENT_TX_FEE, subject.extractValidityFrom(response));
}
Also used : Response(com.hederahashgraph.api.proto.java.Response) ContractCallLocalResponse(com.hederahashgraph.api.proto.java.ContractCallLocalResponse) Query(com.hederahashgraph.api.proto.java.Query) ContractCallLocalQuery(com.hederahashgraph.api.proto.java.ContractCallLocalQuery) Test(org.junit.jupiter.api.Test)

Aggregations

Response (com.hederahashgraph.api.proto.java.Response)114 Query (com.hederahashgraph.api.proto.java.Query)96 Test (org.junit.jupiter.api.Test)87 FileGetInfoResponse (com.hederahashgraph.api.proto.java.FileGetInfoResponse)9 ByteString (com.google.protobuf.ByteString)8 ContractCallLocalQuery (com.hederahashgraph.api.proto.java.ContractCallLocalQuery)8 TokenGetNftInfoQuery (com.hederahashgraph.api.proto.java.TokenGetNftInfoQuery)8 TokenGetNftInfoResponse (com.hederahashgraph.api.proto.java.TokenGetNftInfoResponse)8 TransactionGetReceiptResponse (com.hederahashgraph.api.proto.java.TransactionGetReceiptResponse)8 ContractCallLocalResponse (com.hederahashgraph.api.proto.java.ContractCallLocalResponse)7 ContractGetInfoQuery (com.hederahashgraph.api.proto.java.ContractGetInfoQuery)7 ContractGetInfoResponse (com.hederahashgraph.api.proto.java.ContractGetInfoResponse)7 NetworkGetExecutionTimeQuery (com.hederahashgraph.api.proto.java.NetworkGetExecutionTimeQuery)7 NetworkGetExecutionTimeResponse (com.hederahashgraph.api.proto.java.NetworkGetExecutionTimeResponse)7 ResponseCodeEnum (com.hederahashgraph.api.proto.java.ResponseCodeEnum)7 ScheduleGetInfoQuery (com.hederahashgraph.api.proto.java.ScheduleGetInfoQuery)7 ScheduleGetInfoResponse (com.hederahashgraph.api.proto.java.ScheduleGetInfoResponse)7 TokenGetInfoQuery (com.hederahashgraph.api.proto.java.TokenGetInfoQuery)7 TokenGetInfoResponse (com.hederahashgraph.api.proto.java.TokenGetInfoResponse)7 HashMap (java.util.HashMap)7