import { Tools } from './lib/tools'
import { Bip44Wallet, Blake2bWallet, LedgerWallet } from './lib/wallets'
-export { Account, Blake2b, ChangeBlock, ReceiveBlock, SendBlock, Rolodex, Rpc, Tools, Bip44Wallet, Blake2bWallet, LedgerWallet }
+export {
+ Account,
+ Blake2b,
+ ChangeBlock, ReceiveBlock, SendBlock,
+ Rolodex,
+ Rpc,
+ Tools,
+ Bip44Wallet, Blake2bWallet, LedgerWallet
+}
* be fetched from the network.
*/
export declare class Account {
+ #private
get address (): string
get index (): number | undefined
get publicKey (): string
/**
* Instantiates an Account object from its Nano address.
*
- * @param {string} addresses - Address of the account
+ * @param {string} address - Address of the account
* @returns {Account} A new Account object
*/
static import (address: string): Account
*/
static validate (address: unknown): asserts address is string
}
+
export declare class AccountList extends Object {
[index: number]: Account
get length (): number;
*/
static checksum (entropy: Entropy): Promise<string>
/**
+ * Erases seed bytes and releases variable references to allow garbage
+ * collection.
+ */
+ destroy (): void
+ /**
* Validates a mnemonic phrase.
*
* @param {string} mnemonic - Mnemonic phrase to validate
*/
process (rpc: Rpc): Promise<string>
/**
- * Signs the block using a private key. If a key is not provided, the private
- * key of the block's account will be used if it exists. If that fails, an
- * error is thrown.
- *
- * If successful, the result is stored in the object's `signature`
- * property.
+ * Signs the block using a private key. If successful, the result is stored in
+ * the object's `signature` property.
*
* @param {string} [key] - Hexadecimal-formatted private key to use for signing
*/
static verify (name: string, signature: string, ...data: string[]): Promise<boolean>
}
+/**
+* Represents a Nano network node. It primarily consists of a URL which will
+* accept RPC calls, and an optional API key header construction can be passed if
+* required by the node. Once instantiated, the Rpc object can be used to call
+* any action supported by the Nano protocol. The URL protocol must be HTTPS; any
+* other value will be changed automatically.
+*/
+export declare class Rpc {
+ #private
+ constructor (url: string | URL, apiKeyName?: string)
+ /**
+ * Sends a nano RPC call to a node endpoint.
+ *
+ * @param {string} action - Nano protocol RPC call to execute
+ * @param {object} [data] - JSON to send to the node as defined by the action
+ * @returns {Promise<any>} JSON-formatted RPC results from the node
+ */
+ call (action: string, data?: {
+ [key: string]: unknown
+ }): Promise<any>
+}
+
type SweepResult = {
status: "success" | "error"
address: string
* @returns {Promise<boolean>} True if the data was signed by the public key's matching private key
*/
export declare function verify (key: Key, signature: string, ...input: string[]): Promise<boolean>
-
export declare const Tools: {
convert: typeof convert
hash: typeof hash
export declare const NanoNaClWorker: WorkerQueue
export declare const SafeWorker: WorkerQueue
-/**
-* Represents a Nano network node. It primarily consists of a URL which will
-* accept RPC calls, and an optional API key header construction can be passed if
-* required by the node. Once instantiated, the Rpc object can be used to call
-* any action supported by the Nano protocol. The URL protocol must be HTTPS; any
-* other value will be changed automatically.
-*/
-export declare class Rpc {
- constructor (url: string | URL, apiKeyName?: string)
- /**
- *
- * @param {string} action - Nano protocol RPC call to execute
- * @param {object} [data] - JSON to send to the node as defined by the action
- * @returns {Promise<any>} JSON-formatted RPC results from the node
- */
- call (action: string, data?: {
- [key: string]: any
- }): Promise<any>
-}
-
-export type SafeRecord = {
- label: string
- iv: ArrayBuffer
- salt: ArrayBuffer
- encrypted: ArrayBuffer
-}
-
export type UnknownNumber = number | unknown
export type UnknownUint8Array = Uint8Array | unknown