Search in sources :

Example 66 with AggregateTransaction

use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.

the class AggregateTransactionServiceIntegrationTest method aggregateWhenEmptyInnerTransactions.

@ParameterizedTest
@EnumSource(RepositoryType.class)
void aggregateWhenEmptyInnerTransactions(RepositoryType type) {
    AggregateTransaction aggregateTransaction = AggregateTransactionFactory.createComplete(getNetworkType(), getDeadline(), Collections.emptyList()).maxFee(maxFee).build();
    announceAggregateAndValidate(type, aggregateTransaction, config().getDefaultAccount());
}
Also used : AggregateTransaction(io.nem.symbol.sdk.model.transaction.AggregateTransaction) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 67 with AggregateTransaction

use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.

the class AggregateTransactionServiceIntegrationTest method isMultisigAccountModificationTransactionDeletionComplete.

@ParameterizedTest
@EnumSource(RepositoryType.class)
void isMultisigAccountModificationTransactionDeletionComplete(RepositoryType type) {
    Account multisigAccount = helper().getMultisigAccount(type).getLeft();
    Account cosignatoryAccount = config().getCosignatoryAccount();
    Account cosignatory2Account = config().getCosignatory2Account();
    List<Account> accounts = Arrays.asList(cosignatoryAccount, cosignatory2Account);
    MultisigAccountModificationTransaction multisigAccountModificationTransaction = MultisigAccountModificationTransactionFactory.create(getNetworkType(), getDeadline(), (byte) 1, (byte) 1, Collections.emptyList(), Collections.singletonList(accounts.get(0).getAddress())).maxFee(maxFee).build();
    AggregateTransaction aggregateTransaction = AggregateTransactionFactory.createComplete(getNetworkType(), getDeadline(), Collections.singletonList(multisigAccountModificationTransaction.toAggregate(multisigAccount.getPublicAccount()))).maxFee(maxFee).build();
    SignedTransaction signedAggregateTransaction = aggregateTransaction.signTransactionWithCosigners(multisigAccount, Collections.singletonList(accounts.get(1)), getGenerationHash());
    AggregateTransactionService aggregateTransactionService = new AggregateTransactionServiceImpl(getRepositoryFactory(type));
    Assertions.assertTrue(get(aggregateTransactionService.isComplete(signedAggregateTransaction)));
}
Also used : Account(io.nem.symbol.sdk.model.account.Account) MultisigAccountModificationTransaction(io.nem.symbol.sdk.model.transaction.MultisigAccountModificationTransaction) AggregateTransaction(io.nem.symbol.sdk.model.transaction.AggregateTransaction) AggregateTransactionService(io.nem.symbol.sdk.api.AggregateTransactionService) SignedTransaction(io.nem.symbol.sdk.model.transaction.SignedTransaction) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 68 with AggregateTransaction

use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.

the class VertxAggregateTransactionTest method createAAggregateTransactionViaStaticConstructor.

@Test
void createAAggregateTransactionViaStaticConstructor() {
    Duration epochAdjustment = Duration.ofSeconds(100);
    Address recipient = Address.generateRandom(networkType);
    Deadline deadline = Deadline.create(epochAdjustment);
    TransferTransaction transferTx = TransferTransactionFactory.create(networkType, deadline, recipient, Collections.emptyList()).message(new PlainMessage("")).build();
    AggregateTransaction aggregateTx = AggregateTransactionFactory.createComplete(networkType, deadline, Collections.singletonList(transferTx.toAggregate(new PublicAccount("9A49366406ACA952B88BADF5F1E9BE6CE4968141035A60BE503273EA65456B24", networkType)))).build();
    assertEquals(networkType, aggregateTx.getNetworkType());
    assertEquals(1, (int) aggregateTx.getVersion());
    assertTrue(LocalDateTime.now().isBefore(aggregateTx.getDeadline().getLocalDateTime(epochAdjustment)));
    assertEquals(BigInteger.valueOf(0), aggregateTx.getMaxFee());
    assertEquals(1, aggregateTx.getInnerTransactions().size());
}
Also used : Address(io.nem.symbol.sdk.model.account.Address) PlainMessage(io.nem.symbol.sdk.model.message.PlainMessage) Deadline(io.nem.symbol.sdk.model.transaction.Deadline) AggregateTransaction(io.nem.symbol.sdk.model.transaction.AggregateTransaction) PublicAccount(io.nem.symbol.sdk.model.account.PublicAccount) Duration(java.time.Duration) TransferTransaction(io.nem.symbol.sdk.model.transaction.TransferTransaction) Test(org.junit.jupiter.api.Test)

Example 69 with AggregateTransaction

use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.

the class TransactionMapperVertxTest method shouldCreateAggregateMosaicCreationTransaction.

@Test
void shouldCreateAggregateMosaicCreationTransaction() {
    TransactionInfoDTO aggregateMosaicCreationTransactionDTO = TestHelperVertx.loadTransactionInfoDTO("aggregateMosaicCreationTransaction.json");
    Transaction aggregateMosaicCreationTransaction = map(aggregateMosaicCreationTransactionDTO);
    validateAggregateTransaction((AggregateTransaction) aggregateMosaicCreationTransaction, aggregateMosaicCreationTransactionDTO);
}
Also used : SecretProofTransaction(io.nem.symbol.sdk.model.transaction.SecretProofTransaction) HashLockTransaction(io.nem.symbol.sdk.model.transaction.HashLockTransaction) AccountOperationRestrictionTransaction(io.nem.symbol.sdk.model.transaction.AccountOperationRestrictionTransaction) AccountAddressRestrictionTransaction(io.nem.symbol.sdk.model.transaction.AccountAddressRestrictionTransaction) AggregateTransaction(io.nem.symbol.sdk.model.transaction.AggregateTransaction) NamespaceRegistrationTransaction(io.nem.symbol.sdk.model.transaction.NamespaceRegistrationTransaction) TransferTransaction(io.nem.symbol.sdk.model.transaction.TransferTransaction) MosaicDefinitionTransaction(io.nem.symbol.sdk.model.transaction.MosaicDefinitionTransaction) MultisigAccountModificationTransaction(io.nem.symbol.sdk.model.transaction.MultisigAccountModificationTransaction) AccountMosaicRestrictionTransaction(io.nem.symbol.sdk.model.transaction.AccountMosaicRestrictionTransaction) MosaicMetadataTransaction(io.nem.symbol.sdk.model.transaction.MosaicMetadataTransaction) Transaction(io.nem.symbol.sdk.model.transaction.Transaction) AccountKeyLinkTransaction(io.nem.symbol.sdk.model.transaction.AccountKeyLinkTransaction) NamespaceMetadataTransaction(io.nem.symbol.sdk.model.transaction.NamespaceMetadataTransaction) AccountMetadataTransaction(io.nem.symbol.sdk.model.transaction.AccountMetadataTransaction) AddressAliasTransaction(io.nem.symbol.sdk.model.transaction.AddressAliasTransaction) MosaicAliasTransaction(io.nem.symbol.sdk.model.transaction.MosaicAliasTransaction) MosaicSupplyChangeTransaction(io.nem.symbol.sdk.model.transaction.MosaicSupplyChangeTransaction) SecretLockTransaction(io.nem.symbol.sdk.model.transaction.SecretLockTransaction) TransactionInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO) Test(org.junit.jupiter.api.Test)

Example 70 with AggregateTransaction

use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.

the class TransactionMapperVertxTest method shouldCreateAggregateTransferTransaction.

@Test
void shouldCreateAggregateTransferTransaction() {
    TransactionInfoDTO aggregateTransferTransactionDTO = TestHelperVertx.loadTransactionInfoDTO("aggregateTransferTransaction.json");
    Transaction aggregateTransferTransaction = map(aggregateTransferTransactionDTO);
    validateAggregateTransaction((AggregateTransaction) aggregateTransferTransaction, aggregateTransferTransactionDTO);
}
Also used : SecretProofTransaction(io.nem.symbol.sdk.model.transaction.SecretProofTransaction) HashLockTransaction(io.nem.symbol.sdk.model.transaction.HashLockTransaction) AccountOperationRestrictionTransaction(io.nem.symbol.sdk.model.transaction.AccountOperationRestrictionTransaction) AccountAddressRestrictionTransaction(io.nem.symbol.sdk.model.transaction.AccountAddressRestrictionTransaction) AggregateTransaction(io.nem.symbol.sdk.model.transaction.AggregateTransaction) NamespaceRegistrationTransaction(io.nem.symbol.sdk.model.transaction.NamespaceRegistrationTransaction) TransferTransaction(io.nem.symbol.sdk.model.transaction.TransferTransaction) MosaicDefinitionTransaction(io.nem.symbol.sdk.model.transaction.MosaicDefinitionTransaction) MultisigAccountModificationTransaction(io.nem.symbol.sdk.model.transaction.MultisigAccountModificationTransaction) AccountMosaicRestrictionTransaction(io.nem.symbol.sdk.model.transaction.AccountMosaicRestrictionTransaction) MosaicMetadataTransaction(io.nem.symbol.sdk.model.transaction.MosaicMetadataTransaction) Transaction(io.nem.symbol.sdk.model.transaction.Transaction) AccountKeyLinkTransaction(io.nem.symbol.sdk.model.transaction.AccountKeyLinkTransaction) NamespaceMetadataTransaction(io.nem.symbol.sdk.model.transaction.NamespaceMetadataTransaction) AccountMetadataTransaction(io.nem.symbol.sdk.model.transaction.AccountMetadataTransaction) AddressAliasTransaction(io.nem.symbol.sdk.model.transaction.AddressAliasTransaction) MosaicAliasTransaction(io.nem.symbol.sdk.model.transaction.MosaicAliasTransaction) MosaicSupplyChangeTransaction(io.nem.symbol.sdk.model.transaction.MosaicSupplyChangeTransaction) SecretLockTransaction(io.nem.symbol.sdk.model.transaction.SecretLockTransaction) TransactionInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO) Test(org.junit.jupiter.api.Test)

Aggregations

AggregateTransaction (io.nem.symbol.sdk.model.transaction.AggregateTransaction)94 TransferTransaction (io.nem.symbol.sdk.model.transaction.TransferTransaction)68 Test (org.junit.jupiter.api.Test)66 HashLockTransaction (io.nem.symbol.sdk.model.transaction.HashLockTransaction)44 MultisigAccountModificationTransaction (io.nem.symbol.sdk.model.transaction.MultisigAccountModificationTransaction)43 Transaction (io.nem.symbol.sdk.model.transaction.Transaction)41 AddressAliasTransaction (io.nem.symbol.sdk.model.transaction.AddressAliasTransaction)36 NamespaceRegistrationTransaction (io.nem.symbol.sdk.model.transaction.NamespaceRegistrationTransaction)36 MosaicAliasTransaction (io.nem.symbol.sdk.model.transaction.MosaicAliasTransaction)35 MosaicDefinitionTransaction (io.nem.symbol.sdk.model.transaction.MosaicDefinitionTransaction)35 MosaicMetadataTransaction (io.nem.symbol.sdk.model.transaction.MosaicMetadataTransaction)35 MosaicSupplyChangeTransaction (io.nem.symbol.sdk.model.transaction.MosaicSupplyChangeTransaction)35 NamespaceMetadataTransaction (io.nem.symbol.sdk.model.transaction.NamespaceMetadataTransaction)35 SignedTransaction (io.nem.symbol.sdk.model.transaction.SignedTransaction)35 AccountMetadataTransaction (io.nem.symbol.sdk.model.transaction.AccountMetadataTransaction)34 AccountAddressRestrictionTransaction (io.nem.symbol.sdk.model.transaction.AccountAddressRestrictionTransaction)33 AccountOperationRestrictionTransaction (io.nem.symbol.sdk.model.transaction.AccountOperationRestrictionTransaction)33 PlainMessage (io.nem.symbol.sdk.model.message.PlainMessage)32 AccountKeyLinkTransaction (io.nem.symbol.sdk.model.transaction.AccountKeyLinkTransaction)32 AccountMosaicRestrictionTransaction (io.nem.symbol.sdk.model.transaction.AccountMosaicRestrictionTransaction)32