公開鍵とアカウントの残高を取得します。
新しいファイルを開いて、アカウントのアドレスを引数として AccountHttp
リポジトリから getAccountInfo
関数を呼びます。
// replace with address
const rawAddress = 'TB6Q5E-YACWBP-CXKGIL-I6XWCH-DRFLTB-KUK34I-YJQ';
const address = Address.createFromRawAddress(rawAddress);
// replace with node endpoint
const nodeUrl = 'NODE_URL';
const repositoryFactory = new RepositoryFactoryHttp(nodeUrl);
const accountHttp = repositoryFactory.createAccountRepository();
accountHttp.getAccountInfo(address).subscribe(
(accountInfo) => console.log(accountInfo),
(err) => console.error(err),
);
// replace with address
const rawAddress = 'TB6Q5E-YACWBP-CXKGIL-I6XWCH-DRFLTB-KUK34I-YJQ';
const address = symbol_sdk_1.Address.createFromRawAddress(rawAddress);
// replace with node endpoint
const nodeUrl = 'NODE_URL';
const repositoryFactory = new symbol_sdk_1.RepositoryFactoryHttp(nodeUrl);
const accountHttp = repositoryFactory.createAccountRepository();
accountHttp.getAccountInfo(address).subscribe(
(accountInfo) => console.log(accountInfo),
(err) => console.error(err),
);
// replace with node endpoint
try (final RepositoryFactory repositoryFactory = new RepositoryFactoryVertxImpl(
"NODE_URL")) {
final AccountRepository accountRepository = repositoryFactory
.createAccountRepository();
// Replace with an address
final String rawAddress = "TB6Q5E-YACWBP-CXKGIL-I6XWCH-DRFLTB-KUK34I-YJQ";
final Address address = Address.createFromRawAddress(rawAddress);
final AccountInfo accountInfo = accountRepository
.getAccountInfo(address).toFuture().get();
final JsonHelper helper = new JsonHelperJackson2();
System.out.println(helper.prettyPrint(accountInfo));
}