Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix | Issue #2565] Network Switching and context to store update #2595

Merged
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
5e64ab2
Refactor network configuration handling and introduce Zustand store f…
Da-Colon Dec 5, 2024
44e090b
Refactor network configuration imports to use new Zustand store
Da-Colon Dec 5, 2024
1915478
Remove unused network configuration hook and clean up imports
Da-Colon Dec 5, 2024
dae8741
Refactor SafeMenuItem and related hooks to simplify network handling …
Da-Colon Dec 5, 2024
dc95f17
Refactor DaoHierarchyNode to remove unused chainId and streamline net…
Da-Colon Dec 5, 2024
19dcca0
Merge branch 'develop' of github.com:decentdao/decent-interface into …
Da-Colon Dec 6, 2024
c894027
refactor: simplify WalletMenu component by removing containerRef prop
Da-Colon Dec 6, 2024
32e1ec5
refactor: update network config hook usage to useNetworkConfigStore
Da-Colon Dec 6, 2024
047d978
refactor: reorganize DAOInfoCard layout by grouping FavoriteIcon and …
Da-Colon Dec 6, 2024
2e3b524
refactor: add network icon to DAOInfoCard component
Da-Colon Dec 6, 2024
1091123
refactor: rename NetworkSelector component and update import paths
Da-Colon Dec 6, 2024
1845811
feat: add DropdownMenu component and remove obsolete NetworkSelector
Da-Colon Dec 6, 2024
d226d81
refactor: streamline DAOInfoCard component by enhancing layout and im…
Da-Colon Dec 6, 2024
0ff3f84
refactor: update network configuration to use mainnet instead of sepolia
Da-Colon Dec 6, 2024
736377c
feat: implement DropdownMenu for network selection in EstablishEssent…
Da-Colon Dec 6, 2024
30d8411
refactor: adjust label alignment in EstablishEssentials component
Da-Colon Dec 6, 2024
e2197ba
refactor: adjust icon size and text style in DropdownMenu component
Da-Colon Dec 6, 2024
f3f971e
Merge branch 'develop' of github.com:decentdao/decent-interface into …
Da-Colon Dec 6, 2024
56b0eda
feat: implement dynamic Wagmi configuration and update providers to u…
Da-Colon Dec 6, 2024
a3f879b
refactor: remove unused dynamic Wagmi configuration hook
Da-Colon Dec 7, 2024
999f0f6
feat: integrate automatic chain switching and update Wagmi configurat…
Da-Colon Dec 7, 2024
fb9c751
feat: integrate chain switching functionality in EstablishEssentials …
Da-Colon Dec 10, 2024
af55ec0
Merge branch 'issue/noIssue-state-loading-cleanup' of github.com:dece…
Da-Colon Dec 10, 2024
d11ff98
Merge branch 'issue/2565-network-config-updates' of github.com:decent…
Da-Colon Dec 10, 2024
5337915
Merge branch 'issue/noIssue-state-loading-cleanup' of github.com:dece…
Da-Colon Dec 11, 2024
c05f818
Merge branch 'issue/2565-network-config-updates' of github.com:decent…
Da-Colon Dec 11, 2024
23cab88
Delay setting current config after switching chain to ensure proper s…
Da-Colon Dec 12, 2024
fc918d5
Merge branch 'issue/noIssue-state-loading-cleanup' of github.com:dece…
Da-Colon Dec 12, 2024
9f2ffaf
Merge branch 'issue/2565-network-config-updates' of github.com:decent…
Da-Colon Dec 12, 2024
113d28f
Update error message for invalid DAO search to reflect support for al…
Da-Colon Dec 13, 2024
d2319e5
Enhance useIsSafe hook to search across all supported networks and re…
Da-Colon Dec 13, 2024
2bb83c1
Refactor DAOSearch to display multiple network prefixes in SearchDisp…
Da-Colon Dec 13, 2024
8dab85b
Refactor DAOSearch component to remove extra gap
Da-Colon Dec 13, 2024
ef7a3de
revert: changes made to hook.
Da-Colon Dec 13, 2024
2118a5d
Add useResolveAddressMultiChain hook for multi-chain address resolution
Da-Colon Dec 14, 2024
1e8292a
Refactor DAOSearch to use resolved addresses with chain IDs and updat…
Da-Colon Dec 14, 2024
a25fd55
move translation initialization
Da-Colon Dec 14, 2024
8dace81
Remove 'wrongNetwork' type from LoadingProblem component and its usag…
Da-Colon Dec 14, 2024
0352fdd
Merge branch 'issue/noIssue-state-loading-cleanup' of github.com:dece…
Da-Colon Dec 14, 2024
5b8556b
Merge branch 'issue/2565-network-config-updates' of github.com:decent…
Da-Colon Dec 14, 2024
992c141
Merge branch 'issue/2565-network-config-extended' of github.com:decen…
Da-Colon Dec 14, 2024
89b2989
Merge pull request #2630 from decentdao/issue/2565-cross-chain-dao-se…
Da-Colon Dec 16, 2024
c7b41c5
Merge pull request #2609 from decentdao/issue/2565-network-config-ext…
Da-Colon Dec 16, 2024
cb0e07f
We only really need to search for ENS names on mainnet
adamgall Dec 16, 2024
cba45d2
Merge pull request #2636 from decentdao/only-mainnet-ens-search
Da-Colon Dec 16, 2024
c44efe8
Refactor useResolveAddressMultiChain to utilize mainnet client for EN…
Da-Colon Dec 16, 2024
6cdc66e
Rename useResolveAddressMultiChain to useResolveENSName and refactor …
Da-Colon Dec 16, 2024
8fc85e2
Refactor useSearchDao to utilize useResolveENSName for address resolu…
Da-Colon Dec 16, 2024
98d5e0a
Refactor useSearchDao to use resolveENSName for address resolution an…
Da-Colon Dec 16, 2024
30b14dc
remove try/catch
Da-Colon Dec 16, 2024
5d4c6fd
Merge pull request #2637 from decentdao/issue/2565-resolve-mainnet-ens
Da-Colon Dec 16, 2024
3a6d01e
wait for wallet to be fetch before trying to switch chain
Da-Colon Dec 17, 2024
63c1575
refactor: update useWalletClient to use isFetchedAfterMount for chain…
Da-Colon Dec 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion netlify/shared/moralisBalances.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Store } from '@netlify/blobs';
import Moralis from 'moralis';
import { isAddress } from 'viem';
import type { Address } from 'viem';
import { moralisSupportedChainIds } from '../../src/providers/NetworkConfig/NetworkConfigProvider';
import { moralisSupportedChainIds } from '../../src/providers/NetworkConfig/useNetworkConfigStore';

export interface BalanceDataWithMetadata<T> {
data: T[];
Expand Down
4 changes: 2 additions & 2 deletions src/components/DAOTreasury/components/Transactions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
import { getAddress } from 'viem';
import { useDateTimeDisplay } from '../../../helpers/dateTime';
import { useFractal } from '../../../providers/App/AppProvider';
import { useNetworkConfig } from '../../../providers/NetworkConfig/NetworkConfigProvider';
import { useNetworkConfigStore } from '../../../providers/NetworkConfig/useNetworkConfigStore';
import { useDaoInfoStore } from '../../../store/daoInfo/useDaoInfoStore';
import { TokenEventType, TransferDisplayData, TransferType } from '../../../types';
import { DecentTooltip } from '../../ui/DecentTooltip';
Expand All @@ -14,7 +14,7 @@ import { BarLoader } from '../../ui/loaders/BarLoader';

function TransferRow({ displayData }: { displayData: TransferDisplayData }) {
const { t } = useTranslation(['treasury', 'common']);
const { etherscanBaseURL } = useNetworkConfig();
const { etherscanBaseURL } = useNetworkConfigStore();

return (
<Box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import LidoWithdrawalQueueAbi from '../../../assets/abi/LidoWithdrawalQueueAbi';
import useLidoStaking from '../../../hooks/stake/lido/useLidoStaking';
import { useCanUserCreateProposal } from '../../../hooks/utils/useCanUserSubmitProposal';
import { useFractal } from '../../../providers/App/AppProvider';
import { useNetworkConfig } from '../../../providers/NetworkConfig/NetworkConfigProvider';
import { useNetworkConfigStore } from '../../../providers/NetworkConfig/useNetworkConfigStore';
import { ModalType } from '../../ui/modals/ModalProvider';
import { useDecentModal } from '../../ui/modals/useDecentModal';

Expand All @@ -16,7 +16,7 @@ export default function useTreasuryLidoInteractions() {
const ethAsset = assetsFungible.find(asset => !asset.tokenAddress);
const { handleUnstake, handleClaimUnstakedETH } = useLidoStaking();
const { canUserCreateProposal } = useCanUserCreateProposal();
const { staking } = useNetworkConfig();
const { staking } = useNetworkConfigStore();
const publicClient = usePublicClient();

// --- Lido Stake button setup ---
Expand Down
4 changes: 2 additions & 2 deletions src/components/DaoCreator/StepController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next';
import { Navigate, Route, Routes, useLocation } from 'react-router-dom';
import { toast } from 'sonner';
import { useAccount } from 'wagmi';
import { useNetworkConfig } from '../../providers/NetworkConfig/NetworkConfigProvider';
import { useNetworkConfigStore } from '../../providers/NetworkConfig/useNetworkConfigStore';
import {
ChildERC20Steps,
ChildERC721Steps,
Expand All @@ -25,7 +25,7 @@ import useStepRedirect from './hooks/useStepRedirect';

function StepController(props: Omit<ICreationStepProps, 'steps'>) {
const { t } = useTranslation('daoCreate');
const { createOptions } = useNetworkConfig();
const { createOptions } = useNetworkConfigStore();
const location = useLocation();

const { values, mode, setFieldValue } = props;
Expand Down
4 changes: 2 additions & 2 deletions src/components/DaoCreator/StepWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ReactNode } from 'react';
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
import { BASE_ROUTES, DAO_ROUTES } from '../../constants/routes';
import { useNetworkConfig } from '../../providers/NetworkConfig/NetworkConfigProvider';
import { useNetworkConfigStore } from '../../providers/NetworkConfig/useNetworkConfigStore';
import { useDaoInfoStore } from '../../store/daoInfo/useDaoInfoStore';
import { CreatorSteps } from '../../types';
import PageHeader from '../ui/page/Header/PageHeader';
Expand Down Expand Up @@ -49,7 +49,7 @@ export function StepWrapper({
shouldWrapChildren = true,
}: IStepWrapper) {
const { safe } = useDaoInfoStore();
const { addressPrefix } = useNetworkConfig();
const { addressPrefix } = useNetworkConfigStore();
const { t } = useTranslation(['breadcrumbs']);
const navigate = useNavigate();

Expand Down
78 changes: 75 additions & 3 deletions src/components/DaoCreator/formComponents/EstablishEssentials.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import { Box, Input, RadioGroup } from '@chakra-ui/react';
import { Box, Flex, Icon, Image, Input, RadioGroup } from '@chakra-ui/react';
import { CheckCircle } from '@phosphor-icons/react';
import debounce from 'lodash.debounce';
import { useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useChainId, useSwitchChain } from 'wagmi';
import { createAccountSubstring } from '../../../hooks/utils/useGetAccountName';
import { useNetworkConfig } from '../../../providers/NetworkConfig/NetworkConfigProvider';
import {
supportedNetworks,
useNetworkConfigStore,
} from '../../../providers/NetworkConfig/useNetworkConfigStore';
import { useDaoInfoStore } from '../../../store/daoInfo/useDaoInfoStore';
import { GovernanceType, ICreationStepProps, VotingStrategyType } from '../../../types';
import { getChainIdFromPrefix, getNetworkIcon } from '../../../utils/url';
import { InputComponent, LabelComponent } from '../../ui/forms/InputComponent';
import LabelWrapper from '../../ui/forms/LabelWrapper';
import { RadioWithText } from '../../ui/forms/Radio/RadioWithText';
import { DropdownMenu } from '../../ui/menus/DropdownMenu';
import { StepButtons } from '../StepButtons';
import { StepWrapper } from '../StepWrapper';

Expand Down Expand Up @@ -65,7 +72,9 @@ export function EstablishEssentials(props: ICreationStepProps) {
setFieldValue('essentials.governance', value);
};

const { createOptions } = useNetworkConfig();
const { createOptions, setCurrentConfig, chain, getConfigByChainId, addressPrefix } =
useNetworkConfigStore();
const walletChainID = useChainId();

const [snapshotENSInput, setSnapshotENSInput] = useState('');

Expand All @@ -81,6 +90,24 @@ export function EstablishEssentials(props: ICreationStepProps) {
debounceENSInput(snapshotENSInput);
}, [debounceENSInput, snapshotENSInput]);

const dropdownItems = supportedNetworks.map(network => ({
value: network.chain.id.toString(),
label: network.chain.name,
icon: getNetworkIcon(network.addressPrefix),
selected: chain.id === network.chain.id,
}));

const { switchChain } = useSwitchChain({
mutation: {
onError: () => {
if (chain.id !== walletChainID) {
const chainId = getChainIdFromPrefix(addressPrefix);
switchChain({ chainId });
}
},
},
});

return (
<>
<StepWrapper
Expand All @@ -102,6 +129,51 @@ export function EstablishEssentials(props: ICreationStepProps) {
placeholder={t('daoNamePlaceholder')}
testId="essentials-daoName"
/>
<Box
mt="2rem"
mb="1.5rem"
>
<LabelComponent
label={t('networks')}
helper={t('networkDescription')}
isRequired
alignLabel="flex-start"
>
<DropdownMenu
items={dropdownItems}
selectedItem={dropdownItems.find(item => item.selected)}
onSelect={item => {
setCurrentConfig(getConfigByChainId(Number(item.value)));
}}
title={t('networks')}
isDisabled={false}
renderItem={(item, isSelected) => {
return (
<>
<Flex
alignItems="center"
gap="1rem"
>
<Image
src={item.icon}
fallbackSrc="/images/coin-icon-default.svg"
boxSize="2rem"
/>
{item.label}
</Flex>
{isSelected && (
<Icon
as={CheckCircle}
boxSize="1.5rem"
color="lilac-0"
/>
)}
</>
);
}}
/>
</LabelComponent>
</Box>
<Box
mt="2rem"
mb="1.5rem"
Expand Down
4 changes: 2 additions & 2 deletions src/components/DaoDashboard/Activities/ProposalsHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { DAO_ROUTES } from '../../../constants/routes';
import { useProposalsSortedAndFiltered } from '../../../hooks/DAO/proposal/useProposals';
import { useCanUserCreateProposal } from '../../../hooks/utils/useCanUserSubmitProposal';
import { useFractal } from '../../../providers/App/AppProvider';
import { useNetworkConfig } from '../../../providers/NetworkConfig/NetworkConfigProvider';
import { useNetworkConfigStore } from '../../../providers/NetworkConfig/useNetworkConfigStore';
import { useDaoInfoStore } from '../../../store/daoInfo/useDaoInfoStore';
import {
AzoriusGovernance,
Expand Down Expand Up @@ -39,7 +39,7 @@ export function ProposalsHome() {
const { governance, guardContracts } = useFractal();
const { safe } = useDaoInfoStore();

const { addressPrefix } = useNetworkConfig();
const { addressPrefix } = useNetworkConfigStore();
const azoriusGovernance = governance as AzoriusGovernance;
const delegate = useDecentModal(ModalType.DELEGATE);

Expand Down
4 changes: 2 additions & 2 deletions src/components/DaoDashboard/Info/ParentLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { ArrowBendLeftUp } from '@phosphor-icons/react';
import { useTranslation } from 'react-i18next';
import { Link as RouterLink } from 'react-router-dom';
import { DAO_ROUTES } from '../../../constants/routes';
import { useNetworkConfig } from '../../../providers/NetworkConfig/NetworkConfigProvider';
import { useNetworkConfigStore } from '../../../providers/NetworkConfig/useNetworkConfigStore';
import { useDaoInfoStore } from '../../../store/daoInfo/useDaoInfoStore';
/**
* Displays a link to the current DAO's parent, if it has one.
*/
export function ParentLink() {
const { subgraphInfo } = useDaoInfoStore();
const { addressPrefix } = useNetworkConfig();
const { addressPrefix } = useNetworkConfigStore();
const { t } = useTranslation('breadcrumbs');

if (!subgraphInfo?.parentAddress) {
Expand Down
11 changes: 5 additions & 6 deletions src/components/DaoHierarchy/DaoHierarchyNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Link as RouterLink } from 'react-router-dom';
import { Address, getContract, zeroAddress } from 'viem';
import { useChainId, usePublicClient } from 'wagmi';
import { usePublicClient } from 'wagmi';
import { DAOQueryDocument } from '../../../.graphclient';
import { SENTINEL_ADDRESS } from '../../constants/common';
import { DAO_ROUTES } from '../../constants/routes';
Expand All @@ -15,7 +15,7 @@ import { CacheKeys } from '../../hooks/utils/cache/cacheDefaults';
import { setValue, getValue } from '../../hooks/utils/cache/useLocalStorage';
import { useAddressContractType } from '../../hooks/utils/useAddressContractType';
import { useSafeAPI } from '../../providers/App/hooks/useSafeAPI';
import { useNetworkConfig } from '../../providers/NetworkConfig/NetworkConfigProvider';
import { useNetworkConfigStore } from '../../providers/NetworkConfig/useNetworkConfigStore';
import { useDaoInfoStore } from '../../store/daoInfo/useDaoInfoStore';
import { DaoHierarchyInfo, DaoHierarchyStrategyType, DecentModule } from '../../types';
import { getAzoriusModuleFromModules } from '../../utils';
Expand Down Expand Up @@ -43,8 +43,7 @@ export function DaoHierarchyNode({
const safeApi = useSafeAPI();
const [hierarchyNode, setHierarchyNode] = useState<DaoHierarchyInfo>();
const [hasErrorLoading, setErrorLoading] = useState<boolean>(false);
const { addressPrefix, subgraph } = useNetworkConfig();
const chainId = useChainId();
const { addressPrefix, subgraph, chain } = useNetworkConfigStore();
const publicClient = usePublicClient();

const { getAddressContractType } = useAddressContractType();
Expand Down Expand Up @@ -168,7 +167,7 @@ export function DaoHierarchyNode({
if (safeAddress) {
const cachedNode = getValue({
cacheName: CacheKeys.HIERARCHY_DAO_INFO,
chainId,
chainId: chain.id,
daoAddress: safeAddress,
});
if (cachedNode) {
Expand All @@ -182,7 +181,7 @@ export function DaoHierarchyNode({
setValue(
{
cacheName: CacheKeys.HIERARCHY_DAO_INFO,
chainId,
chainId: chain.id,
daoAddress: safeAddress,
},
_node,
Expand Down
4 changes: 2 additions & 2 deletions src/components/ProposalBuilder/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import useSubmitProposal from '../../hooks/DAO/proposal/useSubmitProposal';
import useCreateProposalSchema from '../../hooks/schemas/proposalBuilder/useCreateProposalSchema';
import { useCanUserCreateProposal } from '../../hooks/utils/useCanUserSubmitProposal';
import { useFractal } from '../../providers/App/AppProvider';
import { useNetworkConfig } from '../../providers/NetworkConfig/NetworkConfigProvider';
import { useNetworkConfigStore } from '../../providers/NetworkConfig/useNetworkConfigStore';
import { useProposalActionsStore } from '../../store/actions/useProposalActionsStore';
import { useDaoInfoStore } from '../../store/daoInfo/useDaoInfoStore';
import { CreateProposalSteps, ProposalExecuteData } from '../../types';
Expand Down Expand Up @@ -58,7 +58,7 @@ export function ProposalBuilder({
const { safe } = useDaoInfoStore();
const safeAddress = safe?.address;

const { addressPrefix } = useNetworkConfig();
const { addressPrefix } = useNetworkConfigStore();
const { submitProposal, pendingCreateTx } = useSubmitProposal();
const { canUserCreateProposal } = useCanUserCreateProposal();
const { createProposalValidation } = useCreateProposalSchema();
Expand Down
4 changes: 2 additions & 2 deletions src/components/ProposalTemplates/ProposalTemplateCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { DAO_ROUTES } from '../../constants/routes';
import useRemoveProposalTemplate from '../../hooks/DAO/proposal/useRemoveProposalTemplate';
import useSubmitProposal from '../../hooks/DAO/proposal/useSubmitProposal';
import { useCanUserCreateProposal } from '../../hooks/utils/useCanUserSubmitProposal';
import { useNetworkConfig } from '../../providers/NetworkConfig/NetworkConfigProvider';
import { useNetworkConfigStore } from '../../providers/NetworkConfig/useNetworkConfigStore';
import { useDaoInfoStore } from '../../store/daoInfo/useDaoInfoStore';
import { ProposalTemplate } from '../../types/proposalBuilder';
import ContentBox from '../ui/containers/ContentBox';
Expand All @@ -29,7 +29,7 @@ export default function ProposalTemplateCard({
const { t } = useTranslation('proposalTemplate');
const { safe } = useDaoInfoStore();

const { addressPrefix } = useNetworkConfig();
const { addressPrefix } = useNetworkConfigStore();

const { prepareRemoveProposalTemplateProposal } = useRemoveProposalTemplate();
const { submitProposal } = useSubmitProposal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useAsyncRequest } from '../../../hooks/utils/useAsyncRequest';
import { useTransaction } from '../../../hooks/utils/useTransaction';
import { useFractal } from '../../../providers/App/AppProvider';
import { useSafeAPI } from '../../../providers/App/hooks/useSafeAPI';
import { useNetworkConfig } from '../../../providers/NetworkConfig/NetworkConfigProvider';
import { useNetworkConfigStore } from '../../../providers/NetworkConfig/useNetworkConfigStore';
import { useDaoInfoStore } from '../../../store/daoInfo/useDaoInfoStore';
import { MultisigProposal, FractalProposalState } from '../../../types';
import { DecentTooltip } from '../../ui/DecentTooltip';
Expand Down Expand Up @@ -42,7 +42,7 @@ export function TxActions({ proposal }: { proposal: MultisigProposal }) {
}
}, [proposal.state]);

const { chain } = useNetworkConfig();
const { chain } = useNetworkConfigStore();
const { t } = useTranslation(['proposal', 'common', 'transaction']);

const [asyncRequest, asyncRequestPending] = useAsyncRequest();
Expand Down
4 changes: 2 additions & 2 deletions src/components/Proposals/ProposalCard/ProposalCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { format } from 'date-fns';
import { useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom';
import { DAO_ROUTES } from '../../../constants/routes';
import { useNetworkConfig } from '../../../providers/NetworkConfig/NetworkConfigProvider';
import { useNetworkConfigStore } from '../../../providers/NetworkConfig/useNetworkConfigStore';
import { useDaoInfoStore } from '../../../store/daoInfo/useDaoInfoStore';
import { AzoriusProposal, FractalProposal, SnapshotProposal } from '../../../types';
import { DEFAULT_DATE_FORMAT } from '../../../utils';
Expand All @@ -15,7 +15,7 @@ import { ProposalCountdown } from '../../ui/proposal/ProposalCountdown';

function ProposalCard({ proposal }: { proposal: FractalProposal }) {
const { safe } = useDaoInfoStore();
const { addressPrefix } = useNetworkConfig();
const { addressPrefix } = useNetworkConfigStore();
const { t } = useTranslation('common');

if (!safe?.address) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Roles/RoleDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import useAvatar from '../../hooks/utils/useAvatar';
import { useCanUserCreateProposal } from '../../hooks/utils/useCanUserSubmitProposal';
import { useCopyText } from '../../hooks/utils/useCopyText';
import { useGetAccountName } from '../../hooks/utils/useGetAccountName';
import { useNetworkConfig } from '../../providers/NetworkConfig/NetworkConfigProvider';
import { useNetworkConfigStore } from '../../providers/NetworkConfig/useNetworkConfigStore';
import { useDaoInfoStore } from '../../store/daoInfo/useDaoInfoStore';
import {
paymentSorterByActiveStatus,
Expand Down Expand Up @@ -79,7 +79,7 @@ export default function RolesDetails({
}) {
const { safe } = useDaoInfoStore();
const navigate = useNavigate();
const { addressPrefix } = useNetworkConfig();
const { addressPrefix } = useNetworkConfigStore();
const permissionsContainerRef = useRef<HTMLDivElement>(null);

const roleHatWearer = 'wearer' in roleHat ? roleHat.wearer : roleHat.wearerAddress;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Roles/RolePaymentDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Address, getAddress, Hex } from 'viem';
import { useAccount, usePublicClient } from 'wagmi';
import { DETAILS_BOX_SHADOW, isDemoMode } from '../../constants/common';
import { DAO_ROUTES } from '../../constants/routes';
import { useNetworkConfig } from '../../providers/NetworkConfig/NetworkConfigProvider';
import { useNetworkConfigStore } from '../../providers/NetworkConfig/useNetworkConfigStore';
import { useDaoInfoStore } from '../../store/daoInfo/useDaoInfoStore';
import { useRolesStore } from '../../store/roles/useRolesStore';
import { BigIntValuePair } from '../../types';
Expand Down Expand Up @@ -141,7 +141,7 @@ export function RolePaymentDetails({
const { t } = useTranslation(['roles']);
const { safe } = useDaoInfoStore();
const { address: connectedAccount } = useAccount();
const { addressPrefix } = useNetworkConfig();
const { addressPrefix } = useNetworkConfigStore();
const { refreshWithdrawableAmount } = useRolesStore();
const navigate = useNavigate();
const publicClient = usePublicClient();
Expand Down
4 changes: 2 additions & 2 deletions src/components/Roles/RoleTerm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import useAvatar from '../../hooks/utils/useAvatar';
import { useCopyText } from '../../hooks/utils/useCopyText';
import { useGetAccountName } from '../../hooks/utils/useGetAccountName';
import { useTransaction } from '../../hooks/utils/useTransaction';
import { useNetworkConfig } from '../../providers/NetworkConfig/NetworkConfigProvider';
import { useNetworkConfigStore } from '../../providers/NetworkConfig/useNetworkConfigStore';
import { useRolesStore } from '../../store/roles/useRolesStore';
import { RoleFormTermStatus } from '../../types/roles';
import { DEFAULT_DATE_TIME_FORMAT_NO_TZ } from '../../utils';
Expand Down Expand Up @@ -284,7 +284,7 @@ export default function RoleTerm({
const { t } = useTranslation(['roles']);
const {
contracts: { hatsProtocol },
} = useNetworkConfig();
} = useNetworkConfigStore();

const roleHat = useMemo(() => {
if (!hatId) return undefined;
Expand Down
Loading
Loading