diff --git a/packages/keychain/__image_snapshots__/components-connect-createsession--default-chromium.png b/packages/keychain/__image_snapshots__/components-connect-createsession--default-chromium.png index dd8bf67dc..97c23a152 100644 Binary files a/packages/keychain/__image_snapshots__/components-connect-createsession--default-chromium.png and b/packages/keychain/__image_snapshots__/components-connect-createsession--default-chromium.png differ diff --git a/packages/keychain/__image_snapshots__/components-connect-createsession--with-preset-chromium.png b/packages/keychain/__image_snapshots__/components-connect-createsession--with-preset-chromium.png index 94e6316e8..c74796d14 100644 Binary files a/packages/keychain/__image_snapshots__/components-connect-createsession--with-preset-chromium.png and b/packages/keychain/__image_snapshots__/components-connect-createsession--with-preset-chromium.png differ diff --git a/packages/keychain/src/components/connect/CreateSession.tsx b/packages/keychain/src/components/connect/CreateSession.tsx index 865dd7101..68b4e5221 100644 --- a/packages/keychain/src/components/connect/CreateSession.tsx +++ b/packages/keychain/src/components/connect/CreateSession.tsx @@ -1,7 +1,7 @@ import { Container, Content, Footer } from "@/components/layout"; import { BigNumberish, shortString } from "starknet"; import { ControllerError } from "@/utils/connection"; -import { useCallback, useEffect, useMemo, useState } from "react"; +import { useCallback, useEffect, useState } from "react"; import { useConnection } from "@/hooks/connection"; import { ControllerErrorAlert } from "@/components/ErrorAlert"; import { SessionConsent } from "@/components/connect"; @@ -12,15 +12,7 @@ import { ParsedSessionPolicies } from "@/hooks/session"; import { UnverifiedSessionSummary } from "@/components/session/UnverifiedSessionSummary"; import { VerifiedSessionSummary } from "@/components/session/VerifiedSessionSummary"; import { DEFAULT_SESSION_DURATION } from "@/const"; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, - Button, - Checkbox, -} from "@cartridge/ui-next"; +import { Button, Checkbox } from "@cartridge/ui-next"; export function CreateSession({ policies, @@ -36,10 +28,6 @@ export function CreateSession({ const [isDisabled, setIsDisabled] = useState(false); const [isConsent, setIsConsent] = useState(false); const [duration, setDuration] = useState(DEFAULT_SESSION_DURATION); - const expiresAt = useMemo( - () => duration + BigInt(Math.floor(Date.now() / 1000)), - [duration], - ); const [maxFee] = useState(); const [error, setError] = useState(); @@ -93,26 +81,26 @@ export function CreateSession({ }); } - await controller.createSession(expiresAt, policies, maxFee); + await controller.createSession(duration, policies, maxFee); onConnect(); } catch (e) { setError(e as unknown as Error); setIsConnecting(false); } - }, [controller, expiresAt, policies, maxFee, onConnect]); + }, [controller, duration, policies, maxFee, onConnect]); const onSkipSession = useCallback(async () => { if (!controller || !policies) return; try { setError(undefined); setIsConnecting(true); - await controller.createSession(expiresAt, policies, maxFee); + await controller.createSession(duration, policies, maxFee); onConnect(); } catch (e) { setError(e as unknown as Error); setIsConnecting(false); } - }, [controller, expiresAt, policies, maxFee, onConnect]); + }, [controller, duration, policies, maxFee, onConnect]); if (!upgrade.isSynced) { return <>; @@ -139,35 +127,21 @@ export function CreateSession({ {policies?.verified ? ( - + ) : ( - + )}