(Fix) Lowercased safes address in URL (#631)
* Return checksummed addrress from `safeParamAddressFromState` selector * Update `yarn.lock` * Remove redundant `toChecksumAddress` call Co-authored-by: Mikhail Mikheev <mmvsha73@gmail.com>
This commit is contained in:
parent
558b9f69f7
commit
30cbada633
|
@ -111,10 +111,15 @@ export const safeCancellationTransactionsSelector: TxSelectorType = createSelect
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
export const safeParamAddressFromStateSelector = (state: GlobalState): string => {
|
export const safeParamAddressFromStateSelector = (state: GlobalState): string | null => {
|
||||||
const match = matchPath(state.router.location.pathname, { path: `${SAFELIST_ADDRESS}/:safeAddress` })
|
const match = matchPath(state.router.location.pathname, { path: `${SAFELIST_ADDRESS}/:safeAddress` })
|
||||||
|
|
||||||
return match ? match.params.safeAddress : null
|
if (match) {
|
||||||
|
const web3 = getWeb3()
|
||||||
|
return web3.utils.toChecksumAddress(match.params.safeAddress)
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
type IncomingTxSelectorType = OutputSelector<GlobalState, RouterProps, List<IncomingTransaction>>
|
type IncomingTxSelectorType = OutputSelector<GlobalState, RouterProps, List<IncomingTransaction>>
|
||||||
|
@ -156,14 +161,12 @@ export type SafeSelectorProps = Safe | typeof undefined
|
||||||
export const safeSelector: OutputSelector<GlobalState, RouterProps, SafeSelectorProps> = createSelector(
|
export const safeSelector: OutputSelector<GlobalState, RouterProps, SafeSelectorProps> = createSelector(
|
||||||
safesMapSelector,
|
safesMapSelector,
|
||||||
safeParamAddressFromStateSelector,
|
safeParamAddressFromStateSelector,
|
||||||
(safes: Map<string, Safe>, address: string) => {
|
(safes: Map<string, Safe>, address: string | null) => {
|
||||||
if (!address) {
|
if (!address) {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
const checksumed = getWeb3().utils.toChecksumAddress(address)
|
|
||||||
const safe = safes.get(checksumed)
|
|
||||||
|
|
||||||
return safe
|
return safes.get(address)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ const finalCreateStore = composeEnhancers(
|
||||||
|
|
||||||
export type GlobalState = {
|
export type GlobalState = {
|
||||||
providers: ProviderState,
|
providers: ProviderState,
|
||||||
|
router: RouterHistory,
|
||||||
safes: SafeState,
|
safes: SafeState,
|
||||||
tokens: TokensState,
|
tokens: TokensState,
|
||||||
transactions: TransactionsState,
|
transactions: TransactionsState,
|
||||||
|
|
Loading…
Reference in New Issue