\r
#confirmed_balance?: bigint\r
#confirmed_height?: number\r
- #confirmed_frontier?: string\r
+ #confirmed_frontier?: Hex\r
#confirmed_frontier_block?: Block\r
#confirmed_receivable?: bigint\r
#confirmed_representative?: Account\r
\r
get confirmed_balance (): bigint | undefined { return this.#confirmed_balance }\r
get confirmed_height (): number | undefined { return this.#confirmed_height }\r
- get confirmed_frontier (): string | undefined { return this.#confirmed_frontier }\r
+ get confirmed_frontier (): Hex | undefined { return this.#confirmed_frontier }\r
get confirmed_frontier_block (): Block | 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
set confirmed_balance (v: bigint | number | string) { this.#confirmed_balance = BigInt(v) }\r
set confirmed_height (v: number | undefined) { if (v !== undefined) this.#confirmed_height = v | 0 }\r
- set confirmed_frontier (v: string | undefined) { this.#confirmed_frontier = v }\r
+ set confirmed_frontier (v: Hex | undefined) { this.#confirmed_frontier = v }\r
set confirmed_frontier_block (v: Block | 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
import { Block } from '../block'
import { Rpc } from '../rpc'
import { AccountInfoRequest } from '../rpc/account_info'
+import { BlockInfoRequest } from '../rpc/block_info'
export async function _refresh (account: Account, rpc: Rpc | string | URL): Promise<void>
export async function _refresh (account: Account, rpc: unknown): Promise<void> {
account[k] = v
}
- const reqConfirmedFrontierBlockInfo = {
+ const reqConfirmedFrontierBlockInfo: BlockInfoRequest = {
+ hash: accountInfo.confirmed_frontier,
+ include_linked_account: true,
json_block: true,
- hash: account.confirmed_frontier
}
const resConfirmedFrontierBlockInfo = await rpc.post('block_info', reqConfirmedFrontierBlockInfo)
if (resConfirmedFrontierBlockInfo == null || typeof resConfirmedFrontierBlockInfo !== 'object') {
confirmedFrontierBlock[confirmedFrontierSubtype](confirmedFrontierContents.link, 0).signature = confirmedFrontierContents.signature
account.confirmed_frontier_block = confirmedFrontierBlock
- const reqFrontierBlockInfo = {
+ const reqFrontierBlockInfo: BlockInfoRequest = {
+ hash: accountInfo.frontier,
+ include_linked_account: true,
json_block: true,
- hash: account.frontier
}
const resFrontierBlockInfo = await rpc.post('block_info', reqFrontierBlockInfo)
if (resFrontierBlockInfo == null || typeof resFrontierBlockInfo !== 'object') {
//! SPDX-FileCopyrightText: 2026 Chris Duncan <chris@codecow.com>
//! SPDX-License-Identifier: GPL-3.0-or-later
+import { hex } from '../convert'
import { RpcError } from '../errors'
export type AccountInfoRequest = {
confirmation_height?: string
confirmation_height_frontier?: string
confirmed_balance: string
- confirmed_frontier: string
+ confirmed_frontier: Hex
confirmed_height: string
confirmed_pending?: string
confirmed_receivable: string
confirmed_representative: string
- frontier: string
+ frontier: Hex
modified_timestamp: string
open_block: string
pending?: string
&& 'balance' in body && typeof body.balance === 'string'
&& 'block_count' in body && typeof body.block_count === 'string'
&& 'confirmed_balance' in body && typeof body.confirmed_balance === 'string'
- && 'confirmed_frontier' in body && typeof body.confirmed_frontier === 'string'
+ && 'confirmed_frontier' in body && hex.is(body.confirmed_frontier)
&& 'confirmed_height' in body && typeof body.confirmed_height === 'string'
&& 'confirmed_receivable' in body && typeof body.confirmed_receivable === 'string'
&& 'confirmed_representative' in body && typeof body.confirmed_representative === 'string'
- && 'frontier' in body && typeof body.frontier === 'string'
+ && 'frontier' in body && hex.is(body.frontier)
&& 'modified_timestamp' in body && typeof body.modified_timestamp === 'string'
&& 'open_block' in body && typeof body.open_block === 'string'
&& 'receivable' in body && typeof body.receivable === 'string'
import { RpcError } from '../errors'
+export type BlockInfoRequest = {
+ hash: Hex
+ include_linked_account: true
+ json_block: true
+}
+
export type BlockInfoContents = {
account: string
balance: string