@neuraiproject/neurai-assets 1.3.2 → 1.4.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
@@ -2,6 +2,12 @@
2
2
 
3
3
  Complete asset management library for Neurai blockchain. Supports creation, reissuance, and queries for all asset types in a non-custodial way.
4
4
 
5
+ > **1.4.0**: NIP-040 `assetMarker` in `localRawBuild` (see below); RPC
6
+ > rejection messages from `@neuraiproject/neurai-rpc` >= 0.5 are surfaced
7
+ > correctly (they carry no `.message`); name-length caps now mirror the node
8
+ > (full name, owner `!` included: 31 mainnet / 121 testnet-regtest, validated
9
+ > against a regtest node); peer `neurai-rpc ^0.6.0`.
10
+
5
11
  ## Features
6
12
 
7
13
  - ✅ **Non-custodial**: Library builds unsigned transactions, your wallet signs them
@@ -183,6 +189,28 @@ const result = await assets.createDepinAsset({
183
189
  > **Note**: DEPIN assets always use `units = 0`. Recipient and change destinations
184
190
  > can be either legacy or AuthScript, as long as they belong to the same chain family.
185
191
 
192
+ ### Transfer Asset
193
+
194
+ ```javascript
195
+ // Works for any asset type (regular, sub, restricted, DePIN).
196
+ const result = await assets.transferAsset({
197
+ assetName: 'MYTOKEN',
198
+ recipients: [
199
+ { address: 'nM...', amount: 5 }, // amount in display units
200
+ { address: 'nQ...', amount: 2.5 }
201
+ ]
202
+ // changeAddress is optional; defaults to the configured change address.
203
+ // Asset change and the network fee are handled automatically.
204
+ });
205
+ ```
206
+
207
+ > **DePIN (`&`) note**: DePIN assets are soulbound — the transfer is only valid
208
+ > if it is authorized by the owner. `transferAsset` handles this automatically:
209
+ > it spends the asset's owner token (`&NAME!`) and returns it to the change
210
+ > address, so authority stays with the sender. You must hold the owner token, or
211
+ > the call throws `OwnerTokenNotFoundError`. Transferring ownership itself (handing
212
+ > the owner token to the recipient) is not done here.
213
+
186
214
  ### Create UNIQUE Assets (NFTs)
187
215
 
188
216
  ```javascript
@@ -503,6 +531,26 @@ The library automatically validates that the owner token is returned in each ope
503
531
 
504
532
  **Note**: In addition to the burned cost, all operations pay a network fee (calculated automatically).
505
533
 
534
+ ## NIP-040 asset marker (local raw builds)
535
+
536
+ Asset payloads open with a 3-byte marker that NIP-040 migrates from the
537
+ Ravencoin-inherited `rvn` to `xna` at an activation height per network
538
+ (testnet: 303000, already crossed; regtest: 1; mainnet: not scheduled yet).
539
+
540
+ - Transactions built **through the node** (`createrawtransaction`) need
541
+ nothing: the node stamps the marker itself.
542
+ - The `localRawBuild` metadata (consumed by
543
+ `@neuraiproject/neurai-create-transaction createFromOperation`, >= 0.7.0)
544
+ now carries `params.assetMarker`. Builders resolve it once per build:
545
+ 1. `params.assetMarker` / `config.assetMarker` if you set it (`'rvn'` |
546
+ `'xna'` — offline builds or tests);
547
+ 2. otherwise the node's `getblockchaininfo.asset_marker` (node commit
548
+ `347362b` or later);
549
+ 3. `'rvn'` when the node predates that field or the call fails — which
550
+ matches what such a node enforces.
551
+
552
+ No height tables and no network inference: the node (or you) decides.
553
+
506
554
  ## Validations
507
555
 
508
556
  The library validates client-side: