nano-pow 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/global.min.js +1 -1
- package/dist/main.min.js +1 -1
- package/dist/types.d.ts +53 -0
- package/package.json +7 -8
package/dist/global.min.js
CHANGED
|
@@ -668,7 +668,7 @@ try {
|
|
|
668
668
|
}
|
|
669
669
|
var NanoPow = isGpuSupported ? NanoPowGpu : isGlSupported ? NanoPowGl : null;
|
|
670
670
|
|
|
671
|
-
//
|
|
671
|
+
// src/global.ts
|
|
672
672
|
globalThis.NanoPow ??= NanoPow;
|
|
673
673
|
globalThis.NanoPowGl ??= NanoPowGl;
|
|
674
674
|
globalThis.NanoPowGpu ??= NanoPowGpu;
|
package/dist/main.min.js
CHANGED
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import "@webgpu/types"
|
|
2
|
+
|
|
3
|
+
declare const NanoPow: typeof NanoPowGl | typeof NanoPowGpu | null
|
|
4
|
+
|
|
5
|
+
export declare class NanoPowGl {
|
|
6
|
+
#private
|
|
7
|
+
/** Compile */
|
|
8
|
+
static init (): Promise<void>
|
|
9
|
+
/**
|
|
10
|
+
* Finds a nonce that satisfies the Nano proof-of-work requirements.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} hash - Hexadecimal hash of previous block, or public key for new accounts
|
|
13
|
+
* @param {number} [threshold=0xfffffff8] - Difficulty of proof-of-work calculation
|
|
14
|
+
*/
|
|
15
|
+
static search (hash: string, threshold?: number): Promise<string>
|
|
16
|
+
/**
|
|
17
|
+
* Validates that a nonce satisfies Nano proof-of-work requirements.
|
|
18
|
+
*
|
|
19
|
+
* @param {string} work - Hexadecimal proof-of-work value to validate
|
|
20
|
+
* @param {string} hash - Hexadecimal hash of previous block, or public key for new accounts
|
|
21
|
+
* @param {number} [threshold=0xfffffff8] - Difficulty of proof-of-work calculation
|
|
22
|
+
*/
|
|
23
|
+
static validate (work: string, hash: string, threshold?: number): Promise<boolean>
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Nano proof-of-work using WebGPU.
|
|
28
|
+
*/
|
|
29
|
+
export declare class NanoPowGpu {
|
|
30
|
+
#private
|
|
31
|
+
static init (): Promise<void>
|
|
32
|
+
static setup (): void
|
|
33
|
+
static reset (): void
|
|
34
|
+
/**
|
|
35
|
+
* Finds a nonce that satisfies the Nano proof-of-work requirements.
|
|
36
|
+
*
|
|
37
|
+
* @param {string} hash - Hexadecimal hash of previous block, or public key for new accounts
|
|
38
|
+
* @param {number} [threshold=0xfffffff8] - Difficulty of proof-of-work calculation
|
|
39
|
+
*/
|
|
40
|
+
static search (hash: string, threshold?: number): Promise<string>
|
|
41
|
+
/**
|
|
42
|
+
* Validates that a nonce satisfies Nano proof-of-work requirements.
|
|
43
|
+
*
|
|
44
|
+
* @param {string} work - Hexadecimal proof-of-work value to validate
|
|
45
|
+
* @param {string} hash - Hexadecimal hash of previous block, or public key for new accounts
|
|
46
|
+
* @param {number} [threshold=0xfffffff8] - Difficulty of proof-of-work calculation
|
|
47
|
+
*/
|
|
48
|
+
static validate (work: string, hash: string, threshold?: number): Promise<boolean>
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export declare const NanoPowGlFragmentShader: string
|
|
52
|
+
export declare const NanoPowGlVertexShader: string
|
|
53
|
+
export declare const NanoPowGpuComputeShader: any
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nano-pow",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Proof-of-work generation and validation with WebGPU/WebGL for Nano cryptocurrency.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nemo",
|
|
@@ -40,11 +40,7 @@
|
|
|
40
40
|
"url": "git+https://zoso.dev/nano-pow.git"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
|
-
"build": "rm -rf
|
|
44
|
-
},
|
|
45
|
-
"imports": {
|
|
46
|
-
"#classes": "./src/classes/index.js",
|
|
47
|
-
"#shaders": "./src/shaders/index.js"
|
|
43
|
+
"build": "rm -rf types && tsc && node esbuild.mjs && cp types.d.ts dist"
|
|
48
44
|
},
|
|
49
45
|
"devDependencies": {
|
|
50
46
|
"@types/node": "^22.10.5",
|
|
@@ -55,7 +51,10 @@
|
|
|
55
51
|
"typescript": "^5.7.3"
|
|
56
52
|
},
|
|
57
53
|
"type": "module",
|
|
58
|
-
"exports":
|
|
59
|
-
|
|
54
|
+
"exports": [
|
|
55
|
+
"./dist/main.min.js",
|
|
56
|
+
"./dist/types.d.ts"
|
|
57
|
+
],
|
|
58
|
+
"types": "dist/types.d.ts",
|
|
60
59
|
"unpkg": "dist/main.min.js"
|
|
61
60
|
}
|