Search in sources :

Example 1 with KeyType

use of com.hedera.services.bdd.spec.keys.KeyFactory.KeyType in project hedera-services by hashgraph.

the class HapiCryptoCreate method opBodyDef.

@Override
protected Consumer<TransactionBody.Builder> opBodyDef(HapiApiSpec spec) throws Throwable {
    key = key != null ? key : netOf(spec, keyName, keyShape, keyType, Optional.of(this::effectiveKeyGen));
    long amount = balanceFn.map(fn -> fn.apply(spec)).orElse(initialBalance.orElse(-1L));
    initialBalance = (amount >= 0) ? Optional.of(amount) : Optional.empty();
    CryptoCreateTransactionBody opBody = spec.txns().<CryptoCreateTransactionBody, CryptoCreateTransactionBody.Builder>body(CryptoCreateTransactionBody.class, b -> {
        b.setKey(key);
        proxy.ifPresent(b::setProxyAccountID);
        entityMemo.ifPresent(b::setMemo);
        sendThresh.ifPresent(b::setSendRecordThreshold);
        receiveThresh.ifPresent(b::setReceiveRecordThreshold);
        initialBalance.ifPresent(b::setInitialBalance);
        receiverSigRequired.ifPresent(b::setReceiverSigRequired);
        autoRenewDurationSecs.ifPresent(s -> b.setAutoRenewPeriod(Duration.newBuilder().setSeconds(s).build()));
        maxAutomaticTokenAssociations.ifPresent(b::setMaxAutomaticTokenAssociations);
    });
    return b -> b.setCryptoCreateAccount(opBody);
}
Also used : Transaction(com.hederahashgraph.api.proto.java.Transaction) Arrays(java.util.Arrays) SigControl(com.hedera.services.bdd.spec.keys.SigControl) HapiTxnOp(com.hedera.services.bdd.spec.transactions.HapiTxnOp) Duration(com.hederahashgraph.api.proto.java.Duration) Function(java.util.function.Function) CryptoCreateMeta(com.hedera.services.usage.crypto.CryptoCreateMeta) BaseTransactionMeta(com.hedera.services.usage.BaseTransactionMeta) UsageAccumulator(com.hedera.services.usage.state.UsageAccumulator) TransactionBody(com.hederahashgraph.api.proto.java.TransactionBody) TxnUtils.netOf(com.hedera.services.bdd.spec.transactions.TxnUtils.netOf) TransactionResponse(com.hederahashgraph.api.proto.java.TransactionResponse) SigValueObj(com.hederahashgraph.fee.SigValueObj) AccountID(com.hederahashgraph.api.proto.java.AccountID) CryptoCreateTransactionBody(com.hederahashgraph.api.proto.java.CryptoCreateTransactionBody) FeeData(com.hederahashgraph.api.proto.java.FeeData) MoreObjects(com.google.common.base.MoreObjects) HapiPropertySource(com.hedera.services.bdd.spec.HapiPropertySource) SUCCESS(com.hederahashgraph.api.proto.java.ResponseCodeEnum.SUCCESS) ByteString(com.google.protobuf.ByteString) Consumer(java.util.function.Consumer) TxnFactory.bannerWith(com.hedera.services.bdd.spec.transactions.TxnFactory.bannerWith) Key(com.hederahashgraph.api.proto.java.Key) List(java.util.List) Logger(org.apache.logging.log4j.Logger) AdapterUtils(com.hedera.services.bdd.spec.fees.AdapterUtils) HederaFunctionality(com.hederahashgraph.api.proto.java.HederaFunctionality) Optional(java.util.Optional) TxnUtils.suFrom(com.hedera.services.bdd.spec.transactions.TxnUtils.suFrom) HapiApiSpec(com.hedera.services.bdd.spec.HapiApiSpec) LogManager(org.apache.logging.log4j.LogManager) KeyType(com.hedera.services.bdd.spec.keys.KeyFactory.KeyType) CryptoCreateTransactionBody(com.hederahashgraph.api.proto.java.CryptoCreateTransactionBody)

Aggregations

MoreObjects (com.google.common.base.MoreObjects)1 ByteString (com.google.protobuf.ByteString)1 HapiApiSpec (com.hedera.services.bdd.spec.HapiApiSpec)1 HapiPropertySource (com.hedera.services.bdd.spec.HapiPropertySource)1 AdapterUtils (com.hedera.services.bdd.spec.fees.AdapterUtils)1 KeyType (com.hedera.services.bdd.spec.keys.KeyFactory.KeyType)1 SigControl (com.hedera.services.bdd.spec.keys.SigControl)1 HapiTxnOp (com.hedera.services.bdd.spec.transactions.HapiTxnOp)1 TxnFactory.bannerWith (com.hedera.services.bdd.spec.transactions.TxnFactory.bannerWith)1 TxnUtils.netOf (com.hedera.services.bdd.spec.transactions.TxnUtils.netOf)1 TxnUtils.suFrom (com.hedera.services.bdd.spec.transactions.TxnUtils.suFrom)1 BaseTransactionMeta (com.hedera.services.usage.BaseTransactionMeta)1 CryptoCreateMeta (com.hedera.services.usage.crypto.CryptoCreateMeta)1 UsageAccumulator (com.hedera.services.usage.state.UsageAccumulator)1 AccountID (com.hederahashgraph.api.proto.java.AccountID)1 CryptoCreateTransactionBody (com.hederahashgraph.api.proto.java.CryptoCreateTransactionBody)1 Duration (com.hederahashgraph.api.proto.java.Duration)1 FeeData (com.hederahashgraph.api.proto.java.FeeData)1 HederaFunctionality (com.hederahashgraph.api.proto.java.HederaFunctionality)1 Key (com.hederahashgraph.api.proto.java.Key)1