Fix multisend enconding when adding a new spender to allowance module

This commit is contained in:
Daniel Sanchez 2021-02-02 11:38:48 +01:00
parent 42821c11d2
commit 29559859d2
2 changed files with 5 additions and 8 deletions

View File

@ -26,7 +26,7 @@ Sentry.init({
dsn: SENTRY_DSN,
release: `safe-react@${process.env.REACT_APP_APP_VERSION}`,
integrations: [new Integrations.BrowserTracing()],
sampleRate: 0.2,
sampleRate: 0.01,
})
const root = document.getElementById('root')

View File

@ -120,6 +120,8 @@ const calculateSpendingLimitsTxData = (
if (transactions.length === 0) {
spendingLimitTxData = setSpendingLimitTx({ spendingLimitArgs, safeAddress })
} else {
const encodedTxForMultisend = setSpendingLimitMultiSendTx({ spendingLimitArgs, safeAddress })
transactions.push(encodedTxForMultisend)
spendingLimitTxData = spendingLimitMultiSendTx({ transactions, safeAddress })
}
@ -193,7 +195,7 @@ export const ReviewSpendingLimits = ({ onBack, onClose, txToken, values }: Revie
ethGasLimit: ethGasLimit || gasLimit,
}
if (safeAddress) {
const { spendingLimitTxData, transactions, spendingLimitArgs } = calculateSpendingLimitsTxData(
const { spendingLimitTxData } = calculateSpendingLimitsTxData(
safeAddress,
spendingLimits,
existentSpendingLimit,
@ -201,12 +203,7 @@ export const ReviewSpendingLimits = ({ onBack, onClose, txToken, values }: Revie
values,
advancedOptionsTxParameters,
)
// if there's no tx for enable module or adding a delegate, then we avoid using multiSend Tx
if (transactions.length === 0) {
dispatch(createTransaction(spendingLimitTxData))
return
}
transactions.push(setSpendingLimitMultiSendTx({ spendingLimitArgs, safeAddress }))
dispatch(createTransaction(spendingLimitTxData))
}
}