use of io.nem.symbol.sdk.model.mosaic.UnresolvedMosaicId in project nem2-sdk-java by nemtech.
the class TestHelper method createMosaic.
protected MosaicId createMosaic(Account account, RepositoryType type, BigInteger initialSupply, String alias) {
MosaicNonce nonce = MosaicNonce.createRandom();
MosaicId mosaicId = MosaicId.createFromNonce(nonce, account.getPublicAccount());
MosaicDefinitionTransaction mosaicDefinitionTransaction = MosaicDefinitionTransactionFactory.create(getNetworkType(), getDeadline(), nonce, mosaicId, MosaicFlags.create(true, true, true), 4, new BlockDuration(100)).maxFee(maxFee).build();
MosaicDefinitionTransaction validateTransaction = announceAndValidate(type, account, mosaicDefinitionTransaction);
Assertions.assertEquals(mosaicId, validateTransaction.getMosaicId());
UnresolvedMosaicId unresolvedMosaicId = mosaicId;
if (alias != null) {
NamespaceId rootNamespaceId = createRootNamespace(type, account, alias);
unresolvedMosaicId = rootNamespaceId;
MosaicAliasTransaction addressAliasTransaction = MosaicAliasTransactionFactory.create(getNetworkType(), getDeadline(), AliasAction.LINK, rootNamespaceId, mosaicId).maxFee(maxFee).build();
announceAggregateAndValidate(type, addressAliasTransaction, account);
}
if (initialSupply != null && initialSupply.longValue() > 0) {
MosaicSupplyChangeTransaction mosaicSupplyChangeTransaction = MosaicSupplyChangeTransactionFactory.create(getNetworkType(), getDeadline(), unresolvedMosaicId, MosaicSupplyChangeActionType.INCREASE, initialSupply).maxFee(maxFee).build();
announceAndValidate(type, account, mosaicSupplyChangeTransaction);
}
return mosaicId;
}
use of io.nem.symbol.sdk.model.mosaic.UnresolvedMosaicId in project nem2-sdk-java by nemtech.
the class AccountMosaicRestrictionTransactionMapper method createFactory.
@Override
protected AccountMosaicRestrictionTransactionFactory createFactory(NetworkType networkType, Deadline deadline, AccountMosaicRestrictionTransactionDTO transaction) {
AccountMosaicRestrictionFlags restrictionFlags = AccountMosaicRestrictionFlags.rawValueOf(transaction.getRestrictionFlags().getValue());
List<UnresolvedMosaicId> additions = transaction.getRestrictionAdditions().stream().map(MapperUtils::toUnresolvedMosaicId).collect(Collectors.toList());
List<UnresolvedMosaicId> deletions = transaction.getRestrictionDeletions().stream().map(MapperUtils::toUnresolvedMosaicId).collect(Collectors.toList());
return AccountMosaicRestrictionTransactionFactory.create(networkType, deadline, restrictionFlags, additions, deletions);
}
use of io.nem.symbol.sdk.model.mosaic.UnresolvedMosaicId in project nem2-sdk-java by nemtech.
the class AccountMosaicRestrictionTransactionMapper method createFactory.
@Override
protected AccountMosaicRestrictionTransactionFactory createFactory(NetworkType networkType, Deadline deadline, AccountMosaicRestrictionTransactionDTO transaction) {
AccountMosaicRestrictionFlags restrictionFlags = AccountMosaicRestrictionFlags.rawValueOf(transaction.getRestrictionFlags().getValue());
List<UnresolvedMosaicId> additions = transaction.getRestrictionAdditions().stream().map(MapperUtils::toUnresolvedMosaicId).collect(Collectors.toList());
List<UnresolvedMosaicId> deletions = transaction.getRestrictionDeletions().stream().map(MapperUtils::toUnresolvedMosaicId).collect(Collectors.toList());
return AccountMosaicRestrictionTransactionFactory.create(networkType, deadline, restrictionFlags, additions, deletions);
}
use of io.nem.symbol.sdk.model.mosaic.UnresolvedMosaicId in project nem2-sdk-java by nemtech.
the class MosaicMetadataTransactionMapper method createFactory.
@Override
protected MosaicMetadataTransactionFactory createFactory(NetworkType networkType, Deadline deadline, MosaicMetadataTransactionDTO transaction) {
UnresolvedAddress targetAddress = toUnresolvedAddress(transaction.getTargetAddress());
Integer valueSizeDelta = transaction.getValueSizeDelta();
BigInteger scopedMetaDataKey = MapperUtils.fromHexToBigInteger(transaction.getScopedMetadataKey());
byte[] value = ConvertUtils.fromHexToBytes(transaction.getValue());
UnresolvedMosaicId targetMosaic = MapperUtils.toUnresolvedMosaicId(transaction.getTargetMosaicId());
MosaicMetadataTransactionFactory factory = MosaicMetadataTransactionFactory.create(networkType, deadline, targetAddress, targetMosaic, scopedMetaDataKey, value);
factory.valueSizeDelta(valueSizeDelta);
Long valueSize = transaction.getValueSize();
if (valueSize != null) {
factory.valueSize(valueSize);
}
return factory;
}
use of io.nem.symbol.sdk.model.mosaic.UnresolvedMosaicId in project nem2-sdk-java by nemtech.
the class MosaicMetadataTransactionMapper method createFactory.
@Override
protected MosaicMetadataTransactionFactory createFactory(NetworkType networkType, Deadline deadline, MosaicMetadataTransactionDTO transaction) {
UnresolvedAddress targetAccount = MapperUtils.toUnresolvedAddress(transaction.getTargetAddress());
Integer valueSizeDelta = transaction.getValueSizeDelta();
BigInteger scopedMetaDataKey = MapperUtils.fromHexToBigInteger(transaction.getScopedMetadataKey());
byte[] value = ConvertUtils.fromHexToBytes(transaction.getValue());
UnresolvedMosaicId targetMosaic = MapperUtils.toUnresolvedMosaicId(transaction.getTargetMosaicId());
MosaicMetadataTransactionFactory factory = MosaicMetadataTransactionFactory.create(networkType, deadline, targetAccount, targetMosaic, scopedMetaDataKey, value);
factory.valueSizeDelta(valueSizeDelta);
Long valueSize = transaction.getValueSize();
if (valueSize != null) {
factory.valueSize(valueSize);
}
return factory;
}
Aggregations