@onekeyfe/hwk-adapter-core 1.2.11-alpha.4 → 1.2.11-alpha.7

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createHwkError
3
- } from "./chunk-V2OHL2JS.mjs";
3
+ } from "./chunk-VKP46GTC.mjs";
4
4
 
5
5
  // src/events/ui-request.ts
6
6
  var UI_EVENT = "UI_EVENT";
@@ -184,4 +184,4 @@ export {
184
184
  UI_REQUEST_TIMEOUT_TAG,
185
185
  UiRequestRegistry
186
186
  };
187
- //# sourceMappingURL=chunk-Z574MVAT.mjs.map
187
+ //# sourceMappingURL=chunk-5AIX6YY5.mjs.map
@@ -61,6 +61,12 @@ var HardwareErrorCode = /* @__PURE__ */ ((HardwareErrorCode2) => {
61
61
  HardwareErrorCode2[HardwareErrorCode2["BtcUnexpectedState"] = 11301] = "BtcUnexpectedState";
62
62
  return HardwareErrorCode2;
63
63
  })(HardwareErrorCode || {});
64
+ var HARDWARE_ERROR_CODES = new Set(
65
+ Object.values(HardwareErrorCode).filter((value) => typeof value === "number")
66
+ );
67
+ function isHardwareErrorCode(code) {
68
+ return typeof code === "number" && HARDWARE_ERROR_CODES.has(code);
69
+ }
64
70
  var ORPHAN_ELIGIBLE_ERROR_CODES = [
65
71
  10005 /* UserAborted */,
66
72
  10001 /* UserRejected */,
@@ -252,5 +258,6 @@ function createHwkError(payload) {
252
258
 
253
259
 
254
260
 
255
- exports.HardwareErrorCode = HardwareErrorCode; exports.ORPHAN_ELIGIBLE_ERROR_CODES = ORPHAN_ELIGIBLE_ERROR_CODES; exports.isHwkRecoveryHint = isHwkRecoveryHint; exports.defaultRecoveryForCode = defaultRecoveryForCode; exports.defaultOriginForCode = defaultOriginForCode; exports.operationMayHaveCompletedParams = operationMayHaveCompletedParams; exports.createHwkError = createHwkError;
256
- //# sourceMappingURL=chunk-UFNTICCX.js.map
261
+
262
+ exports.HardwareErrorCode = HardwareErrorCode; exports.isHardwareErrorCode = isHardwareErrorCode; exports.ORPHAN_ELIGIBLE_ERROR_CODES = ORPHAN_ELIGIBLE_ERROR_CODES; exports.isHwkRecoveryHint = isHwkRecoveryHint; exports.defaultRecoveryForCode = defaultRecoveryForCode; exports.defaultOriginForCode = defaultOriginForCode; exports.operationMayHaveCompletedParams = operationMayHaveCompletedParams; exports.createHwkError = createHwkError;
263
+ //# sourceMappingURL=chunk-EJIHCWWH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/hardware-js-sdk/hardware-js-sdk/packages/hwk-adapter-core/dist/chunk-EJIHCWWH.js","../src/types/errors.ts"],"names":["HardwareErrorCode"],"mappings":"AAAA;ACwBO,IAAK,kBAAA,kBAAL,CAAA,CAAKA,kBAAAA,EAAAA,GAAL;AAEL,EAAAA,kBAAAA,CAAAA,kBAAAA,CAAA,cAAA,EAAA,EAAe,GAAA,EAAA,EAAf,cAAA;AACA,EAAAA,kBAAAA,CAAAA,kBAAAA,CAAA,cAAA,EAAA,EAAe,KAAA,EAAA,EAAf,cAAA;AACA,EAAAA,kBAAAA,CAAAA,kBAAAA,CAAA,eAAA,EAAA,EAAgB,KAAA,EAAA,EAAhB,eAAA;AACA,EAAAA,kBAAAA,CAAAA,kBAAAA,CAAA,kBAAA,EAAA,EAAmB,KAAA,EAAA,EAAnB,kBAAA;AACA,EAAAA,kBAAAA,CAAAA,kBAAAA,CAAA,oBAAA,EAAA,EAAqB,KAAA,EAAA,EAArB,oBAAA;AAEA,EAAAA,kBAAAA,CAAAA,kBAAAA,CAAA,aAAA,EAAA,EAAc,KAAA,EAAA,EAAd,aAAA;AAGA,EAAAA,kBAAAA,CAAAA,kBAAAA,CAAA,gBAAA,EAAA,EAAiB,KAAA,EAAA,EAAjB,gBAAA;AACA,EAAAA,kBAAAA,CAAAA,kBAAAA,CAAA,oBAAA,EAAA,EAAqB,KAAA,EAAA,EAArB,oBAAA;AACA,EAAAA,kBAAAA,CAAA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GAAI,OAAA,CAAQ,QAAA,IAAY,KAAA,EAAA,GAAa,EAAE,OAAA,EAAS,OAAA,CAAQ,QAAQ,CAAA;AAAA,IAChE,GAAI,OAAA,CAAQ,OAAA,IAAW,KAAA,EAAA,GAAa,EAAE,MAAA,EAAQ,OAAA,CAAQ,OAAO;AAAA,EAC/D,CAAC,CAAA;AACH;AD/PA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,qbAAC","file":"/home/runner/work/hardware-js-sdk/hardware-js-sdk/packages/hwk-adapter-core/dist/chunk-EJIHCWWH.js","sourcesContent":[null,"/**\n * HWK HardwareErrorCode — independent namespace from the legacy\n * `@onekeyfe/shared` HardwareErrorCode (which occupies 0-902).\n *\n * All HWK codes are 5-digit (>= 10000) so the two tables never collide\n * even if either side grows. Each sub-category gets a 100-slot block.\n *\n * 10000-10099 Generic / cross-cutting primitives\n * 10100-10199 Device state\n * 10200-10299 Firmware\n * 10300-10399 Transport + OS-level permission\n * 10400-10499 PIN / Passphrase\n * 10500-10599 App lifecycle (wrong app, not open, too old)\n * 10600-10699 Payload / framing limits (adapter-level)\n * 10700-10999 RESERVED, future adapter-level categories\n *\n * 11000-11099 EVM APDU (reactive mapping)\n * 11100-11199 Solana APDU\n * 11200-11299 Tron APDU\n * 11300-11399 BTC APDU\n * 11400-11999 RESERVED — future chain APDU blocks (100 per chain)\n *\n * 12000-99999 RESERVED — future major categories\n */\nexport enum HardwareErrorCode {\n // --- 10000s Generic ---\n UnknownError = 10000,\n UserRejected = 10001,\n InvalidParams = 10002,\n OperationTimeout = 10003,\n MethodNotSupported = 10004,\n /** User dismissed in-app cancel UI. Distinct from UserRejected (on-device). */\n UserAborted = 10005,\n\n // --- 10100s Device state ---\n DeviceNotFound = 10100,\n DeviceDisconnected = 10101,\n DeviceBusy = 10102,\n DeviceLocked = 10103,\n DeviceNotInitialized = 10104,\n DeviceInBootloader = 10105,\n DeviceMismatch = 10106,\n /** Chain app wedged (e.g. Ledger BTC 0x6901). User must exit app on device. */\n DeviceAppStuck = 10107,\n /** Vendor (Ledger / Trezor) doesn't support the chain at all. */\n ChainNotSupported = 10108,\n /** Current operation supports only one connected device. */\n DeviceOneDeviceOnly = 10109,\n /**\n * The device rejected the requested derivation path (Trezor Failure_DataError\n * \"Forbidden key path\") — the path is non-standard or its index is outside the\n * range the device's safety checks allow. Distinct from ChainNotSupported\n * (whole chain) and MethodNotSupported (the operation/method itself).\n */\n DevicePathForbidden = 10110,\n /** Busy with our own in-flight request (queue guard / firmware Failure_Busy), not another app — wait and retry, don't close other apps. */\n DeviceBusyInternal = 10111,\n /** The supplied runtime-only operation id is unknown to this adapter instance. */\n OperationNotFound = 10112,\n /** The supplied operation ended and can never be resumed. */\n OperationEnded = 10113,\n /**\n * Discovery found devices but none is the expected wallet (wrong unit connected). DeviceMismatch\n * is for reaching the expected device and finding a different identity on it.\n */\n DeviceSearchMismatch = 10114,\n\n // --- 10200s Firmware ---\n FirmwareTooOld = 10200,\n FirmwareUpdateRequired = 10201,\n\n // --- 10300s Transport + permission ---\n TransportError = 10300,\n BridgeNotFound = 10301,\n TransportNotAvailable = 10302,\n /**\n * OS-level permission (Bluetooth / USB / etc.) — denied, blocked,\n * unavailable, or dismissed. Consumers surface a single \"please grant\n * permission\" toast and let the user retry manually.\n */\n DevicePermissionDenied = 10303,\n /**\n * BLE SMP pairing did not complete within the GATT bonding window.\n * GATT connected but the device didn't acknowledge SMP — typically\n * because the user didn't confirm the passkey on the device, or the\n * device went out of range mid-pairing. Distinct from OperationTimeout\n * (generic) and from DeviceLocked (Secure Element actually locked).\n */\n BlePairingTimeout = 10304,\n /** Remote network failure reaching a vendor's servers (HTTP/WS). Distinct from TransportError (local USB/BLE link). */\n NetworkError = 10305,\n /**\n * Host-managed pairing handshake failed (Trezor THP). The device rejected the\n * pairing exchange — e.g. CodeEntry: the user mistyped the code shown on the\n * device, so the CPace tag didn't match (\"Unexpected Code Entry Tag\").\n * Recoverable: the user re-pairs and re-enters the code. Distinct from\n * BlePairingTimeout (BLE SMP bonding window) and UserRejected (on-device\n * reject button).\n */\n ThpPairingFailed = 10306,\n /**\n * The OS-level BLE bond is stale/invalid, so the device rejected link\n * encryption: Android GATT_INSUF_AUTHENTICATION (status 5), CoreBluetooth\n * \"Peer removed pairing information\" (CBError 14, iOS and macOS), or a bond\n * Windows still holds that the device refuses. Happens after the device is wiped/re-flashed\n * or unpaired elsewhere while the host still holds an old bond. The SDK cannot\n * remove an OS bond — the user must forget the device in system Bluetooth\n * settings and re-pair. Distinct from BlePairingTimeout (SMP window) and\n * ThpPairingFailed (THP code mismatch).\n */\n BleBondInvalid = 10307,\n /**\n * A stored THP pairing credential was rejected by the device during the\n * handshake (device returned completion `state=0`), so the autoconnect session\n * could not be established. The SDK discards the stale credential; recovery is\n * a fresh pairing. Distinct from ThpPairingFailed (user mistyped the code\n * during an *active* pairing) and BleBondInvalid (OS-level BLE bond).\n */\n ThpPairingRequired = 10308,\n /**\n * Generic BLE connect failure with no identifiable cause, e.g. a timeout or an\n * OS reason that cannot tell a stale bond from an out-of-range / unresponsive\n * device. Surfaced as a\n * generic \"couldn't connect — check the device, re-pair if paired before\".\n * Distinct from BleBondInvalid (a *known* stale-bond signal)\n * and BlePairingTimeout (the SMP bonding window).\n */\n BleConnectFailed = 10309,\n /**\n * The user cancelled BLE pairing from the app while the connect was still\n * waiting on the OS pairing window. Not a failure to report — the flow ends\n * because they asked it to. Distinct from UserAborted (generic in-app cancel)\n * so the pairing UI can close quietly instead of surfacing a connect error,\n * and from BlePairingTimeout (the SMP window elapsed on its own).\n */\n BlePairingCancelled = 10310,\n /**\n * Ledger manager-api WebSocket (app install/uninstall, genuine check) broke while relaying APDUs.\n * The device link is fine, so retry; NetworkError never carried device traffic.\n */\n LedgerSecureChannelError = 10311,\n /**\n * Vendor metadata service returned an unusable payload (Ledger firmware metadata, app catalog).\n * The request succeeded, so callers must not treat it as a dropped link.\n */\n LedgerFirmwareMetadataError = 10312,\n\n // --- 10400s PIN / Passphrase ---\n PinInvalid = 10400,\n PinCancelled = 10401,\n PassphraseRejected = 10402,\n /**\n * The passphrase entered produced a different wallet (`passphraseState`) than\n * the one the caller asked to operate on. Trezor-only: the host pins a wallet\n * by its derived state and the SDK refuses to sign with a mismatched\n * passphrase session. Surfaced by TrezorAdapter.getPassphraseState.\n */\n PassphraseStateMismatch = 10403,\n /**\n * The two new-PIN entries did not match during set/change PIN. Only host-input\n * models (Trezor Model One matrix) surface this; on-device-input models show\n * the mismatch on the device and never return it.\n */\n PinMismatch = 10404,\n /** Standard wallet is unavailable while Trezor enforces on-device passphrase entry. */\n PassphraseAlwaysOnDevice = 10405,\n\n // --- 10500s App lifecycle ---\n /** Chain app NOT INSTALLED on device. User must install via Ledger Live. */\n AppNotInstalled = 10500,\n WrongApp = 10501,\n /** 0x911c Command code not supported — app predates current SDK. */\n AppTooOld = 10502,\n /** Not enough free storage for install/update; user must uninstall apps first. */\n DeviceOutOfMemory = 10503,\n /** Install refused, the app is already on the device; benign when the caller only needs it. */\n AppAlreadyInstalled = 10504,\n\n // --- 10600s Payload / framing limits ---\n /**\n * Payload exceeds a transport's framing cap (Keystone USB: ~12.5KB, 200 frames of 64 bytes).\n * Retrying on the same transport fails the same way; switch channel or shrink the payload.\n */\n PayloadTooLarge = 10600,\n /**\n * One QR request would ask the device for more keys than it accepts (Keystone: 24 account\n * paths). Nothing is sent; USB asks per key and is not limited this way.\n */\n QrRequestTooLarge = 10601,\n\n // --- 11000s EVM (Ledger Ethereum App) APDU-specific ---\n /** 0x6a80 Invalid data — observed on blindSignTransactionFallback when the\n * user has not enabled Blind signing on the device. */\n EvmBlindSigningRequired = 11000,\n /** 0x6984 Plugin not installed */\n EvmClearSignPluginMissing = 11001,\n /** 0x6a84 Insufficient memory (typical on Nano S with large calldata) */\n EvmDataTooLarge = 11002,\n /** 0x6501 TransactionType not supported (app too old for EIP-1559 / blob / 7702) */\n EvmTxTypeNotSupported = 11003,\n\n // --- 11100s Solana ---\n /** 0x6808 Blind signing disabled for this instruction. */\n SolanaBlindSigningRequired = 11100,\n\n // --- 11200s Tron ---\n /** 0x6a8d Custom Contracts setting disabled (blocks TRC-20 etc.). */\n TronCustomContractRequired = 11200,\n /** 0x6a8b Transactions Data setting disabled. */\n TronDataSigningRequired = 11201,\n /** 0x6a8c Sign by Hash setting disabled (hash-signing fallback). */\n TronSignByHashRequired = 11202,\n\n // --- 11300s BTC ---\n /** 0xb008 Wallet policy HMAC mismatch or not registered. */\n BtcWalletPolicyHmacMismatch = 11300,\n /** 0xb007 Aborted due to unexpected state (malformed PSBT / missing UTXO). */\n BtcUnexpectedState = 11301,\n}\n\nconst HARDWARE_ERROR_CODES = new Set<number>(\n Object.values(HardwareErrorCode).filter((value): value is number => typeof value === 'number')\n);\n\n/** DOMExceptions and host errors carry numeric `code`s too (0, 20, -99999); only ours count. */\nexport function isHardwareErrorCode(code: unknown): code is HardwareErrorCode {\n return typeof code === 'number' && HARDWARE_ERROR_CODES.has(code);\n}\n\n/**\n * Device-level failures the SDK cannot self-recover from — affect the entire\n * batch (vs per-chain failures like AppNotInstalled / WrongApp which soft-\n * skip in onboarding). Combined with `accounts.length === 0`, signals\n * genuine orphan. Also reused as the batch-abort whitelist for HWK.\n * Single source of truth.\n *\n * UserRejected (device-side reject) is included: pressing reject is an\n * explicit \"I don't consent\" — continuing the batch to ask again on the\n * next chain is harassment, not helpful.\n */\nexport const ORPHAN_ELIGIBLE_ERROR_CODES: number[] = [\n HardwareErrorCode.UserAborted,\n HardwareErrorCode.UserRejected,\n HardwareErrorCode.DeviceNotFound,\n HardwareErrorCode.DeviceDisconnected,\n HardwareErrorCode.OperationNotFound,\n HardwareErrorCode.OperationEnded,\n HardwareErrorCode.DeviceMismatch,\n HardwareErrorCode.DeviceSearchMismatch,\n HardwareErrorCode.DeviceAppStuck,\n HardwareErrorCode.DeviceOneDeviceOnly,\n HardwareErrorCode.TransportError,\n HardwareErrorCode.DevicePermissionDenied,\n HardwareErrorCode.BlePairingTimeout,\n HardwareErrorCode.ThpPairingFailed,\n HardwareErrorCode.ThpPairingRequired,\n HardwareErrorCode.BleBondInvalid,\n HardwareErrorCode.BleConnectFailed,\n HardwareErrorCode.BlePairingCancelled,\n HardwareErrorCode.PassphraseAlwaysOnDevice,\n];\n\n// ---------------------------------------------------------------------------\n// Standard throwable for HWK adapters\n// ---------------------------------------------------------------------------\n\n/**\n * Where a failure came from; code ranges can't tell (UserRejected=10001 is the device,\n * DevicePermissionDenied=10303 is the host).\n * `device`: the firmware answered (rejection, locked, wrong PIN); surface verbatim, never\n * auto-reconnect, switch channels, or drop a healthy session.\n * `transport`: the pipe failed (cable pulled, bus reset); reconnecting is fair game.\n * `host`: the environment refused (permission, picker, bad params); fix it, not the link.\n * A mapper that can't tell leaves it unset so consumers fall back to code-based tables.\n */\nexport type HwkErrorOrigin = 'device' | 'transport' | 'host';\n\n/**\n * Smallest resource to replace before retrying; never permission to auto-replay a signing command.\n * `call`: nothing. `operation`: rebind from the target if its identity is persistent.\n * `search-target`: rediscover and reselect. `transport`: repair or switch transport.\n * `not-recoverable`: retrying cannot succeed. `unknown`: no safe claim.\n */\nexport type HwkRecoveryScope =\n | 'call'\n | 'operation'\n | 'search-target'\n | 'transport'\n | 'not-recoverable'\n | 'unknown';\n\nexport interface HwkRecoveryHint {\n scope: HwkRecoveryScope;\n}\n\nconst RECOVERY_SCOPES = new Set<HwkRecoveryScope>([\n 'call',\n 'operation',\n 'search-target',\n 'transport',\n 'not-recoverable',\n 'unknown',\n]);\n\nexport function isHwkRecoveryHint(value: unknown): value is HwkRecoveryHint {\n if (!value || typeof value !== 'object') return false;\n const { scope } = value as { scope?: unknown };\n return typeof scope === 'string' && RECOVERY_SCOPES.has(scope as HwkRecoveryScope);\n}\n\nconst RECOVERY_CALL: HwkRecoveryHint = Object.freeze({ scope: 'call' });\nconst RECOVERY_OPERATION: HwkRecoveryHint = Object.freeze({ scope: 'operation' });\nconst RECOVERY_SEARCH_TARGET: HwkRecoveryHint = Object.freeze({ scope: 'search-target' });\nconst RECOVERY_TRANSPORT: HwkRecoveryHint = Object.freeze({ scope: 'transport' });\nconst RECOVERY_NOT_RECOVERABLE: HwkRecoveryHint = Object.freeze({\n scope: 'not-recoverable',\n});\nconst RECOVERY_UNKNOWN: HwkRecoveryHint = Object.freeze({ scope: 'unknown' });\n\n/** Vendor-neutral fallback; adapters may stamp a narrower hint when session state is clear. */\nexport function defaultRecoveryForCode(code: HardwareErrorCode): HwkRecoveryHint {\n switch (code) {\n case HardwareErrorCode.UserRejected:\n case HardwareErrorCode.UserAborted:\n case HardwareErrorCode.DeviceBusy:\n case HardwareErrorCode.DeviceLocked:\n case HardwareErrorCode.DeviceNotInitialized:\n case HardwareErrorCode.DeviceInBootloader:\n case HardwareErrorCode.DeviceAppStuck:\n case HardwareErrorCode.DeviceBusyInternal:\n case HardwareErrorCode.NetworkError:\n case HardwareErrorCode.LedgerSecureChannelError:\n case HardwareErrorCode.LedgerFirmwareMetadataError:\n case HardwareErrorCode.PinInvalid:\n case HardwareErrorCode.PinCancelled:\n case HardwareErrorCode.PassphraseRejected:\n case HardwareErrorCode.PassphraseStateMismatch:\n case HardwareErrorCode.PinMismatch:\n case HardwareErrorCode.FirmwareTooOld:\n case HardwareErrorCode.FirmwareUpdateRequired:\n case HardwareErrorCode.AppNotInstalled:\n case HardwareErrorCode.WrongApp:\n case HardwareErrorCode.AppTooOld:\n case HardwareErrorCode.DeviceOutOfMemory:\n case HardwareErrorCode.AppAlreadyInstalled:\n case HardwareErrorCode.EvmBlindSigningRequired:\n case HardwareErrorCode.EvmClearSignPluginMissing:\n case HardwareErrorCode.EvmDataTooLarge:\n case HardwareErrorCode.EvmTxTypeNotSupported:\n case HardwareErrorCode.SolanaBlindSigningRequired:\n case HardwareErrorCode.TronCustomContractRequired:\n case HardwareErrorCode.TronDataSigningRequired:\n case HardwareErrorCode.TronSignByHashRequired:\n case HardwareErrorCode.BtcWalletPolicyHmacMismatch:\n case HardwareErrorCode.BtcUnexpectedState:\n return RECOVERY_CALL;\n case HardwareErrorCode.DeviceNotFound:\n case HardwareErrorCode.DeviceDisconnected:\n case HardwareErrorCode.OperationNotFound:\n case HardwareErrorCode.OperationEnded:\n case HardwareErrorCode.TransportError:\n case HardwareErrorCode.BlePairingTimeout:\n case HardwareErrorCode.ThpPairingFailed:\n case HardwareErrorCode.ThpPairingRequired:\n case HardwareErrorCode.BleConnectFailed:\n case HardwareErrorCode.BlePairingCancelled:\n return RECOVERY_OPERATION;\n case HardwareErrorCode.DeviceMismatch:\n case HardwareErrorCode.DeviceSearchMismatch:\n case HardwareErrorCode.DeviceOneDeviceOnly:\n case HardwareErrorCode.BleBondInvalid:\n return RECOVERY_SEARCH_TARGET;\n case HardwareErrorCode.BridgeNotFound:\n case HardwareErrorCode.TransportNotAvailable:\n case HardwareErrorCode.DevicePermissionDenied:\n case HardwareErrorCode.PayloadTooLarge:\n case HardwareErrorCode.QrRequestTooLarge:\n return RECOVERY_TRANSPORT;\n case HardwareErrorCode.InvalidParams:\n case HardwareErrorCode.MethodNotSupported:\n case HardwareErrorCode.ChainNotSupported:\n case HardwareErrorCode.DevicePathForbidden:\n return RECOVERY_NOT_RECOVERABLE;\n case HardwareErrorCode.UnknownError:\n case HardwareErrorCode.OperationTimeout:\n default:\n return RECOVERY_UNKNOWN;\n }\n}\n\n/**\n * Default code-to-origin table; vendors override only where their mapping knows better.\n * Context-dependent codes (UnknownError, OperationTimeout, DeviceBusy) return undefined.\n */\nexport function defaultOriginForCode(code: HardwareErrorCode): HwkErrorOrigin | undefined {\n // Chain APDU codes (11000+) are always the device's chain app refusing or qualifying a request.\n if (code >= 11_000) return 'device';\n switch (code) {\n case HardwareErrorCode.UserRejected:\n case HardwareErrorCode.DeviceLocked:\n case HardwareErrorCode.DeviceNotInitialized:\n case HardwareErrorCode.DeviceInBootloader:\n case HardwareErrorCode.DeviceMismatch:\n case HardwareErrorCode.DeviceSearchMismatch:\n case HardwareErrorCode.DeviceAppStuck:\n case HardwareErrorCode.DevicePathForbidden:\n case HardwareErrorCode.DeviceBusyInternal:\n case HardwareErrorCode.ChainNotSupported:\n case HardwareErrorCode.FirmwareTooOld:\n case HardwareErrorCode.FirmwareUpdateRequired:\n case HardwareErrorCode.PinInvalid:\n case HardwareErrorCode.PinMismatch:\n case HardwareErrorCode.PassphraseRejected:\n case HardwareErrorCode.PassphraseStateMismatch:\n case HardwareErrorCode.ThpPairingFailed:\n case HardwareErrorCode.ThpPairingRequired:\n case HardwareErrorCode.WrongApp:\n case HardwareErrorCode.AppNotInstalled:\n case HardwareErrorCode.AppTooOld:\n case HardwareErrorCode.DeviceOutOfMemory:\n case HardwareErrorCode.AppAlreadyInstalled:\n return 'device';\n case HardwareErrorCode.DeviceNotFound:\n case HardwareErrorCode.DeviceDisconnected:\n case HardwareErrorCode.TransportError:\n case HardwareErrorCode.BridgeNotFound:\n case HardwareErrorCode.TransportNotAvailable:\n case HardwareErrorCode.BlePairingTimeout:\n case HardwareErrorCode.NetworkError:\n case HardwareErrorCode.LedgerSecureChannelError:\n case HardwareErrorCode.LedgerFirmwareMetadataError:\n case HardwareErrorCode.BleBondInvalid:\n case HardwareErrorCode.BleConnectFailed:\n return 'transport';\n case HardwareErrorCode.DevicePermissionDenied:\n case HardwareErrorCode.UserAborted:\n case HardwareErrorCode.InvalidParams:\n case HardwareErrorCode.MethodNotSupported:\n case HardwareErrorCode.PinCancelled:\n case HardwareErrorCode.BlePairingCancelled:\n case HardwareErrorCode.PayloadTooLarge:\n case HardwareErrorCode.QrRequestTooLarge:\n case HardwareErrorCode.DeviceOneDeviceOnly:\n return 'host';\n default:\n return undefined;\n }\n}\n\nexport interface IHwkErrorPayload {\n code: HardwareErrorCode;\n message: string;\n origin?: HwkErrorOrigin;\n recovery?: HwkRecoveryHint;\n appName?: string;\n _tag?: string;\n params?: Record<string, unknown>;\n}\n\nexport interface IOperationMayHaveCompletedParams extends Record<string, unknown> {\n operationMayHaveCompleted: true;\n method: string;\n}\n\n/**\n * Marks an unsafe request whose response was lost after dispatch; the transport error is not proof\n * that the device rejected or skipped it.\n */\nexport function operationMayHaveCompletedParams(\n method: string,\n params?: Record<string, unknown>\n): IOperationMayHaveCompletedParams {\n return {\n ...params,\n operationMayHaveCompleted: true,\n method,\n };\n}\n\nexport type HwkError = Error & {\n code: HardwareErrorCode;\n /** See {@link HwkErrorOrigin}. Survives serializeConnectorError/rehydrate via `params`. */\n origin?: HwkErrorOrigin;\n recovery?: HwkRecoveryHint;\n appName?: string;\n _tag?: string;\n params?: Record<string, unknown>;\n};\n\n/**\n * Canonical throwable for HWK adapters. Plain Error + canonical extra fields,\n * shape-compatible with `rehydrateConnectorError` so locally-thrown and\n * cross-boundary errors are indistinguishable to downstream classifiers\n * (`err.code` / `err._tag` / `err.appName`). Do NOT mutate caught errors\n * with `Object.assign` — construct a fresh one via this factory.\n */\nexport function createHwkError(payload: IHwkErrorPayload): HwkError {\n const recovery = payload.recovery ?? defaultRecoveryForCode(payload.code);\n return Object.assign(new Error(payload.message), {\n code: payload.code,\n ...(payload.origin !== undefined && { origin: payload.origin }),\n recovery,\n ...(payload._tag !== undefined && { _tag: payload._tag }),\n ...(payload.appName !== undefined && { appName: payload.appName }),\n ...(payload.params !== undefined && { params: payload.params }),\n });\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkUFNTICCXjs = require('./chunk-UFNTICCX.js');
3
+ var _chunkEJIHCWWHjs = require('./chunk-EJIHCWWH.js');
4
4
 
5
5
  // src/events/ui-request.ts
6
6
  var UI_EVENT = "UI_EVENT";
@@ -127,7 +127,7 @@ var UiRequestRegistry = class {
127
127
  this.pending.delete(requestType);
128
128
  if (requestType === UI_REQUEST.REQUEST_SELECT_DEVICE && _optionalChain([response, 'optionalAccess', _9 => _9.cancelled]) === true) {
129
129
  entry.reject(
130
- _chunkUFNTICCXjs.createHwkError.call(void 0, {
130
+ _chunkEJIHCWWHjs.createHwkError.call(void 0, {
131
131
  code: 10005 /* UserAborted */,
132
132
  message: "Device selection was cancelled",
133
133
  _tag: UI_REQUEST_CANCELLED_TAG
@@ -184,4 +184,4 @@ var UiRequestRegistry = class {
184
184
 
185
185
 
186
186
  exports.UI_EVENT = UI_EVENT; exports.UI_REQUEST = UI_REQUEST; exports.UI_RESPONSE = UI_RESPONSE; exports.UI_REQUEST_DEFAULT_TIMEOUT_MS = UI_REQUEST_DEFAULT_TIMEOUT_MS; exports.UI_REQUEST_PREEMPTED_TAG = UI_REQUEST_PREEMPTED_TAG; exports.UI_REQUEST_CANCELLED_TAG = UI_REQUEST_CANCELLED_TAG; exports.UI_REQUEST_TIMEOUT_TAG = UI_REQUEST_TIMEOUT_TAG; exports.UiRequestRegistry = UiRequestRegistry;
187
- //# sourceMappingURL=chunk-P7RDL34T.js.map
187
+ //# sourceMappingURL=chunk-MVP46CIZ.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/hardware-js-sdk/hardware-js-sdk/packages/hwk-adapter-core/dist/chunk-P7RDL34T.js","../src/events/ui-request.ts","../src/utils/UiRequestRegistry.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACA;ACFO,IAAM,SAAA,EAAW,UAAA;AAEjB,IAAM,WAAA,EAAa;AAAA,EACxB,WAAA,EAAa,gBAAA;AAAA,EACb,kBAAA,EAAoB,uBAAA;AAAA;AAAA;AAAA,EAGpB,4BAAA,EAA8B,iCAAA;AA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,UAAA;AACP,QAAA;AACH,MAAA;AACF,IAAA;AAEwC,IAAA;AAEG,IAAA;AACV,MAAA;AACM,QAAA;AACF,UAAA;AAC/B,UAAA;AACyC,YAAA;AAC/B,cAAA;AACP,YAAA;AACH,UAAA;AACF,QAAA;AACU,MAAA;AAEkB,MAAA;AACR,QAAA;AACE,QAAA;AACtB,QAAA;AACA,QAAA;AACA,QAAA;AACD,MAAA;AACF,IAAA;AACH,EAAA;AAEsD,EAAA;AACd,IAAA;AACL,IAAA;AACC,MAAA;AACL,QAAA;AACY,MAAA;AACZ,QAAA;AAC3B,MAAA;AACF,IAAA;AACkB,IAAA;AAEwB,IAAA;AAC9B,IAAA;AAGoB,IAAA;AAIe,IAAA;AACvB,IAAA;AACO,IAAA;AACA,IAAA;AACvB,MAAA;AACW,QAAA;AACb,UAAA;AACS,UAAA;AACH,UAAA;AACP,QAAA;AACH,MAAA;AACA,MAAA;AACF,IAAA;AACqB,IAAA;AACvB,EAAA;AAAA;AAAA;AAAA;AAAA;AAM6E,EAAA;AACrB,IAAA;AAC5B,MAAA;AACA,MAAA;AAClB,MAAA;AACuC,QAAA;AACnC,UAAA;AACP,QAAA;AACH,MAAA;AACF,IAAA;AAEiB,IAAA;AAC2B,MAAA;AAC9B,MAAA;AACyB,MAAA;AACE,MAAA;AACd,MAAA;AACzB,MAAA;AACF,IAAA;AAE+C,IAAA;AACN,MAAA;AACnB,QAAA;AACpB,MAAA;AACF,IAAA;AACF,EAAA;AAEc,EAAA;AACA,IAAA;AACd,EAAA;AAE0C,EAAA;AACC,IAAA;AACd,IAAA;AAC7B,EAAA;AACF;AFQmD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/hardware-js-sdk/hardware-js-sdk/packages/hwk-adapter-core/dist/chunk-P7RDL34T.js","sourcesContent":[null,"import type { QrResponseData } from '../types/qr';\n\nexport const UI_EVENT = 'UI_EVENT';\n\nexport const UI_REQUEST = {\n REQUEST_PIN: 'ui-request-pin',\n REQUEST_PASSPHRASE: 'ui-request-passphrase',\n // One-way UI notification: device is waiting for passphrase entry on-device.\n // The prompt response path remains RECEIVE_PASSPHRASE with passphraseOnDevice=true.\n REQUEST_PASSPHRASE_ON_DEVICE: 'ui-request-passphrase-on-device',\n REQUEST_BUTTON: 'ui-request-button',\n REQUEST_QR_DISPLAY: 'ui-request-qr-display',\n REQUEST_QR_SCAN: 'ui-request-qr-scan',\n REQUEST_DEVICE_PERMISSION: 'ui-request-device-permission',\n REQUEST_SELECT_DEVICE: 'ui-request-select-device',\n REQUEST_SAVE_DEVICE_BINDING: 'ui-request-save-device-binding',\n DEVICE_BINDING_STATUS: 'ui-device-binding-status',\n REQUEST_DEVICE_CONNECT: 'ui-request-device-connect',\n // Ledger BTC App: account index >= 100 requires display=true. Adapter asks\n // the user once per session before promoting the call.\n REQUEST_BTC_HIGH_INDEX_CONFIRM: 'ui-request-btc-high-index-confirm',\n // Required app is not installed; with autoInstallApp on, ask the user\n // whether to install it before retrying the operation.\n REQUEST_INSTALL_APP: 'ui-request-install-app',\n // The request cannot go over USB (see QrFallbackReason); ask whether to show it as a QR instead.\n REQUEST_QR_FALLBACK_CONFIRM: 'ui-request-qr-fallback-confirm',\n REQUEST_PREEMPTION: 'ui-request-preemption',\n REQUEST_TREZOR_THP_PAIRING: 'ui-request-trezor-thp-pairing',\n CLOSE_UI_WINDOW: 'ui-close',\n DEVICE_PROGRESS: 'ui-device_progress',\n FIRMWARE_PROGRESS: 'ui-firmware-progress',\n FIRMWARE_TIP: 'ui-firmware-tip',\n} as const;\n\nexport const UI_RESPONSE = {\n RECEIVE_PIN: 'receive-pin',\n RECEIVE_PASSPHRASE: 'receive-passphrase',\n RECEIVE_QR_RESPONSE: 'receive-qr-response',\n RECEIVE_SELECT_DEVICE: 'receive-select-device',\n RECEIVE_SAVE_DEVICE_BINDING: 'receive-save-device-binding',\n RECEIVE_DEVICE_CONNECT: 'receive-device-connect',\n RECEIVE_DEVICE_PERMISSION: 'receive-device-permission',\n RECEIVE_BTC_HIGH_INDEX_CONFIRM: 'receive-btc-high-index-confirm',\n RECEIVE_INSTALL_APP: 'receive-install-app',\n RECEIVE_QR_FALLBACK_CONFIRM: 'receive-qr-fallback-confirm',\n RECEIVE_PREEMPTION: 'receive-preemption',\n RECEIVE_TREZOR_THP_PAIRING: 'receive-trezor-thp-pairing',\n CANCEL: 'cancel',\n} as const;\n\n/**\n * The operation a UI request was opened under, so a cancel for one operation spares another's\n * prompts. Absent outside any operation (cold start, teardown).\n */\nexport type UiRequestOperationAttribution = {\n operationId?: string;\n};\n\nexport type DevicePermissionDeniedReason =\n | 'bluetoothTurnedOff'\n | 'permissionDenied'\n | (string & Record<never, never>);\n\nexport type DevicePermissionResponse = {\n granted: boolean;\n reason?: DevicePermissionDeniedReason;\n message?: string;\n};\n\n/**\n * `mismatch`: the host's own records do not match the selected device.\n * `skipped`: the host had nothing to bind, a host contract problem rather than a user action.\n *\n * Either way the binding is not saved and `DEVICE_BINDING_STATUS` reports `failed`. A business\n * call continues; an explicit `bindBleDevice` fails because saving was its whole purpose.\n *\n * The SDK has checked the device's wallet before asking only when the request carries `identity`,\n * i.e. the call named an expected wallet (a `deviceId`); Ledger asks without one for a call that\n * names no wallet. A decline does not retire the endpoint: its session, any operation bound to it,\n * and the adapter's in-memory reconnect target for it stay in place, and later wallet-checked calls\n * still verify the wallet on it. A host that must not use the endpoint again discards the result,\n * releases the operation, and has the user select a device again.\n */\nexport type SaveDeviceBindingDeclineReason = 'mismatch' | 'skipped';\n\n/**\n * Why the request cannot go over USB. Only `payload-too-large` comes after the request was built;\n * the others mean a connected device cannot serve this wallet, so the host may offer a retry.\n */\nexport type QrFallbackReason =\n | 'payload-too-large'\n | 'wallet-mismatch'\n | 'device-locked'\n | 'usb-unavailable';\n\nexport type UiResponseEvent =\n | {\n type: typeof UI_RESPONSE.RECEIVE_SAVE_DEVICE_BINDING;\n payload: {\n requestId: string;\n saved: boolean;\n reason?: SaveDeviceBindingDeclineReason;\n };\n }\n | {\n type: typeof UI_RESPONSE.RECEIVE_PIN;\n payload: string;\n }\n | {\n type: typeof UI_RESPONSE.RECEIVE_PASSPHRASE;\n payload: {\n value: string;\n passphraseOnDevice?: boolean;\n save?: boolean;\n };\n }\n | {\n type: typeof UI_RESPONSE.RECEIVE_QR_RESPONSE;\n payload: QrResponseData;\n }\n | {\n // sdkConnectId echoes one of the DeviceInfo.connectId values emitted in\n // the REQUEST_SELECT_DEVICE event's `devices` list. Scope is the current\n // search session; may be ephemeral (e.g. Ledger USB DMK UUID).\n type: typeof UI_RESPONSE.RECEIVE_SELECT_DEVICE;\n /**\n * `requestId` must echo the `REQUEST_SELECT_DEVICE` request's id. It stays optional in the\n * type for compatibility, but an answer without it (or with another id) is ignored and the\n * selection keeps waiting until its timeout.\n */\n payload: { requestId?: string } & (\n | { sdkConnectId: string; cancelled?: false }\n | { cancelled: true }\n );\n }\n | {\n type: typeof UI_RESPONSE.RECEIVE_DEVICE_CONNECT;\n payload: { confirmed: boolean };\n }\n | {\n type: typeof UI_RESPONSE.RECEIVE_DEVICE_PERMISSION;\n payload: DevicePermissionResponse;\n }\n | {\n type: typeof UI_RESPONSE.RECEIVE_BTC_HIGH_INDEX_CONFIRM;\n payload: { confirmed: boolean };\n }\n | {\n type: typeof UI_RESPONSE.RECEIVE_INSTALL_APP;\n payload: { confirmed: boolean };\n }\n | {\n type: typeof UI_RESPONSE.RECEIVE_QR_FALLBACK_CONFIRM;\n /**\n * Echo the prompt's requestId; missing or stale IDs are ignored. `retry` asks to look for\n * the USB device again; it is ignored for `payload-too-large`.\n */\n payload: { confirmed: boolean; retry?: boolean; requestId?: string };\n }\n | {\n type: typeof UI_RESPONSE.RECEIVE_PREEMPTION;\n payload: { confirmed: boolean };\n }\n | {\n type: typeof UI_RESPONSE.RECEIVE_TREZOR_THP_PAIRING;\n payload: {\n selectedMethod?: number | string;\n tag?: string;\n };\n }\n | {\n type: typeof UI_RESPONSE.CANCEL;\n payload?: undefined;\n };\n","import { UI_REQUEST, UI_RESPONSE } from '../events/ui-request';\nimport { HardwareErrorCode, createHwkError } from '../types/errors';\n\n/** 10 min — every UI request is human-in-the-loop; bias toward \"wait long\". */\nexport const UI_REQUEST_DEFAULT_TIMEOUT_MS = 600_000;\n\nconst RESPONSE_TO_REQUEST: Record<string, string> = {\n [UI_RESPONSE.RECEIVE_PIN]: UI_REQUEST.REQUEST_PIN,\n [UI_RESPONSE.RECEIVE_PASSPHRASE]: UI_REQUEST.REQUEST_PASSPHRASE,\n [UI_RESPONSE.RECEIVE_SELECT_DEVICE]: UI_REQUEST.REQUEST_SELECT_DEVICE,\n [UI_RESPONSE.RECEIVE_SAVE_DEVICE_BINDING]: UI_REQUEST.REQUEST_SAVE_DEVICE_BINDING,\n [UI_RESPONSE.RECEIVE_DEVICE_CONNECT]: UI_REQUEST.REQUEST_DEVICE_CONNECT,\n [UI_RESPONSE.RECEIVE_DEVICE_PERMISSION]: UI_REQUEST.REQUEST_DEVICE_PERMISSION,\n [UI_RESPONSE.RECEIVE_BTC_HIGH_INDEX_CONFIRM]: UI_REQUEST.REQUEST_BTC_HIGH_INDEX_CONFIRM,\n [UI_RESPONSE.RECEIVE_INSTALL_APP]: UI_REQUEST.REQUEST_INSTALL_APP,\n [UI_RESPONSE.RECEIVE_QR_FALLBACK_CONFIRM]: UI_REQUEST.REQUEST_QR_FALLBACK_CONFIRM,\n [UI_RESPONSE.RECEIVE_PREEMPTION]: UI_REQUEST.REQUEST_PREEMPTION,\n [UI_RESPONSE.RECEIVE_TREZOR_THP_PAIRING]: UI_REQUEST.REQUEST_TREZOR_THP_PAIRING,\n // RECEIVE_QR_RESPONSE maps to QR_DISPLAY or QR_SCAN — resolved dynamically below.\n};\n\nexport const UI_REQUEST_PREEMPTED_TAG = 'UiRequestPreempted';\nexport const UI_REQUEST_CANCELLED_TAG = 'UiRequestCancelled';\nexport const UI_REQUEST_TIMEOUT_TAG = 'UiRequestTimeout';\n\nlet requestSequence = 0;\n\ntype PendingEntry = {\n requestId?: string;\n /** The operation this waiter belongs to, when it was opened under one. */\n operationId?: string;\n resolve: (payload: unknown) => void;\n reject: (error: Error) => void;\n timer: ReturnType<typeof setTimeout>;\n};\n\n/**\n * Per-type single-slot registry for adapter-level UI requests. A new `wait`\n * of the same type supersedes (rejects) the prior pending entry. With the\n * job queue running globally serially, cross-type collisions don't occur in\n * normal flow — same-type preemption is a defensive measure for callers\n * that fire the same request twice without waiting on the first.\n *\n * Unknown response types are dropped silently so the public `uiResponse`\n * entry never throws.\n */\nexport class UiRequestRegistry {\n private pending = new Map<string, PendingEntry>();\n\n createRequestId(): string {\n requestSequence += 1;\n return `hwk-ui-${Date.now()}-${requestSequence}`;\n }\n\n wait<T = unknown>(\n requestType: string,\n options?: { timeoutMs?: number; requestId?: string; operationId?: string }\n ): Promise<T> {\n const existing = this.pending.get(requestType);\n if (existing) {\n clearTimeout(existing.timer);\n this.pending.delete(requestType);\n existing.reject(\n Object.assign(new Error(`UI request '${requestType}' was superseded by a new request`), {\n _tag: UI_REQUEST_PREEMPTED_TAG,\n })\n );\n }\n\n const timeoutMs = options?.timeoutMs ?? UI_REQUEST_DEFAULT_TIMEOUT_MS;\n\n return new Promise<T>((resolve, reject) => {\n const timer = setTimeout(() => {\n if (this.pending.get(requestType)?.timer === timer) {\n this.pending.delete(requestType);\n reject(\n Object.assign(new Error(`UI request '${requestType}' timed out after ${timeoutMs}ms`), {\n _tag: UI_REQUEST_TIMEOUT_TAG,\n })\n );\n }\n }, timeoutMs);\n\n this.pending.set(requestType, {\n requestId: options?.requestId,\n operationId: options?.operationId,\n resolve: resolve as (payload: unknown) => void,\n reject,\n timer,\n });\n });\n }\n\n resolve(responseType: string, payload: unknown): void {\n let requestType = RESPONSE_TO_REQUEST[responseType];\n if (responseType === UI_RESPONSE.RECEIVE_QR_RESPONSE) {\n if (this.pending.has(UI_REQUEST.REQUEST_QR_DISPLAY)) {\n requestType = UI_REQUEST.REQUEST_QR_DISPLAY;\n } else if (this.pending.has(UI_REQUEST.REQUEST_QR_SCAN)) {\n requestType = UI_REQUEST.REQUEST_QR_SCAN;\n }\n }\n if (!requestType) return;\n\n const entry = this.pending.get(requestType);\n if (!entry) return;\n\n const response =\n payload && typeof payload === 'object'\n ? (payload as { requestId?: unknown; cancelled?: unknown })\n : undefined;\n // A late response must not resolve (or cancel) a newer request of the same type.\n if (entry.requestId !== undefined && response?.requestId !== entry.requestId) return;\n clearTimeout(entry.timer);\n this.pending.delete(requestType);\n if (requestType === UI_REQUEST.REQUEST_SELECT_DEVICE && response?.cancelled === true) {\n entry.reject(\n createHwkError({\n code: HardwareErrorCode.UserAborted,\n message: 'Device selection was cancelled',\n _tag: UI_REQUEST_CANCELLED_TAG,\n })\n );\n return;\n }\n entry.resolve(payload);\n }\n\n /**\n * Each argument narrows the cancel: none rejects every waiter (teardown); an `operationId` alone\n * rejects only that operation's prompts and leaves another operation's PIN or QR wait untouched.\n */\n cancel(requestType?: string, requestId?: string, operationId?: string): void {\n const reject = (type: string, entry: PendingEntry) => {\n clearTimeout(entry.timer);\n this.pending.delete(type);\n entry.reject(\n Object.assign(new Error(`UI request '${type}' was cancelled`), {\n _tag: UI_REQUEST_CANCELLED_TAG,\n })\n );\n };\n\n if (requestType) {\n const entry = this.pending.get(requestType);\n if (!entry) return;\n if (requestId !== undefined && entry.requestId !== requestId) return;\n if (operationId !== undefined && entry.operationId !== operationId) return;\n reject(requestType, entry);\n return;\n }\n\n for (const [type, entry] of [...this.pending]) {\n if (operationId === undefined || entry.operationId === operationId) {\n reject(type, entry);\n }\n }\n }\n\n reset(): void {\n this.cancel();\n }\n\n hasPending(requestType?: string): boolean {\n if (requestType) return this.pending.has(requestType);\n return this.pending.size > 0;\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/hardware-js-sdk/hardware-js-sdk/packages/hwk-adapter-core/dist/chunk-MVP46CIZ.js","../src/events/ui-request.ts","../src/utils/UiRequestRegistry.ts"],"names":[],"mappings":"AAAA;AACE;AACF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A;AACA;AACA","file":"/home/runner/work/hardware-js-sdk/hardware-js-sdk/packages/hwk-adapter-core/dist/chunk-MVP46CIZ.js","sourcesContent":[null,"import type { QrResponseData } from '../types/qr';\n\nexport const UI_EVENT = 'UI_EVENT';\n\nexport const UI_REQUEST = {\n REQUEST_PIN: 'ui-request-pin',\n REQUEST_PASSPHRASE: 'ui-request-passphrase',\n // One-way UI notification: device is waiting for passphrase entry on-device.\n // The prompt response path remains RECEIVE_PASSPHRASE with passphraseOnDevice=true.\n REQUEST_PASSPHRASE_ON_DEVICE: 'ui-request-passphrase-on-device',\n REQUEST_BUTTON: 'ui-request-button',\n REQUEST_QR_DISPLAY: 'ui-request-qr-display',\n REQUEST_QR_SCAN: 'ui-request-qr-scan',\n REQUEST_DEVICE_PERMISSION: 'ui-request-device-permission',\n REQUEST_SELECT_DEVICE: 'ui-request-select-device',\n REQUEST_SAVE_DEVICE_BINDING: 'ui-request-save-device-binding',\n DEVICE_BINDING_STATUS: 'ui-device-binding-status',\n REQUEST_DEVICE_CONNECT: 'ui-request-device-connect',\n // Ledger BTC App: account index >= 100 requires display=true. Adapter asks\n // the user once per session before promoting the call.\n REQUEST_BTC_HIGH_INDEX_CONFIRM: 'ui-request-btc-high-index-confirm',\n // Required app is not installed; with autoInstallApp on, ask the user\n // whether to install it before retrying the operation.\n REQUEST_INSTALL_APP: 'ui-request-install-app',\n // The request cannot go over USB (see QrFallbackReason); ask whether to show it as a QR instead.\n REQUEST_QR_FALLBACK_CONFIRM: 'ui-request-qr-fallback-confirm',\n REQUEST_PREEMPTION: 'ui-request-preemption',\n REQUEST_TREZOR_THP_PAIRING: 'ui-request-trezor-thp-pairing',\n CLOSE_UI_WINDOW: 'ui-close',\n DEVICE_PROGRESS: 'ui-device_progress',\n FIRMWARE_PROGRESS: 'ui-firmware-progress',\n FIRMWARE_TIP: 'ui-firmware-tip',\n} as const;\n\nexport const UI_RESPONSE = {\n RECEIVE_PIN: 'receive-pin',\n RECEIVE_PASSPHRASE: 'receive-passphrase',\n RECEIVE_QR_RESPONSE: 'receive-qr-response',\n RECEIVE_SELECT_DEVICE: 'receive-select-device',\n RECEIVE_SAVE_DEVICE_BINDING: 'receive-save-device-binding',\n RECEIVE_DEVICE_CONNECT: 'receive-device-connect',\n RECEIVE_DEVICE_PERMISSION: 'receive-device-permission',\n RECEIVE_BTC_HIGH_INDEX_CONFIRM: 'receive-btc-high-index-confirm',\n RECEIVE_INSTALL_APP: 'receive-install-app',\n RECEIVE_QR_FALLBACK_CONFIRM: 'receive-qr-fallback-confirm',\n RECEIVE_PREEMPTION: 'receive-preemption',\n RECEIVE_TREZOR_THP_PAIRING: 'receive-trezor-thp-pairing',\n CANCEL: 'cancel',\n} as const;\n\n/**\n * The operation a UI request was opened under, so a cancel for one operation spares another's\n * prompts. Absent outside any operation (cold start, teardown).\n */\nexport type UiRequestOperationAttribution = {\n operationId?: string;\n};\n\nexport type DevicePermissionDeniedReason =\n | 'bluetoothTurnedOff'\n | 'permissionDenied'\n | (string & Record<never, never>);\n\nexport type DevicePermissionResponse = {\n granted: boolean;\n reason?: DevicePermissionDeniedReason;\n message?: string;\n};\n\n/**\n * `mismatch`: the host's own records do not match the selected device.\n * `skipped`: the host had nothing to bind, a host contract problem rather than a user action.\n *\n * Either way the binding is not saved and `DEVICE_BINDING_STATUS` reports `failed`. A business\n * call continues; an explicit `bindBleDevice` fails because saving was its whole purpose.\n *\n * The SDK has checked the device's wallet before asking only when the request carries `identity`,\n * i.e. the call named an expected wallet (a `deviceId`); Ledger asks without one for a call that\n * names no wallet. A decline does not retire the endpoint: its session, any operation bound to it,\n * and the adapter's in-memory reconnect target for it stay in place, and later wallet-checked calls\n * still verify the wallet on it. A host that must not use the endpoint again discards the result,\n * releases the operation, and has the user select a device again.\n */\nexport type SaveDeviceBindingDeclineReason = 'mismatch' | 'skipped';\n\n/**\n * Why the request cannot go over USB. Only `payload-too-large` comes after the request was built;\n * the others mean a connected device cannot serve this wallet, so the host may offer a retry.\n */\nexport type QrFallbackReason =\n | 'payload-too-large'\n | 'wallet-mismatch'\n | 'device-locked'\n | 'usb-unavailable';\n\nexport type UiResponseEvent =\n | {\n type: typeof UI_RESPONSE.RECEIVE_SAVE_DEVICE_BINDING;\n payload: {\n requestId: string;\n saved: boolean;\n reason?: SaveDeviceBindingDeclineReason;\n };\n }\n | {\n type: typeof UI_RESPONSE.RECEIVE_PIN;\n payload: string;\n }\n | {\n type: typeof UI_RESPONSE.RECEIVE_PASSPHRASE;\n payload: {\n value: string;\n passphraseOnDevice?: boolean;\n save?: boolean;\n };\n }\n | {\n type: typeof UI_RESPONSE.RECEIVE_QR_RESPONSE;\n payload: QrResponseData;\n }\n | {\n // sdkConnectId echoes one of the DeviceInfo.connectId values emitted in\n // the REQUEST_SELECT_DEVICE event's `devices` list. Scope is the current\n // search session; may be ephemeral (e.g. Ledger USB DMK UUID).\n type: typeof UI_RESPONSE.RECEIVE_SELECT_DEVICE;\n /**\n * `requestId` must echo the `REQUEST_SELECT_DEVICE` request's id. It stays optional in the\n * type for compatibility, but an answer without it (or with another id) is ignored and the\n * selection keeps waiting until its timeout.\n */\n payload: { requestId?: string } & (\n | { sdkConnectId: string; cancelled?: false }\n | { cancelled: true }\n );\n }\n | {\n type: typeof UI_RESPONSE.RECEIVE_DEVICE_CONNECT;\n payload: { confirmed: boolean };\n }\n | {\n type: typeof UI_RESPONSE.RECEIVE_DEVICE_PERMISSION;\n payload: DevicePermissionResponse;\n }\n | {\n type: typeof UI_RESPONSE.RECEIVE_BTC_HIGH_INDEX_CONFIRM;\n payload: { confirmed: boolean };\n }\n | {\n type: typeof UI_RESPONSE.RECEIVE_INSTALL_APP;\n payload: { confirmed: boolean };\n }\n | {\n type: typeof UI_RESPONSE.RECEIVE_QR_FALLBACK_CONFIRM;\n /**\n * Echo the prompt's requestId; missing or stale IDs are ignored. `retry` asks to look for\n * the USB device again; it is ignored for `payload-too-large`.\n */\n payload: { confirmed: boolean; retry?: boolean; requestId?: string };\n }\n | {\n type: typeof UI_RESPONSE.RECEIVE_PREEMPTION;\n payload: { confirmed: boolean };\n }\n | {\n type: typeof UI_RESPONSE.RECEIVE_TREZOR_THP_PAIRING;\n payload: {\n selectedMethod?: number | string;\n tag?: string;\n };\n }\n | {\n type: typeof UI_RESPONSE.CANCEL;\n payload?: undefined;\n };\n","import { UI_REQUEST, UI_RESPONSE } from '../events/ui-request';\nimport { HardwareErrorCode, createHwkError } from '../types/errors';\n\n/** 10 min — every UI request is human-in-the-loop; bias toward \"wait long\". */\nexport const UI_REQUEST_DEFAULT_TIMEOUT_MS = 600_000;\n\nconst RESPONSE_TO_REQUEST: Record<string, string> = {\n [UI_RESPONSE.RECEIVE_PIN]: UI_REQUEST.REQUEST_PIN,\n [UI_RESPONSE.RECEIVE_PASSPHRASE]: UI_REQUEST.REQUEST_PASSPHRASE,\n [UI_RESPONSE.RECEIVE_SELECT_DEVICE]: UI_REQUEST.REQUEST_SELECT_DEVICE,\n [UI_RESPONSE.RECEIVE_SAVE_DEVICE_BINDING]: UI_REQUEST.REQUEST_SAVE_DEVICE_BINDING,\n [UI_RESPONSE.RECEIVE_DEVICE_CONNECT]: UI_REQUEST.REQUEST_DEVICE_CONNECT,\n [UI_RESPONSE.RECEIVE_DEVICE_PERMISSION]: UI_REQUEST.REQUEST_DEVICE_PERMISSION,\n [UI_RESPONSE.RECEIVE_BTC_HIGH_INDEX_CONFIRM]: UI_REQUEST.REQUEST_BTC_HIGH_INDEX_CONFIRM,\n [UI_RESPONSE.RECEIVE_INSTALL_APP]: UI_REQUEST.REQUEST_INSTALL_APP,\n [UI_RESPONSE.RECEIVE_QR_FALLBACK_CONFIRM]: UI_REQUEST.REQUEST_QR_FALLBACK_CONFIRM,\n [UI_RESPONSE.RECEIVE_PREEMPTION]: UI_REQUEST.REQUEST_PREEMPTION,\n [UI_RESPONSE.RECEIVE_TREZOR_THP_PAIRING]: UI_REQUEST.REQUEST_TREZOR_THP_PAIRING,\n // RECEIVE_QR_RESPONSE maps to QR_DISPLAY or QR_SCAN — resolved dynamically below.\n};\n\nexport const UI_REQUEST_PREEMPTED_TAG = 'UiRequestPreempted';\nexport const UI_REQUEST_CANCELLED_TAG = 'UiRequestCancelled';\nexport const UI_REQUEST_TIMEOUT_TAG = 'UiRequestTimeout';\n\nlet requestSequence = 0;\n\ntype PendingEntry = {\n requestId?: string;\n /** The operation this waiter belongs to, when it was opened under one. */\n operationId?: string;\n resolve: (payload: unknown) => void;\n reject: (error: Error) => void;\n timer: ReturnType<typeof setTimeout>;\n};\n\n/**\n * Per-type single-slot registry for adapter-level UI requests. A new `wait`\n * of the same type supersedes (rejects) the prior pending entry. With the\n * job queue running globally serially, cross-type collisions don't occur in\n * normal flow — same-type preemption is a defensive measure for callers\n * that fire the same request twice without waiting on the first.\n *\n * Unknown response types are dropped silently so the public `uiResponse`\n * entry never throws.\n */\nexport class UiRequestRegistry {\n private pending = new Map<string, PendingEntry>();\n\n createRequestId(): string {\n requestSequence += 1;\n return `hwk-ui-${Date.now()}-${requestSequence}`;\n }\n\n wait<T = unknown>(\n requestType: string,\n options?: { timeoutMs?: number; requestId?: string; operationId?: string }\n ): Promise<T> {\n const existing = this.pending.get(requestType);\n if (existing) {\n clearTimeout(existing.timer);\n this.pending.delete(requestType);\n existing.reject(\n Object.assign(new Error(`UI request '${requestType}' was superseded by a new request`), {\n _tag: UI_REQUEST_PREEMPTED_TAG,\n })\n );\n }\n\n const timeoutMs = options?.timeoutMs ?? UI_REQUEST_DEFAULT_TIMEOUT_MS;\n\n return new Promise<T>((resolve, reject) => {\n const timer = setTimeout(() => {\n if (this.pending.get(requestType)?.timer === timer) {\n this.pending.delete(requestType);\n reject(\n Object.assign(new Error(`UI request '${requestType}' timed out after ${timeoutMs}ms`), {\n _tag: UI_REQUEST_TIMEOUT_TAG,\n })\n );\n }\n }, timeoutMs);\n\n this.pending.set(requestType, {\n requestId: options?.requestId,\n operationId: options?.operationId,\n resolve: resolve as (payload: unknown) => void,\n reject,\n timer,\n });\n });\n }\n\n resolve(responseType: string, payload: unknown): void {\n let requestType = RESPONSE_TO_REQUEST[responseType];\n if (responseType === UI_RESPONSE.RECEIVE_QR_RESPONSE) {\n if (this.pending.has(UI_REQUEST.REQUEST_QR_DISPLAY)) {\n requestType = UI_REQUEST.REQUEST_QR_DISPLAY;\n } else if (this.pending.has(UI_REQUEST.REQUEST_QR_SCAN)) {\n requestType = UI_REQUEST.REQUEST_QR_SCAN;\n }\n }\n if (!requestType) return;\n\n const entry = this.pending.get(requestType);\n if (!entry) return;\n\n const response =\n payload && typeof payload === 'object'\n ? (payload as { requestId?: unknown; cancelled?: unknown })\n : undefined;\n // A late response must not resolve (or cancel) a newer request of the same type.\n if (entry.requestId !== undefined && response?.requestId !== entry.requestId) return;\n clearTimeout(entry.timer);\n this.pending.delete(requestType);\n if (requestType === UI_REQUEST.REQUEST_SELECT_DEVICE && response?.cancelled === true) {\n entry.reject(\n createHwkError({\n code: HardwareErrorCode.UserAborted,\n message: 'Device selection was cancelled',\n _tag: UI_REQUEST_CANCELLED_TAG,\n })\n );\n return;\n }\n entry.resolve(payload);\n }\n\n /**\n * Each argument narrows the cancel: none rejects every waiter (teardown); an `operationId` alone\n * rejects only that operation's prompts and leaves another operation's PIN or QR wait untouched.\n */\n cancel(requestType?: string, requestId?: string, operationId?: string): void {\n const reject = (type: string, entry: PendingEntry) => {\n clearTimeout(entry.timer);\n this.pending.delete(type);\n entry.reject(\n Object.assign(new Error(`UI request '${type}' was cancelled`), {\n _tag: UI_REQUEST_CANCELLED_TAG,\n })\n );\n };\n\n if (requestType) {\n const entry = this.pending.get(requestType);\n if (!entry) return;\n if (requestId !== undefined && entry.requestId !== requestId) return;\n if (operationId !== undefined && entry.operationId !== operationId) return;\n reject(requestType, entry);\n return;\n }\n\n for (const [type, entry] of [...this.pending]) {\n if (operationId === undefined || entry.operationId === operationId) {\n reject(type, entry);\n }\n }\n }\n\n reset(): void {\n this.cancel();\n }\n\n hasPending(requestType?: string): boolean {\n if (requestType) return this.pending.has(requestType);\n return this.pending.size > 0;\n }\n}\n"]}
@@ -61,6 +61,12 @@ var HardwareErrorCode = /* @__PURE__ */ ((HardwareErrorCode2) => {
61
61
  HardwareErrorCode2[HardwareErrorCode2["BtcUnexpectedState"] = 11301] = "BtcUnexpectedState";
62
62
  return HardwareErrorCode2;
63
63
  })(HardwareErrorCode || {});
64
+ var HARDWARE_ERROR_CODES = new Set(
65
+ Object.values(HardwareErrorCode).filter((value) => typeof value === "number")
66
+ );
67
+ function isHardwareErrorCode(code) {
68
+ return typeof code === "number" && HARDWARE_ERROR_CODES.has(code);
69
+ }
64
70
  var ORPHAN_ELIGIBLE_ERROR_CODES = [
65
71
  10005 /* UserAborted */,
66
72
  10001 /* UserRejected */,
@@ -246,6 +252,7 @@ function createHwkError(payload) {
246
252
 
247
253
  export {
248
254
  HardwareErrorCode,
255
+ isHardwareErrorCode,
249
256
  ORPHAN_ELIGIBLE_ERROR_CODES,
250
257
  isHwkRecoveryHint,
251
258
  defaultRecoveryForCode,
@@ -253,4 +260,4 @@ export {
253
260
  operationMayHaveCompletedParams,
254
261
  createHwkError
255
262
  };
256
- //# sourceMappingURL=chunk-V2OHL2JS.mjs.map
263
+ //# sourceMappingURL=chunk-VKP46GTC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/errors.ts"],"sourcesContent":["/**\n * HWK HardwareErrorCode — independent namespace from the legacy\n * `@onekeyfe/shared` HardwareErrorCode (which occupies 0-902).\n *\n * All HWK codes are 5-digit (>= 10000) so the two tables never collide\n * even if either side grows. Each sub-category gets a 100-slot block.\n *\n * 10000-10099 Generic / cross-cutting primitives\n * 10100-10199 Device state\n * 10200-10299 Firmware\n * 10300-10399 Transport + OS-level permission\n * 10400-10499 PIN / Passphrase\n * 10500-10599 App lifecycle (wrong app, not open, too old)\n * 10600-10699 Payload / framing limits (adapter-level)\n * 10700-10999 RESERVED, future adapter-level categories\n *\n * 11000-11099 EVM APDU (reactive mapping)\n * 11100-11199 Solana APDU\n * 11200-11299 Tron APDU\n * 11300-11399 BTC APDU\n * 11400-11999 RESERVED — future chain APDU blocks (100 per chain)\n *\n * 12000-99999 RESERVED — future major categories\n */\nexport enum HardwareErrorCode {\n // --- 10000s Generic ---\n UnknownError = 10000,\n UserRejected = 10001,\n InvalidParams = 10002,\n OperationTimeout = 10003,\n MethodNotSupported = 10004,\n /** User dismissed in-app cancel UI. Distinct from UserRejected (on-device). */\n UserAborted = 10005,\n\n // --- 10100s Device state ---\n DeviceNotFound = 10100,\n DeviceDisconnected = 10101,\n DeviceBusy = 10102,\n DeviceLocked = 10103,\n DeviceNotInitialized = 10104,\n DeviceInBootloader = 10105,\n DeviceMismatch = 10106,\n /** Chain app wedged (e.g. Ledger BTC 0x6901). User must exit app on device. */\n DeviceAppStuck = 10107,\n /** Vendor (Ledger / Trezor) doesn't support the chain at all. */\n ChainNotSupported = 10108,\n /** Current operation supports only one connected device. */\n DeviceOneDeviceOnly = 10109,\n /**\n * The device rejected the requested derivation path (Trezor Failure_DataError\n * \"Forbidden key path\") — the path is non-standard or its index is outside the\n * range the device's safety checks allow. Distinct from ChainNotSupported\n * (whole chain) and MethodNotSupported (the operation/method itself).\n */\n DevicePathForbidden = 10110,\n /** Busy with our own in-flight request (queue guard / firmware Failure_Busy), not another app — wait and retry, don't close other apps. */\n DeviceBusyInternal = 10111,\n /** The supplied runtime-only operation id is unknown to this adapter instance. */\n OperationNotFound = 10112,\n /** The supplied operation ended and can never be resumed. */\n OperationEnded = 10113,\n /**\n * Discovery found devices but none is the expected wallet (wrong unit connected). DeviceMismatch\n * is for reaching the expected device and finding a different identity on it.\n */\n DeviceSearchMismatch = 10114,\n\n // --- 10200s Firmware ---\n FirmwareTooOld = 10200,\n FirmwareUpdateRequired = 10201,\n\n // --- 10300s Transport + permission ---\n TransportError = 10300,\n BridgeNotFound = 10301,\n TransportNotAvailable = 10302,\n /**\n * OS-level permission (Bluetooth / USB / etc.) — denied, blocked,\n * unavailable, or dismissed. Consumers surface a single \"please grant\n * permission\" toast and let the user retry manually.\n */\n DevicePermissionDenied = 10303,\n /**\n * BLE SMP pairing did not complete within the GATT bonding window.\n * GATT connected but the device didn't acknowledge SMP — typically\n * because the user didn't confirm the passkey on the device, or the\n * device went out of range mid-pairing. Distinct from OperationTimeout\n * (generic) and from DeviceLocked (Secure Element actually locked).\n */\n BlePairingTimeout = 10304,\n /** Remote network failure reaching a vendor's servers (HTTP/WS). Distinct from TransportError (local USB/BLE link). */\n NetworkError = 10305,\n /**\n * Host-managed pairing handshake failed (Trezor THP). The device rejected the\n * pairing exchange — e.g. CodeEntry: the user mistyped the code shown on the\n * device, so the CPace tag didn't match (\"Unexpected Code Entry Tag\").\n * Recoverable: the user re-pairs and re-enters the code. Distinct from\n * BlePairingTimeout (BLE SMP bonding window) and UserRejected (on-device\n * reject button).\n */\n ThpPairingFailed = 10306,\n /**\n * The OS-level BLE bond is stale/invalid, so the device rejected link\n * encryption: Android GATT_INSUF_AUTHENTICATION (status 5), CoreBluetooth\n * \"Peer removed pairing information\" (CBError 14, iOS and macOS), or a bond\n * Windows still holds that the device refuses. Happens after the device is wiped/re-flashed\n * or unpaired elsewhere while the host still holds an old bond. The SDK cannot\n * remove an OS bond — the user must forget the device in system Bluetooth\n * settings and re-pair. Distinct from BlePairingTimeout (SMP window) and\n * ThpPairingFailed (THP code mismatch).\n */\n BleBondInvalid = 10307,\n /**\n * A stored THP pairing credential was rejected by the device during the\n * handshake (device returned completion `state=0`), so the autoconnect session\n * could not be established. The SDK discards the stale credential; recovery is\n * a fresh pairing. Distinct from ThpPairingFailed (user mistyped the code\n * during an *active* pairing) and BleBondInvalid (OS-level BLE bond).\n */\n ThpPairingRequired = 10308,\n /**\n * Generic BLE connect failure with no identifiable cause, e.g. a timeout or an\n * OS reason that cannot tell a stale bond from an out-of-range / unresponsive\n * device. Surfaced as a\n * generic \"couldn't connect — check the device, re-pair if paired before\".\n * Distinct from BleBondInvalid (a *known* stale-bond signal)\n * and BlePairingTimeout (the SMP bonding window).\n */\n BleConnectFailed = 10309,\n /**\n * The user cancelled BLE pairing from the app while the connect was still\n * waiting on the OS pairing window. Not a failure to report — the flow ends\n * because they asked it to. Distinct from UserAborted (generic in-app cancel)\n * so the pairing UI can close quietly instead of surfacing a connect error,\n * and from BlePairingTimeout (the SMP window elapsed on its own).\n */\n BlePairingCancelled = 10310,\n /**\n * Ledger manager-api WebSocket (app install/uninstall, genuine check) broke while relaying APDUs.\n * The device link is fine, so retry; NetworkError never carried device traffic.\n */\n LedgerSecureChannelError = 10311,\n /**\n * Vendor metadata service returned an unusable payload (Ledger firmware metadata, app catalog).\n * The request succeeded, so callers must not treat it as a dropped link.\n */\n LedgerFirmwareMetadataError = 10312,\n\n // --- 10400s PIN / Passphrase ---\n PinInvalid = 10400,\n PinCancelled = 10401,\n PassphraseRejected = 10402,\n /**\n * The passphrase entered produced a different wallet (`passphraseState`) than\n * the one the caller asked to operate on. Trezor-only: the host pins a wallet\n * by its derived state and the SDK refuses to sign with a mismatched\n * passphrase session. Surfaced by TrezorAdapter.getPassphraseState.\n */\n PassphraseStateMismatch = 10403,\n /**\n * The two new-PIN entries did not match during set/change PIN. Only host-input\n * models (Trezor Model One matrix) surface this; on-device-input models show\n * the mismatch on the device and never return it.\n */\n PinMismatch = 10404,\n /** Standard wallet is unavailable while Trezor enforces on-device passphrase entry. */\n PassphraseAlwaysOnDevice = 10405,\n\n // --- 10500s App lifecycle ---\n /** Chain app NOT INSTALLED on device. User must install via Ledger Live. */\n AppNotInstalled = 10500,\n WrongApp = 10501,\n /** 0x911c Command code not supported — app predates current SDK. */\n AppTooOld = 10502,\n /** Not enough free storage for install/update; user must uninstall apps first. */\n DeviceOutOfMemory = 10503,\n /** Install refused, the app is already on the device; benign when the caller only needs it. */\n AppAlreadyInstalled = 10504,\n\n // --- 10600s Payload / framing limits ---\n /**\n * Payload exceeds a transport's framing cap (Keystone USB: ~12.5KB, 200 frames of 64 bytes).\n * Retrying on the same transport fails the same way; switch channel or shrink the payload.\n */\n PayloadTooLarge = 10600,\n /**\n * One QR request would ask the device for more keys than it accepts (Keystone: 24 account\n * paths). Nothing is sent; USB asks per key and is not limited this way.\n */\n QrRequestTooLarge = 10601,\n\n // --- 11000s EVM (Ledger Ethereum App) APDU-specific ---\n /** 0x6a80 Invalid data — observed on blindSignTransactionFallback when the\n * user has not enabled Blind signing on the device. */\n EvmBlindSigningRequired = 11000,\n /** 0x6984 Plugin not installed */\n EvmClearSignPluginMissing = 11001,\n /** 0x6a84 Insufficient memory (typical on Nano S with large calldata) */\n EvmDataTooLarge = 11002,\n /** 0x6501 TransactionType not supported (app too old for EIP-1559 / blob / 7702) */\n EvmTxTypeNotSupported = 11003,\n\n // --- 11100s Solana ---\n /** 0x6808 Blind signing disabled for this instruction. */\n SolanaBlindSigningRequired = 11100,\n\n // --- 11200s Tron ---\n /** 0x6a8d Custom Contracts setting disabled (blocks TRC-20 etc.). */\n TronCustomContractRequired = 11200,\n /** 0x6a8b Transactions Data setting disabled. */\n TronDataSigningRequired = 11201,\n /** 0x6a8c Sign by Hash setting disabled (hash-signing fallback). */\n TronSignByHashRequired = 11202,\n\n // --- 11300s BTC ---\n /** 0xb008 Wallet policy HMAC mismatch or not registered. */\n BtcWalletPolicyHmacMismatch = 11300,\n /** 0xb007 Aborted due to unexpected state (malformed PSBT / missing UTXO). */\n BtcUnexpectedState = 11301,\n}\n\nconst HARDWARE_ERROR_CODES = new Set<number>(\n Object.values(HardwareErrorCode).filter((value): value is number => typeof value === 'number')\n);\n\n/** DOMExceptions and host errors carry numeric `code`s too (0, 20, -99999); only ours count. */\nexport function isHardwareErrorCode(code: unknown): code is HardwareErrorCode {\n return typeof code === 'number' && HARDWARE_ERROR_CODES.has(code);\n}\n\n/**\n * Device-level failures the SDK cannot self-recover from — affect the entire\n * batch (vs per-chain failures like AppNotInstalled / WrongApp which soft-\n * skip in onboarding). Combined with `accounts.length === 0`, signals\n * genuine orphan. Also reused as the batch-abort whitelist for HWK.\n * Single source of truth.\n *\n * UserRejected (device-side reject) is included: pressing reject is an\n * explicit \"I don't consent\" — continuing the batch to ask again on the\n * next chain is harassment, not helpful.\n */\nexport const ORPHAN_ELIGIBLE_ERROR_CODES: number[] = [\n HardwareErrorCode.UserAborted,\n HardwareErrorCode.UserRejected,\n HardwareErrorCode.DeviceNotFound,\n HardwareErrorCode.DeviceDisconnected,\n HardwareErrorCode.OperationNotFound,\n HardwareErrorCode.OperationEnded,\n HardwareErrorCode.DeviceMismatch,\n HardwareErrorCode.DeviceSearchMismatch,\n HardwareErrorCode.DeviceAppStuck,\n HardwareErrorCode.DeviceOneDeviceOnly,\n HardwareErrorCode.TransportError,\n HardwareErrorCode.DevicePermissionDenied,\n HardwareErrorCode.BlePairingTimeout,\n HardwareErrorCode.ThpPairingFailed,\n HardwareErrorCode.ThpPairingRequired,\n HardwareErrorCode.BleBondInvalid,\n HardwareErrorCode.BleConnectFailed,\n HardwareErrorCode.BlePairingCancelled,\n HardwareErrorCode.PassphraseAlwaysOnDevice,\n];\n\n// ---------------------------------------------------------------------------\n// Standard throwable for HWK adapters\n// ---------------------------------------------------------------------------\n\n/**\n * Where a failure came from; code ranges can't tell (UserRejected=10001 is the device,\n * DevicePermissionDenied=10303 is the host).\n * `device`: the firmware answered (rejection, locked, wrong PIN); surface verbatim, never\n * auto-reconnect, switch channels, or drop a healthy session.\n * `transport`: the pipe failed (cable pulled, bus reset); reconnecting is fair game.\n * `host`: the environment refused (permission, picker, bad params); fix it, not the link.\n * A mapper that can't tell leaves it unset so consumers fall back to code-based tables.\n */\nexport type HwkErrorOrigin = 'device' | 'transport' | 'host';\n\n/**\n * Smallest resource to replace before retrying; never permission to auto-replay a signing command.\n * `call`: nothing. `operation`: rebind from the target if its identity is persistent.\n * `search-target`: rediscover and reselect. `transport`: repair or switch transport.\n * `not-recoverable`: retrying cannot succeed. `unknown`: no safe claim.\n */\nexport type HwkRecoveryScope =\n | 'call'\n | 'operation'\n | 'search-target'\n | 'transport'\n | 'not-recoverable'\n | 'unknown';\n\nexport interface HwkRecoveryHint {\n scope: HwkRecoveryScope;\n}\n\nconst RECOVERY_SCOPES = new Set<HwkRecoveryScope>([\n 'call',\n 'operation',\n 'search-target',\n 'transport',\n 'not-recoverable',\n 'unknown',\n]);\n\nexport function isHwkRecoveryHint(value: unknown): value is HwkRecoveryHint {\n if (!value || typeof value !== 'object') return false;\n const { scope } = value as { scope?: unknown };\n return typeof scope === 'string' && RECOVERY_SCOPES.has(scope as HwkRecoveryScope);\n}\n\nconst RECOVERY_CALL: HwkRecoveryHint = Object.freeze({ scope: 'call' });\nconst RECOVERY_OPERATION: HwkRecoveryHint = Object.freeze({ scope: 'operation' });\nconst RECOVERY_SEARCH_TARGET: HwkRecoveryHint = Object.freeze({ scope: 'search-target' });\nconst RECOVERY_TRANSPORT: HwkRecoveryHint = Object.freeze({ scope: 'transport' });\nconst RECOVERY_NOT_RECOVERABLE: HwkRecoveryHint = Object.freeze({\n scope: 'not-recoverable',\n});\nconst RECOVERY_UNKNOWN: HwkRecoveryHint = Object.freeze({ scope: 'unknown' });\n\n/** Vendor-neutral fallback; adapters may stamp a narrower hint when session state is clear. */\nexport function defaultRecoveryForCode(code: HardwareErrorCode): HwkRecoveryHint {\n switch (code) {\n case HardwareErrorCode.UserRejected:\n case HardwareErrorCode.UserAborted:\n case HardwareErrorCode.DeviceBusy:\n case HardwareErrorCode.DeviceLocked:\n case HardwareErrorCode.DeviceNotInitialized:\n case HardwareErrorCode.DeviceInBootloader:\n case HardwareErrorCode.DeviceAppStuck:\n case HardwareErrorCode.DeviceBusyInternal:\n case HardwareErrorCode.NetworkError:\n case HardwareErrorCode.LedgerSecureChannelError:\n case HardwareErrorCode.LedgerFirmwareMetadataError:\n case HardwareErrorCode.PinInvalid:\n case HardwareErrorCode.PinCancelled:\n case HardwareErrorCode.PassphraseRejected:\n case HardwareErrorCode.PassphraseStateMismatch:\n case HardwareErrorCode.PinMismatch:\n case HardwareErrorCode.FirmwareTooOld:\n case HardwareErrorCode.FirmwareUpdateRequired:\n case HardwareErrorCode.AppNotInstalled:\n case HardwareErrorCode.WrongApp:\n case HardwareErrorCode.AppTooOld:\n case HardwareErrorCode.DeviceOutOfMemory:\n case HardwareErrorCode.AppAlreadyInstalled:\n case HardwareErrorCode.EvmBlindSigningRequired:\n case HardwareErrorCode.EvmClearSignPluginMissing:\n case HardwareErrorCode.EvmDataTooLarge:\n case HardwareErrorCode.EvmTxTypeNotSupported:\n case HardwareErrorCode.SolanaBlindSigningRequired:\n case HardwareErrorCode.TronCustomContractRequired:\n case HardwareErrorCode.TronDataSigningRequired:\n case HardwareErrorCode.TronSignByHashRequired:\n case HardwareErrorCode.BtcWalletPolicyHmacMismatch:\n case HardwareErrorCode.BtcUnexpectedState:\n return RECOVERY_CALL;\n case HardwareErrorCode.DeviceNotFound:\n case HardwareErrorCode.DeviceDisconnected:\n case HardwareErrorCode.OperationNotFound:\n case HardwareErrorCode.OperationEnded:\n case HardwareErrorCode.TransportError:\n case HardwareErrorCode.BlePairingTimeout:\n case HardwareErrorCode.ThpPairingFailed:\n case HardwareErrorCode.ThpPairingRequired:\n case HardwareErrorCode.BleConnectFailed:\n case HardwareErrorCode.BlePairingCancelled:\n return RECOVERY_OPERATION;\n case HardwareErrorCode.DeviceMismatch:\n case HardwareErrorCode.DeviceSearchMismatch:\n case HardwareErrorCode.DeviceOneDeviceOnly:\n case HardwareErrorCode.BleBondInvalid:\n return RECOVERY_SEARCH_TARGET;\n case HardwareErrorCode.BridgeNotFound:\n case HardwareErrorCode.TransportNotAvailable:\n case HardwareErrorCode.DevicePermissionDenied:\n case HardwareErrorCode.PayloadTooLarge:\n case HardwareErrorCode.QrRequestTooLarge:\n return RECOVERY_TRANSPORT;\n case HardwareErrorCode.InvalidParams:\n case HardwareErrorCode.MethodNotSupported:\n case HardwareErrorCode.ChainNotSupported:\n case HardwareErrorCode.DevicePathForbidden:\n return RECOVERY_NOT_RECOVERABLE;\n case HardwareErrorCode.UnknownError:\n case HardwareErrorCode.OperationTimeout:\n default:\n return RECOVERY_UNKNOWN;\n }\n}\n\n/**\n * Default code-to-origin table; vendors override only where their mapping knows better.\n * Context-dependent codes (UnknownError, OperationTimeout, DeviceBusy) return undefined.\n */\nexport function defaultOriginForCode(code: HardwareErrorCode): HwkErrorOrigin | undefined {\n // Chain APDU codes (11000+) are always the device's chain app refusing or qualifying a request.\n if (code >= 11_000) return 'device';\n switch (code) {\n case HardwareErrorCode.UserRejected:\n case HardwareErrorCode.DeviceLocked:\n case HardwareErrorCode.DeviceNotInitialized:\n case HardwareErrorCode.DeviceInBootloader:\n case HardwareErrorCode.DeviceMismatch:\n case HardwareErrorCode.DeviceSearchMismatch:\n case HardwareErrorCode.DeviceAppStuck:\n case HardwareErrorCode.DevicePathForbidden:\n case HardwareErrorCode.DeviceBusyInternal:\n case HardwareErrorCode.ChainNotSupported:\n case HardwareErrorCode.FirmwareTooOld:\n case HardwareErrorCode.FirmwareUpdateRequired:\n case HardwareErrorCode.PinInvalid:\n case HardwareErrorCode.PinMismatch:\n case HardwareErrorCode.PassphraseRejected:\n case HardwareErrorCode.PassphraseStateMismatch:\n case HardwareErrorCode.ThpPairingFailed:\n case HardwareErrorCode.ThpPairingRequired:\n case HardwareErrorCode.WrongApp:\n case HardwareErrorCode.AppNotInstalled:\n case HardwareErrorCode.AppTooOld:\n case HardwareErrorCode.DeviceOutOfMemory:\n case HardwareErrorCode.AppAlreadyInstalled:\n return 'device';\n case HardwareErrorCode.DeviceNotFound:\n case HardwareErrorCode.DeviceDisconnected:\n case HardwareErrorCode.TransportError:\n case HardwareErrorCode.BridgeNotFound:\n case HardwareErrorCode.TransportNotAvailable:\n case HardwareErrorCode.BlePairingTimeout:\n case HardwareErrorCode.NetworkError:\n case HardwareErrorCode.LedgerSecureChannelError:\n case HardwareErrorCode.LedgerFirmwareMetadataError:\n case HardwareErrorCode.BleBondInvalid:\n case HardwareErrorCode.BleConnectFailed:\n return 'transport';\n case HardwareErrorCode.DevicePermissionDenied:\n case HardwareErrorCode.UserAborted:\n case HardwareErrorCode.InvalidParams:\n case HardwareErrorCode.MethodNotSupported:\n case HardwareErrorCode.PinCancelled:\n case HardwareErrorCode.BlePairingCancelled:\n case HardwareErrorCode.PayloadTooLarge:\n case HardwareErrorCode.QrRequestTooLarge:\n case HardwareErrorCode.DeviceOneDeviceOnly:\n return 'host';\n default:\n return undefined;\n }\n}\n\nexport interface IHwkErrorPayload {\n code: HardwareErrorCode;\n message: string;\n origin?: HwkErrorOrigin;\n recovery?: HwkRecoveryHint;\n appName?: string;\n _tag?: string;\n params?: Record<string, unknown>;\n}\n\nexport interface IOperationMayHaveCompletedParams extends Record<string, unknown> {\n operationMayHaveCompleted: true;\n method: string;\n}\n\n/**\n * Marks an unsafe request whose response was lost after dispatch; the transport error is not proof\n * that the device rejected or skipped it.\n */\nexport function operationMayHaveCompletedParams(\n method: string,\n params?: Record<string, unknown>\n): IOperationMayHaveCompletedParams {\n return {\n ...params,\n operationMayHaveCompleted: true,\n method,\n };\n}\n\nexport type HwkError = Error & {\n code: HardwareErrorCode;\n /** See {@link HwkErrorOrigin}. Survives serializeConnectorError/rehydrate via `params`. */\n origin?: HwkErrorOrigin;\n recovery?: HwkRecoveryHint;\n appName?: string;\n _tag?: string;\n params?: Record<string, unknown>;\n};\n\n/**\n * Canonical throwable for HWK adapters. Plain Error + canonical extra fields,\n * shape-compatible with `rehydrateConnectorError` so locally-thrown and\n * cross-boundary errors are indistinguishable to downstream classifiers\n * (`err.code` / `err._tag` / `err.appName`). Do NOT mutate caught errors\n * with `Object.assign` — construct a fresh one via this factory.\n */\nexport function createHwkError(payload: IHwkErrorPayload): HwkError {\n const recovery = payload.recovery ?? defaultRecoveryForCode(payload.code);\n return Object.assign(new Error(payload.message), {\n code: payload.code,\n ...(payload.origin !== undefined && { origin: payload.origin }),\n recovery,\n ...(payload._tag !== undefined && { _tag: payload._tag }),\n ...(payload.appName !== undefined && { appName: payload.appName }),\n ...(payload.params !== undefined && { params: payload.params }),\n });\n}\n"],"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A,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAqBO,SAAS,gCACd,QACA,QACkC;AAClC,SAAO;AAAA,IACL,GAAG;AAAA,IACH,2BAA2B;AAAA,IAC3B;AAAA,EACF;AACF;AAmBO,SAAS,eAAe,SAAqC;AAClE,QAAM,WAAW,QAAQ,YAAY,uBAAuB,QAAQ,IAAI;AACxE,SAAO,OAAO,OAAO,IAAI,MAAM,QAAQ,OAAO,GAAG;AAAA,IAC/C,MAAM,QAAQ;AAAA,IACd,GAAI,QAAQ,WAAW,UAAa,EAAE,QAAQ,QAAQ,OAAO;AAAA,IAC7D;AAAA,IACA,GAAI,QAAQ,SAAS,UAAa,EAAE,MAAM,QAAQ,KAAK;AAAA,IACvD,GAAI,QAAQ,YAAY,UAAa,EAAE,SAAS,QAAQ,QAAQ;AAAA,IAChE,GAAI,QAAQ,WAAW,UAAa,EAAE,QAAQ,QAAQ,OAAO;AAAA,EAC/D,CAAC;AACH;","names":["HardwareErrorCode"]}
@@ -93,8 +93,9 @@ declare enum HardwareErrorCode {
93
93
  ThpPairingFailed = 10306,
94
94
  /**
95
95
  * The OS-level BLE bond is stale/invalid, so the device rejected link
96
- * encryption: Android GATT_INSUF_AUTHENTICATION (status 5) or iOS "Peer
97
- * removed pairing information". Happens after the device is wiped/re-flashed
96
+ * encryption: Android GATT_INSUF_AUTHENTICATION (status 5), CoreBluetooth
97
+ * "Peer removed pairing information" (CBError 14, iOS and macOS), or a bond
98
+ * Windows still holds that the device refuses. Happens after the device is wiped/re-flashed
98
99
  * or unpaired elsewhere while the host still holds an old bond. The SDK cannot
99
100
  * remove an OS bond — the user must forget the device in system Bluetooth
100
101
  * settings and re-pair. Distinct from BlePairingTimeout (SMP window) and
@@ -110,12 +111,11 @@ declare enum HardwareErrorCode {
110
111
  */
111
112
  ThpPairingRequired = 10308,
112
113
  /**
113
- * Generic BLE connect failure where the OS dropped the specific reason. On
114
- * macOS the noble native binding hardcodes "connection failed" (and a connect
115
- * timeout) and discards the CoreBluetooth NSError, so the SDK cannot tell a
116
- * stale bond from an out-of-range / unresponsive device. Surfaced as a
114
+ * Generic BLE connect failure with no identifiable cause, e.g. a timeout or an
115
+ * OS reason that cannot tell a stale bond from an out-of-range / unresponsive
116
+ * device. Surfaced as a
117
117
  * generic "couldn't connect — check the device, re-pair if paired before".
118
- * Distinct from BleBondInvalid (a *known* stale-bond signal, iOS/Android only)
118
+ * Distinct from BleBondInvalid (a *known* stale-bond signal)
119
119
  * and BlePairingTimeout (the SMP bonding window).
120
120
  */
121
121
  BleConnectFailed = 10309,
@@ -196,6 +196,8 @@ declare enum HardwareErrorCode {
196
196
  /** 0xb007 Aborted due to unexpected state (malformed PSBT / missing UTXO). */
197
197
  BtcUnexpectedState = 11301
198
198
  }
199
+ /** DOMExceptions and host errors carry numeric `code`s too (0, 20, -99999); only ours count. */
200
+ declare function isHardwareErrorCode(code: unknown): code is HardwareErrorCode;
199
201
  /**
200
202
  * Device-level failures the SDK cannot self-recover from — affect the entire
201
203
  * batch (vs per-chain failures like AppNotInstalled / WrongApp which soft-
@@ -278,4 +280,4 @@ declare function createHwkError(payload: IHwkErrorPayload): HwkError;
278
280
  */
279
281
  declare function enrichErrorMessage(code: HardwareErrorCode, originalMessage: string): string;
280
282
 
281
- export { HardwareErrorCode as H, type IHwkErrorPayload as I, ORPHAN_ELIGIBLE_ERROR_CODES as O, type HwkErrorOrigin as a, type HwkRecoveryHint as b, type HwkError as c, type HwkRecoveryScope as d, type IOperationMayHaveCompletedParams as e, createHwkError as f, defaultOriginForCode as g, defaultRecoveryForCode as h, enrichErrorMessage as i, isHwkRecoveryHint as j, operationMayHaveCompletedParams as o };
283
+ export { HardwareErrorCode as H, type IHwkErrorPayload as I, ORPHAN_ELIGIBLE_ERROR_CODES as O, type HwkErrorOrigin as a, type HwkRecoveryHint as b, type HwkError as c, type HwkRecoveryScope as d, type IOperationMayHaveCompletedParams as e, createHwkError as f, defaultOriginForCode as g, defaultRecoveryForCode as h, enrichErrorMessage as i, isHardwareErrorCode as j, isHwkRecoveryHint as k, operationMayHaveCompletedParams as o };
@@ -93,8 +93,9 @@ declare enum HardwareErrorCode {
93
93
  ThpPairingFailed = 10306,
94
94
  /**
95
95
  * The OS-level BLE bond is stale/invalid, so the device rejected link
96
- * encryption: Android GATT_INSUF_AUTHENTICATION (status 5) or iOS "Peer
97
- * removed pairing information". Happens after the device is wiped/re-flashed
96
+ * encryption: Android GATT_INSUF_AUTHENTICATION (status 5), CoreBluetooth
97
+ * "Peer removed pairing information" (CBError 14, iOS and macOS), or a bond
98
+ * Windows still holds that the device refuses. Happens after the device is wiped/re-flashed
98
99
  * or unpaired elsewhere while the host still holds an old bond. The SDK cannot
99
100
  * remove an OS bond — the user must forget the device in system Bluetooth
100
101
  * settings and re-pair. Distinct from BlePairingTimeout (SMP window) and
@@ -110,12 +111,11 @@ declare enum HardwareErrorCode {
110
111
  */
111
112
  ThpPairingRequired = 10308,
112
113
  /**
113
- * Generic BLE connect failure where the OS dropped the specific reason. On
114
- * macOS the noble native binding hardcodes "connection failed" (and a connect
115
- * timeout) and discards the CoreBluetooth NSError, so the SDK cannot tell a
116
- * stale bond from an out-of-range / unresponsive device. Surfaced as a
114
+ * Generic BLE connect failure with no identifiable cause, e.g. a timeout or an
115
+ * OS reason that cannot tell a stale bond from an out-of-range / unresponsive
116
+ * device. Surfaced as a
117
117
  * generic "couldn't connect — check the device, re-pair if paired before".
118
- * Distinct from BleBondInvalid (a *known* stale-bond signal, iOS/Android only)
118
+ * Distinct from BleBondInvalid (a *known* stale-bond signal)
119
119
  * and BlePairingTimeout (the SMP bonding window).
120
120
  */
121
121
  BleConnectFailed = 10309,
@@ -196,6 +196,8 @@ declare enum HardwareErrorCode {
196
196
  /** 0xb007 Aborted due to unexpected state (malformed PSBT / missing UTXO). */
197
197
  BtcUnexpectedState = 11301
198
198
  }
199
+ /** DOMExceptions and host errors carry numeric `code`s too (0, 20, -99999); only ours count. */
200
+ declare function isHardwareErrorCode(code: unknown): code is HardwareErrorCode;
199
201
  /**
200
202
  * Device-level failures the SDK cannot self-recover from — affect the entire
201
203
  * batch (vs per-chain failures like AppNotInstalled / WrongApp which soft-
@@ -278,4 +280,4 @@ declare function createHwkError(payload: IHwkErrorPayload): HwkError;
278
280
  */
279
281
  declare function enrichErrorMessage(code: HardwareErrorCode, originalMessage: string): string;
280
282
 
281
- export { HardwareErrorCode as H, type IHwkErrorPayload as I, ORPHAN_ELIGIBLE_ERROR_CODES as O, type HwkErrorOrigin as a, type HwkRecoveryHint as b, type HwkError as c, type HwkRecoveryScope as d, type IOperationMayHaveCompletedParams as e, createHwkError as f, defaultOriginForCode as g, defaultRecoveryForCode as h, enrichErrorMessage as i, isHwkRecoveryHint as j, operationMayHaveCompletedParams as o };
283
+ export { HardwareErrorCode as H, type IHwkErrorPayload as I, ORPHAN_ELIGIBLE_ERROR_CODES as O, type HwkErrorOrigin as a, type HwkRecoveryHint as b, type HwkError as c, type HwkRecoveryScope as d, type IOperationMayHaveCompletedParams as e, createHwkError as f, defaultOriginForCode as g, defaultRecoveryForCode as h, enrichErrorMessage as i, isHardwareErrorCode as j, isHwkRecoveryHint as k, operationMayHaveCompletedParams as o };
package/dist/errors.d.mts CHANGED
@@ -1 +1 @@
1
- export { H as HardwareErrorCode, c as HwkError, b as HwkRecoveryHint, d as HwkRecoveryScope, I as IHwkErrorPayload, O as ORPHAN_ELIGIBLE_ERROR_CODES, f as createHwkError, h as defaultRecoveryForCode, i as enrichErrorMessage, j as isHwkRecoveryHint } from './errors-DednD9bG.mjs';
1
+ export { H as HardwareErrorCode, c as HwkError, b as HwkRecoveryHint, d as HwkRecoveryScope, I as IHwkErrorPayload, O as ORPHAN_ELIGIBLE_ERROR_CODES, f as createHwkError, h as defaultRecoveryForCode, i as enrichErrorMessage, k as isHwkRecoveryHint } from './errors-Cl6Q5lqG.mjs';
package/dist/errors.d.ts CHANGED
@@ -1 +1 @@
1
- export { H as HardwareErrorCode, c as HwkError, b as HwkRecoveryHint, d as HwkRecoveryScope, I as IHwkErrorPayload, O as ORPHAN_ELIGIBLE_ERROR_CODES, f as createHwkError, h as defaultRecoveryForCode, i as enrichErrorMessage, j as isHwkRecoveryHint } from './errors-DednD9bG.js';
1
+ export { H as HardwareErrorCode, c as HwkError, b as HwkRecoveryHint, d as HwkRecoveryScope, I as IHwkErrorPayload, O as ORPHAN_ELIGIBLE_ERROR_CODES, f as createHwkError, h as defaultRecoveryForCode, i as enrichErrorMessage, k as isHwkRecoveryHint } from './errors-Cl6Q5lqG.js';
package/dist/errors.js CHANGED
@@ -7,7 +7,7 @@ var _chunkYLCHSNXOjs = require('./chunk-YLCHSNXO.js');
7
7
 
8
8
 
9
9
 
10
- var _chunkUFNTICCXjs = require('./chunk-UFNTICCX.js');
10
+ var _chunkEJIHCWWHjs = require('./chunk-EJIHCWWH.js');
11
11
 
12
12
 
13
13
 
@@ -15,5 +15,5 @@ var _chunkUFNTICCXjs = require('./chunk-UFNTICCX.js');
15
15
 
16
16
 
17
17
 
18
- exports.HardwareErrorCode = _chunkUFNTICCXjs.HardwareErrorCode; exports.ORPHAN_ELIGIBLE_ERROR_CODES = _chunkUFNTICCXjs.ORPHAN_ELIGIBLE_ERROR_CODES; exports.createHwkError = _chunkUFNTICCXjs.createHwkError; exports.defaultRecoveryForCode = _chunkUFNTICCXjs.defaultRecoveryForCode; exports.enrichErrorMessage = _chunkYLCHSNXOjs.enrichErrorMessage; exports.isHwkRecoveryHint = _chunkUFNTICCXjs.isHwkRecoveryHint;
18
+ exports.HardwareErrorCode = _chunkEJIHCWWHjs.HardwareErrorCode; exports.ORPHAN_ELIGIBLE_ERROR_CODES = _chunkEJIHCWWHjs.ORPHAN_ELIGIBLE_ERROR_CODES; exports.createHwkError = _chunkEJIHCWWHjs.createHwkError; exports.defaultRecoveryForCode = _chunkEJIHCWWHjs.defaultRecoveryForCode; exports.enrichErrorMessage = _chunkYLCHSNXOjs.enrichErrorMessage; exports.isHwkRecoveryHint = _chunkEJIHCWWHjs.isHwkRecoveryHint;
19
19
  //# sourceMappingURL=errors.js.map
package/dist/errors.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  createHwkError,
8
8
  defaultRecoveryForCode,
9
9
  isHwkRecoveryHint
10
- } from "./chunk-V2OHL2JS.mjs";
10
+ } from "./chunk-VKP46GTC.mjs";
11
11
  export {
12
12
  HardwareErrorCode,
13
13
  ORPHAN_ELIGIBLE_ERROR_CODES,
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as HardwareErrorCode, a as HwkErrorOrigin, b as HwkRecoveryHint } from './errors-DednD9bG.mjs';
2
- export { c as HwkError, d as HwkRecoveryScope, I as IHwkErrorPayload, e as IOperationMayHaveCompletedParams, O as ORPHAN_ELIGIBLE_ERROR_CODES, f as createHwkError, g as defaultOriginForCode, h as defaultRecoveryForCode, i as enrichErrorMessage, j as isHwkRecoveryHint, o as operationMayHaveCompletedParams } from './errors-DednD9bG.mjs';
1
+ import { H as HardwareErrorCode, a as HwkErrorOrigin, b as HwkRecoveryHint } from './errors-Cl6Q5lqG.mjs';
2
+ export { c as HwkError, d as HwkRecoveryScope, I as IHwkErrorPayload, e as IOperationMayHaveCompletedParams, O as ORPHAN_ELIGIBLE_ERROR_CODES, f as createHwkError, g as defaultOriginForCode, h as defaultRecoveryForCode, i as enrichErrorMessage, j as isHardwareErrorCode, k as isHwkRecoveryHint, o as operationMayHaveCompletedParams } from './errors-Cl6Q5lqG.mjs';
3
3
  import { U as UiResponseEvent, E as ExportedAccountKey, a as UiRequestOperationAttribution, b as UI_REQUEST, Q as QrDisplayData, c as QrFallbackReason, d as UiRequestRegistry, S as SaveDeviceBindingDeclineReason } from './ui-events-Dvu2Gdu8.mjs';
4
4
  export { D as DevicePermissionDeniedReason, e as DevicePermissionResponse, f as QrResponseData, g as UI_EVENT, h as UI_REQUEST_CANCELLED_TAG, i as UI_REQUEST_DEFAULT_TIMEOUT_MS, j as UI_REQUEST_PREEMPTED_TAG, k as UI_REQUEST_TIMEOUT_TAG, l as UI_RESPONSE } from './ui-events-Dvu2Gdu8.mjs';
5
5
 
@@ -2114,6 +2114,12 @@ interface ElectronBleApi {
2114
2114
  id?: string;
2115
2115
  }): Promise<void>;
2116
2116
  }
2117
+ /**
2118
+ * Electron IPC keeps only an Error's message, so a host can reject bridge calls with
2119
+ * `ConnectorSerializedError` data instead. Restores those as `createHwkError` errors; any other
2120
+ * rejection passes through unchanged.
2121
+ */
2122
+ declare function rehydrateElectronBleErrors<T extends object>(bridge: T): T;
2117
2123
 
2118
2124
  declare function emitDeviceBindingStatus(emitter: TypedEventEmitter<HardwareEventMap>, selectionRequestId: string, status: DeviceBindingStatus['status']): void;
2119
2125
  /**
@@ -2292,4 +2298,4 @@ declare function buildUnsupportedMethodResponse(item: AllNetworkAddressParams):
2292
2298
 
2293
2299
  declare const DEVICE_CONNECT_RETRY_DELAY_MS = 1000;
2294
2300
 
2295
- export { ALL_NETWORK_METHOD_NAMES, type ActiveJobInfo, type AllNetworkAddressParams, type AllNetworkAddressResponse, type AllNetworkAddressResponsePayload, type AllNetworkAttachIdentityContext, type AllNetworkCallItemContext, type AllNetworkDeviceIdentity, type AllNetworkGetAddressParams, type AllNetworkMethodName, type AllNetworkResponseContext, type BindBleDeviceParams, type BtcAddress, type BtcGetAddressParams, type BtcGetPublicKeyParams, type BtcPaymentRequest, type BtcPaymentRequestMemo, type BtcPublicKey, type BtcRefTransaction, type BtcSignMsgParams, type BtcSignPsbtParams, type BtcSignTxParams, type BtcSignature, type BtcSignedPsbt, type BtcSignedTx, type BtcTxInput, type BtcTxOutput, CHAIN_FINGERPRINT_PATHS, type CancelCapability, type CancelScopeHandle, type ChainCapability, type ChainForFingerprint, type ConnectionType, type ConnectorCallResult, type ConnectorConfig, type ConnectorConnectTarget, type ConnectorDevice, type ConnectorErrorParams, type ConnectorEventMap, type ConnectorEventType, type ConnectorSearchDevicesOptions, type ConnectorSerializedError, type ConnectorSession, type ConnectorUiEvent, DEVICE, DEVICE_CONNECT_RETRY_DELAY_MS, DEVICE_EVENT, type DetectableHardwareVendor, type DeviceAuthenticityParams, type DeviceAuthenticityResult, type DeviceBindingStatus, type DeviceCapabilities, type DeviceChangeEvent, type DeviceConnectEvent, type DeviceDescriptor, type DeviceDisconnectEvent, type DeviceEvent, type DeviceEventListener, type DeviceInfo, DeviceJobQueue, type DeviceSearchTarget, type DeviceSelectionContext, type DeviceSelectionRequest, type DeviceTarget, EConnectorInteraction, type EIP712Domain, type ElectronBleApi, type ElectronBleConnectOptions, type ElectronBleDeviceInfo, type ElectronBleMatch, type ElectronBleScanOptions, type EvmAddress, type EvmEthereumDefinitions, type EvmGetAddressParams, type EvmPaymentRequest, type EvmPaymentRequestMemo, type EvmSignMsgParams, type EvmSignTxLedgerParams, type EvmSignTxParams, type EvmSignTxTrezorParams, type EvmSignTypedDataFull, type EvmSignTypedDataHash, type EvmSignTypedDataParams, type EvmSignature, type EvmSignedTx, ExportedAccountKey, type Failure, HARDWARE_METHOD_CATALOG, HARDWARE_RUNTIME_ID_PREFIX, type HardwareCallExtra, type HardwareDeviceIdentityInput, HardwareErrorCode, type HardwareEvent, type HardwareEventMap, type HardwareMethodMetadata, type HardwareMethodName, type HardwareOperation, type HardwareOperationTarget, type HardwareRuntimeId, type HardwareRuntimeIdKind, type HardwareUiEvent, HwkErrorOrigin, HwkRecoveryHint, type IBtcMethods, type ICommonCallParams, type IConnector, type IDeviceManagerMethods, type IDeviceManagerOperationContext, type IEvmMethods, type IHardwareBridge, type IHardwareCallParams, type IHardwareCommonCallParams, type IHardwareConnectionContext, type IHardwareWallet, type IPassphraseCallParams, type ISolMethods, type ITronMethods, type IWalletStateMethods, type JobOptions, type KnownDeviceConnection, type LogPayloadDescriber, type LogSummaryContext, type LogSummaryOptions, MISSING_BIP32_MASTER_FINGERPRINT, type NullableCallArg, OPERATION_DEFAULT_TTL_MS, type OperationEndReason, OperationRegistry, type PassphraseResponse, type PassphraseStateAware, type PrepareSolanaOffchainMessageV1Params, type PreparedSolanaOffchainMessageV1, QrDisplayData, QrFallbackReason, type Response, type RunAllNetworkGetAddressOptions, SDK, SaveDeviceBindingDeclineReason, type SaveDeviceBindingRequest, type SdkEvent, type SearchDevicesOptions, type SearchTargetReusePolicy, type SolAddress, type SolGetAddressParams, type SolOffchainMessageV1Params, type SolSignMsgParams, type SolSignTxParams, type SolSignature, type SolSignedTx, type Success, type TransportType, type TrezorBrightnessParams, type TrezorChangePinParams, type TrezorDeviceSettingsParams, type TrezorDisplayRotation, type TrezorSafetyCheckLevel, type TronAddress, type TronContract, type TronFreezeBalanceV2Contract, type TronGetAddressParams, type TronResource, type TronSignMsgParams, type TronSignTxParams, type TronSignature, type TronSignedTx, type TronTransferContract, type TronTriggerSmartContract, type TronUnfreezeBalanceV2Contract, type TronVote, type TronVoteWitnessContract, type TronWithdrawExpireUnfreezeContract, TypedEventEmitter, UI_REQUEST, type UiRequestEvent, UiRequestOperationAttribution, UiRequestRegistry, UiResponseEvent, type VendorType, type WalletIdentity, type ZcashFullViewingKey, type ZcashFullViewingKeyMode, type ZcashGetFullViewingKeyParams, type ZcashGetShieldedAddressParams, type ZcashShieldedAddress, assertBoundedCbor, batchCall, boundedCborFromHex, buildAllNetworkCancelledFailure, buildUnsupportedMethodResponse, bytesToHex, canReplayHardwareMethodAfterTransportFailure, compareSemver, createBridgedConnector, createCombinedConnector, createHardwareLinkId, createHardwareOperationId, createHardwareSearchTargetId, deriveDeviceFingerprint, detectHardwareVendorFromDescriptor, emitDeviceBindingStatus, ensure0x, failure, getAllNetworkMethodChain, getHardwareMethodMetadata, hasHardwareRuntimeIdPrefix, hexToBytes, isAllNetworkMethodName, isConnectionLost, isHardwareOperationId, isKnownNonTargetHardwareVendor, isUserRefusal, isWalletSafetyFailure, padHex64, parseBip32MasterFingerprint, parseHardwareRuntimeId, parseWalletMasterFingerprint, pickConnectionContext, prepareSolanaOffchainMessageV1, rehydrateConnectorError, requestBleDeviceSelection, requestSaveDeviceBinding, resolveHardwareOperationTarget, resolveSearchTargetReusePolicy, runAllNetworkGetAddress, serializeConnectorError, stripHex, success, summarizeForLog, toPhysicalDeviceSearchTarget };
2301
+ export { ALL_NETWORK_METHOD_NAMES, type ActiveJobInfo, type AllNetworkAddressParams, type AllNetworkAddressResponse, type AllNetworkAddressResponsePayload, type AllNetworkAttachIdentityContext, type AllNetworkCallItemContext, type AllNetworkDeviceIdentity, type AllNetworkGetAddressParams, type AllNetworkMethodName, type AllNetworkResponseContext, type BindBleDeviceParams, type BtcAddress, type BtcGetAddressParams, type BtcGetPublicKeyParams, type BtcPaymentRequest, type BtcPaymentRequestMemo, type BtcPublicKey, type BtcRefTransaction, type BtcSignMsgParams, type BtcSignPsbtParams, type BtcSignTxParams, type BtcSignature, type BtcSignedPsbt, type BtcSignedTx, type BtcTxInput, type BtcTxOutput, CHAIN_FINGERPRINT_PATHS, type CancelCapability, type CancelScopeHandle, type ChainCapability, type ChainForFingerprint, type ConnectionType, type ConnectorCallResult, type ConnectorConfig, type ConnectorConnectTarget, type ConnectorDevice, type ConnectorErrorParams, type ConnectorEventMap, type ConnectorEventType, type ConnectorSearchDevicesOptions, type ConnectorSerializedError, type ConnectorSession, type ConnectorUiEvent, DEVICE, DEVICE_CONNECT_RETRY_DELAY_MS, DEVICE_EVENT, type DetectableHardwareVendor, type DeviceAuthenticityParams, type DeviceAuthenticityResult, type DeviceBindingStatus, type DeviceCapabilities, type DeviceChangeEvent, type DeviceConnectEvent, type DeviceDescriptor, type DeviceDisconnectEvent, type DeviceEvent, type DeviceEventListener, type DeviceInfo, DeviceJobQueue, type DeviceSearchTarget, type DeviceSelectionContext, type DeviceSelectionRequest, type DeviceTarget, EConnectorInteraction, type EIP712Domain, type ElectronBleApi, type ElectronBleConnectOptions, type ElectronBleDeviceInfo, type ElectronBleMatch, type ElectronBleScanOptions, type EvmAddress, type EvmEthereumDefinitions, type EvmGetAddressParams, type EvmPaymentRequest, type EvmPaymentRequestMemo, type EvmSignMsgParams, type EvmSignTxLedgerParams, type EvmSignTxParams, type EvmSignTxTrezorParams, type EvmSignTypedDataFull, type EvmSignTypedDataHash, type EvmSignTypedDataParams, type EvmSignature, type EvmSignedTx, ExportedAccountKey, type Failure, HARDWARE_METHOD_CATALOG, HARDWARE_RUNTIME_ID_PREFIX, type HardwareCallExtra, type HardwareDeviceIdentityInput, HardwareErrorCode, type HardwareEvent, type HardwareEventMap, type HardwareMethodMetadata, type HardwareMethodName, type HardwareOperation, type HardwareOperationTarget, type HardwareRuntimeId, type HardwareRuntimeIdKind, type HardwareUiEvent, HwkErrorOrigin, HwkRecoveryHint, type IBtcMethods, type ICommonCallParams, type IConnector, type IDeviceManagerMethods, type IDeviceManagerOperationContext, type IEvmMethods, type IHardwareBridge, type IHardwareCallParams, type IHardwareCommonCallParams, type IHardwareConnectionContext, type IHardwareWallet, type IPassphraseCallParams, type ISolMethods, type ITronMethods, type IWalletStateMethods, type JobOptions, type KnownDeviceConnection, type LogPayloadDescriber, type LogSummaryContext, type LogSummaryOptions, MISSING_BIP32_MASTER_FINGERPRINT, type NullableCallArg, OPERATION_DEFAULT_TTL_MS, type OperationEndReason, OperationRegistry, type PassphraseResponse, type PassphraseStateAware, type PrepareSolanaOffchainMessageV1Params, type PreparedSolanaOffchainMessageV1, QrDisplayData, QrFallbackReason, type Response, type RunAllNetworkGetAddressOptions, SDK, SaveDeviceBindingDeclineReason, type SaveDeviceBindingRequest, type SdkEvent, type SearchDevicesOptions, type SearchTargetReusePolicy, type SolAddress, type SolGetAddressParams, type SolOffchainMessageV1Params, type SolSignMsgParams, type SolSignTxParams, type SolSignature, type SolSignedTx, type Success, type TransportType, type TrezorBrightnessParams, type TrezorChangePinParams, type TrezorDeviceSettingsParams, type TrezorDisplayRotation, type TrezorSafetyCheckLevel, type TronAddress, type TronContract, type TronFreezeBalanceV2Contract, type TronGetAddressParams, type TronResource, type TronSignMsgParams, type TronSignTxParams, type TronSignature, type TronSignedTx, type TronTransferContract, type TronTriggerSmartContract, type TronUnfreezeBalanceV2Contract, type TronVote, type TronVoteWitnessContract, type TronWithdrawExpireUnfreezeContract, TypedEventEmitter, UI_REQUEST, type UiRequestEvent, UiRequestOperationAttribution, UiRequestRegistry, UiResponseEvent, type VendorType, type WalletIdentity, type ZcashFullViewingKey, type ZcashFullViewingKeyMode, type ZcashGetFullViewingKeyParams, type ZcashGetShieldedAddressParams, type ZcashShieldedAddress, assertBoundedCbor, batchCall, boundedCborFromHex, buildAllNetworkCancelledFailure, buildUnsupportedMethodResponse, bytesToHex, canReplayHardwareMethodAfterTransportFailure, compareSemver, createBridgedConnector, createCombinedConnector, createHardwareLinkId, createHardwareOperationId, createHardwareSearchTargetId, deriveDeviceFingerprint, detectHardwareVendorFromDescriptor, emitDeviceBindingStatus, ensure0x, failure, getAllNetworkMethodChain, getHardwareMethodMetadata, hasHardwareRuntimeIdPrefix, hexToBytes, isAllNetworkMethodName, isConnectionLost, isHardwareOperationId, isKnownNonTargetHardwareVendor, isUserRefusal, isWalletSafetyFailure, padHex64, parseBip32MasterFingerprint, parseHardwareRuntimeId, parseWalletMasterFingerprint, pickConnectionContext, prepareSolanaOffchainMessageV1, rehydrateConnectorError, rehydrateElectronBleErrors, requestBleDeviceSelection, requestSaveDeviceBinding, resolveHardwareOperationTarget, resolveSearchTargetReusePolicy, runAllNetworkGetAddress, serializeConnectorError, stripHex, success, summarizeForLog, toPhysicalDeviceSearchTarget };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as HardwareErrorCode, a as HwkErrorOrigin, b as HwkRecoveryHint } from './errors-DednD9bG.js';
2
- export { c as HwkError, d as HwkRecoveryScope, I as IHwkErrorPayload, e as IOperationMayHaveCompletedParams, O as ORPHAN_ELIGIBLE_ERROR_CODES, f as createHwkError, g as defaultOriginForCode, h as defaultRecoveryForCode, i as enrichErrorMessage, j as isHwkRecoveryHint, o as operationMayHaveCompletedParams } from './errors-DednD9bG.js';
1
+ import { H as HardwareErrorCode, a as HwkErrorOrigin, b as HwkRecoveryHint } from './errors-Cl6Q5lqG.js';
2
+ export { c as HwkError, d as HwkRecoveryScope, I as IHwkErrorPayload, e as IOperationMayHaveCompletedParams, O as ORPHAN_ELIGIBLE_ERROR_CODES, f as createHwkError, g as defaultOriginForCode, h as defaultRecoveryForCode, i as enrichErrorMessage, j as isHardwareErrorCode, k as isHwkRecoveryHint, o as operationMayHaveCompletedParams } from './errors-Cl6Q5lqG.js';
3
3
  import { U as UiResponseEvent, E as ExportedAccountKey, a as UiRequestOperationAttribution, b as UI_REQUEST, Q as QrDisplayData, c as QrFallbackReason, d as UiRequestRegistry, S as SaveDeviceBindingDeclineReason } from './ui-events-Dvu2Gdu8.js';
4
4
  export { D as DevicePermissionDeniedReason, e as DevicePermissionResponse, f as QrResponseData, g as UI_EVENT, h as UI_REQUEST_CANCELLED_TAG, i as UI_REQUEST_DEFAULT_TIMEOUT_MS, j as UI_REQUEST_PREEMPTED_TAG, k as UI_REQUEST_TIMEOUT_TAG, l as UI_RESPONSE } from './ui-events-Dvu2Gdu8.js';
5
5
 
@@ -2114,6 +2114,12 @@ interface ElectronBleApi {
2114
2114
  id?: string;
2115
2115
  }): Promise<void>;
2116
2116
  }
2117
+ /**
2118
+ * Electron IPC keeps only an Error's message, so a host can reject bridge calls with
2119
+ * `ConnectorSerializedError` data instead. Restores those as `createHwkError` errors; any other
2120
+ * rejection passes through unchanged.
2121
+ */
2122
+ declare function rehydrateElectronBleErrors<T extends object>(bridge: T): T;
2117
2123
 
2118
2124
  declare function emitDeviceBindingStatus(emitter: TypedEventEmitter<HardwareEventMap>, selectionRequestId: string, status: DeviceBindingStatus['status']): void;
2119
2125
  /**
@@ -2292,4 +2298,4 @@ declare function buildUnsupportedMethodResponse(item: AllNetworkAddressParams):
2292
2298
 
2293
2299
  declare const DEVICE_CONNECT_RETRY_DELAY_MS = 1000;
2294
2300
 
2295
- export { ALL_NETWORK_METHOD_NAMES, type ActiveJobInfo, type AllNetworkAddressParams, type AllNetworkAddressResponse, type AllNetworkAddressResponsePayload, type AllNetworkAttachIdentityContext, type AllNetworkCallItemContext, type AllNetworkDeviceIdentity, type AllNetworkGetAddressParams, type AllNetworkMethodName, type AllNetworkResponseContext, type BindBleDeviceParams, type BtcAddress, type BtcGetAddressParams, type BtcGetPublicKeyParams, type BtcPaymentRequest, type BtcPaymentRequestMemo, type BtcPublicKey, type BtcRefTransaction, type BtcSignMsgParams, type BtcSignPsbtParams, type BtcSignTxParams, type BtcSignature, type BtcSignedPsbt, type BtcSignedTx, type BtcTxInput, type BtcTxOutput, CHAIN_FINGERPRINT_PATHS, type CancelCapability, type CancelScopeHandle, type ChainCapability, type ChainForFingerprint, type ConnectionType, type ConnectorCallResult, type ConnectorConfig, type ConnectorConnectTarget, type ConnectorDevice, type ConnectorErrorParams, type ConnectorEventMap, type ConnectorEventType, type ConnectorSearchDevicesOptions, type ConnectorSerializedError, type ConnectorSession, type ConnectorUiEvent, DEVICE, DEVICE_CONNECT_RETRY_DELAY_MS, DEVICE_EVENT, type DetectableHardwareVendor, type DeviceAuthenticityParams, type DeviceAuthenticityResult, type DeviceBindingStatus, type DeviceCapabilities, type DeviceChangeEvent, type DeviceConnectEvent, type DeviceDescriptor, type DeviceDisconnectEvent, type DeviceEvent, type DeviceEventListener, type DeviceInfo, DeviceJobQueue, type DeviceSearchTarget, type DeviceSelectionContext, type DeviceSelectionRequest, type DeviceTarget, EConnectorInteraction, type EIP712Domain, type ElectronBleApi, type ElectronBleConnectOptions, type ElectronBleDeviceInfo, type ElectronBleMatch, type ElectronBleScanOptions, type EvmAddress, type EvmEthereumDefinitions, type EvmGetAddressParams, type EvmPaymentRequest, type EvmPaymentRequestMemo, type EvmSignMsgParams, type EvmSignTxLedgerParams, type EvmSignTxParams, type EvmSignTxTrezorParams, type EvmSignTypedDataFull, type EvmSignTypedDataHash, type EvmSignTypedDataParams, type EvmSignature, type EvmSignedTx, ExportedAccountKey, type Failure, HARDWARE_METHOD_CATALOG, HARDWARE_RUNTIME_ID_PREFIX, type HardwareCallExtra, type HardwareDeviceIdentityInput, HardwareErrorCode, type HardwareEvent, type HardwareEventMap, type HardwareMethodMetadata, type HardwareMethodName, type HardwareOperation, type HardwareOperationTarget, type HardwareRuntimeId, type HardwareRuntimeIdKind, type HardwareUiEvent, HwkErrorOrigin, HwkRecoveryHint, type IBtcMethods, type ICommonCallParams, type IConnector, type IDeviceManagerMethods, type IDeviceManagerOperationContext, type IEvmMethods, type IHardwareBridge, type IHardwareCallParams, type IHardwareCommonCallParams, type IHardwareConnectionContext, type IHardwareWallet, type IPassphraseCallParams, type ISolMethods, type ITronMethods, type IWalletStateMethods, type JobOptions, type KnownDeviceConnection, type LogPayloadDescriber, type LogSummaryContext, type LogSummaryOptions, MISSING_BIP32_MASTER_FINGERPRINT, type NullableCallArg, OPERATION_DEFAULT_TTL_MS, type OperationEndReason, OperationRegistry, type PassphraseResponse, type PassphraseStateAware, type PrepareSolanaOffchainMessageV1Params, type PreparedSolanaOffchainMessageV1, QrDisplayData, QrFallbackReason, type Response, type RunAllNetworkGetAddressOptions, SDK, SaveDeviceBindingDeclineReason, type SaveDeviceBindingRequest, type SdkEvent, type SearchDevicesOptions, type SearchTargetReusePolicy, type SolAddress, type SolGetAddressParams, type SolOffchainMessageV1Params, type SolSignMsgParams, type SolSignTxParams, type SolSignature, type SolSignedTx, type Success, type TransportType, type TrezorBrightnessParams, type TrezorChangePinParams, type TrezorDeviceSettingsParams, type TrezorDisplayRotation, type TrezorSafetyCheckLevel, type TronAddress, type TronContract, type TronFreezeBalanceV2Contract, type TronGetAddressParams, type TronResource, type TronSignMsgParams, type TronSignTxParams, type TronSignature, type TronSignedTx, type TronTransferContract, type TronTriggerSmartContract, type TronUnfreezeBalanceV2Contract, type TronVote, type TronVoteWitnessContract, type TronWithdrawExpireUnfreezeContract, TypedEventEmitter, UI_REQUEST, type UiRequestEvent, UiRequestOperationAttribution, UiRequestRegistry, UiResponseEvent, type VendorType, type WalletIdentity, type ZcashFullViewingKey, type ZcashFullViewingKeyMode, type ZcashGetFullViewingKeyParams, type ZcashGetShieldedAddressParams, type ZcashShieldedAddress, assertBoundedCbor, batchCall, boundedCborFromHex, buildAllNetworkCancelledFailure, buildUnsupportedMethodResponse, bytesToHex, canReplayHardwareMethodAfterTransportFailure, compareSemver, createBridgedConnector, createCombinedConnector, createHardwareLinkId, createHardwareOperationId, createHardwareSearchTargetId, deriveDeviceFingerprint, detectHardwareVendorFromDescriptor, emitDeviceBindingStatus, ensure0x, failure, getAllNetworkMethodChain, getHardwareMethodMetadata, hasHardwareRuntimeIdPrefix, hexToBytes, isAllNetworkMethodName, isConnectionLost, isHardwareOperationId, isKnownNonTargetHardwareVendor, isUserRefusal, isWalletSafetyFailure, padHex64, parseBip32MasterFingerprint, parseHardwareRuntimeId, parseWalletMasterFingerprint, pickConnectionContext, prepareSolanaOffchainMessageV1, rehydrateConnectorError, requestBleDeviceSelection, requestSaveDeviceBinding, resolveHardwareOperationTarget, resolveSearchTargetReusePolicy, runAllNetworkGetAddress, serializeConnectorError, stripHex, success, summarizeForLog, toPhysicalDeviceSearchTarget };
2301
+ export { ALL_NETWORK_METHOD_NAMES, type ActiveJobInfo, type AllNetworkAddressParams, type AllNetworkAddressResponse, type AllNetworkAddressResponsePayload, type AllNetworkAttachIdentityContext, type AllNetworkCallItemContext, type AllNetworkDeviceIdentity, type AllNetworkGetAddressParams, type AllNetworkMethodName, type AllNetworkResponseContext, type BindBleDeviceParams, type BtcAddress, type BtcGetAddressParams, type BtcGetPublicKeyParams, type BtcPaymentRequest, type BtcPaymentRequestMemo, type BtcPublicKey, type BtcRefTransaction, type BtcSignMsgParams, type BtcSignPsbtParams, type BtcSignTxParams, type BtcSignature, type BtcSignedPsbt, type BtcSignedTx, type BtcTxInput, type BtcTxOutput, CHAIN_FINGERPRINT_PATHS, type CancelCapability, type CancelScopeHandle, type ChainCapability, type ChainForFingerprint, type ConnectionType, type ConnectorCallResult, type ConnectorConfig, type ConnectorConnectTarget, type ConnectorDevice, type ConnectorErrorParams, type ConnectorEventMap, type ConnectorEventType, type ConnectorSearchDevicesOptions, type ConnectorSerializedError, type ConnectorSession, type ConnectorUiEvent, DEVICE, DEVICE_CONNECT_RETRY_DELAY_MS, DEVICE_EVENT, type DetectableHardwareVendor, type DeviceAuthenticityParams, type DeviceAuthenticityResult, type DeviceBindingStatus, type DeviceCapabilities, type DeviceChangeEvent, type DeviceConnectEvent, type DeviceDescriptor, type DeviceDisconnectEvent, type DeviceEvent, type DeviceEventListener, type DeviceInfo, DeviceJobQueue, type DeviceSearchTarget, type DeviceSelectionContext, type DeviceSelectionRequest, type DeviceTarget, EConnectorInteraction, type EIP712Domain, type ElectronBleApi, type ElectronBleConnectOptions, type ElectronBleDeviceInfo, type ElectronBleMatch, type ElectronBleScanOptions, type EvmAddress, type EvmEthereumDefinitions, type EvmGetAddressParams, type EvmPaymentRequest, type EvmPaymentRequestMemo, type EvmSignMsgParams, type EvmSignTxLedgerParams, type EvmSignTxParams, type EvmSignTxTrezorParams, type EvmSignTypedDataFull, type EvmSignTypedDataHash, type EvmSignTypedDataParams, type EvmSignature, type EvmSignedTx, ExportedAccountKey, type Failure, HARDWARE_METHOD_CATALOG, HARDWARE_RUNTIME_ID_PREFIX, type HardwareCallExtra, type HardwareDeviceIdentityInput, HardwareErrorCode, type HardwareEvent, type HardwareEventMap, type HardwareMethodMetadata, type HardwareMethodName, type HardwareOperation, type HardwareOperationTarget, type HardwareRuntimeId, type HardwareRuntimeIdKind, type HardwareUiEvent, HwkErrorOrigin, HwkRecoveryHint, type IBtcMethods, type ICommonCallParams, type IConnector, type IDeviceManagerMethods, type IDeviceManagerOperationContext, type IEvmMethods, type IHardwareBridge, type IHardwareCallParams, type IHardwareCommonCallParams, type IHardwareConnectionContext, type IHardwareWallet, type IPassphraseCallParams, type ISolMethods, type ITronMethods, type IWalletStateMethods, type JobOptions, type KnownDeviceConnection, type LogPayloadDescriber, type LogSummaryContext, type LogSummaryOptions, MISSING_BIP32_MASTER_FINGERPRINT, type NullableCallArg, OPERATION_DEFAULT_TTL_MS, type OperationEndReason, OperationRegistry, type PassphraseResponse, type PassphraseStateAware, type PrepareSolanaOffchainMessageV1Params, type PreparedSolanaOffchainMessageV1, QrDisplayData, QrFallbackReason, type Response, type RunAllNetworkGetAddressOptions, SDK, SaveDeviceBindingDeclineReason, type SaveDeviceBindingRequest, type SdkEvent, type SearchDevicesOptions, type SearchTargetReusePolicy, type SolAddress, type SolGetAddressParams, type SolOffchainMessageV1Params, type SolSignMsgParams, type SolSignTxParams, type SolSignature, type SolSignedTx, type Success, type TransportType, type TrezorBrightnessParams, type TrezorChangePinParams, type TrezorDeviceSettingsParams, type TrezorDisplayRotation, type TrezorSafetyCheckLevel, type TronAddress, type TronContract, type TronFreezeBalanceV2Contract, type TronGetAddressParams, type TronResource, type TronSignMsgParams, type TronSignTxParams, type TronSignature, type TronSignedTx, type TronTransferContract, type TronTriggerSmartContract, type TronUnfreezeBalanceV2Contract, type TronVote, type TronVoteWitnessContract, type TronWithdrawExpireUnfreezeContract, TypedEventEmitter, UI_REQUEST, type UiRequestEvent, UiRequestOperationAttribution, UiRequestRegistry, UiResponseEvent, type VendorType, type WalletIdentity, type ZcashFullViewingKey, type ZcashFullViewingKeyMode, type ZcashGetFullViewingKeyParams, type ZcashGetShieldedAddressParams, type ZcashShieldedAddress, assertBoundedCbor, batchCall, boundedCborFromHex, buildAllNetworkCancelledFailure, buildUnsupportedMethodResponse, bytesToHex, canReplayHardwareMethodAfterTransportFailure, compareSemver, createBridgedConnector, createCombinedConnector, createHardwareLinkId, createHardwareOperationId, createHardwareSearchTargetId, deriveDeviceFingerprint, detectHardwareVendorFromDescriptor, emitDeviceBindingStatus, ensure0x, failure, getAllNetworkMethodChain, getHardwareMethodMetadata, hasHardwareRuntimeIdPrefix, hexToBytes, isAllNetworkMethodName, isConnectionLost, isHardwareOperationId, isKnownNonTargetHardwareVendor, isUserRefusal, isWalletSafetyFailure, padHex64, parseBip32MasterFingerprint, parseHardwareRuntimeId, parseWalletMasterFingerprint, pickConnectionContext, prepareSolanaOffchainMessageV1, rehydrateConnectorError, rehydrateElectronBleErrors, requestBleDeviceSelection, requestSaveDeviceBinding, resolveHardwareOperationTarget, resolveSearchTargetReusePolicy, runAllNetworkGetAddress, serializeConnectorError, stripHex, success, summarizeForLog, toPhysicalDeviceSearchTarget };