@cheny56/node-client 1.0.6 → 1.0.7
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/package.json +1 -1
- package/src/transaction.js +16 -2
- package/src/wallet.js +17 -2
package/package.json
CHANGED
package/src/transaction.js
CHANGED
|
@@ -4,11 +4,25 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { ethers } from 'ethers';
|
|
7
|
-
|
|
8
|
-
import { ml_dsa65 } from '@noble/post-quantum/ml-dsa';
|
|
7
|
+
import { createRequire } from 'module';
|
|
9
8
|
import { TX_TYPE, PQC_TYPE, DEFAULT_CHAIN_ID } from './constants.js';
|
|
10
9
|
import { encodeUint64, encodeBigInt, encodeSignature } from './utils/rlp.js';
|
|
11
10
|
|
|
11
|
+
// Get ml_dsa65 from @noble/post-quantum using createRequire
|
|
12
|
+
// This works around ES module import issues with @noble/post-quantum
|
|
13
|
+
const require = createRequire(import.meta.url);
|
|
14
|
+
|
|
15
|
+
let ml_dsa65;
|
|
16
|
+
try {
|
|
17
|
+
// @noble/post-quantum uses CommonJS exports, so we use require
|
|
18
|
+
ml_dsa65 = require('@noble/post-quantum/ml-dsa').ml_dsa65;
|
|
19
|
+
} catch (e) {
|
|
20
|
+
throw new Error(
|
|
21
|
+
`Failed to import @noble/post-quantum: ${e.message}\n` +
|
|
22
|
+
`Please ensure @noble/post-quantum is installed: npm install @noble/post-quantum`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
12
26
|
/**
|
|
13
27
|
* Base Transaction class
|
|
14
28
|
*/
|
package/src/wallet.js
CHANGED
|
@@ -4,10 +4,25 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { ethers } from 'ethers';
|
|
7
|
-
|
|
8
|
-
import { ml_dsa65 } from '@noble/post-quantum/ml-dsa';
|
|
7
|
+
import { createRequire } from 'module';
|
|
9
8
|
import { derivePQCAddress, deriveHybridAddress } from './utils/address.js';
|
|
10
9
|
|
|
10
|
+
// Get ml_dsa65 from @noble/post-quantum using createRequire
|
|
11
|
+
// This works around ES module import issues with @noble/post-quantum
|
|
12
|
+
// @noble/post-quantum uses CommonJS exports, so we use require() in ES modules
|
|
13
|
+
const require = createRequire(import.meta.url);
|
|
14
|
+
|
|
15
|
+
let ml_dsa65;
|
|
16
|
+
try {
|
|
17
|
+
// @noble/post-quantum uses CommonJS exports, so we use require
|
|
18
|
+
ml_dsa65 = require('@noble/post-quantum/ml-dsa').ml_dsa65;
|
|
19
|
+
} catch (e) {
|
|
20
|
+
throw new Error(
|
|
21
|
+
`Failed to import @noble/post-quantum: ${e.message}\n` +
|
|
22
|
+
`Please ensure @noble/post-quantum is installed: npm install @noble/post-quantum`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
11
26
|
/**
|
|
12
27
|
* ECDSA Wallet (standard Ethereum wallet)
|
|
13
28
|
*/
|