@onekeyfe/hwk-adapter-core 1.2.8-alpha.127 → 1.2.8-alpha.128

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.
@@ -24,7 +24,7 @@ var UI_REQUEST = {
24
24
  // Required app is not installed; with autoInstallApp on, ask the user
25
25
  // whether to install it before retrying the operation.
26
26
  REQUEST_INSTALL_APP: "ui-request-install-app",
27
- // The request is over the USB transport's size limit; ask whether to show it as a QR instead.
27
+ // The request cannot go over USB (see QrFallbackReason); ask whether to show it as a QR instead.
28
28
  REQUEST_QR_FALLBACK_CONFIRM: "ui-request-qr-fallback-confirm",
29
29
  REQUEST_PREEMPTION: "ui-request-preemption",
30
30
  REQUEST_TREZOR_THP_PAIRING: "ui-request-trezor-thp-pairing",
@@ -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-PY5FNLTS.js.map
187
+ //# sourceMappingURL=chunk-P7RDL34T.js.map
@@ -0,0 +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,EA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AA;AAKc,EAAA;AACiC,IAAA;AAC/B,IAAA;AACe,MAAA;AACI,MAAA;AACtB,MAAA;AACgC,QAAA;AAC/B,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"]}
@@ -24,7 +24,7 @@ var UI_REQUEST = {
24
24
  // Required app is not installed; with autoInstallApp on, ask the user
25
25
  // whether to install it before retrying the operation.
26
26
  REQUEST_INSTALL_APP: "ui-request-install-app",
27
- // The request is over the USB transport's size limit; ask whether to show it as a QR instead.
27
+ // The request cannot go over USB (see QrFallbackReason); ask whether to show it as a QR instead.
28
28
  REQUEST_QR_FALLBACK_CONFIRM: "ui-request-qr-fallback-confirm",
29
29
  REQUEST_PREEMPTION: "ui-request-preemption",
30
30
  REQUEST_TREZOR_THP_PAIRING: "ui-request-trezor-thp-pairing",
@@ -184,4 +184,4 @@ export {
184
184
  UI_REQUEST_TIMEOUT_TAG,
185
185
  UiRequestRegistry
186
186
  };
187
- //# sourceMappingURL=chunk-Y7NVGPPY.mjs.map
187
+ //# sourceMappingURL=chunk-Z574MVAT.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/events/ui-request.ts","../src/utils/UiRequestRegistry.ts"],"sourcesContent":["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"],"mappings":";;;;;AAEO,IAAM,WAAW;AAEjB,IAAM,aAAa;AAAA,EACxB,aAAa;AAAA,EACb,oBAAoB;AAAA;AAAA;AAAA,EAGpB,8BAA8B;AAAA,EAC9B,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,iBAAiB;AAAA,EACjB,2BAA2B;AAAA,EAC3B,uBAAuB;AAAA,EACvB,6BAA6B;AAAA,EAC7B,uBAAuB;AAAA,EACvB,wBAAwB;AAAA;AAAA;AAAA,EAGxB,gCAAgC;AAAA;AAAA;AAAA,EAGhC,qBAAqB;AAAA;AAAA,EAErB,6BAA6B;AAAA,EAC7B,oBAAoB;AAAA,EACpB,4BAA4B;AAAA,EAC5B,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,cAAc;AAChB;AAEO,IAAM,cAAc;AAAA,EACzB,aAAa;AAAA,EACb,oBAAoB;AAAA,EACpB,qBAAqB;AAAA,EACrB,uBAAuB;AAAA,EACvB,6BAA6B;AAAA,EAC7B,wBAAwB;AAAA,EACxB,2BAA2B;AAAA,EAC3B,gCAAgC;AAAA,EAChC,qBAAqB;AAAA,EACrB,6BAA6B;AAAA,EAC7B,oBAAoB;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,MAAc,UAAwB;AACpD,mBAAa,MAAM,KAAK;AACxB,WAAK,QAAQ,OAAO,IAAI;AACxB,YAAM;AAAA,QACJ,OAAO,OAAO,IAAI,MAAM,eAAe,IAAI,iBAAiB,GAAG;AAAA,UAC7D,MAAM;AAAA,QACR,CAAC;AAAA,MACH;AAAA,IACF;AAEA,QAAI,aAAa;AACf,YAAM,QAAQ,KAAK,QAAQ,IAAI,WAAW;AAC1C,UAAI,CAAC,MAAO;AACZ,UAAI,cAAc,UAAa,MAAM,cAAc,UAAW;AAC9D,UAAI,gBAAgB,UAAa,MAAM,gBAAgB,YAAa;AACpE,aAAO,aAAa,KAAK;AACzB;AAAA,IACF;AAEA,eAAW,CAAC,MAAM,KAAK,KAAK,CAAC,GAAG,KAAK,OAAO,GAAG;AAC7C,UAAI,gBAAgB,UAAa,MAAM,gBAAgB,aAAa;AAClE,eAAO,MAAM,KAAK;AAAA,MACpB;AAAA,IACF;AAAA,EACF;AAAA,EAEA,QAAc;AACZ,SAAK,OAAO;AAAA,EACd;AAAA,EAEA,WAAW,aAA+B;AACxC,QAAI,YAAa,QAAO,KAAK,QAAQ,IAAI,WAAW;AACpD,WAAO,KAAK,QAAQ,OAAO;AAAA,EAC7B;AACF;","names":[]}
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { H as HardwareErrorCode, a as HwkErrorOrigin, b as HwkRecoveryHint } from './errors-DednD9bG.mjs';
2
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';
3
- import { U as UiResponseEvent, E as ExportedAccountKey, a as UiRequestOperationAttribution, b as UI_REQUEST, Q as QrDisplayData, c as UiRequestRegistry, S as SaveDeviceBindingDeclineReason } from './ui-events-D_lCGgCk.mjs';
4
- export { D as DevicePermissionDeniedReason, d as DevicePermissionResponse, e as QrResponseData, f as UI_EVENT, g as UI_REQUEST_CANCELLED_TAG, h as UI_REQUEST_DEFAULT_TIMEOUT_MS, i as UI_REQUEST_PREEMPTED_TAG, j as UI_REQUEST_TIMEOUT_TAG, k as UI_RESPONSE } from './ui-events-D_lCGgCk.mjs';
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
+ 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
 
6
6
  interface Success<T> {
7
7
  success: true;
@@ -1427,6 +1427,7 @@ type UiRequestEvent = {
1427
1427
  payload: {
1428
1428
  vendor: string;
1429
1429
  requestId: string;
1430
+ reason: QrFallbackReason;
1430
1431
  } & UiRequestOperationAttribution;
1431
1432
  } | {
1432
1433
  type: typeof UI_REQUEST.REQUEST_TREZOR_THP_PAIRING;
@@ -1604,6 +1605,7 @@ interface HardwareEventMap {
1604
1605
  payload: {
1605
1606
  vendor: string;
1606
1607
  requestId: string;
1608
+ reason: QrFallbackReason;
1607
1609
  } & UiRequestOperationAttribution;
1608
1610
  };
1609
1611
  [UI_REQUEST.REQUEST_TREZOR_THP_PAIRING]: {
@@ -2290,4 +2292,4 @@ declare function buildUnsupportedMethodResponse(item: AllNetworkAddressParams):
2290
2292
 
2291
2293
  declare const DEVICE_CONNECT_RETRY_DELAY_MS = 1000;
2292
2294
 
2293
- 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, 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { H as HardwareErrorCode, a as HwkErrorOrigin, b as HwkRecoveryHint } from './errors-DednD9bG.js';
2
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';
3
- import { U as UiResponseEvent, E as ExportedAccountKey, a as UiRequestOperationAttribution, b as UI_REQUEST, Q as QrDisplayData, c as UiRequestRegistry, S as SaveDeviceBindingDeclineReason } from './ui-events-D_lCGgCk.js';
4
- export { D as DevicePermissionDeniedReason, d as DevicePermissionResponse, e as QrResponseData, f as UI_EVENT, g as UI_REQUEST_CANCELLED_TAG, h as UI_REQUEST_DEFAULT_TIMEOUT_MS, i as UI_REQUEST_PREEMPTED_TAG, j as UI_REQUEST_TIMEOUT_TAG, k as UI_RESPONSE } from './ui-events-D_lCGgCk.js';
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
+ 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
 
6
6
  interface Success<T> {
7
7
  success: true;
@@ -1427,6 +1427,7 @@ type UiRequestEvent = {
1427
1427
  payload: {
1428
1428
  vendor: string;
1429
1429
  requestId: string;
1430
+ reason: QrFallbackReason;
1430
1431
  } & UiRequestOperationAttribution;
1431
1432
  } | {
1432
1433
  type: typeof UI_REQUEST.REQUEST_TREZOR_THP_PAIRING;
@@ -1604,6 +1605,7 @@ interface HardwareEventMap {
1604
1605
  payload: {
1605
1606
  vendor: string;
1606
1607
  requestId: string;
1608
+ reason: QrFallbackReason;
1607
1609
  } & UiRequestOperationAttribution;
1608
1610
  };
1609
1611
  [UI_REQUEST.REQUEST_TREZOR_THP_PAIRING]: {
@@ -2290,4 +2292,4 @@ declare function buildUnsupportedMethodResponse(item: AllNetworkAddressParams):
2290
2292
 
2291
2293
  declare const DEVICE_CONNECT_RETRY_DELAY_MS = 1000;
2292
2294
 
2293
- 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, 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 };
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 };
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ var _chunkYLCHSNXOjs = require('./chunk-YLCHSNXO.js');
10
10
 
11
11
 
12
12
 
13
- var _chunkPY5FNLTSjs = require('./chunk-PY5FNLTS.js');
13
+ var _chunkP7RDL34Tjs = require('./chunk-P7RDL34T.js');
14
14
 
15
15
 
16
16
 
@@ -848,13 +848,13 @@ var TypedEventEmitter = class {
848
848
 
849
849
  // src/utils/requestSaveDeviceBinding.ts
850
850
  function emitDeviceBindingStatus(emitter, selectionRequestId, status) {
851
- emitter.emit(_chunkPY5FNLTSjs.UI_REQUEST.DEVICE_BINDING_STATUS, {
852
- type: _chunkPY5FNLTSjs.UI_REQUEST.DEVICE_BINDING_STATUS,
851
+ emitter.emit(_chunkP7RDL34Tjs.UI_REQUEST.DEVICE_BINDING_STATUS, {
852
+ type: _chunkP7RDL34Tjs.UI_REQUEST.DEVICE_BINDING_STATUS,
853
853
  payload: { selectionRequestId, status }
854
854
  });
855
855
  }
856
856
  async function requestSaveDeviceBinding(emitter, registry, binding, signal) {
857
- const type = _chunkPY5FNLTSjs.UI_REQUEST.REQUEST_SAVE_DEVICE_BINDING;
857
+ const type = _chunkP7RDL34Tjs.UI_REQUEST.REQUEST_SAVE_DEVICE_BINDING;
858
858
  const emitStatus = (status) => emitDeviceBindingStatus(emitter, binding.selectionRequestId, status);
859
859
  const declined = (reason) => {
860
860
  emitStatus("failed");
@@ -900,7 +900,7 @@ async function requestBleDeviceSelection({
900
900
  allowUsbFallback = false,
901
901
  pollIntervalMs = 1500
902
902
  }) {
903
- const type = _chunkPY5FNLTSjs.UI_REQUEST.REQUEST_SELECT_DEVICE;
903
+ const type = _chunkP7RDL34Tjs.UI_REQUEST.REQUEST_SELECT_DEVICE;
904
904
  if (signal.aborted) throw signal.reason;
905
905
  if (!emitter.listenerCount(type)) {
906
906
  throw _chunkUFNTICCXjs.createHwkError.call(void 0, {
@@ -1782,5 +1782,5 @@ var DEVICE_CONNECT_RETRY_DELAY_MS = 1e3;
1782
1782
 
1783
1783
 
1784
1784
 
1785
- exports.ALL_NETWORK_METHOD_NAMES = ALL_NETWORK_METHOD_NAMES; exports.CHAIN_FINGERPRINT_PATHS = CHAIN_FINGERPRINT_PATHS; exports.DEVICE = DEVICE; exports.DEVICE_CONNECT_RETRY_DELAY_MS = DEVICE_CONNECT_RETRY_DELAY_MS; exports.DEVICE_EVENT = DEVICE_EVENT; exports.DeviceJobQueue = DeviceJobQueue; exports.EConnectorInteraction = EConnectorInteraction; exports.HARDWARE_METHOD_CATALOG = HARDWARE_METHOD_CATALOG; exports.HARDWARE_RUNTIME_ID_PREFIX = HARDWARE_RUNTIME_ID_PREFIX; exports.HardwareErrorCode = _chunkUFNTICCXjs.HardwareErrorCode; exports.MISSING_BIP32_MASTER_FINGERPRINT = MISSING_BIP32_MASTER_FINGERPRINT; exports.OPERATION_DEFAULT_TTL_MS = OPERATION_DEFAULT_TTL_MS; exports.ORPHAN_ELIGIBLE_ERROR_CODES = _chunkUFNTICCXjs.ORPHAN_ELIGIBLE_ERROR_CODES; exports.OperationRegistry = OperationRegistry; exports.SDK = SDK; exports.TypedEventEmitter = TypedEventEmitter; exports.UI_EVENT = _chunkPY5FNLTSjs.UI_EVENT; exports.UI_REQUEST = _chunkPY5FNLTSjs.UI_REQUEST; exports.UI_REQUEST_CANCELLED_TAG = _chunkPY5FNLTSjs.UI_REQUEST_CANCELLED_TAG; exports.UI_REQUEST_DEFAULT_TIMEOUT_MS = _chunkPY5FNLTSjs.UI_REQUEST_DEFAULT_TIMEOUT_MS; exports.UI_REQUEST_PREEMPTED_TAG = _chunkPY5FNLTSjs.UI_REQUEST_PREEMPTED_TAG; exports.UI_REQUEST_TIMEOUT_TAG = _chunkPY5FNLTSjs.UI_REQUEST_TIMEOUT_TAG; exports.UI_RESPONSE = _chunkPY5FNLTSjs.UI_RESPONSE; exports.UiRequestRegistry = _chunkPY5FNLTSjs.UiRequestRegistry; exports.assertBoundedCbor = assertBoundedCbor; exports.batchCall = batchCall; exports.boundedCborFromHex = boundedCborFromHex; exports.buildAllNetworkCancelledFailure = buildAllNetworkCancelledFailure; exports.buildUnsupportedMethodResponse = buildUnsupportedMethodResponse; exports.bytesToHex = bytesToHex3; exports.canReplayHardwareMethodAfterTransportFailure = canReplayHardwareMethodAfterTransportFailure; exports.compareSemver = compareSemver; exports.createBridgedConnector = createBridgedConnector; exports.createCombinedConnector = createCombinedConnector; exports.createHardwareLinkId = createHardwareLinkId; exports.createHardwareOperationId = createHardwareOperationId; exports.createHardwareSearchTargetId = createHardwareSearchTargetId; exports.createHwkError = _chunkUFNTICCXjs.createHwkError; exports.defaultOriginForCode = _chunkUFNTICCXjs.defaultOriginForCode; exports.defaultRecoveryForCode = _chunkUFNTICCXjs.defaultRecoveryForCode; exports.deriveDeviceFingerprint = deriveDeviceFingerprint; exports.detectHardwareVendorFromDescriptor = detectHardwareVendorFromDescriptor; exports.emitDeviceBindingStatus = emitDeviceBindingStatus; exports.enrichErrorMessage = _chunkYLCHSNXOjs.enrichErrorMessage; exports.ensure0x = ensure0x; exports.failure = failure; exports.getAllNetworkMethodChain = getAllNetworkMethodChain; exports.getHardwareMethodMetadata = getHardwareMethodMetadata; exports.hasHardwareRuntimeIdPrefix = hasHardwareRuntimeIdPrefix; exports.hexToBytes = hexToBytes; exports.isAllNetworkMethodName = isAllNetworkMethodName; exports.isConnectionLost = isConnectionLost; exports.isHardwareOperationId = isHardwareOperationId; exports.isHwkRecoveryHint = _chunkUFNTICCXjs.isHwkRecoveryHint; exports.isKnownNonTargetHardwareVendor = isKnownNonTargetHardwareVendor; exports.isUserRefusal = isUserRefusal; exports.isWalletSafetyFailure = isWalletSafetyFailure; exports.operationMayHaveCompletedParams = _chunkUFNTICCXjs.operationMayHaveCompletedParams; exports.padHex64 = padHex64; exports.parseBip32MasterFingerprint = parseBip32MasterFingerprint; exports.parseHardwareRuntimeId = parseHardwareRuntimeId; exports.parseWalletMasterFingerprint = parseWalletMasterFingerprint; exports.pickConnectionContext = pickConnectionContext; exports.prepareSolanaOffchainMessageV1 = prepareSolanaOffchainMessageV1; exports.rehydrateConnectorError = rehydrateConnectorError; exports.requestBleDeviceSelection = requestBleDeviceSelection; exports.requestSaveDeviceBinding = requestSaveDeviceBinding; exports.resolveHardwareOperationTarget = resolveHardwareOperationTarget; exports.resolveSearchTargetReusePolicy = resolveSearchTargetReusePolicy; exports.runAllNetworkGetAddress = runAllNetworkGetAddress; exports.serializeConnectorError = serializeConnectorError; exports.stripHex = stripHex; exports.success = success; exports.summarizeForLog = summarizeForLog; exports.toPhysicalDeviceSearchTarget = toPhysicalDeviceSearchTarget;
1785
+ exports.ALL_NETWORK_METHOD_NAMES = ALL_NETWORK_METHOD_NAMES; exports.CHAIN_FINGERPRINT_PATHS = CHAIN_FINGERPRINT_PATHS; exports.DEVICE = DEVICE; exports.DEVICE_CONNECT_RETRY_DELAY_MS = DEVICE_CONNECT_RETRY_DELAY_MS; exports.DEVICE_EVENT = DEVICE_EVENT; exports.DeviceJobQueue = DeviceJobQueue; exports.EConnectorInteraction = EConnectorInteraction; exports.HARDWARE_METHOD_CATALOG = HARDWARE_METHOD_CATALOG; exports.HARDWARE_RUNTIME_ID_PREFIX = HARDWARE_RUNTIME_ID_PREFIX; exports.HardwareErrorCode = _chunkUFNTICCXjs.HardwareErrorCode; exports.MISSING_BIP32_MASTER_FINGERPRINT = MISSING_BIP32_MASTER_FINGERPRINT; exports.OPERATION_DEFAULT_TTL_MS = OPERATION_DEFAULT_TTL_MS; exports.ORPHAN_ELIGIBLE_ERROR_CODES = _chunkUFNTICCXjs.ORPHAN_ELIGIBLE_ERROR_CODES; exports.OperationRegistry = OperationRegistry; exports.SDK = SDK; exports.TypedEventEmitter = TypedEventEmitter; exports.UI_EVENT = _chunkP7RDL34Tjs.UI_EVENT; exports.UI_REQUEST = _chunkP7RDL34Tjs.UI_REQUEST; exports.UI_REQUEST_CANCELLED_TAG = _chunkP7RDL34Tjs.UI_REQUEST_CANCELLED_TAG; exports.UI_REQUEST_DEFAULT_TIMEOUT_MS = _chunkP7RDL34Tjs.UI_REQUEST_DEFAULT_TIMEOUT_MS; exports.UI_REQUEST_PREEMPTED_TAG = _chunkP7RDL34Tjs.UI_REQUEST_PREEMPTED_TAG; exports.UI_REQUEST_TIMEOUT_TAG = _chunkP7RDL34Tjs.UI_REQUEST_TIMEOUT_TAG; exports.UI_RESPONSE = _chunkP7RDL34Tjs.UI_RESPONSE; exports.UiRequestRegistry = _chunkP7RDL34Tjs.UiRequestRegistry; exports.assertBoundedCbor = assertBoundedCbor; exports.batchCall = batchCall; exports.boundedCborFromHex = boundedCborFromHex; exports.buildAllNetworkCancelledFailure = buildAllNetworkCancelledFailure; exports.buildUnsupportedMethodResponse = buildUnsupportedMethodResponse; exports.bytesToHex = bytesToHex3; exports.canReplayHardwareMethodAfterTransportFailure = canReplayHardwareMethodAfterTransportFailure; exports.compareSemver = compareSemver; exports.createBridgedConnector = createBridgedConnector; exports.createCombinedConnector = createCombinedConnector; exports.createHardwareLinkId = createHardwareLinkId; exports.createHardwareOperationId = createHardwareOperationId; exports.createHardwareSearchTargetId = createHardwareSearchTargetId; exports.createHwkError = _chunkUFNTICCXjs.createHwkError; exports.defaultOriginForCode = _chunkUFNTICCXjs.defaultOriginForCode; exports.defaultRecoveryForCode = _chunkUFNTICCXjs.defaultRecoveryForCode; exports.deriveDeviceFingerprint = deriveDeviceFingerprint; exports.detectHardwareVendorFromDescriptor = detectHardwareVendorFromDescriptor; exports.emitDeviceBindingStatus = emitDeviceBindingStatus; exports.enrichErrorMessage = _chunkYLCHSNXOjs.enrichErrorMessage; exports.ensure0x = ensure0x; exports.failure = failure; exports.getAllNetworkMethodChain = getAllNetworkMethodChain; exports.getHardwareMethodMetadata = getHardwareMethodMetadata; exports.hasHardwareRuntimeIdPrefix = hasHardwareRuntimeIdPrefix; exports.hexToBytes = hexToBytes; exports.isAllNetworkMethodName = isAllNetworkMethodName; exports.isConnectionLost = isConnectionLost; exports.isHardwareOperationId = isHardwareOperationId; exports.isHwkRecoveryHint = _chunkUFNTICCXjs.isHwkRecoveryHint; exports.isKnownNonTargetHardwareVendor = isKnownNonTargetHardwareVendor; exports.isUserRefusal = isUserRefusal; exports.isWalletSafetyFailure = isWalletSafetyFailure; exports.operationMayHaveCompletedParams = _chunkUFNTICCXjs.operationMayHaveCompletedParams; exports.padHex64 = padHex64; exports.parseBip32MasterFingerprint = parseBip32MasterFingerprint; exports.parseHardwareRuntimeId = parseHardwareRuntimeId; exports.parseWalletMasterFingerprint = parseWalletMasterFingerprint; exports.pickConnectionContext = pickConnectionContext; exports.prepareSolanaOffchainMessageV1 = prepareSolanaOffchainMessageV1; exports.rehydrateConnectorError = rehydrateConnectorError; exports.requestBleDeviceSelection = requestBleDeviceSelection; exports.requestSaveDeviceBinding = requestSaveDeviceBinding; exports.resolveHardwareOperationTarget = resolveHardwareOperationTarget; exports.resolveSearchTargetReusePolicy = resolveSearchTargetReusePolicy; exports.runAllNetworkGetAddress = runAllNetworkGetAddress; exports.serializeConnectorError = serializeConnectorError; exports.stripHex = stripHex; exports.success = success; exports.summarizeForLog = summarizeForLog; exports.toPhysicalDeviceSearchTarget = toPhysicalDeviceSearchTarget;
1786
1786
  //# sourceMappingURL=index.js.map
package/dist/index.mjs CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  UI_REQUEST_TIMEOUT_TAG,
11
11
  UI_RESPONSE,
12
12
  UiRequestRegistry
13
- } from "./chunk-Y7NVGPPY.mjs";
13
+ } from "./chunk-Z574MVAT.mjs";
14
14
  import {
15
15
  HardwareErrorCode,
16
16
  ORPHAN_ELIGIBLE_ERROR_CODES,
@@ -93,6 +93,11 @@ type DevicePermissionResponse = {
93
93
  * releases the operation, and has the user select a device again.
94
94
  */
95
95
  type SaveDeviceBindingDeclineReason = 'mismatch' | 'skipped';
96
+ /**
97
+ * Why the request cannot go over USB. Only `payload-too-large` comes after the request was built;
98
+ * the others mean a connected device cannot serve this wallet, so the host may offer a retry.
99
+ */
100
+ type QrFallbackReason = 'payload-too-large' | 'wallet-mismatch' | 'device-locked' | 'usb-unavailable';
96
101
  type UiResponseEvent = {
97
102
  type: typeof UI_RESPONSE.RECEIVE_SAVE_DEVICE_BINDING;
98
103
  payload: {
@@ -148,9 +153,13 @@ type UiResponseEvent = {
148
153
  };
149
154
  } | {
150
155
  type: typeof UI_RESPONSE.RECEIVE_QR_FALLBACK_CONFIRM;
151
- /** Echo the prompt's requestId; missing or stale IDs are ignored. */
156
+ /**
157
+ * Echo the prompt's requestId; missing or stale IDs are ignored. `retry` asks to look for
158
+ * the USB device again; it is ignored for `payload-too-large`.
159
+ */
152
160
  payload: {
153
161
  confirmed: boolean;
162
+ retry?: boolean;
154
163
  requestId?: string;
155
164
  };
156
165
  } | {
@@ -202,4 +211,4 @@ declare class UiRequestRegistry {
202
211
  hasPending(requestType?: string): boolean;
203
212
  }
204
213
 
205
- export { type DevicePermissionDeniedReason as D, type ExportedAccountKey as E, type QrDisplayData as Q, type SaveDeviceBindingDeclineReason as S, type UiResponseEvent as U, type UiRequestOperationAttribution as a, UI_REQUEST as b, UiRequestRegistry as c, type DevicePermissionResponse as d, type QrResponseData as e, UI_EVENT as f, UI_REQUEST_CANCELLED_TAG as g, UI_REQUEST_DEFAULT_TIMEOUT_MS as h, UI_REQUEST_PREEMPTED_TAG as i, UI_REQUEST_TIMEOUT_TAG as j, UI_RESPONSE as k };
214
+ export { type DevicePermissionDeniedReason as D, type ExportedAccountKey as E, type QrDisplayData as Q, type SaveDeviceBindingDeclineReason as S, type UiResponseEvent as U, type UiRequestOperationAttribution as a, UI_REQUEST as b, type QrFallbackReason as c, UiRequestRegistry as d, type DevicePermissionResponse as e, type QrResponseData as f, UI_EVENT as g, UI_REQUEST_CANCELLED_TAG as h, UI_REQUEST_DEFAULT_TIMEOUT_MS as i, UI_REQUEST_PREEMPTED_TAG as j, UI_REQUEST_TIMEOUT_TAG as k, UI_RESPONSE as l };
@@ -93,6 +93,11 @@ type DevicePermissionResponse = {
93
93
  * releases the operation, and has the user select a device again.
94
94
  */
95
95
  type SaveDeviceBindingDeclineReason = 'mismatch' | 'skipped';
96
+ /**
97
+ * Why the request cannot go over USB. Only `payload-too-large` comes after the request was built;
98
+ * the others mean a connected device cannot serve this wallet, so the host may offer a retry.
99
+ */
100
+ type QrFallbackReason = 'payload-too-large' | 'wallet-mismatch' | 'device-locked' | 'usb-unavailable';
96
101
  type UiResponseEvent = {
97
102
  type: typeof UI_RESPONSE.RECEIVE_SAVE_DEVICE_BINDING;
98
103
  payload: {
@@ -148,9 +153,13 @@ type UiResponseEvent = {
148
153
  };
149
154
  } | {
150
155
  type: typeof UI_RESPONSE.RECEIVE_QR_FALLBACK_CONFIRM;
151
- /** Echo the prompt's requestId; missing or stale IDs are ignored. */
156
+ /**
157
+ * Echo the prompt's requestId; missing or stale IDs are ignored. `retry` asks to look for
158
+ * the USB device again; it is ignored for `payload-too-large`.
159
+ */
152
160
  payload: {
153
161
  confirmed: boolean;
162
+ retry?: boolean;
154
163
  requestId?: string;
155
164
  };
156
165
  } | {
@@ -202,4 +211,4 @@ declare class UiRequestRegistry {
202
211
  hasPending(requestType?: string): boolean;
203
212
  }
204
213
 
205
- export { type DevicePermissionDeniedReason as D, type ExportedAccountKey as E, type QrDisplayData as Q, type SaveDeviceBindingDeclineReason as S, type UiResponseEvent as U, type UiRequestOperationAttribution as a, UI_REQUEST as b, UiRequestRegistry as c, type DevicePermissionResponse as d, type QrResponseData as e, UI_EVENT as f, UI_REQUEST_CANCELLED_TAG as g, UI_REQUEST_DEFAULT_TIMEOUT_MS as h, UI_REQUEST_PREEMPTED_TAG as i, UI_REQUEST_TIMEOUT_TAG as j, UI_RESPONSE as k };
214
+ export { type DevicePermissionDeniedReason as D, type ExportedAccountKey as E, type QrDisplayData as Q, type SaveDeviceBindingDeclineReason as S, type UiResponseEvent as U, type UiRequestOperationAttribution as a, UI_REQUEST as b, type QrFallbackReason as c, UiRequestRegistry as d, type DevicePermissionResponse as e, type QrResponseData as f, UI_EVENT as g, UI_REQUEST_CANCELLED_TAG as h, UI_REQUEST_DEFAULT_TIMEOUT_MS as i, UI_REQUEST_PREEMPTED_TAG as j, UI_REQUEST_TIMEOUT_TAG as k, UI_RESPONSE as l };
@@ -1 +1 @@
1
- export { D as DevicePermissionDeniedReason, d as DevicePermissionResponse, f as UI_EVENT, b as UI_REQUEST, g as UI_REQUEST_CANCELLED_TAG, h as UI_REQUEST_DEFAULT_TIMEOUT_MS, i as UI_REQUEST_PREEMPTED_TAG, j as UI_REQUEST_TIMEOUT_TAG, k as UI_RESPONSE, a as UiRequestOperationAttribution, c as UiRequestRegistry, U as UiResponseEvent } from './ui-events-D_lCGgCk.mjs';
1
+ export { D as DevicePermissionDeniedReason, e as DevicePermissionResponse, g as UI_EVENT, b as UI_REQUEST, 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, a as UiRequestOperationAttribution, d as UiRequestRegistry, U as UiResponseEvent } from './ui-events-Dvu2Gdu8.mjs';
@@ -1 +1 @@
1
- export { D as DevicePermissionDeniedReason, d as DevicePermissionResponse, f as UI_EVENT, b as UI_REQUEST, g as UI_REQUEST_CANCELLED_TAG, h as UI_REQUEST_DEFAULT_TIMEOUT_MS, i as UI_REQUEST_PREEMPTED_TAG, j as UI_REQUEST_TIMEOUT_TAG, k as UI_RESPONSE, a as UiRequestOperationAttribution, c as UiRequestRegistry, U as UiResponseEvent } from './ui-events-D_lCGgCk.js';
1
+ export { D as DevicePermissionDeniedReason, e as DevicePermissionResponse, g as UI_EVENT, b as UI_REQUEST, 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, a as UiRequestOperationAttribution, d as UiRequestRegistry, U as UiResponseEvent } from './ui-events-Dvu2Gdu8.js';
package/dist/ui-events.js CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
 
10
- var _chunkPY5FNLTSjs = require('./chunk-PY5FNLTS.js');
10
+ var _chunkP7RDL34Tjs = require('./chunk-P7RDL34T.js');
11
11
  require('./chunk-UFNTICCX.js');
12
12
 
13
13
 
@@ -18,5 +18,5 @@ require('./chunk-UFNTICCX.js');
18
18
 
19
19
 
20
20
 
21
- exports.UI_EVENT = _chunkPY5FNLTSjs.UI_EVENT; exports.UI_REQUEST = _chunkPY5FNLTSjs.UI_REQUEST; exports.UI_REQUEST_CANCELLED_TAG = _chunkPY5FNLTSjs.UI_REQUEST_CANCELLED_TAG; exports.UI_REQUEST_DEFAULT_TIMEOUT_MS = _chunkPY5FNLTSjs.UI_REQUEST_DEFAULT_TIMEOUT_MS; exports.UI_REQUEST_PREEMPTED_TAG = _chunkPY5FNLTSjs.UI_REQUEST_PREEMPTED_TAG; exports.UI_REQUEST_TIMEOUT_TAG = _chunkPY5FNLTSjs.UI_REQUEST_TIMEOUT_TAG; exports.UI_RESPONSE = _chunkPY5FNLTSjs.UI_RESPONSE; exports.UiRequestRegistry = _chunkPY5FNLTSjs.UiRequestRegistry;
21
+ exports.UI_EVENT = _chunkP7RDL34Tjs.UI_EVENT; exports.UI_REQUEST = _chunkP7RDL34Tjs.UI_REQUEST; exports.UI_REQUEST_CANCELLED_TAG = _chunkP7RDL34Tjs.UI_REQUEST_CANCELLED_TAG; exports.UI_REQUEST_DEFAULT_TIMEOUT_MS = _chunkP7RDL34Tjs.UI_REQUEST_DEFAULT_TIMEOUT_MS; exports.UI_REQUEST_PREEMPTED_TAG = _chunkP7RDL34Tjs.UI_REQUEST_PREEMPTED_TAG; exports.UI_REQUEST_TIMEOUT_TAG = _chunkP7RDL34Tjs.UI_REQUEST_TIMEOUT_TAG; exports.UI_RESPONSE = _chunkP7RDL34Tjs.UI_RESPONSE; exports.UiRequestRegistry = _chunkP7RDL34Tjs.UiRequestRegistry;
22
22
  //# sourceMappingURL=ui-events.js.map
@@ -7,7 +7,7 @@ import {
7
7
  UI_REQUEST_TIMEOUT_TAG,
8
8
  UI_RESPONSE,
9
9
  UiRequestRegistry
10
- } from "./chunk-Y7NVGPPY.mjs";
10
+ } from "./chunk-Z574MVAT.mjs";
11
11
  import "./chunk-V2OHL2JS.mjs";
12
12
  export {
13
13
  UI_EVENT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hwk-adapter-core",
3
- "version": "1.2.8-alpha.127",
3
+ "version": "1.2.8-alpha.128",
4
4
  "description": "Shared types and utilities for OneKey hardware wallet kit",
5
5
  "author": "OneKey",
6
6
  "license": "MIT",
@@ -70,5 +70,5 @@
70
70
  "tsup": "^8.0.0",
71
71
  "typescript": "^5.4.0"
72
72
  },
73
- "gitHead": "1fdcafbc25357d5f4372dc8f89f8c97e561fd153"
73
+ "gitHead": "201fda4da9c555f545ff4a776e79abf090ba8bf8"
74
74
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/hardware-js-sdk/hardware-js-sdk/packages/hwk-adapter-core/dist/chunk-PY5FNLTS.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;AAAA,EAC9B,cAAA,EAAgB,mBAAA;AAAA,EAChB,kBAAA,EAAoB,uBAAA;AAAA,EACpB,eAAA,EAAiB,oBAAA;AAAA,EACjB,yBAAA,EAA2B,8BAAA;AAAA,EAC3B,qBAAA,EAAuB,0BAAA;AAAA,EACvB,2BAAA,EAA6B,gCAAA;AAAA,EAC7B,qBAAA,EAAuB,0BAAA;AAAA,EACvB,sBAAA,EAAwB,2BAAA;AAAA;AAAA;AAAA,EAGxB,8BAAA,EAAgC,mCAAA;AAAA;AAAA;AAAA,EAGhC,mBAAA,EAAqB,wBAAA;AAAA;AAAA,EAErB,2BAAA,EAA6B,gCAAA;AAAA,EAC7B,kBAAA,EAAoB,uBAAA;AAAA,EACpB,0BAAA,EAA4B,+BAAA;AAAA,EAC5B,eAAA,EAAiB,UAAA;AAAA,EACjB,eAAA,EAAiB,oBAAA;AAAA,EACjB,iBAAA,EAAmB,sBAAA;AAAA,EACnB,YAAA,EAAc;AAChB,CAAA;AAEO,IAAM,YAAA,EAAc;AAAA,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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-PY5FNLTS.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 is over the USB transport's size limit; 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\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 /** Echo the prompt's requestId; missing or stale IDs are ignored. */\n payload: { confirmed: 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 +0,0 @@
1
- {"version":3,"sources":["../src/events/ui-request.ts","../src/utils/UiRequestRegistry.ts"],"sourcesContent":["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 is over the USB transport's size limit; 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\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 /** Echo the prompt's requestId; missing or stale IDs are ignored. */\n payload: { confirmed: 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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