@tonconnect/ui 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +268 -2
- package/dist/tonconnect-ui.min.js +467 -0
- package/dist/tonconnect-ui.min.js.map +1 -0
- package/lib/index.d.ts +122 -43
- package/lib/index.js +767 -461
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +768 -462
- package/lib/index.umd.js.map +1 -1
- package/package.json +6 -5
package/lib/index.d.ts
CHANGED
|
@@ -1,62 +1,136 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WalletInfoBase, WalletInfoInjected, WalletInfoRemote, ITonConnect, WalletInfo, Account, Wallet, TonConnectError, SendTransactionRequest, SendTransactionResponse } from '@tonconnect/sdk';
|
|
2
2
|
import { Property } from 'csstype';
|
|
3
3
|
|
|
4
|
+
declare type Locales = 'en' | 'ru';
|
|
5
|
+
|
|
4
6
|
declare enum THEME {
|
|
5
7
|
DARK = "DARK",
|
|
6
8
|
LIGHT = "LIGHT"
|
|
7
9
|
}
|
|
8
10
|
declare type Theme = THEME | 'SYSTEM';
|
|
9
11
|
|
|
10
|
-
declare type
|
|
12
|
+
declare type BorderRadius = 'm' | 's' | 'none';
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
declare type Color$1 = Property.Color;
|
|
15
|
+
declare type ColorsSet = {
|
|
16
|
+
constant: {
|
|
17
|
+
black: Color$1;
|
|
18
|
+
white: Color$1;
|
|
19
|
+
};
|
|
20
|
+
connectButton: {
|
|
21
|
+
background: Color$1;
|
|
22
|
+
foreground: Color$1;
|
|
23
|
+
};
|
|
24
|
+
accent: Color$1;
|
|
25
|
+
icon: {
|
|
26
|
+
primary: Color$1;
|
|
27
|
+
secondary: Color$1;
|
|
28
|
+
tertiary: Color$1;
|
|
29
|
+
success: Color$1;
|
|
30
|
+
};
|
|
31
|
+
background: {
|
|
32
|
+
primary: Color$1;
|
|
33
|
+
secondary: Color$1;
|
|
34
|
+
};
|
|
35
|
+
text: {
|
|
36
|
+
primary: Color$1;
|
|
37
|
+
subhead: Color$1;
|
|
38
|
+
secondary: Color$1;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
declare type PartialColorsSet = {
|
|
42
|
+
constant?: {
|
|
43
|
+
black?: Color$1;
|
|
44
|
+
white?: Color$1;
|
|
45
|
+
};
|
|
46
|
+
connectButton?: {
|
|
47
|
+
background?: Color$1;
|
|
48
|
+
foreground?: Color$1;
|
|
49
|
+
};
|
|
50
|
+
accent?: Color$1;
|
|
51
|
+
icon?: {
|
|
52
|
+
primary?: Color$1;
|
|
53
|
+
secondary?: Color$1;
|
|
54
|
+
tertiary?: Color$1;
|
|
55
|
+
success?: Color$1;
|
|
56
|
+
};
|
|
57
|
+
background?: {
|
|
58
|
+
primary?: Color$1;
|
|
59
|
+
secondary?: Color$1;
|
|
60
|
+
};
|
|
61
|
+
text?: {
|
|
62
|
+
primary?: Color$1;
|
|
63
|
+
subhead?: Color$1;
|
|
64
|
+
secondary?: Color$1;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
16
67
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
68
|
+
interface UIPreferences {
|
|
69
|
+
/**
|
|
70
|
+
* Color theme for the UI elements.
|
|
71
|
+
* @default SYSTEM theme.
|
|
72
|
+
*/
|
|
73
|
+
theme?: Theme;
|
|
74
|
+
/**
|
|
75
|
+
* Birder radius for UI elements.
|
|
76
|
+
* @default 'm'
|
|
77
|
+
*/
|
|
78
|
+
borderRadius?: BorderRadius;
|
|
79
|
+
/**
|
|
80
|
+
* Configure colors scheme for different themes.
|
|
81
|
+
*/
|
|
82
|
+
colorsSet?: Partial<Record<THEME, PartialColorsSet>>;
|
|
22
83
|
}
|
|
23
84
|
|
|
24
|
-
|
|
25
|
-
name: string;
|
|
26
|
-
iconUrl: string;
|
|
27
|
-
connectionSource: WalletConnectionSource;
|
|
28
|
-
}
|
|
85
|
+
declare type UIWallet = WalletInfoBase & (Omit<WalletInfoInjected, 'injected' | 'embedded'> | WalletInfoRemote);
|
|
29
86
|
|
|
30
87
|
declare type WalletsListConfiguration = WalletsListConfigurationExplicit | WalletsListConfigurationImplicit;
|
|
88
|
+
/**
|
|
89
|
+
* Configure whole list of wallets in the modal. Only passed wallets will be displayed.
|
|
90
|
+
*/
|
|
31
91
|
declare type WalletsListConfigurationExplicit = {
|
|
32
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Allows to configure wallets order and add custom wallets. Must be an array of wallets names from WalletsList or custom wallets.
|
|
94
|
+
*/
|
|
95
|
+
wallets: (string | UIWallet)[];
|
|
33
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* Add corrections to the default wallets list in the modal: exclude some wallets and add custom wallets.
|
|
99
|
+
*/
|
|
34
100
|
declare type WalletsListConfigurationImplicit = {
|
|
101
|
+
/**
|
|
102
|
+
* Allows to exclude wallets from wallets list in the modal by its names. Must be an array of wallet's names from WalletsList.
|
|
103
|
+
*/
|
|
35
104
|
excludeWallets?: string[];
|
|
36
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Allows to include extra wallets to the wallets list in the modal.
|
|
107
|
+
*/
|
|
108
|
+
includeWallets?: UIWallet[];
|
|
109
|
+
/**
|
|
110
|
+
* Allows to specify order of the extra wallets in the wallets list in the modal. Cannot be applied if `includeWallets` is not specified.
|
|
111
|
+
* @default 'end'.
|
|
112
|
+
*/
|
|
113
|
+
includeWalletsOrder?: 'start' | 'end';
|
|
37
114
|
};
|
|
38
115
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
116
|
+
interface ActionConfiguration {
|
|
117
|
+
/**
|
|
118
|
+
* Configure action modals behavior.
|
|
119
|
+
* @default ['before']
|
|
120
|
+
*/
|
|
121
|
+
modals?: ('before' | 'success' | 'error')[] | 'all';
|
|
122
|
+
/**
|
|
123
|
+
* Configure action notifications behavior.
|
|
124
|
+
* @default 'all'
|
|
125
|
+
*/
|
|
126
|
+
notifications?: ('before' | 'success' | 'error')[] | 'all';
|
|
43
127
|
}
|
|
44
128
|
|
|
45
|
-
declare type Locales = 'en' | 'ru';
|
|
46
|
-
|
|
47
|
-
declare type Color = Property.Color;
|
|
48
|
-
|
|
49
129
|
interface TonConnectUiOptions {
|
|
50
130
|
/**
|
|
51
|
-
*
|
|
52
|
-
* @default SYSTEM theme.
|
|
53
|
-
*/
|
|
54
|
-
theme?: Theme;
|
|
55
|
-
/**
|
|
56
|
-
* Accent color for the UI elements.
|
|
57
|
-
* @default #31A6F5 (blue).
|
|
131
|
+
* UI elements configuration.
|
|
58
132
|
*/
|
|
59
|
-
|
|
133
|
+
uiPreferences?: UIPreferences;
|
|
60
134
|
/**
|
|
61
135
|
* HTML element id to attach the wallet connect button. If not passed button won't appear.
|
|
62
136
|
* @default null.
|
|
@@ -68,13 +142,17 @@ interface TonConnectUiOptions {
|
|
|
68
142
|
*/
|
|
69
143
|
language?: Locales;
|
|
70
144
|
/**
|
|
71
|
-
* Configuration for the
|
|
145
|
+
* Configuration for the wallets list in the connect wallet modal.
|
|
146
|
+
*/
|
|
147
|
+
walletsList?: WalletsListConfiguration;
|
|
148
|
+
/**
|
|
149
|
+
* Configuration for action-period (e.g. sendTransaction) UI elements: modals and notifications.
|
|
72
150
|
*/
|
|
73
|
-
|
|
151
|
+
actionsConfiguration?: ActionConfiguration;
|
|
74
152
|
/**
|
|
75
|
-
*
|
|
153
|
+
* @deprecated Don't use it
|
|
76
154
|
*/
|
|
77
|
-
|
|
155
|
+
walletsListSource?: string;
|
|
78
156
|
}
|
|
79
157
|
|
|
80
158
|
declare type TonConnectUiCreateOptions = TonConnectUiOptionsWithConnector | TonConnectUiOptionsWithManifest;
|
|
@@ -110,6 +188,7 @@ declare class TonConnectUI {
|
|
|
110
188
|
private readonly connector;
|
|
111
189
|
private _walletInfo;
|
|
112
190
|
private systemThemeChangeUnsubscribe;
|
|
191
|
+
private actionsConfiguration?;
|
|
113
192
|
/**
|
|
114
193
|
* Current connection status.
|
|
115
194
|
*/
|
|
@@ -154,18 +233,18 @@ declare class TonConnectUI {
|
|
|
154
233
|
* @param tx transaction to send.
|
|
155
234
|
* @param options modal and notifications behaviour settings. Default is show only 'before' modal and all notifications.
|
|
156
235
|
*/
|
|
157
|
-
sendTransaction(tx: SendTransactionRequest, options?:
|
|
158
|
-
modals?: ('before' | 'success' | 'error')[];
|
|
159
|
-
notifications?: ('before' | 'success' | 'error')[];
|
|
160
|
-
}): Promise<SendTransactionResponse>;
|
|
236
|
+
sendTransaction(tx: SendTransactionRequest, options?: ActionConfiguration): Promise<SendTransactionResponse>;
|
|
161
237
|
private subscribeToWalletChange;
|
|
162
238
|
private updateWalletInfo;
|
|
163
239
|
private normalizeWidgetRoot;
|
|
164
240
|
private checkButtonRootExist;
|
|
241
|
+
private getModalsAndNotificationsConfiguration;
|
|
165
242
|
}
|
|
166
243
|
|
|
244
|
+
declare type Color = Property.Color;
|
|
245
|
+
|
|
167
246
|
declare class TonConnectUIError extends TonConnectError {
|
|
168
247
|
constructor(...args: ConstructorParameters<typeof Error>);
|
|
169
248
|
}
|
|
170
249
|
|
|
171
|
-
export {
|
|
250
|
+
export { ActionConfiguration, BorderRadius, Color, ColorsSet, Locales, PartialColorsSet, THEME, Theme, TonConnectUI, TonConnectUIError, TonConnectUiCreateOptions, TonConnectUiCreateOptionsBase, TonConnectUiOptions, TonConnectUiOptionsWithConnector, TonConnectUiOptionsWithManifest, UIPreferences, UIWallet, WalletsListConfiguration, WalletsListConfigurationExplicit, WalletsListConfigurationImplicit, TonConnectUI as default };
|