#i?: number\r
#f?: string\r
#b?: bigint\r
+ #p?: bigint\r
#r?: Account\r
+ #w?: bigint\r
#s: Safe\r
\r
get address () { return `${PREFIX}${this.#a}` }\r
get index () { return this.#i }\r
get frontier () { return this.#f }\r
get balance () { return this.#b?.toString() }\r
+ get pending () { return this.#p?.toString() }\r
get representative () { return this.#r }\r
+ get weight () { return this.#w?.toString() }\r
\r
set frontier (v) { this.#f = v }\r
set balance (v) { this.#b = v ? BigInt(v) : undefined }\r
+ set pending (v) { this.#p = v ? BigInt(v) : undefined }\r
set representative (v) {\r
if (v?.constructor === Account) {\r
this.#r = v\r
throw new TypeError(`Invalid argument for account representative: ${v}`)\r
}\r
}\r
+ set weight (v) { this.#w = v ? BigInt(v) : undefined }\r
\r
constructor (address: string, index?: number) {\r
Account.validate(address)\r
throw new TypeError('RPC must be a valid node')\r
}\r
const data = {\r
+ "account": this.address,\r
+ "pending": "true",\r
"representative": "true",\r
- "account": this.address\r
+ "weight": "true"\r
}\r
- const { balance, frontier, representative } = await node.call('account_info', data)\r
+ const { balance, frontier, pending, representative, weight } = await node.call('account_info', data)\r
if (frontier == null) {\r
throw new Error('Account not found')\r
}\r
this.#b = BigInt(balance)\r
this.#f = frontier\r
+ this.#p = BigInt(pending)\r
this.#r = new Account(representative)\r
+ this.#w = BigInt(weight)\r
}\r
\r
static #addressToKey (v: string): string {\r