diff --git a/public/_locales/de/messages.json b/public/_locales/de/messages.json index b1184db50e..fa0c41915c 100644 --- a/public/_locales/de/messages.json +++ b/public/_locales/de/messages.json @@ -1995,9 +1995,6 @@ "unknownAccount": { "message": "Unbekanntes Konto" }, - "ledgerLiveBridgeGuide": { - "message": "Um eine Verbindung zum Ledger herzustellen, aktivieren Sie bitte die Ledger-Live-Anwendung auf Ihrem Gerät, öffnen Sie die Tezos Wallet-Anwendung und erlauben Sie eine WebSocket-Verbindung zu Ihrem Temple-Konto." - }, "noExchangerFoundForToken": { "message": "Für Token $symbol$ ($name$) wurde kein Austauscher gefunden.", "placeholders": { @@ -2074,12 +2071,6 @@ "deleteTokenConfirm": { "message": "Möchten Sie dieses Token wirklich löschen?" }, - "ledgerLiveSettings": { - "message": "Ledger-Live verwenden" - }, - "ledgerLiveSettingsDescription": { - "message": "Mit der neuen Ledger-Live Bridge können Sie Ihr Ledger auf andere Weise verwenden." - }, "totalBalance": { "message": "Gesamtguthaben" }, diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index c9723fba91..79328a5876 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -2379,9 +2379,6 @@ "unknownAccount": { "message": "Unknown account" }, - "ledgerLiveBridgeGuide": { - "message": "To connect to Ledger, please activate the Ledger Live application on your device, open Tezos Wallet application and allow a WebSocket connection to your Temple account." - }, "ledgerBridgeGuide": { "message": "To connect the Ledger, please activate your device and open Tezos Wallet application." }, @@ -2608,12 +2605,6 @@ "deleteTokenConfirm": { "message": "Are you sure you want to delete this token?" }, - "ledgerLiveSettings": { - "message": "Use Ledger Live" - }, - "ledgerLiveSettingsDescription": { - "message": "The new Ledger Live bridge allows you to use your Ledger in a different way." - }, "lockUpSettings": { "message": "Extension lock-up" }, diff --git a/public/_locales/pt/messages.json b/public/_locales/pt/messages.json index 765458e072..ab84e4c791 100644 --- a/public/_locales/pt/messages.json +++ b/public/_locales/pt/messages.json @@ -1995,9 +1995,6 @@ "unknownAccount": { "message": "Conta desconhecida" }, - "ledgerLiveBridgeGuide": { - "message": "Para ligar ao Ledger, ative a aplicação Ledger Live no seu dispositivo, abra a aplicação Carteira Tezos e permita uma ligação WebSocket à sua conta Temple." - }, "noExchangerFoundForToken": { "message": "Não foi encontrado nenhum permutador para o token $symbol$ ($name$).", "placeholders": { @@ -2074,12 +2071,6 @@ "deleteTokenConfirm": { "message": "Tem a certeza de que pretende eliminar este token?" }, - "ledgerLiveSettings": { - "message": "Usar o Ledger Live" - }, - "ledgerLiveSettingsDescription": { - "message": "A nova ponte Ledger Live permite-lhe utilizar o seu Ledger de uma forma diferente." - }, "totalBalance": { "message": "Saldo total" }, diff --git a/public/_locales/tr/messages.json b/public/_locales/tr/messages.json index d3319f2952..4c29ad05cb 100644 --- a/public/_locales/tr/messages.json +++ b/public/_locales/tr/messages.json @@ -1995,9 +1995,6 @@ "unknownAccount": { "message": "Bilinmeyen hesap" }, - "ledgerLiveBridgeGuide": { - "message": "Kayıt Defterine bağlanmak için lütfen cihazınızda Ledger Live uygulamasını etkinleştirin, Tezos Wallet uygulamasını açın ve Temple hesabınıza WebSocket bağlantısına izin verin." - }, "noExchangerFoundForToken": { "message": "Token $symbol$ ($name$) için alım satım yapan kimse bulunamadı.", "placeholders": { @@ -2074,12 +2071,6 @@ "deleteTokenConfirm": { "message": "Bu token'ı silmek istediğinizden emin misiniz?" }, - "ledgerLiveSettings": { - "message": "Ledger Live Uygulamasını Kullan" - }, - "ledgerLiveSettingsDescription": { - "message": "Yeni Ledger Live, Kayıt Defterinizi farklı bir şekilde kullanmanıza olanak tanır." - }, "totalBalance": { "message": "Toplam Bakiye" }, diff --git a/src/app/atoms/ConfirmLedgerOverlay.tsx b/src/app/atoms/ConfirmLedgerOverlay.tsx index bcd905e2d7..068cd130fe 100644 --- a/src/app/atoms/ConfirmLedgerOverlay.tsx +++ b/src/app/atoms/ConfirmLedgerOverlay.tsx @@ -5,8 +5,6 @@ import CSSTransition from 'react-transition-group/CSSTransition'; import { ReactComponent as LedgerNanoIcon } from 'app/misc/ledger.svg'; import { T } from 'lib/i18n'; -import { TransportType } from 'lib/ledger/types'; -import { getLedgerTransportType } from 'lib/temple/ledger'; type ConfirmLedgerOverlayProps = { displayed: boolean; @@ -48,15 +46,9 @@ const ConfirmLedgerOverlay: FC = ({ displayed }) => ( - {getLedgerTransportType() === TransportType.WEBHID ? ( -

- -

- ) : ( -

- -

- )} +

+ +

); diff --git a/src/app/pages/ConnectLedger/ConnectLedger.tsx b/src/app/pages/ConnectLedger/ConnectLedger.tsx index 7bc7f2db0d..22c3de5382 100644 --- a/src/app/pages/ConnectLedger/ConnectLedger.tsx +++ b/src/app/pages/ConnectLedger/ConnectLedger.tsx @@ -11,8 +11,8 @@ import { ReactComponent as OkIcon } from 'app/icons/ok.svg'; import PageLayout from 'app/layouts/PageLayout'; import { useFormAnalytics } from 'lib/analytics'; import { T, t } from 'lib/i18n'; +import { getLedgerTransportType } from 'lib/ledger/helpers'; import { useAllAccounts, useSetAccountPkh, useTempleClient, validateDerivationPath } from 'lib/temple/front'; -import { getLedgerTransportType } from 'lib/temple/ledger'; import { DerivationType, TempleAccountType } from 'lib/temple/types'; import { delay } from 'lib/utils'; import { navigate } from 'lib/woozie'; diff --git a/src/app/templates/SettingsGeneral/Components/LedgerLiveSettings.tsx b/src/app/templates/SettingsGeneral/Components/LedgerLiveSettings.tsx deleted file mode 100644 index 094ed042de..0000000000 --- a/src/app/templates/SettingsGeneral/Components/LedgerLiveSettings.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import React from 'react'; - -import { TempleSharedStorageKey } from 'lib/temple/types'; -import { useLocalStorage } from 'lib/ui/local-storage'; - -import { SettingsGeneralSelectors } from '../selectors'; -import { EnablingSetting } from './EnablingSetting'; - -const LedgerLiveSettings: React.FC<{}> = () => { - const [ledgerLiveEnabled, setLedgerLiveEnabled] = useLocalStorage( - TempleSharedStorageKey.UseLedgerLive, - false - ); - - return ( - - ); -}; - -export default LedgerLiveSettings; diff --git a/src/app/templates/SettingsGeneral/index.tsx b/src/app/templates/SettingsGeneral/index.tsx index 9406cf021b..c7b08586ed 100644 --- a/src/app/templates/SettingsGeneral/index.tsx +++ b/src/app/templates/SettingsGeneral/index.tsx @@ -3,7 +3,6 @@ import React, { FC } from 'react'; import AnalyticsSettings from 'app/templates/SettingsGeneral/Components/AnalyticsSettings'; import BlockExplorerSelect from 'app/templates/SettingsGeneral/Components/BlockExplorerSelect'; import FiatCurrencySelect from 'app/templates/SettingsGeneral/Components/FiatCurrencySelect'; -import LedgerLiveSettings from 'app/templates/SettingsGeneral/Components/LedgerLiveSettings'; import LocaleSelect from 'app/templates/SettingsGeneral/Components/LocaleSelect'; import LockUpSettings from 'app/templates/SettingsGeneral/Components/LockUpSettings'; import PopupSettings from 'app/templates/SettingsGeneral/Components/PopupSettings'; @@ -26,8 +25,6 @@ const GeneralSettings: FC = () => { - - diff --git a/src/app/templates/SettingsGeneral/selectors.ts b/src/app/templates/SettingsGeneral/selectors.ts index f60ee93355..c108eb98c5 100644 --- a/src/app/templates/SettingsGeneral/selectors.ts +++ b/src/app/templates/SettingsGeneral/selectors.ts @@ -8,7 +8,6 @@ export enum SettingsGeneralSelectors { popUpCheckBox = 'Setting General/Pop-up Check Box', extensionLockUpCheckBox = 'Setting General/Extension Lock-up Check Box', anonymousAnalyticsCheckBox = 'Setting General/Anonymous Analytics Check Box', - useLedgerLiveCheckBox = 'Setting General/Use Ledger Live Check Box', notificationCheckBox = 'Setting General/Notification Check Box', partnersPromotion = 'Setting General/Partners Promotion Check Box' } diff --git a/src/lib/ledger/helpers.ts b/src/lib/ledger/helpers.ts index 51c83bedc7..b1d6bbf786 100644 --- a/src/lib/ledger/helpers.ts +++ b/src/lib/ledger/helpers.ts @@ -4,8 +4,7 @@ import { TransportType } from './transport/types'; export const removeMFromDerivationPath = (dPath: string) => (dPath.startsWith('m/') ? dPath.substring(2) : dPath); -export const pickTransportType = (isLedgerLive: boolean) => { - if (isLedgerLive) return TransportType.LEDGERLIVE; +export const getLedgerTransportType = () => { if (isSupportedHID()) return TransportType.WEBHID; if (isSupportedWebAuthn()) return TransportType.WEBAUTHN; return TransportType.U2F; diff --git a/src/lib/ledger/index.ts b/src/lib/ledger/index.ts index 4a08b482cc..90f992c625 100644 --- a/src/lib/ledger/index.ts +++ b/src/lib/ledger/index.ts @@ -18,7 +18,7 @@ export const createLedgerSigner = async ( publicKeyHash ); - // After Ledger Live bridge was setuped, we don't close transport + // Ledger Live is not available but we still don't close transport // Probably we do not need to close it // But if we need, we can close it after not use timeout const cleanup = () => {}; diff --git a/src/lib/ledger/proxy/foreground.ts b/src/lib/ledger/proxy/foreground.ts index abcd51002e..eacef8f133 100644 --- a/src/lib/ledger/proxy/foreground.ts +++ b/src/lib/ledger/proxy/foreground.ts @@ -1,9 +1,8 @@ import browser from 'webextension-polyfill'; -import { isPopupWindow } from 'app/env'; -import { getLedgerTransportType } from 'lib/temple/ledger'; import { stringToUInt8Array } from 'lib/utils'; +import { getLedgerTransportType } from '../helpers'; import type { TempleLedgerSigner } from '../signer'; import { TransportType } from '../types'; import type { RequestMessage, ForegroundResponse, CreatorArguments } from './types'; @@ -31,15 +30,6 @@ browser.runtime.onMessage.addListener((message: unknown): Promise => - WebSocketTransport.open(LEDGER_LIVE_APP_WS_URL); - -export const isLedgerLiveAppOpen = async () => { - try { - await WebSocketTransport.check(LEDGER_LIVE_APP_WS_URL); - return true; - } catch { - return false; - } -}; - -export const openLedgerLiveApp = async () => { - // if (await isLedgerLiveAppOpen()) return; - - await openLedgerLiveAppXDGLink(); - - for (let i = 0; i < APP_POLLING_LIMIT; i++) { - await delay(APP_POLLING_DELAY); - - if (await isLedgerLiveAppOpen()) return; - } - - throw new Error('Ledger transport check timeout'); -}; - -const openLedgerLiveAppXDGLink = async () => { - const url = 'ledgerlive://bridge?appName=Tezos Wallet'; - - try { - await openXDGLinkWithBrowserExtensionTab(url); - } catch { - if (typeof window === 'undefined') { - /* Implying Service Worker environment */ - // @ts-ignore - await clients.openWindow(url); - } else { - window.open(url); - } - } -}; - -const getAssertBrowser = () => { - // @ts-ignore - const browser: typeof Browser | undefined = globalThis.chrome || globalThis.browser; - if (browser == null) throw new Error('Not browser extension'); - return browser; -}; - -const openXDGLinkWithBrowserExtensionTab = async (url: string) => { - const browser = getAssertBrowser(); - - const tab = await new Promise(resolve => - browser.tabs.create( - { url }, - // @ts-ignore - resolve - ) - ); - - const tabId = tab.id!; - const windowId = tab.windowId!; - - await browser.windows.update(windowId, { focused: true }); - - const removeTab = () => - browser.tabs.remove( - tabId, - // @ts-ignore - () => void browser.runtime.lastError - ); - - const tabListener = (info: Browser.Tabs.OnActivatedActiveInfoType) => { - if (info.tabId === tabId || info.previousTabId === tabId) return; - - browser.tabs.onActivated.removeListener(tabListener); - removeTab(); - }; - - browser.tabs.onActivated.addListener(tabListener); - - const windowListener = () => { - browser.windows.get( - windowId, - undefined, - // @ts-ignore - (tabWindow?: Browser.Windows.Window) => { - if (tabWindow?.focused) return; - browser.windows.onFocusChanged.removeListener(windowListener); - removeTab(); - } - ); - }; - - browser.windows.onFocusChanged.addListener(windowListener); -}; diff --git a/src/lib/ledger/transport/types.ts b/src/lib/ledger/transport/types.ts index 37ffda787c..c0e217ed7f 100644 --- a/src/lib/ledger/transport/types.ts +++ b/src/lib/ledger/transport/types.ts @@ -1,5 +1,4 @@ export enum TransportType { - LEDGERLIVE = 'ledgerLive', /** Relies on `globalThis.u2f` interface. */ U2F = 'u2f', /** Relies on `globalThis.navigator.hid` interface. */ diff --git a/src/lib/local-storage/migrations.ts b/src/lib/local-storage/migrations.ts index 3f191b0e4b..1041cdc288 100644 --- a/src/lib/local-storage/migrations.ts +++ b/src/lib/local-storage/migrations.ts @@ -17,5 +17,9 @@ migrate([ if (isNotEmptyString(key) && match(key)) localStorage.removeItem(key); } } + }, + { + name: '1.19.1', + up: () => localStorage.removeItem('useledgerlive') } ]); diff --git a/src/lib/temple/back/ledger.ts b/src/lib/temple/back/ledger.ts index d35ea58a3c..97ae9948a3 100644 --- a/src/lib/temple/back/ledger.ts +++ b/src/lib/temple/back/ledger.ts @@ -4,7 +4,7 @@ import type { TransportType, CreatorArgumentsTuple } from 'lib/ledger/types'; export const createLedgerSigner = async (...args: CreatorArgumentsTuple) => { if (BACKGROUND_IS_WORKER) return createLedgerSignerProxy(...args); - const transportType = (await import('lib/temple/ledger')).getLedgerTransportType(); + const transportType = (await import('lib/ledger/helpers')).getLedgerTransportType(); if (transportType === 'webauthn' || transportType === 'u2f') return createLedgerSignerProxy(...args); diff --git a/src/lib/temple/ledger.ts b/src/lib/temple/ledger.ts deleted file mode 100644 index 6b274bef9a..0000000000 --- a/src/lib/temple/ledger.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { pickTransportType } from 'lib/ledger/helpers'; -import { TempleSharedStorageKey } from 'lib/temple/types'; - -export function getLedgerTransportType() { - const isLedgerLive = localStorage.getItem(TempleSharedStorageKey.UseLedgerLive); - - return pickTransportType(isLedgerLive === 'true'); -} diff --git a/src/lib/temple/types.ts b/src/lib/temple/types.ts index 48ef1c265d..09b5c17469 100644 --- a/src/lib/temple/types.ts +++ b/src/lib/temple/types.ts @@ -139,7 +139,6 @@ export interface TempleSettings { export enum TempleSharedStorageKey { DAppEnabled = 'dappenabled', - UseLedgerLive = 'useledgerlive', LockUpEnabled = 'lock_up', PasswordAttempts = 'passwordAttempts', TimeLock = 'timelock'