wative-core 2.5.1 → 2.5.3
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 +61 -55
- package/README.md +27 -3
- package/dist/artifacts/evm/index.cjs +1 -1
- package/dist/artifacts/evm/index.d.cts +2 -2
- package/dist/artifacts/evm/index.d.ts +2 -2
- package/dist/artifacts/evm/index.js +1 -1
- package/dist/artifacts/svm/index.cjs +1 -1
- package/dist/artifacts/svm/index.d.cts +3 -3
- package/dist/artifacts/svm/index.d.ts +3 -3
- package/dist/artifacts/svm/index.js +1 -1
- package/dist/{container-provider-CBBJbpUn.d.ts → container-provider-D5bLhd__.d.ts} +4 -2
- package/dist/{container-provider-COvXmCLM.d.cts → container-provider-DObyv4EW.d.cts} +4 -2
- package/dist/{evm-V5Fn53uW.d.cts → evm-CJqPjHHu.d.cts} +1 -1
- package/dist/{evm-Dk4ceFz0.d.ts → evm-Yd0NCJAL.d.ts} +1 -1
- package/dist/{file-sink-BjbtAHUL.d.cts → file-sink-D8l-OwW9.d.cts} +2 -2
- package/dist/{file-sink-Bf9mpegF.d.ts → file-sink-GrtMBpmU.d.ts} +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +67 -7
- package/dist/index.d.ts +67 -7
- package/dist/index.js +1 -1
- package/dist/index.node.cjs +1 -1
- package/dist/index.node.d.cts +6 -6
- package/dist/index.node.d.ts +6 -6
- package/dist/index.node.js +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.d.cts +3 -3
- package/dist/node/index.d.ts +3 -3
- package/dist/node/index.js +1 -1
- package/dist/{svm-CjNIJZ4l.d.cts → svm-DgxTJqrR.d.ts} +3 -2
- package/dist/{svm-D8zsWS64.d.ts → svm-qBfrN98x.d.cts} +3 -2
- package/dist/{workspace-DqUdScht.d.cts → workspace-CZO-ANYP.d.cts} +265 -16
- package/dist/{workspace-DqUdScht.d.ts → workspace-CZO-ANYP.d.ts} +265 -16
- package/examples/14-esm-runtime.test.mjs +0 -3
- package/examples/17-locked-state.test.cjs +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
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.3] — 2026-09-19
|
|
6
|
+
|
|
7
|
+
Adds foreign-transaction signing, sign-in, a keyless chain client, and Solana versioned transactions.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- Sign a transaction you did not build with `address.signRawTransaction(...)` (behind a confirm step, with explicit opt-in for the riskiest kinds), preview one with `address.estimate(...)`, sign in to a site with `address.signIn(...)`, and sign several at once with `address.signAll(...)`.
|
|
11
|
+
- `ChainClient` reads balances, simulates, and broadcasts on a network with no account or key; `address.checkDestination(...)` reports whether a recipient is safe, and transfers now refuse an irreversible-loss recipient unless you override.
|
|
12
|
+
- Solana transactions support address lookup tables and versioned (v0) transactions; `send(...)` takes per-send options — confirmation level, timeout, and endpoint route.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- `Contract` and `Program` are no longer added to a shared registry on construction; `Contract.load(name)` / `Program.load(name)` return the built-ins only.
|
|
16
|
+
|
|
17
|
+
## [2.5.2] — 2026-09-18
|
|
18
|
+
|
|
19
|
+
Adds two methods for signing bytes you built yourself.
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
- `address.signDigest(digest)` signs a 32-byte digest on an EVM address exactly as given, with no hashing and no prefix. It returns `r`, `s`, the recovery id (0 or 1), and a 65-byte `signature` with `v = 27 + recovery`. Build `v` from `recovery` for a typed or EIP-155 transaction.
|
|
23
|
+
- `address.signBytes(message)` signs arbitrary bytes on an SVM address exactly as given, for example a serialized Solana transaction message. It returns the 64-byte signature as base58 and as hex.
|
|
24
|
+
- Both take a `Uint8Array` or a `0x`-prefixed hex string of whole bytes, need the account unlocked, and sign whatever they are given, so pass only data you assembled yourself.
|
|
25
|
+
|
|
5
26
|
## [2.5.1] — 2026-09-12
|
|
6
27
|
|
|
7
28
|
Renames the transfer helper and improves fee handling.
|
|
@@ -743,67 +764,54 @@ Unlocking is much faster. Drop-in from 2.2.x; wallets from 1.x need a manual ste
|
|
|
743
764
|
|
|
744
765
|
## [2.2.1] — 2026-07-29
|
|
745
766
|
|
|
746
|
-
Documentation and packaging only.
|
|
767
|
+
Documentation and packaging only. The code is identical to 2.2.0.
|
|
747
768
|
|
|
748
769
|
### Changed
|
|
749
|
-
- **The runnable examples ship as `examples/` instead of `tests/`.**
|
|
750
|
-
- **README** gains npm / CI / node / license badges,
|
|
770
|
+
- **The runnable examples ship as `examples/` instead of `tests/`.** If you referenced `wative-core/tests/...` by path, update it; nothing importable from the package entry changed.
|
|
771
|
+
- **README** gains npm / CI / node / license badges, a diagram of how `Workspace > Account > Wallet > Address` nest, and a section on the two account kinds. Under HD a `Wallet` is a derivation slot holding both an EVM and a Solana key; under PK it is a single imported key on one chain.
|
|
751
772
|
|
|
752
773
|
### Fixed
|
|
753
|
-
-
|
|
754
|
-
|
|
755
|
-
### Internal
|
|
756
|
-
- `.github/workflows/ci.yml`: runs the examples against this build on Node 22.12 and 24, and separately installs `wative-core` from the registry into a clean directory and runs the same files against it — exercising the real tarball's `files` list, `exports` map and dependency resolution. Runs weekly as well, since a published package sits on a moving dependency graph.
|
|
757
|
-
- The private development repo is now guarded against reaching npm (`private`, a `prepublishOnly` refusal, and a `publishConfig` registry pointing nowhere). It shares a package name with the public repo, so a stray publish there would have succeeded and replaced the package.
|
|
774
|
+
- **The `11-subpath-imports` example** now imports the chain artifacts through their subpaths, as its header documents. It previously failed in a real installation.
|
|
758
775
|
|
|
759
776
|
## [2.2.0] — 2026-07-28
|
|
760
777
|
|
|
761
|
-
> **The browser entry is here.** The main entry now
|
|
778
|
+
> **The browser entry is here.** The main entry now bundles for a browser with **zero** unresolvable Node builtins, and ships an IndexedDB storage backend. **No public API was removed** — existing Node imports keep working unchanged, so this remains a minor.
|
|
762
779
|
|
|
763
780
|
### Added
|
|
764
|
-
- **`IdbProvider` — IndexedDB storage backend.** Created via the async factory `IdbProvider.create(name, opts)`, which
|
|
765
|
-
- **`ContainerProvider`** —
|
|
766
|
-
- **`exportContainer()` / `importContainer()`** on `ContainerProvider`. Both require an unlocked workspace and throw `WORKSPACE_LOCKED` otherwise
|
|
781
|
+
- **`IdbProvider` — IndexedDB storage backend.** Created via the async factory `IdbProvider.create(name, opts)`, which requests durable storage before returning. Exposes `durability` (`"persistent" | "best-effort"`) and a `quota` snapshot.
|
|
782
|
+
- **`ContainerProvider`** — a base class for custom storage backends. A backend implements six methods (`_exist`, `_listItems`, `_read`, `_write`, `_remove`, `_ensureDir`) and inherits encryption and the workspace layout, so it no longer has to implement encryption itself.
|
|
783
|
+
- **`exportContainer()` / `importContainer()`** on `ContainerProvider`. Both require an unlocked workspace and throw `WORKSPACE_LOCKED` otherwise. Records move still encrypted and are never decrypted on the way. A container exported from one backend imports into another (IndexedDB ⇄ filesystem) and opens with the same password. Import refuses a non-empty target without `{ overwrite: true }` and rejects entries that do not belong to a container.
|
|
767
784
|
- **`wative-core/node` subpath** — `HybridProvider`, `FileSink` and the default-workspace-path resolver.
|
|
768
785
|
- **`STORAGE_NOT_DURABLE`** error code.
|
|
769
786
|
|
|
770
787
|
### Changed
|
|
771
|
-
- **The root entry
|
|
772
|
-
- `tsconfig` `lib` gains `DOM`; the browser is now a real target.
|
|
788
|
+
- **The root entry has separate browser and Node builds.** A browser bundler picks the browser build; Node picks one that still re-exports `HybridProvider` and `FileSink`, so `import { Workspace, HybridProvider } from "wative-core"` compiles and runs exactly as before. Those two re-exports are **deprecated** in favour of `wative-core/node` and will be removed in a future major.
|
|
773
789
|
|
|
774
790
|
### Browser notes
|
|
775
791
|
- Creating a **new** workspace in evictable storage is **refused** with `STORAGE_NOT_DURABLE` unless `{ acknowledgeEvictionRisk: true }` is passed. Opening an existing workspace is never blocked. Browser storage is evictable and this library holds private keys: Chrome and Firefox treat IndexedDB as best-effort unless `navigator.storage.persist()` is granted, Safari caps script-writable storage at roughly 7 days without user interaction, and private-mode windows may have no IndexedDB at all. Request persistence from a user gesture, and use `exportContainer()` for a durable backup.
|
|
776
792
|
- A **`Buffer` polyfill is still required** — `@solana/web3.js` and `@coral-xyz/anchor` read the global. Standard for any Solana dapp.
|
|
777
793
|
|
|
778
|
-
### Internal
|
|
779
|
-
- `scripts/browser-e2e.mjs` (`pnpm test:browser`) bundles the real dist through the `browser` condition, loads it into headless Chromium and drives a full lifecycle against the browser's own IndexedDB, asserting the same published BIP-44 vectors the Node suite pins. Resolving is not the same as running — a build can resolve cleanly and still fail at runtime, as a 2.1.0 regression showed. Wired into `prepublishOnly`.
|
|
780
|
-
- The published bundle is exercised under each platform to prove the export map lands where intended; asserting its shape is not the same as asserting a resolver's behaviour.
|
|
781
|
-
|
|
782
794
|
## [2.1.0] — 2026-07-28
|
|
783
795
|
|
|
784
|
-
> **Browser groundwork.**
|
|
796
|
+
> **Browser groundwork.** `wative-core/artifacts/evm` and `wative-core/artifacts/svm` now bundle for the browser with **zero** unresolvable Node builtins; the main entry is down to four (`fs`, `fs/promises`, `os`, `path`), all used by the filesystem storage backend. **No public API changed** — this is a drop-in upgrade from 2.0.7.
|
|
785
797
|
|
|
786
798
|
### License
|
|
787
799
|
- **Relicensed to a Modified MIT License** (previously BUSL-1.1). The library is now free for any use, including commercial. The sole added condition: a product or service generating more than 50,000 USD in monthly revenue must prominently display "Wative" on its user interface. Measured per product, not per company. `package.json` declares `"license": "SEE LICENSE IN LICENSE"`, the npm convention for a non-standard licence.
|
|
788
800
|
|
|
789
801
|
### Changed
|
|
790
|
-
- **`web3` 1.7.3 and `ethereumjs-wallet` 1.0.2 replaced by `ethers` 6.**
|
|
791
|
-
- **
|
|
792
|
-
-
|
|
793
|
-
- **
|
|
802
|
+
- **`web3` 1.7.3 and `ethereumjs-wallet` 1.0.2 replaced by `ethers` 6.** Their dependencies pulled in Node builtins that kept the package from bundling for a browser, and web3 1.x is end-of-life.
|
|
803
|
+
- **Encryption and hashing no longer depend on `node:crypto`**, so they run in the browser. Results are byte-identical, and `Cipher.encrypt`/`decrypt` stay synchronous.
|
|
804
|
+
- **IP-address validation no longer depends on `node:net`.**
|
|
805
|
+
- **Workspaces are unchanged.** A workspace written by 2.0.7 opens under 2.1.0, and derived addresses and signatures are identical.
|
|
794
806
|
|
|
795
807
|
### Fixed
|
|
796
|
-
- **EIP-712 with an empty `bytes` field no longer crashes
|
|
797
|
-
- **
|
|
808
|
+
- **EIP-712 with an empty `bytes` field no longer crashes**; it now signs as EIP-712 specifies.
|
|
809
|
+
- **A `gasLimit` too low for the transaction is still refused before signing**, so a transaction that can never execute is not broadcast.
|
|
798
810
|
|
|
799
811
|
### Notes for browser consumers
|
|
800
812
|
- `wative-core/artifacts/evm` and `wative-core/artifacts/svm` bundle cleanly today (the EVM artifact is ~128 KB min+gzip).
|
|
801
813
|
- A **`Buffer` polyfill is still required**, because `@solana/web3.js` and `@coral-xyz/anchor` depend on the global. This is standard for any Solana dapp.
|
|
802
|
-
- The main entry still requires the filesystem builtins listed above.
|
|
803
|
-
|
|
804
|
-
### Internal
|
|
805
|
-
- `scripts/check-browser-bundle.mjs` bundles every published entry for `platform=browser` and ratchets the set of unresolvable Node builtins — failing both on a regression and on a stale baseline, so browser compatibility can only improve. Wired into `prepublishOnly`.
|
|
806
|
-
- Known-answer vectors (`tests/kat/`) pin exact bytes for HD derivation, EIP-191/712 signing, ed25519, the ABI codec, all three EVM transaction types, both KDFs and the envelope wire format; a committed v2.0.7 workspace fixture is opened on every run.
|
|
814
|
+
- The main entry still requires the filesystem builtins listed above. A `wative-core/node` subpath for the Node-only parts (`HybridProvider`, `FileSink`) and an IndexedDB storage backend are planned for 2.2.0.
|
|
807
815
|
|
|
808
816
|
## [2.0.7] — 2026-07-21
|
|
809
817
|
|
|
@@ -811,44 +819,43 @@ Documentation and packaging only. `dist/` is byte-identical to 2.2.0 — no sour
|
|
|
811
819
|
|
|
812
820
|
### Added
|
|
813
821
|
- **`Workspace.open()` options object.** `open()` now accepts `{ provider?, path?, password? }` alongside the existing positional form, so the default location no longer needs an `undefined` placeholder: `await Workspace.open({ password })`. Passing both `provider` and `path` is rejected.
|
|
814
|
-
- **Automatic create-vs-open with folder validation.** `open()` decides for itself: an existing workspace is opened, an empty or absent location is created, and a **non-empty location that is not a wative workspace is refused** — so a mistyped path can no longer write a workspace into unrelated files.
|
|
822
|
+
- **Automatic create-vs-open with folder validation.** `open()` decides for itself: an existing workspace is opened, an empty or absent location is created, and a **non-empty location that is not a wative workspace is refused** — so a mistyped path can no longer write a workspace into unrelated files. Custom providers can override `Provider.inspectContainer()`; by default it accepts any location, so existing custom providers are unaffected.
|
|
815
823
|
|
|
816
824
|
### Changed
|
|
817
825
|
- **`create` parameter is deprecated and ignored.** The third positional argument to `open()` still type-checks so existing calls compile, but create-vs-open is now automatic. The former `"Workspace is not initialized. Pass create=true"` error is gone.
|
|
818
|
-
- **Dependencies.** `@solana/web3.js` 1.91.8 → **1.98.4**.
|
|
826
|
+
- **Dependencies.** `@solana/web3.js` 1.91.8 → **1.98.4**. With 1.91.8 the published package could no longer be loaded under plain Node after a change in one of its dependencies. 1.98.4 needs Node **22.12** or later, which is why the minimum Node version moves.
|
|
819
827
|
|
|
820
828
|
### Fixed
|
|
821
829
|
- **Signing.** `signTypedData` rejects a malformed `domain.chainId` with `PARAMETER_ERROR` instead of leaking a raw `SyntaxError`.
|
|
822
|
-
- **Transactions.** EIP-1559 auto-fill clamps a defaulted priority fee to a user-supplied sub-gwei `maxFeePerGas` (previously produced an invalid tip-over-cap pair); receipt
|
|
830
|
+
- **Transactions.** EIP-1559 auto-fill clamps a defaulted priority fee to a user-supplied sub-gwei `maxFeePerGas` (previously produced an invalid tip-over-cap pair); a receipt that reports its status as `0x01` is no longer misread as a revert; an auto-estimated `gasLimit` gets a 1.2x safety buffer.
|
|
823
831
|
- **Transaction tracker.** `abort()` now wakes pending `whenMined`/`whenConfirmed`/`whenFinalized` awaiters instead of hanging them forever; a failed send rejects those awaiters with the real cause rather than a misleading `TX_TIMEOUT`; `whenConfirmed(n)` with `n > 1` fails loudly instead of silently resolving at first inclusion.
|
|
824
832
|
- **Solana.** Anchor instruction accounts now take their signer/writable flags from the IDL instead of being forced to writable non-signer; `memo` is encoded as a real Memo-program instruction; `addressLookupTables` are rejected rather than silently dropped.
|
|
825
|
-
- **Workspace.** A network can no longer be dropped while a user-asset still references it, and
|
|
826
|
-
- **Accounts & wallets.** A forced `kind: "HD"` now validates the mnemonic checksum at create time;
|
|
833
|
+
- **Workspace.** A network can no longer be dropped while a user-asset still references it, and concurrent changes can no longer leave an asset or an account's default network pointing at a network that is gone.
|
|
834
|
+
- **Accounts & wallets.** A forced `kind: "HD"` now validates the mnemonic checksum at create time; concurrent tag changes on one wallet no longer overwrite each other; invisible Hangul filler characters are rejected in validated text; `formatUnits` no longer emits a misleading `"-0"`.
|
|
827
835
|
|
|
828
836
|
### Packaging
|
|
829
|
-
-
|
|
830
|
-
- The
|
|
837
|
+
- CommonJS TypeScript projects now resolve the `.d.cts` declarations.
|
|
838
|
+
- The package no longer includes a `tests/` directory.
|
|
831
839
|
|
|
832
840
|
## [2.0.5] — 2026-05-04
|
|
833
841
|
|
|
834
842
|
### Added
|
|
835
843
|
- **`EvmTransaction.toRawTx()` and `SvmTransaction.toRawTx()`.** Hand-off accessors that return the lowest-level transaction representation each chain ecosystem already understands, so callers can route a wative-core transaction through any external signer / RPC client without re-deriving the inputs.
|
|
836
844
|
- **`EvmTransaction.toRawTx(): EvmRawTx`** — synchronous. Returns a plain `{ from, to, value, data, type, chainId, nonce?, gasLimit?, gasPrice?, maxFeePerGas?, maxPriorityFeePerGas?, accessList? }` object matching the `web3.js` / `ethers` / `viem` `TransactionRequest` shape. Unset autofill fields are simply omitted, leaving the consumer's provider to fill them in. Does not sign or hit the network.
|
|
837
|
-
- **`SvmTransaction.toRawTx(): Promise<unknown>`** — async. Returns the underlying `@solana/web3.js` `Transaction` instance with `instructions`, `feePayer`, and `recentBlockhash` populated.
|
|
838
|
-
-
|
|
845
|
+
- **`SvmTransaction.toRawTx(): Promise<unknown>`** — async. Returns the underlying `@solana/web3.js` `Transaction` instance with `instructions`, `feePayer`, and `recentBlockhash` populated. Repeated calls return the same instance, and a subsequent `.sign()` reuses it.
|
|
846
|
+
- **`SvmTransaction` no longer needs an `Address` just to build.** If `recentBlockhash` is supplied at construction, `toRawTx()` builds without one. An Address is still required when the blockhash has to be fetched over RPC.
|
|
839
847
|
- **`EvmRawTx`** type exported from the package entry.
|
|
840
848
|
|
|
841
849
|
### Changed
|
|
842
|
-
- **
|
|
843
|
-
-
|
|
844
|
-
- **Per-process KDF cache HMAC secret is lazy-initialized.** No `crypto.randomBytes` call at module load time, removing one pre-condition for browser/Edge runtimes.
|
|
850
|
+
- **More robust file storage across operating systems.** `HybridProvider` handles long Windows paths, refuses to write through a symlinked parent directory, and cleans up temporary files left behind by an interrupted write. Log files that already exist are made owner-only (`0600`) when opened.
|
|
851
|
+
- **Importing the package no longer generates random bytes at load time**, which some edge runtimes forbid.
|
|
845
852
|
|
|
846
853
|
### Security
|
|
847
|
-
- **Passwords are normalized to NFC
|
|
848
|
-
-
|
|
849
|
-
- **
|
|
854
|
+
- **Passwords are normalized to NFC.** Clipboard managers and OS input methods occasionally hand back equivalent strings in different Unicode normalization forms; without normalization, a workspace created on one host would refuse to unlock on another. ASCII passwords are unaffected.
|
|
855
|
+
- **Malformed text in stored data fails with `DECRYPT_FAILED`** instead of being silently replaced with `U+FFFD`.
|
|
856
|
+
- **Reserved account names are matched case-insensitively.** Windows resolves `CON`/`con`/`Con` to the same device, so all three are reserved.
|
|
850
857
|
- **Workspace path resolver throws clearly when no home is available.** Containers and jails without `HOME` / `USERPROFILE` previously fell through to a malformed path; now `Workspace.open()` surfaces a `PARAMETER_ERROR` directing the caller to set `WATIVE_WORKSPACE_PATH` or pass an explicit path.
|
|
851
|
-
-
|
|
858
|
+
- **A workspace path too long for the OS now returns `PROVIDER_IO`** with an actionable "relocate workspace closer to root" message.
|
|
852
859
|
|
|
853
860
|
## [2.0.3] — 2026-05-04
|
|
854
861
|
|
|
@@ -856,16 +863,15 @@ Documentation and packaging only. `dist/` is byte-identical to 2.2.0 — no sour
|
|
|
856
863
|
- **Default workspace path renamed** from `<cwd>/.wative` to `<cwd>/.wative2`. Existing on-disk workspaces under `.wative/` are not migrated automatically — pass the old path explicitly to `Workspace.open()` if you want to keep using one, or rename the directory.
|
|
857
864
|
- **`Workspace.open()` no-arg path now resolves through a 3-tier strategy:**
|
|
858
865
|
1. `WATIVE_WORKSPACE_PATH` env var (if set & non-empty) — wins unconditionally. `~` is expanded.
|
|
859
|
-
2. `<process.cwd()>/.wative2` — used when the env var is unset and the directory already exists on disk.
|
|
866
|
+
2. `<process.cwd()>/.wative2` — used when the env var is unset and the directory already exists on disk. A symlink at this path is refused and resolution falls through to the home directory.
|
|
860
867
|
3. `<os.homedir()>/.wative2` — last-resort fallback. Where `create=true` lands on a fresh machine when no env var is set and there's no project-local `.wative2/`.
|
|
861
868
|
|
|
862
869
|
Calls that pass an explicit path or `Provider` instance are unaffected — those short-circuit before any resolution.
|
|
863
870
|
|
|
864
871
|
### Security
|
|
865
|
-
- **
|
|
866
|
-
- **
|
|
867
|
-
-
|
|
868
|
-
- **`useTestKdfIterations` Jest auto-detect removed.** The `typeof globalThis.expect !== "undefined"` opt-in arm fired in any downstream consumer using Jest, not just our own test process. Now requires explicit `WATIVE_ALLOW_TEST_KDF=1` (or `NODE_ENV=test`). Internal-only function; not on the package surface.
|
|
872
|
+
- **Passwords are stretched with Argon2id, and stored records can no longer be swapped.** Each stored record is now bound to where it lives, so someone who can write to the workspace folder but does not know the password can no longer substitute one record's contents for another's. Workspaces written by 2.0.1 still open; everything written from this release on uses the new format.
|
|
873
|
+
- **The suffix added to a duplicate account name is now unpredictable.**
|
|
874
|
+
- **`Account.lock()` now wipes the derived seed from memory.** Mnemonics and private keys held as JavaScript strings cannot be wiped the same way (see `Workspace.lock()`).
|
|
869
875
|
|
|
870
876
|
## [2.0.1] — 2026-04-29
|
|
871
877
|
|
|
@@ -885,12 +891,12 @@ First release of the v2 line.
|
|
|
885
891
|
|
|
886
892
|
### Security
|
|
887
893
|
- Built-in networks and tokens cannot be dropped from the workspace (they would orphan accounts that reference them by default).
|
|
888
|
-
- Concurrent `addAsset` / `dropAsset` and network
|
|
889
|
-
-
|
|
894
|
+
- Concurrent `addAsset` / `dropAsset` and network changes can no longer produce duplicate asset ids or network slugs.
|
|
895
|
+
- A workspace whose stored data holds duplicate asset ids or network slugs fails to open with an error instead of loading.
|
|
890
896
|
|
|
891
897
|
### Notes
|
|
892
|
-
- Requires Node.js 18.18+.
|
|
893
|
-
- Source maps are not published. The npm package contains only compiled JavaScript and TypeScript declaration files.
|
|
898
|
+
- Requires Node.js 18.18+. Installation needs no native build step. Deno, Bun and browser support is partial.
|
|
899
|
+
- Source maps are not published. The npm package contains only compiled JavaScript and TypeScript declaration files.
|
|
894
900
|
|
|
895
901
|
[2.0.7]: https://github.com/braady/wative-core/releases/tag/v2.0.7
|
|
896
902
|
[2.0.3]: https://github.com/braady/wative-core/releases/tag/v2.0.3
|
package/README.md
CHANGED
|
@@ -477,7 +477,7 @@ const tx = evmAddr.buildTransaction({
|
|
|
477
477
|
value: 1_000_000_000_000_000n,
|
|
478
478
|
chainId: 1,
|
|
479
479
|
});
|
|
480
|
-
await
|
|
480
|
+
await tx.sign(); // resolves once the signature exists
|
|
481
481
|
const tracker = await evmAddr.sendTransaction(tx);
|
|
482
482
|
|
|
483
483
|
tracker.on("change", (state) => console.log("state →", state.status));
|
|
@@ -491,6 +491,8 @@ const sim = await evmAddr.simulateTransaction(tx);
|
|
|
491
491
|
console.log(sim.gasUsed);
|
|
492
492
|
```
|
|
493
493
|
|
|
494
|
+
`address.signTransaction(tx)` returns straight away and does not wait for the signature. To use the signed bytes (`tx.rawTransaction`, `tx.hash`), `await tx.sign()` first — it resolves once signing is done and is safe to call more than once.
|
|
495
|
+
|
|
494
496
|
`buildTransferPayload()` is the one-call path for moving value — it works out the right payload for the asset (native value, ERC-20 calldata, or SPL instructions). You then pass that payload to `buildTransaction()` and send it like any other transaction:
|
|
495
497
|
|
|
496
498
|
```ts
|
|
@@ -503,11 +505,32 @@ const bySymbol = evmAddr.buildTransferPayload({ to: recipient, asset: { symbol:
|
|
|
503
505
|
|
|
504
506
|
// build the transaction from the payload, then sign/send it
|
|
505
507
|
const tx = evmAddr.buildTransaction({ ...nativePayload, chainId: 1 });
|
|
506
|
-
await
|
|
508
|
+
await tx.sign();
|
|
507
509
|
```
|
|
508
510
|
|
|
509
511
|
Amounts are in the token's smallest unit. `buildTransaction` fills in nonce/gas/fees for you when you omit them, or uses the values you pass. An SPL transfer to a recipient without a token account prepends the account-creation step for you.
|
|
510
512
|
|
|
513
|
+
#### Signing bytes you built yourself
|
|
514
|
+
|
|
515
|
+
If you build and broadcast transactions yourself and only need a signature, two methods sign exactly the bytes you give them. Neither hashes its input, adds a prefix, or touches the network.
|
|
516
|
+
|
|
517
|
+
```ts
|
|
518
|
+
// EVM: sign a 32-byte digest you computed (for example the keccak of an encoded transaction)
|
|
519
|
+
const { r, s, recovery, signature } = evmAddr.signDigest("0x" + "ab".repeat(32));
|
|
520
|
+
// r, s: 32-byte hex (s is low); recovery: 0 or 1; signature: 65 bytes, v = 27 + recovery
|
|
521
|
+
|
|
522
|
+
// SVM: sign arbitrary bytes, for example a serialized Solana transaction message
|
|
523
|
+
const { signature: sig58, signatureHex } = svmAddr.signBytes(messageBytes);
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
- Both take a `Uint8Array` or a `0x`-prefixed hex string of whole bytes. Base64 and hex without the prefix are refused; decode base64 yourself first.
|
|
527
|
+
- `signDigest` requires exactly 32 bytes.
|
|
528
|
+
- `signBytes` accepts any length, including binary data that `signMessageEncoded(..., "ed25519")` cannot carry, because that method takes text.
|
|
529
|
+
- The 65-byte `signature` uses the message-signing convention for `v`. For a typed transaction use `recovery` as the y-parity, and for a legacy EIP-155 transaction use `35 + 2 * chainId + recovery`.
|
|
530
|
+
- `signDigest` works only on an EVM address and `signBytes` only on an SVM address. Each needs the account unlocked.
|
|
531
|
+
|
|
532
|
+
> ⚠️ These sign anything you hand them, with none of the checks `signTypedData` applies. Only pass digests and bytes you assembled yourself.
|
|
533
|
+
|
|
511
534
|
### Network — pre-loaded networks + your own
|
|
512
535
|
|
|
513
536
|
```ts
|
|
@@ -581,7 +604,8 @@ const evmTx = new EvmTransaction({
|
|
|
581
604
|
maxFeePerGas: 50_000_000_000n,
|
|
582
605
|
maxPriorityFeePerGas: 1_000_000_000n,
|
|
583
606
|
});
|
|
584
|
-
|
|
607
|
+
evmAddr.signTransaction(evmTx); // checks `from` and attaches the transaction to this address
|
|
608
|
+
await evmTx.sign(); // resolves once the signature exists
|
|
585
609
|
const evmTracker = await evmAddr.sendTransaction(evmTx);
|
|
586
610
|
|
|
587
611
|
const receipt = await evmTracker.whenConfirmed();
|