@@ -5,7 +5,6 @@ import { Module, NetworkVMType } from '@avalabs/vm-module-types';
55
66import type { ModuleManager } from '@src/background/vmModules/ModuleManager' ;
77import { PickKeys } from '@src/background/models' ;
8- import { isDevnet } from '@src/utils/isDevnet' ;
98import { CommonError , SecretsError } from '@src/utils/errors' ;
109import { assertPresent } from '@src/utils/assertions' ;
1110
@@ -29,43 +28,7 @@ export class AddressResolver {
2928 }
3029
3130 async #getNetworksForAddressDerivation( ) : Promise < NetworkWithCaipId [ ] > {
32- const allNetworksForEnv = Object . values (
33- await this . networkService . activeNetworks . promisify ( ) ,
34- ) ;
35-
36- /**
37- * In some instances (like X- and P-Chain), we may get two conflicting networks
38- * in the test environment (e.g. both Fuji P-Chain, and Devnet P-Chain).
39- *
40- * The two variants would result in conflicting addresses, so we need to filter
41- * one of them out, based on whichever is active.
42- *
43- * TODO: find a nicer way to do it. Ideas:
44- * 1) have a 3rd environment (mainnet / testnet / devnet)
45- * 2) have separate NetworkVMType for testnets & devnets
46- * 3) in the AccountService, do not segregate addresses by NetworkVMType,
47- * but rather by CAIP-2 ids (whole ID or just namespace and then choose the more specific one)
48- */
49- const isDevnetOnTheList = allNetworksForEnv . some ( isDevnet ) ;
50-
51- if ( ! isDevnetOnTheList ) {
52- return allNetworksForEnv ;
53- }
54-
55- const isDevnetActive = this . networkService . uiActiveNetwork
56- ? isDevnet ( this . networkService . uiActiveNetwork )
57- : false ;
58-
59- return allNetworksForEnv . filter ( ( network ) => {
60- if (
61- network . vmName !== NetworkVMType . AVM &&
62- network . vmName !== NetworkVMType . PVM
63- ) {
64- return true ;
65- }
66-
67- return isDevnetActive ? isDevnet ( network ) : true ;
68- } ) ;
31+ return Object . values ( await this . networkService . activeNetworks . promisify ( ) ) ;
6932 }
7033
7134 async getDerivationPathsByVM < VMs extends ( keyof DerivationPathsMap ) [ ] > (
0 commit comments