2017-09-27 02:48:34 +00:00
|
|
|
package cy.agorise.crystalwallet.manager;
|
|
|
|
|
2017-10-03 02:49:17 +00:00
|
|
|
import cy.agorise.crystalwallet.apigenerator.ApiRequest;
|
|
|
|
import cy.agorise.crystalwallet.apigenerator.ApiRequestListener;
|
|
|
|
import cy.agorise.crystalwallet.apigenerator.GrapheneApiGenerator;
|
2017-10-02 02:18:56 +00:00
|
|
|
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequest;
|
|
|
|
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestsListener;
|
|
|
|
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateImportBitsharesAccountRequest;
|
2017-09-27 02:48:34 +00:00
|
|
|
import cy.agorise.crystalwallet.models.CryptoNetAccount;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by henry on 26/9/2017.
|
|
|
|
*/
|
|
|
|
|
2017-10-02 02:18:56 +00:00
|
|
|
public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetInfoRequestsListener {
|
2017-09-27 02:48:34 +00:00
|
|
|
@Override
|
|
|
|
public CryptoNetAccount createAccountFromSeed(CryptoNetAccount account) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public CryptoNetAccount importAccountFromSeed(CryptoNetAccount account) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void loadAccountFromDB(CryptoNetAccount account) {
|
|
|
|
|
|
|
|
}
|
2017-10-02 02:18:56 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onNewRequest(CryptoNetInfoRequest request) {
|
|
|
|
if (request instanceof ValidateImportBitsharesAccountRequest){
|
2017-10-03 02:49:17 +00:00
|
|
|
final ValidateImportBitsharesAccountRequest importRequest = (ValidateImportBitsharesAccountRequest) request;
|
|
|
|
ApiRequest checkAccountName = new ApiRequest(0, new ApiRequestListener() {
|
|
|
|
@Override
|
|
|
|
public void success(Object answer, int idPetition) {
|
|
|
|
ApiRequest getAccountInfo = new ApiRequest(1,new ApiRequestListener(){
|
|
|
|
@Override
|
|
|
|
public void success(Object answer, int idPetition) {
|
|
|
|
//TODO compare keys
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void fail(int idPetition) {
|
|
|
|
importRequest._fireOnCarryOutEvent();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
GrapheneApiGenerator.getAccountById((String)answer,getAccountInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void fail(int idPetition) {
|
|
|
|
importRequest._fireOnCarryOutEvent();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
GrapheneApiGenerator.getAccountIdByName(importRequest.getAccountName(),checkAccountName);
|
2017-10-02 02:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
2017-09-27 02:48:34 +00:00
|
|
|
}
|