Skip to content

Commit

Permalink
Found one more place in the app where we're creating a transaction bu…
Browse files Browse the repository at this point in the history
…t _not_ using the Safe data from global state
  • Loading branch information
adamgall committed Apr 4, 2024
1 parent 24c4401 commit 4698383
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/hooks/DAO/useClawBack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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'),
Expand Down

0 comments on commit 4698383

Please sign in to comment.