@onekeyfe/hwk-keystone-adapter 1.2.8-alpha.121 → 1.2.8-alpha.123

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.d.mts CHANGED
@@ -400,8 +400,8 @@ declare class KeystoneAdapter implements IHardwareWallet {
400
400
  */
401
401
  private _fetchAccount;
402
402
  /**
403
- * Resolves which wallet is attached, without a per-path account. `CHAIN_FINGERPRINT_PATHS.evm` is
404
- * a leaf path, so it is cut to the account path Keystone expects.
403
+ * Resolves wallet identity without a per-path account. A caller-supplied fingerprint needs no
404
+ * device round trip; otherwise request the account path from the device.
405
405
  */
406
406
  private _ensureWalletKnown;
407
407
  private _assertQrChainSupported;
package/dist/index.d.ts CHANGED
@@ -400,8 +400,8 @@ declare class KeystoneAdapter implements IHardwareWallet {
400
400
  */
401
401
  private _fetchAccount;
402
402
  /**
403
- * Resolves which wallet is attached, without a per-path account. `CHAIN_FINGERPRINT_PATHS.evm` is
404
- * a leaf path, so it is cut to the account path Keystone expects.
403
+ * Resolves wallet identity without a per-path account. A caller-supplied fingerprint needs no
404
+ * device round trip; otherwise request the account path from the device.
405
405
  */
406
406
  private _ensureWalletKnown;
407
407
  private _assertQrChainSupported;
package/dist/index.js CHANGED
@@ -2263,7 +2263,7 @@ var KeystoneAdapter = class _KeystoneAdapter {
2263
2263
  );
2264
2264
  if (result.success) {
2265
2265
  const ur = result.payload;
2266
- return { urType: ur.urType, urData: ur.urData };
2266
+ return { urType: ur.urType, urData: ur.urData, channel: "usb" };
2267
2267
  }
2268
2268
  const usbError = (0, import_hwk_adapter_core3.rehydrateConnectorError)(result.error);
2269
2269
  const { origin: usbErrorOrigin, code: usbErrorCode } = usbError;
@@ -2276,7 +2276,7 @@ var KeystoneAdapter = class _KeystoneAdapter {
2276
2276
  });
2277
2277
  }
2278
2278
  const displayDevice2 = toDeviceInfo(record);
2279
- return this._requestQrAndAwaitResponse(
2279
+ const responseUr = await this._requestQrAndAwaitResponse(
2280
2280
  displayDevice2,
2281
2281
  {
2282
2282
  ...requestUr,
@@ -2285,6 +2285,7 @@ var KeystoneAdapter = class _KeystoneAdapter {
2285
2285
  },
2286
2286
  signal
2287
2287
  );
2288
+ return { ...responseUr, channel: "qr" };
2288
2289
  }
2289
2290
  throw usbError;
2290
2291
  }
@@ -2327,11 +2328,12 @@ var KeystoneAdapter = class _KeystoneAdapter {
2327
2328
  }
2328
2329
  const displayDevice = record ? toDeviceInfo(record) : placeholderDeviceInfo();
2329
2330
  try {
2330
- return await this._requestQrAndAwaitResponse(
2331
+ const responseUr = await this._requestQrAndAwaitResponse(
2331
2332
  displayDevice,
2332
2333
  { ...requestUr, animated, ...!operationName ? { allowAccountExport: true } : {} },
2333
2334
  signal
2334
2335
  );
2336
+ return { ...responseUr, channel: "qr" };
2335
2337
  } catch (error) {
2336
2338
  const { code, _tag: tag } = error;
2337
2339
  if (operationName && (code === import_hwk_adapter_core3.HardwareErrorCode.OperationTimeout || tag === import_hwk_adapter_core3.UI_REQUEST_TIMEOUT_TAG)) {
@@ -2387,7 +2389,6 @@ var KeystoneAdapter = class _KeystoneAdapter {
2387
2389
  message: "Keystone USB connection was lost during the bundle"
2388
2390
  });
2389
2391
  }
2390
- const operationConnectionType = (0, import_hwk_adapter_core3.isHardwareOperationId)(connectId) ? this._operations.resolve(connectId).connectionType : void 0;
2391
2392
  let existingRecord = target.record;
2392
2393
  if (!existingRecord) {
2393
2394
  existingRecord = await this._tryUsbAttach(signal, target.expectedMasterFingerprint);
@@ -2408,7 +2409,7 @@ var KeystoneAdapter = class _KeystoneAdapter {
2408
2409
  const parsed = responseUr.accountExport ? this.urEngine.parseAccountExport(responseUr) : this.urEngine.parseAccountResponse(responseUr);
2409
2410
  this._assertParsedIdentity(parsed, target);
2410
2411
  const account = requireExportedPath(parsed, syncPath, responseUr.accountExport);
2411
- const useSinglePathUsbExport = !responseUr.accountExport && (operationConnectionType ? operationConnectionType === "usb" : this._forcedTransport === "usb" || this._forcedTransport !== "qr" && Boolean(existingRecord?.usbSessionId));
2412
+ const useSinglePathUsbExport = !responseUr.accountExport && responseUr.channel === "usb";
2412
2413
  let record;
2413
2414
  if (useSinglePathUsbExport && existingRecord) {
2414
2415
  if (parsed.masterFingerprint !== existingRecord.masterFingerprint) {
@@ -2425,15 +2426,12 @@ var KeystoneAdapter = class _KeystoneAdapter {
2425
2426
  return { record, account: { ...account, hwkChain } };
2426
2427
  }
2427
2428
  /**
2428
- * Resolves which wallet is attached, without a per-path account. `CHAIN_FINGERPRINT_PATHS.evm` is
2429
- * a leaf path, so it is cut to the account path Keystone expects.
2429
+ * Resolves wallet identity without a per-path account. A caller-supplied fingerprint needs no
2430
+ * device round trip; otherwise request the account path from the device.
2430
2431
  */
2431
2432
  async _ensureWalletKnown(connectId, deviceId, chain, signal) {
2432
2433
  const target = this._resolveTarget(connectId, deviceId);
2433
2434
  if (target.record) return { record: target.record };
2434
- const attached = await this._tryUsbAttach(signal, target.expectedMasterFingerprint);
2435
- _KeystoneAdapter._throwIfAborted(signal);
2436
- if (attached) return { record: attached };
2437
2435
  if (target.expectedMasterFingerprint) {
2438
2436
  return { record: createDeviceRecord(target.expectedMasterFingerprint) };
2439
2437
  }