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);
}
Aggregations