diff --git a/pom.xml b/pom.xml index d5eaaf6d..3805ed00 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.github.ontio ontology-sdk-java - 1.0.14 + 1.0.15 UTF-8 diff --git a/src/main/java/demo/ApiDemo.java b/src/main/java/demo/ApiDemo.java new file mode 100644 index 00000000..8366662e --- /dev/null +++ b/src/main/java/demo/ApiDemo.java @@ -0,0 +1,38 @@ +package demo; + +import com.github.ontio.OntSdk; + +/** + * @Description: + * @date 2019/12/12 + */ +public class ApiDemo { + + public static void main(String[] args) { + + try { + OntSdk ontSdk = getOntSdk(); + if (true) { + System.out.println(ontSdk.getConnect().getBalance("AHX1wzvdw9Yipk7E9MuLY4GGX4Ym9tHeDe")); + System.out.println(ontSdk.getConnect().getNodeSyncStatus()); + System.exit(0); + } + }catch (Exception ex){ + } + } + public static OntSdk getOntSdk() throws Exception { + + String ip = "http://polaris1.ont.io"; + String restUrl = ip + ":" + "20334"; + String rpcUrl = ip + ":" + "20336"; + String wsUrl = ip + ":" + "20335"; + + OntSdk wm = OntSdk.getInstance(); + wm.setRpc(rpcUrl); + wm.setRestful(restUrl); + wm.setDefaultConnect(wm.getRpc()); + wm.openWalletFile("wallet2.dat"); + + return wm; + } +}