@tonconnect/ui 2.4.0-beta.0 → 2.4.0-beta.1

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, DataSigningEvent, WalletModalOpenedEvent, SelectedWalletEvent, EventDispatcher, SdkActionEvent, ITonConnect, Wallet, OptionalTraceable, FeatureName, WalletInfo, Account, ConnectAdditionalRequest, TonConnectError, SendTransactionRequest, SendTransactionResponse, SignDataPayload, SignDataResponse } from '@tonconnect/sdk';
1
+ import { WalletInfoInjectable, WalletInfoRemote, RequiredFeatures, VersionEvent, ConnectionEvent, ConnectionRestoringEvent, DisconnectionEvent, TransactionSigningEvent, DataSigningEvent, WalletModalOpenedEvent, SelectedWalletEvent, EventDispatcher, SdkActionEvent, ITonConnect, Wallet, OptionalTraceable, FeatureName, WalletInfo, Account, ConnectAdditionalRequest, ChainId, TonConnectError, SendTransactionRequest, SendTransactionResponse, SignDataPayload, SignDataResponse } from '@tonconnect/sdk';
2
2
  export * from '@tonconnect/sdk';
3
3
  import { Property } from 'csstype';
4
4
 
@@ -404,6 +404,12 @@ declare class TonConnectUI {
404
404
  * If `connectRequestParameters.state` was changed to 'ready' or it's value has been changed, QR will be re-rendered.
405
405
  */
406
406
  setConnectRequestParameters(connectRequestParameters: Loadable<ConnectAdditionalRequest> | undefined | null): void;
407
+ /**
408
+ * Set desired network for the connection. Can only be set before connecting.
409
+ * If wallet connects with a different chain, the SDK will throw an error and abort connection.
410
+ * @param network desired network id (e.g., '-239', '-3', or custom). Pass undefined to allow any network.
411
+ */
412
+ setConnectionNetwork(network?: ChainId): void;
407
413
  /**
408
414
  * Returns available wallets list.
409
415
  */
package/lib/index.mjs CHANGED
@@ -50,7 +50,7 @@ var __async = (__this, __arguments, generator) => {
50
50
  });
51
51
  };
52
52
  var _a, _b, _c, _d, _e, _f, _g, _h;
53
- import { TonConnectError, isWalletInfoCurrentlyInjected, toUserFriendlyAddress, CHAIN, TonConnect, isTelegramUrl, decodeTelegramUrlParameters, encodeTelegramUrlParameters, WalletMissingRequiredFeaturesError, isWalletInfoRemote, checkRequiredWalletFeatures, isConnectUrl, UUIDv7, isWalletInfoCurrentlyEmbedded, createVersionInfo, createResponseVersionEvent, createRequestVersionEvent, createWalletModalOpenedEvent, createSelectedWalletEvent, createConnectionStartedEvent, createConnectionCompletedEvent, createConnectionErrorEvent, createConnectionRestoringStartedEvent, createConnectionRestoringCompletedEvent, createConnectionRestoringErrorEvent, createDisconnectionEvent, createTransactionSentForSignatureEvent, createTransactionSignedEvent, createTransactionSigningFailedEvent, createDataSentForSignatureEvent, createDataSignedEvent, createDataSigningFailedEvent, BrowserEventDispatcher, WalletNotSupportFeatureError, SessionCrypto } from "@tonconnect/sdk";
53
+ import { TonConnectError, isWalletInfoCurrentlyInjected, toUserFriendlyAddress, CHAIN, TonConnect, isTelegramUrl, decodeTelegramUrlParameters, encodeTelegramUrlParameters, WalletMissingRequiredFeaturesError, WalletWrongNetworkError, isWalletInfoRemote, checkRequiredWalletFeatures, isConnectUrl, UUIDv7, isWalletInfoCurrentlyEmbedded, createVersionInfo, createResponseVersionEvent, createRequestVersionEvent, createWalletModalOpenedEvent, createSelectedWalletEvent, createConnectionStartedEvent, createConnectionCompletedEvent, createConnectionErrorEvent, createConnectionRestoringStartedEvent, createConnectionRestoringCompletedEvent, createConnectionRestoringErrorEvent, createDisconnectionEvent, createTransactionSentForSignatureEvent, createTransactionSignedEvent, createTransactionSigningFailedEvent, createDataSentForSignatureEvent, createDataSignedEvent, createDataSigningFailedEvent, BrowserEventDispatcher, WalletNotSupportFeatureError, SessionCrypto } from "@tonconnect/sdk";
54
54
  export * from "@tonconnect/sdk";
55
55
  import UAParser from "ua-parser-js";
56
56
  import deepmerge from "deepmerge";
@@ -1974,7 +1974,7 @@ const common$1 = { "close": "Close", "openWallet": "Open wallet", "copyLink": "C
1974
1974
  const button$1 = { "connectWallet": "Connect Wallet", "dropdown": { "copy": "Copy address", "copied": "Address copied!", "disconnect": "Disconnect" } };
1975
1975
  const notifications$1 = { "confirm": { "header": "Open {{ name }} to confirm the transaction." }, "transactionSent": { "header": "Transaction sent", "text": "Your transaction will be processed in a few seconds." }, "transactionCanceled": { "header": "Transaction canceled", "text": "There will be no changes to your account." }, "dataSigned": { "header": "Data signed" }, "signDataCanceled": { "header": "Sign data canceled" } };
1976
1976
  const walletItem$1 = { "walletOn": "Wallet in", "recent": "Recent", "installed": "Installed", "popular": "Popular" };
1977
- const walletModal$1 = { "loading": "Loading wallets", "wallets": "Wallets", "mobileUniversalModal": { "connectYourWallet": "Connect your TON wallet", "openWalletOnTelegramOrSelect": "Use Wallet in Telegram or choose other application", "openWalletOnTelegram": "Connect Wallet in Telegram", "chooseOtherApplication": "Choose other application", "openLink": "Open Link", "scan": "Scan with your mobile wallet" }, "desktopUniversalModal": { "connectYourWallet": "Connect your TON wallet", "scan": "Scan with your mobile wallet", "availableWallets": "Available wallets" }, "mobileConnectionModal": { "showQR": "Show QR Code", "scanQR": "Scan the QR code below with your phone’s or {{ name }}’s camera", "missingFeatures": "Please update {{ name }}, your version does not support required features for this dApp", "notSupportedWallet": "{{ name }} doesn’t support the requested action. Please connect another wallet that supports it", "continueIn": "Continue in {{ name }}…", "updateWallet": "Update {{ name }}", "chooseAnotherWallet": "Choose Another Wallet", "connectionDeclined": "Connection declined" }, "desktopConnectionModal": { "scanQR": "Scan the QR code below with your phone’s or {{ name }}’s camera", "continueInExtension": "Continue in {{ name }} browser extension…", "dontHaveExtension": "Seems you don't have installed {{ name }} browser extension", "missingFeatures": "Please update {{ name }}, your version does not support required features for this dApp", "notSupportedWallet": "{{ name }} doesn’t support the requested action. Please connect another wallet that supports it", "getWallet": "Get {{ name }}", "updateWallet": "Update {{ name }}", "chooseAnotherWallet": "Choose Another Wallet", "continueOnDesktop": "Continue in {{ name }} on desktop…", "openWalletOnTelegram": "Connect Wallet in Telegram on desktop", "connectionDeclined": "Connection declined" }, "infoModal": { "whatIsAWallet": "What is a wallet", "secureDigitalAssets": "Secure digital assets storage", "walletProtects": "A wallet protects and manages your digital assets including TON, tokens and collectables.", "controlIdentity": "Control your Web3 identity", "manageIdentity": "Manage your digital identity and access decentralized applications with ease. Maintain control over your data and engage securely in the blockchain ecosystem.", "effortlessCryptoTransactions": "Effortless crypto transactions", "easilySend": "Easily send, receive, monitor your cryptocurrencies. Streamline your operations with decentralized applications.", "getAWallet": "Get a Wallet" }, "restoreModal": { "title": "Restore", "step1": { "title": "Find your current recovery phrase", "text": "Open your wallet settings and locate the recovery phrase" }, "step2": { "title": "Copy your recovery phrase", "text": "Write it down or copy it to a safe place" }, "step3": { "title": "Restore in a supported wallet", "text": "Enter the recovery phrase to access your wallet" } }, "allWallets": { "walletsBelowNotSupported": "The wallets below don’t support all features of the connected service. You can use your recovery phrase in one of the supported wallets above.", "walletNotSupportService": "{{ name }} doesn’t support connected service" }, "featureNotSupported": { "wallet": { "title": "{{ name }} doesn’t support the requested action", "description": "Install a supported wallet from the list below, restore it with your recovery phrase, then connect it and try again.", "info": "Learn how to restore your wallet" }, "version": { "description": "Your current version of {{ name }} or wallet contract type doesn't support the required features. Please update it to continue.", "updateButton": "Update {{ name }}", "aboutW5": "About W5" }, "disconnect": { "title": "Confirm Disconnect", "description": "You will be disconnected from your current wallet and redirected to connect {{ name }}.", "button": "Disconnect" } } };
1977
+ const walletModal$1 = { "loading": "Loading wallets", "wallets": "Wallets", "mobileUniversalModal": { "connectYourWallet": "Connect your TON wallet", "openWalletOnTelegramOrSelect": "Use Wallet in Telegram or choose other application", "openWalletOnTelegram": "Connect Wallet in Telegram", "chooseOtherApplication": "Choose other application", "openLink": "Open Link", "scan": "Scan with your mobile wallet" }, "desktopUniversalModal": { "connectYourWallet": "Connect your TON wallet", "scan": "Scan with your mobile wallet", "availableWallets": "Available wallets" }, "mobileConnectionModal": { "showQR": "Show QR Code", "scanQR": "Scan the QR code below with your phone’s or {{ name }}’s camera", "missingFeatures": "Please update {{ name }}, your version does not support required features for this dApp", "wrongNetwork": "Connected wallet is on a different network. Please switch network in {{ name }} and try again", "notSupportedWallet": "{{ name }} doesn’t support the requested action. Please connect another wallet that supports it", "continueIn": "Continue in {{ name }}…", "updateWallet": "Update {{ name }}", "chooseAnotherWallet": "Choose Another Wallet", "connectionDeclined": "Connection declined" }, "desktopConnectionModal": { "scanQR": "Scan the QR code below with your phone’s or {{ name }}’s camera", "continueInExtension": "Continue in {{ name }} browser extension…", "dontHaveExtension": "Seems you don't have installed {{ name }} browser extension", "missingFeatures": "Please update {{ name }}, your version does not support required features for this dApp", "wrongNetwork": "Connected wallet is on a different network. Please switch network in {{ name }} and try again", "notSupportedWallet": "{{ name }} doesn’t support the requested action. Please connect another wallet that supports it", "getWallet": "Get {{ name }}", "updateWallet": "Update {{ name }}", "chooseAnotherWallet": "Choose Another Wallet", "continueOnDesktop": "Continue in {{ name }} on desktop…", "openWalletOnTelegram": "Connect Wallet in Telegram on desktop", "connectionDeclined": "Connection declined" }, "infoModal": { "whatIsAWallet": "What is a wallet", "secureDigitalAssets": "Secure digital assets storage", "walletProtects": "A wallet protects and manages your digital assets including TON, tokens and collectables.", "controlIdentity": "Control your Web3 identity", "manageIdentity": "Manage your digital identity and access decentralized applications with ease. Maintain control over your data and engage securely in the blockchain ecosystem.", "effortlessCryptoTransactions": "Effortless crypto transactions", "easilySend": "Easily send, receive, monitor your cryptocurrencies. Streamline your operations with decentralized applications.", "getAWallet": "Get a Wallet" }, "restoreModal": { "title": "Restore", "step1": { "title": "Find your current recovery phrase", "text": "Open your wallet settings and locate the recovery phrase" }, "step2": { "title": "Copy your recovery phrase", "text": "Write it down or copy it to a safe place" }, "step3": { "title": "Restore in a supported wallet", "text": "Enter the recovery phrase to access your wallet" } }, "allWallets": { "walletsBelowNotSupported": "The wallets below don’t support all features of the connected service. You can use your recovery phrase in one of the supported wallets above.", "walletNotSupportService": "{{ name }} doesn’t support connected service" }, "featureNotSupported": { "wallet": { "title": "{{ name }} doesn’t support the requested action", "description": "Install a supported wallet from the list below, restore it with your recovery phrase, then connect it and try again.", "info": "Learn how to restore your wallet" }, "version": { "description": "Your current version of {{ name }} or wallet contract type doesn't support the required features. Please update it to continue.", "updateButton": "Update {{ name }}", "aboutW5": "About W5" }, "disconnect": { "title": "Confirm Disconnect", "description": "You will be disconnected from your current wallet and redirected to connect {{ name }}.", "button": "Disconnect" } } };
1978
1978
  const actionModal$1 = { "confirmTransaction": { "header": "Confirm the transaction in {{ name }}", "text": "It will only take a moment." }, "signData": { "header": "Sign the data in {{ name }}", "text": "It will only take a moment." }, "transactionSent": "$notifications.transactionSent", "transactionCanceled": "$notifications.transactionCanceled", "dataSigned": "$notifications.dataSigned", "signDataCanceled": "$notifications.signDataCanceled" };
1979
1979
  const en = {
1980
1980
  common: common$1,
@@ -1988,7 +1988,7 @@ const common = { "close": "Закрыть", "openWallet": "Открыть кош
1988
1988
  const button = { "connectWallet": "Подключить кошелёк", "dropdown": { "copy": "Скопировать адрес", "copied": "Адрес скопирован!", "disconnect": "Отключить кошелёк" } };
1989
1989
  const notifications = { "confirm": { "header": "Откройте {{ name }}, чтобы подтвердить транзакцию." }, "transactionSent": { "header": "Транзакция отправлена", "text": "Ваша транзакция будет обработана через несколько секунд." }, "transactionCanceled": { "header": "Транзакция отменена", "text": "Состояние вашего счёта не изменится." }, "dataSigned": { "header": "Данные подписаны" }, "signDataCanceled": { "header": "Подпись данных отменена" } };
1990
1990
  const walletItem = { "walletOn": "Wallet в", "recent": "Недавний", "installed": "Установлен", "popular": "Популярен" };
1991
- const walletModal = { "loading": "Кошельки загружаются", "wallets": "Кошельки", "mobileUniversalModal": { "connectYourWallet": "Подключите TON кошелёк", "openWalletOnTelegramOrSelect": "Подключите Wallet в Telegram или выберете другое приложение", "openWalletOnTelegram": "Открыть Wallet в Telegram", "chooseOtherApplication": "Выберите другое приложение", "openLink": "Открыть", "scan": "Отсканируйте камерой вашего телефона" }, "desktopUniversalModal": { "connectYourWallet": "Подключите TON кошелёк", "scan": "Отсканируйте QR-код камерой вашего телефона", "availableWallets": "Доступные кошельки" }, "mobileConnectionModal": { "showQR": "Показать QR-код", "scanQR": "Отсканируйте QR-код ниже камерой в приложении {{ name }}, или камерой телефона", "missingFeatures": "Обновите {{ name }}, ваша версия не поддерживает необходимые функции для этого dApp", "notSupportedWallet": "{{ name }} не поддерживает запрошенное действие. Пожалуйста, подключите другой кошелёк, который поддерживает это", "continueIn": "Продолжите в {{ name }}…", "updateWallet": "Обновить {{ name }}", "chooseAnotherWallet": "Выбрать другой кошелёк", "connectionDeclined": "Подключение отклонено" }, "desktopConnectionModal": { "scanQR": "Отсканируйте QR-код ниже камерой в приложении {{ name }}, или камерой телефона", "continueInExtension": "Откройте браузерное расширение {{ name }}", "dontHaveExtension": "Похоже, у вас не установлено браузерное расширение {{ name }}", "missingFeatures": "Обновите {{ name }}, ваша версия не поддерживает необходимые функции для этого dApp", "notSupportedWallet": "{{ name }} не поддерживает запрошенное действие. Пожалуйста, подключите другой кошелёк, который поддерживает это", "getWallet": "Скачать {{ name }}", "updateWallet": "Обновить {{ name }}", "chooseAnotherWallet": "Выбрать другой кошелёк", "continueOnDesktop": "Откройте {{ name }} на компьютере…", "openWalletOnTelegram": "Открыть Wallet в Telegram", "connectionDeclined": "Подключение отклонено" }, "infoModal": { "whatIsAWallet": "Что такое кошелёк?", "secureDigitalAssets": "Надежное хранилище цифровых активов", "walletProtects": "Кошелёк защищает ваши цифровые активы, включая TON, токены и предметы коллекционирования, и управляет ими.", "controlIdentity": "Контроль своей личности Web3", "manageIdentity": "Управляйте своей цифровой идентификацией и с легкостью получайте доступ к децентрализованным приложениям. Сохраняйте контроль над своими данными и безопасно участвуйте в экосистеме блокчейна.", "effortlessCryptoTransactions": "Простые криптотранзакции", "easilySend": "Легко отправляйте, получайте и отслеживайте свои криптовалюты. Оптимизируйте свои операции с помощью децентрализованных приложений.", "getAWallet": "Скачать кошелёк" }, "restoreModal": { "title": "Восстановление", "step1": { "title": "Найдите вашу текущую фразу восстановления", "text": "Откройте настройки кошелька и найдите фразу восстановления" }, "step2": { "title": "Скопируйте вашу фразу восстановления", "text": "Запишите её или сохраните в безопасном месте" }, "step3": { "title": "Восстановите в поддерживаемом кошельке", "text": "Введите фразу восстановления для доступа к вашему кошельку" } }, "allWallets": { "walletsBelowNotSupported": "Кошельки ниже не поддерживают все функции подключённого сервиса. Вы можете использовать свою фразу восстановления в одном из поддерживаемых выше кошельков.", "walletNotSupportService": "{{ name }} не поддерживает подключённый сервис" }, "featureNotSupported": { "wallet": { "title": "{{ name }} не поддерживает запрошенное действие", "description": "Установите поддерживаемый кошелёк из списка ниже, восстановите его с помощью фразы восстановления, затем подключитесь и попробуйте снова.", "info": "Узнать, как восстановить кошелёк" }, "version": { "description": "Текущая версия {{ name }} или тип контракта кошелька не поддерживает необходимые функции. Обновите кошелёк, чтобы продолжить.", "updateButton": "Обновить {{ name }}", "aboutW5": "Про W5" }, "disconnect": { "title": "Подтвердите отключение", "description": "Вы будете отключены от текущего кошелька и перенаправлены на подключение {{ name }}.", "button": "Отключиться" } } };
1991
+ const walletModal = { "loading": "Кошельки загружаются", "wallets": "Кошельки", "mobileUniversalModal": { "connectYourWallet": "Подключите TON кошелёк", "openWalletOnTelegramOrSelect": "Подключите Wallet в Telegram или выберете другое приложение", "openWalletOnTelegram": "Открыть Wallet в Telegram", "chooseOtherApplication": "Выберите другое приложение", "openLink": "Открыть", "scan": "Отсканируйте камерой вашего телефона" }, "desktopUniversalModal": { "connectYourWallet": "Подключите TON кошелёк", "scan": "Отсканируйте QR-код камерой вашего телефона", "availableWallets": "Доступные кошельки" }, "mobileConnectionModal": { "showQR": "Показать QR-код", "scanQR": "Отсканируйте QR-код ниже камерой в приложении {{ name }}, или камерой телефона", "missingFeatures": "Обновите {{ name }}, ваша версия не поддерживает необходимые функции для этого dApp", "wrongNetwork": "Подключённый кошелёк находится в другой сети. Пожалуйста, переключите сеть в {{ name }} и попробуйте снова", "notSupportedWallet": "{{ name }} не поддерживает запрошенное действие. Пожалуйста, подключите другой кошелёк, который поддерживает это", "continueIn": "Продолжите в {{ name }}…", "updateWallet": "Обновить {{ name }}", "chooseAnotherWallet": "Выбрать другой кошелёк", "connectionDeclined": "Подключение отклонено" }, "desktopConnectionModal": { "scanQR": "Отсканируйте QR-код ниже камерой в приложении {{ name }}, или камерой телефона", "continueInExtension": "Откройте браузерное расширение {{ name }}", "dontHaveExtension": "Похоже, у вас не установлено браузерное расширение {{ name }}", "missingFeatures": "Обновите {{ name }}, ваша версия не поддерживает необходимые функции для этого dApp", "wrongNetwork": "Подключённый кошелёк находится в другой сети. Пожалуйста, переключите сеть в {{ name }} и попробуйте снова", "notSupportedWallet": "{{ name }} не поддерживает запрошенное действие. Пожалуйста, подключите другой кошелёк, который поддерживает это", "getWallet": "Скачать {{ name }}", "updateWallet": "Обновить {{ name }}", "chooseAnotherWallet": "Выбрать другой кошелёк", "continueOnDesktop": "Откройте {{ name }} на компьютере…", "openWalletOnTelegram": "Открыть Wallet в Telegram", "connectionDeclined": "Подключение отклонено" }, "infoModal": { "whatIsAWallet": "Что такое кошелёк?", "secureDigitalAssets": "Надежное хранилище цифровых активов", "walletProtects": "Кошелёк защищает ваши цифровые активы, включая TON, токены и предметы коллекционирования, и управляет ими.", "controlIdentity": "Контроль своей личности Web3", "manageIdentity": "Управляйте своей цифровой идентификацией и с легкостью получайте доступ к децентрализованным приложениям. Сохраняйте контроль над своими данными и безопасно участвуйте в экосистеме блокчейна.", "effortlessCryptoTransactions": "Простые криптотранзакции", "easilySend": "Легко отправляйте, получайте и отслеживайте свои криптовалюты. Оптимизируйте свои операции с помощью децентрализованных приложений.", "getAWallet": "Скачать кошелёк" }, "restoreModal": { "title": "Восстановление", "step1": { "title": "Найдите вашу текущую фразу восстановления", "text": "Откройте настройки кошелька и найдите фразу восстановления" }, "step2": { "title": "Скопируйте вашу фразу восстановления", "text": "Запишите её или сохраните в безопасном месте" }, "step3": { "title": "Восстановите в поддерживаемом кошельке", "text": "Введите фразу восстановления для доступа к вашему кошельку" } }, "allWallets": { "walletsBelowNotSupported": "Кошельки ниже не поддерживают все функции подключённого сервиса. Вы можете использовать свою фразу восстановления в одном из поддерживаемых выше кошельков.", "walletNotSupportService": "{{ name }} не поддерживает подключённый сервис" }, "featureNotSupported": { "wallet": { "title": "{{ name }} не поддерживает запрошенное действие", "description": "Установите поддерживаемый кошелёк из списка ниже, восстановите его с помощью фразы восстановления, затем подключитесь и попробуйте снова.", "info": "Узнать, как восстановить кошелёк" }, "version": { "description": "Текущая версия {{ name }} или тип контракта кошелька не поддерживает необходимые функции. Обновите кошелёк, чтобы продолжить.", "updateButton": "Обновить {{ name }}", "aboutW5": "Про W5" }, "disconnect": { "title": "Подтвердите отключение", "description": "Вы будете отключены от текущего кошелька и перенаправлены на подключение {{ name }}.", "button": "Отключиться" } } };
1992
1992
  const actionModal = { "confirmTransaction": { "header": "Подтвердите действие в {{ name }}", "text": "Это займет пару секунд." }, "signData": { "header": "Подпишите данные в {{ name }}", "text": "Это займет пару секунд." }, "transactionSent": "$notifications.transactionSent", "transactionCanceled": "$notifications.transactionCanceled", "dataSigned": "$notifications.dataSigned", "signDataCanceled": "$notifications.signDataCanceled" };
1993
1993
  const ru = {
1994
1994
  common,
@@ -9365,6 +9365,10 @@ const DesktopConnectionModal = (props) => {
9365
9365
  setConnectionErrored("missing-features");
9366
9366
  return;
9367
9367
  }
9368
+ if (error instanceof WalletWrongNetworkError) {
9369
+ setConnectionErrored("wrong-network");
9370
+ return;
9371
+ }
9368
9372
  if (props.wallet.appName !== AT_WALLET_APP_NAME) {
9369
9373
  setConnectionErrored("connection-declined");
9370
9374
  }
@@ -9543,6 +9547,23 @@ const DesktopConnectionModal = (props) => {
9543
9547
  }
9544
9548
  });
9545
9549
  }
9550
+ }), createComponent(Match, {
9551
+ get when() {
9552
+ return connectionErrored() === "wrong-network";
9553
+ },
9554
+ get children() {
9555
+ return createComponent(BodyTextStyled$2, {
9556
+ translationKey: "walletModal.desktopConnectionModal.wrongNetwork",
9557
+ get translationValues() {
9558
+ return {
9559
+ name: props.wallet.name
9560
+ };
9561
+ },
9562
+ get children() {
9563
+ return ["Connected wallet is on a different network. Please switch network in ", memo(() => props.wallet.name), " and try again."];
9564
+ }
9565
+ });
9566
+ }
9546
9567
  })];
9547
9568
  }
9548
9569
  }), createComponent(ButtonsContainerStyled$2, {
@@ -10150,7 +10171,15 @@ const MobileConnectionModal = (props) => {
10150
10171
  });
10151
10172
  const connector = useContext(ConnectorContext);
10152
10173
  const unsubscribe = connector.onStatusChange(() => {
10153
- }, () => {
10174
+ }, (error) => {
10175
+ if (error instanceof WalletMissingRequiredFeaturesError) {
10176
+ setConnectionErrored("missing-features");
10177
+ return;
10178
+ }
10179
+ if (error instanceof WalletWrongNetworkError) {
10180
+ setConnectionErrored("wrong-network");
10181
+ return;
10182
+ }
10154
10183
  setConnectionErrored(null);
10155
10184
  });
10156
10185
  const universalLink = createMemo(() => {
@@ -10298,6 +10327,23 @@ const MobileConnectionModal = (props) => {
10298
10327
  children: "Connection declined"
10299
10328
  });
10300
10329
  }
10330
+ }), createComponent(Match, {
10331
+ get when() {
10332
+ return connectionErrored() === "wrong-network";
10333
+ },
10334
+ get children() {
10335
+ return createComponent(BodyTextStyled$1, {
10336
+ translationKey: "walletModal.mobileConnectionModal.wrongNetwork",
10337
+ get translationValues() {
10338
+ return {
10339
+ name: props.wallet.name
10340
+ };
10341
+ },
10342
+ get children() {
10343
+ return ["Connected wallet is on a different network. Please switch network in ", memo(() => props.wallet.name), " and try again."];
10344
+ }
10345
+ });
10346
+ }
10301
10347
  }), createComponent(Match, {
10302
10348
  get when() {
10303
10349
  return connectionErrored() === "not-supported";
@@ -10311,7 +10357,7 @@ const MobileConnectionModal = (props) => {
10311
10357
  };
10312
10358
  },
10313
10359
  get children() {
10314
- return [memo(() => props.wallet.name), " doesnt support the requested action. Please connect another wallet that supports it."];
10360
+ return [memo(() => props.wallet.name), " doesn't support the requested action. Please connect another wallet that supports it."];
10315
10361
  }
10316
10362
  });
10317
10363
  }
@@ -10379,6 +10425,24 @@ const MobileConnectionModal = (props) => {
10379
10425
  }
10380
10426
  });
10381
10427
  }
10428
+ }), createComponent(Match, {
10429
+ get when() {
10430
+ return connectionErrored() === "wrong-network";
10431
+ },
10432
+ get children() {
10433
+ return createComponent(Button, {
10434
+ get leftIcon() {
10435
+ return createComponent(RetryIcon, {});
10436
+ },
10437
+ onClick: onRetry,
10438
+ get children() {
10439
+ return createComponent(Translation, {
10440
+ translationKey: "common.retry",
10441
+ children: "Retry"
10442
+ });
10443
+ }
10444
+ });
10445
+ }
10382
10446
  }), createComponent(Match, {
10383
10447
  get when() {
10384
10448
  return connectionErrored() === "connection-declined";
@@ -12676,7 +12740,7 @@ class TonConnectUITracker {
12676
12740
  }
12677
12741
  }
12678
12742
  }
12679
- const tonConnectUiVersion = "2.4.0-beta.0";
12743
+ const tonConnectUiVersion = "2.4.0-beta.1";
12680
12744
  class TonConnectEnvironment {
12681
12745
  constructor() {
12682
12746
  this.userAgent = getUserAgent();
@@ -12868,6 +12932,14 @@ class TonConnectUI {
12868
12932
  (_a2 = this.connectRequestParametersCallback) == null ? void 0 : _a2.call(this, connectRequestParameters == null ? void 0 : connectRequestParameters.value);
12869
12933
  }
12870
12934
  }
12935
+ /**
12936
+ * Set desired network for the connection. Can only be set before connecting.
12937
+ * If wallet connects with a different chain, the SDK will throw an error and abort connection.
12938
+ * @param network desired network id (e.g., '-239', '-3', or custom). Pass undefined to allow any network.
12939
+ */
12940
+ setConnectionNetwork(network) {
12941
+ this.connector.setConnectionNetwork(network);
12942
+ }
12871
12943
  /**
12872
12944
  * Returns available wallets list.
12873
12945
  */