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 014011e97..30a664aa3 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 436f88175..bae014f2e 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 a4ec3175c..74f7284b3 100644 --- a/packages/keychain/src/components/connect/CreateSession.tsx +++ b/packages/keychain/src/components/connect/CreateSession.tsx @@ -10,15 +10,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, @@ -33,10 +25,6 @@ export function CreateSession({ const [isConnecting, setIsConnecting] = 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(); @@ -76,26 +64,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 <>; @@ -126,38 +114,19 @@ export function CreateSession({ game={theme.name} contracts={policies.contracts} messages={chainSpecificMessages} + duration={duration} + onDurationChange={setDuration} /> ) : ( )}