use of com.hedera.services.bdd.spec.queries.contract.HapiGetContractInfo in project hedera-services by hashgraph.
the class TxnUtils method currContractExpiry.
public static Timestamp currContractExpiry(String contract, HapiApiSpec spec) throws Throwable {
HapiGetContractInfo subOp = getContractInfo(contract).noLogging();
Optional<Throwable> error = subOp.execFor(spec);
if (error.isPresent()) {
log.error("Unable to look up current expiration timestamp of contract 0.0." + spec.registry().getContractId(contract).getContractNum());
throw error.get();
}
return subOp.getResponse().getContractGetInfo().getContractInfo().getExpirationTime();
}
use of com.hedera.services.bdd.spec.queries.contract.HapiGetContractInfo 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();
}
}
Aggregations