use of com.hedera.services.bdd.spec.queries.crypto.ReferenceType in project hedera-services by hashgraph.
the class HapiCryptoDelete method opBodyDef.
@Override
protected Consumer<TransactionBody.Builder> opBodyDef(HapiApiSpec spec) throws Throwable {
AccountID target;
if (referenceType == ReferenceType.REGISTRY_NAME) {
target = TxnUtils.asId(account, spec);
} else {
account = lookUpAccountWithAlias(spec, aliasKeySource);
target = asAccount(account);
}
CryptoDeleteTransactionBody opBody = spec.txns().<CryptoDeleteTransactionBody, CryptoDeleteTransactionBody.Builder>body(CryptoDeleteTransactionBody.class, b -> {
transferAccount.ifPresent(a -> b.setTransferAccountID(spec.registry().getAccountID(a)));
b.setDeleteAccountID(target);
});
return b -> b.setCryptoDelete(opBody);
}
use of com.hedera.services.bdd.spec.queries.crypto.ReferenceType in project hedera-services by hashgraph.
the class HapiCryptoUpdate method opBodyDef.
@Override
protected Consumer<TransactionBody.Builder> opBodyDef(HapiApiSpec spec) throws Throwable {
try {
updKey = updKeyName.map(spec.registry()::getKey);
} catch (Exception ignore) {
}
AccountID id;
if (referenceType == ReferenceType.REGISTRY_NAME) {
id = TxnUtils.asId(account, spec);
} else {
id = asIdForKeyLookUp(aliasKeySource, spec);
account = asAccountString(id);
}
CryptoUpdateTransactionBody opBody = spec.txns().<CryptoUpdateTransactionBody, CryptoUpdateTransactionBody.Builder>body(CryptoUpdateTransactionBody.class, builder -> {
builder.setAccountIDToUpdate(id);
newProxy.ifPresent(p -> {
var proxyId = TxnUtils.asId(p, spec);
builder.setProxyAccountID(proxyId);
});
updSigRequired.ifPresent(u -> builder.setReceiverSigRequiredWrapper(BoolValue.of(u)));
if (useContractKey) {
builder.setKey(Key.newBuilder().setContractID(HapiPropertySource.asContract("0.0.1234")));
} else {
updKey.ifPresent(builder::setKey);
}
newAutoRenewPeriod.ifPresent(p -> builder.setAutoRenewPeriod(Duration.newBuilder().setSeconds(p)));
entityMemo.ifPresent(m -> builder.setMemo(StringValue.newBuilder().setValue(m).build()));
sendThreshold.ifPresent(v -> builder.setSendRecordThresholdWrapper(UInt64Value.newBuilder().setValue(v).build()));
newExpiry.ifPresent(l -> builder.setExpirationTime(Timestamp.newBuilder().setSeconds(l).build()));
newMaxAutomaticAssociations.ifPresent(p -> builder.setMaxAutomaticTokenAssociations(Int32Value.of(p)));
});
return builder -> builder.setCryptoUpdateAccount(opBody);
}
Aggregations