@tonconnect/ui 0.0.5 → 0.0.6

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 CHANGED
@@ -1,3 +1,168 @@
1
- # TON Connect SDK UI
1
+ # TON Connect UI
2
2
 
3
- ⚠️ API is work in progress right now.
3
+ ⚠️ **API is work in progress right now. Don't use this package in production.**
4
+
5
+ TonConnect UI is a UI kit for TonConnect SDK. Use it to connect your app to TON wallets via TonConnect protocol.
6
+
7
+ If you use React for your dapp, take a look at [TonConnect UI React kit](https://github.com/ton-connect/sdk/tree/main/packages/ui-react).
8
+
9
+ If you want to use TonConnect on the server side, you should use the [TonConnect SDK](https://github.com/ton-connect/sdk/tree/main/packages/sdk).
10
+
11
+ You can find more details and the protocol specification in the [docs](https://github.com/ton-connect/docs).
12
+
13
+ ---
14
+
15
+ [Latest API documentation](https://ton-connect.github.io/sdk/modules/_tonconnect_ui.html)
16
+
17
+ # Getting started
18
+
19
+ ## Installation with npm
20
+ `npm i @tonconnect/ui`
21
+
22
+ # Usage
23
+
24
+ ## Create TonConnectUI instance
25
+ ```ts
26
+ import TonConnectUI from '@tonconnect/ui'
27
+
28
+ const tonConnectUI = new TonConnectUI({
29
+ manifestUrl: 'https://<YOUR_APP_URL>/tonconnect-manifest.json',
30
+ buttonRootId: '<YOUR_CONNECT_BUTTON_ANCHOR_ID>'
31
+ });
32
+ ```
33
+
34
+ See all available options:
35
+ [TonConnectUiOptionsWithManifest](https://ton-connect.github.io/sdk/docs/interfaces/_tonconnect_ui.TonConnectUiOptionsWithManifest.html)
36
+ [TonConnectUiOptionsWithConnector](https://ton-connect.github.io/sdk/docs/interfaces/_tonconnect_ui.TonConnectUiOptionsWithConnector.html)
37
+
38
+ ## Change options if needed
39
+ ```ts
40
+ tonConnectUI.uiOptions = {
41
+ language: 'ru',
42
+ theme: THEME.DARK
43
+ };
44
+ ```
45
+
46
+ UI element will be rerendered after assignation. You should pass only options that you want to change.
47
+ Passed options will be merged with current UI options. Note, that you have to pass object to `tonConnectUI.uiOptions` to keep reactivity.
48
+
49
+ DON'T do this:
50
+ ```ts
51
+ tonConnectUI.uiOptions.language = 'ru'; // WRONG, WILL NOT WORK
52
+ ```
53
+
54
+ [See all available options](https://ton-connect.github.io/sdk/docs/interfaces/_tonconnect_ui.TonConnectUiOptions.html)
55
+
56
+ ## Fetch wallets list
57
+ ```ts
58
+ const walletsList = await tonConnectUI.getWallets();
59
+
60
+ /* walletsList is
61
+ {
62
+ name: string;
63
+ imageUrl: string;
64
+ tondns?: string;
65
+ aboutUrl: string;
66
+ universalLink?: string;
67
+ deepLink?: string;
68
+ bridgeUrl?: string;
69
+ jsBridgeKey?: string;
70
+ injected?: boolean; // true if this wallet is injected to the webpage
71
+ embedded?: boolean; // true if the dapp is opened inside this wallet's browser
72
+ }[]
73
+ */
74
+ ```
75
+
76
+ or
77
+
78
+ ```ts
79
+ const walletsList = await TonConnectUI.getWallets();
80
+ ```
81
+
82
+ ## Call connect
83
+ "TonConnect UI connect button" (which is added at `buttonRootId`) automatically handles clicks and calls connect.
84
+ But you are still able to open "connect modal" programmatically, e.g. after click on your custom connect button.
85
+
86
+ ```ts
87
+ const connectedWallet = await tonConnectUI.connectWallet();
88
+ ```
89
+
90
+ If there is an error while wallet connecting, `TonConnectUIError` or `TonConnectError` will be thrown depends on situation.
91
+
92
+ ## Get current connected Wallet and WalletInfo
93
+ You can use special getters to read current connection state. Note that this getter only represents current value, so they are not reactive.
94
+ To react and handle wallet changes use `onStatusChange` mathod.
95
+
96
+ ```ts
97
+ const currentWallet = tonConnectUI.wallet;
98
+ const currentWalletInfo = tonConnectUI.walletInfo;
99
+ const currentAccount = tonConnectUI.account;
100
+ const currentIsConnectedStatus = tonConnectUI.connected;
101
+ ```
102
+
103
+ ## Subscribe to the connection status changes
104
+ ```js
105
+ const unsubscribe = tonConnectUI.onStatusChange(
106
+ walletAndwalletInfo => {
107
+ // update state/reactive variables to show updates in the ui
108
+ }
109
+ );
110
+
111
+ // call `unsubscribe()` later to save resources when you don't need to listen for updates anymore.
112
+ ```
113
+
114
+ ## Disconnect wallet
115
+ Call to disconnect the wallet.
116
+
117
+ ```ts
118
+ await tonConnectUI.disconnect();
119
+ ```
120
+
121
+ ## Send transaction
122
+ Wallet must be connected when you call `sendTransaction`. Otherwise, an error will be thrown.
123
+
124
+
125
+ ```ts
126
+ const transaction = {
127
+ validUntil: Date.now() + 1000000,
128
+ messages: [
129
+ {
130
+ address: "0:412410771DA82CBA306A55FA9E0D43C9D245E38133CB58F1457DFB8D5CD8892F",
131
+ amount: "20000000",
132
+ stateInit: "base64bocblahblahblah==" // just for instance. Replace with your transaction initState or remove
133
+ },
134
+ {
135
+ address: "0:E69F10CC84877ABF539F83F879291E5CA169451BA7BCE91A37A5CED3AB8080D3",
136
+ amount: "60000000",
137
+ payload: "base64bocblahblahblah==" // just for instance. Replace with your transaction payload or remove
138
+ }
139
+ ]
140
+ }
141
+
142
+ try {
143
+ const result = await tonConnectUI.sendTransaction(transaction);
144
+
145
+ // you can use signed boc to find the transaction
146
+ const someTxData = await myAppExplorerService.getTransaction(result.boc);
147
+ alert('Transaction was sent successfully', someTxData);
148
+ } catch (e) {
149
+ console.error(e);
150
+ }
151
+ ```
152
+
153
+ `sendTransaction` will automatically render informational modals and notifications. You can change its behaviour:
154
+
155
+ ```ts
156
+ const result = await tonConnectUI.sendTransaction(defaultTx, {
157
+ modals: ['before', 'success', 'error'],
158
+ notifications: ['before', 'success', 'error']
159
+ });
160
+ ```
161
+
162
+ Default configuration is:
163
+ ```ts
164
+ const defaultBehaviour = {
165
+ modals: ['before'],
166
+ notifications: ['before', 'success', 'error']
167
+ }
168
+ ```
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { WalletConnectionSource, ITonConnect, Account, Wallet, WalletInfo, TonConnectError, SendTransactionRequest, SendTransactionResponse } from '@tonconnect/sdk';
1
+ import { WalletConnectionSource, ITonConnect, WalletInfo, Account, Wallet, TonConnectError, SendTransactionRequest, SendTransactionResponse } from '@tonconnect/sdk';
2
2
  import { Property } from 'csstype';
3
3
 
4
4
  declare enum THEME {
@@ -47,47 +47,89 @@ declare type Locales = 'en' | 'ru';
47
47
  declare type Color = Property.Color;
48
48
 
49
49
  interface TonConnectUiOptions {
50
+ /**
51
+ * Color theme for the UI elements.
52
+ * @default SYSTEM theme.
53
+ */
50
54
  theme?: Theme;
55
+ /**
56
+ * Accent color for the UI elements.
57
+ * @default #31A6F5 (blue).
58
+ */
51
59
  accentColor?: Color;
60
+ /**
61
+ * HTML element id to attach the wallet connect button. If not passed button won't appear.
62
+ * @default null.
63
+ */
52
64
  buttonRootId?: string | null;
65
+ /**
66
+ * Language for the phrases it the UI elements.
67
+ * @default system
68
+ */
53
69
  language?: Locales;
70
+ /**
71
+ * Configuration for the wallet connect button.
72
+ */
54
73
  buttonConfiguration?: Partial<ButtonConfiguration>;
74
+ /**
75
+ * Configuration for the wallet connect modal and action modals.
76
+ */
55
77
  widgetConfiguration?: Partial<WidgetConfiguration>;
56
78
  }
57
79
 
58
80
  declare type TonConnectUiCreateOptions = TonConnectUiOptionsWithConnector | TonConnectUiOptionsWithManifest;
59
81
  interface TonConnectUiOptionsWithManifest extends TonConnectUiCreateOptionsBase {
82
+ /**
83
+ * 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.
84
+ * If not passed, manifest from `${window.location.origin}/tonconnect-manifest.json` will be taken.
85
+ */
60
86
  manifestUrl?: string;
61
87
  }
62
88
  interface TonConnectUiOptionsWithConnector extends TonConnectUiCreateOptionsBase {
89
+ /**
90
+ * TonConnect instance. Can be helpful if you use custom ITonConnect implementation, or use both of @tonconnect/sdk and @tonconnect/ui in your app.
91
+ */
63
92
  connector?: ITonConnect;
64
93
  }
65
94
  interface TonConnectUiCreateOptionsBase extends TonConnectUiOptions {
95
+ /**
96
+ * Try to restore existing session and reconnect to the corresponding wallet.
97
+ * @default true.
98
+ */
66
99
  restoreConnection?: boolean;
100
+ /**
101
+ * 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.
102
+ * @default `div#tc-widget-root`.
103
+ */
67
104
  widgetRootId?: string;
68
105
  }
69
106
 
70
- declare class TonConnectUi {
107
+ declare class TonConnectUI {
108
+ static getWallets(): Promise<WalletInfo[]>;
71
109
  private readonly walletInfoStorage;
72
110
  private readonly connector;
73
111
  private _walletInfo;
74
112
  private systemThemeChangeUnsubscribe;
75
113
  /**
76
- * Current connection status
114
+ * Current connection status.
77
115
  */
78
116
  get connected(): boolean;
79
117
  /**
80
- * Current connected account or null
118
+ * Current connected account or null.
81
119
  */
82
120
  get account(): Account | null;
83
121
  /**
84
- * Curren connected wallet app or null
122
+ * Curren connected wallet app or null.
85
123
  */
86
124
  get wallet(): Wallet | null;
87
125
  /**
88
- * Curren connected wallet's info or null
126
+ * Curren connected wallet's info or null.
89
127
  */
90
128
  get walletInfo(): WalletInfo | null;
129
+ /**
130
+ * Set and apply new UI options. Object with partial options should be passed. Passed options will be merged with current options.
131
+ * @param options
132
+ */
91
133
  set uiOptions(options: TonConnectUiOptions);
92
134
  constructor(options?: TonConnectUiCreateOptions);
93
135
  /**
@@ -95,8 +137,8 @@ declare class TonConnectUi {
95
137
  */
96
138
  getWallets(): Promise<WalletInfo[]>;
97
139
  /**
98
- * Subscribe to connection status change
99
- * @return function which has to be called to unsubscribe
140
+ * Subscribe to connection status change.
141
+ * @return function which has to be called to unsubscribe.
100
142
  */
101
143
  onStatusChange(callback: (wallet: (Wallet & WalletInfo) | null) => void, errorsHandler?: (err: TonConnectError) => void): ReturnType<ITonConnect['onStatusChange']>;
102
144
  /**
@@ -108,13 +150,13 @@ declare class TonConnectUi {
108
150
  */
109
151
  disconnect(): Promise<void>;
110
152
  /**
111
- * Opens the modal window and handles the tx sending
112
- * @param tx
113
- * @param options
153
+ * Opens the modal window and handles the transaction sending.
154
+ * @param tx transaction to send.
155
+ * @param options modal and notifications behaviour settings. Default is show only 'before' modal and all notifications.
114
156
  */
115
157
  sendTransaction(tx: SendTransactionRequest, options?: {
116
- modals: ('before' | 'success' | 'error')[];
117
- notifications: ('before' | 'success' | 'error')[];
158
+ modals?: ('before' | 'success' | 'error')[];
159
+ notifications?: ('before' | 'success' | 'error')[];
118
160
  }): Promise<SendTransactionResponse>;
119
161
  private subscribeToWalletChange;
120
162
  private updateWalletInfo;
@@ -126,4 +168,4 @@ declare class TonConnectUIError extends TonConnectError {
126
168
  constructor(...args: ConstructorParameters<typeof Error>);
127
169
  }
128
170
 
129
- export { ButtonAppearance, ButtonConfiguration, ButtonSize, Locales, THEME, Theme, Themed, TonConnectUIError, TonConnectUi, TonConnectUiCreateOptions, TonConnectUiCreateOptionsBase, TonConnectUiOptions, TonConnectUiOptionsWithConnector, TonConnectUiOptionsWithManifest, WalletsListConfiguration, WalletsListConfigurationExplicit, WalletsListConfigurationImplicit, WidgetConfiguration, TonConnectUi as default };
171
+ export { ButtonAppearance, ButtonConfiguration, ButtonSize, Locales, THEME, Theme, Themed, TonConnectUI, TonConnectUIError, TonConnectUiCreateOptions, TonConnectUiCreateOptionsBase, TonConnectUiOptions, TonConnectUiOptionsWithConnector, TonConnectUiOptionsWithManifest, WalletsListConfiguration, WalletsListConfigurationExplicit, WalletsListConfigurationImplicit, WidgetConfiguration, TonConnectUI as default };
package/lib/index.js CHANGED
@@ -2688,7 +2688,11 @@ class SessionCrypto {
2688
2688
  const [nonce, internalMessage] = splitToUint8Arrays(message, this.nonceLength);
2689
2689
  const decrypted = nacl.box.open(internalMessage, nonce, senderPublicKey, this.keyPair.secretKey);
2690
2690
  if (!decrypted) {
2691
- throw new Error("Decryption error");
2691
+ throw new Error(`Decryption error:
2692
+ message: ${message.toString()}
2693
+ sender pubkey: ${senderPublicKey.toString()}
2694
+ keypair pubkey: ${this.keyPair.publicKey.toString()}
2695
+ keypair secretkey: ${this.keyPair.secretKey.toString()}`);
2692
2696
  }
2693
2697
  return new TextDecoder().decode(decrypted);
2694
2698
  }
@@ -2890,14 +2894,14 @@ class BridgeGateway {
2890
2894
  });
2891
2895
  }
2892
2896
  close() {
2893
- var _a2;
2897
+ var _a;
2894
2898
  this.isClosed = true;
2895
- (_a2 = this.eventSource) === null || _a2 === void 0 ? void 0 : _a2.close();
2899
+ (_a = this.eventSource) === null || _a === void 0 ? void 0 : _a.close();
2896
2900
  }
2897
2901
  errorsHandler(e2) {
2898
- var _a2, _b;
2902
+ var _a, _b;
2899
2903
  if (!this.isClosed) {
2900
- if (((_a2 = this.eventSource) === null || _a2 === void 0 ? void 0 : _a2.readyState) === EventSource.CLOSED) {
2904
+ if (((_a = this.eventSource) === null || _a === void 0 ? void 0 : _a.readyState) === EventSource.CLOSED) {
2901
2905
  this.eventSource.close();
2902
2906
  this.registerSession();
2903
2907
  return;
@@ -3087,8 +3091,8 @@ class BridgeProvider {
3087
3091
  });
3088
3092
  }
3089
3093
  connect(message) {
3090
- var _a2;
3091
- (_a2 = this.bridge) === null || _a2 === void 0 ? void 0 : _a2.close();
3094
+ var _a;
3095
+ (_a = this.bridge) === null || _a === void 0 ? void 0 : _a.close();
3092
3096
  const sessionCrypto = new SessionCrypto();
3093
3097
  this.session = {
3094
3098
  sessionCrypto,
@@ -3099,9 +3103,9 @@ class BridgeProvider {
3099
3103
  return this.generateUniversalLink(message);
3100
3104
  }
3101
3105
  restoreConnection() {
3102
- var _a2;
3106
+ var _a;
3103
3107
  return __awaiter$4(this, void 0, void 0, function* () {
3104
- (_a2 = this.bridge) === null || _a2 === void 0 ? void 0 : _a2.close();
3108
+ (_a = this.bridge) === null || _a === void 0 ? void 0 : _a.close();
3105
3109
  const storedConnection = yield this.connectionStorage.getHttpConnection();
3106
3110
  if (!storedConnection) {
3107
3111
  return;
@@ -3125,15 +3129,15 @@ class BridgeProvider {
3125
3129
  });
3126
3130
  }
3127
3131
  closeConnection() {
3128
- var _a2;
3129
- (_a2 = this.bridge) === null || _a2 === void 0 ? void 0 : _a2.close();
3132
+ var _a;
3133
+ (_a = this.bridge) === null || _a === void 0 ? void 0 : _a.close();
3130
3134
  this.listeners = [];
3131
3135
  this.session = null;
3132
3136
  this.bridge = null;
3133
3137
  }
3134
3138
  disconnect() {
3135
- var _a2;
3136
- (_a2 = this.bridge) === null || _a2 === void 0 ? void 0 : _a2.close();
3139
+ var _a;
3140
+ (_a = this.bridge) === null || _a === void 0 ? void 0 : _a.close();
3137
3141
  this.listeners = [];
3138
3142
  return this.removeBridgeAndSession();
3139
3143
  }
@@ -3202,8 +3206,8 @@ function getWindow$1() {
3202
3206
  return window;
3203
3207
  }
3204
3208
  function getWebPageManifest() {
3205
- var _a2;
3206
- const origin = (_a2 = getWindow$1()) === null || _a2 === void 0 ? void 0 : _a2.location.origin;
3209
+ var _a;
3210
+ const origin = (_a = getWindow$1()) === null || _a === void 0 ? void 0 : _a.location.origin;
3207
3211
  if (origin) {
3208
3212
  return origin + "/tonconnect-manifest.json";
3209
3213
  }
@@ -3311,10 +3315,10 @@ class InjectedProvider {
3311
3315
  return Promise.resolve();
3312
3316
  }
3313
3317
  closeAllListeners() {
3314
- var _a2;
3318
+ var _a;
3315
3319
  this.listenSubscriptions = false;
3316
3320
  this.listeners = [];
3317
- (_a2 = this.unsubscribeCallback) === null || _a2 === void 0 ? void 0 : _a2.call(this);
3321
+ (_a = this.unsubscribeCallback) === null || _a === void 0 ? void 0 : _a.call(this);
3318
3322
  }
3319
3323
  listen(eventsCallback) {
3320
3324
  this.listeners.push(eventsCallback);
@@ -3551,7 +3555,6 @@ var __rest = globalThis && globalThis.__rest || function(s2, e2) {
3551
3555
  }
3552
3556
  return t2;
3553
3557
  };
3554
- var _a;
3555
3558
  class TonConnect {
3556
3559
  constructor(options) {
3557
3560
  this.walletsList = new WalletsListManager();
@@ -3568,12 +3571,15 @@ class TonConnect {
3568
3571
  }
3569
3572
  this.bridgeConnectionStorage = new BridgeConnectionStorage(this.dappSettings.storage);
3570
3573
  }
3574
+ static getWallets() {
3575
+ return this.walletsList.getWallets();
3576
+ }
3571
3577
  get connected() {
3572
3578
  return this._wallet !== null;
3573
3579
  }
3574
3580
  get account() {
3575
- var _b;
3576
- return ((_b = this._wallet) === null || _b === void 0 ? void 0 : _b.account) || null;
3581
+ var _a;
3582
+ return ((_a = this._wallet) === null || _a === void 0 ? void 0 : _a.account) || null;
3577
3583
  }
3578
3584
  get wallet() {
3579
3585
  return this._wallet;
@@ -3598,11 +3604,11 @@ class TonConnect {
3598
3604
  };
3599
3605
  }
3600
3606
  connect(wallet, request) {
3601
- var _b;
3607
+ var _a;
3602
3608
  if (this.connected) {
3603
3609
  throw new WalletAlreadyConnectedError();
3604
3610
  }
3605
- (_b = this.provider) === null || _b === void 0 ? void 0 : _b.closeConnection();
3611
+ (_a = this.provider) === null || _a === void 0 ? void 0 : _a.closeConnection();
3606
3612
  this.provider = this.createProvider(wallet);
3607
3613
  return this.provider.connect(this.createConnectRequest(request));
3608
3614
  }
@@ -3713,8 +3719,8 @@ class TonConnect {
3713
3719
  }
3714
3720
  }
3715
3721
  checkFeatureSupport(feature) {
3716
- var _b;
3717
- if (!((_b = this.wallet) === null || _b === void 0 ? void 0 : _b.device.features.includes(feature))) {
3722
+ var _a;
3723
+ if (!((_a = this.wallet) === null || _a === void 0 ? void 0 : _a.device.features.includes(feature))) {
3718
3724
  throw new WalletNotSupportFeatureError();
3719
3725
  }
3720
3726
  }
@@ -3736,9 +3742,7 @@ class TonConnect {
3736
3742
  };
3737
3743
  }
3738
3744
  }
3739
- _a = TonConnect;
3740
3745
  TonConnect.walletsList = new WalletsListManager();
3741
- TonConnect.getWallets = _a.walletsList.getWallets();
3742
3746
  function toUserFriendlyAddress(hexAddress) {
3743
3747
  const { wc, hex } = parseHexAddress(hexAddress);
3744
3748
  const bounceableTag = 17;
@@ -6206,17 +6210,17 @@ const TransitionGroup = (props) => {
6206
6210
  };
6207
6211
  function clickOutside$1(el, accessor) {
6208
6212
  const onClick = (e2) => {
6209
- var _a2;
6210
- return !el.contains(e2.target) && ((_a2 = accessor()) == null ? void 0 : _a2());
6213
+ var _a;
6214
+ return !el.contains(e2.target) && ((_a = accessor()) == null ? void 0 : _a());
6211
6215
  };
6212
6216
  document.body.addEventListener("click", onClick);
6213
6217
  onCleanup(() => document.body.removeEventListener("click", onClick));
6214
6218
  }
6215
6219
  function escPressed(_, accessor) {
6216
6220
  const onKeyPress = (e2) => {
6217
- var _a2, _b;
6221
+ var _a, _b;
6218
6222
  if (e2.key === "Escape") {
6219
- (_a2 = document.activeElement) == null ? void 0 : _a2.blur();
6223
+ (_a = document.activeElement) == null ? void 0 : _a.blur();
6220
6224
  (_b = accessor()) == null ? void 0 : _b();
6221
6225
  }
6222
6226
  };
@@ -6521,8 +6525,8 @@ const H1 = (props) => {
6521
6525
  return props.class;
6522
6526
  },
6523
6527
  get children() {
6524
- var _a2;
6525
- return memo(() => !!props.translationKey, true)() ? t2(props.translationKey, props.translationValues, (_a2 = props.children) == null ? void 0 : _a2.toString()) : props.children;
6528
+ var _a;
6529
+ return memo(() => !!props.translationKey, true)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
6526
6530
  }
6527
6531
  });
6528
6532
  };
@@ -6547,8 +6551,8 @@ const H2 = (props) => {
6547
6551
  return props.class;
6548
6552
  },
6549
6553
  get children() {
6550
- var _a2;
6551
- return memo(() => !!props.translationKey, true)() ? t2(props.translationKey, props.translationValues, (_a2 = props.children) == null ? void 0 : _a2.toString()) : props.children;
6554
+ var _a;
6555
+ return memo(() => !!props.translationKey, true)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
6552
6556
  }
6553
6557
  });
6554
6558
  };
@@ -6569,8 +6573,8 @@ const H3 = (props) => {
6569
6573
  const [t2] = useI18n();
6570
6574
  return createComponent(H3Styled, {
6571
6575
  get children() {
6572
- var _a2;
6573
- return memo(() => !!props.translationKey, true)() ? t2(props.translationKey, props.translationValues, (_a2 = props.children) == null ? void 0 : _a2.toString()) : props.children;
6576
+ var _a;
6577
+ return memo(() => !!props.translationKey, true)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
6574
6578
  }
6575
6579
  });
6576
6580
  };
@@ -6613,8 +6617,8 @@ const Text = (inputs) => {
6613
6617
  return props.class;
6614
6618
  },
6615
6619
  get children() {
6616
- var _a2;
6617
- return memo(() => !!props.translationKey, true)() ? t2(props.translationKey, props.translationValues, (_a2 = props.children) == null ? void 0 : _a2.toString()) : props.children;
6620
+ var _a;
6621
+ return memo(() => !!props.translationKey, true)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
6618
6622
  }
6619
6623
  });
6620
6624
  };
@@ -7980,8 +7984,8 @@ const AccountButton = () => {
7980
7984
  }), null);
7981
7985
  insert(_el$, createComponent(NotificationsStyled, {}), null);
7982
7986
  createRenderEffect((_p$) => {
7983
- var _a2, _b;
7984
- const _v$ = position.strategy, _v$2 = `${(_a2 = position.y) != null ? _a2 : 0}px`, _v$3 = `${(_b = position.x) != null ? _b : 0}px`;
7987
+ var _a, _b;
7988
+ const _v$ = position.strategy, _v$2 = `${(_a = position.y) != null ? _a : 0}px`, _v$3 = `${(_b = position.x) != null ? _b : 0}px`;
7985
7989
  _v$ !== _p$._v$ && _el$.style.setProperty("position", _p$._v$ = _v$);
7986
7990
  _v$2 !== _p$._v$2 && _el$.style.setProperty("top", _p$._v$2 = _v$2);
7987
7991
  _v$3 !== _p$._v$3 && _el$.style.setProperty("left", _p$._v$3 = _v$3);
@@ -9712,9 +9716,9 @@ const QRCode = (props) => {
9712
9716
  });
9713
9717
  };
9714
9718
  const Translation = (props) => {
9715
- var _a2;
9719
+ var _a;
9716
9720
  const [t2] = useI18n();
9717
- return t2(props.translationKey, props.translationValues, (_a2 = props.children) == null ? void 0 : _a2.toString());
9721
+ return t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString());
9718
9722
  };
9719
9723
  const QrCodeModalStyled = styled.div`
9720
9724
  padding: 0 24px;
@@ -10023,8 +10027,8 @@ const SelectWalletModal = (props) => {
10023
10027
  };
10024
10028
  const ModalWrapper = styled.div`
10025
10029
  color: ${(props) => {
10026
- var _a2;
10027
- return ((_a2 = props.theme) == null ? void 0 : _a2.accentColor) || "blue";
10030
+ var _a;
10031
+ return ((_a = props.theme) == null ? void 0 : _a.accentColor) || "blue";
10028
10032
  }};
10029
10033
  `;
10030
10034
  const StyledModal = styled(Modal)`
@@ -10266,8 +10270,8 @@ const TransactionSentModal = (props) => {
10266
10270
  const ActionsModal = () => {
10267
10271
  return createComponent(Modal, {
10268
10272
  get opened() {
10269
- var _a2;
10270
- return memo(() => action() !== null, true)() && ((_a2 = action()) == null ? void 0 : _a2.openModal) === true;
10273
+ var _a;
10274
+ return memo(() => action() !== null, true)() && ((_a = action()) == null ? void 0 : _a.openModal) === true;
10271
10275
  },
10272
10276
  onClose: () => setAction(null),
10273
10277
  get children() {
@@ -10519,7 +10523,7 @@ function mergeOptions(options, defaultOptions) {
10519
10523
  isMergeableObject: isPlainObject
10520
10524
  });
10521
10525
  }
10522
- class TonConnectUi {
10526
+ class TonConnectUI {
10523
10527
  constructor(options) {
10524
10528
  __publicField(this, "walletInfoStorage", new WalletInfoStorage());
10525
10529
  __publicField(this, "connector");
@@ -10544,6 +10548,9 @@ class TonConnectUi {
10544
10548
  setAppState({ connector: this.connector });
10545
10549
  widgetController.renderApp(rootId, this);
10546
10550
  }
10551
+ static getWallets() {
10552
+ return TonConnect.getWallets();
10553
+ }
10547
10554
  get connected() {
10548
10555
  return this.connector.connected;
10549
10556
  }
@@ -10557,7 +10564,7 @@ class TonConnectUi {
10557
10564
  return this._walletInfo;
10558
10565
  }
10559
10566
  set uiOptions(options) {
10560
- var _a2;
10567
+ var _a;
10561
10568
  this.checkButtonRootExist(options.buttonRootId);
10562
10569
  if (options.theme === "SYSTEM") {
10563
10570
  setTheme(getSystemTheme());
@@ -10568,7 +10575,7 @@ class TonConnectUi {
10568
10575
  }
10569
10576
  } else {
10570
10577
  if (options.theme) {
10571
- (_a2 = this.systemThemeChangeUnsubscribe) == null ? void 0 : _a2.call(this);
10578
+ (_a = this.systemThemeChangeUnsubscribe) == null ? void 0 : _a.call(this);
10572
10579
  setTheme(options.theme);
10573
10580
  }
10574
10581
  }
@@ -10707,8 +10714,8 @@ class TonConnectUi {
10707
10714
  }
10708
10715
  export {
10709
10716
  THEME,
10717
+ TonConnectUI,
10710
10718
  TonConnectUIError,
10711
- TonConnectUi,
10712
- TonConnectUi as default
10719
+ TonConnectUI as default
10713
10720
  };
10714
10721
  //# sourceMappingURL=index.js.map