From 46983832b6f966feb53e4211a2cec273db030756 Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Thu, 4 Apr 2024 13:42:15 -0400 Subject: [PATCH] Found one more place in the app where we're creating a transaction but _not_ using the Safe data from global state --- src/hooks/DAO/useClawBack.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/hooks/DAO/useClawBack.ts b/src/hooks/DAO/useClawBack.ts index d5bb2ffc34..982f4c1584 100644 --- a/src/hooks/DAO/useClawBack.ts +++ b/src/hooks/DAO/useClawBack.ts @@ -25,7 +25,14 @@ export default function useClawBack({ childSafeInfo, parentAddress }: IUseClawBa const childSafeBalance = await safeAPI.getBalances( utils.getAddress(childSafeInfo.daoAddress), ); + const parentSafeInfo = await safeAPI.getSafeInfo(utils.getAddress(parentAddress)); + let parentSafeInfoNextNonce = parentSafeInfo.nonce; + const pendingTransactions = await safeAPI.getPendingTransactions(parentAddress); + if (pendingTransactions.count > 0) { + parentSafeInfoNextNonce = Math.max(...pendingTransactions.results.map(tx => tx.nonce)) + 1; + } + if (canUserCreateProposal && parentAddress && childSafeInfo && parentSafeInfo) { const abiCoder = new ethers.utils.AbiCoder(); const fractalModule = childSafeInfo.fractalModules!.find( @@ -88,7 +95,7 @@ export default function useClawBack({ childSafeInfo, parentAddress }: IUseClawBa values: transactions.map(tx => tx.value), calldatas: transactions.map(tx => tx.calldata), }, - nonce: parentSafeInfo.nonce, + nonce: parentSafeInfoNextNonce, pendingToastMessage: t('clawBackPendingToastMessage'), failedToastMessage: t('clawBackFailedToastMessage'), successToastMessage: t('clawBackSuccessToastMessage'),