From f6340de2e4db6eeaca45a1439a616a893b2b69b8 Mon Sep 17 00:00:00 2001 From: henry Date: Tue, 14 Nov 2017 22:50:25 -0400 Subject: [PATCH] change url of the bitshares api server --- .../apigenerator/GrapheneApiGenerator.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/apigenerator/GrapheneApiGenerator.java b/app/src/main/java/cy/agorise/crystalwallet/apigenerator/GrapheneApiGenerator.java index ac66720..0cb4d00 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/apigenerator/GrapheneApiGenerator.java +++ b/app/src/main/java/cy/agorise/crystalwallet/apigenerator/GrapheneApiGenerator.java @@ -57,8 +57,11 @@ public abstract class GrapheneApiGenerator { //TODO network connections //TODO make to work with all Graphene type, not only bitshares - public static String url = "http://128.0.69.157:8090"; - private static String equivalentUrl = "http://128.0.69.157:8090"; + //public static String url = "http://128.0.69.157:8090"; + //private static String equivalentUrl = "http://128.0.69.157:8090"; + public static String url = "wss://bitshares.openledger.info/ws"; + private static String equivalentUrl = "wss://bitshares.openledger.info/ws"; + // The message broker for bitshares private static SubscriptionMessagesHub bitsharesSubscriptionHub = new SubscriptionMessagesHub("", "", true, new NodeErrorListener() { @@ -595,12 +598,18 @@ public abstract class GrapheneApiGenerator { //TODO indirect equivalent value } for(LimitOrder order : orders){ - if(order.getSellPrice().base.getAsset().getBitassetId().equals(baseAsset.getBitsharesId())) { - Converter converter = new Converter(); - double equiValue = converter.getConversionRate(order.getSellPrice(), Converter.BASE_TO_QUOTE); - CryptoCurrencyEquivalence equivalence = new CryptoCurrencyEquivalence(baseAsset.getId(), quoteAsset.getId(), (int) (Math.pow(10, baseAsset.getPrecision()) * equiValue), new Date()); - CrystalDatabase.getAppDatabase(context).cryptoCurrencyEquivalenceDao().insertCryptoCurrencyEquivalence(equivalence); - break; + try { + //if (order.getSellPrice().base.getAsset().getBitassetId().equals(baseAsset.getBitsharesId())) { + Converter converter = new Converter(); + order.getSellPrice().base.getAsset().setPrecision(baseAsset.getPrecision()); + order.getSellPrice().quote.getAsset().setPrecision(quoteAsset.getPrecision()); + double equiValue = converter.getConversionRate(order.getSellPrice(), Converter.BASE_TO_QUOTE); + CryptoCurrencyEquivalence equivalence = new CryptoCurrencyEquivalence(baseAsset.getId(), quoteAsset.getId(), (int) (Math.pow(10, baseAsset.getPrecision()) * equiValue), new Date()); + CrystalDatabase.getAppDatabase(context).cryptoCurrencyEquivalenceDao().insertCryptoCurrencyEquivalence(equivalence); + break; + //} + }catch(Exception e){ + e.printStackTrace(); } } }