File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66
77 <groupId >com.github.ontio</groupId >
88 <artifactId >ontology-sdk-java</artifactId >
9- <version >1.0.14 </version >
9+ <version >1.0.15 </version >
1010
1111 <properties >
1212 <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
Original file line number Diff line number Diff line change 1+ package demo ;
2+
3+ import com .github .ontio .OntSdk ;
4+
5+ /**
6+ * @Description:
7+ * @date 2019/12/12
8+ */
9+ public class ApiDemo {
10+
11+ public static void main (String [] args ) {
12+
13+ try {
14+ OntSdk ontSdk = getOntSdk ();
15+ if (true ) {
16+ System .out .println (ontSdk .getConnect ().getBalance ("AHX1wzvdw9Yipk7E9MuLY4GGX4Ym9tHeDe" ));
17+ System .out .println (ontSdk .getConnect ().getNodeSyncStatus ());
18+ System .exit (0 );
19+ }
20+ }catch (Exception ex ){
21+ }
22+ }
23+ public static OntSdk getOntSdk () throws Exception {
24+
25+ String ip = "http://polaris1.ont.io" ;
26+ String restUrl = ip + ":" + "20334" ;
27+ String rpcUrl = ip + ":" + "20336" ;
28+ String wsUrl = ip + ":" + "20335" ;
29+
30+ OntSdk wm = OntSdk .getInstance ();
31+ wm .setRpc (rpcUrl );
32+ wm .setRestful (restUrl );
33+ wm .setDefaultConnect (wm .getRpc ());
34+ wm .openWalletFile ("wallet2.dat" );
35+
36+ return wm ;
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments