get publicKey (): string
get confirmed_balance (): bigint | undefined
get confirmed_block_height (): number | undefined
- get confirmed_frontier_block (): string | undefined
+ get confirmed_frontier (): string | undefined
+ get confirmed_frontier_block (): Block | undefined
get confirmed_receivable (): bigint | undefined
get confirmed_representative (): Account | undefined
get balance (): bigint | undefined
get block_height (): number | undefined
- get frontier_block (): string | undefined
+ get frontier (): string | undefined
+ get frontier_block (): Block | undefined
get open_block (): string | undefined
get receivable (): bigint | undefined
get representative (): Account | undefined
get weight (): bigint | undefined
set confirmed_balance (v: bigint | number | string)
set confirmed_block_height (v: number | undefined)
- set confirmed_frontier_block (v: string | undefined)
+ set confirmed_frontier (v: string | undefined)
+ set confirmed_frontier_block (v: Block | undefined)
set confirmed_receivable (v: bigint | number | string)
set confirmed_representative (v: unknown)
set balance (v: bigint | number | string)
set block_height (v: number | undefined)
- set frontier_block (v: string | undefined)
+ set frontier (v: string | undefined)
+ set frontier_block (v: Block | undefined)
set open_block (v: string | undefined)
set receivable (v: bigint | number | string)
set representative (v: unknown)
*/
refresh (rpc: Rpc | string | URL): Promise<void>
/**
- * Validates a Nano address with 'nano' and 'xrb' prefixes
+ * Validates a Nano address with 'nano' and 'xrb' prefixes.
* Derived from https://github.com/alecrios/nano-address-validator
*
* @param {string} address - Nano address to validate
*/
export declare class Block {
#private
+ [key: string]: bigint | string | Account | Function | Uint8Array<ArrayBuffer> | 'send' | 'receive' | 'change' | undefined
subtype?: 'send' | 'receive' | 'change'
account: Account
balance: bigint
*/
sign (key: string): Promise<Block>
/**
- * Signs the block using a Ledger hardware wallet. If that fails, an error is
- * thrown with the status code from the device. If successful, the result is
- * stored in the `signature` property of the block. The wallet must be unlocked
- * prior to signing.
- *
- * @param {number} index - Account index between 0x0 and 0x7fffffff
- * @param {object} [frontier] - JSON of frontier block for offline signing
- * @returns Block with `signature` value set
- */
- sign (index: number, frontier?: Block): Promise<Block>
- /**
* Signs the block using a Wallet. If successful, the result is stored in
* the `signature` property of the block. The wallet must be unlocked prior to
* signing.
*/
sign (wallet: Wallet, index: number): Promise<Block>
/**
+ * Signs the block using a Ledger hardware wallet. If that fails, an error is
+ * thrown with the status code from the device. If successful, the result is
+ * stored in the `signature` property of the block. The wallet must be unlocked
+ * prior to signing.
+ *
+ * @param {number} index - Account index between 0x0 and 0x7fffffff
+ * @param {object} [frontier] - JSON of frontier block for offline signing
+ * @returns Block with `signature` value set
+ */
+ sign (wallet: Wallet, index: number, frontier?: Block): Promise<Block>
+ /**
* Verifies the signature of the block. If a key is not provided, the public
* key of the block's account will be used if it exists.
*
* saved under one nickname.
*/
export declare class Rolodex {
- static #private
+ #private
/**
* Adds an address to the rolodex under a specific nickname.
*
* them all to a single recipient address. Hardware wallets are unsupported.
*
* @param {Rpc|string|URL} rpc - RPC node information required to refresh accounts, calculate PoW, and process blocks
-* @param {(Wallet|Ledger)} wallet - Wallet from which to sweep funds
+* @param {(Wallet)} wallet - Wallet from which to sweep funds
* @param {string} recipient - Destination address for all swept funds
-* @param {number} from - Starting account index to sweep
-* @param {number} to - Ending account index to sweep
+* @param {number} [from=0] - Starting account index to sweep
+* @param {number} [to=from] - Ending account index to sweep
* @returns An array of results including both successes and failures
*/
-export declare function sweep (rpc: Rpc | string | URL, wallet: Wallet | Ledger, recipient: string, from?: number, to?: number): Promise<SweepResult[]>
+export declare function sweep (rpc: Rpc | string | URL, wallet: Wallet, recipient: string, from?: number, to?: number): Promise<SweepResult[]>
/**
* Verifies the signature of arbitrary strings using a public key.
*
*/
static backup (): Promise<NamedData[]>
/**
+ * Creates a new Ledger wallet manager.
+ *
+ * @param {string} type - Encrypts the wallet to lock and unlock it
+ * @returns {Wallet} A newly instantiated Wallet
+ */
+ static create (type: 'Ledger'): Promise<Wallet>
+ /**
* Creates a new HD wallet by using an entropy value generated using a
* cryptographically strong pseudorandom number generator.
*
* @param {string} [salt=''] - Used when generating the final seed
* @returns {Wallet} A newly instantiated Wallet
*/
- static create (type: 'BIP-44' | 'BLAKE2b', password: string, mnemonicSalt?: string): Promise<Wallet>
+ static create (type: 'BIP-44' | 'BLAKE2b', password?: string, mnemonicSalt?: string): Promise<Wallet>
/**
* Imports an existing HD wallet by using an entropy value generated using a
* cryptographically strong pseudorandom number generator.NamedD
*/
get id (): string
/**
- * Method used to create wallet and derive accounts.
+ * Algorithm or device used to create wallet and derive accounts.
*/
get type (): WalletType
/**
* ```
*
* If `from` is greater than `to`, their values will be swapped.
- * @param {number} from - Start index of accounts. Default: 0
- * @param {number} to - End index of accounts. Default: `from`
+ * @param {number} [from=0] - Start index of accounts. Default: 0
+ * @param {number} [to=from] - End index of accounts. Default: `from`
* @returns {AccountList} Promise for a list of Accounts at the specified indexes
*/
accounts (from?: number, to?: number): Promise<AccountList>
*/
destroy (): Promise<void>
/**
- * Clears the seed and mnemonic from the vault.
+ * For BIP-44 and BLAKE2b wallets, clears the seed and mnemonic from the vault.
+ *
+ * For Ledger hardware wallets, revokes permission granted by the user to
+ * access the Ledger device. The 'quit app' ADPU command is uncooperative, so
+ * this is currently the only way to ensure the connection is severed.
+ * `setTimeout` is used to expire any lingering transient user activation.
*/
lock (): void
/**
*
* 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<Account[]>} Accounts with updated balances, frontiers, and representatives
+ * @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
*/
refresh (rpc: Rpc | string | URL, from?: number, to?: number): Promise<AccountList>
/**
* before being returned. The wallet must be unlocked prior to signing.
*
* @param {number} index - Account to use for signing
- * @param {(Block)} block - Block data to be hashed and signed
+ * @param {Block} block - Block data to be hashed and signed
*/
sign (index: number, block: Block): Promise<void>
/**
+ * Signs a block using a Ledger hardware wallet at the wallet index specified.
+ * The signature is appended to the signature field of the block before being
+ * returned. The wallet must be unlocked prior to signing.
+ *
+ * @param {number} index - Account to use for signing
+ * @param {Block} block - Block data to be hashed and signed
+ * @param {Block} [frontier] - Previous block data to be cached by Ledger wallet
+ */
+ sign (index: number, block: Block, frontier?: Block): Promise<void>
+ /**
+ * Attempts to connect to the Ledger device.
+ */
+ unlock (): Promise<void>
+ /**
* Unlocks the wallet using the same password as used prior to lock it.
*
* @param {string} password Used previously to lock the wallet