@hardkas/config 0.5.0-alpha → 0.5.2-alpha

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/dist/index.d.ts CHANGED
@@ -4,24 +4,28 @@ type HardkasTargetKind = "simulated" | "kaspa-node" | "kaspa-rpc" | "igra";
4
4
  type HardkasNetworkName = string;
5
5
  interface HardkasSimulatedTarget {
6
6
  kind: "simulated";
7
+ description?: string;
7
8
  }
8
9
  interface HardkasKaspaNodeTarget {
9
10
  kind: "kaspa-node";
10
- network: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "devnet";
11
+ network: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "devnet" | "simnet";
11
12
  rpcUrl?: string;
12
13
  dataDir?: string;
13
14
  binaryPath?: string;
15
+ description?: string;
14
16
  }
15
17
  interface HardkasKaspaRpcTarget {
16
18
  kind: "kaspa-rpc";
17
- network: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "devnet";
19
+ network: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "devnet" | "simnet";
18
20
  rpcUrl: string;
21
+ description?: string;
19
22
  }
20
23
  interface HardkasIgraTarget {
21
24
  kind: "igra";
22
25
  chainId: number;
23
26
  rpcUrl: string;
24
27
  currencySymbol?: "iKAS";
28
+ description?: string;
25
29
  }
26
30
  type HardkasNetworkTarget = HardkasSimulatedTarget | HardkasKaspaNodeTarget | HardkasKaspaRpcTarget | HardkasIgraTarget;
27
31
  type HardkasAccountConfig = {
package/dist/index.js CHANGED
@@ -12,8 +12,15 @@ import { createJiti } from "jiti";
12
12
  var DEFAULT_HARDKAS_CONFIG = {
13
13
  defaultNetwork: "simnet",
14
14
  networks: {
15
+ simulated: {
16
+ kind: "simulated",
17
+ description: "Pure local simulation \u2014 no Docker, no RPC, no node"
18
+ },
15
19
  simnet: {
16
- kind: "simulated"
20
+ kind: "kaspa-node",
21
+ network: "simnet",
22
+ rpcUrl: "ws://127.0.0.1:18210",
23
+ description: "Local Docker kaspad on simnet \u2014 requires hardkas node start"
17
24
  },
18
25
  devnet: {
19
26
  kind: "kaspa-node",
@@ -81,11 +88,25 @@ async function loadConfigFile(filePath, cwd) {
81
88
  try {
82
89
  const jiti = createJiti(import.meta.url);
83
90
  const module = await jiti.import(filePath);
84
- const config = module.default || module.config || module;
91
+ const userConfig = module.default || module.config || module;
92
+ const mergedConfig = {
93
+ ...DEFAULT_HARDKAS_CONFIG,
94
+ ...userConfig,
95
+ // Merge networks: built-ins + user custom networks
96
+ networks: {
97
+ ...DEFAULT_HARDKAS_CONFIG.networks,
98
+ ...userConfig.networks && typeof userConfig.networks === "object" ? userConfig.networks : {}
99
+ },
100
+ // Merge accounts: only if user provides an object (not a number)
101
+ accounts: {
102
+ ...DEFAULT_HARDKAS_CONFIG.accounts,
103
+ ...userConfig.accounts && typeof userConfig.accounts === "object" && !Array.isArray(userConfig.accounts) ? userConfig.accounts : {}
104
+ }
105
+ };
85
106
  return {
86
107
  path: filePath,
87
108
  cwd,
88
- config
109
+ config: mergedConfig
89
110
  };
90
111
  } catch (error) {
91
112
  throw new Error(`Failed to load HardKAS config at ${filePath}: ${error instanceof Error ? error.message : String(error)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hardkas/config",
3
- "version": "0.5.0-alpha",
3
+ "version": "0.5.2-alpha",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "dependencies": {
19
19
  "jiti": "^2.4.2",
20
- "@hardkas/core": "0.5.0-alpha"
20
+ "@hardkas/core": "0.5.2-alpha"
21
21
  },
22
22
  "devDependencies": {
23
23
  "tsup": "^8.3.5",