refactor: simplify safe's fields selectors
This commit is contained in:
parent
d0d19b0b3e
commit
823fc40f7d
|
@ -167,37 +167,23 @@ export const safeBalancesSelector = createSelector(safeSelector, (safe) => {
|
||||||
return safe.balances
|
return safe.balances
|
||||||
})
|
})
|
||||||
|
|
||||||
export const safeNameSelector = createSelector(safeSelector, (safe) => {
|
export const safeFieldSelector = (field) => (safe) => safe?.[field]
|
||||||
return safe ? safe.name : undefined
|
|
||||||
})
|
|
||||||
|
|
||||||
export const safeEthBalanceSelector = createSelector(safeSelector, (safe) => {
|
export const safeNameSelector = createSelector(safeSelector, safeFieldSelector('name'))
|
||||||
return safe ? safe.ethBalance : undefined
|
|
||||||
})
|
|
||||||
|
|
||||||
export const safeNeedsUpdateSelector = createSelector(safeSelector, (safe) => {
|
export const safeEthBalanceSelector = createSelector(safeSelector, safeFieldSelector('ethBalance'))
|
||||||
return safe ? safe.needsUpdate : undefined
|
|
||||||
})
|
|
||||||
|
|
||||||
export const safeCurrentVersionSelector = createSelector(safeSelector, (safe) => {
|
export const safeNeedsUpdateSelector = createSelector(safeSelector, safeFieldSelector('needsUpdate'))
|
||||||
return safe ? safe.currentVersion : undefined
|
|
||||||
})
|
|
||||||
|
|
||||||
export const safeThresholdSelector = createSelector(safeSelector, (safe) => {
|
export const safeCurrentVersionSelector = createSelector(safeSelector, safeFieldSelector('currentVersion'))
|
||||||
return safe ? safe.threshold : undefined
|
|
||||||
})
|
|
||||||
|
|
||||||
export const safeNonceSelector = createSelector(safeSelector, (safe) => {
|
export const safeThresholdSelector = createSelector(safeSelector, safeFieldSelector('threshold'))
|
||||||
return safe ? safe.nonce : undefined
|
|
||||||
})
|
|
||||||
|
|
||||||
export const safeOwnersSelector = createSelector(safeSelector, (safe) => {
|
export const safeNonceSelector = createSelector(safeSelector, safeFieldSelector('nonce'))
|
||||||
return safe ? safe.owners : undefined
|
|
||||||
})
|
|
||||||
|
|
||||||
export const safeFeaturesEnabledSelector = createSelector(safeSelector, (safe) => {
|
export const safeOwnersSelector = createSelector(safeSelector, safeFieldSelector('owners'))
|
||||||
return safe ? safe.featuresEnabled : undefined
|
|
||||||
})
|
export const safeFeaturesEnabledSelector = createSelector(safeSelector, safeFieldSelector('featuresEnabled'))
|
||||||
|
|
||||||
export const getActiveTokensAddressesForAllSafes = createSelector(safesListSelector, (safes) => {
|
export const getActiveTokensAddressesForAllSafes = createSelector(safesListSelector, (safes) => {
|
||||||
const addresses = Set().withMutations((set) => {
|
const addresses = Set().withMutations((set) => {
|
||||||
|
|
Loading…
Reference in New Issue