Skip to content

Commit

Permalink
fix: ledger tx sign error process
Browse files Browse the repository at this point in the history
  • Loading branch information
alter-eggo committed Oct 18, 2023
1 parent 47aa2e2 commit 618923f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,34 +67,34 @@ export function LedgerSignStacksTxContainer() {
},
});

const versionInfo = await getStacksAppVersion(stacksApp);
ledgerAnalytics.trackDeviceVersionInfo(versionInfo);
setLatestDeviceResponse(versionInfo);
try {
const versionInfo = await getStacksAppVersion(stacksApp);
ledgerAnalytics.trackDeviceVersionInfo(versionInfo);
setLatestDeviceResponse(versionInfo);

if (versionInfo.deviceLocked) {
setAwaitingDeviceConnection(false);
return;
}
if (versionInfo.deviceLocked) {
setAwaitingDeviceConnection(false);
return;
}

if (versionInfo.returnCode !== LedgerError.NoErrors) {
logger.error('Return code from device has error', versionInfo);
return;
}
if (versionInfo.returnCode !== LedgerError.NoErrors) {
logger.error('Return code from device has error', versionInfo);
return;
}

if (isVersionOfLedgerStacksAppWithContractPrincipalBug(versionInfo)) {
navigate(RouteUrls.LedgerOutdatedAppWarning);
const response = await hasUserSkippedBuggyAppWarning.wait();
if (isVersionOfLedgerStacksAppWithContractPrincipalBug(versionInfo)) {
navigate(RouteUrls.LedgerOutdatedAppWarning);
const response = await hasUserSkippedBuggyAppWarning.wait();

if (response === 'cancelled-operation') {
ledgerNavigate.cancelLedgerAction();
return;
if (response === 'cancelled-operation') {
ledgerNavigate.cancelLedgerAction();
return;
}
}
}

ledgerNavigate.toDeviceBusyStep('Verifying public key on Ledger…');
await verifyLedgerPublicKey(stacksApp);
ledgerNavigate.toDeviceBusyStep('Verifying public key on Ledger…');
await verifyLedgerPublicKey(stacksApp);

try {
ledgerNavigate.toConnectionSuccessStep('stacks');
await delay(1000);
if (!unsignedTransaction) throw new Error('No unsigned tx');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function ConnectLedger(props: ConnectLedgerProps) {
{showBitcoinConnectButton && (
<LeatherButton
onClick={onConnectLedger || connectBitcoin}
disabled={awaitingLedgerConnection}
aria-busy={awaitingLedgerConnection}
display="flex"
alignItems="center"
>
Expand All @@ -93,7 +93,7 @@ export function ConnectLedger(props: ConnectLedgerProps) {
{showStacksConnectButton && (
<LeatherButton
onClick={onConnectLedger || connectStacks}
disabled={awaitingLedgerConnection}
aria-busy={awaitingLedgerConnection}
display="flex"
alignItems="center"
>
Expand Down

0 comments on commit 618923f

Please sign in to comment.