Search in sources :

Example 1 with HapiGetAccountInfo

use of com.hedera.services.bdd.spec.queries.crypto.HapiGetAccountInfo in project hedera-services by hashgraph.

the class HapiCryptoUpdate method lookupInfo.

private CryptoGetInfoResponse.AccountInfo lookupInfo(HapiApiSpec spec) throws Throwable {
    HapiGetAccountInfo subOp = getAccountInfo(account).noLogging();
    Optional<Throwable> error = subOp.execFor(spec);
    if (error.isPresent()) {
        if (!loggingOff) {
            log.warn("Unable to look up current account info!", error.get());
        }
        throw error.get();
    }
    return subOp.getResponse().getCryptoGetInfo().getAccountInfo();
}
Also used : HapiGetAccountInfo(com.hedera.services.bdd.spec.queries.crypto.HapiGetAccountInfo)

Example 2 with HapiGetAccountInfo

use of com.hedera.services.bdd.spec.queries.crypto.HapiGetAccountInfo in project hedera-services by hashgraph.

the class HapiTokenAssociate method lookupExpiry.

private long lookupExpiry(HapiApiSpec spec) throws Throwable {
    if (!spec.registry().hasContractId(account)) {
        HapiGetAccountInfo subOp = getAccountInfo(account).noLogging();
        Optional<Throwable> error = subOp.execFor(spec);
        if (error.isPresent()) {
            if (!loggingOff) {
                log.warn("Unable to look up current info for " + HapiPropertySource.asAccountString(spec.registry().getAccountID(account)), error.get());
            }
            throw error.get();
        }
        return subOp.getResponse().getCryptoGetInfo().getAccountInfo().getExpirationTime().getSeconds();
    } else {
        HapiGetContractInfo subOp = getContractInfo(account).noLogging();
        Optional<Throwable> error = subOp.execFor(spec);
        if (error.isPresent()) {
            if (!loggingOff) {
                log.warn("Unable to look up current info for " + HapiPropertySource.asContractString(spec.registry().getContractId(account)), error.get());
            }
            throw error.get();
        }
        return subOp.getResponse().getContractGetInfo().getContractInfo().getExpirationTime().getSeconds();
    }
}
Also used : HapiGetContractInfo(com.hedera.services.bdd.spec.queries.contract.HapiGetContractInfo) HapiGetAccountInfo(com.hedera.services.bdd.spec.queries.crypto.HapiGetAccountInfo)

Aggregations

HapiGetAccountInfo (com.hedera.services.bdd.spec.queries.crypto.HapiGetAccountInfo)2 HapiGetContractInfo (com.hedera.services.bdd.spec.queries.contract.HapiGetContractInfo)1