* Releases variable references to allow garbage collection.
*/
destroy (): Promise<void>
+ /**
+ * Stringifies public properties into a JSON object so it can be further
+ * stringified by JSON.stringify()
+ */
+ toJSON (): {
+ address: string
+ index: number | undefined
+ publicKey: string
+ confirmed_balance: string | undefined
+ confirmed_height: string | undefined
+ confirmed_frontier: string | undefined
+ confirmed_receivable: string | undefined
+ confirmed_representative: string | undefined
+ balance: string | undefined
+ block_count: number | undefined
+ frontier: string | undefined
+ open_block: string | undefined
+ receivable: string | undefined
+ representative: string | undefined
+ representative_block: string | undefined
+ weight: string | undefined
+ }
/**
* Instantiates an Account object from its Nano address.
*
*/
export declare class Bip39 {
#private
+ encoder: TextEncoder
/**
- * https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt
- */
- static wordlist: readonly string[]
+ * SHA-256 hash of entropy that is appended to the entropy and subsequently
+ * used to generate the mnemonic phrase.
+ *
+ * @param {Uint8Array<ArrayBuffer>} entropy - Cryptographically strong pseudorandom data of length N bits
+ * @returns {Promise<bigint>} First N/32 bits of the hash as a bigint
+ */
+ static checksum (entropy: Uint8Array<ArrayBuffer>): Promise<bigint>
/**
* Derives a mnemonic phrase from source of entropy or seed.
*
* maximum entropy allowed.
*
* @param {(ArrayBuffer|Uint8Array<ArrayBuffer>)} entropy - Cryptographically secure random value
- * @returns {string} Mnemonic phrase created using the BIP-39 wordlist
+ * @returns {Promise<Bip39>} Mnemonic phrase created using the BIP-39 wordlist
*/
static fromEntropy (entropy: ArrayBuffer | Uint8Array<ArrayBuffer>): Promise<Bip39>
/**
* wallets use the maximum of 24 words.
*
* @param {string} phrase - String of 12, 15, 18, 21, or 24 words
- * @returns {string} Mnemonic phrase validated using the BIP-39 wordlist
+ * @returns {Promise<Bip39>} Mnemonic phrase validated using the BIP-39 wordlist
*/
static fromPhrase (phrase: string): Promise<Bip39>
/**
* Validates a mnemonic phrase meets the BIP-39 specification.
*
* @param {string} mnemonic - Mnemonic phrase to validate
- * @returns {boolean} True if the mnemonic phrase is valid
+ * @returns {Promise<boolean>} True if the mnemonic phrase is valid
*/
static validate (mnemonic: string): Promise<boolean>
- get phrase (): string | undefined
private constructor ()
/**
+ * BIP-39 mnemonic phrase, normlized using Normalization Form Compatibility
+ * Decomposition (NFKD).
+ */
+ get phrase (): string | undefined
+ /**
* Erases seed bytes and releases variable references.
*/
destroy (): void
/**
* Converts the mnemonic phrase to a BLAKE2b seed.
*
- * @returns {Promise<Uint8Array<ArrayBuffer>>} Promise for seed as bytes
+ * @returns {Uint8Array<ArrayBuffer>} Seed as bytes
*/
- toBlake2bSeed (): Promise<Uint8Array<ArrayBuffer>>
+ toBlake2bSeed (): Uint8Array<ArrayBuffer>
/**
* Converts the mnemonic phrase to a BLAKE2b seed.
*
* @param {string} format
- * @returns {Promise<string>} Promise for seed as hexadecimal string
+ * @returns {string} Seed as hexadecimal string
*/
- toBlake2bSeed (format: 'hex'): Promise<string>
+ toBlake2bSeed (format: 'hex'): string
+ /**
+ * https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt
+ */
+ static wordlist: readonly string[]
}
/**
* If `from` is greater than `to`, their values will be swapped.
* @param {number} [from=0] - Start index of accounts. Default: 0
* @param {number} [to=from] - End index of accounts. Default: `from`
- * @returns {Promise<AccountList>} Promise for a list of Accounts at the specified indexes
+ * @returns {Promise<Map<number, Account>>} Promise for a list of Accounts at the specified indexes
*/
accounts (from?: number, to?: number): Promise<Map<number, Account>>
/**
* A successful response will set these properties on each account.
*
* @param {(Rpc|string|URL)} rpc - RPC node information required to refresh accounts, calculate PoW, and process blocks
- * @returns {Promise<AccountList>} Promise for accounts with updated balances, frontiers, and representatives
+ * @returns {Promise<Map<number, Account>>} Promise for accounts with updated balances, frontiers, and representatives
*/
refresh (rpc: Rpc | string | URL, from?: number, to?: number): Promise<Map<number, Account>>
/**