Skip to content

Commit

Permalink
Merge pull request #2364 from torusresearch/develop
Browse files Browse the repository at this point in the history
Release v4.0.2
  • Loading branch information
chaitanyapotti authored Oct 9, 2023
2 parents 158a986 + 4100700 commit 3b3a8d9
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/controllers/PreferencesController.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,17 @@ import {
} from '../utils/enums'
import { notifyUser } from '../utils/notifications'
import { setSentryEnabled } from '../utils/sentry'
import { formatDate, formatPastTx, formatTime, getEthTxStatus, getIFrameOrigin, getUserLanguage, isMain, waitForMs } from '../utils/utils'
import {
formatDate,
formatPastTx,
formatTime,
getEthTxStatus,
getIFrameOrigin,
getUserLanguage,
isMain,
toChecksumAddressByChainId,
waitForMs,
} from '../utils/utils'
import { ObservableStore } from './utils/ObservableStore'
import { isErrorObject, prettyPrintData } from './utils/permissionUtils'

Expand Down Expand Up @@ -217,6 +227,11 @@ class PreferencesController extends SafeEventEmitter {
customNetworks,
} = user.data || {}

// transform addresses that were saved as lowercase in our db
const chainId = this.network.getCurrentChainId()
const publicAddress = toChecksumAddressByChainId(public_address, chainId)
const defaultPublicAddress = toChecksumAddressByChainId(default_public_address) || publicAddress

this.updateStore(
{
contacts,
Expand All @@ -226,11 +241,11 @@ class PreferencesController extends SafeEventEmitter {
locale: locale || getUserLanguage(),
permissions,
accountType: account_type || ACCOUNT_TYPE.NORMAL,
defaultPublicAddress: default_public_address || public_address,
defaultPublicAddress,
customTokens,
customNfts,
},
public_address
publicAddress
)

// update network controller with all the custom network updates.
Expand Down Expand Up @@ -784,7 +799,7 @@ class PreferencesController extends SafeEventEmitter {
normalizedAddChainParams(id, addChainParams) {
/**
* addChainParams interface
*
*
* interface AddEthereumChainParameter {
chainId: string; // A 0x-prefixed hexadecimal string
chainName: string;
Expand Down

0 comments on commit 3b3a8d9

Please sign in to comment.