|
1 | 1 | // Copyright 2019-2022 @subwallet/extension-koni-ui authors & contributors
|
2 | 2 | // SPDX-License-Identifier: Apache-2.0
|
3 | 3 |
|
4 |
| -import { _ChainInfo } from '@subwallet/chain-list/types'; |
5 | 4 | import { LedgerNetwork } from '@subwallet/extension-base/background/KoniTypes';
|
6 | 5 | import { _isChainEvmCompatible } from '@subwallet/extension-base/services/chain-service/utils';
|
7 | 6 | import { EVMLedger, SubstrateLedger } from '@subwallet/extension-web-ui/connector';
|
8 |
| -import { isLedgerCapable } from '@subwallet/extension-web-ui/constants'; |
| 7 | +import { isLedgerCapable, ledgerIncompatible } from '@subwallet/extension-web-ui/constants'; |
9 | 8 | import { useSelector } from '@subwallet/extension-web-ui/hooks';
|
10 | 9 | import useGetSupportedLedger from '@subwallet/extension-web-ui/hooks/ledger/useGetSupportedLedger';
|
11 | 10 | import { Ledger } from '@subwallet/extension-web-ui/types';
|
@@ -49,7 +48,7 @@ const getNetwork = (ledgerChains: LedgerNetwork[], slug: string, isEthereumNetwo
|
49 | 48 | const retrieveLedger = (slug: string, ledgerChains: LedgerNetwork[], isEthereumNetwork: boolean): Ledger => {
|
50 | 49 | const { isLedgerCapable } = baseState;
|
51 | 50 |
|
52 |
| - assert(isLedgerCapable, 'Incompatible browser, only Chrome is supported'); |
| 51 | + assert(isLedgerCapable, ledgerIncompatible); |
53 | 52 |
|
54 | 53 | const def = getNetwork(ledgerChains, slug, isEthereumNetwork);
|
55 | 54 |
|
@@ -86,6 +85,7 @@ export function useLedger (slug?: string, active = true): Result {
|
86 | 85 | const [refreshLock, setRefreshLock] = useState(false);
|
87 | 86 | const [warning, setWarning] = useState<string | null>(null);
|
88 | 87 | const [error, setError] = useState<string | null>(null);
|
| 88 | + |
89 | 89 | const [ledger, setLedger] = useState<Ledger| null>(null);
|
90 | 90 |
|
91 | 91 | const getLedger = useCallback(() => {
|
@@ -268,7 +268,7 @@ export function useLedger (slug?: string, active = true): Result {
|
268 | 268 | console.error(error);
|
269 | 269 | });
|
270 | 270 | }, 300);
|
271 |
| - }, [slug, ledgerChains, t, active, chainInfoMap, appName, handleError, getLedger]); |
| 271 | + }, [slug, t, active, handleError, getLedger]); |
272 | 272 |
|
273 | 273 | useEffect(() => {
|
274 | 274 | destroyRef.current = () => {
|
|
0 commit comments