@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.
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Category = exports.Severity = exports.ErrorCode = void 0;
4
+ // Error Code Enum
5
+ var ErrorCode;
6
+ (function (ErrorCode) {
7
+ // Success
8
+ ErrorCode[ErrorCode["Success"] = 0] = "Success";
9
+ // Authentication
10
+ ErrorCode[ErrorCode["AuthenticationFailed"] = 1000] = "AuthenticationFailed";
11
+ ErrorCode[ErrorCode["AuthenticationIncorrectPin"] = 1001] = "AuthenticationIncorrectPin";
12
+ ErrorCode[ErrorCode["AuthenticationPinAttemptsRemaining"] = 1002] = "AuthenticationPinAttemptsRemaining";
13
+ ErrorCode[ErrorCode["AuthenticationPinCancelled"] = 1003] = "AuthenticationPinCancelled";
14
+ ErrorCode[ErrorCode["AuthenticationDeviceLocked"] = 1100] = "AuthenticationDeviceLocked";
15
+ ErrorCode[ErrorCode["AuthenticationDeviceBlocked"] = 1101] = "AuthenticationDeviceBlocked";
16
+ ErrorCode[ErrorCode["AuthenticationSecurityCondition"] = 1200] = "AuthenticationSecurityCondition";
17
+ ErrorCode[ErrorCode["AuthenticationWipeCodeMismatch"] = 1300] = "AuthenticationWipeCodeMismatch";
18
+ // User action
19
+ ErrorCode[ErrorCode["UserRejected"] = 2000] = "UserRejected";
20
+ ErrorCode[ErrorCode["UserCancelled"] = 2001] = "UserCancelled";
21
+ ErrorCode[ErrorCode["UserConfirmationRequired"] = 2002] = "UserConfirmationRequired";
22
+ ErrorCode[ErrorCode["UserInputRequired"] = 2003] = "UserInputRequired";
23
+ // Device state
24
+ ErrorCode[ErrorCode["DeviceNotReady"] = 3000] = "DeviceNotReady";
25
+ ErrorCode[ErrorCode["DeviceInvalidSession"] = 3001] = "DeviceInvalidSession";
26
+ ErrorCode[ErrorCode["DeviceDisconnected"] = 3003] = "DeviceDisconnected";
27
+ ErrorCode[ErrorCode["DeviceUsedElsewhere"] = 3004] = "DeviceUsedElsewhere";
28
+ ErrorCode[ErrorCode["DeviceCallInProgress"] = 3005] = "DeviceCallInProgress";
29
+ ErrorCode[ErrorCode["DeviceNotFound"] = 3010] = "DeviceNotFound";
30
+ ErrorCode[ErrorCode["DeviceMultipleConnected"] = 3011] = "DeviceMultipleConnected";
31
+ ErrorCode[ErrorCode["DeviceMissingCapability"] = 3020] = "DeviceMissingCapability";
32
+ ErrorCode[ErrorCode["DeviceBtcOnlyFirmware"] = 3021] = "DeviceBtcOnlyFirmware";
33
+ ErrorCode[ErrorCode["DeviceIncompatibleMode"] = 3030] = "DeviceIncompatibleMode";
34
+ // Connection & transport
35
+ ErrorCode[ErrorCode["ConnectionTransportMissing"] = 4000] = "ConnectionTransportMissing";
36
+ ErrorCode[ErrorCode["ConnectionClosed"] = 4001] = "ConnectionClosed";
37
+ ErrorCode[ErrorCode["ConnectionTimeout"] = 4002] = "ConnectionTimeout";
38
+ ErrorCode[ErrorCode["ConnectionBlocked"] = 4003] = "ConnectionBlocked";
39
+ // Protocol
40
+ ErrorCode[ErrorCode["ProtocolUnexpectedMessage"] = 5000] = "ProtocolUnexpectedMessage";
41
+ ErrorCode[ErrorCode["ProtocolCommandError"] = 5001] = "ProtocolCommandError";
42
+ ErrorCode[ErrorCode["ProtocolMessageError"] = 5002] = "ProtocolMessageError";
43
+ // Device state
44
+ ErrorCode[ErrorCode["DeviceStateBlindSignNotSupported"] = 6001] = "DeviceStateBlindSignNotSupported";
45
+ ErrorCode[ErrorCode["DeviceStateOnlyV4Supported"] = 6002] = "DeviceStateOnlyV4Supported";
46
+ ErrorCode[ErrorCode["DeviceStateEthAppClosed"] = 6003] = "DeviceStateEthAppClosed";
47
+ ErrorCode[ErrorCode["DeviceStateEthAppOutOfDate"] = 6004] = "DeviceStateEthAppOutOfDate";
48
+ // Mobile/BLE Permission Errors
49
+ ErrorCode[ErrorCode["PermissionBluetoothDenied"] = 7000] = "PermissionBluetoothDenied";
50
+ ErrorCode[ErrorCode["PermissionLocationDenied"] = 7001] = "PermissionLocationDenied";
51
+ ErrorCode[ErrorCode["PermissionNearbyDevicesDenied"] = 7002] = "PermissionNearbyDevicesDenied";
52
+ ErrorCode[ErrorCode["BluetoothDisabled"] = 7100] = "BluetoothDisabled";
53
+ ErrorCode[ErrorCode["BluetoothScanFailed"] = 7101] = "BluetoothScanFailed";
54
+ ErrorCode[ErrorCode["BluetoothConnectionFailed"] = 7102] = "BluetoothConnectionFailed";
55
+ ErrorCode[ErrorCode["MobileNotSupported"] = 7300] = "MobileNotSupported";
56
+ // Transaction
57
+ ErrorCode[ErrorCode["TxInsufficientFunds"] = 10000] = "TxInsufficientFunds";
58
+ // Unknown/fallback
59
+ ErrorCode[ErrorCode["Unknown"] = 99999] = "Unknown";
60
+ })(ErrorCode || (exports.ErrorCode = ErrorCode = {}));
61
+ // Severity Enum
62
+ var Severity;
63
+ (function (Severity) {
64
+ Severity["Info"] = "Info";
65
+ Severity["Err"] = "Error";
66
+ Severity["Warning"] = "Warning";
67
+ Severity["Critical"] = "Critical";
68
+ })(Severity || (exports.Severity = Severity = {}));
69
+ // Category Enum
70
+ var Category;
71
+ (function (Category) {
72
+ Category["Success"] = "Success";
73
+ Category["Authentication"] = "Authentication";
74
+ Category["Protocol"] = "Protocol";
75
+ Category["Connection"] = "Connection";
76
+ Category["UserAction"] = "UserAction";
77
+ Category["DeviceState"] = "DeviceState";
78
+ Category["Unknown"] = "Unknown";
79
+ Category["Configuration"] = "Configuration";
80
+ })(Category || (exports.Category = Category = {}));
81
+ //# sourceMappingURL=hardware-errors-enums.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hardware-errors-enums.cjs","sourceRoot":"","sources":["../src/hardware-errors-enums.ts"],"names":[],"mappings":";;;AAAA,kBAAkB;AAClB,IAAY,SA+DX;AA/DD,WAAY,SAAS;IACnB,UAAU;IACV,+CAAW,CAAA;IAEX,iBAAiB;IACjB,4EAA2B,CAAA;IAC3B,wFAAiC,CAAA;IACjC,wGAAyC,CAAA;IACzC,wFAAiC,CAAA;IACjC,wFAAiC,CAAA;IACjC,0FAAkC,CAAA;IAClC,kGAAsC,CAAA;IACtC,gGAAqC,CAAA;IAErC,cAAc;IACd,4DAAmB,CAAA;IACnB,8DAAoB,CAAA;IACpB,oFAA+B,CAAA;IAC/B,sEAAwB,CAAA;IAExB,eAAe;IACf,gEAAqB,CAAA;IACrB,4EAA2B,CAAA;IAC3B,wEAAyB,CAAA;IACzB,0EAA0B,CAAA;IAC1B,4EAA2B,CAAA;IAC3B,gEAAqB,CAAA;IACrB,kFAA8B,CAAA;IAC9B,kFAA8B,CAAA;IAC9B,8EAA4B,CAAA;IAC5B,gFAA6B,CAAA;IAE7B,yBAAyB;IACzB,wFAAiC,CAAA;IACjC,oEAAuB,CAAA;IACvB,sEAAwB,CAAA;IACxB,sEAAwB,CAAA;IAExB,WAAW;IACX,sFAAgC,CAAA;IAChC,4EAA2B,CAAA;IAC3B,4EAA2B,CAAA;IAE3B,eAAe;IACf,oGAAuC,CAAA;IACvC,wFAAiC,CAAA;IACjC,kFAA8B,CAAA;IAC9B,wFAAiC,CAAA;IAEjC,+BAA+B;IAC/B,sFAAgC,CAAA;IAChC,oFAA+B,CAAA;IAC/B,8FAAoC,CAAA;IACpC,sEAAwB,CAAA;IACxB,0EAA0B,CAAA;IAC1B,sFAAgC,CAAA;IAChC,wEAAyB,CAAA;IAEzB,cAAc;IACd,2EAA2B,CAAA;IAE3B,mBAAmB;IACnB,mDAAe,CAAA;AACjB,CAAC,EA/DW,SAAS,yBAAT,SAAS,QA+DpB;AAED,gBAAgB;AAChB,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,+BAAmB,CAAA;IACnB,iCAAqB,CAAA;AACvB,CAAC,EALW,QAAQ,wBAAR,QAAQ,QAKnB;AAED,gBAAgB;AAChB,IAAY,QASX;AATD,WAAY,QAAQ;IAClB,+BAAmB,CAAA;IACnB,6CAAiC,CAAA;IACjC,iCAAqB,CAAA;IACrB,qCAAyB,CAAA;IACzB,qCAAyB,CAAA;IACzB,uCAA2B,CAAA;IAC3B,+BAAmB,CAAA;IACnB,2CAA+B,CAAA;AACjC,CAAC,EATW,QAAQ,wBAAR,QAAQ,QASnB","sourcesContent":["// Error Code Enum\nexport enum ErrorCode {\n // Success\n Success = 0,\n\n // Authentication\n AuthenticationFailed = 1000,\n AuthenticationIncorrectPin = 1001,\n AuthenticationPinAttemptsRemaining = 1002,\n AuthenticationPinCancelled = 1003,\n AuthenticationDeviceLocked = 1100,\n AuthenticationDeviceBlocked = 1101,\n AuthenticationSecurityCondition = 1200,\n AuthenticationWipeCodeMismatch = 1300,\n\n // User action\n UserRejected = 2000,\n UserCancelled = 2001,\n UserConfirmationRequired = 2002,\n UserInputRequired = 2003,\n\n // Device state\n DeviceNotReady = 3000,\n DeviceInvalidSession = 3001,\n DeviceDisconnected = 3003,\n DeviceUsedElsewhere = 3004,\n DeviceCallInProgress = 3005,\n DeviceNotFound = 3010,\n DeviceMultipleConnected = 3011,\n DeviceMissingCapability = 3020,\n DeviceBtcOnlyFirmware = 3021,\n DeviceIncompatibleMode = 3030,\n\n // Connection & transport\n ConnectionTransportMissing = 4000,\n ConnectionClosed = 4001,\n ConnectionTimeout = 4002,\n ConnectionBlocked = 4003,\n\n // Protocol\n ProtocolUnexpectedMessage = 5000,\n ProtocolCommandError = 5001,\n ProtocolMessageError = 5002,\n\n // Device state\n DeviceStateBlindSignNotSupported = 6001,\n DeviceStateOnlyV4Supported = 6002,\n DeviceStateEthAppClosed = 6003,\n DeviceStateEthAppOutOfDate = 6004,\n\n // Mobile/BLE Permission Errors\n PermissionBluetoothDenied = 7000,\n PermissionLocationDenied = 7001,\n PermissionNearbyDevicesDenied = 7002,\n BluetoothDisabled = 7100,\n BluetoothScanFailed = 7101,\n BluetoothConnectionFailed = 7102,\n MobileNotSupported = 7300,\n\n // Transaction\n TxInsufficientFunds = 10000,\n\n // Unknown/fallback\n Unknown = 99999,\n}\n\n// Severity Enum\nexport enum Severity {\n Info = 'Info',\n Err = 'Error',\n Warning = 'Warning',\n Critical = 'Critical',\n}\n\n// Category Enum\nexport enum Category {\n Success = 'Success',\n Authentication = 'Authentication',\n Protocol = 'Protocol',\n Connection = 'Connection',\n UserAction = 'UserAction',\n DeviceState = 'DeviceState',\n Unknown = 'Unknown',\n Configuration = 'Configuration',\n}\n"]}
@@ -0,0 +1,62 @@
1
+ export declare enum ErrorCode {
2
+ Success = 0,
3
+ AuthenticationFailed = 1000,
4
+ AuthenticationIncorrectPin = 1001,
5
+ AuthenticationPinAttemptsRemaining = 1002,
6
+ AuthenticationPinCancelled = 1003,
7
+ AuthenticationDeviceLocked = 1100,
8
+ AuthenticationDeviceBlocked = 1101,
9
+ AuthenticationSecurityCondition = 1200,
10
+ AuthenticationWipeCodeMismatch = 1300,
11
+ UserRejected = 2000,
12
+ UserCancelled = 2001,
13
+ UserConfirmationRequired = 2002,
14
+ UserInputRequired = 2003,
15
+ DeviceNotReady = 3000,
16
+ DeviceInvalidSession = 3001,
17
+ DeviceDisconnected = 3003,
18
+ DeviceUsedElsewhere = 3004,
19
+ DeviceCallInProgress = 3005,
20
+ DeviceNotFound = 3010,
21
+ DeviceMultipleConnected = 3011,
22
+ DeviceMissingCapability = 3020,
23
+ DeviceBtcOnlyFirmware = 3021,
24
+ DeviceIncompatibleMode = 3030,
25
+ ConnectionTransportMissing = 4000,
26
+ ConnectionClosed = 4001,
27
+ ConnectionTimeout = 4002,
28
+ ConnectionBlocked = 4003,
29
+ ProtocolUnexpectedMessage = 5000,
30
+ ProtocolCommandError = 5001,
31
+ ProtocolMessageError = 5002,
32
+ DeviceStateBlindSignNotSupported = 6001,
33
+ DeviceStateOnlyV4Supported = 6002,
34
+ DeviceStateEthAppClosed = 6003,
35
+ DeviceStateEthAppOutOfDate = 6004,
36
+ PermissionBluetoothDenied = 7000,
37
+ PermissionLocationDenied = 7001,
38
+ PermissionNearbyDevicesDenied = 7002,
39
+ BluetoothDisabled = 7100,
40
+ BluetoothScanFailed = 7101,
41
+ BluetoothConnectionFailed = 7102,
42
+ MobileNotSupported = 7300,
43
+ TxInsufficientFunds = 10000,
44
+ Unknown = 99999
45
+ }
46
+ export declare enum Severity {
47
+ Info = "Info",
48
+ Err = "Error",
49
+ Warning = "Warning",
50
+ Critical = "Critical"
51
+ }
52
+ export declare enum Category {
53
+ Success = "Success",
54
+ Authentication = "Authentication",
55
+ Protocol = "Protocol",
56
+ Connection = "Connection",
57
+ UserAction = "UserAction",
58
+ DeviceState = "DeviceState",
59
+ Unknown = "Unknown",
60
+ Configuration = "Configuration"
61
+ }
62
+ //# sourceMappingURL=hardware-errors-enums.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hardware-errors-enums.d.cts","sourceRoot":"","sources":["../src/hardware-errors-enums.ts"],"names":[],"mappings":"AACA,oBAAY,SAAS;IAEnB,OAAO,IAAI;IAGX,oBAAoB,OAAO;IAC3B,0BAA0B,OAAO;IACjC,kCAAkC,OAAO;IACzC,0BAA0B,OAAO;IACjC,0BAA0B,OAAO;IACjC,2BAA2B,OAAO;IAClC,+BAA+B,OAAO;IACtC,8BAA8B,OAAO;IAGrC,YAAY,OAAO;IACnB,aAAa,OAAO;IACpB,wBAAwB,OAAO;IAC/B,iBAAiB,OAAO;IAGxB,cAAc,OAAO;IACrB,oBAAoB,OAAO;IAC3B,kBAAkB,OAAO;IACzB,mBAAmB,OAAO;IAC1B,oBAAoB,OAAO;IAC3B,cAAc,OAAO;IACrB,uBAAuB,OAAO;IAC9B,uBAAuB,OAAO;IAC9B,qBAAqB,OAAO;IAC5B,sBAAsB,OAAO;IAG7B,0BAA0B,OAAO;IACjC,gBAAgB,OAAO;IACvB,iBAAiB,OAAO;IACxB,iBAAiB,OAAO;IAGxB,yBAAyB,OAAO;IAChC,oBAAoB,OAAO;IAC3B,oBAAoB,OAAO;IAG3B,gCAAgC,OAAO;IACvC,0BAA0B,OAAO;IACjC,uBAAuB,OAAO;IAC9B,0BAA0B,OAAO;IAGjC,yBAAyB,OAAO;IAChC,wBAAwB,OAAO;IAC/B,6BAA6B,OAAO;IACpC,iBAAiB,OAAO;IACxB,mBAAmB,OAAO;IAC1B,yBAAyB,OAAO;IAChC,kBAAkB,OAAO;IAGzB,mBAAmB,QAAQ;IAG3B,OAAO,QAAQ;CAChB;AAGD,oBAAY,QAAQ;IAClB,IAAI,SAAS;IACb,GAAG,UAAU;IACb,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB;AAGD,oBAAY,QAAQ;IAClB,OAAO,YAAY;IACnB,cAAc,mBAAmB;IACjC,QAAQ,aAAa;IACrB,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,WAAW,gBAAgB;IAC3B,OAAO,YAAY;IACnB,aAAa,kBAAkB;CAChC"}
@@ -0,0 +1,62 @@
1
+ export declare enum ErrorCode {
2
+ Success = 0,
3
+ AuthenticationFailed = 1000,
4
+ AuthenticationIncorrectPin = 1001,
5
+ AuthenticationPinAttemptsRemaining = 1002,
6
+ AuthenticationPinCancelled = 1003,
7
+ AuthenticationDeviceLocked = 1100,
8
+ AuthenticationDeviceBlocked = 1101,
9
+ AuthenticationSecurityCondition = 1200,
10
+ AuthenticationWipeCodeMismatch = 1300,
11
+ UserRejected = 2000,
12
+ UserCancelled = 2001,
13
+ UserConfirmationRequired = 2002,
14
+ UserInputRequired = 2003,
15
+ DeviceNotReady = 3000,
16
+ DeviceInvalidSession = 3001,
17
+ DeviceDisconnected = 3003,
18
+ DeviceUsedElsewhere = 3004,
19
+ DeviceCallInProgress = 3005,
20
+ DeviceNotFound = 3010,
21
+ DeviceMultipleConnected = 3011,
22
+ DeviceMissingCapability = 3020,
23
+ DeviceBtcOnlyFirmware = 3021,
24
+ DeviceIncompatibleMode = 3030,
25
+ ConnectionTransportMissing = 4000,
26
+ ConnectionClosed = 4001,
27
+ ConnectionTimeout = 4002,
28
+ ConnectionBlocked = 4003,
29
+ ProtocolUnexpectedMessage = 5000,
30
+ ProtocolCommandError = 5001,
31
+ ProtocolMessageError = 5002,
32
+ DeviceStateBlindSignNotSupported = 6001,
33
+ DeviceStateOnlyV4Supported = 6002,
34
+ DeviceStateEthAppClosed = 6003,
35
+ DeviceStateEthAppOutOfDate = 6004,
36
+ PermissionBluetoothDenied = 7000,
37
+ PermissionLocationDenied = 7001,
38
+ PermissionNearbyDevicesDenied = 7002,
39
+ BluetoothDisabled = 7100,
40
+ BluetoothScanFailed = 7101,
41
+ BluetoothConnectionFailed = 7102,
42
+ MobileNotSupported = 7300,
43
+ TxInsufficientFunds = 10000,
44
+ Unknown = 99999
45
+ }
46
+ export declare enum Severity {
47
+ Info = "Info",
48
+ Err = "Error",
49
+ Warning = "Warning",
50
+ Critical = "Critical"
51
+ }
52
+ export declare enum Category {
53
+ Success = "Success",
54
+ Authentication = "Authentication",
55
+ Protocol = "Protocol",
56
+ Connection = "Connection",
57
+ UserAction = "UserAction",
58
+ DeviceState = "DeviceState",
59
+ Unknown = "Unknown",
60
+ Configuration = "Configuration"
61
+ }
62
+ //# sourceMappingURL=hardware-errors-enums.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hardware-errors-enums.d.mts","sourceRoot":"","sources":["../src/hardware-errors-enums.ts"],"names":[],"mappings":"AACA,oBAAY,SAAS;IAEnB,OAAO,IAAI;IAGX,oBAAoB,OAAO;IAC3B,0BAA0B,OAAO;IACjC,kCAAkC,OAAO;IACzC,0BAA0B,OAAO;IACjC,0BAA0B,OAAO;IACjC,2BAA2B,OAAO;IAClC,+BAA+B,OAAO;IACtC,8BAA8B,OAAO;IAGrC,YAAY,OAAO;IACnB,aAAa,OAAO;IACpB,wBAAwB,OAAO;IAC/B,iBAAiB,OAAO;IAGxB,cAAc,OAAO;IACrB,oBAAoB,OAAO;IAC3B,kBAAkB,OAAO;IACzB,mBAAmB,OAAO;IAC1B,oBAAoB,OAAO;IAC3B,cAAc,OAAO;IACrB,uBAAuB,OAAO;IAC9B,uBAAuB,OAAO;IAC9B,qBAAqB,OAAO;IAC5B,sBAAsB,OAAO;IAG7B,0BAA0B,OAAO;IACjC,gBAAgB,OAAO;IACvB,iBAAiB,OAAO;IACxB,iBAAiB,OAAO;IAGxB,yBAAyB,OAAO;IAChC,oBAAoB,OAAO;IAC3B,oBAAoB,OAAO;IAG3B,gCAAgC,OAAO;IACvC,0BAA0B,OAAO;IACjC,uBAAuB,OAAO;IAC9B,0BAA0B,OAAO;IAGjC,yBAAyB,OAAO;IAChC,wBAAwB,OAAO;IAC/B,6BAA6B,OAAO;IACpC,iBAAiB,OAAO;IACxB,mBAAmB,OAAO;IAC1B,yBAAyB,OAAO;IAChC,kBAAkB,OAAO;IAGzB,mBAAmB,QAAQ;IAG3B,OAAO,QAAQ;CAChB;AAGD,oBAAY,QAAQ;IAClB,IAAI,SAAS;IACb,GAAG,UAAU;IACb,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB;AAGD,oBAAY,QAAQ;IAClB,OAAO,YAAY;IACnB,cAAc,mBAAmB;IACjC,QAAQ,aAAa;IACrB,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,WAAW,gBAAgB;IAC3B,OAAO,YAAY;IACnB,aAAa,kBAAkB;CAChC"}
@@ -0,0 +1,78 @@
1
+ // Error Code Enum
2
+ export var ErrorCode;
3
+ (function (ErrorCode) {
4
+ // Success
5
+ ErrorCode[ErrorCode["Success"] = 0] = "Success";
6
+ // Authentication
7
+ ErrorCode[ErrorCode["AuthenticationFailed"] = 1000] = "AuthenticationFailed";
8
+ ErrorCode[ErrorCode["AuthenticationIncorrectPin"] = 1001] = "AuthenticationIncorrectPin";
9
+ ErrorCode[ErrorCode["AuthenticationPinAttemptsRemaining"] = 1002] = "AuthenticationPinAttemptsRemaining";
10
+ ErrorCode[ErrorCode["AuthenticationPinCancelled"] = 1003] = "AuthenticationPinCancelled";
11
+ ErrorCode[ErrorCode["AuthenticationDeviceLocked"] = 1100] = "AuthenticationDeviceLocked";
12
+ ErrorCode[ErrorCode["AuthenticationDeviceBlocked"] = 1101] = "AuthenticationDeviceBlocked";
13
+ ErrorCode[ErrorCode["AuthenticationSecurityCondition"] = 1200] = "AuthenticationSecurityCondition";
14
+ ErrorCode[ErrorCode["AuthenticationWipeCodeMismatch"] = 1300] = "AuthenticationWipeCodeMismatch";
15
+ // User action
16
+ ErrorCode[ErrorCode["UserRejected"] = 2000] = "UserRejected";
17
+ ErrorCode[ErrorCode["UserCancelled"] = 2001] = "UserCancelled";
18
+ ErrorCode[ErrorCode["UserConfirmationRequired"] = 2002] = "UserConfirmationRequired";
19
+ ErrorCode[ErrorCode["UserInputRequired"] = 2003] = "UserInputRequired";
20
+ // Device state
21
+ ErrorCode[ErrorCode["DeviceNotReady"] = 3000] = "DeviceNotReady";
22
+ ErrorCode[ErrorCode["DeviceInvalidSession"] = 3001] = "DeviceInvalidSession";
23
+ ErrorCode[ErrorCode["DeviceDisconnected"] = 3003] = "DeviceDisconnected";
24
+ ErrorCode[ErrorCode["DeviceUsedElsewhere"] = 3004] = "DeviceUsedElsewhere";
25
+ ErrorCode[ErrorCode["DeviceCallInProgress"] = 3005] = "DeviceCallInProgress";
26
+ ErrorCode[ErrorCode["DeviceNotFound"] = 3010] = "DeviceNotFound";
27
+ ErrorCode[ErrorCode["DeviceMultipleConnected"] = 3011] = "DeviceMultipleConnected";
28
+ ErrorCode[ErrorCode["DeviceMissingCapability"] = 3020] = "DeviceMissingCapability";
29
+ ErrorCode[ErrorCode["DeviceBtcOnlyFirmware"] = 3021] = "DeviceBtcOnlyFirmware";
30
+ ErrorCode[ErrorCode["DeviceIncompatibleMode"] = 3030] = "DeviceIncompatibleMode";
31
+ // Connection & transport
32
+ ErrorCode[ErrorCode["ConnectionTransportMissing"] = 4000] = "ConnectionTransportMissing";
33
+ ErrorCode[ErrorCode["ConnectionClosed"] = 4001] = "ConnectionClosed";
34
+ ErrorCode[ErrorCode["ConnectionTimeout"] = 4002] = "ConnectionTimeout";
35
+ ErrorCode[ErrorCode["ConnectionBlocked"] = 4003] = "ConnectionBlocked";
36
+ // Protocol
37
+ ErrorCode[ErrorCode["ProtocolUnexpectedMessage"] = 5000] = "ProtocolUnexpectedMessage";
38
+ ErrorCode[ErrorCode["ProtocolCommandError"] = 5001] = "ProtocolCommandError";
39
+ ErrorCode[ErrorCode["ProtocolMessageError"] = 5002] = "ProtocolMessageError";
40
+ // Device state
41
+ ErrorCode[ErrorCode["DeviceStateBlindSignNotSupported"] = 6001] = "DeviceStateBlindSignNotSupported";
42
+ ErrorCode[ErrorCode["DeviceStateOnlyV4Supported"] = 6002] = "DeviceStateOnlyV4Supported";
43
+ ErrorCode[ErrorCode["DeviceStateEthAppClosed"] = 6003] = "DeviceStateEthAppClosed";
44
+ ErrorCode[ErrorCode["DeviceStateEthAppOutOfDate"] = 6004] = "DeviceStateEthAppOutOfDate";
45
+ // Mobile/BLE Permission Errors
46
+ ErrorCode[ErrorCode["PermissionBluetoothDenied"] = 7000] = "PermissionBluetoothDenied";
47
+ ErrorCode[ErrorCode["PermissionLocationDenied"] = 7001] = "PermissionLocationDenied";
48
+ ErrorCode[ErrorCode["PermissionNearbyDevicesDenied"] = 7002] = "PermissionNearbyDevicesDenied";
49
+ ErrorCode[ErrorCode["BluetoothDisabled"] = 7100] = "BluetoothDisabled";
50
+ ErrorCode[ErrorCode["BluetoothScanFailed"] = 7101] = "BluetoothScanFailed";
51
+ ErrorCode[ErrorCode["BluetoothConnectionFailed"] = 7102] = "BluetoothConnectionFailed";
52
+ ErrorCode[ErrorCode["MobileNotSupported"] = 7300] = "MobileNotSupported";
53
+ // Transaction
54
+ ErrorCode[ErrorCode["TxInsufficientFunds"] = 10000] = "TxInsufficientFunds";
55
+ // Unknown/fallback
56
+ ErrorCode[ErrorCode["Unknown"] = 99999] = "Unknown";
57
+ })(ErrorCode || (ErrorCode = {}));
58
+ // Severity Enum
59
+ export var Severity;
60
+ (function (Severity) {
61
+ Severity["Info"] = "Info";
62
+ Severity["Err"] = "Error";
63
+ Severity["Warning"] = "Warning";
64
+ Severity["Critical"] = "Critical";
65
+ })(Severity || (Severity = {}));
66
+ // Category Enum
67
+ export var Category;
68
+ (function (Category) {
69
+ Category["Success"] = "Success";
70
+ Category["Authentication"] = "Authentication";
71
+ Category["Protocol"] = "Protocol";
72
+ Category["Connection"] = "Connection";
73
+ Category["UserAction"] = "UserAction";
74
+ Category["DeviceState"] = "DeviceState";
75
+ Category["Unknown"] = "Unknown";
76
+ Category["Configuration"] = "Configuration";
77
+ })(Category || (Category = {}));
78
+ //# sourceMappingURL=hardware-errors-enums.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hardware-errors-enums.mjs","sourceRoot":"","sources":["../src/hardware-errors-enums.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAClB,MAAM,CAAN,IAAY,SA+DX;AA/DD,WAAY,SAAS;IACnB,UAAU;IACV,+CAAW,CAAA;IAEX,iBAAiB;IACjB,4EAA2B,CAAA;IAC3B,wFAAiC,CAAA;IACjC,wGAAyC,CAAA;IACzC,wFAAiC,CAAA;IACjC,wFAAiC,CAAA;IACjC,0FAAkC,CAAA;IAClC,kGAAsC,CAAA;IACtC,gGAAqC,CAAA;IAErC,cAAc;IACd,4DAAmB,CAAA;IACnB,8DAAoB,CAAA;IACpB,oFAA+B,CAAA;IAC/B,sEAAwB,CAAA;IAExB,eAAe;IACf,gEAAqB,CAAA;IACrB,4EAA2B,CAAA;IAC3B,wEAAyB,CAAA;IACzB,0EAA0B,CAAA;IAC1B,4EAA2B,CAAA;IAC3B,gEAAqB,CAAA;IACrB,kFAA8B,CAAA;IAC9B,kFAA8B,CAAA;IAC9B,8EAA4B,CAAA;IAC5B,gFAA6B,CAAA;IAE7B,yBAAyB;IACzB,wFAAiC,CAAA;IACjC,oEAAuB,CAAA;IACvB,sEAAwB,CAAA;IACxB,sEAAwB,CAAA;IAExB,WAAW;IACX,sFAAgC,CAAA;IAChC,4EAA2B,CAAA;IAC3B,4EAA2B,CAAA;IAE3B,eAAe;IACf,oGAAuC,CAAA;IACvC,wFAAiC,CAAA;IACjC,kFAA8B,CAAA;IAC9B,wFAAiC,CAAA;IAEjC,+BAA+B;IAC/B,sFAAgC,CAAA;IAChC,oFAA+B,CAAA;IAC/B,8FAAoC,CAAA;IACpC,sEAAwB,CAAA;IACxB,0EAA0B,CAAA;IAC1B,sFAAgC,CAAA;IAChC,wEAAyB,CAAA;IAEzB,cAAc;IACd,2EAA2B,CAAA;IAE3B,mBAAmB;IACnB,mDAAe,CAAA;AACjB,CAAC,EA/DW,SAAS,KAAT,SAAS,QA+DpB;AAED,gBAAgB;AAChB,MAAM,CAAN,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,+BAAmB,CAAA;IACnB,iCAAqB,CAAA;AACvB,CAAC,EALW,QAAQ,KAAR,QAAQ,QAKnB;AAED,gBAAgB;AAChB,MAAM,CAAN,IAAY,QASX;AATD,WAAY,QAAQ;IAClB,+BAAmB,CAAA;IACnB,6CAAiC,CAAA;IACjC,iCAAqB,CAAA;IACrB,qCAAyB,CAAA;IACzB,qCAAyB,CAAA;IACzB,uCAA2B,CAAA;IAC3B,+BAAmB,CAAA;IACnB,2CAA+B,CAAA;AACjC,CAAC,EATW,QAAQ,KAAR,QAAQ,QASnB","sourcesContent":["// Error Code Enum\nexport enum ErrorCode {\n // Success\n Success = 0,\n\n // Authentication\n AuthenticationFailed = 1000,\n AuthenticationIncorrectPin = 1001,\n AuthenticationPinAttemptsRemaining = 1002,\n AuthenticationPinCancelled = 1003,\n AuthenticationDeviceLocked = 1100,\n AuthenticationDeviceBlocked = 1101,\n AuthenticationSecurityCondition = 1200,\n AuthenticationWipeCodeMismatch = 1300,\n\n // User action\n UserRejected = 2000,\n UserCancelled = 2001,\n UserConfirmationRequired = 2002,\n UserInputRequired = 2003,\n\n // Device state\n DeviceNotReady = 3000,\n DeviceInvalidSession = 3001,\n DeviceDisconnected = 3003,\n DeviceUsedElsewhere = 3004,\n DeviceCallInProgress = 3005,\n DeviceNotFound = 3010,\n DeviceMultipleConnected = 3011,\n DeviceMissingCapability = 3020,\n DeviceBtcOnlyFirmware = 3021,\n DeviceIncompatibleMode = 3030,\n\n // Connection & transport\n ConnectionTransportMissing = 4000,\n ConnectionClosed = 4001,\n ConnectionTimeout = 4002,\n ConnectionBlocked = 4003,\n\n // Protocol\n ProtocolUnexpectedMessage = 5000,\n ProtocolCommandError = 5001,\n ProtocolMessageError = 5002,\n\n // Device state\n DeviceStateBlindSignNotSupported = 6001,\n DeviceStateOnlyV4Supported = 6002,\n DeviceStateEthAppClosed = 6003,\n DeviceStateEthAppOutOfDate = 6004,\n\n // Mobile/BLE Permission Errors\n PermissionBluetoothDenied = 7000,\n PermissionLocationDenied = 7001,\n PermissionNearbyDevicesDenied = 7002,\n BluetoothDisabled = 7100,\n BluetoothScanFailed = 7101,\n BluetoothConnectionFailed = 7102,\n MobileNotSupported = 7300,\n\n // Transaction\n TxInsufficientFunds = 10000,\n\n // Unknown/fallback\n Unknown = 99999,\n}\n\n// Severity Enum\nexport enum Severity {\n Info = 'Info',\n Err = 'Error',\n Warning = 'Warning',\n Critical = 'Critical',\n}\n\n// Category Enum\nexport enum Category {\n Success = 'Success',\n Authentication = 'Authentication',\n Protocol = 'Protocol',\n Connection = 'Connection',\n UserAction = 'UserAction',\n DeviceState = 'DeviceState',\n Unknown = 'Unknown',\n Configuration = 'Configuration',\n}\n"]}
package/dist/index.cjs ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./hardware-errors-enums.cjs"), exports);
18
+ __exportStar(require("./hardware-error-mappings.cjs"), exports);
19
+ __exportStar(require("./hardware-error.cjs"), exports);
20
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAAwC;AACxC,gEAA0C;AAC1C,uDAAiC","sourcesContent":["export * from './hardware-errors-enums';\nexport * from './hardware-error-mappings';\nexport * from './hardware-error';\n"]}
@@ -0,0 +1,4 @@
1
+ export * from "./hardware-errors-enums.cjs";
2
+ export * from "./hardware-error-mappings.cjs";
3
+ export * from "./hardware-error.cjs";
4
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4CAAwC;AACxC,8CAA0C;AAC1C,qCAAiC"}
@@ -0,0 +1,4 @@
1
+ export * from "./hardware-errors-enums.mjs";
2
+ export * from "./hardware-error-mappings.mjs";
3
+ export * from "./hardware-error.mjs";
4
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4CAAwC;AACxC,8CAA0C;AAC1C,qCAAiC"}
package/dist/index.mjs ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./hardware-errors-enums.mjs";
2
+ export * from "./hardware-error-mappings.mjs";
3
+ export * from "./hardware-error.mjs";
4
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4CAAwC;AACxC,8CAA0C;AAC1C,qCAAiC","sourcesContent":["export * from './hardware-errors-enums';\nexport * from './hardware-error-mappings';\nexport * from './hardware-error';\n"]}
package/package.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "@metamask/hw-wallet-sdk",
3
+ "version": "0.1.0",
4
+ "description": "MetaMask Hardware Device SDK",
5
+ "keywords": [
6
+ "metamask",
7
+ "hardware-wallet"
8
+ ],
9
+ "homepage": "https://github.com/MetaMask/accounts/tree/main/packages/hw-wallet-sdk#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/MetaMask/accounts/issues"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/MetaMask/accounts.git"
16
+ },
17
+ "exports": {
18
+ ".": {
19
+ "import": {
20
+ "types": "./dist/index.d.mts",
21
+ "default": "./dist/index.mjs"
22
+ },
23
+ "require": {
24
+ "types": "./dist/index.d.cts",
25
+ "default": "./dist/index.cjs"
26
+ }
27
+ }
28
+ },
29
+ "main": "./dist/index.cjs",
30
+ "types": "./dist/index.d.cts",
31
+ "files": [
32
+ "dist/"
33
+ ],
34
+ "scripts": {
35
+ "build": "ts-bridge --project tsconfig.build.json --no-references",
36
+ "build:clean": "yarn build --clean",
37
+ "build:docs": "typedoc",
38
+ "changelog:update": "../../scripts/update-changelog.sh @metamask/hw-wallet-sdk",
39
+ "changelog:validate": "../../scripts/validate-changelog.sh @metamask/hw-wallet-sdk",
40
+ "publish:preview": "yarn npm publish --tag preview",
41
+ "test": "yarn test:source && yarn test:types",
42
+ "test:clean": "jest --clearCache",
43
+ "test:source": "jest && jest-it-up",
44
+ "test:types": "../../scripts/tsd-test.sh ./src",
45
+ "test:watch": "jest --watch"
46
+ },
47
+ "devDependencies": {
48
+ "@lavamoat/allow-scripts": "^3.2.1",
49
+ "@lavamoat/preinstall-always-fail": "^2.1.0",
50
+ "@metamask/auto-changelog": "^3.4.4",
51
+ "@ts-bridge/cli": "^0.6.3",
52
+ "@types/jest": "^29.5.12",
53
+ "@types/node": "^20.12.12",
54
+ "deepmerge": "^4.2.2",
55
+ "depcheck": "^1.4.7",
56
+ "jest": "^29.5.0",
57
+ "jest-it-up": "^3.1.0",
58
+ "rimraf": "^5.0.7",
59
+ "ts-jest": "^29.0.5",
60
+ "ts-node": "^10.9.2",
61
+ "tsd": "^0.31.0",
62
+ "typedoc": "^0.25.13",
63
+ "typescript": "~5.6.3"
64
+ },
65
+ "engines": {
66
+ "node": "^18.18 || >=20"
67
+ },
68
+ "publishConfig": {
69
+ "access": "public",
70
+ "registry": "https://registry.npmjs.org/"
71
+ },
72
+ "lavamoat": {
73
+ "allowScripts": {
74
+ "@lavamoat/preinstall-always-fail": false
75
+ }
76
+ },
77
+ "tsd": {
78
+ "directory": "src",
79
+ "compilerOptions": {
80
+ "composite": "false"
81
+ }
82
+ }
83
+ }