]> git.codecow.com Git - libnemo.git/commitdiff
Update types.
authorChris Duncan <chris@zoso.dev>
Thu, 24 Jul 2025 15:04:43 +0000 (08:04 -0700)
committerChris Duncan <chris@zoso.dev>
Thu, 24 Jul 2025 15:04:43 +0000 (08:04 -0700)
src/main.ts
src/types.d.ts

index fe7b46f6d9852aa1359bdd104751752627bdc52e..7d4fb46568fd001180f07ef7ba85c11b155bf1cd 100644 (file)
@@ -9,4 +9,12 @@ import { Rpc } from './lib/rpc'
 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
+}
index adc548ee7330fe0914a6adb1f54ce60942993796..9670864304f3f8a4768032417c785da3131032ef 100644 (file)
@@ -12,6 +12,7 @@ import { default as TransportHID } from '@ledgerhq/hw-transport-webhid'
 * be fetched from the network.
 */
 export declare class Account {
+       #private
        get address (): string
        get index (): number | undefined
        get publicKey (): string
@@ -34,7 +35,7 @@ export declare class Account {
        /**
        * 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
@@ -148,6 +149,7 @@ export declare class Account {
        */
        static validate (address: unknown): asserts address is string
 }
+
 export declare class AccountList extends Object {
        [index: number]: Account
        get length (): number;
@@ -190,6 +192,11 @@ export declare class Bip39Mnemonic {
         */
        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
@@ -297,12 +304,8 @@ declare abstract class Block {
        */
        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
        */
@@ -502,6 +505,28 @@ export declare class Rolodex {
        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
@@ -545,7 +570,6 @@ export declare function sweep (rpc: Rpc | string | URL, wallet: Blake2bWallet |
 * @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
@@ -1016,33 +1040,6 @@ export declare const Bip44CkdWorker: WorkerQueue
 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