@neuraiproject/neurai-key 2.8.8 → 3.0.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/README.md CHANGED
@@ -5,7 +5,7 @@ Generate Neurai addresses from a mnemonic phrase following the standards BIP32,
5
5
  That is, use your 12 words to get addresses for Neurai mainnet and testnet.
6
6
 
7
7
  **NPM**: https://www.npmjs.com/package/@neuraiproject/neurai-key
8
- **CDN**: https://cdn.jsdelivr.net/npm/@neuraiproject/neurai-key@2.8.8/dist/NeuraiKey.js
8
+ **CDN**: https://cdn.jsdelivr.net/npm/@neuraiproject/neurai-key@3.0.0/dist/NeuraiKey.global.js
9
9
 
10
10
  ## Features
11
11
 
@@ -40,10 +40,8 @@ A simple and "spot on" way to generate/derive addresses.
40
40
 
41
41
  If you need brutal performance check out getAddressByPath example below.
42
42
 
43
- ```
43
+ ```javascript
44
44
  import NeuraiKey from "@neuraiproject/neurai-key";
45
- //Or import as CommonsJS module
46
- //const NeuraiKey = require("@neuraiproject/neurai-key");
47
45
 
48
46
  const mnemonic = NeuraiKey.generateMnemonic();
49
47
  const ACCOUNT = 0; //default is zero
@@ -268,47 +266,58 @@ console.log(pubkeyHex);
268
266
 
269
267
  ## How to import into your project
270
268
 
271
- ### ES6 module
269
+ ### ESM default
272
270
 
273
- ```
274
- //As ES6 module
271
+ ```javascript
275
272
  import NeuraiKey from "@neuraiproject/neurai-key";
276
273
  ```
277
274
 
278
- ### CommonsJS module
275
+ ### ESM browser explicit
279
276
 
277
+ ```javascript
278
+ import NeuraiKey from "@neuraiproject/neurai-key/browser";
280
279
  ```
281
- //As CommonsJS module
280
+
281
+ ### CommonJS
282
+
283
+ ```javascript
282
284
  const NeuraiKey = require("@neuraiproject/neurai-key");
283
285
  ```
284
286
 
285
- ### Browserify
287
+ ### Global build for HTML
286
288
 
287
- ```
288
- //A browseriy:d version, with all the dependencies bundled for the web
289
+ ```html
289
290
  <html>
290
291
  <body>
291
- <script src="./node_modules/@neuraiproject/neurai-key/dist/NeuraiKey.js"></script>
292
+ <script src="./node_modules/@neuraiproject/neurai-key/dist/NeuraiKey.global.js"></script>
292
293
  <script>
293
- alert(NeuraiKey.generateMnemonic());
294
+ alert(globalThis.NeuraiKey.generateMnemonic());
294
295
  </script>
295
296
  </body>
296
297
  </html>
297
298
  ```
298
299
 
300
+ ## Package layout in `3.0.0`
301
+
302
+ - `dist/index.js`: ESM main entry
303
+ - `dist/index.cjs`: CommonJS entry
304
+ - `dist/browser.js`: explicit browser ESM bundle
305
+ - `dist/NeuraiKey.global.js`: global build for `<script>`
306
+ - `dist/index.d.ts`: TypeScript declarations
307
+
299
308
  ## install
300
309
 
301
- ` npm install @neuraiproject/neurai-key`
310
+ `npm install @neuraiproject/neurai-key`
302
311
 
303
312
  ## build
304
313
 
305
- ` npm run build`
314
+ `npm run build`
306
315
 
307
316
  ## test
308
317
 
309
318
  `npm test`
310
319
 
311
- Note, the tests run on the built version, so you need to build before you run the tests
320
+ The test script already builds the package before running Jest.
312
321
 
313
322
  ## BIP32
314
323