@metamask/hw-wallet-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +15 -0
- package/dist/hardware-error-mappings.cjs +163 -0
- package/dist/hardware-error-mappings.cjs.map +1 -0
- package/dist/hardware-error-mappings.d.cts +160 -0
- package/dist/hardware-error-mappings.d.cts.map +1 -0
- package/dist/hardware-error-mappings.d.mts +160 -0
- package/dist/hardware-error-mappings.d.mts.map +1 -0
- package/dist/hardware-error-mappings.mjs +160 -0
- package/dist/hardware-error-mappings.mjs.map +1 -0
- package/dist/hardware-error.cjs +142 -0
- package/dist/hardware-error.cjs.map +1 -0
- package/dist/hardware-error.d.cts +61 -0
- package/dist/hardware-error.d.cts.map +1 -0
- package/dist/hardware-error.d.mts +61 -0
- package/dist/hardware-error.d.mts.map +1 -0
- package/dist/hardware-error.mjs +138 -0
- package/dist/hardware-error.mjs.map +1 -0
- package/dist/hardware-errors-enums.cjs +81 -0
- package/dist/hardware-errors-enums.cjs.map +1 -0
- package/dist/hardware-errors-enums.d.cts +62 -0
- package/dist/hardware-errors-enums.d.cts.map +1 -0
- package/dist/hardware-errors-enums.d.mts +62 -0
- package/dist/hardware-errors-enums.d.mts.map +1 -0
- package/dist/hardware-errors-enums.mjs +78 -0
- package/dist/hardware-errors-enums.mjs.map +1 -0
- package/dist/index.cjs +20 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +4 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +4 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +83 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add hardware related error mappings and custom hardware error ([#421](https://github.com/MetaMask/accounts/pull/421))
|
|
15
|
+
- Add BLE and mobile error mappings with new error codes for Bluetooth permissions, connection states, and mobile support ([#433](https://github.com/MetaMask/accounts/pull/433))
|
|
16
|
+
|
|
17
|
+
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/hw-wallet-sdk@0.1.0...HEAD
|
|
18
|
+
[0.1.0]: https://github.com/MetaMask/accounts/releases/tag/@metamask/hw-wallet-sdk@0.1.0
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# `@metamask/hw-wallet-sdk`
|
|
2
|
+
|
|
3
|
+
MetaMask Hardware Wallet SDK.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
`yarn add @metamask/hw-wallet-sdk`
|
|
8
|
+
|
|
9
|
+
or
|
|
10
|
+
|
|
11
|
+
`npm install @metamask/hw-wallet-sdk`
|
|
12
|
+
|
|
13
|
+
## Contributing
|
|
14
|
+
|
|
15
|
+
This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/core#readme).
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MOBILE_ERROR_MAPPINGS = exports.BLE_ERROR_MAPPINGS = exports.LEDGER_ERROR_MAPPINGS = void 0;
|
|
4
|
+
const hardware_errors_enums_1 = require("./hardware-errors-enums.cjs");
|
|
5
|
+
exports.LEDGER_ERROR_MAPPINGS = {
|
|
6
|
+
'0x9000': {
|
|
7
|
+
code: hardware_errors_enums_1.ErrorCode.Success,
|
|
8
|
+
message: 'Operation successful',
|
|
9
|
+
severity: hardware_errors_enums_1.Severity.Info,
|
|
10
|
+
category: hardware_errors_enums_1.Category.Success,
|
|
11
|
+
},
|
|
12
|
+
'0x6300': {
|
|
13
|
+
code: hardware_errors_enums_1.ErrorCode.AuthenticationFailed,
|
|
14
|
+
message: 'Authentication failed',
|
|
15
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
16
|
+
category: hardware_errors_enums_1.Category.Authentication,
|
|
17
|
+
userMessage: 'Authentication failed. Please verify your credentials.',
|
|
18
|
+
},
|
|
19
|
+
'0x63c0': {
|
|
20
|
+
code: hardware_errors_enums_1.ErrorCode.AuthenticationPinAttemptsRemaining,
|
|
21
|
+
message: 'PIN attempts remaining',
|
|
22
|
+
severity: hardware_errors_enums_1.Severity.Warning,
|
|
23
|
+
category: hardware_errors_enums_1.Category.Authentication,
|
|
24
|
+
userMessage: 'Incorrect PIN. Please try again.',
|
|
25
|
+
},
|
|
26
|
+
'0x6982': {
|
|
27
|
+
code: hardware_errors_enums_1.ErrorCode.AuthenticationSecurityCondition,
|
|
28
|
+
message: 'Security conditions not satisfied',
|
|
29
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
30
|
+
category: hardware_errors_enums_1.Category.Authentication,
|
|
31
|
+
userMessage: 'Device is locked or access rights are insufficient. Please unlock your device.',
|
|
32
|
+
},
|
|
33
|
+
'0x6985': {
|
|
34
|
+
code: hardware_errors_enums_1.ErrorCode.UserRejected,
|
|
35
|
+
message: 'User rejected action on device',
|
|
36
|
+
severity: hardware_errors_enums_1.Severity.Warning,
|
|
37
|
+
category: hardware_errors_enums_1.Category.UserAction,
|
|
38
|
+
userMessage: 'Transaction was rejected. Please approve on your device to continue.',
|
|
39
|
+
},
|
|
40
|
+
'0x9804': {
|
|
41
|
+
code: hardware_errors_enums_1.ErrorCode.AuthenticationSecurityCondition,
|
|
42
|
+
message: 'App update required',
|
|
43
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
44
|
+
category: hardware_errors_enums_1.Category.Authentication,
|
|
45
|
+
userMessage: 'Please update your Ledger app to continue.',
|
|
46
|
+
},
|
|
47
|
+
'0x9808': {
|
|
48
|
+
code: hardware_errors_enums_1.ErrorCode.AuthenticationFailed,
|
|
49
|
+
message: 'Contradiction in secret code status',
|
|
50
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
51
|
+
category: hardware_errors_enums_1.Category.Authentication,
|
|
52
|
+
},
|
|
53
|
+
'0x9840': {
|
|
54
|
+
code: hardware_errors_enums_1.ErrorCode.AuthenticationDeviceBlocked,
|
|
55
|
+
message: 'Code blocked',
|
|
56
|
+
severity: hardware_errors_enums_1.Severity.Critical,
|
|
57
|
+
category: hardware_errors_enums_1.Category.Authentication,
|
|
58
|
+
userMessage: 'Your device is blocked due to too many failed attempts. Please follow device recovery procedures.',
|
|
59
|
+
},
|
|
60
|
+
'0x650f': {
|
|
61
|
+
code: hardware_errors_enums_1.ErrorCode.ConnectionClosed,
|
|
62
|
+
message: 'App closed or connection issue',
|
|
63
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
64
|
+
category: hardware_errors_enums_1.Category.Connection,
|
|
65
|
+
userMessage: 'Connection lost or app closed. Please open the corresponding app on your Ledger device.',
|
|
66
|
+
},
|
|
67
|
+
'0x5515': {
|
|
68
|
+
code: hardware_errors_enums_1.ErrorCode.AuthenticationDeviceLocked,
|
|
69
|
+
message: 'Device is locked',
|
|
70
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
71
|
+
category: hardware_errors_enums_1.Category.Authentication,
|
|
72
|
+
userMessage: 'Please unlock your Ledger device to continue.',
|
|
73
|
+
},
|
|
74
|
+
'0x5501': {
|
|
75
|
+
code: hardware_errors_enums_1.ErrorCode.UserRejected,
|
|
76
|
+
message: 'User refused on device',
|
|
77
|
+
severity: hardware_errors_enums_1.Severity.Warning,
|
|
78
|
+
category: hardware_errors_enums_1.Category.UserAction,
|
|
79
|
+
userMessage: 'Operation was rejected. Please approve on your device to continue.',
|
|
80
|
+
},
|
|
81
|
+
'0x6a80': {
|
|
82
|
+
code: hardware_errors_enums_1.ErrorCode.DeviceStateBlindSignNotSupported,
|
|
83
|
+
message: 'Blind signing not supported',
|
|
84
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
85
|
+
category: hardware_errors_enums_1.Category.DeviceState,
|
|
86
|
+
userMessage: 'Blind signing is not supported on this device.',
|
|
87
|
+
},
|
|
88
|
+
'0x6d00': {
|
|
89
|
+
code: hardware_errors_enums_1.ErrorCode.DeviceStateOnlyV4Supported,
|
|
90
|
+
message: 'Ledger Only V4 supported',
|
|
91
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
92
|
+
category: hardware_errors_enums_1.Category.DeviceState,
|
|
93
|
+
userMessage: 'Only V4 is supported on this device.',
|
|
94
|
+
},
|
|
95
|
+
'0x6e00': {
|
|
96
|
+
code: hardware_errors_enums_1.ErrorCode.DeviceStateEthAppClosed,
|
|
97
|
+
message: 'Ethereum app closed',
|
|
98
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
99
|
+
category: hardware_errors_enums_1.Category.DeviceState,
|
|
100
|
+
userMessage: 'Ethereum app is closed. Please open it to continue.',
|
|
101
|
+
},
|
|
102
|
+
'0x6501': {
|
|
103
|
+
code: hardware_errors_enums_1.ErrorCode.DeviceStateEthAppOutOfDate,
|
|
104
|
+
message: 'Ethereum app out of date',
|
|
105
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
106
|
+
category: hardware_errors_enums_1.Category.DeviceState,
|
|
107
|
+
userMessage: 'Ethereum app is out of date. Please update it to continue.',
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
exports.BLE_ERROR_MAPPINGS = {
|
|
111
|
+
BLUETOOTH_PERMISSION_DENIED: {
|
|
112
|
+
code: hardware_errors_enums_1.ErrorCode.PermissionBluetoothDenied,
|
|
113
|
+
message: 'Bluetooth permission denied',
|
|
114
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
115
|
+
category: hardware_errors_enums_1.Category.Configuration,
|
|
116
|
+
userMessage: 'Bluetooth permission is required to connect to your hardware wallet. Please enable it in your device settings.',
|
|
117
|
+
},
|
|
118
|
+
LOCATION_PERMISSION_DENIED: {
|
|
119
|
+
code: hardware_errors_enums_1.ErrorCode.PermissionLocationDenied,
|
|
120
|
+
message: 'Location permission denied',
|
|
121
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
122
|
+
category: hardware_errors_enums_1.Category.Configuration,
|
|
123
|
+
userMessage: 'Location permission is required for Bluetooth scanning on Android. Please enable it in your device settings.',
|
|
124
|
+
},
|
|
125
|
+
NEARBY_DEVICES_PERMISSION_DENIED: {
|
|
126
|
+
code: hardware_errors_enums_1.ErrorCode.PermissionNearbyDevicesDenied,
|
|
127
|
+
message: 'Nearby devices permission denied',
|
|
128
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
129
|
+
category: hardware_errors_enums_1.Category.Configuration,
|
|
130
|
+
userMessage: 'Nearby devices permission is required to scan for your hardware wallet. Please enable it in your device settings.',
|
|
131
|
+
},
|
|
132
|
+
BLUETOOTH_DISABLED: {
|
|
133
|
+
code: hardware_errors_enums_1.ErrorCode.BluetoothDisabled,
|
|
134
|
+
message: 'Bluetooth is turned off',
|
|
135
|
+
severity: hardware_errors_enums_1.Severity.Warning,
|
|
136
|
+
category: hardware_errors_enums_1.Category.Connection,
|
|
137
|
+
userMessage: 'Bluetooth is turned off. Please enable Bluetooth to connect to your hardware wallet.',
|
|
138
|
+
},
|
|
139
|
+
BLUETOOTH_SCAN_FAILED: {
|
|
140
|
+
code: hardware_errors_enums_1.ErrorCode.BluetoothScanFailed,
|
|
141
|
+
message: 'Bluetooth scanning failed',
|
|
142
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
143
|
+
category: hardware_errors_enums_1.Category.Connection,
|
|
144
|
+
userMessage: 'Unable to scan for Bluetooth devices. Please try again.',
|
|
145
|
+
},
|
|
146
|
+
BLUETOOTH_CONNECTION_FAILED: {
|
|
147
|
+
code: hardware_errors_enums_1.ErrorCode.BluetoothConnectionFailed,
|
|
148
|
+
message: 'Bluetooth connection failed',
|
|
149
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
150
|
+
category: hardware_errors_enums_1.Category.Connection,
|
|
151
|
+
userMessage: 'Failed to connect via Bluetooth. Please make sure your device is nearby and try again.',
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
exports.MOBILE_ERROR_MAPPINGS = {
|
|
155
|
+
NOT_SUPPORTED: {
|
|
156
|
+
code: hardware_errors_enums_1.ErrorCode.MobileNotSupported,
|
|
157
|
+
message: 'Operation not supported on mobile',
|
|
158
|
+
severity: hardware_errors_enums_1.Severity.Err,
|
|
159
|
+
category: hardware_errors_enums_1.Category.DeviceState,
|
|
160
|
+
userMessage: 'This operation is not supported on mobile devices.',
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
//# sourceMappingURL=hardware-error-mappings.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hardware-error-mappings.cjs","sourceRoot":"","sources":["../src/hardware-error-mappings.ts"],"names":[],"mappings":";;;AAAA,uEAAwE;AAE3D,QAAA,qBAAqB,GAAG;IACnC,QAAQ,EAAE;QACR,IAAI,EAAE,iCAAS,CAAC,OAAO;QACvB,OAAO,EAAE,sBAAsB;QAC/B,QAAQ,EAAE,gCAAQ,CAAC,IAAI;QACvB,QAAQ,EAAE,gCAAQ,CAAC,OAAO;KAC3B;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,iCAAS,CAAC,oBAAoB;QACpC,OAAO,EAAE,uBAAuB;QAChC,QAAQ,EAAE,gCAAQ,CAAC,GAAG;QACtB,QAAQ,EAAE,gCAAQ,CAAC,cAAc;QACjC,WAAW,EAAE,wDAAwD;KACtE;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,iCAAS,CAAC,kCAAkC;QAClD,OAAO,EAAE,wBAAwB;QACjC,QAAQ,EAAE,gC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ACnC,aAAa,EAAE;QACb,IAAI,EAAE,iCAAS,CAAC,kBAAkB;QAClC,OAAO,EAAE,mCAAmC;QAC5C,QAAQ,EAAE,gCAAQ,CAAC,GAAG;QACtB,QAAQ,EAAE,gCAAQ,CAAC,WAAW;QAC9B,WAAW,EAAE,oDAAoD;KAClE;CACF,CAAC","sourcesContent":["import { ErrorCode, Severity, Category } from './hardware-errors-enums';\n\nexport const LEDGER_ERROR_MAPPINGS = {\n '0x9000': {\n code: ErrorCode.Success,\n message: 'Operation successful',\n severity: Severity.Info,\n category: Category.Success,\n },\n '0x6300': {\n code: ErrorCode.AuthenticationFailed,\n message: 'Authentication failed',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'Authentication failed. Please verify your credentials.',\n },\n '0x63c0': {\n code: ErrorCode.AuthenticationPinAttemptsRemaining,\n message: 'PIN attempts remaining',\n severity: Severity.Warning,\n category: Category.Authentication,\n userMessage: 'Incorrect PIN. Please try again.',\n },\n '0x6982': {\n code: ErrorCode.AuthenticationSecurityCondition,\n message: 'Security conditions not satisfied',\n severity: Severity.Err,\n category: Category.Authentication,\n\n userMessage:\n 'Device is locked or access rights are insufficient. Please unlock your device.',\n },\n '0x6985': {\n code: ErrorCode.UserRejected,\n message: 'User rejected action on device',\n severity: Severity.Warning,\n category: Category.UserAction,\n\n userMessage:\n 'Transaction was rejected. Please approve on your device to continue.',\n },\n '0x9804': {\n code: ErrorCode.AuthenticationSecurityCondition,\n message: 'App update required',\n severity: Severity.Err,\n category: Category.Authentication,\n\n userMessage: 'Please update your Ledger app to continue.',\n },\n '0x9808': {\n code: ErrorCode.AuthenticationFailed,\n message: 'Contradiction in secret code status',\n severity: Severity.Err,\n category: Category.Authentication,\n },\n '0x9840': {\n code: ErrorCode.AuthenticationDeviceBlocked,\n message: 'Code blocked',\n severity: Severity.Critical,\n category: Category.Authentication,\n\n userMessage:\n 'Your device is blocked due to too many failed attempts. Please follow device recovery procedures.',\n },\n '0x650f': {\n code: ErrorCode.ConnectionClosed,\n message: 'App closed or connection issue',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Connection lost or app closed. Please open the corresponding app on your Ledger device.',\n },\n '0x5515': {\n code: ErrorCode.AuthenticationDeviceLocked,\n message: 'Device is locked',\n severity: Severity.Err,\n category: Category.Authentication,\n userMessage: 'Please unlock your Ledger device to continue.',\n },\n '0x5501': {\n code: ErrorCode.UserRejected,\n message: 'User refused on device',\n severity: Severity.Warning,\n category: Category.UserAction,\n userMessage:\n 'Operation was rejected. Please approve on your device to continue.',\n },\n '0x6a80': {\n code: ErrorCode.DeviceStateBlindSignNotSupported,\n message: 'Blind signing not supported',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Blind signing is not supported on this device.',\n },\n '0x6d00': {\n code: ErrorCode.DeviceStateOnlyV4Supported,\n message: 'Ledger Only V4 supported',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Only V4 is supported on this device.',\n },\n '0x6e00': {\n code: ErrorCode.DeviceStateEthAppClosed,\n message: 'Ethereum app closed',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Ethereum app is closed. Please open it to continue.',\n },\n '0x6501': {\n code: ErrorCode.DeviceStateEthAppOutOfDate,\n message: 'Ethereum app out of date',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'Ethereum app is out of date. Please update it to continue.',\n },\n};\n\nexport const BLE_ERROR_MAPPINGS = {\n BLUETOOTH_PERMISSION_DENIED: {\n code: ErrorCode.PermissionBluetoothDenied,\n message: 'Bluetooth permission denied',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Bluetooth permission is required to connect to your hardware wallet. Please enable it in your device settings.',\n },\n LOCATION_PERMISSION_DENIED: {\n code: ErrorCode.PermissionLocationDenied,\n message: 'Location permission denied',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Location permission is required for Bluetooth scanning on Android. Please enable it in your device settings.',\n },\n NEARBY_DEVICES_PERMISSION_DENIED: {\n code: ErrorCode.PermissionNearbyDevicesDenied,\n message: 'Nearby devices permission denied',\n severity: Severity.Err,\n category: Category.Configuration,\n userMessage:\n 'Nearby devices permission is required to scan for your hardware wallet. Please enable it in your device settings.',\n },\n BLUETOOTH_DISABLED: {\n code: ErrorCode.BluetoothDisabled,\n message: 'Bluetooth is turned off',\n severity: Severity.Warning,\n category: Category.Connection,\n userMessage:\n 'Bluetooth is turned off. Please enable Bluetooth to connect to your hardware wallet.',\n },\n BLUETOOTH_SCAN_FAILED: {\n code: ErrorCode.BluetoothScanFailed,\n message: 'Bluetooth scanning failed',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage: 'Unable to scan for Bluetooth devices. Please try again.',\n },\n BLUETOOTH_CONNECTION_FAILED: {\n code: ErrorCode.BluetoothConnectionFailed,\n message: 'Bluetooth connection failed',\n severity: Severity.Err,\n category: Category.Connection,\n userMessage:\n 'Failed to connect via Bluetooth. Please make sure your device is nearby and try again.',\n },\n};\n\nexport const MOBILE_ERROR_MAPPINGS = {\n NOT_SUPPORTED: {\n code: ErrorCode.MobileNotSupported,\n message: 'Operation not supported on mobile',\n severity: Severity.Err,\n category: Category.DeviceState,\n userMessage: 'This operation is not supported on mobile devices.',\n },\n};\n"]}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { ErrorCode, Severity, Category } from "./hardware-errors-enums.cjs";
|
|
2
|
+
export declare const LEDGER_ERROR_MAPPINGS: {
|
|
3
|
+
'0x9000': {
|
|
4
|
+
code: ErrorCode;
|
|
5
|
+
message: string;
|
|
6
|
+
severity: Severity;
|
|
7
|
+
category: Category;
|
|
8
|
+
};
|
|
9
|
+
'0x6300': {
|
|
10
|
+
code: ErrorCode;
|
|
11
|
+
message: string;
|
|
12
|
+
severity: Severity;
|
|
13
|
+
category: Category;
|
|
14
|
+
userMessage: string;
|
|
15
|
+
};
|
|
16
|
+
'0x63c0': {
|
|
17
|
+
code: ErrorCode;
|
|
18
|
+
message: string;
|
|
19
|
+
severity: Severity;
|
|
20
|
+
category: Category;
|
|
21
|
+
userMessage: string;
|
|
22
|
+
};
|
|
23
|
+
'0x6982': {
|
|
24
|
+
code: ErrorCode;
|
|
25
|
+
message: string;
|
|
26
|
+
severity: Severity;
|
|
27
|
+
category: Category;
|
|
28
|
+
userMessage: string;
|
|
29
|
+
};
|
|
30
|
+
'0x6985': {
|
|
31
|
+
code: ErrorCode;
|
|
32
|
+
message: string;
|
|
33
|
+
severity: Severity;
|
|
34
|
+
category: Category;
|
|
35
|
+
userMessage: string;
|
|
36
|
+
};
|
|
37
|
+
'0x9804': {
|
|
38
|
+
code: ErrorCode;
|
|
39
|
+
message: string;
|
|
40
|
+
severity: Severity;
|
|
41
|
+
category: Category;
|
|
42
|
+
userMessage: string;
|
|
43
|
+
};
|
|
44
|
+
'0x9808': {
|
|
45
|
+
code: ErrorCode;
|
|
46
|
+
message: string;
|
|
47
|
+
severity: Severity;
|
|
48
|
+
category: Category;
|
|
49
|
+
};
|
|
50
|
+
'0x9840': {
|
|
51
|
+
code: ErrorCode;
|
|
52
|
+
message: string;
|
|
53
|
+
severity: Severity;
|
|
54
|
+
category: Category;
|
|
55
|
+
userMessage: string;
|
|
56
|
+
};
|
|
57
|
+
'0x650f': {
|
|
58
|
+
code: ErrorCode;
|
|
59
|
+
message: string;
|
|
60
|
+
severity: Severity;
|
|
61
|
+
category: Category;
|
|
62
|
+
userMessage: string;
|
|
63
|
+
};
|
|
64
|
+
'0x5515': {
|
|
65
|
+
code: ErrorCode;
|
|
66
|
+
message: string;
|
|
67
|
+
severity: Severity;
|
|
68
|
+
category: Category;
|
|
69
|
+
userMessage: string;
|
|
70
|
+
};
|
|
71
|
+
'0x5501': {
|
|
72
|
+
code: ErrorCode;
|
|
73
|
+
message: string;
|
|
74
|
+
severity: Severity;
|
|
75
|
+
category: Category;
|
|
76
|
+
userMessage: string;
|
|
77
|
+
};
|
|
78
|
+
'0x6a80': {
|
|
79
|
+
code: ErrorCode;
|
|
80
|
+
message: string;
|
|
81
|
+
severity: Severity;
|
|
82
|
+
category: Category;
|
|
83
|
+
userMessage: string;
|
|
84
|
+
};
|
|
85
|
+
'0x6d00': {
|
|
86
|
+
code: ErrorCode;
|
|
87
|
+
message: string;
|
|
88
|
+
severity: Severity;
|
|
89
|
+
category: Category;
|
|
90
|
+
userMessage: string;
|
|
91
|
+
};
|
|
92
|
+
'0x6e00': {
|
|
93
|
+
code: ErrorCode;
|
|
94
|
+
message: string;
|
|
95
|
+
severity: Severity;
|
|
96
|
+
category: Category;
|
|
97
|
+
userMessage: string;
|
|
98
|
+
};
|
|
99
|
+
'0x6501': {
|
|
100
|
+
code: ErrorCode;
|
|
101
|
+
message: string;
|
|
102
|
+
severity: Severity;
|
|
103
|
+
category: Category;
|
|
104
|
+
userMessage: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
export declare const BLE_ERROR_MAPPINGS: {
|
|
108
|
+
BLUETOOTH_PERMISSION_DENIED: {
|
|
109
|
+
code: ErrorCode;
|
|
110
|
+
message: string;
|
|
111
|
+
severity: Severity;
|
|
112
|
+
category: Category;
|
|
113
|
+
userMessage: string;
|
|
114
|
+
};
|
|
115
|
+
LOCATION_PERMISSION_DENIED: {
|
|
116
|
+
code: ErrorCode;
|
|
117
|
+
message: string;
|
|
118
|
+
severity: Severity;
|
|
119
|
+
category: Category;
|
|
120
|
+
userMessage: string;
|
|
121
|
+
};
|
|
122
|
+
NEARBY_DEVICES_PERMISSION_DENIED: {
|
|
123
|
+
code: ErrorCode;
|
|
124
|
+
message: string;
|
|
125
|
+
severity: Severity;
|
|
126
|
+
category: Category;
|
|
127
|
+
userMessage: string;
|
|
128
|
+
};
|
|
129
|
+
BLUETOOTH_DISABLED: {
|
|
130
|
+
code: ErrorCode;
|
|
131
|
+
message: string;
|
|
132
|
+
severity: Severity;
|
|
133
|
+
category: Category;
|
|
134
|
+
userMessage: string;
|
|
135
|
+
};
|
|
136
|
+
BLUETOOTH_SCAN_FAILED: {
|
|
137
|
+
code: ErrorCode;
|
|
138
|
+
message: string;
|
|
139
|
+
severity: Severity;
|
|
140
|
+
category: Category;
|
|
141
|
+
userMessage: string;
|
|
142
|
+
};
|
|
143
|
+
BLUETOOTH_CONNECTION_FAILED: {
|
|
144
|
+
code: ErrorCode;
|
|
145
|
+
message: string;
|
|
146
|
+
severity: Severity;
|
|
147
|
+
category: Category;
|
|
148
|
+
userMessage: string;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
export declare const MOBILE_ERROR_MAPPINGS: {
|
|
152
|
+
NOT_SUPPORTED: {
|
|
153
|
+
code: ErrorCode;
|
|
154
|
+
message: string;
|
|
155
|
+
severity: Severity;
|
|
156
|
+
category: Category;
|
|
157
|
+
userMessage: string;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
//# sourceMappingURL=hardware-error-mappings.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hardware-error-mappings.d.cts","sourceRoot":"","sources":["../src/hardware-error-mappings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,oCAAgC;AAExE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiHjC,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgD9B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;CAQjC,CAAC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { ErrorCode, Severity, Category } from "./hardware-errors-enums.mjs";
|
|
2
|
+
export declare const LEDGER_ERROR_MAPPINGS: {
|
|
3
|
+
'0x9000': {
|
|
4
|
+
code: ErrorCode;
|
|
5
|
+
message: string;
|
|
6
|
+
severity: Severity;
|
|
7
|
+
category: Category;
|
|
8
|
+
};
|
|
9
|
+
'0x6300': {
|
|
10
|
+
code: ErrorCode;
|
|
11
|
+
message: string;
|
|
12
|
+
severity: Severity;
|
|
13
|
+
category: Category;
|
|
14
|
+
userMessage: string;
|
|
15
|
+
};
|
|
16
|
+
'0x63c0': {
|
|
17
|
+
code: ErrorCode;
|
|
18
|
+
message: string;
|
|
19
|
+
severity: Severity;
|
|
20
|
+
category: Category;
|
|
21
|
+
userMessage: string;
|
|
22
|
+
};
|
|
23
|
+
'0x6982': {
|
|
24
|
+
code: ErrorCode;
|
|
25
|
+
message: string;
|
|
26
|
+
severity: Severity;
|
|
27
|
+
category: Category;
|
|
28
|
+
userMessage: string;
|
|
29
|
+
};
|
|
30
|
+
'0x6985': {
|
|
31
|
+
code: ErrorCode;
|
|
32
|
+
message: string;
|
|
33
|
+
severity: Severity;
|
|
34
|
+
category: Category;
|
|
35
|
+
userMessage: string;
|
|
36
|
+
};
|
|
37
|
+
'0x9804': {
|
|
38
|
+
code: ErrorCode;
|
|
39
|
+
message: string;
|
|
40
|
+
severity: Severity;
|
|
41
|
+
category: Category;
|
|
42
|
+
userMessage: string;
|
|
43
|
+
};
|
|
44
|
+
'0x9808': {
|
|
45
|
+
code: ErrorCode;
|
|
46
|
+
message: string;
|
|
47
|
+
severity: Severity;
|
|
48
|
+
category: Category;
|
|
49
|
+
};
|
|
50
|
+
'0x9840': {
|
|
51
|
+
code: ErrorCode;
|
|
52
|
+
message: string;
|
|
53
|
+
severity: Severity;
|
|
54
|
+
category: Category;
|
|
55
|
+
userMessage: string;
|
|
56
|
+
};
|
|
57
|
+
'0x650f': {
|
|
58
|
+
code: ErrorCode;
|
|
59
|
+
message: string;
|
|
60
|
+
severity: Severity;
|
|
61
|
+
category: Category;
|
|
62
|
+
userMessage: string;
|
|
63
|
+
};
|
|
64
|
+
'0x5515': {
|
|
65
|
+
code: ErrorCode;
|
|
66
|
+
message: string;
|
|
67
|
+
severity: Severity;
|
|
68
|
+
category: Category;
|
|
69
|
+
userMessage: string;
|
|
70
|
+
};
|
|
71
|
+
'0x5501': {
|
|
72
|
+
code: ErrorCode;
|
|
73
|
+
message: string;
|
|
74
|
+
severity: Severity;
|
|
75
|
+
category: Category;
|
|
76
|
+
userMessage: string;
|
|
77
|
+
};
|
|
78
|
+
'0x6a80': {
|
|
79
|
+
code: ErrorCode;
|
|
80
|
+
message: string;
|
|
81
|
+
severity: Severity;
|
|
82
|
+
category: Category;
|
|
83
|
+
userMessage: string;
|
|
84
|
+
};
|
|
85
|
+
'0x6d00': {
|
|
86
|
+
code: ErrorCode;
|
|
87
|
+
message: string;
|
|
88
|
+
severity: Severity;
|
|
89
|
+
category: Category;
|
|
90
|
+
userMessage: string;
|
|
91
|
+
};
|
|
92
|
+
'0x6e00': {
|
|
93
|
+
code: ErrorCode;
|
|
94
|
+
message: string;
|
|
95
|
+
severity: Severity;
|
|
96
|
+
category: Category;
|
|
97
|
+
userMessage: string;
|
|
98
|
+
};
|
|
99
|
+
'0x6501': {
|
|
100
|
+
code: ErrorCode;
|
|
101
|
+
message: string;
|
|
102
|
+
severity: Severity;
|
|
103
|
+
category: Category;
|
|
104
|
+
userMessage: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
export declare const BLE_ERROR_MAPPINGS: {
|
|
108
|
+
BLUETOOTH_PERMISSION_DENIED: {
|
|
109
|
+
code: ErrorCode;
|
|
110
|
+
message: string;
|
|
111
|
+
severity: Severity;
|
|
112
|
+
category: Category;
|
|
113
|
+
userMessage: string;
|
|
114
|
+
};
|
|
115
|
+
LOCATION_PERMISSION_DENIED: {
|
|
116
|
+
code: ErrorCode;
|
|
117
|
+
message: string;
|
|
118
|
+
severity: Severity;
|
|
119
|
+
category: Category;
|
|
120
|
+
userMessage: string;
|
|
121
|
+
};
|
|
122
|
+
NEARBY_DEVICES_PERMISSION_DENIED: {
|
|
123
|
+
code: ErrorCode;
|
|
124
|
+
message: string;
|
|
125
|
+
severity: Severity;
|
|
126
|
+
category: Category;
|
|
127
|
+
userMessage: string;
|
|
128
|
+
};
|
|
129
|
+
BLUETOOTH_DISABLED: {
|
|
130
|
+
code: ErrorCode;
|
|
131
|
+
message: string;
|
|
132
|
+
severity: Severity;
|
|
133
|
+
category: Category;
|
|
134
|
+
userMessage: string;
|
|
135
|
+
};
|
|
136
|
+
BLUETOOTH_SCAN_FAILED: {
|
|
137
|
+
code: ErrorCode;
|
|
138
|
+
message: string;
|
|
139
|
+
severity: Severity;
|
|
140
|
+
category: Category;
|
|
141
|
+
userMessage: string;
|
|
142
|
+
};
|
|
143
|
+
BLUETOOTH_CONNECTION_FAILED: {
|
|
144
|
+
code: ErrorCode;
|
|
145
|
+
message: string;
|
|
146
|
+
severity: Severity;
|
|
147
|
+
category: Category;
|
|
148
|
+
userMessage: string;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
export declare const MOBILE_ERROR_MAPPINGS: {
|
|
152
|
+
NOT_SUPPORTED: {
|
|
153
|
+
code: ErrorCode;
|
|
154
|
+
message: string;
|
|
155
|
+
severity: Severity;
|
|
156
|
+
category: Category;
|
|
157
|
+
userMessage: string;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
//# sourceMappingURL=hardware-error-mappings.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hardware-error-mappings.d.mts","sourceRoot":"","sources":["../src/hardware-error-mappings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,oCAAgC;AAExE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiHjC,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgD9B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;CAQjC,CAAC"}
|