use of io.nem.symbol.catapult.builders.AddressDto in project nem2-sdk-java by nemtech.
the class SecretLockInfo method serialize.
/**
* @return serializes the state of this object.
*/
public byte[] serialize() {
short version = (short) getVersion();
AddressDto ownerAddress = SerializationUtils.toAddressDto(getOwnerAddress());
MosaicBuilder mosaic = MosaicBuilder.create(SerializationUtils.toMosaicIdDto(getMosaicId()), SerializationUtils.toAmount(getAmount()));
HeightDto endHeight = new HeightDto(getEndHeight().longValue());
LockStatusDto status = LockStatusDto.rawValueOf(getStatus().getValue());
Hash256Dto secret = SerializationUtils.toHash256Dto(getSecret());
AddressDto recipient = SerializationUtils.toAddressDto(getRecipientAddress());
LockHashAlgorithmDto hashAlgorithm = LockHashAlgorithmDto.rawValueOf((byte) this.hashAlgorithm.getValue());
return SecretLockInfoBuilder.create(version, ownerAddress, mosaic, endHeight, status, hashAlgorithm, secret, recipient).serialize();
}
use of io.nem.symbol.catapult.builders.AddressDto in project nem2-sdk-java by nemtech.
the class HashLockInfo method serialize.
/**
* @return serializes the state of this object.
*/
public byte[] serialize() {
AddressDto ownerAddress = SerializationUtils.toAddressDto(getOwnerAddress());
MosaicBuilder mosaic = MosaicBuilder.create(SerializationUtils.toMosaicIdDto(getMosaicId()), SerializationUtils.toAmount(getAmount()));
HeightDto endHeight = new HeightDto(getEndHeight().longValue());
LockStatusDto status = LockStatusDto.rawValueOf(getStatus().getValue());
Hash256Dto hash = SerializationUtils.toHash256Dto(getHash());
return HashLockInfoBuilder.create((short) getVersion(), ownerAddress, mosaic, endHeight, status, hash).serialize();
}
use of io.nem.symbol.catapult.builders.AddressDto in project nem2-sdk-java by nemtech.
the class AccountRestrictions method serialize.
/**
* @return serializes the state of this object.
*/
public byte[] serialize() {
AddressDto address = SerializationUtils.toAddressDto(getAddress());
List<AccountRestrictionsInfoBuilder> restrictions = getRestrictions().stream().map(this::toAccountRestrictionsInfoBuilder).collect(Collectors.toList());
return AccountRestrictionsBuilder.create((short) getVersion(), address, restrictions).serialize();
}
use of io.nem.symbol.catapult.builders.AddressDto in project nem2-sdk-java by nemtech.
the class MultisigAccountInfo method serialize.
/**
* @return serializes the state of this object.
*/
public byte[] serialize() {
int minApproval = (int) getMinApproval();
int minRemoval = (int) getMinRemoval();
AddressDto accountAddress = SerializationUtils.toAddressDto(getAccountAddress());
List<AddressDto> cosignatoryAddresses = getCosignatoryAddresses().stream().map(SerializationUtils::toAddressDto).collect(Collectors.toList());
List<AddressDto> multisigAddresses = getMultisigAddresses().stream().map(SerializationUtils::toAddressDto).collect(Collectors.toList());
return MultisigEntryBuilder.create((short) getVersion(), minApproval, minRemoval, accountAddress, cosignatoryAddresses, multisigAddresses).serialize();
}
use of io.nem.symbol.catapult.builders.AddressDto in project nem2-sdk-java by nemtech.
the class NamespaceInfo method serialize.
/**
* @return serializes the state of this object.
*/
public byte[] serialize(List<NamespaceInfo> fullPath) {
if (!this.isRoot()) {
throw new IllegalArgumentException("Namespace must be root in order to serialize!");
}
List<NamespaceInfo> children = sortList(fullPath, this.getId());
if (fullPath.size() != children.size()) {
throw new IllegalArgumentException("Some of the children do not belong to this root namespace");
}
NamespaceIdDto id = new NamespaceIdDto(getId().getIdAsLong());
AddressDto ownerAddress = SerializationUtils.toAddressDto(getOwnerAddress());
NamespaceLifetimeBuilder lifetime = NamespaceLifetimeBuilder.create(new HeightDto(getStartHeight().longValue()), new HeightDto(getEndHeight().longValue()));
NamespaceAliasBuilder rootAlias = getAlias().createAliasBuilder();
List<NamespacePathBuilder> paths = children.stream().map(this::toNamespaceAliasTypeDto).collect(Collectors.toList());
RootNamespaceHistoryBuilder builder = RootNamespaceHistoryBuilder.create((short) getVersion(), id, ownerAddress, lifetime, rootAlias, paths);
return builder.serialize();
}
Aggregations