Added the request service and the bitshares logic to the upgrade to LTM account.
Still we need the implementation of graphenej library to finish this implementation.
This commit is contained in:
parent
6598d4aacb
commit
f23d1c4a58
2 changed files with 77 additions and 0 deletions
|
@ -23,6 +23,7 @@ import cy.agorise.crystalwallet.models.seed.BIP39;
|
|||
import cy.agorise.crystalwallet.requestmanagers.CryptoNetEquivalentRequest;
|
||||
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequest;
|
||||
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestsListener;
|
||||
import cy.agorise.crystalwallet.requestmanagers.ValidateBitsharesLTMUpgradeRequest;
|
||||
import cy.agorise.crystalwallet.requestmanagers.ValidateBitsharesSendRequest;
|
||||
import cy.agorise.crystalwallet.requestmanagers.ValidateCreateBitsharesAccountRequest;
|
||||
import cy.agorise.crystalwallet.requestmanagers.ValidateExistBitsharesAccountRequest;
|
||||
|
@ -227,6 +228,8 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
|
|||
this.getEquivalentValue((CryptoNetEquivalentRequest) request);
|
||||
}else if (request instanceof ValidateCreateBitsharesAccountRequest){
|
||||
this.validateCreateAccount((ValidateCreateBitsharesAccountRequest) request);
|
||||
}else if (request instanceof ValidateBitsharesLTMUpgradeRequest){
|
||||
this.validateLTMAccountUpgrade((ValidateBitsharesLTMUpgradeRequest) request);
|
||||
}else{
|
||||
//TODO not implemented
|
||||
System.out.println("Error request not implemented " + request.getClass().getName());
|
||||
|
@ -436,6 +439,15 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcast a transaction request
|
||||
*/
|
||||
private void validateLTMAccountUpgrade(final ValidateBitsharesLTMUpgradeRequest sendRequest) {
|
||||
//TODO check internet, server connection
|
||||
sendRequest.setStatus(ValidateBitsharesLTMUpgradeRequest.StatusCode.PETITION_FAILED);
|
||||
CrystalDatabase db = CrystalDatabase.getAppDatabase(sendRequest.getContext());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the account info from a graphene id
|
||||
* @param grapheneId The graphene id of the account
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
package cy.agorise.crystalwallet.requestmanagers;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import cy.agorise.crystalwallet.enums.CryptoCoin;
|
||||
import cy.agorise.crystalwallet.models.GrapheneAccount;
|
||||
|
||||
/**
|
||||
* Class used to make a send amount request.
|
||||
*
|
||||
* Created by henry on 8/10/2017.
|
||||
*/
|
||||
|
||||
public class ValidateBitsharesLTMUpgradeRequest extends CryptoNetInfoRequest {
|
||||
/**
|
||||
* The status code of this request
|
||||
*/
|
||||
public enum StatusCode{
|
||||
NOT_STARTED,
|
||||
SUCCEEDED,
|
||||
NO_INTERNET,
|
||||
NO_SERVER_CONNECTION,
|
||||
NO_ASSET_INFO_DB,
|
||||
NO_ASSET_INFO,
|
||||
NO_FUNDS,
|
||||
PETITION_FAILED
|
||||
}
|
||||
|
||||
// The app context
|
||||
private Context mContext;
|
||||
// The source account used to transfer fund from
|
||||
private GrapheneAccount mSourceAccount;
|
||||
// The state of this request
|
||||
private StatusCode status = StatusCode.NOT_STARTED;
|
||||
|
||||
public ValidateBitsharesLTMUpgradeRequest(Context context, GrapheneAccount sourceAccount) {
|
||||
super(CryptoCoin.BITSHARES);
|
||||
this.mContext = context;
|
||||
this.mSourceAccount = sourceAccount;
|
||||
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return mContext;
|
||||
}
|
||||
|
||||
public GrapheneAccount getSourceAccount() {
|
||||
return mSourceAccount;
|
||||
}
|
||||
|
||||
public void validate(){
|
||||
if ((this.status != StatusCode.NOT_STARTED)){
|
||||
this._fireOnCarryOutEvent();
|
||||
}
|
||||
}
|
||||
|
||||
public void setStatus(StatusCode code){
|
||||
this.status = code;
|
||||
this.validate();
|
||||
}
|
||||
|
||||
public StatusCode getStatus() {
|
||||
return status;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue