公開鍵とアカウントの残高を取得します。
新しいファイルを開いて、アカウントのアドレスを引数として 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));
}
ターミナルを開き、次のコマンドを実行します。
TCHBDE-NCLKEB-ILBPWP-3JPB2X-NY64OE-7PYHHE-32I
をあなたがクエリを発行したいアドレスに置き換えます。
symbol-cli account info --address TCHBDE-NCLKEB-ILBPWP-3JPB2X-NY64OE-7PYHHE-32I