]> zoso.dev Git - nano-pow.git/commitdiff
Update typings.
authorChris Duncan <chris@zoso.dev>
Sat, 18 Jan 2025 23:06:21 +0000 (15:06 -0800)
committerChris Duncan <chris@zoso.dev>
Sat, 18 Jan 2025 23:06:21 +0000 (15:06 -0800)
types.d.ts

index f81da16b8bd3b46d8a401f4a0f5c4d8fe7d65131..3fe38ad5f334fcdbb543089e9b25b1b0d5f8b537 100644 (file)
@@ -15,7 +15,7 @@ declare const NanoPow: typeof NanoPowGl | typeof NanoPowGpu | null
 */
 export type NanoPowOptions = {
        debug?: boolean
-       effort?: 0x1 | 0x2 | 0x3 | 0x4 | 0x5 | 0x6 | 0x7 | 0x8 | 0x9 | 0xa | 0xb | 0xc | 0xd | 0xe | 0xf | 0x10
+       effort?: number
        threshold?: number
 }
 
@@ -23,13 +23,14 @@ export declare class NanoPowGl {
        #private
        /** Compile */
        static init (): Promise<void>
+       static reset (): void
        /**
        * Finds a nonce that satisfies the Nano proof-of-work requirements.
        *
        * @param {string} hash - Hexadecimal hash of previous block, or public key for new accounts
        * @param {number} [threshold=0xfffffff8] - Difficulty of proof-of-work calculation
        */
-       static search (hash: string, threshold?: number): Promise<string>
+       static search (hash: string, options?: NanoPowOptions): Promise<string>
        /**
        * Validates that a nonce satisfies Nano proof-of-work requirements.
        *
@@ -37,7 +38,7 @@ export declare class NanoPowGl {
        * @param {string} hash - Hexadecimal hash of previous block, or public key for new accounts
        * @param {number} [threshold=0xfffffff8] - Difficulty of proof-of-work calculation
        */
-       static validate (work: string, hash: string, threshold?: number): Promise<boolean>
+       static validate (work: string, hash: string, options?: NanoPowOptions): Promise<boolean>
 }
 
 /**
@@ -52,15 +53,15 @@ export declare class NanoPowGpu {
        * Finds a nonce that satisfies the Nano proof-of-work requirements.
        *
        * @param {string} hash - Hexadecimal hash of previous block, or public key for new accounts
-       * @param {number} [threshold=0xfffffff8] - Difficulty of proof-of-work calculation
+       * @param {NanoPowOptions} options - Used to configure search execution
        */
-       static search (hash: string, threshold?: number): Promise<string>
+       static search (hash: string, options?: NanoPowOptions): Promise<string>
        /**
        * Validates that a nonce satisfies Nano proof-of-work requirements.
        *
        * @param {string} work - Hexadecimal proof-of-work value to validate
        * @param {string} hash - Hexadecimal hash of previous block, or public key for new accounts
-       * @param {number} [threshold=0xfffffff8] - Difficulty of proof-of-work calculation
+       * @param {NanoPowOptions} options - Options used to configure search execution
        */
-       static validate (work: string, hash: string, threshold?: number): Promise<boolean>
+       static validate (work: string, hash: string, options?: NanoPowOptions): Promise<boolean>
 }