hd-wallet-wasm 0.2.8 → 0.3.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.
- package/dist/hd-wallet.js +0 -0
- package/dist/hd-wallet.wasm +0 -0
- package/package.json +2 -4
- package/src/index.mjs +11 -28
package/dist/hd-wallet.js
CHANGED
|
Binary file
|
package/dist/hd-wallet.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hd-wallet-wasm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Comprehensive HD Wallet implementation in WebAssembly - BIP-32/39/44, multi-curve, multi-chain support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.mjs",
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./src/index.d.ts",
|
|
13
|
-
"import": "./src/index.mjs"
|
|
14
|
-
"require": "./dist/hd-wallet.cjs"
|
|
13
|
+
"import": "./src/index.mjs"
|
|
15
14
|
},
|
|
16
15
|
"./aligned": {
|
|
17
16
|
"types": "./src/aligned.d.ts",
|
|
@@ -30,7 +29,6 @@
|
|
|
30
29
|
"src/generated/",
|
|
31
30
|
"dist/hd-wallet.js",
|
|
32
31
|
"dist/hd-wallet.wasm",
|
|
33
|
-
"dist/hd-wallet.cjs",
|
|
34
32
|
"dist/index.d.ts",
|
|
35
33
|
"README.md"
|
|
36
34
|
],
|
package/src/index.mjs
CHANGED
|
@@ -597,42 +597,27 @@ class HDKey {
|
|
|
597
597
|
// =============================================================================
|
|
598
598
|
|
|
599
599
|
/**
|
|
600
|
-
* WASM module loader
|
|
601
|
-
* @
|
|
602
|
-
* @returns {Promise<Function>} WASM module factory
|
|
600
|
+
* WASM module loader (single-file, isomorphic)
|
|
601
|
+
* @returns {Promise<Object>} Initialized WASM module
|
|
603
602
|
*/
|
|
604
|
-
async function loadWasmModule(
|
|
605
|
-
// Try to import the Emscripten-generated module
|
|
603
|
+
async function loadWasmModule() {
|
|
606
604
|
let HDWalletWasm;
|
|
607
605
|
|
|
608
606
|
try {
|
|
609
|
-
// Try dynamic import (works in Node.js and bundlers)
|
|
610
607
|
const module = await import('../dist/hd-wallet.js');
|
|
611
608
|
HDWalletWasm = module.default;
|
|
612
609
|
} catch (e) {
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
HDWalletWasm = window.HDWalletWasm;
|
|
610
|
+
if (typeof globalThis !== 'undefined' && globalThis.HDWalletWasm) {
|
|
611
|
+
HDWalletWasm = globalThis.HDWalletWasm;
|
|
616
612
|
} else {
|
|
617
613
|
throw new Error(
|
|
618
614
|
'Failed to load HD Wallet WASM module. ' +
|
|
619
|
-
'Make sure hd-wallet.js is accessible or set it on
|
|
615
|
+
'Make sure hd-wallet.js is accessible or set it on globalThis.HDWalletWasm'
|
|
620
616
|
);
|
|
621
617
|
}
|
|
622
618
|
}
|
|
623
619
|
|
|
624
|
-
|
|
625
|
-
const wasmOptions = {};
|
|
626
|
-
if (wasmPath) {
|
|
627
|
-
wasmOptions.locateFile = (path) => {
|
|
628
|
-
if (path.endsWith('.wasm')) {
|
|
629
|
-
return wasmPath;
|
|
630
|
-
}
|
|
631
|
-
return path;
|
|
632
|
-
};
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
return HDWalletWasm(wasmOptions);
|
|
620
|
+
return HDWalletWasm();
|
|
636
621
|
}
|
|
637
622
|
|
|
638
623
|
/**
|
|
@@ -2680,21 +2665,19 @@ function createModule(wasm) {
|
|
|
2680
2665
|
|
|
2681
2666
|
/**
|
|
2682
2667
|
* Initialize the HD Wallet WASM module
|
|
2683
|
-
* @param {string} [wasmPath] - Optional path to WASM file
|
|
2684
2668
|
* @returns {Promise<Object>} Initialized HDWalletModule
|
|
2685
2669
|
*/
|
|
2686
|
-
export default async function init(
|
|
2687
|
-
const wasm = await loadWasmModule(
|
|
2670
|
+
export default async function init() {
|
|
2671
|
+
const wasm = await loadWasmModule();
|
|
2688
2672
|
return createModule(wasm);
|
|
2689
2673
|
}
|
|
2690
2674
|
|
|
2691
2675
|
/**
|
|
2692
2676
|
* Create HD Wallet instance (alternative syntax)
|
|
2693
|
-
* @param {string} [wasmPath] - Optional path to WASM file
|
|
2694
2677
|
* @returns {Promise<Object>} Initialized HDWalletModule
|
|
2695
2678
|
*/
|
|
2696
|
-
export async function createHDWallet(
|
|
2697
|
-
return init(
|
|
2679
|
+
export async function createHDWallet() {
|
|
2680
|
+
return init();
|
|
2698
2681
|
}
|
|
2699
2682
|
|
|
2700
2683
|
// Export types and enums
|