From b948f83bc5ff0dc558131e516e12f07cb7e3ec06 Mon Sep 17 00:00:00 2001 From: Tarrence van As Date: Tue, 17 Dec 2024 21:14:58 -0500 Subject: [PATCH] Remove chainid timeout --- packages/keychain/src/hooks/connection.ts | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/packages/keychain/src/hooks/connection.ts b/packages/keychain/src/hooks/connection.ts index 4840d6d33..683c247ad 100644 --- a/packages/keychain/src/hooks/connection.ts +++ b/packages/keychain/src/hooks/connection.ts @@ -7,7 +7,7 @@ import { OpenSettingsCtx, } from "utils/connection"; import { getChainName, isIframe } from "@cartridge/utils"; -import { RpcProvider, constants } from "starknet"; +import { RpcProvider } from "starknet"; import { Prefund, ResponseCodes, @@ -29,8 +29,6 @@ import { } from "@cartridge/presets"; import { ParsedSessionPolicies, parseSessionPolicies } from "./session"; -const CHAIN_ID_TIMEOUT = 3000; - type ParentMethods = AsyncMethodReturns<{ close: () => Promise }>; export function useConnectionValue() { @@ -201,17 +199,7 @@ export function useConnectionValue() { const update = async () => { try { let provider = new RpcProvider({ nodeUrl: rpcUrl }); - const timeoutPromise = new Promise((_, reject) => - setTimeout( - () => reject(new Error("Chain ID fetch timed out")), - CHAIN_ID_TIMEOUT, - ), - ); - const chainIdPromise = provider.getChainId(); - let chainId = (await Promise.race([ - chainIdPromise, - timeoutPromise, - ])) as constants.StarknetChainId; + const chainId = await provider.getChainId(); setChainId(chainId); } catch (e) { console.error(e);