Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

fix unsupported chain message issue #106

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Changes from all commits
Commits
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
14 changes: 3 additions & 11 deletions src/hooks/useConnectedUser.tsx
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ import config, { ChainConfiguration } from '../config';

export type TConnectedUserState = null | {
address: `0x${string}`;
config: ChainConfiguration;
config: ChainConfiguration | null;
isActiveChainSupported: boolean;
};

@@ -35,17 +35,9 @@ function ConnectedUserProvider({ children }: IConnectedUserProviderProps) {

useEffect(() => {
const configuration =
activeChain?.id && config[activeChain.id]
? config[activeChain.id]
: undefined;
activeChain?.id && config[activeChain.id] ? config[activeChain.id] : null;

if (
activeConnector &&
activeChain &&
accountAddress &&
isConnected &&
configuration
) {
if (activeConnector && activeChain && accountAddress && isConnected) {
setUser({
address: accountAddress,
config: configuration,
2 changes: 1 addition & 1 deletion src/modules/dashboard/components/Yield/ClaimYield.tsx
Original file line number Diff line number Diff line change
@@ -85,7 +85,7 @@ export default function ClaimYield({ amount }: IProps) {

return (
<section className="m-auto flex w-2/3 items-center justify-between p-6">
{user ? (
{user && user.config ? (
<>
<span>Claim Yield</span>
<ClaimYieldButton amount={amount} config={user.config} />
4 changes: 1 addition & 3 deletions src/routes/bake.tsx
Original file line number Diff line number Diff line change
@@ -20,15 +20,13 @@ export function Bake() {
);
}

if (!user.isActiveChainSupported)
if (!user.config)
return (
<BakeLayout>
<UnsupportedNetwork />
</BakeLayout>
);

if (!user.config) throw new Error(`Missing chain config!`);

return (
<BakeLayout>
<Suspense