@neuraiproject/neurai-depin-terminal 1.0.0 → 1.0.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuraiproject/neurai-depin-terminal",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Neurai DePIN terminal messaging client",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "scripts": {
24
24
  "start": "node src/index.js",
25
- "bundle": "esbuild src/index.js --bundle --platform=node --format=cjs --outfile=dist/index.cjs --minify --external:secp256k1 --alias:term.js=./src/lib/empty.js --alias:pty.js=./src/lib/empty.js --log-override:empty-import-meta=silent",
25
+ "bundle": "esbuild src/index.js --bundle --platform=node --format=cjs --outfile=dist/index.cjs --minify --alias:term.js=./src/lib/empty.js --alias:pty.js=./src/lib/empty.js --log-override:empty-import-meta=silent",
26
26
  "prepublishOnly": "npm run bundle",
27
27
  "build": "npm run bundle && NODE_NO_WARNINGS=1 pkg dist/index.cjs --targets node18-linux-x64,node18-macos-x64,node18-win-x64 --output bin/neurai-depin-terminal --compress GZip"
28
28
  },
@@ -47,12 +47,11 @@
47
47
  "dependencies": {
48
48
  "@neuraiproject/neurai-depin-msg": "^2.1.1",
49
49
  "@neuraiproject/neurai-jswallet": "0.12.8",
50
- "@neuraiproject/neurai-key": "^2.8.5",
50
+ "@neuraiproject/neurai-key": "^2.8.6",
51
51
  "blessed": "^0.1.81",
52
52
  "blessed-contrib": "^4.11.0",
53
53
  "chalk": "^5.3.0",
54
- "readline": "^1.3.0",
55
- "secp256k1": "^4.0.4"
54
+ "readline": "^1.3.0"
56
55
  },
57
56
  "devDependencies": {
58
57
  "esbuild": "^0.27.2",
@@ -5,7 +5,6 @@
5
5
  */
6
6
 
7
7
  import NeuraiKey from '@neuraiproject/neurai-key';
8
- import secp256k1 from 'secp256k1';
9
8
  import {
10
9
  ADDRESS,
11
10
  ERROR_MESSAGES
@@ -32,7 +31,7 @@ export class WalletManager {
32
31
 
33
32
  /**
34
33
  * Derive address and public key from WIF private key
35
- * Uses NeuraiKey to get address and secp256k1 to derive compressed public key
34
+ * Uses NeuraiKey to get address and derive compressed public key
36
35
  * @returns {Promise<void>}
37
36
  * @throws {WalletError} If key derivation fails
38
37
  */
@@ -46,10 +45,10 @@ export class WalletManager {
46
45
  this.address = keyInfo.address;
47
46
  this.privateKeyHex = keyInfo.privateKey;
48
47
 
49
- // Derive compressed public key from private key
50
- const privateKeyBuffer = Buffer.from(keyInfo.privateKey, 'hex');
51
- const publicKeyBuffer = secp256k1.publicKeyCreate(privateKeyBuffer, true);
52
- this.publicKey = Buffer.from(publicKeyBuffer).toString('hex');
48
+ // Derive compressed public key from WIF
49
+ this.publicKey = await withSuppressedConsole(() => {
50
+ return NeuraiKey.getPubkeyByWIF(this.config.network, this.config.privateKey);
51
+ });
53
52
  } catch (error) {
54
53
  throw new WalletError(`${ERROR_MESSAGES.INVALID_WIF}: ${error.message}`);
55
54
  }