use of io.nem.symbol.catapult.builders.AddressDto in project nem2-sdk-java by nemtech.
the class Metadata method serialize.
/**
* @return serializes the state of this object.
*/
public byte[] serialize() {
AddressDto sourceAddress = SerializationUtils.toAddressDto(getSourceAddress());
AddressDto targetAddress = SerializationUtils.toAddressDto(getTargetAddress());
ScopedMetadataKeyDto scopedMetadataKey = new ScopedMetadataKeyDto(getScopedMetadataKey().longValue());
long targetId = getTargetId().map(this::toTargetId).orElse(0L);
MetadataTypeDto metadataType = MetadataTypeDto.rawValueOf((byte) getMetadataType().getValue());
MetadataValueBuilder value = toMetadataValueBuilder(getValue());
return MetadataEntryBuilder.create((short) getVersion(), sourceAddress, targetAddress, scopedMetadataKey, targetId, metadataType, value).serialize();
}
use of io.nem.symbol.catapult.builders.AddressDto in project nem2-sdk-java by nemtech.
the class MosaicInfo method serialize.
/**
* @return serializes the state of the mosaic.
*/
public byte[] serialize() {
MosaicIdDto mosaicId = SerializationUtils.toMosaicIdDto(getMosaicId());
AmountDto supply = SerializationUtils.toAmount(getSupply());
HeightDto startHeight = new HeightDto(getStartHeight().longValue());
AddressDto ownerAddress = SerializationUtils.toAddressDto(getOwnerAddress());
int revision = (int) getRevision();
EnumSet<MosaicFlagsDto> flags = SerializationUtils.getMosaicFlagsEnumSet(this.getMosaicFlags());
MosaicPropertiesBuilder properties = MosaicPropertiesBuilder.create(flags, (byte) getDivisibility(), new BlockDurationDto(getDuration().longValue()));
MosaicDefinitionBuilder definition = MosaicDefinitionBuilder.create(startHeight, ownerAddress, revision, properties);
return MosaicEntryBuilder.create((short) getVersion(), mosaicId, supply, definition).serialize();
}
Aggregations