Replaces addSafeModules with updateSafe
This commit is contained in:
parent
2f688a2488
commit
c12774205c
|
@ -15,7 +15,6 @@ import { makeOwner } from 'src/routes/safe/store/models/owner'
|
||||||
import { checksumAddress } from 'src/utils/checksumAddress'
|
import { checksumAddress } from 'src/utils/checksumAddress'
|
||||||
import { ModulePair, SafeOwner } from 'src/routes/safe/store/models/safe'
|
import { ModulePair, SafeOwner } from 'src/routes/safe/store/models/safe'
|
||||||
import { Dispatch } from 'redux'
|
import { Dispatch } from 'redux'
|
||||||
import addSafeModules from './addSafeModules'
|
|
||||||
import { SENTINEL_ADDRESS } from 'src/logic/contracts/safeContracts'
|
import { SENTINEL_ADDRESS } from 'src/logic/contracts/safeContracts'
|
||||||
|
|
||||||
const buildOwnersFrom = (
|
const buildOwnersFrom = (
|
||||||
|
@ -105,24 +104,16 @@ export const checkAndUpdateSafe = (safeAdd: string) => async (dispatch: Dispatch
|
||||||
|
|
||||||
// Converts from [ { address, ownerName} ] to address array
|
// Converts from [ { address, ownerName} ] to address array
|
||||||
const localOwners = localSafe ? localSafe.owners.map((localOwner) => localOwner.address) : undefined
|
const localOwners = localSafe ? localSafe.owners.map((localOwner) => localOwner.address) : undefined
|
||||||
const localThreshold = localSafe ? localSafe.threshold : undefined
|
|
||||||
const localNonce = localSafe ? localSafe.nonce : undefined
|
|
||||||
|
|
||||||
dispatch(
|
dispatch(
|
||||||
addSafeModules({
|
updateSafe({
|
||||||
safeAddress,
|
address: safeAddress,
|
||||||
modulesAddresses: buildModulesLinkedList(modules?.array, modules?.next),
|
modules: buildModulesLinkedList(modules?.array, modules?.next),
|
||||||
|
nonce: Number(remoteNonce),
|
||||||
|
threshold: Number(remoteThreshold),
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
if (localNonce !== Number(remoteNonce)) {
|
|
||||||
dispatch(updateSafe({ address: safeAddress, nonce: Number(remoteNonce) }))
|
|
||||||
}
|
|
||||||
|
|
||||||
if (localThreshold !== Number(remoteThreshold)) {
|
|
||||||
dispatch(updateSafe({ address: safeAddress, threshold: Number(remoteThreshold) }))
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the remote owners does not contain a local address, we remove that local owner
|
// If the remote owners does not contain a local address, we remove that local owner
|
||||||
if (localOwners) {
|
if (localOwners) {
|
||||||
localOwners.forEach((localAddress) => {
|
localOwners.forEach((localAddress) => {
|
||||||
|
|
Loading…
Reference in New Issue