#index?: number\r
#publicKey: Uint8Array<ArrayBuffer>\r
\r
+ #confirmed_balance?: bigint\r
+ #confirmed_block_height?: number\r
+ #confirmed_frontier_block?: string\r
+ #confirmed_receivable?: bigint\r
+ #confirmed_representative?: Account\r
+\r
#balance?: bigint\r
- #frontier?: string\r
+ #block_height?: number\r
+ #frontier_block?: string\r
+ #open_block?: string\r
#receivable?: bigint\r
#representative?: Account\r
+ #representative_block?: string\r
#weight?: bigint\r
\r
get address (): string { return `${PREFIX}${this.#address}` }\r
get index (): number | undefined { return this.#index }\r
get publicKey (): string { return bytes.toHex(this.#publicKey) }\r
\r
+ get confirmed_balance (): bigint | undefined { return this.#confirmed_balance }\r
+ get confirmed_block_height (): number | undefined { return this.#confirmed_block_height }\r
+ get confirmed_frontier_block (): string | undefined { return this.#confirmed_frontier_block }\r
+ get confirmed_receivable (): bigint | undefined { return this.#confirmed_receivable }\r
+ get confirmed_representative (): Account | undefined { return this.#confirmed_representative }\r
+\r
get balance (): bigint | undefined { return this.#balance }\r
- get frontier (): string | undefined { return this.#frontier }\r
+ get block_height (): number | undefined { return this.#block_height }\r
+ get frontier_block (): string | undefined { return this.#frontier_block }\r
+ get open_block (): string | undefined { return this.#open_block }\r
get receivable (): bigint | undefined { return this.#receivable }\r
get representative (): Account | undefined { return this.#representative }\r
+ get representative_block (): string | undefined { return this.#representative_block }\r
get weight (): bigint | undefined { return this.#weight }\r
\r
+ set confirmed_balance (v: bigint | number | string) { this.#confirmed_balance = BigInt(v) }\r
+ set confirmed_block_height (v: number | undefined) { if (v !== undefined) this.#confirmed_block_height = v | 0 }\r
+ set confirmed_frontier_block (v: string | undefined) { this.#confirmed_frontier_block = v }\r
+ set confirmed_receivable (v: bigint | number | string) { this.#confirmed_receivable = BigInt(v) }\r
+ set confirmed_representative (v: unknown) {\r
+ if (v instanceof Account) {\r
+ this.#confirmed_representative = v\r
+ } else if (typeof v === 'string') {\r
+ this.#confirmed_representative = Account.load(v)\r
+ } else {\r
+ throw new TypeError(`Invalid argument for account confirmed representative: ${v}`)\r
+ }\r
+ }\r
+\r
set balance (v: bigint | number | string) { this.#balance = BigInt(v) }\r
- set frontier (v: string | undefined) { this.#frontier = v }\r
+ set block_height (v: number | undefined) { if (v !== undefined) this.#block_height = v | 0 }\r
+ set frontier_block (v: string | undefined) { this.#frontier_block = v }\r
+ set open_block (v: string | undefined) { this.#open_block = v }\r
set receivable (v: bigint | number | string) { this.#receivable = BigInt(v) }\r
set representative (v: unknown) {\r
if (v instanceof Account) {\r
throw new TypeError(`Invalid argument for account representative: ${v}`)\r
}\r
}\r
+ set representative_block (v: string | undefined) { this.#representative_block = v }\r
set weight (v: bigint | number | string) { this.#weight = BigInt(v) }\r
\r
private constructor (address: string, publicKey: Key, index?: number) {\r
* allow garbage collection.\r
*/\r
async destroy (): Promise<void> {\r
- this.#frontier = undefined\r
+ this.#frontier_block = undefined\r
this.#balance = undefined\r
this.#receivable = undefined\r
this.#representative = undefined\r
}\r
const data = {\r
account: this.address,\r
+ include_confirmed: true,\r
receivable: true,\r
representative: true,\r
weight: true\r
}\r
- const { balance, frontier, receivable, representative, weight } = await rpc.call('account_info', data)\r
+ const { confirmed_balance, confirmed_frontier, confirmed_height, confirmed_receivable, confirmed_representative,\r
+ balance, block_count, frontier, open_block, receivable, representative, representative_block, weight,\r
+ } = await rpc.call('account_info', data)\r
+\r
if (frontier == null) {\r
throw new Error('Account not found')\r
}\r
- this.#balance = BigInt(balance)\r
- this.#frontier = frontier\r
- this.#receivable = BigInt(receivable)\r
- this.#representative = await Account.load(representative)\r
- this.#weight = BigInt(weight)\r
+ this.confirmed_balance = confirmed_balance\r
+ this.confirmed_block_height = confirmed_height\r
+ this.confirmed_frontier_block = confirmed_frontier\r
+ this.confirmed_representative = confirmed_representative\r
+ this.confirmed_receivable = confirmed_receivable\r
+ this.balance = balance\r
+ this.block_height = block_count\r
+ this.frontier_block = frontier\r
+ this.open_block = open_block\r
+ this.receivable = receivable\r
+ this.representative = representative\r
+ this.representative_block = representative_block\r
+ this.weight = weight\r
}\r
\r
/**\r
assert.notEqual(account.balance, '')
assert.equal(typeof account.balance, 'bigint')
//@ts-expect-error
- assert.ok(account.balance >= 0)
+ assert.ok(account.balance >= 0n)
- assert.exists(account.frontier)
- assert.equal(typeof account.frontier, 'string')
- assert.notEqual(account.frontier, '')
- assert.ok(/^[A-F0-9]{64}$/i.test(account.frontier ?? ''))
+ assert.exists(account.frontier_block)
+ assert.equal(typeof account.frontier_block, 'string')
+ assert.notEqual(account.frontier_block, '')
+ assert.ok(/^[A-F0-9]{64}$/i.test(account.frontier_block ?? ''))
assert.exists(account.representative)
assert.notEqual(account.representative, '')
assert.ok(account instanceof Account)
assert.equal(typeof account.balance, 'bigint')
- assert.exists(account.frontier)
- assert.equal(typeof account.frontier, 'string')
+ assert.exists(account.frontier_block)
+ assert.equal(typeof account.frontier_block, 'string')
await assert.resolves(wallet.destroy())
})