Added steem url and verifier
Added bip21 implementation with lowercase
This commit is contained in:
parent
8ff53de0ae
commit
6e81192b37
4 changed files with 16 additions and 29 deletions
|
@ -57,6 +57,17 @@ public class CrystalApplication extends Application {
|
|||
|
||||
public static final CryptoCurrency BITCOIN_CURRENCY = new CryptoCurrency("BTC",CryptoNet.BITCOIN,8);
|
||||
|
||||
public static String STEEM_URL[] =
|
||||
{
|
||||
"https://api.steemit.com",
|
||||
"https://api.steemitdev.com",
|
||||
"https://api.steemitstage.com",
|
||||
"https://api.steem.house",
|
||||
"https://appbasetest.timcliff.com",
|
||||
|
||||
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
@ -108,6 +119,8 @@ public class CrystalApplication extends Application {
|
|||
db.cryptoCurrencyDao().insertCryptoCurrency(BITCOIN_CURRENCY);
|
||||
}
|
||||
|
||||
CryptoNetManager.addCryptoNetURL(CryptoNet.STEEM,STEEM_URL);
|
||||
|
||||
|
||||
GeneralSetting generalSettingPreferredLanguage = db.generalSettingDao().getSettingByName(GeneralSetting.SETTING_NAME_PREFERRED_LANGUAGE);
|
||||
|
||||
|
|
|
@ -495,7 +495,7 @@ public class GeneralAccountManager implements CryptoAccountManager, CryptoNetInf
|
|||
}
|
||||
|
||||
private void calculateUri(CalculateBitcoinUriRequest request) {
|
||||
StringBuilder uri = new StringBuilder(this.cryptoCoin.getLabel()+":");
|
||||
StringBuilder uri = new StringBuilder(this.cryptoCoin.getLabel().toLowerCase()+":");
|
||||
|
||||
CrystalDatabase db = CrystalDatabase.getAppDatabase(request.getContext());
|
||||
long index = db.bitcoinAddressDao().getLastExternalAddress(request.getAccount().getId());
|
||||
|
|
|
@ -33,7 +33,6 @@ import cy.agorise.crystalwallet.models.GrapheneAccount;
|
|||
import cy.agorise.crystalwallet.models.GrapheneAccountInfo;
|
||||
import cy.agorise.crystalwallet.models.seed.BIP39;
|
||||
import cy.agorise.crystalwallet.network.CryptoNetManager;
|
||||
import cy.agorise.crystalwallet.requestmanagers.CryptoNetEquivalentRequest;
|
||||
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequest;
|
||||
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestsListener;
|
||||
import cy.agorise.crystalwallet.requestmanagers.GetBitsharesAccountNameCacheRequest;
|
||||
|
@ -185,8 +184,6 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
|
|||
this.validateExistAcccount((ValidateExistBitsharesAccountRequest) request);
|
||||
} else if (request instanceof ValidateBitsharesSendRequest) {
|
||||
this.validateSendRequest((ValidateBitsharesSendRequest) request);
|
||||
} else if (request instanceof CryptoNetEquivalentRequest) {
|
||||
this.getEquivalentValue((CryptoNetEquivalentRequest) request);
|
||||
} else if (request instanceof GetBitsharesAccountNameCacheRequest) {
|
||||
this.getBitsharesAccountNameCacheRequest((GetBitsharesAccountNameCacheRequest) request);
|
||||
} else {
|
||||
|
@ -699,31 +696,6 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current change from two assets
|
||||
*/
|
||||
private void getEquivalentValue(final CryptoNetEquivalentRequest request){
|
||||
if(request.getFromCurrency() instanceof BitsharesAsset && request.getToCurrency() instanceof BitsharesAsset) {
|
||||
BitsharesAsset fromAsset = (BitsharesAsset) request.getFromCurrency();
|
||||
BitsharesAsset toAsset = (BitsharesAsset) request.getToCurrency();
|
||||
ApiRequest getEquivalentRequest = new ApiRequest(0, new ApiRequestListener() {
|
||||
@Override
|
||||
public void success(Object answer, int idPetition) {
|
||||
request.setPrice((Long)answer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(int idPetition) {
|
||||
//TODO error
|
||||
}
|
||||
});
|
||||
GrapheneApiGenerator.getEquivalentValue(fromAsset.getBitsharesId(),toAsset.getBitsharesId(), getEquivalentRequest);
|
||||
}else{
|
||||
//TODO error
|
||||
System.out.println("Equivalent Value error ");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class to retrieve the account id or the account name, if one of those is missing
|
||||
*/
|
||||
|
|
|
@ -18,6 +18,8 @@ public abstract class CryptoNetVerifier {
|
|||
return new BitsharesCryptoNetVerifier();
|
||||
}else if(cryptoNet.getLabel().equals(CryptoNet.BITCOIN.getLabel())){
|
||||
return new BitcoinCryptoNetVerifier(CryptoCoin.BITCOIN);
|
||||
}else if(cryptoNet.getLabel().equals(CryptoNet.STEEM.getLabel())){
|
||||
return new SteemCryptoNetVerifier();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue