Skip to content

Commit

Permalink
fix: wrong network in provider
Browse files Browse the repository at this point in the history
  • Loading branch information
kwiss committed Jun 19, 2024
1 parent c25d7d2 commit f0f672f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 36 deletions.
5 changes: 5 additions & 0 deletions .changeset/quick-walls-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ark-project/react": patch
---

Remove wrong network message from provider
36 changes: 0 additions & 36 deletions packages/react/src/components/ArkProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,6 @@ export type ArkProviderProviderProps = {
config: CreateConfigParameters;
};

function AlertCircleIcon(props: React.SVGProps<SVGSVGElement>) {
return (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<circle cx="12" cy="12" r="10" />
<line x1="12" x2="12" y1="8" y2="12" />
<line x1="12" x2="12.01" y1="16" y2="16" />
</svg>
);
}

function ArkProvider(props: PropsWithChildren<ArkProviderProviderProps>) {
const { children, config: baseConfig } = props;
const [owner, setOwner] = useState<string | undefined>(undefined);
Expand Down Expand Up @@ -89,21 +68,6 @@ function ArkProvider(props: PropsWithChildren<ArkProviderProviderProps>) {
fetchOwner();
}, [address, config.starknetProvider, connector]);

if (starknetChain.network !== config.starknetNetwork) {
return (
<div className="flex flex-col items-center justify-center w-full min-h-screen space-y-4">
<div className="flex items-center justify-center rounded-full p-3 bg-red-50">
<AlertCircleIcon className="w-10 h-10 text-red-500" />
</div>
<h1 className="text-3xl font-bold tracking-tighter">Wrong Network</h1>
<p className="mx-auto max-w-[600px] text-center text-gray-500 md:text-xl/relaxed dark:text-gray-400">
Please switch to the <b>{config.starknetNetwork}</b> network in your
connected wallet.
</p>
</div>
);
}

return (
<ConfigDataContext.Provider value={config}>
<OwnerDataContext.Provider value={owner}>
Expand Down

0 comments on commit f0f672f

Please sign in to comment.