diff --git a/build.gradle b/build.gradle index 925fca8..61c8cb5 100644 --- a/build.gradle +++ b/build.gradle @@ -83,6 +83,8 @@ project(":core") { dependencies { compile "com.badlogicgames.gdx:gdx:$gdxVersion" compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" + compile "com.google.code.gson:gson:1.7.2" + } } diff --git a/core/src/com/jw/lightwallet/screens/MainScreen.java b/core/src/com/jw/lightwallet/screens/MainScreen.java index a01282b..ddc7f3e 100644 --- a/core/src/com/jw/lightwallet/screens/MainScreen.java +++ b/core/src/com/jw/lightwallet/screens/MainScreen.java @@ -1,19 +1,36 @@ package com.jw.lightwallet.screens; -import java.io.IOException; - +import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.jw.lightwallet.LightWallet; import com.jw.lightwallet.utils.DaemonRPC; public class MainScreen extends AbstractScreen { + // Interface classes DaemonRPC daemonrpc; + + // Layout stuff + Table screenlayout; + TextButton daemonbutton; + TextButton walletbutton; + Table daemonlayout; + + // Bitmonerod info variables + int blockheight; + int diff; + int hashrate; + float blockreward; public MainScreen(LightWallet game) { super(game); - daemonrpc = new DaemonRPC(); - daemonrpc.getinfo(); + daemonrpc = new DaemonRPC(); } + + public void show() { + super.show(); + + } } diff --git a/core/src/com/jw/lightwallet/utils/DaemonRPC.java b/core/src/com/jw/lightwallet/utils/DaemonRPC.java index d314c0d..956f9fe 100644 --- a/core/src/com/jw/lightwallet/utils/DaemonRPC.java +++ b/core/src/com/jw/lightwallet/utils/DaemonRPC.java @@ -1,33 +1,25 @@ package com.jw.lightwallet.utils; -import java.util.HashMap; -import java.util.Map; - import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Net.HttpMethods; import com.badlogic.gdx.Net.HttpRequest; import com.badlogic.gdx.Net.HttpResponse; import com.badlogic.gdx.Net.HttpResponseListener; -import com.badlogic.gdx.net.HttpParametersUtils; public class DaemonRPC { public String address; - public Map params; String status; + String getlastblock; public DaemonRPC () { - address = "http://moneroclub.com:8880"; + address = "http://node.moneroclub.com:8880/json_rpc"; + getlastblock = "{\"jsonrpc\":\"2.0\",\"id\":\"test\",\"method\":\"getlastblockheader\",\"params\":[]}"; } - public void getinfo () { - Map params = new HashMap(); - params.put("jsonrpc", "2.0"); - params.put("id", "test"); - params.put("method", "getinfo"); - + public void getinfo () { HttpRequest httpGet = new HttpRequest(HttpMethods.POST); - httpGet.setUrl("http://somewhere.net"); - httpGet.setContent(HttpParametersUtils.convertHttpParameters(params)); + httpGet.setUrl(address); + httpGet.setContent(getlastblock); Gdx.net.sendHttpRequest (httpGet, new HttpResponseListener() { public void handleHttpResponse(HttpResponse httpResponse) {