mirror of
https://github.com/status-im/safe-react.git
synced 2025-01-10 18:15:37 +00:00
export LOADED_SAFE as a constant
This commit is contained in:
parent
c3e3abf158
commit
a9bf00c616
@ -19,6 +19,7 @@ import { latestMasterContractVersionSelector, safeTotalFiatBalanceSelector } fro
|
||||
import { getSafeInfo } from 'src/logic/safe/utils/safeInformation'
|
||||
import { getModules } from 'src/logic/safe/utils/modules'
|
||||
import { getSpendingLimits } from 'src/logic/safe/utils/spendingLimits'
|
||||
import { LOADED_SAFE_KEY } from 'src/utils/constants'
|
||||
|
||||
const buildOwnersFrom = (safeOwners: string[], localSafe?: SafeRecordProps): List<SafeOwner> => {
|
||||
const ownersList = safeOwners.map((ownerAddress) => {
|
||||
@ -159,7 +160,7 @@ export default (safeAdd: string) => async (
|
||||
): Promise<Action | void> => {
|
||||
try {
|
||||
const safeAddress = checksumAddress(safeAdd)
|
||||
const safeName = (await getSafeName(safeAddress)) || 'LOADED SAFE'
|
||||
const safeName = (await getSafeName(safeAddress)) || LOADED_SAFE_KEY
|
||||
const latestMasterContractVersion = latestMasterContractVersionSelector(getState())
|
||||
const totalFiatBalance = safeTotalFiatBalanceSelector(getState())
|
||||
const safeProps = await buildSafe(safeAddress, safeName, latestMasterContractVersion, totalFiatBalance)
|
||||
|
@ -16,6 +16,7 @@ import { checksumAddress } from 'src/utils/checksumAddress'
|
||||
import { ADD_OR_UPDATE_SAFE, buildOwnersFrom } from 'src/logic/safe/store/actions/addOrUpdateSafe'
|
||||
import { sameAddress } from 'src/logic/wallets/ethAddresses'
|
||||
import { shouldSafeStoreBeUpdated } from 'src/logic/safe/utils/shouldSafeStoreBeUpdated'
|
||||
import { LOADED_SAFE_KEY } from 'src/utils/constants'
|
||||
|
||||
export const SAFE_REDUCER_ID = 'safes'
|
||||
export const DEFAULT_SAFE_INITIAL_STATE = 'NOT_ASKED'
|
||||
@ -87,13 +88,13 @@ export default handleActions<AppReduxState['safes'], Payloads>(
|
||||
let loadedViaUrl = safe.loadedViaUrl
|
||||
|
||||
if (!state.hasIn(['safes', safeAddress])) {
|
||||
loadedViaUrl = !safe?.name || safe?.name === 'LOADED SAFE'
|
||||
loadedViaUrl = !safe?.name || safe?.name === LOADED_SAFE_KEY
|
||||
}
|
||||
|
||||
return shouldUpdate
|
||||
? state.updateIn(
|
||||
['safes', safeAddress],
|
||||
makeSafe({ name: safe?.name || 'LOADED SAFE', address: safeAddress, loadedViaUrl }),
|
||||
makeSafe({ name: safe?.name || LOADED_SAFE_KEY, address: safeAddress, loadedViaUrl }),
|
||||
(prevSafe) => updateSafeProps(prevSafe, safe),
|
||||
)
|
||||
: state
|
||||
@ -110,7 +111,7 @@ export default handleActions<AppReduxState['safes'], Payloads>(
|
||||
return shouldUpdate
|
||||
? state.updateIn(
|
||||
['safes', safeAddress],
|
||||
makeSafe({ name: safe?.name || 'LOADED SAFE', address: safeAddress, loadedViaUrl: !!safe?.name }),
|
||||
makeSafe({ name: safe?.name || LOADED_SAFE_KEY, address: safeAddress, loadedViaUrl: !!safe?.name }),
|
||||
(prevSafe) => updateSafeProps(prevSafe, safe),
|
||||
)
|
||||
: state
|
||||
|
@ -17,6 +17,7 @@ export const SQUARELINK_ID = {
|
||||
*/
|
||||
export const INFURA_TOKEN = process.env.REACT_APP_INFURA_TOKEN || ''
|
||||
export const LATEST_SAFE_VERSION = process.env.REACT_APP_LATEST_SAFE_VERSION || '1.1.1'
|
||||
export const LOADED_SAFE_KEY = 'LOADED SAFE'
|
||||
export const APP_VERSION = process.env.REACT_APP_APP_VERSION || 'not-defined'
|
||||
export const OPENSEA_API_KEY = process.env.REACT_APP_OPENSEA_API_KEY || ''
|
||||
export const COLLECTIBLES_SOURCE = process.env.REACT_APP_COLLECTIBLES_SOURCE || 'Gnosis'
|
||||
|
Loading…
x
Reference in New Issue
Block a user