-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathrender.tsx
More file actions
51 lines (44 loc) · 1.37 KB
/
Copy pathrender.tsx
File metadata and controls
51 lines (44 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { assert } from '@metamask/superstruct';
import type { SolanaKeyringRequest } from '../../../../core/handlers/onKeyringRequest/structs';
import { SolanaSignInRequestStruct } from '../../../../core/services/wallet/structs';
import { SOL_IMAGE_SVG } from '../../../../core/test/mocks/solana-image-svg';
import {
createInterface,
getPreferences,
showDialog,
} from '../../../../core/utils/interface';
import type { SolanaKeyringAccount } from '../../../../domain';
import type { ConfirmSignInProps } from './ConfirmSignIn';
import { ConfirmSignIn } from './ConfirmSignIn';
/**
* Renders the confirmation dialog for a sign in request.
*
* @param request - The request to confirm.
* @param account - The account that the request is for.
* @returns The confirmation dialog.
*/
export async function render(
request: SolanaKeyringRequest,
account: SolanaKeyringAccount,
) {
assert(request.request, SolanaSignInRequestStruct);
const {
request: { params },
scope,
origin,
} = request;
const preferences = await getPreferences();
const id = await createInterface(
<ConfirmSignIn
params={params as ConfirmSignInProps['params']}
account={account}
scope={scope}
preferences={preferences}
networkImage={SOL_IMAGE_SVG}
origin={origin}
/>,
{},
);
const dialogPromise = showDialog(id);
return dialogPromise;
}