Search in sources :

Example 76 with Query

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

the class HapiGetTokenNftInfo method lookupCostWith.

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

Example 77 with Query

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

the class HapiGetTokenNftInfo method submitWith.

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

Example 78 with Query

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

the class HapiGetTokenNftInfos method lookupCostWith.

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

Example 79 with Query

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

the class HapiGetTokenNftInfos method submitWith.

@Override
protected void submitWith(HapiApiSpec spec, Transaction payment) throws Throwable {
    Query query = getTokenNftInfosQuery(spec, payment, false);
    response = spec.clients().getTokenSvcStub(targetNodeFor(spec), useTls).getTokenNftInfos(query);
    if (verboseLoggingOn) {
        log.info("NftInfo for '" + token + "': ");
        response.getTokenGetNftInfos().getNftsList().forEach(nft -> log.info(nft.toString()));
    }
}
Also used : Query(com.hederahashgraph.api.proto.java.Query) TokenGetNftInfosQuery(com.hederahashgraph.api.proto.java.TokenGetNftInfosQuery)

Example 80 with Query

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

the class HapiGetAccountNftInfos method submitWith.

@Override
protected void submitWith(HapiApiSpec spec, Transaction payment) {
    Query query = getAccountNftInfosQuery(spec, payment, false);
    response = spec.clients().getTokenSvcStub(targetNodeFor(spec), useTls).getAccountNftInfos(query);
    if (verboseLoggingOn) {
        StringBuilder information = new StringBuilder("Nft information for '" + account + "': \n");
        List<TokenNftInfo> nfts = response.getTokenGetAccountNftInfos().getNftsList();
        information.append(Strings.join(nfts, '\n'));
        log.info(information.toString());
    }
}
Also used : TokenNftInfo(com.hederahashgraph.api.proto.java.TokenNftInfo) Query(com.hederahashgraph.api.proto.java.Query) TokenGetAccountNftInfosQuery(com.hederahashgraph.api.proto.java.TokenGetAccountNftInfosQuery)

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