@neuraiproject/neurai-assets 1.1.0 → 1.1.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.
Files changed (2) hide show
  1. package/README.md +107 -12
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -5,11 +5,12 @@ Complete asset management library for Neurai blockchain. Supports creation, reis
5
5
  ## Features
6
6
 
7
7
  - ✅ **Non-custodial**: Library builds unsigned transactions, your wallet signs them
8
- - ✅ **All asset types**: ROOT, SUB, UNIQUE (NFTs), QUALIFIER, RESTRICTED
8
+ - ✅ **All asset types**: ROOT, SUB, UNIQUE (NFTs), QUALIFIER, RESTRICTED, DEPIN
9
9
  - ✅ **Complete operations**: Creation, reissuance, tagging, freezing
10
10
  - ✅ **RPC queries**: Complete wrapper for all asset query methods
11
11
  - ✅ **Client-side validation**: Prevents errors before creating transactions
12
12
  - ✅ **Owner token protection**: Validation to prevent permanent loss
13
+ - ✅ **PQ-ready networks**: Supports `xna-pq` and `xna-pq-test` with `nq1...` / `tnq1...` addresses
13
14
 
14
15
  ## Supported Asset Types
15
16
 
@@ -21,6 +22,7 @@ Complete asset management library for Neurai blockchain. Supports creation, reis
21
22
  | **QUALIFIER** | `#KYC` | 2000 XNA | Compliance tag |
22
23
  | **SUB_QUALIFIER** | `#PARENT/#SUB` | 200 XNA | Sub-qualifier |
23
24
  | **RESTRICTED** | `$SECURITY` | 3000 XNA | Security token with compliance |
25
+ | **DEPIN** | `&DEVICE` or `&DEVICE/ROUTER001` | 10 XNA | Soulbound asset with holder validity controls |
24
26
 
25
27
  ## Installation
26
28
 
@@ -54,6 +56,17 @@ const signedTx = await wallet.signTransaction(result.rawTx);
54
56
  const txid = await wallet.broadcastTransaction(signedTx);
55
57
  ```
56
58
 
59
+ You can also initialize the library with PQ networks and addresses:
60
+
61
+ ```javascript
62
+ const assetsPQ = new NeuraiAssets(rpc, {
63
+ network: 'xna-pq', // or 'xna-pq-test'
64
+ addresses: ['nq1yourpqaddress...'],
65
+ changeAddress: 'nq1yourpqchange...',
66
+ toAddress: 'nq1recipientpqaddress...'
67
+ });
68
+ ```
69
+
57
70
  ## Operation Examples
58
71
 
59
72
  ### Create ROOT Asset
@@ -93,6 +106,20 @@ const result = await assets.reissueAsset({
93
106
  });
94
107
  ```
95
108
 
109
+ ### Create DEPIN Asset
110
+
111
+ ```javascript
112
+ const result = await assets.createDepinAsset({
113
+ assetName: '&DEVICE/ROUTER001',
114
+ quantity: 1,
115
+ reissuable: false,
116
+ hasIpfs: false
117
+ });
118
+ ```
119
+
120
+ > **Note**: DEPIN assets always use `units = 0`. The library accepts both legacy
121
+ > and PQ addresses as recipients depending on the configured network.
122
+
96
123
  ### Create UNIQUE Assets (NFTs)
97
124
 
98
125
  ```javascript
@@ -319,6 +346,30 @@ const exists = await assets.assetExists('MYTOKEN');
319
346
  console.log(exists); // true/false
320
347
  ```
321
348
 
349
+ ### View DEPIN Holders
350
+
351
+ ```javascript
352
+ const holders = await assets.listDepinHolders('&DEVICE/ROUTER001');
353
+ console.log(holders);
354
+ // [
355
+ // { address: 'nq1holder...', amount: 1, valid: 1 },
356
+ // { address: 'nq1holder2...', amount: 1, valid: 0 }
357
+ // ]
358
+ ```
359
+
360
+ ### Check DEPIN Validity for an Address
361
+
362
+ ```javascript
363
+ const validity = await assets.checkDepinValidity('&DEVICE/ROUTER001', 'nq1holder...');
364
+ console.log(validity);
365
+ // {
366
+ // has_asset: true,
367
+ // amount: 1,
368
+ // valid: 1,
369
+ // blocked: false
370
+ // }
371
+ ```
372
+
322
373
  ### Detect Asset Type
323
374
 
324
375
  ```javascript
@@ -327,7 +378,8 @@ const type2 = assets.getAssetType('PARENT/SUB'); // 'SUB'
327
378
  const type3 = assets.getAssetType('TOKEN#NFT'); // 'UNIQUE'
328
379
  const type4 = assets.getAssetType('#KYC'); // 'QUALIFIER'
329
380
  const type5 = assets.getAssetType('$SECURITY'); // 'RESTRICTED'
330
- const type6 = assets.getAssetType('MYTOKEN!'); // 'OWNER'
381
+ const type6 = assets.getAssetType('&DEVICE/ONE'); // 'DEPIN'
382
+ const type7 = assets.getAssetType('MYTOKEN!'); // 'OWNER'
331
383
  ```
332
384
 
333
385
  ## Transaction Result Structure
@@ -337,15 +389,14 @@ All creation/reissuance operations return an object with this structure:
337
389
  ```javascript
338
390
  {
339
391
  rawTx: 'hex string', // Unsigned transaction (to sign with wallet)
392
+ utxos: [...], // UTXOs selected for the operation
340
393
  inputs: [...], // Transaction inputs
341
- outputs: {...}, // Ordered outputs
394
+ outputs: [...], // Ordered outputs
342
395
  fee: 0.001, // Fee in XNA
343
- burn: 1000, // Burned amount in XNA
344
- metadata: { // Operation-specific metadata
345
- assetName: 'MYTOKEN',
346
- ownerTokenName: 'MYTOKEN!',
347
- operationType: 'ISSUE_ROOT'
348
- }
396
+ burnAmount: 1000, // Burned amount in XNA
397
+ assetName: 'MYTOKEN', // Operation-specific fields vary by builder
398
+ ownerTokenName: 'MYTOKEN!',
399
+ operationType: 'ISSUE_ROOT'
349
400
  }
350
401
  ```
351
402
 
@@ -358,6 +409,7 @@ When you create an asset, an **owner token** is automatically generated (e.g., `
358
409
  - Create SUB assets
359
410
  - Manage tags (if qualifier)
360
411
  - Freeze/unfreeze (if restricted)
412
+ - Manage DEPIN reissuance and controls (if depin)
361
413
 
362
414
  ⚠️ **If you lose the owner token, you lose these capabilities PERMANENTLY**
363
415
 
@@ -378,7 +430,9 @@ The library automatically validates that the owner token is returned in each ope
378
430
  | Create QUALIFIER (root) | 2000 |
379
431
  | Create QUALIFIER (sub) | 200 |
380
432
  | Create RESTRICTED asset | 3000 |
433
+ | Create DEPIN asset | 10 |
381
434
  | Reissue ROOT/SUB | 200 |
435
+ | Reissue DEPIN | 200 |
382
436
  | Reissue RESTRICTED | 200 |
383
437
  | Tag/Untag address | 0.1 (per address) |
384
438
  | Freeze/Unfreeze address | 0 (network fee only) |
@@ -415,11 +469,37 @@ const assets = new NeuraiAssets(rpc, {
415
469
  const assets = new NeuraiAssets(rpc, {
416
470
  network: 'xna-test',
417
471
  addresses: [...],
418
- changeAddress: 'm...' // or 'n...'
419
- toAddress: 'm...'
472
+ changeAddress: 't...',
473
+ toAddress: 't...'
474
+ });
475
+
476
+ // PQ Mainnet
477
+ const assetsPQ = new NeuraiAssets(rpc, {
478
+ network: 'xna-pq',
479
+ addresses: ['nq1...'],
480
+ changeAddress: 'nq1...',
481
+ toAddress: 'nq1...'
482
+ });
483
+
484
+ // PQ Testnet
485
+ const assetsPQTest = new NeuraiAssets(rpc, {
486
+ network: 'xna-pq-test',
487
+ addresses: ['tnq1...'],
488
+ changeAddress: 'tnq1...',
489
+ toAddress: 'tnq1...'
420
490
  });
421
491
  ```
422
492
 
493
+ The library accepts these network names:
494
+
495
+ - `xna`: legacy/mainnet address flow (`N...`)
496
+ - `xna-test`: legacy/testnet address flow (`t...`)
497
+ - `xna-pq`: PQ mainnet address flow (`nq1...`)
498
+ - `xna-pq-test`: PQ testnet address flow (`tnq1...`)
499
+
500
+ If you need to derive PQ addresses, use `neurai-key` and pass the resulting `nq1...`
501
+ or `tnq1...` addresses into this library.
502
+
423
503
  ## Update Configuration
424
504
 
425
505
  ```javascript
@@ -449,6 +529,17 @@ const builder = new builders.IssueRootBuilder(rpc, {
449
529
  const result = await builder.build();
450
530
  ```
451
531
 
532
+ The builders module also includes:
533
+
534
+ - `IssueDepinBuilder`
535
+ - `IssueRootBuilder`
536
+ - `IssueSubBuilder`
537
+ - `IssueUniqueBuilder`
538
+ - `IssueQualifierBuilder`
539
+ - `IssueRestrictedBuilder`
540
+ - `ReissueBuilder`
541
+ - `ReissueRestrictedBuilder`
542
+
452
543
  ## Error Handling
453
544
 
454
545
  The library throws specific errors:
@@ -524,4 +615,8 @@ const signedTx = await wallet.signTransaction(result.rawTx);
524
615
  // Broadcast
525
616
  const txid = await wallet.broadcastTransaction(signedTx);
526
617
  console.log('Transaction ID:', txid);
527
- ```
618
+ ```
619
+
620
+ For PQ wallets, derive addresses externally with `neurai-key` using `xna-pq` or
621
+ `xna-pq-test`, then initialize `NeuraiAssets` with those addresses and the matching
622
+ network name.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuraiproject/neurai-assets",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Non-custodial Neurai asset management library for JavaScript",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {