wative-core 2.5.4 → 2.5.6

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 (40) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +43 -5
  3. package/dist/artifacts/evm/index.cjs +1 -1
  4. package/dist/artifacts/evm/index.d.cts +2 -2
  5. package/dist/artifacts/evm/index.d.ts +2 -2
  6. package/dist/artifacts/evm/index.js +1 -1
  7. package/dist/artifacts/svm/index.cjs +1 -1
  8. package/dist/artifacts/svm/index.d.cts +3 -3
  9. package/dist/artifacts/svm/index.d.ts +3 -3
  10. package/dist/artifacts/svm/index.js +1 -1
  11. package/dist/{container-provider-C0dZf8jA.d.ts → container-provider-BOFF5wqv.d.ts} +1 -1
  12. package/dist/{container-provider-B_TXusVF.d.cts → container-provider-QvO3JYFb.d.cts} +1 -1
  13. package/dist/{evm-CsdcpuSb.d.ts → evm-BWORcsia.d.ts} +1 -1
  14. package/dist/{evm-DjRcWpHv.d.cts → evm-DaLCh_ce.d.cts} +1 -1
  15. package/dist/{file-sink-B_Ng4V0f.d.cts → file-sink-DJEWW4yu.d.cts} +2 -2
  16. package/dist/{file-sink-gFMJnV3R.d.ts → file-sink-bJzTrooq.d.ts} +2 -2
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.d.cts +36 -7
  19. package/dist/index.d.ts +36 -7
  20. package/dist/index.js +1 -1
  21. package/dist/index.node.cjs +1 -1
  22. package/dist/index.node.d.cts +6 -6
  23. package/dist/index.node.d.ts +6 -6
  24. package/dist/index.node.js +1 -1
  25. package/dist/node/index.cjs +1 -1
  26. package/dist/node/index.d.cts +3 -3
  27. package/dist/node/index.d.ts +3 -3
  28. package/dist/node/index.js +1 -1
  29. package/dist/{svm-BZlfBFcJ.d.ts → svm-5rQU53_9.d.ts} +1 -1
  30. package/dist/{svm-B7qJlwaU.d.cts → svm-BYbTqW4J.d.cts} +1 -1
  31. package/dist/{workspace-kmsiTC-d.d.cts → workspace-D7nb3-cO.d.cts} +12 -2
  32. package/dist/{workspace-kmsiTC-d.d.ts → workspace-D7nb3-cO.d.ts} +12 -2
  33. package/examples/03-pk-account.test.cjs +1 -1
  34. package/examples/04-network-management.test.cjs +6 -6
  35. package/examples/05-asset-management.test.cjs +2 -2
  36. package/examples/06-address-signing.test.cjs +2 -3
  37. package/examples/07-custom-provider.test.cjs +1 -1
  38. package/examples/18-envelope-v3.test.cjs +3 -3
  39. package/examples/README.md +2 -2
  40. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -2,6 +2,33 @@
2
2
 
3
3
  All notable changes to `wative-core` are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4
4
 
5
+ ## [2.5.6] — 2026-10-11
6
+
7
+ Adds the Ink network and a portable, password-protected backup of an account's seed phrase, and tightens the rules for account and network names.
8
+
9
+ ### Added
10
+ - Ink (chain 57073) is a built-in network, with ETH, USDC and USDT0 — 15 networks and 32 tokens in total.
11
+ - `sealMnemonic(...)` and `openMnemonic(...)` back up and restore one account's seed phrase as a portable copy, encrypted under the workspace password; opening it against the wrong account is refused.
12
+
13
+ ### Changed
14
+ - BREAKING: account and network names are 3–32 characters (a name longer than 32 no longer loads), and a display name may be as short as 3.
15
+ - BREAKING: `wallet.drop()` applies to private-key accounts only; shorten an HD account with `sliceWallets(...)`, or hide an index with `disableSlots(...)`.
16
+ - When `accounts.create` rejects a secret, the error code now matches it: `INVALID_MNEMONIC` for a seed phrase, `INVALID_PRIVATE_KEY` for a private key.
17
+ - A seed phrase pasted with surrounding quotes or trailing punctuation is now accepted.
18
+
19
+ ### Fixed
20
+ - Opening a workspace no longer fails because one stored record cannot be read; the rest load and the unreadable ones are listed by `workspace.damagedAccountSlugs`.
21
+
22
+ ## [2.5.5] — 2026-10-03
23
+
24
+ Adds reorder methods for networks and per-network assets, and a dedicated error for duplicate adds.
25
+
26
+ ### Added
27
+ - Reorder with `workspace.networks.move(slug, toIndex)` and `workspace.moveAsset(network, id, toIndex)`, which move a network, or a token within its network, to a 0-based final position; the new order is what the networks list and `assets(network)` return, and it persists.
28
+
29
+ ### Changed
30
+ - BREAKING: a duplicate add now rejects with the new `DUPLICATE_IDENTITY` code instead of `PARAMETER_ERROR` (29 codes total) — a duplicate account or network slug, an asset id, an asset `(network, contractAddress)` pair or native slot, a re-imported key identity, or a duplicate wallet id. Callers branching on `err.code === "PARAMETER_ERROR"` for these must switch. Malformed input and a network `(chainId, rpcUrl)` collision stay `PARAMETER_ERROR`.
31
+
5
32
  ## [2.5.4] — 2026-09-29
6
33
 
7
34
  Reworks disabling wallet slots, adds a filtered wallet list, and improves mnemonic generation.
package/README.md CHANGED
@@ -95,6 +95,7 @@ which is indistinguishable from a Solana *public* key.
95
95
  | Those two addresses | independent keys, two paths | **one key, both curves** |
96
96
  | `dumpMnemonic()` | ✔ | throws `UNSUPPORTED_OP` |
97
97
  | `sliceWallets(n)` | ✔ | throws `UNSUPPORTED_OP` |
98
+ | `wallet.drop()` | throws `UNSUPPORTED_OP` | ✔ |
98
99
  | `importPrivateKey()` | throws `UNSUPPORTED_OP` | ✔ |
99
100
 
100
101
  ```ts
@@ -138,6 +139,7 @@ const ws = await Workspace.open({ password: "your-workspace-password" });
138
139
  const account = await ws.accounts.create(
139
140
  "Trading Desk",
140
141
  "your-workspace-password",
142
+ // Published BIP-39 test vector — swept constantly. Call newMnemonic() for a real wallet.
141
143
  "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
142
144
  );
143
145
 
@@ -162,6 +164,7 @@ const ws = await Workspace.open({ provider, password: "your-workspace-password"
162
164
  const account = await ws.accounts.create(
163
165
  "Trading Desk",
164
166
  "your-workspace-password",
167
+ // Published BIP-39 test vector — swept constantly. Call newMnemonic() for a real wallet.
165
168
  "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
166
169
  );
167
170
 
@@ -318,18 +321,19 @@ The library is organized around seven things you'll work with:
318
321
  - **`Account`** — either an HD account (one BIP-39 mnemonic, can derive many wallets) or a PK account (raw private keys you import one at a time). Each account can have its own password or share the workspace password.
319
322
  - **`Wallet`** — a unit inside an account, holding one address per `(vm, network)`. Both kinds give you an EVM and a Solana address: an HD slot derives one per chain from the mnemonic, an import derives its sibling from the imported key. Treat `wallet.addresses` as the list it is.
320
323
  - **`Address`** — an on-chain identity. Sign messages, build transactions, transfer native coins or tokens, and send them.
321
- - **`Network`** — chain metadata. 14 networks ship pre-loaded.
322
- - **`Asset`** — token metadata. 29 tokens ship pre-loaded.
324
+ - **`Network`** — chain metadata. 15 networks ship pre-loaded.
325
+ - **`Asset`** — token metadata. 32 tokens ship pre-loaded.
323
326
  - **`Transaction`** — `EvmTransaction` or `SvmTransaction`. Subscribe to lifecycle events (`change` / `confirmed` / `failed`) or await terminal states (`whenSubmitted` / `whenMined` / `whenConfirmed` / `whenFinalized`). Tracking stops at first inclusion, so `whenConfirmed(n)` with `n > 1` rejects `UNSUPPORTED_OP` — call it with no argument and poll `receipt.blockNumber` against the chain head if you need depth — and `whenFinalized()` rejects `UNSUPPORTED_OP` unless the node reported finality directly.
324
327
 
325
328
  Everything is encrypted on disk under your workspace password.
326
329
 
327
330
  ### Pre-loaded networks and tokens
328
331
 
329
- | Networks (14) | Tokens (29) |
332
+ | Networks (15) | Tokens (32) |
330
333
  |---|---|
331
334
  | ethereum, base, bnbchain, arbitrum, optimism | native gas + USDC + USDT on each EVM mainnet (BSC versions are 18-decimal Binance-Peg); plus WETH on ethereum |
332
335
  | hyperevm, robinhood | native HYPE on HyperEVM; native ETH on Robinhood Chain |
336
+ | ink | native ETH + USDC + USDT0 |
333
337
  | sepolia, arbitrum-sepolia | native ETH on both testnets; plus USDC on arbitrum-sepolia |
334
338
  | hyperevm-testnet, robinhood-testnet | native HYPE / native ETH, mirroring their mainnets |
335
339
  | solana, solana-testnet, solana-devnet | native SOL + USDC + USDT + WSOL on solana mainnet; native-only on testnets |
@@ -409,6 +413,7 @@ If you'd rather not rely on the resolver, just pass the path explicitly — it s
409
413
  const hd = await ws.accounts.create(
410
414
  "Trading Desk",
411
415
  "wsp-pwd",
416
+ // Published BIP-39 test vector — swept constantly. Call newMnemonic() for a real wallet.
412
417
  "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
413
418
  );
414
419
  await hd.deriveWallets(10);
@@ -417,6 +422,7 @@ await hd.sliceWallets(6);
417
422
  const pk = await ws.accounts.create(
418
423
  "External Hot Wallet",
419
424
  "wsp-pwd",
425
+ // Published test key (Ganache account #0) — never hold funds on it.
420
426
  "0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d",
421
427
  undefined,
422
428
  { kind: "PK" },
@@ -429,6 +435,7 @@ await pk.importPrivateKey(
429
435
  const sub = await ws.accounts.create(
430
436
  "Sub Account",
431
437
  "sub-pwd",
438
+ // Published BIP-39 test vector — swept constantly. Call newMnemonic() for a real wallet.
432
439
  "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
433
440
  undefined,
434
441
  { hasOwnPassword: true },
@@ -436,7 +443,8 @@ const sub = await ws.accounts.create(
436
443
  await sub.tryUnlock("sub-pwd");
437
444
  await sub.resetPassword("sub-pwd", "new-sub-pwd");
438
445
 
439
- console.log(hd.dumpMnemonic());
446
+ // Returns the seed phrase in the clear — whoever reads it controls every address.
447
+ const phrase = hd.dumpMnemonic();
440
448
 
441
449
  hd.lock();
442
450
  await pk.drop();
@@ -452,9 +460,39 @@ console.log(wallet.addresses.length);
452
460
  await wallet.addTag("hot");
453
461
  await wallet.addTag("alpha-strategy");
454
462
 
455
- await hd.wallets.drop(hd.wallets[10]);
463
+ await hd.sliceWallets(10); // HD removes a tail; wallet.drop() is PK-only
456
464
  ```
457
465
 
466
+ ### Handling the seed phrase
467
+
468
+ > ⚠️ **A seed phrase is the account.** It derives every private key on every
469
+ > chain, now and for every wallet derived later, and it is not revocable: there
470
+ > is no way to retire a phrase that leaked.
471
+ >
472
+ > `newMnemonic()` mints one, `dumpMnemonic()` reads one back out of an unlocked
473
+ > HD account, and `sealMnemonic()` / `openMnemonic()` store one encrypted under
474
+ > the workspace password for backup. All four hand you plaintext words.
475
+ >
476
+ > - **Do not log it, print it, or put it in an error.** `console.log(phrase)`
477
+ > reaches CI logs, container log aggregation, terminal scrollback and crash
478
+ > reporters. The library makes a best-effort attempt to keep a phrase out of
479
+ > its own log output; treat that as a backstop, not a guarantee, and do not
480
+ > rely on it for anything you print yourself.
481
+ > - **Do not pass it as `displayName`.** That argument is stored in the clear
482
+ > and becomes part of an on-disk filename. A complete, valid phrase there is
483
+ > refused — a partial one is not, so keep the argument order in mind:
484
+ > `create(displayName, password, secret)`.
485
+ > - **A phrase restores anywhere.** The derivation paths are the standard ones
486
+ > (`m/44'/60'/0'/0/i` for EVM, `m/44'/501'/i'/0'` for SVM), so the same words
487
+ > reproduce the same addresses in this library and in other wallets.
488
+ > - **Mint it, do not copy it.** `newMnemonic()` draws from the platform CSPRNG.
489
+ > Every phrase printed in this document is a published test vector whose
490
+ > addresses are swept within seconds of being funded; a phrase from a web page,
491
+ > a screenshot or an example is already someone else's.
492
+ > - **Clear it when you are done with it.** JavaScript strings cannot be wiped,
493
+ > so drop the reference and prefer `lock()`; for forensic-grade cleanup,
494
+ > restart the process.
495
+
458
496
  ### Address — sign messages, build transactions
459
497
 
460
498
  > ⚠️ **One secret controls both addresses in a PK wallet.** There is only one