use of io.nem.symbol.sdk.model.transaction.SignedTransaction in project nem2-sdk-java by nemtech.
the class AggregateTransactionServiceIntegrationTest method isMultisigAccountModificationTransactionAdditionNotComplete.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void isMultisigAccountModificationTransactionAdditionNotComplete(RepositoryType type) {
Account testAccount = helper().getTestAccount(type).getLeft();
Account multisigAccount = helper().getMultisigAccount(type).getLeft();
Account cosignatoryAccount = config().getCosignatoryAccount();
Account cosignatory2Account = config().getCosignatory2Account();
List<Account> accounts = Arrays.asList(cosignatoryAccount, cosignatory2Account);
List<UnresolvedAddress> additions = accounts.stream().map(Account::getAddress).collect(Collectors.toList());
MultisigAccountModificationTransaction multisigAccountModificationTransaction = MultisigAccountModificationTransactionFactory.create(getNetworkType(), getDeadline(), (byte) 1, (byte) 1, additions, Collections.emptyList()).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(testAccount), getGenerationHash());
AggregateTransactionService aggregateTransactionService = new AggregateTransactionServiceImpl(getRepositoryFactory(type));
Assertions.assertFalse(get(aggregateTransactionService.isComplete(signedAggregateTransaction)));
}
use of io.nem.symbol.sdk.model.transaction.SignedTransaction in project nem2-sdk-java by nemtech.
the class AggregateTransactionServiceIntegrationTest method isMultisigAccountModificationTransactionDeletionNotComplete.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void isMultisigAccountModificationTransactionDeletionNotComplete(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, // Random
Collections.singletonList(config().getTestAccount()), // account
getGenerationHash());
AggregateTransactionService aggregateTransactionService = new AggregateTransactionServiceImpl(getRepositoryFactory(type));
Assertions.assertFalse(get(aggregateTransactionService.isComplete(signedAggregateTransaction)));
}
use of io.nem.symbol.sdk.model.transaction.SignedTransaction 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)));
}
use of io.nem.symbol.sdk.model.transaction.SignedTransaction in project nem2-sdk-java by nemtech.
the class TransactionRepositoryVertxImplTest method getSignedTransaction.
private SignedTransaction getSignedTransaction() {
String generationHash = "A94B1BE81F1D4C95D6D252AD7BA3FFFB1674991FD880B7A57DC3180AF8D69C32";
Account account = Account.generateNewAccount(this.networkType);
Address recipientAddress = Address.generateRandom(this.networkType);
TransferTransaction transferTransaction = TransferTransactionFactory.create(NetworkType.MIJIN_TEST, new Deadline(BigInteger.ONE), recipientAddress, Collections.singletonList(createAbsolute(BigInteger.valueOf(1)))).message(new PlainMessage("E2ETest:standaloneTransferTransaction:message")).build();
SignedTransaction signedTransaction = account.sign(transferTransaction, generationHash);
String payload = signedTransaction.getPayload();
assertEquals(444, payload.length());
return signedTransaction;
}
use of io.nem.symbol.sdk.model.transaction.SignedTransaction in project nem2-sdk-java by nemtech.
the class TransactionRepositoryVertxImplTest method shouldAnnounce.
@Test
public void shouldAnnounce() throws Exception {
SignedTransaction signedTransaction = getSignedTransaction();
AnnounceTransactionInfoDTO announceTransactionInfoDTO = new AnnounceTransactionInfoDTO();
announceTransactionInfoDTO.setMessage("SomeMessage");
mockRemoteCall(announceTransactionInfoDTO);
TransactionAnnounceResponse response = repository.announce(signedTransaction).toFuture().get();
Assertions.assertNotNull(response);
Assertions.assertEquals(announceTransactionInfoDTO.getMessage(), announceTransactionInfoDTO.getMessage());
}
Aggregations