Skip to content

Commit

Permalink
Update network typing on migration
Browse files Browse the repository at this point in the history
  • Loading branch information
gambinish committed Aug 27, 2024
1 parent 7f7e379 commit 94e304d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/scripts/migrations/128.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { NetworkConfiguration } from '@metamask/network-controller';
import { hasProperty, isObject } from '@metamask/utils';
import { cloneDeep } from 'lodash';

Expand Down Expand Up @@ -31,8 +32,15 @@ function transformState(state: Record<string, unknown>) {
hasProperty(state, 'NetworkController') &&
isObject(state.NetworkController)
) {
// type NetworkConfiguration and NetworkConfigurationId not exported from NetworkConroller.d.ts
// need for reverse lookup. typing to string
const existingNetworkConfigsCopy = state.NetworkController
.networkConfigurations as Record<string, any>;
.networkConfigurations as Record<
string,
NetworkConfiguration & {
id: string;
}
>;

Object.values(existingNetworkConfigsCopy).forEach((networkConfig) => {
if (networkConfig.ticker === 'MATIC') {
Expand Down

0 comments on commit 94e304d

Please sign in to comment.