fix the order of transactions, change updateSafe to upgradeSafe to avoid naming confusion with the updateSafe action (#610)
This commit is contained in:
parent
1f3f13eeb9
commit
0b7d6f0b24
|
@ -10,7 +10,7 @@ import type { MultiSendTransactionInstanceType } from '~/logic/contracts/safeCon
|
||||||
import { DELEGATE_CALL } from '~/logic/safe/transactions'
|
import { DELEGATE_CALL } from '~/logic/safe/transactions'
|
||||||
import { getWeb3 } from '~/logic/wallets/getWeb3'
|
import { getWeb3 } from '~/logic/wallets/getWeb3'
|
||||||
|
|
||||||
export const upgradeSafeToLastVersion = async (safeAddress: string, createTransaction: Function) => {
|
export const upgradeSafeToLatestVersion = async (safeAddress: string, createTransaction: Function) => {
|
||||||
const sendTransactions = async (txs: Array<MultiSendTransactionInstanceType>) => {
|
const sendTransactions = async (txs: Array<MultiSendTransactionInstanceType>) => {
|
||||||
const web3 = getWeb3()
|
const web3 = getWeb3()
|
||||||
const encodeMultiSendCallData = getEncodedMultiSendCallData(txs, web3)
|
const encodeMultiSendCallData = getEncodedMultiSendCallData(txs, web3)
|
||||||
|
@ -35,13 +35,13 @@ export const upgradeSafeToLastVersion = async (safeAddress: string, createTransa
|
||||||
operation: 0,
|
operation: 0,
|
||||||
to: safeAddress,
|
to: safeAddress,
|
||||||
value: 0,
|
value: 0,
|
||||||
data: fallbackHandlerTxData,
|
data: updateSafeTxData,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
operation: 0,
|
operation: 0,
|
||||||
to: safeAddress,
|
to: safeAddress,
|
||||||
value: 0,
|
value: 0,
|
||||||
data: updateSafeTxData,
|
data: fallbackHandlerTxData,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
return sendTransactions(txs)
|
return sendTransactions(txs)
|
|
@ -10,7 +10,7 @@ import GnoForm from '~/components/forms/GnoForm'
|
||||||
import Block from '~/components/layout/Block'
|
import Block from '~/components/layout/Block'
|
||||||
import Button from '~/components/layout/Button'
|
import Button from '~/components/layout/Button'
|
||||||
import { styles } from './style'
|
import { styles } from './style'
|
||||||
import { upgradeSafeToLastVersion } from '~/logic/safe/utils/updateSafe'
|
import { upgradeSafeToLatestVersion } from '~/logic/safe/utils/upgradeSafe'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
onClose: Function,
|
onClose: Function,
|
||||||
|
@ -22,7 +22,7 @@ type Props = {
|
||||||
const UpdateSafeModal = ({ onClose, classes, safeAddress, createTransaction }: Props) => {
|
const UpdateSafeModal = ({ onClose, classes, safeAddress, createTransaction }: Props) => {
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
// Call the update safe method
|
// Call the update safe method
|
||||||
await upgradeSafeToLastVersion(safeAddress, createTransaction)
|
await upgradeSafeToLatestVersion(safeAddress, createTransaction)
|
||||||
onClose()
|
onClose()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,16 +21,16 @@ describe('Upgrade a Safe', () => {
|
||||||
operation: 0,
|
operation: 0,
|
||||||
to: safeAddress,
|
to: safeAddress,
|
||||||
value: 0,
|
value: 0,
|
||||||
data: fallbackHandlerTxData,
|
data: updateSafeTxData,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
operation: 0,
|
operation: 0,
|
||||||
to: safeAddress,
|
to: safeAddress,
|
||||||
value: 0,
|
value: 0,
|
||||||
data: updateSafeTxData,
|
data: fallbackHandlerTxData,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
const expectedEncodedData = '0x8d80ff0a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000f200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024f08a0323000000000000000000000000d5d82b6addc9027b22dca772aa68d5d74cdbdf44000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000247de7edef00000000000000000000000034cfac646f301356faa8b21e94227e3583fe3f5f0000000000000000000000000000'
|
const expectedEncodedData = '0x8d80ff0a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000f2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000247de7edef00000000000000000000000034cfac646f301356faa8b21e94227e3583fe3f5f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024f08a0323000000000000000000000000d5d82b6addc9027b22dca772aa68d5d74cdbdf440000000000000000000000000000'
|
||||||
const multiSendTxData = getEncodedMultiSendCallData(txs, web3)
|
const multiSendTxData = getEncodedMultiSendCallData(txs, web3)
|
||||||
expect(multiSendTxData).toEqual(expectedEncodedData)
|
expect(multiSendTxData).toEqual(expectedEncodedData)
|
||||||
})
|
})
|
Loading…
Reference in New Issue