@hardkas/accounts 0.9.1-alpha → 0.9.3-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.
Files changed (2) hide show
  1. package/dist/index.js +14 -13
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -79,7 +79,7 @@ function loadRealAccountStoreSync(options) {
79
79
  return store;
80
80
  } catch (e) {
81
81
  throw new Error(
82
- `Failed to load real account store at ${filePath}: ${e instanceof Error ? e.message : String(e)}`
82
+ `Failed to load real account store at ${filePath}: ${e instanceof Error ? e instanceof Error ? e instanceof Error ? e.message : String(e) : String(e) : String(e)}`
83
83
  );
84
84
  }
85
85
  }
@@ -102,7 +102,7 @@ async function saveRealAccountStore(store, options) {
102
102
  });
103
103
  } catch (e) {
104
104
  throw new Error(
105
- `Failed to save real account store at ${filePath}: ${e instanceof Error ? e.message : String(e)}`
105
+ `Failed to save real account store at ${filePath}: ${e instanceof Error ? e instanceof Error ? e instanceof Error ? e.message : String(e) : String(e) : String(e)}`
106
106
  );
107
107
  }
108
108
  }
@@ -247,7 +247,7 @@ function resolveHardkasAccount(options) {
247
247
  ...accConfig
248
248
  };
249
249
  }
250
- const realStore = loadRealAccountStoreSync();
250
+ const realStore = loadRealAccountStoreSync({ cwd: workspaceRoot });
251
251
  const realAcc = realStore ? getRealDevAccount(realStore, alias) : null;
252
252
  if (realAcc) {
253
253
  return {
@@ -308,7 +308,7 @@ function listHardkasAccounts(config) {
308
308
  }
309
309
  }
310
310
  }
311
- const realStore = loadRealAccountStoreSync();
311
+ const realStore = loadRealAccountStoreSync({ cwd: workspaceRoot });
312
312
  if (realStore) {
313
313
  for (const realAcc of listRealDevAccounts(realStore)) {
314
314
  accounts.set(realAcc.name, {
@@ -376,8 +376,8 @@ async function resolveHardkasAccountAddress(accountOrAddress, config, context =
376
376
  throw err;
377
377
  }
378
378
  } catch (e) {
379
- if (e.code === "HARDKAS_INVALID_ADDRESS") throw e;
380
- if (e.code === "ERR_MODULE_NOT_FOUND" || e.message.includes("Cannot find module") || e.message.includes("kaspa-wasm")) {
379
+ if (e instanceof Error && e.code === "HARDKAS_INVALID_ADDRESS") throw e;
380
+ if (e instanceof Error && (e.code === "ERR_MODULE_NOT_FOUND" || (e instanceof Error ? e instanceof Error ? e.message : String(e) : String(e)).includes("Cannot find module") || (e instanceof Error ? e instanceof Error ? e.message : String(e) : String(e)).includes("kaspa-wasm"))) {
381
381
  const err = new Error(
382
382
  "ADDRESS_VALIDATOR_UNAVAILABLE: The Kaspa address validator backend is not available."
383
383
  );
@@ -663,7 +663,7 @@ var KeystoreManager = class {
663
663
  return keystore;
664
664
  } catch (e) {
665
665
  throw new Error(
666
- `Failed to load keystore at ${filePath}: ${e instanceof Error ? e.message : String(e)}`
666
+ `Failed to load keystore at ${filePath}: ${e instanceof Error ? e instanceof Error ? e instanceof Error ? e.message : String(e) : String(e) : String(e)}`
667
667
  );
668
668
  }
669
669
  }
@@ -682,7 +682,7 @@ var KeystoreManager = class {
682
682
  });
683
683
  } catch (e) {
684
684
  throw new Error(
685
- `Failed to save keystore at ${filePath}: ${e instanceof Error ? e.message : String(e)}`
685
+ `Failed to save keystore at ${filePath}: ${e instanceof Error ? e instanceof Error ? e instanceof Error ? e.message : String(e) : String(e) : String(e)}`
686
686
  );
687
687
  }
688
688
  }
@@ -769,7 +769,7 @@ async function getOrCreateDevAccount(workspaceDir, index, alias) {
769
769
  try {
770
770
  address = pubKey.toAddress(network).toString();
771
771
  } catch (e) {
772
- const msg = e instanceof Error ? e.message : String(e);
772
+ const msg = e instanceof Error ? e instanceof Error ? e instanceof Error ? e.message : String(e) : String(e) : String(e);
773
773
  if (msg.includes("Second argument must be") || msg.includes("Unsupported")) {
774
774
  const err = new Error("DEV_ACCOUNT_BACKEND_UNSUPPORTED_NETWORK");
775
775
  err.code = "DEV_ACCOUNT_BACKEND_UNSUPPORTED_NETWORK";
@@ -781,12 +781,13 @@ async function getOrCreateDevAccount(workspaceDir, index, alias) {
781
781
  privateKey = privKey.toString();
782
782
  }
783
783
  } catch (e) {
784
- if (e.message === "DEV_ACCOUNT_BACKEND_UNSUPPORTED_NETWORK") {
784
+ const msg = e instanceof Error ? e instanceof Error ? e instanceof Error ? e.message : String(e) : String(e) : String(e);
785
+ if (msg === "DEV_ACCOUNT_BACKEND_UNSUPPORTED_NETWORK") {
785
786
  throw e;
786
787
  }
787
788
  console.warn(`
788
789
  [Warning] Could not generate dev account '${alias}'.
789
- ${e.message}`);
790
+ ${msg}`);
790
791
  return { address: "", privateKey: "", publicKey: "" };
791
792
  }
792
793
  const accountData = {
@@ -1168,7 +1169,7 @@ var KaspaSdkKeyGenerator = class {
1168
1169
  );
1169
1170
  } catch (e) {
1170
1171
  throw new Error(
1171
- `Failed to generate account using SDK: ${e instanceof Error ? e.message : String(e)}`
1172
+ `Failed to generate account using SDK: ${e instanceof Error ? e instanceof Error ? e instanceof Error ? e.message : String(e) : String(e) : String(e)}`
1172
1173
  );
1173
1174
  }
1174
1175
  }
@@ -1426,7 +1427,7 @@ var KaspaSdkRealTxSigner = class {
1426
1427
  txId
1427
1428
  };
1428
1429
  } catch (e) {
1429
- const msg = e instanceof Error ? e.message : String(e);
1430
+ const msg = e instanceof Error ? e instanceof Error ? e instanceof Error ? e.message : String(e) : String(e) : String(e);
1430
1431
  if (msg.includes("is not a constructor") || msg.includes("is not a function")) {
1431
1432
  throw new Error(
1432
1433
  `Kaspa SDK signer adapter could not find required transaction signing primitives: ${msg}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hardkas/accounts",
3
- "version": "0.9.1-alpha",
3
+ "version": "0.9.3-alpha",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -19,10 +19,10 @@
19
19
  "dependencies": {
20
20
  "hash-wasm": "^4.12.0",
21
21
  "kaspa-wasm": "0.13.0",
22
- "@hardkas/artifacts": "0.9.1-alpha",
23
- "@hardkas/config": "0.9.1-alpha",
24
- "@hardkas/core": "0.9.1-alpha",
25
- "@hardkas/localnet": "0.9.1-alpha"
22
+ "@hardkas/artifacts": "0.9.3-alpha",
23
+ "@hardkas/core": "0.9.3-alpha",
24
+ "@hardkas/config": "0.9.3-alpha",
25
+ "@hardkas/localnet": "0.9.3-alpha"
26
26
  },
27
27
  "devDependencies": {
28
28
  "tsup": "^8.3.5",