wative-core 2.2.0 → 2.2.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/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
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.2.1] — 2026-07-29
6
+
7
+ Documentation and packaging only — the library code is identical to 2.2.0.
8
+
9
+ ### Changed
10
+ - The runnable examples moved from `tests/` to `examples/`; update any path references.
11
+ - Clearer README: how Workspace, Account, Wallet and Address relate, and when to use a recovery-phrase account versus an imported-key one.
12
+
13
+ ### Fixed
14
+ - One example failed when run from an installed copy.
15
+
5
16
  ## [2.2.0] — 2026-07-28
6
17
 
7
18
  Runs in the browser now. Existing Node code keeps working unchanged.
package/README.md CHANGED
@@ -1,7 +1,88 @@
1
1
  # Wative Core 2
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/wative-core?color=cb3837&logo=npm)](https://www.npmjs.com/package/wative-core)
4
+ [![CI](https://github.com/braady/wative-core/actions/workflows/ci.yml/badge.svg)](https://github.com/braady/wative-core/actions/workflows/ci.yml)
5
+ [![node](https://img.shields.io/node/v/wative-core)](https://nodejs.org)
6
+ [![license](https://img.shields.io/badge/license-Modified%20MIT-blue)](./LICENSE)
7
+
3
8
  Hyperscale crypto wallet management library — multi-workspace, multi-chain, originally designed for on-chain market makers.
4
9
 
10
+ Runs in Node and in the browser. Wallets live in one encrypted container: on disk
11
+ under Node, in IndexedDB in a browser, or in any storage you plug in yourself.
12
+
13
+ ## How it fits together
14
+
15
+ A workspace is the container. Everything else nests inside it:
16
+
17
+ ```
18
+ Workspace one encrypted container, one password
19
+ │
20
+ ├── Account an identity — HD (from a mnemonic) or PK (imported keys)
21
+ │ └── Wallet one slot in that account
22
+ │ └── Address one key on one chain — this is what signs
23
+ │
24
+ ├── Network the chains you can reach (RPC, chain id)
25
+ └── Asset the tokens tracked on each network
26
+ ```
27
+
28
+ ### Two kinds of Account
29
+
30
+ The nesting is the same for both, but a `Wallet` means something different in
31
+ each — and that is the part most people get wrong first.
32
+
33
+ **HD** — one mnemonic, many slots. A `Wallet` is a derivation slot, and it holds
34
+ the EVM *and* Solana keys derived from that same slot:
35
+
36
+ ```
37
+ Account "Trading Desk" (HD) one mnemonic
38
+ ├── Wallet 0 m/44'/60'/0'/0/0
39
+ │ ├── Address vm: "evm" 0x9858EfFD…
40
+ │ └── Address vm: "svm" HAgk14JpMQ… same slot, both chains
41
+ ├── Wallet 1 m/44'/60'/0'/0/1
42
+ │ ├── Address vm: "evm" 0x6Fac4D18…
43
+ │ └── Address vm: "svm" Hh8QwFUA6…
44
+ └── … account.deriveWallets(n)
45
+ ```
46
+
47
+ **PK** — imported keys. A `Wallet` is one key you handed in, on the one chain
48
+ you imported it for. Wallets have no relationship to each other:
49
+
50
+ ```
51
+ Account "Cold Storage" (PK) no mnemonic
52
+ ├── Wallet 0 the key passed to accounts.create()
53
+ │ └── Address vm: "evm" 0x90F8bf6A…
54
+ ├── Wallet 1 account.importPrivateKey(pk, "evm")
55
+ │ └── Address vm: "evm" 0xFFcf8FDE…
56
+ └── Wallet 2 account.importPrivateKey(pk, "svm")
57
+ └── Address vm: "svm" 7WktogJEd… one chain per wallet
58
+ ```
59
+
60
+ A PK account can hold as many keys as you like, and they can be on different
61
+ chains — but it refuses the same identity twice.
62
+
63
+ | | HD | PK |
64
+ | ---------------------- | ----------------------------- | ------------------------------- |
65
+ | Created from | a BIP-39 mnemonic | one private key |
66
+ | Grows with | `deriveWallets(n)` | `importPrivateKey(pk, vm)` |
67
+ | A `Wallet` is | a derivation slot | one imported key |
68
+ | Addresses per `Wallet` | **2** — one evm, one svm | **1** — the chain you imported |
69
+ | `dumpMnemonic()` | ✔ | throws `UNSUPPORTED_OP` |
70
+ | `sliceWallets(n)` | ✔ | throws `UNSUPPORTED_OP` |
71
+ | `importPrivateKey()` | throws `UNSUPPORTED_OP` | ✔ |
72
+
73
+ ```ts
74
+ // HD — one slot gives you the matching keys on both chains
75
+ const hd = await ws.accounts.create("Trading Desk", password, mnemonic);
76
+ await hd.deriveWallets(5); // slots 1..5, alongside slot 0
77
+ hd.wallets[0].addresses.find((a) => a.vm === "evm");
78
+ hd.wallets[0].addresses.find((a) => a.vm === "svm");
79
+
80
+ // PK — each import is its own wallet, on one chain
81
+ const pk = await ws.accounts.create("Cold Storage", password, privateKey);
82
+ await pk.importPrivateKey(anotherEvmKey, "evm"); // -> a new Wallet
83
+ await pk.importPrivateKey(aSolanaKey, "svm"); // -> another new Wallet
84
+ ```
85
+
5
86
  ## Install
6
87
 
7
88
  ```bash
@@ -128,7 +209,7 @@ await otherProvider.importContainer(backup); // same password opens it
128
209
 
129
210
  ## Runnable examples
130
211
 
131
- A `tests/` folder ships with the package — runnable JavaScript files demonstrating every domain's use cases. Read them top-to-bottom as walkthroughs, or run them as integration tests via Node's built-in test runner.
212
+ An `examples/` folder ships with the package — runnable JavaScript files demonstrating every domain's use cases. Read them top-to-bottom as walkthroughs, or run them as integration tests via Node's built-in test runner.
132
213
 
133
214
  Copy them out of `node_modules` first, then run the whole set:
134
215
 
@@ -140,10 +221,10 @@ node --test wative-examples/
140
221
  The copy is required: Node's test runner skips anything under `node_modules`, so pointing `--test` there finds no files. To run a single example without copying, execute it directly — a `node:test` file runs itself:
141
222
 
142
223
  ```bash
143
- node node_modules/wative-core/tests/01-quick-start.test.cjs
224
+ node node_modules/wative-core/examples/01-quick-start.test.cjs
144
225
  ```
145
226
 
146
- Files cover: quick start, HD vs PK accounts, network management, asset management, address signing, custom storage backends, persistence, workspace search, default-network selection, subpath imports, the workspace logger, workspace config, the ESM entry, and package resolution. See [tests/README.md](./tests/README.md) for the index.
227
+ Files cover: quick start, HD vs PK accounts, network management, asset management, address signing, custom storage backends, persistence, workspace search, default-network selection, subpath imports, the workspace logger, workspace config, the ESM entry, and package resolution. See [examples/README.md](./examples/README.md) for the index.
147
228
 
148
229
  ## What you can do
149
230
 
@@ -5,8 +5,11 @@
5
5
  const test = require("node:test");
6
6
  const assert = require("node:assert");
7
7
 
8
- const evmArtifacts = require("../dist/artifacts/evm/index.cjs");
9
- const svmArtifacts = require("../dist/artifacts/svm/index.cjs");
8
+ // Imported by SUBPATH, which is the whole point of this example — and what a
9
+ // consumer writes. A relative path into dist/ would resolve here but nowhere
10
+ // else, so it would pass in-repo while failing for every real installation.
11
+ const evmArtifacts = require("wative-core/artifacts/evm");
12
+ const svmArtifacts = require("wative-core/artifacts/svm");
10
13
 
11
14
  test("subpath import — evm artifacts expose a usable ERC20 contract", () => {
12
15
  assert.ok(evmArtifacts.ERC20);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wative-core",
3
- "version": "2.2.0",
4
- "description": "Hyperscale crypto wallet management library — multi-workspace, multi-chain, originally designed for on-chain market makers",
3
+ "version": "2.2.1",
4
+ "description": "Hyperscale crypto wallet management library \u2014 multi-workspace, multi-chain, originally designed for on-chain market makers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.node.cjs",
7
7
  "module": "./dist/index.node.js",
@@ -86,7 +86,7 @@
86
86
  "files": [
87
87
  "dist/",
88
88
  "CHANGELOG.md",
89
- "tests/"
89
+ "examples/"
90
90
  ],
91
91
  "dependencies": {
92
92
  "@coral-xyz/anchor": "0.30.1",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes