@solard/cli 0.2.15 → 0.2.17

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.
@@ -115,40 +115,23 @@ async function confirmNewPassword(): Promise<string> {
115
115
 
116
116
  async function validateAllStoredWallets(password: string): Promise<void> {
117
117
  setMasterKey(password);
118
- const { createTraderSolard } = await import("@solard/sdk");
118
+ const { createTraderSolard } = await import("@solard/core");
119
119
  const probe = createTraderSolard();
120
120
  try {
121
- const wallets = probe.db.wallets
122
- .select()
123
- .orderBy("id", "asc")
124
- .all() as Array<{
125
- name: string;
126
- address: string;
127
- }>;
128
- if (!wallets.length) return;
129
- const failures: Array<{ name: string; address: string }> = [];
130
- let decrypted = 0;
131
- for (const wallet of wallets) {
132
- try {
133
- probe.wallets.signer(wallet.address);
134
- decrypted += 1;
135
- } catch {
136
- failures.push({ name: wallet.name, address: wallet.address });
137
- }
138
- }
139
- if (!failures.length) return;
121
+ const integrity = probe.wallets.integrity();
122
+ if (!integrity.failures.length) return;
140
123
  clearMasterKey();
141
- if (decrypted === 0) {
124
+ if (integrity.decrypted === 0) {
142
125
  throw new VaultOnboardingError(
143
126
  "That wallet password could not decrypt the stored wallet database.",
144
127
  );
145
128
  }
146
- const affected = failures
129
+ const affected = integrity.failures
147
130
  .map((wallet) => `@${wallet.name} ${wallet.address}`)
148
131
  .join(", ");
149
132
  throw new VaultIntegrityError(
150
133
  `Wallet database integrity check failed: one master password must decrypt every stored signing wallet. ` +
151
- `Decrypted ${decrypted}/${wallets.length}; undecryptable: ${affected}`,
134
+ `Decrypted ${integrity.decrypted}/${integrity.total}; undecryptable or mismatched: ${affected}`,
152
135
  );
153
136
  } finally {
154
137
  probe.close();