Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing custom token due to mismatched case of public addresses #2361

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 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 @@ -311,8 +321,10 @@ class PreferencesController extends SafeEventEmitter {
const selectedAddress = address || this.store.getState().selectedAddress
const currentState = this.state(selectedAddress) || cloneDeep(DEFAULT_ACCOUNT_STATE)
const mergedState = deepmerge(currentState, newPartialState, { arrayMerge: overwriteMerge })
const chainId = this.network.getCurrentChainId()
const checksumAddress = toChecksumAddressByChainId(selectedAddress, chainId)
this.store.updateState({
[selectedAddress]: mergedState,
[checksumAddress]: mergedState,
})
return mergedState
}
Expand Down Expand Up @@ -784,7 +796,7 @@ class PreferencesController extends SafeEventEmitter {
normalizedAddChainParams(id, addChainParams) {
/**
* addChainParams interface
*
*
* interface AddEthereumChainParameter {
chainId: string; // A 0x-prefixed hexadecimal string
chainName: string;
Expand Down
Loading