export class Account {\r
[key: string]: any\r
\r
+ static #isInternal: boolean = false\r
+ static get isInternal (): boolean { return this.#isInternal }\r
/**\r
- * @returns\r
- */\r
+ * @returns {'Account'}\r
+ */\r
static get DB_NAME (): 'Account' { return 'Account' }\r
\r
- static #isInternal: boolean = false\r
-\r
#address?: Address\r
#index?: number\r
#publicKey: Uint8Array<ArrayBuffer>\r
set weight (v: bigint | number | string) { this.#weight = BigInt(v) }\r
\r
private constructor (address: Address, publicKey: Uint8Array<ArrayBuffer>, index?: number) {\r
- if (!Account.#isInternal) {\r
+ if (!(this.constructor as typeof Account).isInternal) {\r
throw new Error('Account cannot be instantiated directly. Use `load()` instead.')\r
}\r
- Account.#isInternal = false\r
this.#address = address\r
this.#publicKey = publicKey\r
this.#index = index\r
const publicKey = await NanoNaCl.convert(privateKey)\r
const address = new Address(publicKey)\r
this.#isInternal = true\r
- accounts.push(new this(address, publicKey, index))\r
+ const account = new this(address, publicKey, index)\r
+ this.#isInternal = false\r
+ accounts.push(account)\r
}\r
return accounts\r
} catch (err) {\r
const address = new Address(keypair.publicKey)\r
const publicKey = address.toPublicKey()\r
this.#isInternal = true\r
- accounts.push(new this(address, publicKey, index))\r
+ const account = new this(address, publicKey, index)\r
+ this.#isInternal = false\r
+ accounts.push(account)\r
}\r
return accounts\r
} catch (err) {\r