-
Notifications
You must be signed in to change notification settings - Fork 89
/
ton-connect-ui-create-options.ts
42 lines (36 loc) · 1.7 KB
/
ton-connect-ui-create-options.ts
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
import { EventDispatcher, ITonConnect, SdkActionEvent } from '@tonconnect/sdk';
import { TonConnectUiOptions } from 'src/models/ton-connect-ui-options';
import { UserActionEvent } from 'src/tracker/types';
export type TonConnectUiCreateOptions =
| TonConnectUiOptionsWithConnector
| TonConnectUiOptionsWithManifest;
export interface TonConnectUiOptionsWithManifest extends TonConnectUiCreateOptionsBase {
/**
* Url to the [manifest]{@link https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest} with the Dapp metadata that will be displayed in the user's wallet.
* If not passed, manifest from `${window.location.origin}/tonconnect-manifest.json` will be taken.
*/
manifestUrl?: string;
}
export interface TonConnectUiOptionsWithConnector extends TonConnectUiCreateOptionsBase {
/**
* TonConnect instance. Can be helpful if you use custom ITonConnect implementation, or use both of @tonconnect/sdk and @tonconnect/ui in your app.
*/
connector?: ITonConnect;
}
export interface TonConnectUiCreateOptionsBase extends TonConnectUiOptions {
/**
* Try to restore existing session and reconnect to the corresponding wallet.
* @default true.
*/
restoreConnection?: boolean;
/**
* HTML element id to attach the modal window element. If not passed, `div#tc-widget-root` in the end of the <body> will be added and used.
* @default `div#tc-widget-root`.
*/
widgetRootId?: string;
/**
* Event dispatcher to track user actions. By default, it uses `window.dispatchEvent` for browser environment.
* @default BrowserEventDispatcher.
*/
eventDispatcher?: EventDispatcher<UserActionEvent | SdkActionEvent>;
}