-
Notifications
You must be signed in to change notification settings - Fork 6
Explorer
John Smith edited this page Apr 26, 2020
·
2 revisions
BigDecimal balance = NKNExplorer.Wallet.queryBalance("NKNTknBaGnWXK7UB1KgnhaXrpJJc4qbCvwqs");
Checks whether a given address is in correct NKN format and does not contain typos (unless the typos happen to be very very unlucky to pass address checksum)
String address = "NKNTknBaGnWXK7UB1KgnhaXrpJJc4qbCvwqs"; // Change/add/remove any char and see if it is still valid
System.out.println("Address " + address + " is " + (NKNExplorer.isAddressValid(address) ? "" : "not ") + "valid");
Get the NKN address from a friendly name, registered using name service
String address = NKNExplorer.Wallet.resolveNamedAddress("somename");
Get a list of subscribers to a given topic (and bucket)
final NKNExplorer.Subscription.Subscriber[] subscribers = NKNExplorer.Subscription.getSubscribers(topic, bucket);
System.out.println("Subscribers of '" + topic + "':");
for (NKNExplorer.Subscription.Subscriber s : subscribers) {
System.out.println(" " + s.fullClientIdentifier + (s.meta.isEmpty() ? "" : ": " + s.meta));
}
System.out.println("Total: " + subscribers.length + " subs");
Beware: Both NKN nodes and this sdk are still work in progress and anything can change or stop working at any time.