nano-rspow-web 0.8.0 → 0.10.0

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.
@@ -32,6 +32,13 @@ export function generate_work(hash_hex: string, threshold_hex: string): Promise<
32
32
  */
33
33
  export function generate_work_cpu(hash_hex: string, threshold_hex: string): GenerateResult;
34
34
 
35
+ /**
36
+ * Try up to max_nonces nonces in a single synchronous batch.
37
+ * Returns the nonce as a hex string if found, or `null` if the batch
38
+ * was exhausted. RNG state persists across calls.
39
+ */
40
+ export function generate_work_cpu_batch(hash_hex: string, threshold_hex: string, max_nonces: number): any;
41
+
35
42
  /**
36
43
  * Asynchronously generate Proof of Work forcing WebGPU execution.
37
44
  *
@@ -53,6 +60,7 @@ export interface InitOutput {
53
60
  readonly __wbg_wasmcanceltoken_free: (a: number, b: number) => void;
54
61
  readonly generate_work: (a: number, b: number, c: number, d: number) => any;
55
62
  readonly generate_work_cpu: (a: number, b: number, c: number, d: number) => [number, number, number];
63
+ readonly generate_work_cpu_batch: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
56
64
  readonly generate_work_gpu: (a: number, b: number, c: number, d: number, e: number) => any;
57
65
  readonly generateresult_is_gpu: (a: number) => number;
58
66
  readonly generateresult_nonce: (a: number) => [number, number];
package/nano_rspow_web.js CHANGED
@@ -104,6 +104,27 @@ export function generate_work_cpu(hash_hex, threshold_hex) {
104
104
  return GenerateResult.__wrap(ret[0]);
105
105
  }
106
106
 
107
+ /**
108
+ * Try up to max_nonces nonces in a single synchronous batch.
109
+ * Returns the nonce as a hex string if found, or `null` if the batch
110
+ * was exhausted. RNG state persists across calls.
111
+ * @param {string} hash_hex
112
+ * @param {string} threshold_hex
113
+ * @param {number} max_nonces
114
+ * @returns {any}
115
+ */
116
+ export function generate_work_cpu_batch(hash_hex, threshold_hex, max_nonces) {
117
+ const ptr0 = passStringToWasm0(hash_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
118
+ const len0 = WASM_VECTOR_LEN;
119
+ const ptr1 = passStringToWasm0(threshold_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
120
+ const len1 = WASM_VECTOR_LEN;
121
+ const ret = wasm.generate_work_cpu_batch(ptr0, len0, ptr1, len1, max_nonces);
122
+ if (ret[2]) {
123
+ throw takeFromExternrefTable0(ret[1]);
124
+ }
125
+ return takeFromExternrefTable0(ret[0]);
126
+ }
127
+
107
128
  /**
108
129
  * Asynchronously generate Proof of Work forcing WebGPU execution.
109
130
  *
@@ -586,12 +607,12 @@ function __wbg_get_imports() {
586
607
  arg0.writeBuffer(arg1, arg2, getArrayU8FromWasm0(arg3, arg4), arg5, arg6);
587
608
  }, arguments); },
588
609
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
589
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 63, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
610
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 64, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
590
611
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h15c04ebc453d8f26);
591
612
  return ret;
592
613
  },
593
614
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
594
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 98, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
615
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 99, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
595
616
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h58e4f4265216b47b);
596
617
  return ret;
597
618
  },
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nano-rspow-web",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "WebGPU-accelerated Nano (XNO) Proof of Work generation in the browser using WebAssembly",
5
5
  "repository": {
6
6
  "type": "git",