Skip to content

Add Sonic network support#714

Merged
kvhnuke merged 2 commits intoenkryptcom:devop/release-2-9from
sonicseg:main
Jun 17, 2025
Merged

Add Sonic network support#714
kvhnuke merged 2 commits intoenkryptcom:devop/release-2-9from
sonicseg:main

Conversation

@sonicseg
Copy link
Contributor

@sonicseg sonicseg commented Jun 14, 2025

Summary

This PR adds support for the Sonic blockchain network to Enkrypt.

Changes Made

  • ✅ Added Sonic to NetworkNames and CoingeckoPlatform enums
  • ✅ Created sonic.ts network configuration file
  • ✅ Added Sonic network icon (WebP format)
  • ✅ Configured Etherscan-compatible activity handler
  • ✅ Integrated MEW asset handler for token balances
  • ✅ Added NFT handler support
  • ✅ Updated all necessary type definitions

Network Details

Testing

  • Network appears in manage networks screen
  • Can switch to Sonic network
  • Can view account balances
  • Transaction history loads correctly
  • Block explorer links work

Summary by CodeRabbit

  • New Features
    • Added support for the Sonic blockchain network, including network configuration, token balance tracking, asset information, and activity monitoring.
    • Integrated Sonic with Coingecko for price data and block explorer functionality.

kvhnuke and others added 2 commits June 4, 2025 11:53
…bs.com, block explorer sonicscan.org, with full activity/asset/NFT handler integration
@coderabbitai
Copy link

coderabbitai bot commented Jun 14, 2025

Walkthrough

Support for the Sonic network was added across multiple modules. This includes defining its network configuration, updating enums for network and Coingecko platform identifiers, adding endpoint mappings, extending supported network types, and integrating Sonic into asset and activity handlers. No changes were made to existing logic or control flow.

Changes

File(s) Change Summary
.../src/providers/ethereum/networks/sonic.ts Introduced Sonic network configuration and exported it as a new EvmNetwork instance.
.../src/providers/ethereum/networks/index.ts Imported and added Sonic network to the exported networks object.
.../src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts Added Sonic network endpoint to the NetworkEndpoints record.
.../src/providers/ethereum/libs/assets-handlers/assetinfo-mew.ts Added Sonic entry to supportedNetworks mapping with token balance and Coingecko platform info.
.../src/providers/ethereum/libs/assets-handlers/types/tokenbalance-mew.ts Extended SupportedNetworkNames union type to include NetworkNames.Sonic.
.../src/types/networks.ts Added Sonic to NetworkNames and CoingeckoPlatform enums.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Extension
    participant SonicNetwork
    participant Coingecko

    User->>Extension: Requests asset info or activity for Sonic
    Extension->>SonicNetwork: Fetches data (via API endpoints)
    Extension->>Coingecko: Fetches price data for Sonic
    SonicNetwork-->>Extension: Returns network data
    Coingecko-->>Extension: Returns price data
    Extension-->>User: Presents Sonic network info and activity
Loading

Possibly related PRs

  • feat: add derive network #680: Adds support for the Derive network, following a similar pattern for integrating a new network.
  • Add HEMI Network #688: Adds support for the Hemi network, mirroring the structure and changes for a different Ethereum-compatible network.

Suggested reviewers

  • kvhnuke
  • SemajaM8
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/extension/src/providers/ethereum/networks/sonic.ts (1)

19-20: Provide an HTTPS fallback RPC

Only a wss:// endpoint is defined. Some wallets/plugins (e.g. mobile deep-links or background scripts) cannot open WebSocket connections. Recommend adding an HTTPS endpoint if the network provides one, or at least document that limitation.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ccbae8f and a88a428.

📒 Files selected for processing (6)
  • packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts (1 hunks)
  • packages/extension/src/providers/ethereum/libs/assets-handlers/assetinfo-mew.ts (1 hunks)
  • packages/extension/src/providers/ethereum/libs/assets-handlers/types/tokenbalance-mew.ts (1 hunks)
  • packages/extension/src/providers/ethereum/networks/index.ts (2 hunks)
  • packages/extension/src/providers/ethereum/networks/sonic.ts (1 hunks)
  • packages/types/src/networks.ts (2 hunks)
🔇 Additional comments (9)
packages/types/src/networks.ts (2)

78-78: Add Sonic to NetworkNames enum
Addition of Sonic = "SONIC" aligns with PR objective to support the Sonic network.


159-159: Add Sonic to CoingeckoPlatform enum
Mapping Sonic = "sonic" ensures correct Coingecko platform integration.

packages/extension/src/providers/ethereum/libs/assets-handlers/assetinfo-mew.ts (1)

136-139: Register Sonic in MEW asset handler
The supportedNetworks mapping now includes NetworkNames.Sonic with tbName: 'sonic' and cgPlatform: CoingeckoPlatform.Sonic.

packages/extension/src/providers/ethereum/libs/assets-handlers/types/tokenbalance-mew.ts (1)

56-56: Extend SupportedNetworkNames with Sonic
Including NetworkNames.Sonic ensures Sonic balances are handled by the MEW asset handler.

packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts (1)

61-61: Configure Sonic block explorer endpoint
Added NetworkNames.Sonic'https://api.sonicscan.org/' to NetworkEndpoints for activity handling.

packages/extension/src/providers/ethereum/networks/index.ts (1)

44-44: Integrate Sonic network node
Imported sonicNode and added sonic: sonicNode to the network nodes export.
Ensure that packages/extension/src/providers/ethereum/networks/sonic.ts exists and exports an EvmNetwork configured with chain ID 146, RPC endpoint wss://rpc.soniclabs.com, block explorer URL https://sonicscan.org, and corresponding handlers.

Also applies to: 134-134

packages/extension/src/providers/ethereum/networks/sonic.ts (3)

1-1: Verify icon import path

'./icons/sonic.webp' assumes an icons sub-folder under networks/. A few existing network configs keep their icons one level higher (e.g. ../icons/<net>.svg). Double-check the actual location to avoid a bundler/runtime 404.


21-22: Confirm Coingecko identifiers

coingeckoID: 'sonic-3' and CoingeckoPlatform.Sonic are new. Ensure they already exist on Coingecko; otherwise price look-ups will silently fail.


25-25: Ensure Sonic is registered in Etherscan activity config

wrapActivityHandler(EtherscanActivity) will look up a base URL for NetworkNames.Sonic inside etherscan/configs.ts. If that mapping was missed, activity loading will throw at runtime. Double-check the config entry:

export const ETHERSCAN_ENDPOINTS = {
  [NetworkNames.Sonic]: 'https://api.sonicscan.org/',
  // …
};

@kvhnuke kvhnuke changed the base branch from main to devop/release-2-9 June 17, 2025 18:03
@kvhnuke kvhnuke merged commit 1ebe1e3 into enkryptcom:devop/release-2-9 Jun 17, 2025
2 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Jun 17, 2025
@coderabbitai coderabbitai bot mentioned this pull request Jul 9, 2025
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