Skip to content

Commit

Permalink
fix: use registry chain directly
Browse files Browse the repository at this point in the history
  • Loading branch information
songwongtp committed May 18, 2024
1 parent a767fac commit 137f8d9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/lib/providers/network-guard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,27 @@ interface NetworkGuardProps {
}

export const NetworkGuard = observer(({ children }: NetworkGuardProps) => {
const { isHydrated, currentChainId, chainConfig } = useCelatoneApp();
const {
isHydrated,
currentChainId,
chainConfig: { registryChainName },
} = useCelatoneApp();
const { setAccountUserKey, isAccountUserKeyExist } = useAccountStore();
const { setCodeUserKey, isCodeUserKeyExist } = useCodeStore();
const { setContractUserKey, isContractUserKeyExist } = useContractStore();
const { setProjectUserKey, isProjectUserKeyExist } = usePublicProjectStore();

useEffect(() => {
if (isHydrated) {
const userKey = formatUserKey(
chainConfig.registryChainName,
DEFAULT_ADDRESS
);
const userKey = formatUserKey(registryChainName, DEFAULT_ADDRESS);
setAccountUserKey(userKey);
setCodeUserKey(userKey);
setContractUserKey(userKey);
setProjectUserKey(userKey);
}
}, [
isHydrated,
chainConfig.registryChainName,
registryChainName,
setAccountUserKey,
setCodeUserKey,
setContractUserKey,
Expand Down

0 comments on commit 137f8d9

Please sign in to comment.