Skip to content

Commit 9b8f7a0

Browse files
committed
Fix connect Ledger on Aleph Zero
1 parent 1eaadf3 commit 9b8f7a0

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

packages/extension-web-ui/src/Popup/Confirmations/parts/Sign/Evm.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,13 @@ const Component: React.FC<Props> = (props: Props) => {
294294
loading={loading}
295295
onClick={onConfirm}
296296
>
297-
{t('Approve')}
297+
{
298+
signMode !== AccountSignMode.LEDGER
299+
? t('Approve')
300+
: !isLedgerConnected
301+
? t('Refresh')
302+
: t('Approve')
303+
}
298304
</Button>
299305
{
300306
signMode === AccountSignMode.QR && (
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Copyright 2019-2022 @subwallet/extension-koni-ui authors & contributors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
export const ledgerIncompatible = 'Incompatible browser. Use a Chromium-based browser like Chrome or Brave and try again.';

packages/extension-web-ui/src/constants/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ export * from './signing';
2020
export * from './strings';
2121
export * from './transaction';
2222
export * from './wallet';
23+
export * from './error';

packages/extension-web-ui/src/hooks/ledger/useLedger.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
// Copyright 2019-2022 @subwallet/extension-koni-ui authors & contributors
22
// SPDX-License-Identifier: Apache-2.0
33

4-
import { _ChainInfo } from '@subwallet/chain-list/types';
54
import { LedgerNetwork } from '@subwallet/extension-base/background/KoniTypes';
65
import { _isChainEvmCompatible } from '@subwallet/extension-base/services/chain-service/utils';
76
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';
98
import { useSelector } from '@subwallet/extension-web-ui/hooks';
109
import useGetSupportedLedger from '@subwallet/extension-web-ui/hooks/ledger/useGetSupportedLedger';
1110
import { Ledger } from '@subwallet/extension-web-ui/types';
@@ -49,7 +48,7 @@ const getNetwork = (ledgerChains: LedgerNetwork[], slug: string, isEthereumNetwo
4948
const retrieveLedger = (slug: string, ledgerChains: LedgerNetwork[], isEthereumNetwork: boolean): Ledger => {
5049
const { isLedgerCapable } = baseState;
5150

52-
assert(isLedgerCapable, 'Incompatible browser, only Chrome is supported');
51+
assert(isLedgerCapable, ledgerIncompatible);
5352

5453
const def = getNetwork(ledgerChains, slug, isEthereumNetwork);
5554

@@ -86,6 +85,7 @@ export function useLedger (slug?: string, active = true): Result {
8685
const [refreshLock, setRefreshLock] = useState(false);
8786
const [warning, setWarning] = useState<string | null>(null);
8887
const [error, setError] = useState<string | null>(null);
88+
8989
const [ledger, setLedger] = useState<Ledger| null>(null);
9090

9191
const getLedger = useCallback(() => {
@@ -268,7 +268,7 @@ export function useLedger (slug?: string, active = true): Result {
268268
console.error(error);
269269
});
270270
}, 300);
271-
}, [slug, ledgerChains, t, active, chainInfoMap, appName, handleError, getLedger]);
271+
}, [slug, t, active, handleError, getLedger]);
272272

273273
useEffect(() => {
274274
destroyRef.current = () => {

packages/webapp/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@
4949
"webpack-cli": "^5.1.4",
5050
"webpack-dev-server": "^5.0.4"
5151
}
52-
}
52+
}

0 commit comments

Comments
 (0)