@onekeyfe/hwk-ledger-adapter 1.2.8-alpha.126 → 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.
package/dist/index.js CHANGED
@@ -2908,7 +2908,8 @@ var _LedgerAdapter = class _LedgerAdapter {
2908
2908
  /** Actual work done under the job queue — connection, fingerprint, call, and recovery. */
2909
2909
  async _runConnectorCall(connectId, method, params, signal, fingerprint, permissionDeviceId, commonParams, installContext, operationId, lockedRetryBudget = _LedgerAdapter.MAX_BUSINESS_RETRY_BUDGET) {
2910
2910
  _LedgerAdapter._throwIfAborted(signal);
2911
- if (!operationId) {
2911
+ const resolvesAppManagementTransport = APP_MANAGEMENT_METHODS.has(method) && this.connector.availableTransports?.includes("usb") && this.connector.availableTransports.includes("ble");
2912
+ if (!operationId && !resolvesAppManagementTransport) {
2912
2913
  await this._ensureDevicePermission(
2913
2914
  connectId,
2914
2915
  permissionDeviceId ?? fingerprint?.deviceId,
@@ -2982,6 +2983,16 @@ var _LedgerAdapter = class _LedgerAdapter {
2982
2983
  _tag: ERROR_TAG.DeviceSessionNotFound
2983
2984
  });
2984
2985
  }
2986
+ if (!operationId && resolvesAppManagementTransport) {
2987
+ const transport = this._sessionTransports.get(sessionId);
2988
+ await this._ensureDevicePermission(
2989
+ resolvedConnectId,
2990
+ permissionDeviceId ?? fingerprint?.deviceId,
2991
+ signal,
2992
+ transport && (isLedgerBleConnectionType(transport) ? "ble" : "hid")
2993
+ );
2994
+ _LedgerAdapter._throwIfAborted(signal);
2995
+ }
2985
2996
  try {
2986
2997
  const isBleSession = this._sessionTransports.get(sessionId) === "ble";
2987
2998
  if (!operationId && connectionAttempt.pendingBinding) {
@@ -3214,11 +3225,11 @@ var _LedgerAdapter = class _LedgerAdapter {
3214
3225
  * Ensure OS-level Bluetooth/USB permission; times out after 60s if the host never
3215
3226
  * replies. Without connectId the request is environment-level, else device-level.
3216
3227
  */
3217
- async _ensureDevicePermission(connectId, deviceId, signal) {
3228
+ async _ensureDevicePermission(connectId, deviceId, signal, transportOverride) {
3218
3229
  if (signal?.aborted) {
3219
3230
  _LedgerAdapter._throwIfAborted(signal);
3220
3231
  }
3221
- const transportType = this.activeTransport ?? "hid";
3232
+ const transportType = transportOverride ?? this.activeTransport ?? "hid";
3222
3233
  const operationId = this._activeOperationId();
3223
3234
  const waitPromise = this._uiRegistry.wait(
3224
3235
  import_hwk_adapter_core4.UI_REQUEST.REQUEST_DEVICE_PERMISSION,