Add Sonic network support#714
Conversation
Release: v2.8.0
…bs.com, block explorer sonicscan.org, with full activity/asset/NFT handler integration
WalkthroughSupport 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
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
Possibly related PRs
Suggested reviewers
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/extension/src/providers/ethereum/networks/sonic.ts (1)
19-20: Provide an HTTPS fallback RPCOnly 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
📒 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 ofSonic = "SONIC"aligns with PR objective to support the Sonic network.
159-159: Add Sonic to CoingeckoPlatform enum
MappingSonic = "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
ThesupportedNetworksmapping now includesNetworkNames.SonicwithtbName: 'sonic'andcgPlatform: CoingeckoPlatform.Sonic.packages/extension/src/providers/ethereum/libs/assets-handlers/types/tokenbalance-mew.ts (1)
56-56: Extend SupportedNetworkNames with Sonic
IncludingNetworkNames.Sonicensures 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
AddedNetworkNames.Sonic→'https://api.sonicscan.org/'toNetworkEndpointsfor activity handling.packages/extension/src/providers/ethereum/networks/index.ts (1)
44-44: Integrate Sonic network node
ImportedsonicNodeand addedsonic: sonicNodeto the network nodes export.
Ensure thatpackages/extension/src/providers/ethereum/networks/sonic.tsexists and exports anEvmNetworkconfigured with chain ID146, RPC endpointwss://rpc.soniclabs.com, block explorer URLhttps://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 aniconssub-folder undernetworks/. 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'andCoingeckoPlatform.Sonicare 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 forNetworkNames.Sonicinsideetherscan/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/', // … };
Summary
This PR adds support for the Sonic blockchain network to Enkrypt.
Changes Made
Network Details
Testing
Summary by CodeRabbit