Search in sources :

Example 1 with SystemDelete

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

the class HapiSysDelete method opBodyDef.

@Override
protected Consumer<TransactionBody.Builder> opBodyDef(HapiApiSpec spec) throws Throwable {
    if (file.isPresent() && contract.isPresent()) {
        Assertions.fail("Ambiguous SystemDelete---both file and contract present!");
    }
    SystemDeleteTransactionBody opBody = spec.txns().<SystemDeleteTransactionBody, SystemDeleteTransactionBody.Builder>body(SystemDeleteTransactionBody.class, b -> {
        newExpiry.ifPresent(l -> b.setExpirationTime(TimestampSeconds.newBuilder().setSeconds(l)));
        file.ifPresent(n -> b.setFileID(asFileId(n, spec)));
        contract.ifPresent(n -> b.setContractID(asContractId(n, spec)));
    });
    return b -> b.setSystemDelete(opBody);
}
Also used : Transaction(com.hederahashgraph.api.proto.java.Transaction) SystemDeleteTransactionBody(com.hederahashgraph.api.proto.java.SystemDeleteTransactionBody) TxnUtils.asFileId(com.hedera.services.bdd.spec.transactions.TxnUtils.asFileId) SystemDelete(com.hederahashgraph.api.proto.java.HederaFunctionality.SystemDelete) HapiTxnOp(com.hedera.services.bdd.spec.transactions.HapiTxnOp) MoreObjects(com.google.common.base.MoreObjects) Function(java.util.function.Function) Consumer(java.util.function.Consumer) OptionalLong(java.util.OptionalLong) TransactionBody(com.hederahashgraph.api.proto.java.TransactionBody) HederaFunctionality(com.hederahashgraph.api.proto.java.HederaFunctionality) Assertions(org.junit.jupiter.api.Assertions) Optional(java.util.Optional) TransactionResponse(com.hederahashgraph.api.proto.java.TransactionResponse) TimestampSeconds(com.hederahashgraph.api.proto.java.TimestampSeconds) HapiApiSpec(com.hedera.services.bdd.spec.HapiApiSpec) TxnUtils.asContractId(com.hedera.services.bdd.spec.transactions.TxnUtils.asContractId) SystemDeleteTransactionBody(com.hederahashgraph.api.proto.java.SystemDeleteTransactionBody)

Aggregations

MoreObjects (com.google.common.base.MoreObjects)1 HapiApiSpec (com.hedera.services.bdd.spec.HapiApiSpec)1 HapiTxnOp (com.hedera.services.bdd.spec.transactions.HapiTxnOp)1 TxnUtils.asContractId (com.hedera.services.bdd.spec.transactions.TxnUtils.asContractId)1 TxnUtils.asFileId (com.hedera.services.bdd.spec.transactions.TxnUtils.asFileId)1 HederaFunctionality (com.hederahashgraph.api.proto.java.HederaFunctionality)1 SystemDelete (com.hederahashgraph.api.proto.java.HederaFunctionality.SystemDelete)1 SystemDeleteTransactionBody (com.hederahashgraph.api.proto.java.SystemDeleteTransactionBody)1 TimestampSeconds (com.hederahashgraph.api.proto.java.TimestampSeconds)1 Transaction (com.hederahashgraph.api.proto.java.Transaction)1 TransactionBody (com.hederahashgraph.api.proto.java.TransactionBody)1 TransactionResponse (com.hederahashgraph.api.proto.java.TransactionResponse)1 Optional (java.util.Optional)1 OptionalLong (java.util.OptionalLong)1 Consumer (java.util.function.Consumer)1 Function (java.util.function.Function)1 Assertions (org.junit.jupiter.api.Assertions)1