use of io.nem.symbol.sdk.model.account.Account in project nem2-sdk-java by nemtech.
the class AccountRepositoryIntegrationTest method getAccountsInfoFromAddresses.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getAccountsInfoFromAddresses(RepositoryType type) {
Account account = config().getDefaultAccount();
Address address = account.getAddress();
List<AccountInfo> accountInfos = get(this.getAccountRepository(type).getAccountsInfo(Collections.singletonList(address)));
assertEquals(1, accountInfos.size());
assertEquals(account.getAddress(), accountInfos.get(0).getAddress());
assertEquals(AccountType.UNLINKED, accountInfos.get(0).getAccountType());
}
use of io.nem.symbol.sdk.model.account.Account in project nem2-sdk-java by nemtech.
the class AggregateTransactionServiceIntegrationTest method isMultisigAccountModificationTransactionAdditionComplete.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void isMultisigAccountModificationTransactionAdditionComplete(RepositoryType type) {
Account multisigAccount = helper().getMultisigAccount(type).getKey();
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, accounts, getGenerationHash());
AggregateTransactionService aggregateTransactionService = new AggregateTransactionServiceImpl(getRepositoryFactory(type));
Assertions.assertTrue(get(aggregateTransactionService.isComplete(signedAggregateTransaction)));
}
use of io.nem.symbol.sdk.model.account.Account in project nem2-sdk-java by nemtech.
the class AggregateTransactionServiceIntegrationTest method isTransferFromMultisigComplete.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void isTransferFromMultisigComplete(RepositoryType type) {
Account multisigAccount = helper().getMultisigAccount(type).getKey();
Account cosignatoryAccount = config().getCosignatoryAccount();
TransferTransaction transferTransaction = TransferTransactionFactory.create(getNetworkType(), getDeadline(), getRecipient(), Collections.emptyList()).message(new PlainMessage("")).maxFee(maxFee).build();
AggregateTransaction aggregateTransaction = AggregateTransactionFactory.createComplete(getNetworkType(), getDeadline(), Collections.singletonList(transferTransaction.toAggregate(multisigAccount.getPublicAccount()))).maxFee(maxFee).build();
SignedTransaction signedAggregateTransaction = aggregateTransaction.signTransactionWithCosigners(multisigAccount, Arrays.asList(cosignatoryAccount, config().getTestAccount()), getGenerationHash());
AggregateTransactionService aggregateTransactionService = new AggregateTransactionServiceImpl(getRepositoryFactory(type));
Assertions.assertTrue(get(aggregateTransactionService.isComplete(signedAggregateTransaction)));
}
use of io.nem.symbol.sdk.model.account.Account 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.account.Account 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)));
}
Aggregations