]> zoso.dev Git - nano-pow.git/commitdiff
Remove deprecated methods and unused types. next/recover-execution
authorChris Duncan <chris@zoso.dev>
Fri, 28 Mar 2025 03:32:45 +0000 (20:32 -0700)
committerChris Duncan <chris@zoso.dev>
Fri, 28 Mar 2025 03:32:45 +0000 (20:32 -0700)
src/lib/gl/index.ts

index fca8265e511d94487366784eac93dbc0fcecbc1a..315dfd5133d5c7454d6af10972297c92c5c1dee9 100644 (file)
@@ -5,7 +5,7 @@
 import { default as NanoPowGlDownsampleShader } from './gl-downsample.frag'
 import { default as NanoPowGlDrawShader } from './gl-draw.frag'
 import { default as NanoPowGlVertexShader } from './gl-vertex.vert'
-import type { FBO, NanoPowExecution, NanoPowOptions, WorkGenerateRequest, WorkGenerateResponse, WorkValidateRequest, WorkValidateResponse } from '../../types.d.ts'
+import type { FBO, NanoPowExecution, NanoPowOptions, WorkGenerateResponse, WorkValidateResponse } from '#types'
 
 /**
 * Nano proof-of-work using WebGL 2.0.
@@ -351,30 +351,6 @@ export class NanoPowGl {
                throw new Error('Query reported result but nonce value not found')
        }
 
-       /**
-       * 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 {NanoPowOptions} options - Used to configure search execution
-       */
-       static async search (hash: string, options?: NanoPowOptions): Promise<string> {
-               if (options?.threshold != null) {
-                       options.threshold = BigInt(`0x${options.threshold.toString(16) ?? '0'}00000000`)
-               }
-               this.#call = {
-                       method: 'search',
-                       hash,
-                       options
-               }
-               let result
-               try {
-                       result = await this.work_generate(hash, options)
-               } finally {
-                       this.#call = null
-               }
-               return result.work
-       }
-
        /**
        * Finds a nonce that satisfies the Nano proof-of-work requirements.
        *
@@ -478,33 +454,6 @@ export class NanoPowGl {
                }
        }
 
-       /**
-       * 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 {NanoPowOptions} options - Options used to configure search execution
-       */
-       static async validate (work: string, hash: string, options?: NanoPowOptions): Promise<boolean> {
-               if (options?.threshold != null) {
-                       options.threshold = BigInt(`0x${options.threshold.toString(16) ?? '0'}00000000`)
-               }
-               this.#call = {
-                       method: 'search',
-                       hash,
-                       options
-               }
-               let result
-               try {
-                       result = await this.work_validate(work, hash, options)
-               } finally {
-                       this.#call = null
-               }
-               return (options?.threshold != null)
-                       ? result.valid === '1'
-                       : result.valid_all === '1'
-       }
-
        /**
        * Validates that a nonce satisfies Nano proof-of-work requirements.
        *