@tonconnect/ui 2.1.1-beta.0 → 2.2.0

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/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { WalletInfoInjectable, WalletInfoRemote, RequiredFeatures, VersionEvent, ConnectionEvent, ConnectionRestoringEvent, DisconnectionEvent, TransactionSigningEvent, ITonConnect, EventDispatcher, SdkActionEvent, Wallet, WalletInfo, Account, ConnectAdditionalRequest, TonConnectError, SendTransactionRequest, SendTransactionResponse } from '@tonconnect/sdk';
1
+ import { WalletInfoInjectable, WalletInfoRemote, RequiredFeatures, VersionEvent, ConnectionEvent, ConnectionRestoringEvent, DisconnectionEvent, TransactionSigningEvent, DataSigningEvent, ITonConnect, EventDispatcher, SdkActionEvent, Wallet, FeatureName, WalletInfo, Account, ConnectAdditionalRequest, TonConnectError, SendTransactionRequest, SendTransactionResponse, SignDataPayload, SignDataResponse } from '@tonconnect/sdk';
2
2
  export * from '@tonconnect/sdk';
3
3
  import { Property } from 'csstype';
4
4
 
@@ -161,6 +161,10 @@ interface TonConnectUiOptions {
161
161
  * Required features for wallets. If wallet doesn't support required features, it will be disabled.
162
162
  */
163
163
  walletsRequiredFeatures?: RequiredFeatures;
164
+ /**
165
+ * Preferred features for wallets. If wallet doesn't support preferred features, it will be moved to the end of the list.
166
+ */
167
+ walletsPreferredFeatures?: RequiredFeatures;
164
168
  /**
165
169
  * Configuration for action-period (e.g. sendTransaction) UI elements: modals and notifications and wallet behaviour (return strategy).
166
170
  */
@@ -175,7 +179,7 @@ interface TonConnectUiOptions {
175
179
  /**
176
180
  * User action events.
177
181
  */
178
- declare type UserActionEvent = VersionEvent | ConnectionEvent | ConnectionRestoringEvent | DisconnectionEvent | TransactionSigningEvent;
182
+ declare type UserActionEvent = VersionEvent | ConnectionEvent | ConnectionRestoringEvent | DisconnectionEvent | TransactionSigningEvent | DataSigningEvent;
179
183
 
180
184
  declare type TonConnectUiCreateOptions = TonConnectUiOptionsWithConnector | TonConnectUiOptionsWithManifest;
181
185
  interface TonConnectUiOptionsWithManifest extends TonConnectUiCreateOptionsBase {
@@ -270,10 +274,25 @@ declare type WalletModalClosed = {
270
274
  */
271
275
  closeReason: WalletsModalCloseReason | null;
272
276
  };
277
+ declare type ChooseSupportedFeatureWalletsModal = {
278
+ /**
279
+ * Modal window status.
280
+ */
281
+ status: 'opened';
282
+ /**
283
+ * Always `null` for choose supported feature wallet modal.
284
+ */
285
+ closeReason: null;
286
+ type: 'wallet-not-support-feature';
287
+ requiredFeature: {
288
+ featureName: FeatureName;
289
+ value?: RequiredFeatures['sendTransaction'];
290
+ };
291
+ };
273
292
  /**
274
293
  * Modal window state.
275
294
  */
276
- declare type WalletsModalState = WalletModalOpened | WalletModalClosed;
295
+ declare type WalletsModalState = WalletModalOpened | WalletModalClosed | ChooseSupportedFeatureWalletsModal;
277
296
  /**
278
297
  * Modal window close reason.
279
298
  */
@@ -331,7 +350,10 @@ declare class TonConnectUI {
331
350
  private systemThemeChangeUnsubscribe;
332
351
  private actionsConfiguration?;
333
352
  private readonly walletsList;
334
- readonly walletsRequiredFeatures?: RequiredFeatures;
353
+ private _walletsRequiredFeatures?;
354
+ get walletsRequiredFeatures(): RequiredFeatures | undefined;
355
+ private _walletsPreferredFeatures?;
356
+ get walletsPreferredFeatures(): RequiredFeatures | undefined;
335
357
  private connectRequestParametersCallback?;
336
358
  /**
337
359
  * TonConnect instance.
@@ -444,6 +466,12 @@ declare class TonConnectUI {
444
466
  * @param options modal and notifications behaviour settings. Default is show only 'before' modal and all notifications.
445
467
  */
446
468
  sendTransaction(tx: SendTransactionRequest, options?: ActionConfiguration): Promise<SendTransactionResponse>;
469
+ /**
470
+ * Signs the data and returns the signature.
471
+ * @param data data to sign.
472
+ */
473
+ signData(data: SignDataPayload): Promise<SignDataResponse>;
474
+ private redirectAfterRequestSent;
447
475
  /**
448
476
  * TODO: remove in the next major version.
449
477
  * Initiates a connection with an embedded wallet, awaits its completion, and returns the connected wallet information.
@@ -481,6 +509,17 @@ declare class TonConnectUI {
481
509
  * @internal
482
510
  */
483
511
  private waitForSendTransaction;
512
+ /**
513
+ * Waits for a transaction to be sent based on provided options, returning the transaction response.
514
+ * @param options - Configuration for transaction statuses and errors handling.
515
+ * @options.transaction - Transaction to send.
516
+ * @options.ignoreErrors - If true, ignores errors during waiting, waiting continues until a valid transaction is sent. Default is false.
517
+ * @options.abortSignal - Optional AbortSignal for external cancellation. Throws TonConnectUIError if aborted.
518
+ * @param onRequestSent (optional) will be called after the transaction is sent to the wallet.
519
+ * @throws TonConnectUIError if waiting is aborted or no valid transaction response is received and ignoreErrors is false.
520
+ * @internal
521
+ */
522
+ private waitForSignData;
484
523
  /**
485
524
  * Subscribe to the transaction modal window state changes, returns a function which has to be called to unsubscribe.
486
525
  * @internal