use of io.nem.symbol.sdk.model.blockchain.BlockDuration in project nem2-sdk-java by nemtech.
the class MosaicDefinitionTransactionIntegrationTest method aggregateMosaicDefinitionTransaction.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void aggregateMosaicDefinitionTransaction(RepositoryType type) {
MosaicNonce nonce = MosaicNonce.createRandom();
MosaicId mosaicId = MosaicId.createFromNonce(nonce, this.account.getPublicAccount());
MosaicDefinitionTransaction mosaicDefinitionTransaction = MosaicDefinitionTransactionFactory.create(getNetworkType(), getDeadline(), nonce, mosaicId, MosaicFlags.create(true, false, true), 4, new BlockDuration(100)).maxFee(maxFee).build();
MosaicDefinitionTransaction processed = announceAggregateAndValidate(type, mosaicDefinitionTransaction, this.account).getLeft();
Assertions.assertEquals(mosaicDefinitionTransaction.getMosaicNonce(), processed.getMosaicNonce());
Assertions.assertEquals(mosaicId, processed.getMosaicId());
}
use of io.nem.symbol.sdk.model.blockchain.BlockDuration in project nem2-sdk-java by nemtech.
the class MosaicDefinitionTransactionTest method createAMosaicCreationTransactionViaStaticConstructor.
@Test
void createAMosaicCreationTransactionViaStaticConstructor() {
Account owner = Account.generateNewAccount(NetworkType.MIJIN_TEST);
Duration epochAdjustment = Duration.ofSeconds(100);
int nonceNumber = 12345;
MosaicNonce nonce = MosaicNonce.createFromInteger(nonceNumber);
MosaicDefinitionTransaction mosaicCreationTx = MosaicDefinitionTransactionFactory.create(NetworkType.MIJIN_TEST, Deadline.create(epochAdjustment), nonce, MosaicId.createFromNonce(nonce, owner.getPublicAccount()), MosaicFlags.create(true, true, true), 4, new BlockDuration(222222)).build();
System.out.println(ConvertUtils.toHex(BinarySerializationImpl.INSTANCE.serialize(mosaicCreationTx)));
assertEquals(NetworkType.MIJIN_TEST, mosaicCreationTx.getNetworkType());
assertEquals(1, (int) mosaicCreationTx.getVersion());
assertTrue(LocalDateTime.now().isBefore(mosaicCreationTx.getDeadline().getLocalDateTime(epochAdjustment)));
assertEquals(BigInteger.valueOf(0), mosaicCreationTx.getMaxFee());
// assertEquals(new BigInteger("0"), mosaicCreationTx.getMosaicId().getId());
assertTrue(mosaicCreationTx.getMosaicFlags().isSupplyMutable());
assertTrue(mosaicCreationTx.getMosaicFlags().isTransferable());
assertTrue(mosaicCreationTx.getMosaicFlags().isRestrictable());
assertEquals(nonceNumber, mosaicCreationTx.getMosaicNonce().getNonceAsInt());
assertEquals(4, mosaicCreationTx.getDivisibility());
assertEquals(new BlockDuration(222222), mosaicCreationTx.getBlockDuration());
}
Aggregations