Skip to content

Fix various small bugs#4150

Open
kajoseph wants to merge 6 commits intobitpay:masterfrom
kajoseph:fixVarious
Open

Fix various small bugs#4150
kajoseph wants to merge 6 commits intobitpay:masterfrom
kajoseph:fixVarious

Conversation

@kajoseph
Copy link
Copy Markdown
Collaborator

@kajoseph kajoseph commented Apr 29, 2026

Description

This fixes various small bugs I found while digging into various issues recently

Changelog

  • bitcore-cli: Fixes read-only wallet imports
  • bitcore-cli: Adds read-only export functionality (to support exporting RO wallets)
  • root: Fixes vscode debugger crashing - bump root typescript version to 5.7
  • insight: Fixes bitcore libs version mismatch with @bitpay-labs depdendencies
  • insight: Fixes block page crashing to a white page when the block tx call fails

Testing Notes

  • bitcore-cli: Export any read-only wallet from the app and import into bitcore-cli
  • bitcore-cli: Export a wallet as read-only
  • bitcore-cli: Export a read-only wallet -- it should not error and not ask if you want to export read-only.
  • root: The vscode debugger should work
  • insight: it should run + going to block page where txs API call returns empty should not crash to a white page

Checklist

  • I have read CONTRIBUTING.md and verified that this PR follows the guidelines and requirements outlined in it.

@kajoseph kajoseph added bitcore-cli This pull request modifies the bitcore-cli package insight This pull request modifies the insight package labels Apr 29, 2026
@kajoseph kajoseph requested review from MichaelAJay and Copilot April 29, 2026 17:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses several small bugs across the monorepo, including read-only wallet handling in bitcore-cli, stability fixes in Insight’s block details UI, and dependency/version alignment (TypeScript at the repo root and bitcore-lib packages in Insight).

Changes:

  • bitcore-cli: Improve handling of read-only wallets during load/save/import.
  • insight: Prevent Block Details “Transactions” section from crashing when the tx list is missing; align @bitpay-labs/bitcore-lib* versions.
  • Root: Bump TypeScript to 5.7.3 (plus lockfile updates).

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/insight/src/components/block-details.tsx Avoids runtime crash when transactionList is undefined by guarding length access.
packages/insight/package.json Updates Insight’s @bitpay-labs/bitcore-lib* dependency versions.
packages/insight/package-lock.json Lockfile updates reflecting the Insight dependency version changes.
packages/bitcore-cli/src/wallet.ts Adjusts wallet load/save/import paths to support read-only wallets (no key).
package.json Updates root TypeScript version to 5.7.3.
package-lock.json Lockfile updates reflecting the TypeScript bump (and nested dependency resolution).
Files not reviewed (1)
  • packages/insight/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)

packages/bitcore-cli/src/wallet.ts:280

  • save() now serializes wallets where this.#walletData.key can be undefined (read-only wallets). However export() still assumes this.#walletData.key is always present and calls .toObj() unconditionally, which will throw at runtime if a user loads/imports a read-only wallet and then runs export. Update export() to either (a) support exporting read-only wallets by omitting key, or (b) fail fast with a clear message when key is missing.
      let data: WalletData | EncryptionTypes.IEncrypted = { key: this.#walletData.key?.toObj(), credentials: this.#walletData.credentials.toObj() };
      if (encryptAll) {
        const password = await getPassword('Enter password to encrypt:', { minLength: 6 });
        await prompt.password({
          message: 'Confirm password:',

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

kajoseph and others added 2 commits April 29, 2026 14:42
Co-authored-by: Copilot <copilot@github.com>
Comment thread packages/bitcore-cli/src/wallet.ts Outdated
}

let key;
if (this.#walletData.key instanceof TssKey.TssKey) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrap prior if/else in if (!readonly) {}

throw new Error('No wallet data to save. Wallet not created or loaded');
}

let key;
Copy link
Copy Markdown
Contributor

@MichaelAJay MichaelAJay Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to explicitly type key:
let key: TssKey.TssKey | Key | undefined

The downside being that the conditional below (get pw & decrypt) would have to get bumped into each conditional branch (but then could be cleaned up below)

    let key: TssKey.TssKey | Key | undefined;
    if (this.#walletData.key instanceof TssKey.TssKey) {
      key = new TssKey.TssKey(this.#walletData.key.toObj());
      const walletPassword = await getPassword('Wallet password:');
      key.decrypt(walletPassword);
    } else if (!readOnly) {
      key = new Key({ seedType: 'object', seedData: this.#walletData.key.toObj() });
      const walletPassword = await getPassword('Wallet password:');
      key.decrypt(walletPassword);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bitcore-cli This pull request modifies the bitcore-cli package insight This pull request modifies the insight package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants