zeldhash-miner 0.2.1 → 0.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/README.md CHANGED
@@ -204,9 +204,39 @@ try {
204
204
 
205
205
  ## Runtime Notes
206
206
 
207
- - The WASM artifacts live in `node_modules/zeldhash-miner/wasm`. Most modern bundlers copy them automatically because the SDK loads them via `new URL("./wasm/zeldhash_miner_wasm_bg.wasm", import.meta.url)`.
208
- - If your bundler does not copy assets automatically, copy the `wasm/` folder to your public/static assets.
209
- - WebGPU is optional. When `useWebGPU` is `true`, the miner auto-detects support and silently falls back to CPU.
207
+ ### WASM Asset Loading
208
+
209
+ The SDK automatically loads WASM assets from `/wasm/` on your application's origin. This works out of the box with most setups:
210
+
211
+ 1. **Copy assets to your public folder**: Copy the `wasm/` folder from `node_modules/zeldhash-miner/` to your app's `public/` directory:
212
+ ```bash
213
+ cp -r node_modules/zeldhash-miner/wasm public/wasm
214
+ ```
215
+
216
+ 2. **Also copy the worker**: The worker script needs to be served from your app as well:
217
+ ```bash
218
+ cp node_modules/zeldhash-miner/dist/worker.js public/worker.js
219
+ ```
220
+
221
+ The SDK bootstraps `globalThis.__ZELDMINER_WASM_BASE__` to `/wasm/` (relative to your app's origin) automatically, so WASM files are fetched from `https://your-app.com/wasm/` rather than from inside `node_modules/`.
222
+
223
+ ### Custom WASM Path
224
+
225
+ If you need to serve WASM assets from a different location, you can override the base path:
226
+
227
+ ```ts
228
+ // Set before importing ZeldMiner
229
+ globalThis.__ZELDMINER_WASM_BASE__ = "/custom/path/to/wasm/";
230
+ ```
231
+
232
+ Or use environment variables with Vite:
233
+ ```bash
234
+ VITE_ZELDMINER_WASM_BASE=/custom/wasm/
235
+ ```
236
+
237
+ ### WebGPU
238
+
239
+ WebGPU is optional. When `useWebGPU` is `true`, the miner auto-detects support and silently falls back to CPU.
210
240
 
211
241
  ## Build & Test
212
242
 
package/dist/index.d.ts CHANGED
@@ -58,6 +58,7 @@ export declare class MiningCoordinator {
58
58
  on<K extends CoordinatorEvent>(event: K, handler: CoordinatorListener<K>): void;
59
59
  off<K extends CoordinatorEvent>(event: K, handler: CoordinatorListener<K>): void;
60
60
  private emit;
61
+ private resolveWorkerUrl;
61
62
  private spawnWorkers;
62
63
  private handleWorkerMessage;
63
64
  private emitProgress;