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
@@ -1,4 +1,4 @@
1
- import { c as Address, a5 as SvmTxBuildParams, a4 as SvmTransaction, N as Network, a2 as SvmAddressLookupTable } from './workspace-kmsiTC-d.js';
1
+ import { c as Address, a5 as SvmTxBuildParams, a4 as SvmTransaction, N as Network, a2 as SvmAddressLookupTable } from './workspace-D7nb3-cO.js';
2
2
 
3
3
  declare function svmResolveAddressLookupTables(network: Network, addresses: readonly string[]): Promise<SvmAddressLookupTable[]>;
4
4
  interface SvmInstruction {
@@ -1,4 +1,4 @@
1
- import { c as Address, a5 as SvmTxBuildParams, a4 as SvmTransaction, N as Network, a2 as SvmAddressLookupTable } from './workspace-kmsiTC-d.cjs';
1
+ import { c as Address, a5 as SvmTxBuildParams, a4 as SvmTransaction, N as Network, a2 as SvmAddressLookupTable } from './workspace-D7nb3-cO.cjs';
2
2
 
3
3
  declare function svmResolveAddressLookupTables(network: Network, addresses: readonly string[]): Promise<SvmAddressLookupTable[]>;
4
4
  interface SvmInstruction {
@@ -119,6 +119,7 @@ declare class Network {
119
119
  static readonly HyperEVMTestnet: Network;
120
120
  static readonly Robinhood: Network;
121
121
  static readonly RobinhoodTestnet: Network;
122
+ static readonly Ink: Network;
122
123
  static builtin(slug: Slug): Network | null;
123
124
  static all(): readonly Network[];
124
125
  static isBuiltinSlug(slug: Slug): boolean;
@@ -129,6 +130,8 @@ interface NetworkCollection extends ReadonlyArray<Network> {
129
130
  drop(network: Network): Promise<void>;
130
131
 
131
132
  update(network: Network): Promise<Network>;
133
+
134
+ move(slug: Slug, toIndex: number): Promise<void>;
132
135
  bySlug(slug: Slug): Network | null;
133
136
  byChainId(id: ChainId): Network | null;
134
137
  }
@@ -321,6 +324,8 @@ type WativeErrorCode = "WORKSPACE_LOCKED" | "ACCOUNT_LOCKED"
321
324
 
322
325
  | "WALLET_DISABLED" | "RECORD_LOCKED" | "BAD_PASSWORD" | "WEAK_PASSWORD" | "RECORD_NOT_FOUND" | "PROVIDER_IO" | "PERMISSION_DENIED" | "DISK_FULL" | "PARAMETER_ERROR"
323
326
 
327
+ | "DUPLICATE_IDENTITY"
328
+
324
329
  | "IRREGULAR_DESTINATION" | "DECRYPT_FAILED" | "ENCRYPT_FAILED" | "ALGORITHM_IRREVERSIBLE" | "INVALID_MNEMONIC" | "INVALID_PRIVATE_KEY" | "UNSUPPORTED_NETWORK" | "TX_BUILD_FAILED" | "TX_SIGN_FAILED" | "TX_SUBMIT_FAILED" | "TX_TIMEOUT" | "TX_DROPPED" | "TX_ABORTED" | "RPC_UNREACHABLE"
325
330
 
326
331
  | "RPC_REJECTED" | "STORAGE_NOT_DURABLE" | "UNSUPPORTED_OP";
@@ -797,6 +802,7 @@ declare class Wallet {
797
802
  clearTags(): Promise<void>;
798
803
 
799
804
  dumpPrivateKey(vm: ChainVM): string;
805
+
800
806
  drop(): Promise<void>;
801
807
  readonly _account: Account;
802
808
  }
@@ -840,7 +846,10 @@ declare class Account {
840
846
  readonly organizationType: AccountOrgType;
841
847
  encryptionAlgorithm: string;
842
848
  signature: string;
843
- ppCiphertext?: string;
849
+
850
+ get ppCiphertext(): string | undefined;
851
+
852
+ set ppCiphertext(_value: string | undefined);
844
853
  readonly hasOwnPassword: boolean;
845
854
  readonly _workspace: Workspace;
846
855
  readonly wallets: WalletCollection;
@@ -935,7 +944,6 @@ interface WalletCollection extends ReadonlyArray<Wallet> {
935
944
  drop(wallet: Wallet): Promise<void>;
936
945
  byId(id: number): Wallet | null;
937
946
  }
938
-
939
947
  declare function newMnemonic(wordCount?: 12 | 15 | 18 | 21 | 24): string;
940
948
 
941
949
  type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "fatal";
@@ -1067,6 +1075,8 @@ declare class Workspace {
1067
1075
 
1068
1076
  dropAsset(id: AssetId): Promise<void>;
1069
1077
 
1078
+ moveAsset(network: NetworkLike, id: AssetId, toIndex: number): Promise<void>;
1079
+
1070
1080
  _findUserAssetOnNetwork(slug: Slug): {
1071
1081
  id: number;
1072
1082
  symbol: string;
@@ -119,6 +119,7 @@ declare class Network {
119
119
  static readonly HyperEVMTestnet: Network;
120
120
  static readonly Robinhood: Network;
121
121
  static readonly RobinhoodTestnet: Network;
122
+ static readonly Ink: Network;
122
123
  static builtin(slug: Slug): Network | null;
123
124
  static all(): readonly Network[];
124
125
  static isBuiltinSlug(slug: Slug): boolean;
@@ -129,6 +130,8 @@ interface NetworkCollection extends ReadonlyArray<Network> {
129
130
  drop(network: Network): Promise<void>;
130
131
 
131
132
  update(network: Network): Promise<Network>;
133
+
134
+ move(slug: Slug, toIndex: number): Promise<void>;
132
135
  bySlug(slug: Slug): Network | null;
133
136
  byChainId(id: ChainId): Network | null;
134
137
  }
@@ -321,6 +324,8 @@ type WativeErrorCode = "WORKSPACE_LOCKED" | "ACCOUNT_LOCKED"
321
324
 
322
325
  | "WALLET_DISABLED" | "RECORD_LOCKED" | "BAD_PASSWORD" | "WEAK_PASSWORD" | "RECORD_NOT_FOUND" | "PROVIDER_IO" | "PERMISSION_DENIED" | "DISK_FULL" | "PARAMETER_ERROR"
323
326
 
327
+ | "DUPLICATE_IDENTITY"
328
+
324
329
  | "IRREGULAR_DESTINATION" | "DECRYPT_FAILED" | "ENCRYPT_FAILED" | "ALGORITHM_IRREVERSIBLE" | "INVALID_MNEMONIC" | "INVALID_PRIVATE_KEY" | "UNSUPPORTED_NETWORK" | "TX_BUILD_FAILED" | "TX_SIGN_FAILED" | "TX_SUBMIT_FAILED" | "TX_TIMEOUT" | "TX_DROPPED" | "TX_ABORTED" | "RPC_UNREACHABLE"
325
330
 
326
331
  | "RPC_REJECTED" | "STORAGE_NOT_DURABLE" | "UNSUPPORTED_OP";
@@ -797,6 +802,7 @@ declare class Wallet {
797
802
  clearTags(): Promise<void>;
798
803
 
799
804
  dumpPrivateKey(vm: ChainVM): string;
805
+
800
806
  drop(): Promise<void>;
801
807
  readonly _account: Account;
802
808
  }
@@ -840,7 +846,10 @@ declare class Account {
840
846
  readonly organizationType: AccountOrgType;
841
847
  encryptionAlgorithm: string;
842
848
  signature: string;
843
- ppCiphertext?: string;
849
+
850
+ get ppCiphertext(): string | undefined;
851
+
852
+ set ppCiphertext(_value: string | undefined);
844
853
  readonly hasOwnPassword: boolean;
845
854
  readonly _workspace: Workspace;
846
855
  readonly wallets: WalletCollection;
@@ -935,7 +944,6 @@ interface WalletCollection extends ReadonlyArray<Wallet> {
935
944
  drop(wallet: Wallet): Promise<void>;
936
945
  byId(id: number): Wallet | null;
937
946
  }
938
-
939
947
  declare function newMnemonic(wordCount?: 12 | 15 | 18 | 21 | 24): string;
940
948
 
941
949
  type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "fatal";
@@ -1067,6 +1075,8 @@ declare class Workspace {
1067
1075
 
1068
1076
  dropAsset(id: AssetId): Promise<void>;
1069
1077
 
1078
+ moveAsset(network: NetworkLike, id: AssetId, toIndex: number): Promise<void>;
1079
+
1070
1080
  _findUserAssetOnNetwork(slug: Slug): {
1071
1081
  id: number;
1072
1082
  symbol: string;
@@ -76,7 +76,7 @@ test("PK account — duplicate import is rejected", async () => {
76
76
  const ws = await Workspace.open({ path: root, password: "wsp-pwd" });
77
77
 
78
78
  const acc = await ws.accounts.create("HotWallet", "wsp-pwd", EVM_PK, undefined, { kind: "PK" });
79
- await assert.rejects(acc.importPrivateKey(EVM_PK, "evm"), (err) => err.code === "PARAMETER_ERROR");
79
+ await assert.rejects(acc.importPrivateKey(EVM_PK, "evm"), (err) => err.code === "DUPLICATE_IDENTITY");
80
80
 
81
81
  await ws.lock();
82
82
  });
@@ -8,15 +8,15 @@ const { join } = require("node:path");
8
8
 
9
9
  const { Workspace, Network } = require("wative-core");
10
10
 
11
- test("network — 14 pre-loaded networks ship at workspace open", async () => {
11
+ test("network — the pre-loaded networks ship at workspace open", async () => {
12
12
  const root = mkdtempSync(join(tmpdir(), "wative-net-builtin-"));
13
13
  const ws = await Workspace.open({ path: root, password: "wsp-pwd" });
14
14
 
15
15
  const slugs = ws.networks.map((n) => n.slug).sort();
16
16
  assert.deepStrictEqual(slugs, [
17
17
  "arbitrum", "arbitrum-sepolia", "base", "bnbchain", "ethereum",
18
- "hyperevm", "hyperevm-testnet", "optimism", "robinhood", "robinhood-testnet",
19
- "sepolia", "solana", "solana-devnet", "solana-testnet",
18
+ "hyperevm", "hyperevm-testnet", "ink", "optimism", "robinhood",
19
+ "robinhood-testnet", "sepolia", "solana", "solana-devnet", "solana-testnet",
20
20
  ]);
21
21
 
22
22
  assert.strictEqual(Network.ArbitrumSepolia.chainId, 421614);
@@ -43,9 +43,9 @@ test("network — add a brand-new user network", async () => {
43
43
  });
44
44
  await ws.networks.add(monad);
45
45
 
46
- assert.strictEqual(ws.networks.length, 15);
46
+ assert.strictEqual(ws.networks.length, 16);
47
47
  assert.strictEqual(ws.networks.bySlug("monad-testnet").chainId, 10143);
48
- await assert.rejects(ws.networks.add(monad), (err) => err.code === "PARAMETER_ERROR");
48
+ await assert.rejects(ws.networks.add(monad), (err) => err.code === "DUPLICATE_IDENTITY");
49
49
 
50
50
  await ws.lock();
51
51
  });
@@ -65,7 +65,7 @@ test("network — override a pre-loaded RPC URL via update()", async () => {
65
65
  ws.networks.bySlug("ethereum").rpcUrl,
66
66
  "https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY",
67
67
  );
68
- assert.strictEqual(ws.networks.length, 14);
68
+ assert.strictEqual(ws.networks.length, 15);
69
69
 
70
70
  await ws.lock();
71
71
  });
@@ -64,7 +64,7 @@ test("asset — id and address collisions are rejected", async () => {
64
64
  contractAddress: "0x1234567890123456789012345678901234567890",
65
65
  network: Network.Ethereum,
66
66
  });
67
- await assert.rejects(ws.addAsset(dupId), (err) => err.code === "PARAMETER_ERROR");
67
+ await assert.rejects(ws.addAsset(dupId), (err) => err.code === "DUPLICATE_IDENTITY");
68
68
 
69
69
  const dupAddr = new Asset({
70
70
  id: 201,
@@ -74,7 +74,7 @@ test("asset — id and address collisions are rejected", async () => {
74
74
  contractAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
75
75
  network: Network.Ethereum,
76
76
  });
77
- await assert.rejects(ws.addAsset(dupAddr), (err) => err.code === "PARAMETER_ERROR");
77
+ await assert.rejects(ws.addAsset(dupAddr), (err) => err.code === "DUPLICATE_IDENTITY");
78
78
 
79
79
  await ws.lock();
80
80
  });
@@ -6,7 +6,7 @@ const { mkdtempSync } = require("node:fs");
6
6
  const { tmpdir } = require("node:os");
7
7
  const { join } = require("node:path");
8
8
 
9
- const { Workspace, Network } = require("wative-core");
9
+ const { Workspace } = require("wative-core");
10
10
 
11
11
  const MNEMONIC =
12
12
  "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about";
@@ -36,7 +36,7 @@ test("address — buildTransaction convenience helper (offline)", async () => {
36
36
  const acc = await ws.accounts.create("Desk", "wsp-pwd", MNEMONIC);
37
37
  const evm = acc.wallets[0].addresses.find((a) => a.vm === "evm");
38
38
 
39
- const tx = await evm.buildTransaction({
39
+ const tx = evm.buildTransaction({
40
40
  to: "0x1234567890123456789012345678901234567890",
41
41
  value: 1_000_000_000_000_000n,
42
42
  chainId: 1,
@@ -45,7 +45,6 @@ test("address — buildTransaction convenience helper (offline)", async () => {
45
45
  maxFeePerGas: 50_000_000_000n,
46
46
  maxPriorityFeePerGas: 1_000_000_000n,
47
47
  type: 2,
48
- network: Network.Ethereum,
49
48
  });
50
49
 
51
50
  assert.strictEqual(tx.from.toLowerCase(), evm.publicKey.toLowerCase());
@@ -128,7 +128,7 @@ test("custom provider — full lifecycle against an in-memory backend", async ()
128
128
  assert.strictEqual(ws.locked, false);
129
129
 
130
130
  const slugs = ws.networks.map((n) => n.slug).sort();
131
- assert.strictEqual(slugs.length, 14);
131
+ assert.strictEqual(slugs.length, 15);
132
132
  assert.ok(slugs.includes("ethereum"));
133
133
  assert.ok(slugs.includes("arbitrum-sepolia"));
134
134
 
@@ -29,7 +29,7 @@ function versions(root) {
29
29
 
30
30
  test("HybridProviderV3 writes v3 records, and they all share one salt", async () => {
31
31
  const root = mkdtempSync(join(tmpdir(), "wative-v3-example-"));
32
- const ws = await Workspace.open(new HybridProviderV3(root), PW, true);
32
+ const ws = await Workspace.open(new HybridProviderV3(root), PW);
33
33
  const acc = await ws.accounts.create("V3 Desk", PW, MNEMONIC);
34
34
  await acc.deriveWallets(3);
35
35
  await ws.lock();
@@ -52,7 +52,7 @@ test("HybridProviderV3 writes v3 records, and they all share one salt", async ()
52
52
 
53
53
  test("a v3 container reopens and yields the original secrets", async () => {
54
54
  const root = mkdtempSync(join(tmpdir(), "wative-v3-example-"));
55
- let ws = await Workspace.open(new HybridProviderV3(root), PW, true);
55
+ let ws = await Workspace.open(new HybridProviderV3(root), PW);
56
56
  const created = await ws.accounts.create("V3 Desk", PW, MNEMONIC);
57
57
  await created.deriveWallets(2);
58
58
  const expected = created.wallets.map((w) => w.addresses.map((a) => a.publicKey).join(","));
@@ -72,7 +72,7 @@ test("a v3 container reopens and yields the original secrets", async () => {
72
72
 
73
73
  test("a wrong password is rejected, and does not damage the container", async () => {
74
74
  const root = mkdtempSync(join(tmpdir(), "wative-v3-example-"));
75
- let ws = await Workspace.open(new HybridProviderV3(root), PW, true);
75
+ let ws = await Workspace.open(new HybridProviderV3(root), PW);
76
76
  await ws.accounts.create("V3 Desk", PW, MNEMONIC);
77
77
  await ws.lock();
78
78
 
@@ -34,8 +34,8 @@ All tests work fully offline — no RPC calls, no real networks. Each test creat
34
34
  | [01-quick-start.test.cjs](01-quick-start.test.cjs) | Open a workspace, create an HD account, derive 5 wallets, inspect EVM + Solana addresses, lock. |
35
35
  | [02-hd-account.test.cjs](02-hd-account.test.cjs) | HD-specific flows — deriving / slicing wallets, dumping the mnemonic, account-level passwords with `resetPassword`, round-trip across lock + reopen. |
36
36
  | [03-pk-account.test.cjs](03-pk-account.test.cjs) | PK accounts — creating from a private key, importing more keys, and the three key formats accepted (EVM hex, Solana base58, `solana-keygen` JSON) with the chain inferred from the key. Also shows each import producing an address on both chains, duplicate-import rejection, and dropping wallets. |
37
- | [04-network-management.test.cjs](04-network-management.test.cjs) | The 14 pre-loaded networks, adding a brand-new network, overriding a pre-loaded RPC URL via `update()`, dropping user networks, the built-in protection guard. |
38
- | [05-asset-management.test.cjs](05-asset-management.test.cjs) | The 29 pre-loaded tokens, adding a custom user token, id collision rejection, contract-address collision rejection, dropping user tokens, `workspace.filter(q, "Asset")` search. |
37
+ | [04-network-management.test.cjs](04-network-management.test.cjs) | The 15 pre-loaded networks, adding a brand-new network, overriding a pre-loaded RPC URL via `update()`, dropping user networks, the built-in protection guard. |
38
+ | [05-asset-management.test.cjs](05-asset-management.test.cjs) | The 32 pre-loaded tokens, adding a custom user token, id collision rejection, contract-address collision rejection, dropping user tokens, `workspace.filter(q, "Asset")` search. |
39
39
  | [06-address-signing.test.cjs](06-address-signing.test.cjs) | Personal-message signing on EVM and Solana, building a transaction fully offline (no RPC). |
40
40
  | [07-custom-provider.test.cjs](07-custom-provider.test.cjs) | Taking over the record layer as well, by extending `Provider` rather than `ContainerProvider` — for storage that has its own encryption or its own idea of a record. Longer than [19](19-simple-provider.test.cjs); start there unless you need this. |
41
41
  | [08-persistence.test.cjs](08-persistence.test.cjs) | Round-trip across `lock()` + reopen — multiple accounts, user networks, custom assets, and logger configuration. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wative-core",
3
- "version": "2.5.4",
3
+ "version": "2.5.6",
4
4
  "description": "Hyperscale crypto wallet management library — multi-workspace, multi-chain, originally designed for on-chain market makers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.node.cjs",
@@ -102,6 +102,6 @@
102
102
  "tweetnacl": "1.0.3"
103
103
  },
104
104
  "optionalDependencies": {
105
- "@node-rs/argon2": "^2.0.2"
105
+ "@node-rs/argon2": "2.0.2"
106
106
  }
107
107
  }