-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathhardware-error-mappings.ts
More file actions
176 lines (169 loc) · 5.79 KB
/
Copy pathhardware-error-mappings.ts
File metadata and controls
176 lines (169 loc) · 5.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
import { ErrorCode, Severity, Category } from './hardware-errors-enums';
export const LEDGER_ERROR_MAPPINGS = {
'0x9000': {
code: ErrorCode.Success,
message: 'Operation successful',
severity: Severity.Info,
category: Category.Success,
},
'0x6300': {
code: ErrorCode.AuthenticationFailed,
message: 'Authentication failed',
severity: Severity.Err,
category: Category.Authentication,
userMessage: 'Authentication failed. Please verify your credentials.',
},
'0x63c0': {
code: ErrorCode.AuthenticationPinAttemptsRemaining,
message: 'PIN attempts remaining',
severity: Severity.Warning,
category: Category.Authentication,
userMessage: 'Incorrect PIN. Please try again.',
},
'0x6982': {
code: ErrorCode.AuthenticationSecurityCondition,
message: 'Security conditions not satisfied',
severity: Severity.Err,
category: Category.Authentication,
userMessage:
'Device is locked or access rights are insufficient. Please unlock your device.',
},
'0x6985': {
code: ErrorCode.UserRejected,
message: 'User rejected action on device',
severity: Severity.Warning,
category: Category.UserAction,
userMessage:
'Transaction was rejected. Please approve on your device to continue.',
},
'0x9804': {
code: ErrorCode.AuthenticationSecurityCondition,
message: 'App update required',
severity: Severity.Err,
category: Category.Authentication,
userMessage: 'Please update your Ledger app to continue.',
},
'0x9808': {
code: ErrorCode.AuthenticationFailed,
message: 'Contradiction in secret code status',
severity: Severity.Err,
category: Category.Authentication,
},
'0x9840': {
code: ErrorCode.AuthenticationDeviceBlocked,
message: 'Code blocked',
severity: Severity.Critical,
category: Category.Authentication,
userMessage:
'Your device is blocked due to too many failed attempts. Please follow device recovery procedures.',
},
'0x650f': {
code: ErrorCode.ConnectionClosed,
message: 'App closed or connection issue',
severity: Severity.Err,
category: Category.Connection,
userMessage:
'Connection lost or app closed. Please open the corresponding app on your Ledger device.',
},
'0x5515': {
code: ErrorCode.AuthenticationDeviceLocked,
message: 'Device is locked',
severity: Severity.Err,
category: Category.Authentication,
userMessage: 'Please unlock your Ledger device to continue.',
},
'0x5501': {
code: ErrorCode.UserRejected,
message: 'User refused on device',
severity: Severity.Warning,
category: Category.UserAction,
userMessage:
'Operation was rejected. Please approve on your device to continue.',
},
'0x6a80': {
code: ErrorCode.DeviceStateBlindSignNotSupported,
message: 'Blind signing not supported',
severity: Severity.Err,
category: Category.DeviceState,
userMessage: 'Blind signing is not supported on this device.',
},
'0x6d00': {
code: ErrorCode.DeviceStateOnlyV4Supported,
message: 'Ledger Only V4 supported',
severity: Severity.Err,
category: Category.DeviceState,
userMessage: 'Only V4 is supported on this device.',
},
'0x6e00': {
code: ErrorCode.DeviceStateEthAppClosed,
message: 'Ethereum app closed',
severity: Severity.Err,
category: Category.DeviceState,
userMessage: 'Ethereum app is closed. Please open it to continue.',
},
'0x6501': {
code: ErrorCode.DeviceStateEthAppOutOfDate,
message: 'Ethereum app out of date',
severity: Severity.Err,
category: Category.DeviceState,
userMessage: 'Ethereum app is out of date. Please update it to continue.',
},
};
export const BLE_ERROR_MAPPINGS = {
BLUETOOTH_PERMISSION_DENIED: {
code: ErrorCode.PermissionBluetoothDenied,
message: 'Bluetooth permission denied',
severity: Severity.Err,
category: Category.Configuration,
userMessage:
'Bluetooth permission is required to connect to your hardware wallet. Please enable it in your device settings.',
},
LOCATION_PERMISSION_DENIED: {
code: ErrorCode.PermissionLocationDenied,
message: 'Location permission denied',
severity: Severity.Err,
category: Category.Configuration,
userMessage:
'Location permission is required for Bluetooth scanning on Android. Please enable it in your device settings.',
},
NEARBY_DEVICES_PERMISSION_DENIED: {
code: ErrorCode.PermissionNearbyDevicesDenied,
message: 'Nearby devices permission denied',
severity: Severity.Err,
category: Category.Configuration,
userMessage:
'Nearby devices permission is required to scan for your hardware wallet. Please enable it in your device settings.',
},
BLUETOOTH_DISABLED: {
code: ErrorCode.BluetoothDisabled,
message: 'Bluetooth is turned off',
severity: Severity.Warning,
category: Category.Connection,
userMessage:
'Bluetooth is turned off. Please enable Bluetooth to connect to your hardware wallet.',
},
BLUETOOTH_SCAN_FAILED: {
code: ErrorCode.BluetoothScanFailed,
message: 'Bluetooth scanning failed',
severity: Severity.Err,
category: Category.Connection,
userMessage: 'Unable to scan for Bluetooth devices. Please try again.',
},
BLUETOOTH_CONNECTION_FAILED: {
code: ErrorCode.BluetoothConnectionFailed,
message: 'Bluetooth connection failed',
severity: Severity.Err,
category: Category.Connection,
userMessage:
'Failed to connect via Bluetooth. Please make sure your device is nearby and try again.',
},
};
export const MOBILE_ERROR_MAPPINGS = {
NOT_SUPPORTED: {
code: ErrorCode.MobileNotSupported,
message: 'Operation not supported on mobile',
severity: Severity.Err,
category: Category.DeviceState,
userMessage: 'This operation is not supported on mobile devices.',
},
};