Skip to content

Commit de3edf5

Browse files
committed
chore: update copy of ledger err
1 parent b37d3a9 commit de3edf5

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

app/hooks/use-prepare-ledger.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ import {
1010

1111
import type { LedgerMessageEvents } from '../main/register-ledger-listeners';
1212
import { useListenLedgerEffect } from './use-listen-ledger-effect';
13-
import { messages$ } from './use-message-events';
1413
import { isTestnet } from '@utils/network-utils';
14+
import { messages$ } from './use-message-events';
15+
import { useCheckForUpdates } from './use-check-for-updates';
1516

1617
export enum LedgerConnectStep {
1718
Disconnected,
@@ -34,6 +35,7 @@ export function usePrepareLedger() {
3435
const [step, setStep] = useState<LedgerConnectStep>(LedgerConnectStep.Disconnected);
3536
const [isLocked, setIsLocked] = useState(false);
3637
const [appVersion, setAppVersion] = useState<AppVersion | null>(null);
38+
const { isNewerReleaseAvailable } = useCheckForUpdates();
3739

3840
const versionSupportsTestnetLedger = useMemo(() => {
3941
if (appVersion === null) return false;
@@ -51,13 +53,15 @@ export function usePrepareLedger() {
5153
return `Cannot use Ledger on testnet with app version 0.11.0 or lower. Upgrade on Ledger Live.`;
5254
}
5355
return `
54-
Make sure to upgrade your Stacks app to the latest version in Ledger Live.
55-
This version of the Stacks Wallet only works with ${String(
56-
LATEST_LEDGER_VERSION_MAJOR
57-
)}.${String(LATEST_LEDGER_VERSION_MINOR)}.
56+
Make sure to upgrade your Stacks app to the latest version in Ledger Live. ${
57+
isNewerReleaseAvailable
58+
? 'You should also upgrade your Stacks Wallet to the latest version.'
59+
: ''
60+
}
61+
This version of the Stacks Wallet only works with ${LATEST_LEDGER_VERSION_MAJOR}.${LATEST_LEDGER_VERSION_MINOR}.
5862
Detected version ${String(appVersion?.major)}.${String(appVersion?.minor)}
5963
`;
60-
}, [appVersion, versionSupportsTestnetLedger]);
64+
}, [appVersion?.major, appVersion?.minor, isNewerReleaseAvailable, versionSupportsTestnetLedger]);
6165

6266
useListenLedgerEffect();
6367

app/modals/receive-stx/components/reveal-stx-address-ledger.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ import { RootState } from '@store/index';
1010
import { AddressDisplayer } from './address-displayer';
1111
import { SevereWarning } from '@components/severe-warning';
1212
import { LedgerConnectStep, usePrepareLedger } from '@hooks/use-prepare-ledger';
13+
import { ErrorLabel } from '@components/error-label';
14+
import { ErrorText } from '@components/error-text';
1315

1416
export const RevealStxAddressLedger: FC = () => {
15-
const { step, isLocked } = usePrepareLedger();
17+
const { step, isLocked, isSupportedAppVersion, appVersionErrorText } = usePrepareLedger();
1618
const [address, setAddress] = useState<null | string>(null);
1719
const [success, setSuccess] = useState(false);
1820
const [pendingLedgerAction, setPendingLedgerAction] =
@@ -82,6 +84,11 @@ export const RevealStxAddressLedger: FC = () => {
8284
</Stack>
8385
</Flex>
8486
)}
87+
{!isSupportedAppVersion && (
88+
<ErrorLabel my="base-loose">
89+
<ErrorText>{appVersionErrorText}</ErrorText>
90+
</ErrorLabel>
91+
)}
8592
<Box>
8693
{pendingLedgerAction === 'pending' && address && (
8794
<Flex mb="base">

0 commit comments

Comments
 (0)