use of io.nem.symbol.sdk.model.transaction.AccountMosaicRestrictionTransaction in project nem2-sdk-java by nemtech.
the class TransactionMapperVertxTest method shouldCreateAccountMosaicRestriction.
@Test
public void shouldCreateAccountMosaicRestriction() throws Exception {
TransactionInfoDTO transactionInfoDTO = TestHelperVertx.loadTransactionInfoDTO("accountMosaicRestrictionTransaction.json");
AccountMosaicRestrictionTransaction transaction = (AccountMosaicRestrictionTransaction) map(transactionInfoDTO);
validateStandaloneTransaction(transaction, transactionInfoDTO);
Assertions.assertEquals(AccountMosaicRestrictionFlags.ALLOW_INCOMING_MOSAIC, transaction.getRestrictionFlags());
Assertions.assertEquals(1, transaction.getRestrictionAdditions().size());
Assertions.assertEquals("00003646934825AA", transaction.getRestrictionAdditions().get(0).getIdAsHex());
}
use of io.nem.symbol.sdk.model.transaction.AccountMosaicRestrictionTransaction in project nem2-sdk-java by nemtech.
the class TransactionMapperOkHttpTest method shouldCreateAccountMosaicRestriction.
@Test
public void shouldCreateAccountMosaicRestriction() throws Exception {
TransactionInfoDTO transactionInfoDTO = TestHelperOkHttp.loadTransactionInfoDTO("accountMosaicRestrictionTransaction.json");
AccountMosaicRestrictionTransaction transaction = (AccountMosaicRestrictionTransaction) map(transactionInfoDTO);
validateStandaloneTransaction(transaction, transactionInfoDTO);
Assertions.assertEquals(AccountMosaicRestrictionFlags.ALLOW_INCOMING_MOSAIC, transaction.getRestrictionFlags());
Assertions.assertEquals(1, transaction.getRestrictionAdditions().size());
Assertions.assertEquals("00003646934825AA", transaction.getRestrictionAdditions().get(0).getIdAsHex());
}
use of io.nem.symbol.sdk.model.transaction.AccountMosaicRestrictionTransaction in project nem2-sdk-java by nemtech.
the class AccountRestrictionIntegrationTest method sendAccountRestrictionMosaic.
private void sendAccountRestrictionMosaic(RepositoryType type, UnresolvedMosaicId unresolvedMosaicId, boolean add, AccountMosaicRestrictionFlags accountRestrictionFlags) {
List<UnresolvedMosaicId> additions = add ? Collections.singletonList(unresolvedMosaicId) : Collections.emptyList();
List<UnresolvedMosaicId> deletions = !add ? Collections.singletonList(unresolvedMosaicId) : Collections.emptyList();
AccountMosaicRestrictionTransaction transaction = AccountMosaicRestrictionTransactionFactory.create(getNetworkType(), getDeadline(), accountRestrictionFlags, additions, deletions).maxFee(maxFee).build();
AccountMosaicRestrictionTransaction processedTransaction = announceAndValidate(type, testAccount, transaction);
Assertions.assertEquals(accountRestrictionFlags, processedTransaction.getRestrictionFlags());
Assertions.assertEquals(additions, processedTransaction.getRestrictionAdditions());
Assertions.assertEquals(deletions, processedTransaction.getRestrictionDeletions());
}
use of io.nem.symbol.sdk.model.transaction.AccountMosaicRestrictionTransaction in project nem2-sdk-java by nemtech.
the class TransactionServiceTest method accountMosaicRestrictionTransactionResolveAlias.
@Test
void accountMosaicRestrictionTransactionResolveAlias() throws ExecutionException, InterruptedException {
String transactionHash = "aaaa";
TransactionFactory<AccountMosaicRestrictionTransaction> factory = AccountMosaicRestrictionTransactionFactory.create(NetworkType.MIJIN_TEST, new Deadline(BigInteger.ONE), AccountMosaicRestrictionFlags.ALLOW_INCOMING_MOSAIC, Arrays.asList(mosaicNamespace1, mosaicId2, mosaicNamespace2), Arrays.asList(mosaicNamespace2, mosaicNamespace3, mosaicId3)).transactionInfo(TransactionInfo.create(height, 4, "ABC", transactionHash, ""));
AccountMosaicRestrictionTransaction transaction = factory.build();
simulateStatement(height, 5, 0);
List<String> hashes = Collections.singletonList(transactionHash);
Mockito.when(transactionRepositoryMock.getTransactions(Mockito.eq(TransactionGroup.CONFIRMED), Mockito.eq(hashes))).thenReturn(Observable.just(Collections.singletonList(transaction)));
AccountMosaicRestrictionTransaction resolvedTransaction = (AccountMosaicRestrictionTransaction) service.resolveAliases(hashes).toFuture().get().get(0);
Assertions.assertEquals(Arrays.asList(mosaicId1, mosaicId2, mosaicId2), resolvedTransaction.getRestrictionAdditions());
Assertions.assertEquals(Arrays.asList(mosaicId2, mosaicId3, mosaicId3), resolvedTransaction.getRestrictionDeletions());
}
Aggregations