Skip to content

Commit

Permalink
Use that helper in all the places
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgall committed Apr 10, 2024
1 parent d1ec2a7 commit 2218084
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
5 changes: 1 addition & 4 deletions src/hooks/DAO/loaders/useFractalNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,8 @@ export const useFractalNode = (

try {
if (!safeAPI) throw new Error('SafeAPI not set');

const address = utils.getAddress(_daoAddress);
const safeInfoResponse = await safeAPI.getSafeInfo(address);
const nextNonce = await safeAPI.getNextNonce(address);
safeInfo = { ...safeInfoResponse, nonce: nextNonce };
safeInfo = await safeAPI.getSafeData(address);
} catch (e) {
reset({ error: true });
return;
Expand Down
6 changes: 2 additions & 4 deletions src/hooks/DAO/loaders/useLoadDAONode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,12 @@ export const useLoadDAONode = () => {
}

const sanitizedDaoAddress = utils.getAddress(_daoAddress);
const safeInfo = await safeAPI.getSafeInfo(sanitizedDaoAddress);
const nextNonce = await safeAPI.getNextNonce(sanitizedDaoAddress);
const safeInfoWithGuard = { ...safeInfo, nonce: nextNonce };
const safeInfoWithGuard = await safeAPI.getSafeData(sanitizedDaoAddress);

const node: FractalNode = Object.assign(graphNodeInfo, {
daoName: await getDaoName(sanitizedDaoAddress, graphNodeInfo.daoName),
safe: safeInfoWithGuard,
fractalModules: await lookupModules(safeInfo.modules),
fractalModules: await lookupModules(safeInfoWithGuard.modules),
});

// TODO we could cache node here, but should be careful not to cache
Expand Down
5 changes: 2 additions & 3 deletions src/hooks/DAO/useClawBack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ export default function useClawBack({ childSafeInfo, parentAddress }: IUseClawBa
);

const santitizedParentAddress = utils.getAddress(parentAddress);
const parentSafeInfo = await safeAPI.getSafeInfo(santitizedParentAddress);
const parentSafeNextNonce = await safeAPI.getNextNonce(santitizedParentAddress);
const parentSafeInfo = await safeAPI.getSafeData(santitizedParentAddress);

if (canUserCreateProposal && parentAddress && childSafeInfo && parentSafeInfo) {
const abiCoder = new ethers.utils.AbiCoder();
Expand Down Expand Up @@ -92,7 +91,7 @@ export default function useClawBack({ childSafeInfo, parentAddress }: IUseClawBa
values: transactions.map(tx => tx.value),
calldatas: transactions.map(tx => tx.calldata),
},
nonce: parentSafeNextNonce,
nonce: parentSafeInfo.nonce,
pendingToastMessage: t('clawBackPendingToastMessage'),
failedToastMessage: t('clawBackFailedToastMessage'),
successToastMessage: t('clawBackSuccessToastMessage'),
Expand Down

0 comments on commit 2218084

Please sign in to comment.