use of io.nem.symbol.sdk.model.transaction.AccountAddressRestrictionFlags in project nem2-sdk-java by nemtech.
the class AccountRestrictionIntegrationTest method addAndRemoveAddressRestriction.
@ParameterizedTest
@EnumSource(RepositoryType.class)
public void addAndRemoveAddressRestriction(RepositoryType type) {
AccountAddressRestrictionFlags restrictionFlags = AccountAddressRestrictionFlags.ALLOW_OUTGOING_ADDRESS;
Address address = getRecipient();
Assertions.assertNotNull(get(getRepositoryFactory(type).createAccountRepository().getAccountInfo(testAccount.getAddress())));
if (hasRestriction(type, testAccount, restrictionFlags, address)) {
System.out.println("Removing existing address restriction!");
sendAccountRestrictionAddress(type, address, false, restrictionFlags);
Assertions.assertFalse(hasRestriction(type, testAccount, restrictionFlags, address));
}
System.out.println("Adding address restriction");
sendAccountRestrictionAddress(type, address, true, restrictionFlags);
Assertions.assertTrue(hasRestriction(type, testAccount, restrictionFlags, address));
System.out.println("Removing address restriction");
sendAccountRestrictionAddress(type, address, false, restrictionFlags);
Assertions.assertFalse(hasRestriction(type, testAccount, restrictionFlags, address));
}
use of io.nem.symbol.sdk.model.transaction.AccountAddressRestrictionFlags in project nem2-sdk-java by nemtech.
the class AccountAddressRestrictionTransactionMapper method createFactory.
@Override
protected AccountAddressRestrictionTransactionFactory createFactory(NetworkType networkType, Deadline deadline, AccountAddressRestrictionTransactionDTO transaction) {
AccountAddressRestrictionFlags restrictionFlags = AccountAddressRestrictionFlags.rawValueOf(transaction.getRestrictionFlags().getValue());
List<UnresolvedAddress> restrictionAdditions = transaction.getRestrictionAdditions().stream().map(MapperUtils::toUnresolvedAddress).collect(Collectors.toList());
List<UnresolvedAddress> restrictionDeletions = transaction.getRestrictionDeletions().stream().map(MapperUtils::toUnresolvedAddress).collect(Collectors.toList());
return AccountAddressRestrictionTransactionFactory.create(networkType, deadline, restrictionFlags, restrictionAdditions, restrictionDeletions);
}
use of io.nem.symbol.sdk.model.transaction.AccountAddressRestrictionFlags in project nem2-sdk-java by nemtech.
the class AccountAddressRestrictionTransactionMapper method createFactory.
@Override
protected AccountAddressRestrictionTransactionFactory createFactory(NetworkType networkType, Deadline deadline, AccountAddressRestrictionTransactionDTO transaction) {
AccountAddressRestrictionFlags restrictionFlags = AccountAddressRestrictionFlags.rawValueOf(transaction.getRestrictionFlags().getValue());
List<UnresolvedAddress> restrictionAdditions = transaction.getRestrictionAdditions().stream().map(MapperUtils::toUnresolvedAddress).collect(Collectors.toList());
List<UnresolvedAddress> restrictionDeletions = transaction.getRestrictionDeletions().stream().map(MapperUtils::toUnresolvedAddress).collect(Collectors.toList());
return AccountAddressRestrictionTransactionFactory.create(networkType, deadline, restrictionFlags, restrictionAdditions, restrictionDeletions);
}
Aggregations