Search in sources :

Example 1 with AmountDto

use of io.nem.symbol.catapult.builders.AmountDto in project nem2-sdk-java by nemtech.

the class AccountInfo method toHeightActivityBucketBuilder.

private HeightActivityBucketBuilder toHeightActivityBucketBuilder(ActivityBucket activityBucket) {
    ImportanceHeightDto startHeight = new ImportanceHeightDto(activityBucket.getStartHeight().longValue());
    AmountDto totalFeesPaid = SerializationUtils.toAmount(activityBucket.getTotalFeesPaid());
    int beneficiaryCount = (int) activityBucket.getBeneficiaryCount();
    long rawScore = activityBucket.getRawScore().longValue();
    return HeightActivityBucketBuilder.create(startHeight, totalFeesPaid, beneficiaryCount, rawScore);
}
Also used : ImportanceHeightDto(io.nem.symbol.catapult.builders.ImportanceHeightDto) AmountDto(io.nem.symbol.catapult.builders.AmountDto)

Example 2 with AmountDto

use of io.nem.symbol.catapult.builders.AmountDto 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();
}
Also used : MosaicDefinitionBuilder(io.nem.symbol.catapult.builders.MosaicDefinitionBuilder) BlockDurationDto(io.nem.symbol.catapult.builders.BlockDurationDto) MosaicIdDto(io.nem.symbol.catapult.builders.MosaicIdDto) MosaicFlagsDto(io.nem.symbol.catapult.builders.MosaicFlagsDto) AmountDto(io.nem.symbol.catapult.builders.AmountDto) AddressDto(io.nem.symbol.catapult.builders.AddressDto) MosaicPropertiesBuilder(io.nem.symbol.catapult.builders.MosaicPropertiesBuilder) HeightDto(io.nem.symbol.catapult.builders.HeightDto)

Aggregations

AmountDto (io.nem.symbol.catapult.builders.AmountDto)2 AddressDto (io.nem.symbol.catapult.builders.AddressDto)1 BlockDurationDto (io.nem.symbol.catapult.builders.BlockDurationDto)1 HeightDto (io.nem.symbol.catapult.builders.HeightDto)1 ImportanceHeightDto (io.nem.symbol.catapult.builders.ImportanceHeightDto)1 MosaicDefinitionBuilder (io.nem.symbol.catapult.builders.MosaicDefinitionBuilder)1 MosaicFlagsDto (io.nem.symbol.catapult.builders.MosaicFlagsDto)1 MosaicIdDto (io.nem.symbol.catapult.builders.MosaicIdDto)1 MosaicPropertiesBuilder (io.nem.symbol.catapult.builders.MosaicPropertiesBuilder)1