Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 31 additions & 13 deletions web/src/ui/IframeShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,16 @@
function WalletUI({
authQueue,
setAuthQueue,
verificationHash,
}: {
authQueue: AuthorizationRequest[];
setAuthQueue: React.Dispatch<React.SetStateAction<AuthorizationRequest[]>>;
verificationHash: string | null;
}) {
const { currentNetwork } = useNetwork();
const chainInfo = networkToChainInfo(currentNetwork);

const walletAPI = useMemo(
() => WalletApi.create(chainInfo.chainId, chainInfo.version),
[currentNetwork.id],

Check warning on line 103 in web/src/ui/IframeShell.tsx

View workflow job for this annotation

GitHub Actions / Lint & Typecheck

React Hook useMemo has missing dependencies: 'chainInfo.chainId' and 'chainInfo.version'. Either include them or remove the dependency array
);
const onRefreshAccounts = useCallback(async () => {
const normalizedChainInfo = {
Expand All @@ -118,7 +116,7 @@
);
const currentAuth = authQueue[0] ?? null;

const handleAuthApprove = (itemResponses: Record<string, any>) => {

Check warning on line 119 in web/src/ui/IframeShell.tsx

View workflow job for this annotation

GitHub Actions / Lint & Typecheck

Unexpected any. Specify a different type
if (currentAuth) {
walletAPI.resolveAuthorization({
id: currentAuth.id,
Expand All @@ -132,7 +130,7 @@

const handleAuthDeny = () => {
if (currentAuth) {
const itemResponses: Record<string, any> = {};

Check warning on line 133 in web/src/ui/IframeShell.tsx

View workflow job for this annotation

GitHub Actions / Lint & Typecheck

Unexpected any. Specify a different type
for (const item of currentAuth.items) {
itemResponses[item.id] = {
id: item.id,
Expand All @@ -154,10 +152,6 @@
<WalletContext.Provider value={walletContext}>
<CssBaseline />
<App />
{/* Overlay: emoji verification during key exchange */}
<Dialog open={!!verificationHash} fullScreen>
<EmojiVerification verificationHash={verificationHash ?? ""} />
</Dialog>
{/* Overlay: dApp authorization requests */}
{currentAuth && (
<AuthorizationDialog
Expand Down Expand Up @@ -410,8 +404,8 @@
let networkLocked = false;
return async (appId: string, chainInfo: ChainInfo) => {
clearVerificationHashRef.current();
const rawChainId = (chainInfo as any).chainId;

Check warning on line 407 in web/src/ui/IframeShell.tsx

View workflow job for this annotation

GitHub Actions / Lint & Typecheck

Unexpected any. Specify a different type
const rawVersion = (chainInfo as any).version;

Check warning on line 408 in web/src/ui/IframeShell.tsx

View workflow job for this annotation

GitHub Actions / Lint & Typecheck

Unexpected any. Specify a different type
const chainId = rawChainId instanceof Fr ? rawChainId : Fr.fromString(String(rawChainId));
const version = rawVersion instanceof Fr ? rawVersion : Fr.fromString(String(rawVersion));

Expand Down Expand Up @@ -485,9 +479,26 @@
}, []);

// ─── Render: centralized gate sequence ───
//
// The emoji-verification dialog is rendered alongside every gate so it
// can appear during key exchange regardless of which gate is active —
// including the pre-network-lock blank screen. Without this, the iframe
// renders empty while the dApp waits for the user to click an emoji that
// is never shown.

const emojiOverlay = (
<Dialog open={!!verificationHash} fullScreen>
<EmojiVerification verificationHash={verificationHash ?? ""} />
</Dialog>
);

if (gate === "checking") {
return <CssBaseline />;
return (
<>
<CssBaseline />
{emojiOverlay}
</>
);
}

if (gate === "needs-storage" || gate === "needs-visit") {
Expand All @@ -499,6 +510,7 @@
onGrant={handleRequestStorageAccess}
onRetry={handleRetryClick}
/>
{emojiOverlay}
</>
);
}
Expand All @@ -508,6 +520,7 @@
<>
<CssBaseline />
<NoCookieGate onRetry={handleNoCookieRetry} />
{emojiOverlay}
</>
);
}
Expand All @@ -517,6 +530,7 @@
<>
<CssBaseline />
<PinDialog mode="enter" error={pinError} onSubmit={handlePinSubmit} />
{emojiOverlay}
</>
);
}
Expand All @@ -527,15 +541,19 @@
// failed requests and — if the default is unreachable — wedging the
// onboarding "registering contracts" step.
if (!networkLocked) {
return <CssBaseline />;
return (
<>
<CssBaseline />
{emojiOverlay}
</>
);
}

return (
<WalletUI
authQueue={authQueue}
setAuthQueue={setAuthQueue}
verificationHash={verificationHash}
/>
<>
<WalletUI authQueue={authQueue} setAuthQueue={setAuthQueue} />
{emojiOverlay}
</>
);
}

Expand Down
Loading