Search in sources :

Example 91 with Query

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

the class HapiGetFileInfo method submitWith.

@Override
protected void submitWith(HapiApiSpec spec, Transaction payment) throws Throwable {
    Query query = getFileInfoQuery(spec, payment, false);
    response = spec.clients().getFileSvcStub(targetNodeFor(spec), useTls).getFileInfo(query);
    if (verboseLoggingOn) {
        log.info("Info for file '" + file + "': " + response.getFileGetInfo());
    }
    if (saveFileInfoToReg.isPresent()) {
        spec.registry().saveFileInfo(saveFileInfoToReg.get(), response.getFileGetInfo().getFileInfo());
    }
}
Also used : Query(com.hederahashgraph.api.proto.java.Query) FileGetInfoQuery(com.hederahashgraph.api.proto.java.FileGetInfoQuery)

Example 92 with Query

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

the class HapiTxnOp method resolvedStatusOfSubmission.

private ResponseCodeEnum resolvedStatusOfSubmission(HapiApiSpec spec) throws Throwable {
    long delayMS = spec.setup().statusPreResolvePauseMs();
    long elapsedMS = System.currentTimeMillis() - submitTime;
    if (elapsedMS <= delayMS) {
        pause(delayMS - elapsedMS);
    }
    long beginWait = Instant.now().toEpochMilli();
    Query receiptQuery = txnReceiptQueryFor(extractTxnId(txnSubmitted));
    do {
        Response response = statusResponse(spec, receiptQuery);
        lastReceipt = response.getTransactionGetReceipt().getReceipt();
        ResponseCodeEnum statusNow = lastReceipt.getStatus();
        if (acceptAnyStatus) {
            expectedStatus = Optional.of(statusNow);
            return statusNow;
        } else if (statusNow != UNKNOWN) {
            if (acceptAnyKnownStatus) {
                expectedStatus = Optional.of(statusNow);
            }
            return statusNow;
        }
        pause(spec.setup().statusWaitSleepMs());
    } while ((Instant.now().toEpochMilli() - beginWait) < spec.setup().statusWaitTimeoutMs());
    return UNKNOWN;
}
Also used : TransactionGetReceiptResponse(com.hederahashgraph.api.proto.java.TransactionGetReceiptResponse) TransactionResponse(com.hederahashgraph.api.proto.java.TransactionResponse) Response(com.hederahashgraph.api.proto.java.Response) ResponseCodeEnum(com.hederahashgraph.api.proto.java.ResponseCodeEnum) Query(com.hederahashgraph.api.proto.java.Query)

Example 93 with Query

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

the class HapiGetAccountNftInfos method lookupCostWith.

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

Example 94 with Query

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

the class HapiGetTokenInfo method submitWith.

@Override
protected void submitWith(HapiApiSpec spec, Transaction payment) {
    Query query = getTokenInfoQuery(spec, payment, false);
    response = spec.clients().getTokenSvcStub(targetNodeFor(spec), useTls).getTokenInfo(query);
    if (verboseLoggingOn) {
        log.info("Info for '" + token + "': " + response.getTokenGetInfo().getTokenInfo());
    }
}
Also used : TokenGetInfoQuery(com.hederahashgraph.api.proto.java.TokenGetInfoQuery) Query(com.hederahashgraph.api.proto.java.Query)

Example 95 with Query

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

the class HapiGetTokenInfo method lookupCostWith.

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

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