-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |