Skip to content

Commit

Permalink
feat: add MethodNotSupported error to ledger (#1627)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ross Bulat authored Nov 11, 2023
1 parent b3150ba commit c756f5d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/contexts/Hardware/Ledger/LedgerHardware.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,13 @@ export const LedgerHardwareProvider = ({
code: 'DeviceTimeout',
});
break;
// Occurs when a method in a all is not supported by the device.
case 'methodNotSupported':
setStatusFeedback({
message: t('methodNotSupported'),
code: 'MethodNotSupported',
});
break;
// Occurs when one or more of nested calls being signed does not support nesting.
case 'nestingNotSupported':
setStatusFeedback({
Expand Down
1 change: 1 addition & 0 deletions src/contexts/Hardware/Ledger/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export type LedgerStatusCode =
| 'SignedPayload'
| 'DeviceBusy'
| 'DeviceTimeout'
| 'MethodNotSupported'
| 'NestingNotSupported'
| 'WrongTransaction'
| 'DeviceNotConnected'
Expand Down
1 change: 1 addition & 0 deletions src/contexts/Hardware/Utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type { LedgerAddress } from './Ledger/types';
// Ledger error keyed by type of error.
const LedgerErrorsByType = {
timeout: ['Error: Timeout'],
methodNotSupported: ['Error: Method not supported'],
nestingNotSupported: ['Error: Call nesting not supported'],
outsideActiveChannel: ['Error: TransportError: Invalid channel'],
deviceNotConnected: ['TransportOpenUserCancelled'],
Expand Down
1 change: 1 addition & 0 deletions src/locale/cn/modals.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
"managePool": "管理池",
"maxCommission": "最高佣金值",
"maximumCommissionUpdated": "最高佣金值最新值",
"methodNotSupported": "调用方法不受支持,无法签署交易",
"minDelayBetweenUpdates": "更新之间的最小延迟",
"minutes": "分钟",
"missingNesting": "该调用缺少内置支持,无法签署交易",
Expand Down
1 change: 1 addition & 0 deletions src/locale/en/modals.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
"managePool": "Manage Pool",
"maxCommission": "Max Commission",
"maximumCommissionUpdated": "Maximum Commission Updated",
"methodNotSupported": "Call method not supported, cannot sign.",
"minDelayBetweenUpdates": "Min Delay Between Updates",
"minutes": "Minutes",
"missingNesting": "Call missing nesting support, cannot sign.",
Expand Down

0 comments on commit c756f5d

Please sign in to comment.