From f8d07ccc64fec0623fc1fe92f1c96e607b8c8d22 Mon Sep 17 00:00:00 2001 From: Henry Varona Date: Sat, 26 Nov 2016 18:45:36 -0400 Subject: [PATCH] Get account name WS --- src/main/java/com/luminiasoft/bitshares/Address.java | 4 ---- src/main/java/com/luminiasoft/bitshares/Test.java | 5 +++-- src/main/java/com/luminiasoft/bitshares/models/ApiCall.java | 2 -- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/luminiasoft/bitshares/Address.java b/src/main/java/com/luminiasoft/bitshares/Address.java index f355399..b757ff5 100644 --- a/src/main/java/com/luminiasoft/bitshares/Address.java +++ b/src/main/java/com/luminiasoft/bitshares/Address.java @@ -64,7 +64,6 @@ public class Address { factory.setSSLContext(context); WebSocket mWebSocket = factory.createSocket(OPENLEDGER_WITNESS_URL); mWebSocket.addListener(new GetAccountsByAddress(this.toString(), accountIdListener)); - System.out.println("Before connecting"); mWebSocket.connect(); } catch (IOException e) { System.out.println("IOException. Msg: " + e.getMessage()); @@ -95,11 +94,9 @@ public class Address { if (sl.size() > 0) { accountId = (String) sl.get(0); try { - // Create a custom SSL context. SSLContext context = NaiveSSLContext.getInstance("TLS"); WebSocketFactory factory = new WebSocketFactory(); factory.setSSLContext(context); - WebSocket mWebSocket = factory.createSocket(OPENLEDGER_WITNESS_URL); mWebSocket.addListener(new GetAccountNameById(accountId, accountListener)); mWebSocket.connect(); @@ -139,7 +136,6 @@ public class Address { if (response.result.getClass() == ArrayList.class) { List l = (List) response.result; if (l.size() > 0) { - System.out.println("list class " + l.get(0).getClass()); if (l.get(0).getClass() == LinkedTreeMap.class) { LinkedTreeMap ltm = (LinkedTreeMap) l.get(0); accountName = (String) ltm.get("name"); diff --git a/src/main/java/com/luminiasoft/bitshares/Test.java b/src/main/java/com/luminiasoft/bitshares/Test.java index 9c18cfa..bc6c32f 100644 --- a/src/main/java/com/luminiasoft/bitshares/Test.java +++ b/src/main/java/com/luminiasoft/bitshares/Test.java @@ -606,8 +606,9 @@ public class Test { public void testAccountNamebyAddress() { BrainKey brainKey = new BrainKey(Main.BRAIN_KEY, 0); - Address address = new Address(brainKey.getPrivateKey()); - address.getAccountName(); + Address address = new Address(brainKey.getPrivateKey()); + address.getAccountDetail(); + System.out.println(address.getAccountName()); /*try { BrainKey brainKey = new BrainKey(Main.BRAIN_KEY, 0); Address address = new Address(brainKey.getPrivateKey()); diff --git a/src/main/java/com/luminiasoft/bitshares/models/ApiCall.java b/src/main/java/com/luminiasoft/bitshares/models/ApiCall.java index b19c35e..c5e57a3 100644 --- a/src/main/java/com/luminiasoft/bitshares/models/ApiCall.java +++ b/src/main/java/com/luminiasoft/bitshares/models/ApiCall.java @@ -77,7 +77,6 @@ public class ApiCall implements JsonSerializable { methodParams.add((String) this.params.get(i)); }else if(this.params.get(i) instanceof ArrayList){ // Other times it might be an array - System.out.println("es un arreglo"); JsonArray array = new JsonArray(); ArrayList listArgument = (ArrayList) this.params.get(i); for(int l = 0; l < listArgument.size(); l++){ @@ -90,7 +89,6 @@ public class ApiCall implements JsonSerializable { paramsArray.add(methodParams); obj.add(KEY_PARAMS, paramsArray); obj.addProperty(KEY_JSON_RPC, this.jsonrpc); - System.out.println("JSON Object: " + obj.toString()); return obj; }