Getting the account information

Get the public key and balance of an account.

Prerequisites

Method #01: Using the SDK

  1. Open a new file and call getAccountInfo function, passing your account’s address as a parameter.
const rawAddress = process.env.ADDRESS as string;
const address = Address.createFromRawAddress(rawAddress);

const accountHttp = new AccountHttp('http://localhost:3000');
accountHttp
    .getAccountInfo(address)
    .subscribe(accountInfo => console.log(accountInfo), err => console.error(err));
const rawAddress = process.env.ADDRESS;
const address = nem2_sdk_1.Address.createFromRawAddress(rawAddress);
const accountHttp = new nem2_sdk_1.AccountHttp('http://localhost:3000');
accountHttp
    .getAccountInfo(address)
    .subscribe(accountInfo => console.log(accountInfo), err => console.error(err));

Method #02: Using the CLI

nem2-cli account info --address SD5DT3-CH4BLA-BL5HIM-EKP2TA-PUKF4N-Y3L5HR-IR54