use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.
the class TransactionMapperVertxTest method shouldCreateAggregateMosaicAddressRestrictionTransaction.
@Test
void shouldCreateAggregateMosaicAddressRestrictionTransaction() {
TransactionInfoDTO aggregateMosaicAddressRestrictionTransactionDTO = TestHelperVertx.loadTransactionInfoDTO("aggregateMosaicAddressRestrictionTransaction.json");
Transaction aggregateMosaicAddressRestrictionTransaction = map(aggregateMosaicAddressRestrictionTransactionDTO);
validateAggregateTransaction((AggregateTransaction) aggregateMosaicAddressRestrictionTransaction, aggregateMosaicAddressRestrictionTransactionDTO);
}
use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.
the class TransactionMapperVertxTest method shouldCreateAggregateMultisigModificationTransaction.
@Test
void shouldCreateAggregateMultisigModificationTransaction() {
TransactionInfoDTO aggregateMultisigModificationTransactionDTO = TestHelperVertx.loadTransactionInfoDTO("aggregateMultisigModificationTransaction.json");
Transaction aggregateMultisigModificationTransaction = map(aggregateMultisigModificationTransactionDTO);
validateAggregateTransaction((AggregateTransaction) aggregateMultisigModificationTransaction, aggregateMultisigModificationTransactionDTO);
}
use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.
the class TransactionMapperVertxTest method shouldCreateAggregateTransferTransactionUsingAlias.
@Test
void shouldCreateAggregateTransferTransactionUsingAlias() {
TransactionInfoDTO aggregateTransferTransactionDTO = TestHelperVertx.loadTransactionInfoDTO("aggregateTransferTransactionUsingAlias.json");
Transaction aggregateTransferTransaction = map(aggregateTransferTransactionDTO);
validateAggregateTransaction((AggregateTransaction) aggregateTransferTransaction, aggregateTransferTransactionDTO);
}
use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.
the class VertxCosignatureTransactionTest method shouldThrowExceptionWhenTransactionToCosignHasNotBeenAnnunced.
@Test
void shouldThrowExceptionWhenTransactionToCosignHasNotBeenAnnunced() throws Exception {
AggregateTransaction aggregateTransaction = AggregateTransactionFactory.createComplete(NetworkType.MIJIN_TEST, new Deadline(BigInteger.ONE), Collections.emptyList()).build();
assertThrows(IllegalArgumentException.class, () -> {
CosignatureTransaction.create(aggregateTransaction);
}, "Transaction to cosign should be announced before being able to cosign it");
}
use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.
the class TestHelper method announceAggregateAndValidate.
<T extends Transaction> Pair<T, AggregateTransaction> announceAggregateAndValidate(RepositoryType type, T transaction, Account signer, Account... cosigners) {
System.out.println("Announcing Aggregate Transaction: " + transaction.getType() + " signer " + signer.getAddress().plain() + " cosigners: " + Arrays.stream(cosigners).map(s -> s.getAddress().plain()).collect(Collectors.joining(", ")));
AggregateTransaction aggregateTransaction = AggregateTransactionFactory.createComplete(getNetworkType(), getDeadline(), Collections.singletonList(transaction.toAggregate(signer.getPublicAccount()))).maxFee(maxFee).build();
SignedTransaction signedTransaction = signer.signTransactionWithCosignatories(aggregateTransaction, Arrays.asList(cosigners), getGenerationHash());
if (transaction.getType() != TransactionType.AGGREGATE_COMPLETE) {
System.out.println("Announcing Transaction Transaction: " + transaction.getType() + " Address: " + signer.getAddress().plain() + " Public Key: " + signer.getPublicAccount().getPublicKey().toHex() + " hash " + signedTransaction.getHash());
}
TransactionService transactionService = new TransactionServiceImpl(getRepositoryFactory(type));
AggregateTransaction announcedAggregateTransaction = (AggregateTransaction) getTransactionOrFail(transactionService.announce(getListener(type), signedTransaction), transaction);
T announcedCorrectly = (T) announcedAggregateTransaction.getInnerTransactions().get(0);
System.out.println("Transaction completed, Transaction hash " + announcedAggregateTransaction.getTransactionInfo().get().getHash().get());
return Pair.of(announcedCorrectly, announcedAggregateTransaction);
}
Aggregations