From 2eb87fdc241ff9da4f6062711c64fbab9b0fab4f Mon Sep 17 00:00:00 2001 From: Jonatan Chaverri Date: Tue, 5 Nov 2024 12:36:28 -0600 Subject: [PATCH] fix: use recommended injected connectors --- apps/web/src/providers/starknet.tsx | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/apps/web/src/providers/starknet.tsx b/apps/web/src/providers/starknet.tsx index 4a8b7c9..bb9fa6c 100644 --- a/apps/web/src/providers/starknet.tsx +++ b/apps/web/src/providers/starknet.tsx @@ -1,22 +1,25 @@ import { sepolia } from "@starknet-react/chains"; -import { StarknetConfig, publicProvider } from "@starknet-react/core"; +import { + StarknetConfig, + publicProvider, + useInjectedConnectors, +} from "@starknet-react/core"; import type { Connector } from "@starknet-react/core"; -import { InjectedConnector } from "starknetkit/injected"; +import { argent, braavos } from "@starknet-react/core"; export default function StarknetProvider({ children, }: { children: React.ReactNode; }) { - const connectors = [ - // TODO: add ArgentX - new InjectedConnector({ - options: { id: "argentX" }, - }), - new InjectedConnector({ - options: { id: "braavos" }, - }), - ]; + const { connectors } = useInjectedConnectors({ + // Show these connectors if the user has no connector installed. + recommended: [argent(), braavos()], + // Hide recommended connectors if the user has any connector installed. + includeRecommended: "onlyIfNoConnectors", + // Randomize the order of the connectors. + order: "random", + }); return (