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