From 2218084be2037993f60a12a7b813c0e8c78c16d6 Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Wed, 10 Apr 2024 15:35:52 -0400 Subject: [PATCH] Use that helper in all the places --- src/hooks/DAO/loaders/useFractalNode.ts | 5 +---- src/hooks/DAO/loaders/useLoadDAONode.ts | 6 ++---- src/hooks/DAO/useClawBack.ts | 5 ++--- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/hooks/DAO/loaders/useFractalNode.ts b/src/hooks/DAO/loaders/useFractalNode.ts index 9337b0006a..3d41116001 100644 --- a/src/hooks/DAO/loaders/useFractalNode.ts +++ b/src/hooks/DAO/loaders/useFractalNode.ts @@ -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; diff --git a/src/hooks/DAO/loaders/useLoadDAONode.ts b/src/hooks/DAO/loaders/useLoadDAONode.ts index a7840fc786..7cf0fe8f63 100644 --- a/src/hooks/DAO/loaders/useLoadDAONode.ts +++ b/src/hooks/DAO/loaders/useLoadDAONode.ts @@ -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 diff --git a/src/hooks/DAO/useClawBack.ts b/src/hooks/DAO/useClawBack.ts index 8b685623ab..8ac284eda8 100644 --- a/src/hooks/DAO/useClawBack.ts +++ b/src/hooks/DAO/useClawBack.ts @@ -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(); @@ -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'),