@neuraiproject/neurai-key 2.8.0 → 2.8.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Neuraiproject
3
+ Copyright (c) 2025 Neurai
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  Generate Neurai addresses from a mnemonic phrase following the standards BIP32, BIP39, BIP44.
4
4
 
5
5
  That is, use your 12 words to get addresses for Neurai mainnet and testnet.
6
+ The library also support Evrmorecoin EVR, both mainnet and testnet.
6
7
 
7
8
 
8
9
  ## Example get external and internal (change) addresses by path
package/index.ts CHANGED
@@ -12,13 +12,15 @@ import HDKey from "hdkey";
12
12
  import { IAddressObject } from "./types";
13
13
 
14
14
  //Could not declare Network as enum, something wrong with parcel bundler
15
- export type Network = "xna" | "xna-test";
15
+ export type Network = "xna" | "xna-test" | "evr" | "evr-test";
16
16
 
17
17
  function getNetwork(name: Network) {
18
18
  const c = name.toLowerCase(); //Just to be sure
19
19
  const map = {
20
- xna: chains.xna.main.versions,
21
- "xna-test": chains.xna.test.versions,
20
+ xna: chains.xna.mainnet.versions,
21
+ "xna-test": chains.xna.testnet?.versions,
22
+ evr: chains.evr.mainnet.versions,
23
+ "evr-test": chains.evr.testnet?.versions,
22
24
  };
23
25
 
24
26
  const network = map[c];
@@ -37,7 +39,7 @@ export function getCoinType(network: Network) {
37
39
  return chain.bip44;
38
40
  }
39
41
  /**
40
- * @param network - should have value "xna", "xna-test"
42
+ * @param network - should have value "xna", "xna-test", "evr" or "evr-test"
41
43
  * @param mnemonic - your mnemonic
42
44
  * @param account - accounts in BIP44 starts from 0, 0 is the default account
43
45
  * @param position - starts from 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuraiproject/neurai-key",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "description": "Generate Neurai addresses from mnemonic code. BIP32, BIP39, BIP44",
5
5
  "source": "index.ts",
6
6
  "main": "dist/main.js",
package/test.js CHANGED
@@ -44,7 +44,7 @@ test("Validate Wallet Import Format (WIF) test-net ", () => {
44
44
  );
45
45
  });
46
46
 
47
- test("Validate get public address from Wallet Import Format (WIF) main-et ", () => {
47
+ test("Validate get public address from Wallet Import Format (WIF) main-net ", () => {
48
48
  const network = "xna";
49
49
  const WIF = "KyWuYcev1hJ7YJZTjWx8coXNRm4jRbMEhgVVVC8vDcTaKRCMASUE";
50
50
  const addressObject = NeuraiKey.getAddressByWIF(network, WIF);
@@ -69,3 +69,58 @@ test("Non valid bytes to mnemonic should fail", () => {
69
69
  "patient feed learn prison angle convince first napkin uncover track open theory"
70
70
  );
71
71
  });
72
+
73
+ describe("Validate diff languages", () => {
74
+ it("Should accept spanish mnemonic", () => {
75
+ const m =
76
+ "velero nuera pepino reír barro reforma negar rumbo atento separar pesa puma";
77
+ const valid = NeuraiKey.isMnemonicValid(m);
78
+ expect(valid).toBe(true);
79
+ });
80
+
81
+ it("Should accept French mnemonic", () => {
82
+ const m =
83
+ "vaseux mixte ozone quiétude besogne punaise membre réussir avarice samedi pantalon poney";
84
+ const valid = NeuraiKey.isMnemonicValid(m);
85
+ expect(valid).toBe(true);
86
+ });
87
+ });
88
+
89
+ it("Should accept Italian mnemonic", () => {
90
+ const m =
91
+ "veloce perforare recinto sciroppo bici scelto parabola sguardo avanzato sonnifero remoto rustico";
92
+ const valid = NeuraiKey.isMnemonicValid(m);
93
+ expect(valid).toBe(true);
94
+ });
95
+
96
+ describe("generateAddress", () => {
97
+ it("should generate an address with a mnemonic", () => {
98
+ // Call the function
99
+ const result = NeuraiKey.generateAddressObject();
100
+
101
+ // Assertions
102
+ expect(result).toHaveProperty("mnemonic");
103
+ expect(result.mnemonic).toBeDefined();
104
+ expect(result.network).toBe("xna"); //Test default
105
+ expect(result).toHaveProperty("address"); // replace 'key' with the actual property you expect in addressObject
106
+ // ... you can add more assertions based on the expected structure of the result
107
+ });
108
+
109
+ it("default network should be xna for Neurai", () => {
110
+ const network = "xna-test";
111
+ // Call the function
112
+ const result = NeuraiKey.generateAddressObject(network);
113
+ // Assertions
114
+ expect(result.network).toBe(network); //Test default
115
+ });
116
+
117
+ it("Should handle xna-test", () => {
118
+ const network = "xna-test";
119
+ // Call the function
120
+ const result = NeuraiKey.generateAddressObject(network);
121
+ // Assertions
122
+ expect(result.network).toBe(network); //Test default
123
+ });
124
+
125
+ // Add more tests if needed to cover different scenarios
126
+ });