@tonconnect/ui 2.3.1 → 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/README.md +39 -0
- package/dist/tonconnect-ui.min.js +239 -239
- package/dist/tonconnect-ui.min.js.map +1 -1
- package/lib/index.cjs +400 -85
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +17 -11
- package/lib/index.mjs +401 -86
- package/lib/index.mjs.map +1 -1
- package/package.json +6 -3
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, encodeTelegramUrlParameters, WalletMissingRequiredFeaturesError, isWalletInfoRemote, checkRequiredWalletFeatures,
|
|
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";
|
|
@@ -1717,6 +1717,7 @@ function logWarning(...args) {
|
|
|
1717
1717
|
}
|
|
1718
1718
|
}
|
|
1719
1719
|
function openLink(href, target = "_self") {
|
|
1720
|
+
setLastOpenedLink({ link: href });
|
|
1720
1721
|
logDebug("openLink", href, target);
|
|
1721
1722
|
window.open(href, target, "noopener noreferrer");
|
|
1722
1723
|
}
|
|
@@ -1962,11 +1963,18 @@ const setLastSelectedWalletInfo = (walletInfo) => {
|
|
|
1962
1963
|
_setLastSelectedWalletInfo(walletInfo);
|
|
1963
1964
|
};
|
|
1964
1965
|
const [action, setAction] = createSignal(null);
|
|
1966
|
+
const [lastVisibleWalletsInfo, setLastVisibleWalletsInfo] = createSignal({
|
|
1967
|
+
walletsMenu: "explicit_wallet",
|
|
1968
|
+
wallets: []
|
|
1969
|
+
});
|
|
1970
|
+
const [lastOpenedLink, setLastOpenedLink] = createSignal({
|
|
1971
|
+
link: ""
|
|
1972
|
+
});
|
|
1965
1973
|
const common$1 = { "close": "Close", "openWallet": "Open wallet", "copyLink": "Copy Link", "linkCopied": "Link Copied", "copied": "Copied", "yourWallet": "Your Wallet", "retry": "Retry", "get": "GET", "mobile": "Mobile", "browserExtension": "Browser Extension", "desktop": "Desktop" };
|
|
1966
1974
|
const button$1 = { "connectWallet": "Connect Wallet", "dropdown": { "copy": "Copy address", "copied": "Address copied!", "disconnect": "Disconnect" } };
|
|
1967
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" } };
|
|
1968
1976
|
const walletItem$1 = { "walletOn": "Wallet in", "recent": "Recent", "installed": "Installed", "popular": "Popular" };
|
|
1969
|
-
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" } } };
|
|
1970
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" };
|
|
1971
1979
|
const en = {
|
|
1972
1980
|
common: common$1,
|
|
@@ -1980,7 +1988,7 @@ const common = { "close": "Закрыть", "openWallet": "Открыть кош
|
|
|
1980
1988
|
const button = { "connectWallet": "Подключить кошелёк", "dropdown": { "copy": "Скопировать адрес", "copied": "Адрес скопирован!", "disconnect": "Отключить кошелёк" } };
|
|
1981
1989
|
const notifications = { "confirm": { "header": "Откройте {{ name }}, чтобы подтвердить транзакцию." }, "transactionSent": { "header": "Транзакция отправлена", "text": "Ваша транзакция будет обработана через несколько секунд." }, "transactionCanceled": { "header": "Транзакция отменена", "text": "Состояние вашего счёта не изменится." }, "dataSigned": { "header": "Данные подписаны" }, "signDataCanceled": { "header": "Подпись данных отменена" } };
|
|
1982
1990
|
const walletItem = { "walletOn": "Wallet в", "recent": "Недавний", "installed": "Установлен", "popular": "Популярен" };
|
|
1983
|
-
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": "Отключиться" } } };
|
|
1984
1992
|
const actionModal = { "confirmTransaction": { "header": "Подтвердите действие в {{ name }}", "text": "Это займет пару секунд." }, "signData": { "header": "Подпишите данные в {{ name }}", "text": "Это займет пару секунд." }, "transactionSent": "$notifications.transactionSent", "transactionCanceled": "$notifications.transactionCanceled", "dataSigned": "$notifications.dataSigned", "signDataCanceled": "$notifications.signDataCanceled" };
|
|
1985
1993
|
const ru = {
|
|
1986
1994
|
common,
|
|
@@ -2436,6 +2444,27 @@ if (!webAppVersion) {
|
|
|
2436
2444
|
const window2 = getWindow$1();
|
|
2437
2445
|
webAppVersion = (_g = (_f = (_e = window2 == null ? void 0 : window2.Telegram) == null ? void 0 : _e.WebApp) == null ? void 0 : _f.version) != null ? _g : "6.0";
|
|
2438
2446
|
}
|
|
2447
|
+
const initDataRaw = initParams == null ? void 0 : initParams.tgWebAppData;
|
|
2448
|
+
let telegramUser = void 0;
|
|
2449
|
+
try {
|
|
2450
|
+
if (initDataRaw) {
|
|
2451
|
+
let initData = urlParseQueryString(initDataRaw);
|
|
2452
|
+
let userRaw = initData.user;
|
|
2453
|
+
if (userRaw) {
|
|
2454
|
+
let user = JSON.parse(userRaw);
|
|
2455
|
+
if (typeof user.id === "number" && typeof user.is_premium === "boolean") {
|
|
2456
|
+
telegramUser = {
|
|
2457
|
+
id: user.id,
|
|
2458
|
+
isPremium: user.is_premium
|
|
2459
|
+
};
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
} catch (e2) {
|
|
2464
|
+
}
|
|
2465
|
+
function getTgUser() {
|
|
2466
|
+
return telegramUser;
|
|
2467
|
+
}
|
|
2439
2468
|
function isTmaPlatform(...platforms) {
|
|
2440
2469
|
return platforms.includes(tmaPlatform);
|
|
2441
2470
|
}
|
|
@@ -2467,6 +2496,7 @@ function sendOpenTelegramLink(link, fallback) {
|
|
|
2467
2496
|
}
|
|
2468
2497
|
const pathFull = url.pathname + url.search;
|
|
2469
2498
|
if (isIframe() || versionAtLeast("6.1")) {
|
|
2499
|
+
setLastOpenedLink({ link: pathFull, type: "tg_link" });
|
|
2470
2500
|
postEvent("web_app_open_tg_link", { path_full: pathFull });
|
|
2471
2501
|
} else {
|
|
2472
2502
|
openLinkBlank("https://t.me" + pathFull);
|
|
@@ -8711,6 +8741,10 @@ const AllWalletsListModal = (props) => {
|
|
|
8711
8741
|
};
|
|
8712
8742
|
const walletsList = () => isMobile() ? props.walletsList.filter(supportsMobile) : props.walletsList;
|
|
8713
8743
|
const supportedWallets = () => walletsList().filter((wallet) => wallet.isSupportRequiredFeatures);
|
|
8744
|
+
setLastVisibleWalletsInfo({
|
|
8745
|
+
walletsMenu: "other_wallets",
|
|
8746
|
+
wallets: supportedWallets()
|
|
8747
|
+
});
|
|
8714
8748
|
const unsupportedWallets = () => walletsList().filter((wallet) => !wallet.isSupportRequiredFeatures);
|
|
8715
8749
|
return createComponent(DesktopSelectWalletModalStyled, {
|
|
8716
8750
|
"data-tc-wallets-modal-list": "true",
|
|
@@ -9245,28 +9279,48 @@ function redirectToWallet(universalLink, deepLink, options, setOpenMethod) {
|
|
|
9245
9279
|
}
|
|
9246
9280
|
}
|
|
9247
9281
|
}
|
|
9248
|
-
function
|
|
9249
|
-
|
|
9250
|
-
return universalLink;
|
|
9251
|
-
}
|
|
9282
|
+
function enrichUniversalLink(universalLink, params) {
|
|
9283
|
+
var _a2, _b2;
|
|
9252
9284
|
if (!isTelegramUrl(universalLink)) {
|
|
9253
|
-
|
|
9254
|
-
|
|
9285
|
+
return addQueryParametersIfNotPresented(universalLink, {
|
|
9286
|
+
id: params.sessionId,
|
|
9287
|
+
trace_id: params.traceId
|
|
9288
|
+
});
|
|
9255
9289
|
}
|
|
9256
9290
|
const directLink = convertToTGDirectLink(universalLink);
|
|
9257
9291
|
const directLinkUrl = new URL(directLink);
|
|
9258
|
-
|
|
9259
|
-
directLinkUrl.searchParams.
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
const
|
|
9263
|
-
|
|
9292
|
+
const previousStartApp = decodeTelegramUrlParameters(
|
|
9293
|
+
(_a2 = directLinkUrl.searchParams.get("startapp")) != null ? _a2 : ""
|
|
9294
|
+
);
|
|
9295
|
+
let searchParams = buildSearchParams(previousStartApp);
|
|
9296
|
+
const sessionId = (_b2 = params.sessionId) != null ? _b2 : searchParams.get("id");
|
|
9297
|
+
const traceId = params.traceId;
|
|
9298
|
+
const orderedKeys = ["tonconnect", "v", "id", "trace_id"];
|
|
9299
|
+
const unorderedParams = searchParams.entries().filter(([key]) => !orderedKeys.includes(key));
|
|
9300
|
+
const startApp = buildQueryParams(__spreadProps(__spreadValues({
|
|
9301
|
+
tonconnect: "",
|
|
9302
|
+
v: "2",
|
|
9303
|
+
id: sessionId
|
|
9304
|
+
}, Object.fromEntries(unorderedParams)), {
|
|
9305
|
+
trace_id: traceId
|
|
9306
|
+
})).replace("=&", "&");
|
|
9307
|
+
directLinkUrl.searchParams.set("startapp", encodeTelegramUrlParameters(startApp));
|
|
9308
|
+
return directLinkUrl.toString();
|
|
9264
9309
|
}
|
|
9265
9310
|
function addQueryParameter(url, key, value) {
|
|
9266
9311
|
const parsed = new URL(url);
|
|
9267
9312
|
parsed.searchParams.append(key, value);
|
|
9268
9313
|
return parsed.toString();
|
|
9269
9314
|
}
|
|
9315
|
+
function addQueryParametersIfNotPresented(url, params) {
|
|
9316
|
+
const parsed = new URL(url);
|
|
9317
|
+
for (const [key, value] of Object.entries(params)) {
|
|
9318
|
+
if (value !== void 0 && value !== null) {
|
|
9319
|
+
parsed.searchParams.set(key, value);
|
|
9320
|
+
}
|
|
9321
|
+
}
|
|
9322
|
+
return parsed.toString();
|
|
9323
|
+
}
|
|
9270
9324
|
function convertToTGDirectLink(universalLink) {
|
|
9271
9325
|
const url = new URL(universalLink);
|
|
9272
9326
|
if (url.searchParams.has("attach")) {
|
|
@@ -9275,6 +9329,20 @@ function convertToTGDirectLink(universalLink) {
|
|
|
9275
9329
|
}
|
|
9276
9330
|
return url.toString();
|
|
9277
9331
|
}
|
|
9332
|
+
function buildSearchParams(search = "") {
|
|
9333
|
+
const url = new URL("https://example.com");
|
|
9334
|
+
url.search = search;
|
|
9335
|
+
return url.searchParams;
|
|
9336
|
+
}
|
|
9337
|
+
function buildQueryParams(params) {
|
|
9338
|
+
const searchParams = buildSearchParams();
|
|
9339
|
+
for (const [key, value] of Object.entries(params)) {
|
|
9340
|
+
if (value !== void 0 && value !== null) {
|
|
9341
|
+
searchParams.append(key, value);
|
|
9342
|
+
}
|
|
9343
|
+
}
|
|
9344
|
+
return searchParams.toString();
|
|
9345
|
+
}
|
|
9278
9346
|
function convertToTGDeepLink(directLink) {
|
|
9279
9347
|
const parsed = new URL(directLink);
|
|
9280
9348
|
const [, domain, appname] = parsed.pathname.split("/");
|
|
@@ -9297,17 +9365,24 @@ const DesktopConnectionModal = (props) => {
|
|
|
9297
9365
|
setConnectionErrored("missing-features");
|
|
9298
9366
|
return;
|
|
9299
9367
|
}
|
|
9368
|
+
if (error instanceof WalletWrongNetworkError) {
|
|
9369
|
+
setConnectionErrored("wrong-network");
|
|
9370
|
+
return;
|
|
9371
|
+
}
|
|
9300
9372
|
if (props.wallet.appName !== AT_WALLET_APP_NAME) {
|
|
9301
9373
|
setConnectionErrored("connection-declined");
|
|
9302
9374
|
}
|
|
9303
9375
|
});
|
|
9304
9376
|
onCleanup(unsubscribe);
|
|
9305
9377
|
const generateUniversalLink = () => {
|
|
9378
|
+
var _a2;
|
|
9306
9379
|
try {
|
|
9307
9380
|
const universalLink2 = connector.connect({
|
|
9308
9381
|
universalLink: props.wallet.universalLink,
|
|
9309
9382
|
bridgeUrl: props.wallet.bridgeUrl
|
|
9310
|
-
}, props.additionalRequest
|
|
9383
|
+
}, props.additionalRequest, {
|
|
9384
|
+
traceId: (_a2 = props.walletsModalState) == null ? void 0 : _a2.traceId
|
|
9385
|
+
});
|
|
9311
9386
|
setUniversalLink(universalLink2);
|
|
9312
9387
|
} catch (e2) {
|
|
9313
9388
|
}
|
|
@@ -9361,13 +9436,16 @@ const DesktopConnectionModal = (props) => {
|
|
|
9361
9436
|
});
|
|
9362
9437
|
};
|
|
9363
9438
|
const onClickExtension = () => {
|
|
9439
|
+
var _a2;
|
|
9364
9440
|
setConnectionErrored(null);
|
|
9365
9441
|
setMode("extension");
|
|
9366
9442
|
if (isWalletInfoCurrentlyInjected(props.wallet)) {
|
|
9367
9443
|
setLastSelectedWalletInfo(props.wallet);
|
|
9368
9444
|
connector.connect({
|
|
9369
9445
|
jsBridgeKey: props.wallet.jsBridgeKey
|
|
9370
|
-
}, props.additionalRequest
|
|
9446
|
+
}, props.additionalRequest, {
|
|
9447
|
+
traceId: (_a2 = props.walletsModalState) == null ? void 0 : _a2.traceId
|
|
9448
|
+
});
|
|
9371
9449
|
}
|
|
9372
9450
|
};
|
|
9373
9451
|
if (supportsMobile(props.wallet)) {
|
|
@@ -9469,6 +9547,23 @@ const DesktopConnectionModal = (props) => {
|
|
|
9469
9547
|
}
|
|
9470
9548
|
});
|
|
9471
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
|
+
}
|
|
9472
9567
|
})];
|
|
9473
9568
|
}
|
|
9474
9569
|
}), createComponent(ButtonsContainerStyled$2, {
|
|
@@ -10076,13 +10171,26 @@ const MobileConnectionModal = (props) => {
|
|
|
10076
10171
|
});
|
|
10077
10172
|
const connector = useContext(ConnectorContext);
|
|
10078
10173
|
const unsubscribe = connector.onStatusChange(() => {
|
|
10079
|
-
}, () => {
|
|
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
|
+
}
|
|
10080
10183
|
setConnectionErrored(null);
|
|
10081
10184
|
});
|
|
10082
|
-
const universalLink = createMemo(() =>
|
|
10083
|
-
|
|
10084
|
-
|
|
10085
|
-
|
|
10185
|
+
const universalLink = createMemo(() => {
|
|
10186
|
+
var _a2;
|
|
10187
|
+
return connector.connect({
|
|
10188
|
+
universalLink: props.wallet.universalLink,
|
|
10189
|
+
bridgeUrl: props.wallet.bridgeUrl
|
|
10190
|
+
}, props.additionalRequest, {
|
|
10191
|
+
traceId: (_a2 = props.walletModalState) == null ? void 0 : _a2.traceId
|
|
10192
|
+
});
|
|
10193
|
+
});
|
|
10086
10194
|
const onClickTelegram = () => {
|
|
10087
10195
|
const alwaysForceRedirect = true;
|
|
10088
10196
|
setLastSelectedWalletInfo(__spreadProps(__spreadValues({}, props.wallet), {
|
|
@@ -10219,6 +10327,23 @@ const MobileConnectionModal = (props) => {
|
|
|
10219
10327
|
children: "Connection declined"
|
|
10220
10328
|
});
|
|
10221
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
|
+
}
|
|
10222
10347
|
}), createComponent(Match, {
|
|
10223
10348
|
get when() {
|
|
10224
10349
|
return connectionErrored() === "not-supported";
|
|
@@ -10232,7 +10357,7 @@ const MobileConnectionModal = (props) => {
|
|
|
10232
10357
|
};
|
|
10233
10358
|
},
|
|
10234
10359
|
get children() {
|
|
10235
|
-
return [memo(() => props.wallet.name), " doesn
|
|
10360
|
+
return [memo(() => props.wallet.name), " doesn't support the requested action. Please connect another wallet that supports it."];
|
|
10236
10361
|
}
|
|
10237
10362
|
});
|
|
10238
10363
|
}
|
|
@@ -10300,6 +10425,24 @@ const MobileConnectionModal = (props) => {
|
|
|
10300
10425
|
}
|
|
10301
10426
|
});
|
|
10302
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
|
+
}
|
|
10303
10446
|
}), createComponent(Match, {
|
|
10304
10447
|
get when() {
|
|
10305
10448
|
return connectionErrored() === "connection-declined";
|
|
@@ -10626,7 +10769,9 @@ const MobileUniversalModal = (props) => {
|
|
|
10626
10769
|
}, null);
|
|
10627
10770
|
const getUniversalLink = () => {
|
|
10628
10771
|
if (!universalLink()) {
|
|
10629
|
-
setUniversalLink(connector.connect(walletsBridges(), props.additionalRequest
|
|
10772
|
+
setUniversalLink(connector.connect(walletsBridges(), props.additionalRequest, {
|
|
10773
|
+
traceId: props.walletModalState.traceId
|
|
10774
|
+
}));
|
|
10630
10775
|
}
|
|
10631
10776
|
return universalLink();
|
|
10632
10777
|
};
|
|
@@ -10663,7 +10808,9 @@ const MobileUniversalModal = (props) => {
|
|
|
10663
10808
|
const walletLink = connector.connect({
|
|
10664
10809
|
bridgeUrl: atWallet.bridgeUrl,
|
|
10665
10810
|
universalLink: atWallet.universalLink
|
|
10666
|
-
}, props.additionalRequest
|
|
10811
|
+
}, props.additionalRequest, {
|
|
10812
|
+
traceId: props.walletModalState.traceId
|
|
10813
|
+
});
|
|
10667
10814
|
const forceRedirect = !firstClick();
|
|
10668
10815
|
setFirstClick(false);
|
|
10669
10816
|
redirectToTelegram(walletLink, {
|
|
@@ -10686,6 +10833,10 @@ const MobileUniversalModal = (props) => {
|
|
|
10686
10833
|
};
|
|
10687
10834
|
const supportedWallets = createMemo(() => walletsList().filter((wallet) => wallet.isSupportRequiredFeatures), null);
|
|
10688
10835
|
const visibleWallets = createMemo(() => supportedWallets().slice(0, 3), null);
|
|
10836
|
+
setLastVisibleWalletsInfo({
|
|
10837
|
+
walletsMenu: "main_screen",
|
|
10838
|
+
wallets: atWalletSupportFeatures() ? [props.walletsList.find((wallet) => wallet.appName === AT_WALLET_APP_NAME), ...visibleWallets()] : visibleWallets()
|
|
10839
|
+
});
|
|
10689
10840
|
const fourWalletsItem = createMemo(() => walletsList().filter((wallet) => !visibleWallets().find((w) => w.appName === wallet.appName)).slice(0, 4), null);
|
|
10690
10841
|
return (() => {
|
|
10691
10842
|
var _el$ = _tmpl$2();
|
|
@@ -10916,9 +11067,15 @@ const DesktopUniversalModal = (props) => {
|
|
|
10916
11067
|
setLastSelectedWalletInfo({
|
|
10917
11068
|
openMethod: "qrcode"
|
|
10918
11069
|
});
|
|
10919
|
-
const request = createMemo(() => connector.connect(walletsBridges(), props.additionalRequest
|
|
11070
|
+
const request = createMemo(() => connector.connect(walletsBridges(), props.additionalRequest, {
|
|
11071
|
+
traceId: props.walletModalState.traceId
|
|
11072
|
+
}));
|
|
10920
11073
|
const supportedWallets = createMemo(() => props.walletsList.filter((wallet) => wallet.isSupportRequiredFeatures), null);
|
|
10921
11074
|
const visibleWallets = createMemo(() => supportedWallets().slice(0, 3), null);
|
|
11075
|
+
setLastVisibleWalletsInfo({
|
|
11076
|
+
walletsMenu: "main_screen",
|
|
11077
|
+
wallets: visibleWallets()
|
|
11078
|
+
});
|
|
10922
11079
|
const fourWalletsItem = createMemo(() => props.walletsList.filter((wallet) => !visibleWallets().find((w) => w.appName === wallet.appName)).slice(0, 4), null);
|
|
10923
11080
|
return createComponent(DesktopUniversalModalStyled, {
|
|
10924
11081
|
onClick: () => setPopupOpened(false),
|
|
@@ -11513,6 +11670,9 @@ const WalletsModal = () => {
|
|
|
11513
11670
|
get component() {
|
|
11514
11671
|
return isMobile() ? MobileConnectionModal : DesktopConnectionModal;
|
|
11515
11672
|
},
|
|
11673
|
+
get walletsModalState() {
|
|
11674
|
+
return walletsModalState();
|
|
11675
|
+
},
|
|
11516
11676
|
get wallet() {
|
|
11517
11677
|
return selectedWalletInfo();
|
|
11518
11678
|
},
|
|
@@ -11535,6 +11695,9 @@ const WalletsModal = () => {
|
|
|
11535
11695
|
return isMobile() ? MobileUniversalModal : DesktopUniversalModal;
|
|
11536
11696
|
},
|
|
11537
11697
|
onSelect: setSelectedWalletInfo,
|
|
11698
|
+
get walletModalState() {
|
|
11699
|
+
return walletsModalState();
|
|
11700
|
+
},
|
|
11538
11701
|
get walletsList() {
|
|
11539
11702
|
return walletsList();
|
|
11540
11703
|
},
|
|
@@ -11625,7 +11788,10 @@ const ActionModal = (props) => {
|
|
|
11625
11788
|
const returnStrategy = "returnStrategy" in currentAction ? currentAction.returnStrategy : appState.returnStrategy;
|
|
11626
11789
|
const forceRedirect = !firstClick();
|
|
11627
11790
|
setFirstClick(false);
|
|
11628
|
-
const linkWithSessionId =
|
|
11791
|
+
const linkWithSessionId = enrichUniversalLink(universalLink, {
|
|
11792
|
+
sessionId: currentAction.sessionId,
|
|
11793
|
+
traceId: currentAction.traceId
|
|
11794
|
+
});
|
|
11629
11795
|
if (isTelegramUrl(universalLink)) {
|
|
11630
11796
|
redirectToTelegram(linkWithSessionId, {
|
|
11631
11797
|
returnStrategy,
|
|
@@ -12034,9 +12200,13 @@ const App = (props) => {
|
|
|
12034
12200
|
});
|
|
12035
12201
|
};
|
|
12036
12202
|
const widgetController = {
|
|
12037
|
-
openWalletsModal: () => void setTimeout(() => setWalletsModalState({
|
|
12038
|
-
|
|
12039
|
-
|
|
12203
|
+
openWalletsModal: (options) => void setTimeout(() => setWalletsModalState((prev) => {
|
|
12204
|
+
var _a2;
|
|
12205
|
+
return {
|
|
12206
|
+
status: "opened",
|
|
12207
|
+
traceId: (_a2 = options == null ? void 0 : options.traceId) != null ? _a2 : prev == null ? void 0 : prev.traceId,
|
|
12208
|
+
closeReason: null
|
|
12209
|
+
};
|
|
12040
12210
|
})),
|
|
12041
12211
|
closeWalletsModal: (reason) => void setTimeout(() => setWalletsModalState({
|
|
12042
12212
|
status: "closed",
|
|
@@ -12053,8 +12223,9 @@ const widgetController = {
|
|
|
12053
12223
|
status: "closed",
|
|
12054
12224
|
closeReason: reason
|
|
12055
12225
|
})),
|
|
12056
|
-
openWalletNotSupportFeatureModal: (cause) => void setTimeout(() => setWalletsModalState({
|
|
12226
|
+
openWalletNotSupportFeatureModal: (cause, options) => void setTimeout(() => setWalletsModalState({
|
|
12057
12227
|
status: "opened",
|
|
12228
|
+
traceId: options.traceId,
|
|
12058
12229
|
closeReason: null,
|
|
12059
12230
|
type: "wallet-not-support-feature",
|
|
12060
12231
|
requiredFeature: cause.requiredFeature
|
|
@@ -12062,6 +12233,7 @@ const widgetController = {
|
|
|
12062
12233
|
setAction: (action2) => void setTimeout(() => setAction(action2)),
|
|
12063
12234
|
clearAction: () => void setTimeout(() => setAction(null)),
|
|
12064
12235
|
getSelectedWalletInfo: () => lastSelectedWalletInfo(),
|
|
12236
|
+
getLastVisibleWallets: () => lastVisibleWalletsInfo(),
|
|
12065
12237
|
removeSelectedWalletInfo: () => setLastSelectedWalletInfo(null),
|
|
12066
12238
|
renderApp: (root, tonConnectUI) => render(() => createComponent(App, {
|
|
12067
12239
|
tonConnectUI
|
|
@@ -12079,19 +12251,67 @@ class WalletsModalManager {
|
|
|
12079
12251
|
this.state = state;
|
|
12080
12252
|
this.consumers.forEach((consumer) => consumer(state));
|
|
12081
12253
|
});
|
|
12254
|
+
createEffect(
|
|
12255
|
+
on(lastSelectedWalletInfo, (selectedWallet, previousWallet) => __async(this, null, function* () {
|
|
12256
|
+
try {
|
|
12257
|
+
const { wallets, walletsMenu } = widgetController.getLastVisibleWallets();
|
|
12258
|
+
if (selectedWallet && "appName" in selectedWallet) {
|
|
12259
|
+
if (previousWallet && "appName" in previousWallet && previousWallet.appName === selectedWallet.appName) {
|
|
12260
|
+
return;
|
|
12261
|
+
}
|
|
12262
|
+
const clientId = yield this.connector.getSessionId();
|
|
12263
|
+
this.tracker.trackSelectedWallet(
|
|
12264
|
+
wallets.map((wallet) => wallet.name),
|
|
12265
|
+
selectedWallet,
|
|
12266
|
+
walletsMenu,
|
|
12267
|
+
"",
|
|
12268
|
+
void 0,
|
|
12269
|
+
clientId,
|
|
12270
|
+
this.state.traceId
|
|
12271
|
+
);
|
|
12272
|
+
}
|
|
12273
|
+
} catch (error) {
|
|
12274
|
+
logError(error);
|
|
12275
|
+
}
|
|
12276
|
+
}))
|
|
12277
|
+
);
|
|
12278
|
+
createEffect(
|
|
12279
|
+
on(lastOpenedLink, (openedLink) => __async(this, null, function* () {
|
|
12280
|
+
try {
|
|
12281
|
+
const { wallets, walletsMenu } = widgetController.getLastVisibleWallets();
|
|
12282
|
+
if (isConnectUrl(openedLink.link)) {
|
|
12283
|
+
const selectedWallet = lastSelectedWalletInfo();
|
|
12284
|
+
const clientId = yield this.connector.getSessionId();
|
|
12285
|
+
this.tracker.trackSelectedWallet(
|
|
12286
|
+
wallets.map((wallet) => wallet.name),
|
|
12287
|
+
selectedWallet && "appName" in selectedWallet ? selectedWallet : null,
|
|
12288
|
+
walletsMenu,
|
|
12289
|
+
openedLink.link,
|
|
12290
|
+
openedLink.type,
|
|
12291
|
+
clientId,
|
|
12292
|
+
this.state.traceId
|
|
12293
|
+
);
|
|
12294
|
+
}
|
|
12295
|
+
} catch (error) {
|
|
12296
|
+
logError(error);
|
|
12297
|
+
}
|
|
12298
|
+
}))
|
|
12299
|
+
);
|
|
12082
12300
|
}
|
|
12083
12301
|
/**
|
|
12084
12302
|
* Opens the modal window.
|
|
12085
12303
|
*/
|
|
12086
|
-
open() {
|
|
12304
|
+
open(options) {
|
|
12087
12305
|
return __async(this, null, function* () {
|
|
12306
|
+
var _a2;
|
|
12307
|
+
const traceId = (_a2 = options == null ? void 0 : options.traceId) != null ? _a2 : UUIDv7();
|
|
12088
12308
|
this.tracker.trackConnectionStarted();
|
|
12089
12309
|
const walletsList = yield this.connector.getWallets();
|
|
12090
12310
|
const embeddedWallet = walletsList.find(isWalletInfoCurrentlyEmbedded);
|
|
12091
12311
|
if (embeddedWallet) {
|
|
12092
|
-
return this.connectEmbeddedWallet(embeddedWallet);
|
|
12312
|
+
return this.connectEmbeddedWallet(embeddedWallet, { traceId });
|
|
12093
12313
|
} else {
|
|
12094
|
-
return this.openWalletsModal();
|
|
12314
|
+
return this.openWalletsModal({ traceId });
|
|
12095
12315
|
}
|
|
12096
12316
|
});
|
|
12097
12317
|
}
|
|
@@ -12119,10 +12339,12 @@ class WalletsModalManager {
|
|
|
12119
12339
|
* @param embeddedWallet - Information about the embedded wallet to connect to.
|
|
12120
12340
|
* @internal
|
|
12121
12341
|
*/
|
|
12122
|
-
connectEmbeddedWallet(embeddedWallet) {
|
|
12342
|
+
connectEmbeddedWallet(embeddedWallet, options) {
|
|
12123
12343
|
const connect = (parameters) => {
|
|
12124
12344
|
setLastSelectedWalletInfo(embeddedWallet);
|
|
12125
|
-
this.connector.connect({ jsBridgeKey: embeddedWallet.jsBridgeKey }, parameters
|
|
12345
|
+
this.connector.connect({ jsBridgeKey: embeddedWallet.jsBridgeKey }, parameters, {
|
|
12346
|
+
traceId: options.traceId
|
|
12347
|
+
});
|
|
12126
12348
|
};
|
|
12127
12349
|
const additionalRequest = appState.connectRequestParameters;
|
|
12128
12350
|
if ((additionalRequest == null ? void 0 : additionalRequest.state) === "loading") {
|
|
@@ -12135,12 +12357,12 @@ class WalletsModalManager {
|
|
|
12135
12357
|
* Opens the modal window to connect to an external wallet, and waits when modal window is opened.
|
|
12136
12358
|
* @internal
|
|
12137
12359
|
*/
|
|
12138
|
-
openWalletsModal() {
|
|
12360
|
+
openWalletsModal(options) {
|
|
12139
12361
|
return __async(this, null, function* () {
|
|
12140
12362
|
if (isInTMA()) {
|
|
12141
12363
|
sendExpand();
|
|
12142
12364
|
}
|
|
12143
|
-
widgetController.openWalletsModal();
|
|
12365
|
+
widgetController.openWalletsModal({ traceId: options.traceId });
|
|
12144
12366
|
return new Promise((resolve) => {
|
|
12145
12367
|
const unsubscribe = this.onStateChange((state) => {
|
|
12146
12368
|
const { status } = state;
|
|
@@ -12273,10 +12495,9 @@ class SingleWalletModalManager {
|
|
|
12273
12495
|
}
|
|
12274
12496
|
class TonConnectUITracker {
|
|
12275
12497
|
constructor(options) {
|
|
12276
|
-
var _a2;
|
|
12277
12498
|
this.eventPrefix = "ton-connect-ui-";
|
|
12278
12499
|
this.tonConnectSdkVersion = null;
|
|
12279
|
-
this.eventDispatcher =
|
|
12500
|
+
this.eventDispatcher = options == null ? void 0 : options.eventDispatcher;
|
|
12280
12501
|
this.tonConnectUiVersion = options.tonConnectUiVersion;
|
|
12281
12502
|
this.init().catch();
|
|
12282
12503
|
}
|
|
@@ -12352,6 +12573,29 @@ class TonConnectUITracker {
|
|
|
12352
12573
|
} catch (e2) {
|
|
12353
12574
|
}
|
|
12354
12575
|
}
|
|
12576
|
+
/**
|
|
12577
|
+
* Track wallet opened event.
|
|
12578
|
+
* @param args
|
|
12579
|
+
*/
|
|
12580
|
+
trackWalletModalOpened(...args) {
|
|
12581
|
+
try {
|
|
12582
|
+
const event = createWalletModalOpenedEvent(this.version, ...args);
|
|
12583
|
+
this.dispatchUserActionEvent(event);
|
|
12584
|
+
} catch (e2) {
|
|
12585
|
+
}
|
|
12586
|
+
}
|
|
12587
|
+
/**
|
|
12588
|
+
* Track wallet selected event.
|
|
12589
|
+
* @param args
|
|
12590
|
+
*/
|
|
12591
|
+
trackSelectedWallet(...args) {
|
|
12592
|
+
try {
|
|
12593
|
+
const event = createSelectedWalletEvent(this.version, ...args);
|
|
12594
|
+
this.dispatchUserActionEvent(event);
|
|
12595
|
+
} catch (e2) {
|
|
12596
|
+
logError(e2);
|
|
12597
|
+
}
|
|
12598
|
+
}
|
|
12355
12599
|
/**
|
|
12356
12600
|
* Track connection init event.
|
|
12357
12601
|
* @param args
|
|
@@ -12496,22 +12740,48 @@ class TonConnectUITracker {
|
|
|
12496
12740
|
}
|
|
12497
12741
|
}
|
|
12498
12742
|
}
|
|
12499
|
-
const tonConnectUiVersion = "2.
|
|
12743
|
+
const tonConnectUiVersion = "2.4.0-beta.1";
|
|
12744
|
+
class TonConnectEnvironment {
|
|
12745
|
+
constructor() {
|
|
12746
|
+
this.userAgent = getUserAgent();
|
|
12747
|
+
}
|
|
12748
|
+
getLocale() {
|
|
12749
|
+
var _a2;
|
|
12750
|
+
return ((_a2 = navigator.languages) == null ? void 0 : _a2[0]) || navigator.language || "";
|
|
12751
|
+
}
|
|
12752
|
+
getBrowser() {
|
|
12753
|
+
var _a2;
|
|
12754
|
+
return (_a2 = this.userAgent.browser) != null ? _a2 : "";
|
|
12755
|
+
}
|
|
12756
|
+
getPlatform() {
|
|
12757
|
+
var _a2;
|
|
12758
|
+
return (_a2 = this.userAgent.os) != null ? _a2 : "";
|
|
12759
|
+
}
|
|
12760
|
+
getTelegramUser() {
|
|
12761
|
+
return getTgUser();
|
|
12762
|
+
}
|
|
12763
|
+
getClientEnvironment() {
|
|
12764
|
+
return isInTMA() ? "miniapp" : "web";
|
|
12765
|
+
}
|
|
12766
|
+
}
|
|
12500
12767
|
class TonConnectUI {
|
|
12501
12768
|
// TODO: `actionsConfiguration.twaReturnUrl` is used only in `connectWallet` method, but it's not used in `sendTransaction` method, NEED TO FIX IT
|
|
12502
12769
|
constructor(options) {
|
|
12770
|
+
var _a2;
|
|
12503
12771
|
this.walletInfoStorage = new WalletInfoStorage();
|
|
12504
12772
|
this.preferredWalletStorage = new PreferredWalletStorage();
|
|
12505
12773
|
this.walletInfo = null;
|
|
12506
12774
|
this.systemThemeChangeUnsubscribe = null;
|
|
12507
12775
|
this.connectionRestored = Promise.resolve(false);
|
|
12776
|
+
let eventDispatcher = (_a2 = options == null ? void 0 : options.eventDispatcher) != null ? _a2 : new BrowserEventDispatcher();
|
|
12508
12777
|
if (options && "connector" in options && options.connector) {
|
|
12509
12778
|
this.connector = options.connector;
|
|
12510
12779
|
} else if (options && "manifestUrl" in options && options.manifestUrl) {
|
|
12511
12780
|
this.connector = new TonConnect({
|
|
12512
12781
|
manifestUrl: options.manifestUrl,
|
|
12513
|
-
eventDispatcher
|
|
12514
|
-
walletsRequiredFeatures: options.walletsRequiredFeatures
|
|
12782
|
+
eventDispatcher,
|
|
12783
|
+
walletsRequiredFeatures: options.walletsRequiredFeatures,
|
|
12784
|
+
environment: new TonConnectEnvironment()
|
|
12515
12785
|
});
|
|
12516
12786
|
} else {
|
|
12517
12787
|
throw new TonConnectUIError(
|
|
@@ -12519,7 +12789,7 @@ class TonConnectUI {
|
|
|
12519
12789
|
);
|
|
12520
12790
|
}
|
|
12521
12791
|
this.tracker = new TonConnectUITracker({
|
|
12522
|
-
eventDispatcher
|
|
12792
|
+
eventDispatcher,
|
|
12523
12793
|
tonConnectUiVersion
|
|
12524
12794
|
});
|
|
12525
12795
|
this.modal = new WalletsModalManager({
|
|
@@ -12662,6 +12932,14 @@ class TonConnectUI {
|
|
|
12662
12932
|
(_a2 = this.connectRequestParametersCallback) == null ? void 0 : _a2.call(this, connectRequestParameters == null ? void 0 : connectRequestParameters.value);
|
|
12663
12933
|
}
|
|
12664
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
|
+
}
|
|
12665
12943
|
/**
|
|
12666
12944
|
* Returns available wallets list.
|
|
12667
12945
|
*/
|
|
@@ -12687,9 +12965,18 @@ class TonConnectUI {
|
|
|
12687
12965
|
/**
|
|
12688
12966
|
* Opens the modal window, returns a promise that resolves after the modal window is opened.
|
|
12689
12967
|
*/
|
|
12690
|
-
openModal() {
|
|
12968
|
+
openModal(options) {
|
|
12691
12969
|
return __async(this, null, function* () {
|
|
12692
|
-
|
|
12970
|
+
var _a2;
|
|
12971
|
+
const traceId = (_a2 = options == null ? void 0 : options.traceId) != null ? _a2 : UUIDv7();
|
|
12972
|
+
yield this.modal.open({ traceId });
|
|
12973
|
+
const sessionId = yield this.getSessionId();
|
|
12974
|
+
const visibleWallets = widgetController.getLastVisibleWallets();
|
|
12975
|
+
this.tracker.trackWalletModalOpened(
|
|
12976
|
+
visibleWallets.wallets.map((wallet) => wallet.name),
|
|
12977
|
+
sessionId,
|
|
12978
|
+
options == null ? void 0 : options.traceId
|
|
12979
|
+
);
|
|
12693
12980
|
});
|
|
12694
12981
|
}
|
|
12695
12982
|
/**
|
|
@@ -12746,26 +13033,30 @@ class TonConnectUI {
|
|
|
12746
13033
|
* @return Connected wallet.
|
|
12747
13034
|
* @throws TonConnectUIError if connection was aborted.
|
|
12748
13035
|
*/
|
|
12749
|
-
connectWallet() {
|
|
13036
|
+
connectWallet(options) {
|
|
12750
13037
|
return __async(this, null, function* () {
|
|
13038
|
+
var _a2;
|
|
13039
|
+
const traceId = (_a2 = options == null ? void 0 : options.traceId) != null ? _a2 : UUIDv7();
|
|
12751
13040
|
const walletsList = yield this.getWallets();
|
|
12752
13041
|
const embeddedWallet = walletsList.find(isWalletInfoCurrentlyEmbedded);
|
|
12753
13042
|
if (embeddedWallet) {
|
|
12754
|
-
return yield this.connectEmbeddedWallet(embeddedWallet);
|
|
13043
|
+
return yield this.connectEmbeddedWallet(embeddedWallet, { traceId });
|
|
12755
13044
|
} else {
|
|
12756
|
-
return yield this.connectExternalWallet();
|
|
13045
|
+
return yield this.connectExternalWallet({ traceId });
|
|
12757
13046
|
}
|
|
12758
13047
|
});
|
|
12759
13048
|
}
|
|
12760
13049
|
/**
|
|
12761
13050
|
* Disconnect wallet and clean localstorage.
|
|
12762
13051
|
*/
|
|
12763
|
-
disconnect() {
|
|
13052
|
+
disconnect(options) {
|
|
13053
|
+
var _a2;
|
|
13054
|
+
const traceId = (_a2 = options == null ? void 0 : options.traceId) != null ? _a2 : UUIDv7();
|
|
12764
13055
|
this.tracker.trackDisconnection(this.wallet, "dapp");
|
|
12765
13056
|
widgetController.clearAction();
|
|
12766
13057
|
widgetController.removeSelectedWalletInfo();
|
|
12767
13058
|
this.walletInfoStorage.removeWalletInfo();
|
|
12768
|
-
return this.connector.disconnect();
|
|
13059
|
+
return this.connector.disconnect({ traceId });
|
|
12769
13060
|
}
|
|
12770
13061
|
/**
|
|
12771
13062
|
* Opens the modal window and handles the transaction sending.
|
|
@@ -12774,6 +13065,8 @@ class TonConnectUI {
|
|
|
12774
13065
|
*/
|
|
12775
13066
|
sendTransaction(tx, options) {
|
|
12776
13067
|
return __async(this, null, function* () {
|
|
13068
|
+
var _a2;
|
|
13069
|
+
const traceId = (_a2 = options == null ? void 0 : options.traceId) != null ? _a2 : UUIDv7();
|
|
12777
13070
|
this.tracker.trackTransactionSentForSignature(this.wallet, tx);
|
|
12778
13071
|
if (!this.connected) {
|
|
12779
13072
|
this.tracker.trackTransactionSigningFailed(this.wallet, tx, "Wallet was not connected");
|
|
@@ -12789,11 +13082,12 @@ class TonConnectUI {
|
|
|
12789
13082
|
showNotification: notifications2.includes("before"),
|
|
12790
13083
|
openModal: modals.includes("before"),
|
|
12791
13084
|
sent: false,
|
|
12792
|
-
sessionId: sessionId || void 0
|
|
13085
|
+
sessionId: sessionId || void 0,
|
|
13086
|
+
traceId
|
|
12793
13087
|
});
|
|
12794
13088
|
const abortController = new AbortController();
|
|
12795
13089
|
const onRequestSent = () => {
|
|
12796
|
-
var
|
|
13090
|
+
var _a3;
|
|
12797
13091
|
if (abortController.signal.aborted) {
|
|
12798
13092
|
return;
|
|
12799
13093
|
}
|
|
@@ -12802,12 +13096,14 @@ class TonConnectUI {
|
|
|
12802
13096
|
showNotification: notifications2.includes("before"),
|
|
12803
13097
|
openModal: modals.includes("before"),
|
|
12804
13098
|
sent: true,
|
|
12805
|
-
sessionId: sessionId || void 0
|
|
13099
|
+
sessionId: sessionId || void 0,
|
|
13100
|
+
traceId
|
|
12806
13101
|
});
|
|
12807
13102
|
this.redirectAfterRequestSent({
|
|
12808
13103
|
returnStrategy,
|
|
12809
13104
|
twaReturnUrl,
|
|
12810
|
-
sessionId: sessionId || void 0
|
|
13105
|
+
sessionId: sessionId || void 0,
|
|
13106
|
+
traceId
|
|
12811
13107
|
});
|
|
12812
13108
|
let firstClick = true;
|
|
12813
13109
|
const redirectToWallet2 = () => __async(this, null, function* () {
|
|
@@ -12820,10 +13116,11 @@ class TonConnectUI {
|
|
|
12820
13116
|
returnStrategy,
|
|
12821
13117
|
twaReturnUrl,
|
|
12822
13118
|
forceRedirect,
|
|
12823
|
-
sessionId: sessionId || void 0
|
|
13119
|
+
sessionId: sessionId || void 0,
|
|
13120
|
+
traceId
|
|
12824
13121
|
});
|
|
12825
13122
|
});
|
|
12826
|
-
(
|
|
13123
|
+
(_a3 = options == null ? void 0 : options.onRequestSent) == null ? void 0 : _a3.call(options, redirectToWallet2);
|
|
12827
13124
|
};
|
|
12828
13125
|
const unsubscribe = this.onTransactionModalStateChange((action2) => {
|
|
12829
13126
|
if (action2 == null ? void 0 : action2.openModal) {
|
|
@@ -12838,7 +13135,8 @@ class TonConnectUI {
|
|
|
12838
13135
|
const result = yield this.waitForSendTransaction(
|
|
12839
13136
|
{
|
|
12840
13137
|
transaction: tx,
|
|
12841
|
-
signal: abortController.signal
|
|
13138
|
+
signal: abortController.signal,
|
|
13139
|
+
traceId
|
|
12842
13140
|
},
|
|
12843
13141
|
onRequestSent
|
|
12844
13142
|
);
|
|
@@ -12846,19 +13144,21 @@ class TonConnectUI {
|
|
|
12846
13144
|
widgetController.setAction({
|
|
12847
13145
|
name: "transaction-sent",
|
|
12848
13146
|
showNotification: notifications2.includes("success"),
|
|
12849
|
-
openModal: modals.includes("success")
|
|
13147
|
+
openModal: modals.includes("success"),
|
|
13148
|
+
traceId
|
|
12850
13149
|
});
|
|
12851
13150
|
return result;
|
|
12852
13151
|
} catch (e2) {
|
|
12853
13152
|
if (e2 instanceof WalletNotSupportFeatureError) {
|
|
12854
13153
|
widgetController.clearAction();
|
|
12855
|
-
widgetController.openWalletNotSupportFeatureModal(e2.cause);
|
|
13154
|
+
widgetController.openWalletNotSupportFeatureModal(e2.cause, { traceId });
|
|
12856
13155
|
throw e2;
|
|
12857
13156
|
}
|
|
12858
13157
|
widgetController.setAction({
|
|
12859
13158
|
name: "transaction-canceled",
|
|
12860
13159
|
showNotification: notifications2.includes("error"),
|
|
12861
|
-
openModal: modals.includes("error")
|
|
13160
|
+
openModal: modals.includes("error"),
|
|
13161
|
+
traceId
|
|
12862
13162
|
});
|
|
12863
13163
|
if (e2 instanceof TonConnectError) {
|
|
12864
13164
|
throw e2;
|
|
@@ -12877,6 +13177,8 @@ class TonConnectUI {
|
|
|
12877
13177
|
*/
|
|
12878
13178
|
signData(data, options) {
|
|
12879
13179
|
return __async(this, null, function* () {
|
|
13180
|
+
var _a2;
|
|
13181
|
+
const traceId = (_a2 = options == null ? void 0 : options.traceId) != null ? _a2 : UUIDv7();
|
|
12880
13182
|
this.tracker.trackDataSentForSignature(this.wallet, data);
|
|
12881
13183
|
if (!this.connected) {
|
|
12882
13184
|
this.tracker.trackDataSigningFailed(this.wallet, data, "Wallet was not connected");
|
|
@@ -12892,11 +13194,12 @@ class TonConnectUI {
|
|
|
12892
13194
|
showNotification: notifications2.includes("before"),
|
|
12893
13195
|
openModal: modals.includes("before"),
|
|
12894
13196
|
signed: false,
|
|
12895
|
-
sessionId: sessionId || void 0
|
|
13197
|
+
sessionId: sessionId || void 0,
|
|
13198
|
+
traceId
|
|
12896
13199
|
});
|
|
12897
13200
|
const abortController = new AbortController();
|
|
12898
13201
|
const onRequestSent = () => {
|
|
12899
|
-
var
|
|
13202
|
+
var _a3;
|
|
12900
13203
|
if (abortController.signal.aborted) {
|
|
12901
13204
|
return;
|
|
12902
13205
|
}
|
|
@@ -12905,12 +13208,14 @@ class TonConnectUI {
|
|
|
12905
13208
|
showNotification: notifications2.includes("before"),
|
|
12906
13209
|
openModal: modals.includes("before"),
|
|
12907
13210
|
signed: true,
|
|
12908
|
-
sessionId: sessionId || void 0
|
|
13211
|
+
sessionId: sessionId || void 0,
|
|
13212
|
+
traceId
|
|
12909
13213
|
});
|
|
12910
13214
|
this.redirectAfterRequestSent({
|
|
12911
13215
|
returnStrategy,
|
|
12912
13216
|
twaReturnUrl,
|
|
12913
|
-
sessionId: sessionId || void 0
|
|
13217
|
+
sessionId: sessionId || void 0,
|
|
13218
|
+
traceId
|
|
12914
13219
|
});
|
|
12915
13220
|
let firstClick = true;
|
|
12916
13221
|
const redirectToWallet2 = () => {
|
|
@@ -12923,10 +13228,11 @@ class TonConnectUI {
|
|
|
12923
13228
|
returnStrategy,
|
|
12924
13229
|
twaReturnUrl,
|
|
12925
13230
|
forceRedirect,
|
|
12926
|
-
sessionId: sessionId || void 0
|
|
13231
|
+
sessionId: sessionId || void 0,
|
|
13232
|
+
traceId
|
|
12927
13233
|
});
|
|
12928
13234
|
};
|
|
12929
|
-
(
|
|
13235
|
+
(_a3 = options == null ? void 0 : options.onRequestSent) == null ? void 0 : _a3.call(options, redirectToWallet2);
|
|
12930
13236
|
};
|
|
12931
13237
|
const unsubscribe = this.onTransactionModalStateChange((action2) => {
|
|
12932
13238
|
if (action2 == null ? void 0 : action2.openModal) {
|
|
@@ -12941,7 +13247,8 @@ class TonConnectUI {
|
|
|
12941
13247
|
const result = yield this.waitForSignData(
|
|
12942
13248
|
{
|
|
12943
13249
|
data,
|
|
12944
|
-
signal: new AbortController().signal
|
|
13250
|
+
signal: new AbortController().signal,
|
|
13251
|
+
traceId
|
|
12945
13252
|
},
|
|
12946
13253
|
onRequestSent
|
|
12947
13254
|
);
|
|
@@ -12949,19 +13256,21 @@ class TonConnectUI {
|
|
|
12949
13256
|
widgetController.setAction({
|
|
12950
13257
|
name: "data-signed",
|
|
12951
13258
|
showNotification: notifications2.includes("success"),
|
|
12952
|
-
openModal: modals.includes("success")
|
|
13259
|
+
openModal: modals.includes("success"),
|
|
13260
|
+
traceId
|
|
12953
13261
|
});
|
|
12954
13262
|
return result;
|
|
12955
13263
|
} catch (e2) {
|
|
12956
13264
|
if (e2 instanceof WalletNotSupportFeatureError) {
|
|
12957
13265
|
widgetController.clearAction();
|
|
12958
|
-
widgetController.openWalletNotSupportFeatureModal(e2.cause);
|
|
13266
|
+
widgetController.openWalletNotSupportFeatureModal(e2.cause, { traceId });
|
|
12959
13267
|
throw e2;
|
|
12960
13268
|
}
|
|
12961
13269
|
widgetController.setAction({
|
|
12962
13270
|
name: "sign-data-canceled",
|
|
12963
13271
|
showNotification: notifications2.includes("error"),
|
|
12964
|
-
openModal: modals.includes("error")
|
|
13272
|
+
openModal: modals.includes("error"),
|
|
13273
|
+
traceId
|
|
12965
13274
|
});
|
|
12966
13275
|
if (e2 instanceof TonConnectError) {
|
|
12967
13276
|
throw e2;
|
|
@@ -12981,9 +13290,6 @@ class TonConnectUI {
|
|
|
12981
13290
|
getSessionId() {
|
|
12982
13291
|
return __async(this, null, function* () {
|
|
12983
13292
|
var _a2, _b2;
|
|
12984
|
-
if (!this.connected) {
|
|
12985
|
-
return null;
|
|
12986
|
-
}
|
|
12987
13293
|
try {
|
|
12988
13294
|
const storage = (_a2 = this.connector.dappSettings) == null ? void 0 : _a2.storage;
|
|
12989
13295
|
if (storage) {
|
|
@@ -13010,13 +13316,14 @@ class TonConnectUI {
|
|
|
13010
13316
|
returnStrategy,
|
|
13011
13317
|
twaReturnUrl,
|
|
13012
13318
|
forceRedirect,
|
|
13013
|
-
sessionId
|
|
13319
|
+
sessionId,
|
|
13320
|
+
traceId
|
|
13014
13321
|
}) {
|
|
13015
13322
|
if (this.walletInfo && "universalLink" in this.walletInfo && (this.walletInfo.openMethod === "universal-link" || this.walletInfo.openMethod === "custom-deeplink")) {
|
|
13016
|
-
const linkWithSessionId =
|
|
13017
|
-
|
|
13018
|
-
|
|
13019
|
-
);
|
|
13323
|
+
const linkWithSessionId = enrichUniversalLink(this.walletInfo.universalLink, {
|
|
13324
|
+
sessionId,
|
|
13325
|
+
traceId
|
|
13326
|
+
});
|
|
13020
13327
|
if (isTelegramUrl(this.walletInfo.universalLink)) {
|
|
13021
13328
|
redirectToTelegram(linkWithSessionId, {
|
|
13022
13329
|
returnStrategy,
|
|
@@ -13044,11 +13351,13 @@ class TonConnectUI {
|
|
|
13044
13351
|
* @throws Error if the connection process fails.
|
|
13045
13352
|
* @internal
|
|
13046
13353
|
*/
|
|
13047
|
-
connectEmbeddedWallet(embeddedWallet) {
|
|
13354
|
+
connectEmbeddedWallet(embeddedWallet, options) {
|
|
13048
13355
|
return __async(this, null, function* () {
|
|
13049
13356
|
const connect = (parameters) => {
|
|
13050
13357
|
setLastSelectedWalletInfo(embeddedWallet);
|
|
13051
|
-
this.connector.connect({ jsBridgeKey: embeddedWallet.jsBridgeKey }, parameters
|
|
13358
|
+
this.connector.connect({ jsBridgeKey: embeddedWallet.jsBridgeKey }, parameters, {
|
|
13359
|
+
traceId: options.traceId
|
|
13360
|
+
});
|
|
13052
13361
|
};
|
|
13053
13362
|
const additionalRequest = appState.connectRequestParameters;
|
|
13054
13363
|
if ((additionalRequest == null ? void 0 : additionalRequest.state) === "loading") {
|
|
@@ -13057,7 +13366,8 @@ class TonConnectUI {
|
|
|
13057
13366
|
connect(additionalRequest == null ? void 0 : additionalRequest.value);
|
|
13058
13367
|
}
|
|
13059
13368
|
return yield this.waitForWalletConnection({
|
|
13060
|
-
ignoreErrors: false
|
|
13369
|
+
ignoreErrors: false,
|
|
13370
|
+
traceId: options.traceId
|
|
13061
13371
|
});
|
|
13062
13372
|
});
|
|
13063
13373
|
}
|
|
@@ -13068,10 +13378,10 @@ class TonConnectUI {
|
|
|
13068
13378
|
* @throws Error if the user cancels the connection process or if the connection process fails.
|
|
13069
13379
|
* @internal
|
|
13070
13380
|
*/
|
|
13071
|
-
connectExternalWallet() {
|
|
13381
|
+
connectExternalWallet(options) {
|
|
13072
13382
|
return __async(this, null, function* () {
|
|
13073
13383
|
const abortController = new AbortController();
|
|
13074
|
-
widgetController.openWalletsModal();
|
|
13384
|
+
widgetController.openWalletsModal({ traceId: options.traceId });
|
|
13075
13385
|
const unsubscribe = this.onModalStateChange((state) => {
|
|
13076
13386
|
const { status, closeReason } = state;
|
|
13077
13387
|
if (status === "opened") {
|
|
@@ -13084,7 +13394,8 @@ class TonConnectUI {
|
|
|
13084
13394
|
});
|
|
13085
13395
|
return yield this.waitForWalletConnection({
|
|
13086
13396
|
ignoreErrors: true,
|
|
13087
|
-
signal: abortController.signal
|
|
13397
|
+
signal: abortController.signal,
|
|
13398
|
+
traceId: options.traceId
|
|
13088
13399
|
});
|
|
13089
13400
|
});
|
|
13090
13401
|
}
|
|
@@ -13182,7 +13493,11 @@ class TonConnectUI {
|
|
|
13182
13493
|
reject(new TonConnectUIError("Transaction was not sent"));
|
|
13183
13494
|
};
|
|
13184
13495
|
signal.addEventListener("abort", onCanceledHandler, { once: true });
|
|
13185
|
-
this.connector.sendTransaction(transaction, {
|
|
13496
|
+
this.connector.sendTransaction(transaction, {
|
|
13497
|
+
onRequestSent,
|
|
13498
|
+
signal,
|
|
13499
|
+
traceId: options.traceId
|
|
13500
|
+
}).then((result) => {
|
|
13186
13501
|
signal.removeEventListener("abort", onCanceledHandler);
|
|
13187
13502
|
return onTransactionHandler(result);
|
|
13188
13503
|
}).catch((reason) => {
|