use of io.nuls.account.model.Account in project nuls by nuls-io.
the class AccountServiceTest method removeAccount.
@Test
public void removeAccount() {
List<Account> accounts = this.accountService.createAccount(2, "nuls123456").getData();
Result result0 = accountService.removeAccount(accounts.get(0).getAddress().toString(), "nuls123456");
assertTrue(result0.isSuccess());
Result result1 = accountService.removeAccount(accounts.get(1).getAddress().toString(), "123456");
assertTrue(result1.isFailed());
}
use of io.nuls.account.model.Account in project nuls by nuls-io.
the class AccountServiceTest method exportAccountToKeyStore.
@Test
public void exportAccountToKeyStore() {
List<Account> accounts = this.accountService.createAccount(1, "nuls123456").getData();
Account account = accounts.get(0);
Result<AccountKeyStore> result = accountService.exportAccountToKeyStore(account.getAddress().toString(), "nuls123456");
try {
System.out.println(JSONUtils.obj2PrettyJson(result.getData()));
} catch (Exception e) {
e.printStackTrace();
}
assertNotNull(result.getData());
}
use of io.nuls.account.model.Account in project nuls by nuls-io.
the class AccountServiceTest method isEncypted.
@Test
public void isEncypted() {
List<Account> accounts = this.accountService.createAccount(1, "nuls123456").getData();
Account account = accounts.get(0);
assertTrue(accountService.isEncrypted(account.getAddress().toString()).isSuccess());
List<Account> accounts2 = this.accountService.createAccount(1, "").getData();
Account account2 = accounts2.get(0);
assertTrue(accountService.isEncrypted(account2.getAddress().toString()).isFailed());
}
use of io.nuls.account.model.Account in project nuls by nuls-io.
the class AccountServiceTest method importAccount.
@Test
public void importAccount() {
AccountKeyStore accountKeyStore = new AccountKeyStore();
accountKeyStore.setAddress("Ns5fRyLX5Z6aNrxSGijUcR9SwjnVivi");
accountKeyStore.setAlias(null);
accountKeyStore.setEncryptedPrivateKey("8fd44822ecf4589c02722f2b8f8e8636cd3106c8b85f0fbc87c78bdef64512f7c604e42e3d829fdbe981fb135ed46dc8");
accountKeyStore.setPrikey(null);
accountKeyStore.setPubKey(Hex.decode("025e11c5bba00490c15ff9f0c5e24c7141204282fec3ef9b179cc77d947161c4cc"));
Result<Account> result = accountService.importAccountFormKeyStore(accountKeyStore, "nuls123456");
assertTrue(result.isSuccess());
assertNotNull(accountService.getAccount(result.getData().getAddress()));
}
use of io.nuls.account.model.Account in project nuls by nuls-io.
the class AliasServiceTest method saveAlias.
@Test
public void saveAlias() {
List<Account> accounts = accountService.createAccount(1, "nuls123456").getData();
Account account = accounts.get(0);
Alias alias = new Alias(account.getAddress().getAddressBytes(), "lichao");
try {
assertTrue(aliasService.saveAlias(new AliasPo(alias)).isSuccess());
} catch (NulsException e) {
e.printStackTrace();
}
}
Aggregations