Skip to content

Conversation

@Corey-Code
Copy link
Owner

This pull request adds first-class support for SVM (Solana Virtual Machine) networks and assets to the codebase, alongside existing Cosmos, Bitcoin, and EVM support. The changes include Solana key derivation, network and asset registry integration, account management in the keyring, and static asset definitions. Additionally, several EVM networks and their native assets have been added to improve coverage.

Key changes:

Solana/SVM Support:

  • Introduced Solana (SVM) key derivation and address utilities in the new src/lib/crypto/solana.ts, supporting BIP44 derivation, base58 encoding, and address validation.
  • Extended the Keyring class to support SVM accounts, including methods for deriving, retrieving, serializing, and restoring Solana accounts, and updated serialization logic to handle SVM data. [1] [2] [3] [4] [5] [6]
  • Added SVM network and asset definitions, including static assets for Solana mainnet, devnet, testnet, and Eclipse, and integrated SVM asset support into asset fetching and fallbacks. [1] [2] [3] [4]
  • Updated network registry and type-checking utilities to recognize SVM networks, with new helpers and exports for SVM network configs. [1] [2] [3] [4] [5] [6]

EVM Network and Asset Expansion:

  • Added native asset definitions for multiple EVM networks, including eth-mainnet, pol-mainnet (Polygon), arb1-mainnet (Arbitrum), oeth-mainnet (Optimism), cro-mainnet (Cronos), ftm-mainnet (Fantom), gno-mainnet (Gnosis), manta-mainnet, zksync-mainnet, metis-andromeda-mainnet, and zkevm-mainnet. [1] [2] [3]
  • Updated token color mappings for new EVM and SVM assets.

Dependency Update:

  • Added @noble/curves as a dependency to support Ed25519 cryptography for Solana key derivation.

- 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.
@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: 2713ace
Status: ✅  Deploy successful!
Preview URL: https://08867746.vidulum-app.pages.dev
Branch Preview URL: https://feature-add-svm-evm-and-asse.vidulum-app.pages.dev

View logs

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 PR introduces first-class Solana/SVM support and significantly expands network and asset handling across the wallet, including cryptography, network registry, keyring, storage, UI, and documentation, along with comprehensive tests. It also adds a static known-asset registry for popular ERC20 and SPL tokens and extends native asset definitions for multiple EVM networks.

Changes:

  • Add Solana/SVM cryptography (Ed25519 SLIP-0010 derivation), RPC client, network configs, and keyring support, plus wallet store and UI wiring for SVM accounts and addresses.
  • Extend the asset system with static native assets for many EVM and SVM networks and a large known-token registry (ERC20 & SPL), integrating into the Network Manager and Dashboard.
  • Update storage, network abstractions, and documentation to support the new network type pattern, and add targeted tests for Solana crypto/client, network registry SVM handling, and asset registries.

Reviewed changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/lib/solana/client.test.ts New test suite covering SolanaClient RPC behavior (balances, token balances, slots, blockhash, rent exemption, tx send, signature status, account info, RPC error handling).
tests/lib/networks/registry.test.ts Extends registry tests to cover SVM networks (Solana mainnet/devnet configs, SVM type guards, enabled SVM networks, explorer URL helpers).
tests/lib/crypto/solana.test.ts New tests validating Solana derivation paths, deterministic Ed25519 key derivation from mnemonics, address formatting, and basic address validation behavior.
tests/lib/assets/knownAssets.test.ts New tests for the known ERC20/SPL token registry; currently assert that getKnownErc20Tokens(56) and (137) return [], which conflicts with the new BSC/Polygon token lists and will need updating.
src/store/walletStore.ts Extends pre-derivation and account-creation/import flows to derive and persist SVM addresses, adds getSvmAddress/deriveSvmAccount store methods, and changes Bitcoin/EVM pre-derivation to cover all networks (not just enabled) for better future enablement behavior.
src/store/networkStore.ts Broadens getNetworksByType to include the new 'svm' NetworkType so UI and logic can retrieve SVM networks via the store.
src/popup/pages/Dashboard.tsx Integrates SVM into the Dashboard: adds SVM tab, SVM address derivation and caching (per account/network), ensures balances only load once SVM addresses are derived, and adjusts network list styling and account menu layout.
src/popup/pages/CreateWallet.tsx Adjusts the root container to allow horizontal overflow and fit-content width, improving layout behavior for the create-wallet flow.
src/popup/components/NetworkManagerModal.tsx Extends Network Manager with an SVM tab, type-aware asset loading for Cosmos/EVM/SVM (including known ERC20/SPL tokens), and updated badge color schemes for the new network type.
src/lib/storage/encrypted-storage.ts Adds an svm map to the derivedAddresses structure for imported accounts and threads it through add/get/update helpers so SVM pre-derived addresses are stored and retrievable without passwords.
src/lib/solana/index.ts New Solana module barrel exporting the SolanaClient, factory, and related types.
src/lib/solana/client.ts New Solana RPC client implementing JSON-RPC calls for SOL balances, SPL token balances, slots, blockhashes, rent, sending transactions, signature status, account info, and RPC URL failover.
src/lib/networks/types.ts Introduces SvmNetworkConfig and extends NetworkType/NetworkConfig unions, modeling core SVM properties (rpcUrls, cluster, isMainnet).
src/lib/networks/solana.ts Adds concrete SVM network configs for Solana mainnet/devnet/testnet and Eclipse mainnet, plus helpers to list and filter enabled SVM networks.
src/lib/networks/registry.ts Registers SVM networks, adds getSvm, isSvmNetwork, and ensures explorer URL helpers work for the new networks in addition to existing types.
src/lib/networks/index.ts Re-exports SVM config types, concrete SVM networks, SVM registry helpers, and SVM type guard alongside existing network exports.
src/lib/crypto/solana.ts New Ed25519 SLIP-0010 key-derivation module for Solana, including BIP44 path generation, mnemonic-to-keypair derivation, base58 address encoding, and a lightweight isValidSolanaAddress check.
src/lib/crypto/keyring.ts Extends the Keyring with an SvmKeyringAccount type, in-memory SVM account storage, derivation from the main mnemonic, serialization/deserialization of SVM addresses for session persistence, and SVM key getters that can re-derive keys when needed.
src/lib/cosmos/chains.ts Updates getNetworkType to return 'svm' for SVM networks, enabling generic network-type routing logic to recognize SVM.
src/lib/assets/knownAssets.ts Introduces a comprehensive static registry of known ERC20 tokens across many EVM chains and SPL tokens on Solana mainnet, with helpers to retrieve token lists, look up tokens by denom, and extract contract/mint addresses.
src/lib/assets/chainRegistry.ts Adds static native asset definitions for a wide set of EVM networks and SVM networks, integrates them into fallback assets, and updates fetchChainAssets and token color mappings to handle EVM and SVM types.
package.json Adds @noble/curves as a dependency for Ed25519 functionality and keeps existing cryptographic dependencies aligned with the new SVM crypto module.
package-lock.json Locks in @noble/curves and its transitive @noble/hashes dependency (v2.x) alongside the existing hashes dependency, matching the new crypto usage.
docs/ADDING_NETWORK_TYPE.md New, thorough guide documenting all steps required to add a new network type (patterned after the SVM integration), spanning types, networks, crypto, keyring, storage, UI, and testing.

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

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, #65, 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, #66, to work on those changes. Once the pull request is ready, I'll request review from you.

@Corey-Code Corey-Code merged commit 29f1608 into develop Feb 3, 2026
3 checks passed
@Corey-Code Corey-Code deleted the feature/add-svm-evm-and-assets branch February 3, 2026 22:14
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