Skip to content

Conversation

@Corey-Code
Copy link
Owner

This pull request introduces significant improvements to the security and interoperability of the crypto and blockchain modules, with a focus on secure key derivation, BIP32 path validation, and Cosmos IBC (Inter-Blockchain Communication) support. It also includes an important new dependency and some minor code formatting enhancements.

Security and Key Derivation Improvements:

  • Enhanced BIP32 key derivation for both Bitcoin and EVM by adding secure memory cleanup (zeroing out sensitive data), validating private keys at each derivation step, and validating BIP32 derivation paths before use. This helps prevent sensitive keys from lingering in memory and guards against invalid key generation. (src/lib/crypto/bitcoin.ts, src/lib/crypto/evm.ts) [1] [2] [3] [4] [5] [6]

  • Updated Bitcoin and UTXO derivation path logic to use Keplr-compatible account indexing, aligning with Cosmos chain standards and improving cross-chain wallet compatibility. (src/lib/crypto/bitcoin.ts) [1] [2] [3]

Cosmos IBC Interoperability:

  • Added a new src/lib/cosmos/ibc-connections.ts module to fetch, manage, and cache IBC channel data from the Cosmos chain registry, enabling robust cross-chain token transfer support and chain connection discovery. (src/lib/cosmos/ibc-connections.ts)

API and Dependency Updates:

  • Exposed additional Bitcoin transaction building and signing functions and types from src/lib/bitcoin/transaction.ts for broader use in the codebase. (src/lib/bitcoin/index.ts)

  • Added the @moonpay/moonpay-react dependency to package.json, likely for fiat onramp/offramp integration. (package.json)

Other Improvements:

  • Improved code formatting and readability in several crypto utility functions, such as breaking up long parameter lists for better maintainability. (src/lib/crypto/bitcoin.ts) [1] [2] [3]

These changes collectively improve the security, maintainability, and cross-chain compatibility of the codebase.

Corey-Code and others added 3 commits February 1, 2026 13:10
…#47) (#50)

* Feature - Integrate MoonPay SDK for buy/sell functionality in web app

* Update src/popup/components/MoonPaySDKWidget.tsx



* Update Withdraw.tsx



* Fix MoonPay extension documentation to reflect new tab implementation (#48)

* Initial plan

* Update MoonPayWidget documentation to reflect new tab approach



---------




* Fix MoonPay widget documentation to reflect new tab implementation (#49)

* Initial plan

* Update MoonPay integration documentation to reflect new tab behavior



---------




---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
- Implemented BIP32 derivation logic in test-bip32.cjs for generating child keys and addresses.
- Added BIP84 path derivation for native SegWit addresses in test-bip32.cjs.
- Created test-keplr-path.cjs to validate Keplr-compatible derivation paths for Bitcoin.
- Introduced comprehensive tests for UTXO transactions in transaction.test.ts, covering fee estimation, transaction building, and error handling.
- Enhanced crypto tests to validate Bitcoin key derivation and address generation in keyring.test.ts.
- Updated chainRegistry tests to mock cosmos-registry module for better isolation.
Copy link
Contributor

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 pull request implements significant security and interoperability improvements for a multi-chain cryptocurrency wallet, focusing on three main areas:

Changes:

  • Enhanced BIP32 key derivation with secure memory cleanup, private key validation, and Keplr-compatible derivation paths for Bitcoin and EVM chains
  • Added Cosmos IBC (Inter-Blockchain Communication) support with channel discovery, caching, and cross-chain token transfers
  • Integrated MoonPay SDK for fiat on/off-ramp functionality with separate implementations for web app (SDK widget) and extension (external tab)
  • Implemented Bitcoin transaction building and signing with support for SegWit and legacy formats, including UTXO selection and fee estimation
  • Added multi-wallet account management allowing users to create new wallets with separate mnemonics or derive accounts from existing wallets

Reviewed changes

Copilot reviewed 26 out of 28 changed files in this pull request and generated 28 comments.

Show a summary per file
File Description
vite.config.web.ts, vite.config.js Added __IS_WEB_BUILD__ build-time constant to differentiate web app from extension
src/vite-env.d.ts Type declaration for build-time constant
src/lib/crypto/bitcoin.ts Enhanced BIP32 derivation with security hardening, Keplr-compatible paths, and memory cleanup
src/lib/crypto/evm.ts Similar security enhancements for EVM key derivation
src/lib/crypto/keyring.ts Added wallet management for cross-chain signing and forced re-derivation support
src/lib/storage/encrypted-storage.ts Extended storage to support imported accounts with pre-derived addresses
src/store/walletStore.ts Major additions for multi-wallet management, cross-chain signing with password
src/lib/bitcoin/transaction.ts New comprehensive transaction building and signing module for UTXO chains
src/lib/bitcoin/index.ts Exposed transaction functions in public API
src/lib/cosmos/ibc-connections.ts New module for IBC connection discovery and management
src/popup/components/IBCTransferModal.tsx New UI component for IBC token transfers
src/popup/components/MoonPayWidget.tsx Universal MoonPay widget with web/extension variants
src/popup/components/MoonPaySDKWidget.tsx Web-specific MoonPay SDK integration
src/popup/components/SendModal.tsx Added Bitcoin transaction signing support
src/popup/pages/Dashboard.tsx Added IBC transfer UI, improved account management, address caching
src/popup/pages/Deposit.tsx, Withdraw.tsx Split into web/extension variants with MoonPay integration
tests/* Updated and added tests for new derivation paths and transaction building
package.json Added @moonpay/moonpay-react dependency
Comments suppressed due to low confidence (1)

src/store/walletStore.ts:38

  • The syncKeyringWithBackground function skips execution in web builds using __IS_WEB_BUILD__, but doesn't check if browser.runtime.sendMessage is available before calling it. In some edge cases, even in extension builds, the runtime API might not be available (e.g., if the extension context is invalidated). Add a check for browser?.runtime?.sendMessage before attempting to use it.
async function syncKeyringWithBackground(serializedKeyring: string): Promise<void> {
  // Skip in web builds - no background service worker
  if (__IS_WEB_BUILD__) {
    return;
  }

  try {
    const response = await browser.runtime.sendMessage({
      type: MessageType.SYNC_KEYRING,
      payload: { serializedKeyring },
    });
    if (response?.success) {
      console.log('Background service worker synced');
    } else {
      console.warn('Background sync failed:', response?.error);

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

Copy link
Contributor

Copilot AI commented Feb 3, 2026

@Corey-Code I've opened a new pull request, #53, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Feb 3, 2026

@Corey-Code I've opened a new pull request, #54, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Feb 3, 2026

@Corey-Code I've opened a new pull request, #55, to work on those changes. Once the pull request is ready, I'll request review from you.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 3, 2026

Deploying vidulum-app with  Cloudflare Pages  Cloudflare Pages

Latest commit: f5c353c
Status: ✅  Deploy successful!
Preview URL: https://7c0102c0.vidulum-app.pages.dev
Branch Preview URL: https://feature-changes-and-improvem.vidulum-app.pages.dev

View logs

Copy link
Contributor

Copilot AI commented Feb 3, 2026

@Corey-Code I've opened a new pull request, #56, to work on those changes. Once the pull request is ready, I'll request review from you.

Corey-Code and others added 2 commits February 2, 2026 22:14
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI commented Feb 3, 2026

@Corey-Code I've opened a new pull request, #57, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Feb 3, 2026

@Corey-Code I've opened a new pull request, #58, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI commented Feb 3, 2026

@Corey-Code I've opened a new pull request, #59, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI commented Feb 3, 2026

@Corey-Code I've opened a new pull request, #60, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI commented Feb 3, 2026

@Corey-Code I've opened a new pull request, #61, to work on those changes. Once the pull request is ready, I'll request review from you.

Corey-Code and others added 13 commits February 2, 2026 22:35
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI commented Feb 3, 2026

@Corey-Code I've opened a new pull request, #62, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Feb 3, 2026

@Corey-Code I've opened a new pull request, #63, to work on those changes. Once the pull request is ready, I'll request review from you.

Corey-Code and others added 3 commits February 3, 2026 09:34
…hing and caching logic

- Updated `fetchIBCConnections` to utilize `getIBCChannelsForChainId` for fetching IBC connections.
- Removed caching mechanism and related functions for IBC connections.
- Re-exported `IBCChannel` type for backward compatibility.
- Cleaned up code and comments for clarity.
- Updated Cosmos registry file with new formatting and removed unnecessary comments.
…etwork switches (#63)

* Initial plan

* Implement two-level cache for Bitcoin and EVM addresses

- Change cache structure from Map<cosmosAddress, address> to Map<cosmosAddress, Map<networkId, address>>
- Addresses now persist across network switches
- Only clear display state on network change, not the entire cache
- Check cache before re-deriving addresses to avoid redundant work
- Improves efficiency for users switching between networks

Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>

* Fix infinite loop in cache dependency arrays

- Remove cache state from useEffect dependencies to prevent infinite loops
- Use functional state updates to access previous cache state
- Separate cache checking and updating into distinct phases
- Maintains cache persistence while avoiding re-render cycles

Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>

* Refactor cache to use useRef instead of setState for reads

- Replace useState cache with useRef to avoid anti-pattern
- Use trigger state to force re-renders when cache updates
- Read directly from ref without needing setState callbacks
- Cleaner code that follows React best practices

Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>
…sues (#62)

* Initial plan

* Add runtime Buffer availability checks to prevent initialization order issues

Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>

* Refactor: Extract ensureBuffer to shared utility module

Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>

* Optimize Buffer checks: call ensureBuffer once at module level

Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>

* Add documentation explaining defensive Buffer check in ensureBuffer

Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>
@Corey-Code Corey-Code merged commit 4fc329e into develop Feb 3, 2026
2 checks passed
@Corey-Code Corey-Code deleted the feature/changes-and-improvements branch February 3, 2026 14:59
Corey-Code added a commit that referenced this pull request Feb 3, 2026
* Feature - Integrate MoonPay SDK for buy/sell functionality in web app (#47)

* Feature - Integrate MoonPay SDK for buy/sell functionality in web app

* Update src/popup/components/MoonPaySDKWidget.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update Withdraw.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fix MoonPay extension documentation to reflect new tab implementation (#48)

* Initial plan

* Update MoonPayWidget documentation to reflect new tab approach

Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>

* Fix MoonPay widget documentation to reflect new tab implementation (#49)

* Initial plan

* Update MoonPay integration documentation to reflect new tab behavior

Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>

* Feature/changes and improvements (#52)

* Feature - Integrate MoonPay SDK for buy/sell functionality in web app (#47) (#50)

* Feature - Integrate MoonPay SDK for buy/sell functionality in web app

* Update src/popup/components/MoonPaySDKWidget.tsx



* Update Withdraw.tsx



* Fix MoonPay extension documentation to reflect new tab implementation (#48)

* Initial plan

* Update MoonPayWidget documentation to reflect new tab approach



---------




* Fix MoonPay widget documentation to reflect new tab implementation (#49)

* Initial plan

* Update MoonPay integration documentation to reflect new tab behavior



---------




---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>

* feat: add BIP32 and BIP84 derivation tests for Bitcoin addresses

- Implemented BIP32 derivation logic in test-bip32.cjs for generating child keys and addresses.
- Added BIP84 path derivation for native SegWit addresses in test-bip32.cjs.
- Created test-keplr-path.cjs to validate Keplr-compatible derivation paths for Bitcoin.
- Introduced comprehensive tests for UTXO transactions in transaction.test.ts, covering fee estimation, transaction building, and error handling.
- Enhanced crypto tests to validate Bitcoin key derivation and address generation in keyring.test.ts.
- Updated chainRegistry tests to mock cosmos-registry module for better isolation.

* feat: implement IBC transfer functionality and modal in the dashboard

* Add fee validation for sweepAll transactions to prevent excessive fees (#53)

* Fix memory safety in deriveBitcoinKeyPairFromSeed key cleanup (#55)

* Secure pubKey cleanup in BIP32 child key derivation (#54)

* Update transaction.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update bitcoin.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update encrypted-storage.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update transaction.test.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update walletStore.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update ibc-connections.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update IBCTransferModal.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update IBCTransferModal.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update IBCTransferModal.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update IBCTransferModal.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update Dashboard.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update chainRegistry.test.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update transaction.test.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Simplify secureZero function in evm.ts to remove ineffective random overwrite (#56)

* Add BIP32 hardened derivation indicator documentation (#57)

* Fix memory leak in EVM BIP32 child key derivation (#58)

* Use actual UTXO count for Bitcoin max amount fee estimation (#59)

* Remove forceReDerive parameter from address derivation (#60)

* Refactor IBC connections to use pre-bundled data; remove runtime fetching and caching logic

- Updated `fetchIBCConnections` to utilize `getIBCChannelsForChainId` for fetching IBC connections.
- Removed caching mechanism and related functions for IBC connections.
- Re-exported `IBCChannel` type for backward compatibility.
- Cleaned up code and comments for clarity.
- Updated Cosmos registry file with new formatting and removed unnecessary comments.

* Optimize address caching with two-level structure to persist across network switches (#63)

* Initial plan

* Implement two-level cache for Bitcoin and EVM addresses

- Change cache structure from Map<cosmosAddress, address> to Map<cosmosAddress, Map<networkId, address>>
- Addresses now persist across network switches
- Only clear display state on network change, not the entire cache
- Check cache before re-deriving addresses to avoid redundant work
- Improves efficiency for users switching between networks

Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>

* Fix infinite loop in cache dependency arrays

- Remove cache state from useEffect dependencies to prevent infinite loops
- Use functional state updates to access previous cache state
- Separate cache checking and updating into distinct phases
- Maintains cache persistence while avoiding re-render cycles

Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>

* Refactor cache to use useRef instead of setState for reads

- Replace useState cache with useRef to avoid anti-pattern
- Use trigger state to force re-renders when cache updates
- Read directly from ref without needing setState callbacks
- Cleaner code that follows React best practices

Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>

* Add runtime Buffer polyfill checks to prevent initialization order issues (#62)

* Initial plan

* Add runtime Buffer availability checks to prevent initialization order issues

Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>

* Refactor: Extract ensureBuffer to shared utility module

Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>

* Optimize Buffer checks: call ensureBuffer once at module level

Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>

* Add documentation explaining defensive Buffer check in ensureBuffer

Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Corey-Code <37006206+Corey-Code@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>

* Add comprehensive tests for Solana and asset management functionality (#64)

* Add comprehensive tests for Solana and asset management functionality

- Introduced tests for known ERC20 and SPL tokens, validating structure, uniqueness, and common tokens.
- Implemented tests for Solana cryptography, including key derivation, address generation, and validation.
- Enhanced network registry tests to include SVM networks and their configurations.
- Developed extensive tests for Solana RPC client, covering balance retrieval, token balances, transaction handling, and error management.

* Update solana.test.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update knownAssets tests for BSC and Polygon token support (#65)

* Implement proper base58 decoding and 32-byte validation for Solana addresses (#66)

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Corey-Code added a commit that referenced this pull request Feb 3, 2026
* Feature - Integrate MoonPay SDK for buy/sell functionality in web app (#47)

* Feature - Integrate MoonPay SDK for buy/sell functionality in web app

* Update src/popup/components/MoonPaySDKWidget.tsx



* Update Withdraw.tsx



* Fix MoonPay extension documentation to reflect new tab implementation (#48)

* Initial plan

* Update MoonPayWidget documentation to reflect new tab approach



---------




* Fix MoonPay widget documentation to reflect new tab implementation (#49)

* Initial plan

* Update MoonPay integration documentation to reflect new tab behavior



---------




---------




* Feature/changes and improvements (#52)

* Feature - Integrate MoonPay SDK for buy/sell functionality in web app (#47) (#50)

* Feature - Integrate MoonPay SDK for buy/sell functionality in web app

* Update src/popup/components/MoonPaySDKWidget.tsx



* Update Withdraw.tsx



* Fix MoonPay extension documentation to reflect new tab implementation (#48)

* Initial plan

* Update MoonPayWidget documentation to reflect new tab approach



---------




* Fix MoonPay widget documentation to reflect new tab implementation (#49)

* Initial plan

* Update MoonPay integration documentation to reflect new tab behavior



---------




---------




* feat: add BIP32 and BIP84 derivation tests for Bitcoin addresses

- Implemented BIP32 derivation logic in test-bip32.cjs for generating child keys and addresses.
- Added BIP84 path derivation for native SegWit addresses in test-bip32.cjs.
- Created test-keplr-path.cjs to validate Keplr-compatible derivation paths for Bitcoin.
- Introduced comprehensive tests for UTXO transactions in transaction.test.ts, covering fee estimation, transaction building, and error handling.
- Enhanced crypto tests to validate Bitcoin key derivation and address generation in keyring.test.ts.
- Updated chainRegistry tests to mock cosmos-registry module for better isolation.

* feat: implement IBC transfer functionality and modal in the dashboard

* Add fee validation for sweepAll transactions to prevent excessive fees (#53)

* Fix memory safety in deriveBitcoinKeyPairFromSeed key cleanup (#55)

* Secure pubKey cleanup in BIP32 child key derivation (#54)

* Update transaction.ts



* Update bitcoin.ts



* Update encrypted-storage.ts



* Update transaction.test.ts



* Update walletStore.ts



* Update ibc-connections.ts



* Update IBCTransferModal.tsx



* Update IBCTransferModal.tsx



* Update IBCTransferModal.tsx



* Update IBCTransferModal.tsx



* Update Dashboard.tsx



* Update chainRegistry.test.ts



* Update transaction.test.ts



* Simplify secureZero function in evm.ts to remove ineffective random overwrite (#56)

* Add BIP32 hardened derivation indicator documentation (#57)

* Fix memory leak in EVM BIP32 child key derivation (#58)

* Use actual UTXO count for Bitcoin max amount fee estimation (#59)

* Remove forceReDerive parameter from address derivation (#60)

* Refactor IBC connections to use pre-bundled data; remove runtime fetching and caching logic

- Updated `fetchIBCConnections` to utilize `getIBCChannelsForChainId` for fetching IBC connections.
- Removed caching mechanism and related functions for IBC connections.
- Re-exported `IBCChannel` type for backward compatibility.
- Cleaned up code and comments for clarity.
- Updated Cosmos registry file with new formatting and removed unnecessary comments.

* Optimize address caching with two-level structure to persist across network switches (#63)

* Initial plan

* Implement two-level cache for Bitcoin and EVM addresses

- Change cache structure from Map<cosmosAddress, address> to Map<cosmosAddress, Map<networkId, address>>
- Addresses now persist across network switches
- Only clear display state on network change, not the entire cache
- Check cache before re-deriving addresses to avoid redundant work
- Improves efficiency for users switching between networks



* Fix infinite loop in cache dependency arrays

- Remove cache state from useEffect dependencies to prevent infinite loops
- Use functional state updates to access previous cache state
- Separate cache checking and updating into distinct phases
- Maintains cache persistence while avoiding re-render cycles



* Refactor cache to use useRef instead of setState for reads

- Replace useState cache with useRef to avoid anti-pattern
- Use trigger state to force re-renders when cache updates
- Read directly from ref without needing setState callbacks
- Cleaner code that follows React best practices



---------




* Add runtime Buffer polyfill checks to prevent initialization order issues (#62)

* Initial plan

* Add runtime Buffer availability checks to prevent initialization order issues



* Refactor: Extract ensureBuffer to shared utility module



* Optimize Buffer checks: call ensureBuffer once at module level



* Add documentation explaining defensive Buffer check in ensureBuffer



---------




---------




* Add comprehensive tests for Solana and asset management functionality (#64)

* Add comprehensive tests for Solana and asset management functionality

- Introduced tests for known ERC20 and SPL tokens, validating structure, uniqueness, and common tokens.
- Implemented tests for Solana cryptography, including key derivation, address generation, and validation.
- Enhanced network registry tests to include SVM networks and their configurations.
- Developed extensive tests for Solana RPC client, covering balance retrieval, token balances, transaction handling, and error management.

* Update solana.test.ts



* Update knownAssets tests for BSC and Polygon token support (#65)

* Implement proper base58 decoding and 32-byte validation for Solana addresses (#66)

---------




---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants