From b715dfa8b8f32f40b425ee3ee666b675f6908a0a Mon Sep 17 00:00:00 2001 From: salimtb Date: Wed, 14 Jan 2026 15:34:48 +0100 Subject: [PATCH 1/4] fix: clean up slip 44 service --- .../src/NetworkEnablementController.test.ts | 56 ++++---- .../src/NetworkEnablementController.ts | 52 +++----- .../src/index.ts | 7 +- .../src/services/Slip44Service.test.ts | 125 +++++------------- .../src/services/Slip44Service.ts | 60 ++++----- .../src/services/index.ts | 8 +- 6 files changed, 105 insertions(+), 203 deletions(-) diff --git a/packages/network-enablement-controller/src/NetworkEnablementController.test.ts b/packages/network-enablement-controller/src/NetworkEnablementController.test.ts index 18b92a0826a..51b1fb3ceaa 100644 --- a/packages/network-enablement-controller/src/NetworkEnablementController.test.ts +++ b/packages/network-enablement-controller/src/NetworkEnablementController.test.ts @@ -24,31 +24,18 @@ import type { import { Slip44Service } from './services'; import { advanceTime } from '../../../tests/helpers'; -// Mock Slip44Service.getSlip44ByChainId to avoid network calls -jest - .spyOn(Slip44Service, 'getSlip44ByChainId') - .mockImplementation(async (chainId: number, symbol?: string) => { - // Known chainId mappings from chainid.network - const chainIdToSlip44: Record = { - 1: 60, // Ethereum - 10: 60, // Optimism - 56: 714, // BNB Chain - 137: 966, // Polygon - 43114: 9000, // Avalanche - 42161: 60, // Arbitrum - 8453: 60, // Base - 59144: 60, // Linea - 1329: 60, // Sei (uses ETH as native) - }; - if (chainIdToSlip44[chainId] !== undefined) { - return chainIdToSlip44[chainId]; - } - // Fall back to symbol lookup if chainId not found - if (symbol) { - return Slip44Service.getSlip44BySymbol(symbol); - } - return undefined; - }); +// Known chainId mappings from chainid.network for mocking +const chainIdToSlip44: Record = { + 1: 60, // Ethereum + 10: 60, // Optimism + 56: 714, // BNB Chain + 137: 966, // Polygon + 43114: 9000, // Avalanche + 42161: 60, // Arbitrum + 8453: 60, // Base + 59144: 60, // Linea + 1329: 60, // Sei (uses ETH as native) +}; const controllerName = 'NetworkEnablementController'; @@ -159,10 +146,17 @@ describe('NetworkEnablementController', () => { beforeEach(() => { clock = useFakeTimers(); + // Mock Slip44Service.getEvmSlip44 to avoid network calls + jest + .spyOn(Slip44Service, 'getEvmSlip44') + .mockImplementation(async (chainId) => { + return chainIdToSlip44[chainId] ?? 60; + }); }); afterEach(() => { clock.restore(); + jest.restoreAllMocks(); }); it('initializes with default state', () => { @@ -1585,7 +1579,7 @@ describe('NetworkEnablementController', () => { }, nativeAssetIdentifiers: { ...getDefaultNativeAssetIdentifiers(), - 'eip155:2': 'eip155:2/slip44:966', // MATIC + 'eip155:2': 'eip155:2/slip44:60', // Defaults to 60 as chainId 2 is not in chainid.network }, }); @@ -1623,7 +1617,7 @@ describe('NetworkEnablementController', () => { }, nativeAssetIdentifiers: { ...getDefaultNativeAssetIdentifiers(), - 'eip155:2': 'eip155:2/slip44:966', // MATIC + 'eip155:2': 'eip155:2/slip44:60', // Defaults to 60 as chainId 2 is not in chainid.network }, }); @@ -1661,7 +1655,7 @@ describe('NetworkEnablementController', () => { }, nativeAssetIdentifiers: { ...getDefaultNativeAssetIdentifiers(), - 'eip155:2': 'eip155:2/slip44:966', // MATIC + 'eip155:2': 'eip155:2/slip44:60', // Defaults to 60 as chainId 2 is not in chainid.network }, }); }); @@ -1805,8 +1799,10 @@ describe('NetworkEnablementController', () => { }, nativeAssetIdentifiers: { ...getDefaultNativeAssetIdentifiers(), + // Note: This is testing invalid input (non-EVM chainId to EVM event handler) + // getEvmSlip44 defaults to 60 for unknown chainIds 'bip122:000000000019d6689c085ae165831e93': - 'bip122:000000000019d6689c085ae165831e93/slip44:0', // BTC + 'bip122:000000000019d6689c085ae165831e93/slip44:60', }, }); }); @@ -3017,4 +3013,4 @@ describe('NetworkEnablementController', () => { expect(controller.isNetworkEnabled('0x2105')).toBe(false); }); }); -}); +}); \ No newline at end of file diff --git a/packages/network-enablement-controller/src/NetworkEnablementController.ts b/packages/network-enablement-controller/src/NetworkEnablementController.ts index fe549aa0d38..894a81f9f7d 100644 --- a/packages/network-enablement-controller/src/NetworkEnablementController.ts +++ b/packages/network-enablement-controller/src/NetworkEnablementController.ts @@ -240,13 +240,10 @@ export class NetworkEnablementController extends BaseController< }, }); - messenger.subscribe( - 'NetworkController:networkAdded', - ({ chainId, nativeCurrency }) => { - // eslint-disable-next-line no-void - void this.#onAddNetwork(chainId, nativeCurrency); - }, - ); + messenger.subscribe('NetworkController:networkAdded', ({ chainId }) => { + // eslint-disable-next-line no-void + void this.#onAddNetwork(chainId); + }); messenger.subscribe('NetworkController:networkRemoved', ({ chainId }) => { this.#removeNetworkEntry(chainId); @@ -449,7 +446,7 @@ export class NetworkEnablementController extends BaseController< identifier: NativeAssetIdentifier; }[] = []; - for (const [chainId, config] of Object.entries( + for (const [chainId] of Object.entries( networkControllerState.networkConfigurationsByChainId, )) { const { caipChainId } = deriveKeys(chainId as Hex); @@ -462,13 +459,9 @@ export class NetworkEnablementController extends BaseController< // Parse hex chainId to number for chainid.network lookup const numericChainId = parseInt(chainId, 16); - // EVM networks: use getSlip44ByChainId (chainid.network data) - // Default to 60 (Ethereum) if no specific mapping is found - const slip44CoinType = - (await Slip44Service.getSlip44ByChainId( - numericChainId, - config.nativeCurrency, - )) ?? 60; + // EVM networks: use getEvmSlip44 (chainid.network data) + // Defaults to 60 (Ethereum) if no specific mapping is found + const slip44CoinType = await Slip44Service.getEvmSlip44(numericChainId); evmNativeAssetUpdates.push({ caipChainId, @@ -553,14 +546,10 @@ export class NetworkEnablementController extends BaseController< let slip44CoinType: number | undefined; if (namespace === 'eip155') { - // EVM networks: use getSlip44ByChainId (chainid.network data) - // Default to 60 (Ethereum) if no specific mapping is found + // EVM networks: use getEvmSlip44 (chainid.network data) + // Defaults to 60 (Ethereum) if no specific mapping is found const numericChainId = parseInt(reference, 10); - slip44CoinType = - (await Slip44Service.getSlip44ByChainId( - numericChainId, - nativeCurrency, - )) ?? 60; + slip44CoinType = await Slip44Service.getEvmSlip44(numericChainId); } else { // Non-EVM networks: use getSlip44BySymbol (@metamask/slip44 package) slip44CoinType = Slip44Service.getSlip44BySymbol(nativeCurrency); @@ -708,7 +697,6 @@ export class NetworkEnablementController extends BaseController< * Handles the addition of a new EVM network to the controller. * * @param chainId - The chain ID to add (Hex format) - * @param nativeCurrency - The native currency symbol of the network (e.g., 'ETH') * * @description * - If in popular networks mode (>2 popular networks enabled) AND adding a popular network: @@ -717,20 +705,16 @@ export class NetworkEnablementController extends BaseController< * - Switch to the newly added network (disable all others, enable this one) * - Also updates the nativeAssetIdentifiers with the CAIP-19-like identifier */ - async #onAddNetwork(chainId: Hex, nativeCurrency: string): Promise { + async #onAddNetwork(chainId: Hex): Promise { const { namespace, storageKey, reference, caipChainId } = deriveKeys(chainId); - // Parse hex chainId to number for chainid.network lookup - const numericChainId = parseInt(reference, 16); + // Parse reference (decimal string from CAIP-2) to number for chainid.network lookup + const numericChainId = parseInt(reference, 10); - // EVM networks: use getSlip44ByChainId (chainid.network data) - // Default to 60 (Ethereum) if no specific mapping is found - const slip44CoinType = - (await Slip44Service.getSlip44ByChainId( - numericChainId, - nativeCurrency, - )) ?? 60; + // EVM networks: use getEvmSlip44 (chainid.network data) + // Defaults to 60 (Ethereum) if no specific mapping is found + const slip44CoinType = await Slip44Service.getEvmSlip44(numericChainId); this.update((state) => { // Ensure the namespace bucket exists @@ -767,4 +751,4 @@ export class NetworkEnablementController extends BaseController< ); }); } -} +} \ No newline at end of file diff --git a/packages/network-enablement-controller/src/index.ts b/packages/network-enablement-controller/src/index.ts index e998a911b64..fd48ddfb3cc 100644 --- a/packages/network-enablement-controller/src/index.ts +++ b/packages/network-enablement-controller/src/index.ts @@ -21,9 +21,4 @@ export { selectEnabledSolanaNetworks, } from './selectors'; -export { - Slip44Service, - getSlip44BySymbol, - getSlip44ByChainId, -} from './services'; -export type { Slip44Entry } from './services'; +export { Slip44Service, getEvmSlip44, getSlip44BySymbol } from './services'; diff --git a/packages/network-enablement-controller/src/services/Slip44Service.test.ts b/packages/network-enablement-controller/src/services/Slip44Service.test.ts index 68659f09997..fab63a5b132 100644 --- a/packages/network-enablement-controller/src/services/Slip44Service.test.ts +++ b/packages/network-enablement-controller/src/services/Slip44Service.test.ts @@ -89,45 +89,6 @@ describe('Slip44Service', () => { }); }); - describe('getSlip44Entry', () => { - it('returns entry for ETH coin type 60', () => { - const result = Slip44Service.getSlip44Entry(60); - - expect(result).toBeDefined(); - expect(result?.symbol).toBe('ETH'); - expect(result?.name).toBe('Ethereum'); - expect(result?.index).toBe('60'); - }); - - it('returns entry for BTC coin type 0', () => { - const result = Slip44Service.getSlip44Entry(0); - - expect(result).toBeDefined(); - expect(result?.symbol).toBe('BTC'); - expect(result?.name).toBe('Bitcoin'); - expect(result?.index).toBe('0'); - }); - - it('returns entry for SOL coin type 501', () => { - const result = Slip44Service.getSlip44Entry(501); - - expect(result).toBeDefined(); - expect(result?.symbol).toBe('SOL'); - expect(result?.name).toBe('Solana'); - expect(result?.index).toBe('501'); - }); - - it('returns undefined for non-existent coin type', () => { - const result = Slip44Service.getSlip44Entry(999999999); - expect(result).toBeUndefined(); - }); - - it('returns undefined for negative coin type', () => { - const result = Slip44Service.getSlip44Entry(-1); - expect(result).toBeUndefined(); - }); - }); - describe('clearCache', () => { it('clears the cache so lookups are performed again', () => { // Perform initial lookup to populate cache @@ -173,7 +134,7 @@ describe('Slip44Service', () => { }); }); - describe('getSlip44ByChainId', () => { + describe('getEvmSlip44', () => { it('returns slip44 from chainid.network data when available', async () => { // Mock chainid.network response with Ethereum data mockFetchWithErrorHandling.mockResolvedValueOnce([ @@ -181,7 +142,7 @@ describe('Slip44Service', () => { { chainId: 56, slip44: 714 }, ]); - const result = await Slip44Service.getSlip44ByChainId(1); + const result = await Slip44Service.getEvmSlip44(1); expect(result).toBe(60); expect(mockFetchWithErrorHandling).toHaveBeenCalledWith({ @@ -198,9 +159,9 @@ describe('Slip44Service', () => { ]); // First call - fetches data - const result1 = await Slip44Service.getSlip44ByChainId(1); + const result1 = await Slip44Service.getEvmSlip44(1); // Second call - should use cache (line 144) - const result2 = await Slip44Service.getSlip44ByChainId(56); + const result2 = await Slip44Service.getEvmSlip44(56); expect(result1).toBe(60); expect(result2).toBe(714); @@ -221,9 +182,9 @@ describe('Slip44Service', () => { // Make concurrent calls const [result1, result2, result3] = await Promise.all([ - Slip44Service.getSlip44ByChainId(1), - Slip44Service.getSlip44ByChainId(1), - Slip44Service.getSlip44ByChainId(1), + Slip44Service.getEvmSlip44(1), + Slip44Service.getEvmSlip44(1), + Slip44Service.getEvmSlip44(1), ]); expect(result1).toBe(60); @@ -233,75 +194,51 @@ describe('Slip44Service', () => { expect(mockFetchWithErrorHandling).toHaveBeenCalledTimes(1); }); - it('falls back to symbol lookup when chainId not found in cache', async () => { + it('defaults to 60 when chainId not found in cache', async () => { // Mock chainid.network response without the requested chainId mockFetchWithErrorHandling.mockResolvedValueOnce([ { chainId: 1, slip44: 60 }, ]); - // Request a chainId not in the response, but provide a symbol - const result = await Slip44Service.getSlip44ByChainId(999, 'ETH'); - - expect(result).toBe(60); // Falls back to symbol lookup - }); - - it('returns undefined when chainId not found and no symbol provided (line 152)', async () => { - // Mock chainid.network response - mockFetchWithErrorHandling.mockResolvedValueOnce([ - { chainId: 1, slip44: 60 }, - ]); - - // Request a chainId not in the response, without symbol - const result = await Slip44Service.getSlip44ByChainId(999); + // Request a chainId not in the response + const result = await Slip44Service.getEvmSlip44(999); - expect(result).toBeUndefined(); + expect(result).toBe(60); // Defaults to 60 (Ethereum) }); - it('handles invalid response by initializing empty cache (lines 102-104)', async () => { + it('handles invalid response by initializing empty cache and defaults to 60', async () => { // Mock invalid response (not an array) mockFetchWithErrorHandling.mockResolvedValueOnce('invalid response'); - // Should not throw, but return undefined - const result = await Slip44Service.getSlip44ByChainId(1); + // Should not throw, defaults to 60 + const result = await Slip44Service.getEvmSlip44(1); - expect(result).toBeUndefined(); + expect(result).toBe(60); }); - it('handles null response by initializing empty cache', async () => { + it('handles null response by initializing empty cache and defaults to 60', async () => { // Mock null response mockFetchWithErrorHandling.mockResolvedValueOnce(null); - // Should not throw, but return undefined - const result = await Slip44Service.getSlip44ByChainId(1); - - expect(result).toBeUndefined(); - }); + // Should not throw, defaults to 60 + const result = await Slip44Service.getEvmSlip44(1); - it('handles network error by initializing empty cache and falling back to symbol', async () => { - // Mock network error - mockFetchWithErrorHandling.mockRejectedValueOnce( - new Error('Network error'), - ); - - // Should not throw, but fall back to symbol lookup - const result = await Slip44Service.getSlip44ByChainId(1, 'ETH'); - - expect(result).toBe(60); // Falls back to symbol lookup + expect(result).toBe(60); }); - it('handles network error and returns undefined when no symbol provided', async () => { + it('handles network error by initializing empty cache and defaults to 60', async () => { // Mock network error mockFetchWithErrorHandling.mockRejectedValueOnce( new Error('Network error'), ); - // Should not throw, return undefined when no symbol - const result = await Slip44Service.getSlip44ByChainId(1); + // Should not throw, defaults to 60 + const result = await Slip44Service.getEvmSlip44(1); - expect(result).toBeUndefined(); + expect(result).toBe(60); }); - it('filters out entries without slip44 field', async () => { + it('filters out entries without slip44 field and defaults to 60', async () => { // Mock response with some entries missing slip44 mockFetchWithErrorHandling.mockResolvedValueOnce([ { chainId: 1, slip44: 60 }, @@ -310,15 +247,15 @@ describe('Slip44Service', () => { { chainId: 56, slip44: 714 }, ]); - const result1 = await Slip44Service.getSlip44ByChainId(1); - const result2 = await Slip44Service.getSlip44ByChainId(2); - const result3 = await Slip44Service.getSlip44ByChainId(3); - const result56 = await Slip44Service.getSlip44ByChainId(56); + const result1 = await Slip44Service.getEvmSlip44(1); + const result2 = await Slip44Service.getEvmSlip44(2); + const result3 = await Slip44Service.getEvmSlip44(3); + const result56 = await Slip44Service.getEvmSlip44(56); expect(result1).toBe(60); - expect(result2).toBeUndefined(); // Not in cache - expect(result3).toBeUndefined(); // Not in cache + expect(result2).toBe(60); // Not in cache, defaults to 60 + expect(result3).toBe(60); // Not in cache, defaults to 60 expect(result56).toBe(714); }); }); -}); +}); \ No newline at end of file diff --git a/packages/network-enablement-controller/src/services/Slip44Service.ts b/packages/network-enablement-controller/src/services/Slip44Service.ts index 0655405eafc..c5d0087502d 100644 --- a/packages/network-enablement-controller/src/services/Slip44Service.ts +++ b/packages/network-enablement-controller/src/services/Slip44Service.ts @@ -44,7 +44,7 @@ type Slip44Data = Record; * SLIP-44 defines registered coin types used in BIP-44 derivation paths. * * This service provides two lookup methods: - * 1. `getSlip44ByChainId` - Primary method using chainid.network data (recommended) + * 1. `getEvmSlip44` - For EVM networks, uses chainid.network data (recommended for eip155) * 2. `getSlip44BySymbol` - Fallback method using @metamask/slip44 package * * @see https://github.com/satoshilabs/slips/blob/master/slip-0044.md @@ -69,7 +69,7 @@ export class Slip44Service { /** * Fetches and caches chain data from chainid.network. - * This is called automatically by getSlip44ByChainId. + * This is called automatically by getEvmSlip44. */ static async #fetchChainData(): Promise { if (this.#chainIdCache !== null) { @@ -114,27 +114,30 @@ export class Slip44Service { } /** - * Gets the SLIP-44 coin type identifier for a given EVM chain ID. + * Gets the SLIP-44 coin type identifier for an EVM network by chain ID. * - * This method first checks chainid.network data (which maps chainId directly - * to slip44), then falls back to symbol lookup if not found. + * **IMPORTANT: This method is for EVM networks only (eip155 namespace).** + * For non-EVM networks (Bitcoin, Solana, Tron, etc.), use `getSlip44BySymbol`. * - * @param chainId - The EVM chain ID (e.g., 1 for Ethereum, 56 for BNB Chain) - * @param symbol - Optional symbol for fallback lookup (e.g., 'ETH', 'BNB') - * @returns The SLIP-44 coin type number, or undefined if not found + * This method checks chainid.network data (which maps chainId directly + * to slip44). If not found, defaults to 60 (Ethereum). + * + * @param chainId - The EVM chain ID as a number (e.g., 1 for Ethereum, 56 for BNB Chain) + * @returns The SLIP-44 coin type number (defaults to 60 if not found) * @example * ```typescript - * const ethCoinType = await Slip44Service.getSlip44ByChainId(1); + * // For EVM networks only + * const ethCoinType = await Slip44Service.getEvmSlip44(1); * // Returns 60 * - * const bnbCoinType = await Slip44Service.getSlip44ByChainId(56); + * const bnbCoinType = await Slip44Service.getEvmSlip44(56); * // Returns 714 + * + * const unknownEvmChain = await Slip44Service.getEvmSlip44(99999); + * // Returns 60 (default for EVM) * ``` */ - static async getSlip44ByChainId( - chainId: number, - symbol?: string, - ): Promise { + static async getEvmSlip44(chainId: number): Promise { // Ensure chain data is loaded await this.#fetchChainData(); @@ -144,20 +147,18 @@ export class Slip44Service { return cached; } - // Fall back to symbol lookup if provided - if (symbol) { - return this.getSlip44BySymbol(symbol); - } - - return undefined; + // Default to 60 (Ethereum) for EVM networks without specific mapping + return 60; } /** - * Gets the SLIP-44 coin type identifier for a given network symbol. + * Gets the SLIP-44 coin type identifier for a non-EVM network by symbol. + * + * **IMPORTANT: This method is for non-EVM networks only (Bitcoin, Solana, Tron, etc.).** + * For EVM networks (eip155 namespace), use `getEvmSlip44` instead. * * Note: Symbol lookup may return incorrect results for duplicate symbols - * (e.g., CPC is both CPChain and Capricoin). For EVM networks, prefer - * using getSlip44ByChainId instead. + * (e.g., CPC is both CPChain and Capricoin). * * @param symbol - The network symbol (e.g., 'ETH', 'BTC', 'SOL') * @returns The SLIP-44 coin type number, or undefined if not found @@ -197,17 +198,6 @@ export class Slip44Service { return undefined; } - /** - * Gets the SLIP-44 entry for a given coin type index. - * - * @param index - The SLIP-44 coin type index (e.g., 60 for ETH, 0 for BTC) - * @returns The SLIP-44 entry with metadata, or undefined if not found - */ - static getSlip44Entry(index: number): Slip44Entry | undefined { - const slip44Data = slip44 as Slip44Data; - return slip44Data[index.toString()]; - } - /** * Clears all internal caches. * Useful for testing or if the underlying data might change. @@ -217,4 +207,4 @@ export class Slip44Service { this.#chainIdCache = null; this.#fetchPromise = null; } -} +} \ No newline at end of file diff --git a/packages/network-enablement-controller/src/services/index.ts b/packages/network-enablement-controller/src/services/index.ts index 683cb976dbd..b6bfd00a152 100644 --- a/packages/network-enablement-controller/src/services/index.ts +++ b/packages/network-enablement-controller/src/services/index.ts @@ -1,10 +1,10 @@ import { Slip44Service } from './Slip44Service'; export { Slip44Service }; -export type { Slip44Entry } from './Slip44Service'; // Re-export static methods as standalone functions for convenience +// getEvmSlip44: For EVM networks (eip155) - uses chainId lookup, defaults to 60 +export const getEvmSlip44 = Slip44Service.getEvmSlip44.bind(Slip44Service); +// getSlip44BySymbol: For non-EVM networks (Bitcoin, Solana, Tron) - uses symbol lookup export const getSlip44BySymbol = - Slip44Service.getSlip44BySymbol.bind(Slip44Service); -export const getSlip44ByChainId = - Slip44Service.getSlip44ByChainId.bind(Slip44Service); + Slip44Service.getSlip44BySymbol.bind(Slip44Service); \ No newline at end of file From e368883797c1df843c538b56cd2513a69c56d087 Mon Sep 17 00:00:00 2001 From: salimtb Date: Wed, 14 Jan 2026 15:37:41 +0100 Subject: [PATCH 2/4] fix: add changelog --- packages/network-enablement-controller/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/network-enablement-controller/CHANGELOG.md b/packages/network-enablement-controller/CHANGELOG.md index 0b13c45f148..ed387dd5673 100644 --- a/packages/network-enablement-controller/CHANGELOG.md +++ b/packages/network-enablement-controller/CHANGELOG.md @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Clean up Slip44Service ([#7626](https://github.com/MetaMask/core/pull/7626)) - Add missing MegaETH to POPULARE_NETWORKS list ([#7286](https://github.com/MetaMask/core/pull/7286)) ## [4.0.0] From 3777564041b0369b303d9b05ca1e91530a670aa5 Mon Sep 17 00:00:00 2001 From: salimtb Date: Wed, 14 Jan 2026 15:44:37 +0100 Subject: [PATCH 3/4] fix: fix linter --- .../src/NetworkEnablementController.test.ts | 2 +- .../src/NetworkEnablementController.ts | 2 +- .../src/services/Slip44Service.test.ts | 2 +- .../network-enablement-controller/src/services/Slip44Service.ts | 2 +- packages/network-enablement-controller/src/services/index.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/network-enablement-controller/src/NetworkEnablementController.test.ts b/packages/network-enablement-controller/src/NetworkEnablementController.test.ts index 51b1fb3ceaa..00ba58fccaa 100644 --- a/packages/network-enablement-controller/src/NetworkEnablementController.test.ts +++ b/packages/network-enablement-controller/src/NetworkEnablementController.test.ts @@ -3013,4 +3013,4 @@ describe('NetworkEnablementController', () => { expect(controller.isNetworkEnabled('0x2105')).toBe(false); }); }); -}); \ No newline at end of file +}); diff --git a/packages/network-enablement-controller/src/NetworkEnablementController.ts b/packages/network-enablement-controller/src/NetworkEnablementController.ts index 894a81f9f7d..bfbd845662d 100644 --- a/packages/network-enablement-controller/src/NetworkEnablementController.ts +++ b/packages/network-enablement-controller/src/NetworkEnablementController.ts @@ -751,4 +751,4 @@ export class NetworkEnablementController extends BaseController< ); }); } -} \ No newline at end of file +} diff --git a/packages/network-enablement-controller/src/services/Slip44Service.test.ts b/packages/network-enablement-controller/src/services/Slip44Service.test.ts index fab63a5b132..54588947ec5 100644 --- a/packages/network-enablement-controller/src/services/Slip44Service.test.ts +++ b/packages/network-enablement-controller/src/services/Slip44Service.test.ts @@ -258,4 +258,4 @@ describe('Slip44Service', () => { expect(result56).toBe(714); }); }); -}); \ No newline at end of file +}); diff --git a/packages/network-enablement-controller/src/services/Slip44Service.ts b/packages/network-enablement-controller/src/services/Slip44Service.ts index c5d0087502d..9c3ea2a8b3a 100644 --- a/packages/network-enablement-controller/src/services/Slip44Service.ts +++ b/packages/network-enablement-controller/src/services/Slip44Service.ts @@ -207,4 +207,4 @@ export class Slip44Service { this.#chainIdCache = null; this.#fetchPromise = null; } -} \ No newline at end of file +} diff --git a/packages/network-enablement-controller/src/services/index.ts b/packages/network-enablement-controller/src/services/index.ts index b6bfd00a152..5d87168f7ff 100644 --- a/packages/network-enablement-controller/src/services/index.ts +++ b/packages/network-enablement-controller/src/services/index.ts @@ -7,4 +7,4 @@ export { Slip44Service }; export const getEvmSlip44 = Slip44Service.getEvmSlip44.bind(Slip44Service); // getSlip44BySymbol: For non-EVM networks (Bitcoin, Solana, Tron) - uses symbol lookup export const getSlip44BySymbol = - Slip44Service.getSlip44BySymbol.bind(Slip44Service); \ No newline at end of file + Slip44Service.getSlip44BySymbol.bind(Slip44Service); From 47cfb4e3cd811abb115b1890257b393f0652dbfc Mon Sep 17 00:00:00 2001 From: salimtb Date: Wed, 14 Jan 2026 15:45:21 +0100 Subject: [PATCH 4/4] fix: fix PR comments --- .../src/NetworkEnablementController.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/network-enablement-controller/src/NetworkEnablementController.ts b/packages/network-enablement-controller/src/NetworkEnablementController.ts index bfbd845662d..dcbaac6fd36 100644 --- a/packages/network-enablement-controller/src/NetworkEnablementController.ts +++ b/packages/network-enablement-controller/src/NetworkEnablementController.ts @@ -460,7 +460,6 @@ export class NetworkEnablementController extends BaseController< const numericChainId = parseInt(chainId, 16); // EVM networks: use getEvmSlip44 (chainid.network data) - // Defaults to 60 (Ethereum) if no specific mapping is found const slip44CoinType = await Slip44Service.getEvmSlip44(numericChainId); evmNativeAssetUpdates.push({ @@ -547,7 +546,6 @@ export class NetworkEnablementController extends BaseController< if (namespace === 'eip155') { // EVM networks: use getEvmSlip44 (chainid.network data) - // Defaults to 60 (Ethereum) if no specific mapping is found const numericChainId = parseInt(reference, 10); slip44CoinType = await Slip44Service.getEvmSlip44(numericChainId); } else { @@ -713,7 +711,6 @@ export class NetworkEnablementController extends BaseController< const numericChainId = parseInt(reference, 10); // EVM networks: use getEvmSlip44 (chainid.network data) - // Defaults to 60 (Ethereum) if no specific mapping is found const slip44CoinType = await Slip44Service.getEvmSlip44(numericChainId); this.update((state) => {