Fixed error feedback on import request
This commit is contained in:
parent
e8ceb88c6e
commit
c4ac6b4a29
2 changed files with 39 additions and 32 deletions
|
@ -129,8 +129,13 @@ public abstract class GrapheneApiGenerator {
|
||||||
List<UserAccount> accounts = resp.get(0);
|
List<UserAccount> accounts = resp.get(0);
|
||||||
if(accounts.size() > 0){
|
if(accounts.size() > 0){
|
||||||
for(UserAccount account : accounts) {
|
for(UserAccount account : accounts) {
|
||||||
request.getListener().success(account,request.getId());}}}
|
request.getListener().success(account, request.getId());
|
||||||
request.getListener().fail(request.getId());
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
request.getListener().fail(request.getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -276,44 +276,46 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fail(int idPetition) {
|
public void fail(int idPetition) {
|
||||||
//importRequest.setStatus(ImportBitsharesAccountRequest.StatusCode.PETITION_FAILED);
|
BIP39 bip39 = new BIP39(-1, importRequest.getMnemonic());
|
||||||
}
|
ApiRequest getAccountNamesBP39 = new ApiRequest(0, new ApiRequestListener() {
|
||||||
});
|
@Override
|
||||||
|
public void success(Object answer, int idPetition) {
|
||||||
|
if(answer != null && importRequest.getStatus().equals(ImportBitsharesAccountRequest.StatusCode.NOT_STARTED)) {
|
||||||
|
UserAccount userAccount = (UserAccount) answer;
|
||||||
|
importRequest.setSeedType(SeedType.BIP39);
|
||||||
|
importRequest.setStatus(ImportBitsharesAccountRequest.StatusCode.SUCCEEDED);
|
||||||
|
|
||||||
ApiRequest getAccountNamesBP39 = new ApiRequest(0, new ApiRequestListener() {
|
AccountSeed seed = new AccountSeed();
|
||||||
@Override
|
seed.setName(userAccount.getName());
|
||||||
public void success(Object answer, int idPetition) {
|
seed.setType(importRequest.getSeedType());
|
||||||
if(answer != null && importRequest.getStatus().equals(ImportBitsharesAccountRequest.StatusCode.NOT_STARTED)) {
|
seed.setMasterSeed(importRequest.getMnemonic());
|
||||||
UserAccount userAccount = (UserAccount) answer;
|
long idSeed = accountSeedDao.insertAccountSeed(seed);
|
||||||
importRequest.setSeedType(SeedType.BIP39);
|
if (idSeed >= 0) {
|
||||||
importRequest.setStatus(ImportBitsharesAccountRequest.StatusCode.SUCCEEDED);
|
GrapheneAccount account = new GrapheneAccount();
|
||||||
|
account.setCryptoNet(CryptoNet.BITSHARES);
|
||||||
AccountSeed seed = new AccountSeed();
|
account.setAccountIndex(0);
|
||||||
seed.setName(userAccount.getName());
|
account.setSeedId(idSeed);
|
||||||
seed.setType(importRequest.getSeedType());
|
account.setAccountId(userAccount.getObjectId());
|
||||||
seed.setMasterSeed(importRequest.getMnemonic());
|
importAccountFromSeed(account, importRequest.getContext());
|
||||||
long idSeed = accountSeedDao.insertAccountSeed(seed);
|
}
|
||||||
if (idSeed >= 0) {
|
}
|
||||||
GrapheneAccount account = new GrapheneAccount();
|
|
||||||
account.setCryptoNet(CryptoNet.BITSHARES);
|
|
||||||
account.setAccountIndex(0);
|
|
||||||
account.setSeedId(idSeed);
|
|
||||||
account.setAccountId(userAccount.getObjectId());
|
|
||||||
importAccountFromSeed(account, importRequest.getContext());
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fail(int idPetition) {
|
public void fail(int idPetition) {
|
||||||
//importRequest.setStatus(ImportBitsharesAccountRequest.StatusCode.PETITION_FAILED);
|
importRequest.setStatus(ImportBitsharesAccountRequest.StatusCode.PETITION_FAILED);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
GrapheneApiGenerator.getAccountByOwnerOrActiveAddress(new Address(ECKey.fromPublicOnly(bip39.getBitsharesActiveKey(0).getPubKey())),getAccountNamesBP39);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BrainKey bk = new BrainKey(importRequest.getMnemonic(), 0);
|
BrainKey bk = new BrainKey(importRequest.getMnemonic(), 0);
|
||||||
BIP39 bip39 = new BIP39(-1, importRequest.getMnemonic());
|
|
||||||
GrapheneApiGenerator.getAccountByOwnerOrActiveAddress(bk.getPublicAddress("BTS"),getAccountNamesBK);
|
GrapheneApiGenerator.getAccountByOwnerOrActiveAddress(bk.getPublicAddress("BTS"),getAccountNamesBK);
|
||||||
GrapheneApiGenerator.getAccountByOwnerOrActiveAddress(new Address(ECKey.fromPublicOnly(bip39.getBitsharesActiveKey(0).getPubKey())),getAccountNamesBP39);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue