use of io.nem.symbol.catapult.builders.AccountKeyTypeFlagsDto in project nem2-sdk-java by nemtech.
the class AccountInfo method serialize.
public byte[] serialize() {
AddressDto address = SerializationUtils.toAddressDto(getAddress());
HeightDto addressHeight = new HeightDto(getAddressHeight().longValue());
KeyDto publicKey = SerializationUtils.toKeyDto(getPublicKey());
HeightDto publicKeyHeight = new HeightDto(getPublicKeyHeight().longValue());
AccountTypeDto accountType = AccountTypeDto.rawValueOf((byte) getAccountType().getValue());
EnumSet<AccountKeyTypeFlagsDto> supplementalPublicKeysMask = getAccountKeyTypeFlags();
KeyDto linkedPublicKey = getSupplementalAccountKeys().getLinked().map(SerializationUtils::toKeyDto).orElse(null);
KeyDto nodePublicKey = getSupplementalAccountKeys().getNode().map(SerializationUtils::toKeyDto).orElse(null);
KeyDto vrfPublicKey = getSupplementalAccountKeys().getVrf().map(SerializationUtils::toKeyDto).orElse(null);
List<PinnedVotingKeyBuilder> votingPublicKeys = getSupplementalAccountKeys().getVoting().stream().map(this::toPinnedVotingKeyBuilder).collect(Collectors.toList());
ImportanceDto importanceValue = new ImportanceDto(getImportance().getValue().longValue());
ImportanceHeightDto importanceHeight = new ImportanceHeightDto(getImportance().getHeight().longValue());
ImportanceSnapshotBuilder importanceSnapshots = ImportanceSnapshotBuilder.create(importanceValue, importanceHeight);
HeightActivityBucketsBuilder activityBuckets = toHeightActivityBucketsBuilder();
List<MosaicBuilder> balances = SerializationUtils.toMosaicBuilders(getMosaics());
if (isHighValue()) {
return AccountStateBuilder.createHighValue((short) getVersion(), address, addressHeight, publicKey, publicKeyHeight, accountType, supplementalPublicKeysMask, linkedPublicKey, nodePublicKey, vrfPublicKey, votingPublicKeys, importanceSnapshots, activityBuckets, balances).serialize();
} else {
return AccountStateBuilder.createRegular((short) getVersion(), address, addressHeight, publicKey, publicKeyHeight, accountType, supplementalPublicKeysMask, linkedPublicKey, nodePublicKey, vrfPublicKey, votingPublicKeys, balances).serialize();
}
}
Aggregations