@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.mjs CHANGED
@@ -2277,7 +2277,7 @@ var KeystoneAdapter = class _KeystoneAdapter {
2277
2277
  );
2278
2278
  if (result.success) {
2279
2279
  const ur = result.payload;
2280
- return { urType: ur.urType, urData: ur.urData };
2280
+ return { urType: ur.urType, urData: ur.urData, channel: "usb" };
2281
2281
  }
2282
2282
  const usbError = rehydrateConnectorError(result.error);
2283
2283
  const { origin: usbErrorOrigin, code: usbErrorCode } = usbError;
@@ -2290,7 +2290,7 @@ var KeystoneAdapter = class _KeystoneAdapter {
2290
2290
  });
2291
2291
  }
2292
2292
  const displayDevice2 = toDeviceInfo(record);
2293
- return this._requestQrAndAwaitResponse(
2293
+ const responseUr = await this._requestQrAndAwaitResponse(
2294
2294
  displayDevice2,
2295
2295
  {
2296
2296
  ...requestUr,
@@ -2299,6 +2299,7 @@ var KeystoneAdapter = class _KeystoneAdapter {
2299
2299
  },
2300
2300
  signal
2301
2301
  );
2302
+ return { ...responseUr, channel: "qr" };
2302
2303
  }
2303
2304
  throw usbError;
2304
2305
  }
@@ -2341,11 +2342,12 @@ var KeystoneAdapter = class _KeystoneAdapter {
2341
2342
  }
2342
2343
  const displayDevice = record ? toDeviceInfo(record) : placeholderDeviceInfo();
2343
2344
  try {
2344
- return await this._requestQrAndAwaitResponse(
2345
+ const responseUr = await this._requestQrAndAwaitResponse(
2345
2346
  displayDevice,
2346
2347
  { ...requestUr, animated, ...!operationName ? { allowAccountExport: true } : {} },
2347
2348
  signal
2348
2349
  );
2350
+ return { ...responseUr, channel: "qr" };
2349
2351
  } catch (error) {
2350
2352
  const { code, _tag: tag } = error;
2351
2353
  if (operationName && (code === HardwareErrorCode2.OperationTimeout || tag === UI_REQUEST_TIMEOUT_TAG)) {
@@ -2401,7 +2403,6 @@ var KeystoneAdapter = class _KeystoneAdapter {
2401
2403
  message: "Keystone USB connection was lost during the bundle"
2402
2404
  });
2403
2405
  }
2404
- const operationConnectionType = isHardwareOperationId2(connectId) ? this._operations.resolve(connectId).connectionType : void 0;
2405
2406
  let existingRecord = target.record;
2406
2407
  if (!existingRecord) {
2407
2408
  existingRecord = await this._tryUsbAttach(signal, target.expectedMasterFingerprint);
@@ -2422,7 +2423,7 @@ var KeystoneAdapter = class _KeystoneAdapter {
2422
2423
  const parsed = responseUr.accountExport ? this.urEngine.parseAccountExport(responseUr) : this.urEngine.parseAccountResponse(responseUr);
2423
2424
  this._assertParsedIdentity(parsed, target);
2424
2425
  const account = requireExportedPath(parsed, syncPath, responseUr.accountExport);
2425
- const useSinglePathUsbExport = !responseUr.accountExport && (operationConnectionType ? operationConnectionType === "usb" : this._forcedTransport === "usb" || this._forcedTransport !== "qr" && Boolean(existingRecord?.usbSessionId));
2426
+ const useSinglePathUsbExport = !responseUr.accountExport && responseUr.channel === "usb";
2426
2427
  let record;
2427
2428
  if (useSinglePathUsbExport && existingRecord) {
2428
2429
  if (parsed.masterFingerprint !== existingRecord.masterFingerprint) {
@@ -2439,15 +2440,12 @@ var KeystoneAdapter = class _KeystoneAdapter {
2439
2440
  return { record, account: { ...account, hwkChain } };
2440
2441
  }
2441
2442
  /**
2442
- * Resolves which wallet is attached, without a per-path account. `CHAIN_FINGERPRINT_PATHS.evm` is
2443
- * a leaf path, so it is cut to the account path Keystone expects.
2443
+ * Resolves wallet identity without a per-path account. A caller-supplied fingerprint needs no
2444
+ * device round trip; otherwise request the account path from the device.
2444
2445
  */
2445
2446
  async _ensureWalletKnown(connectId, deviceId, chain, signal) {
2446
2447
  const target = this._resolveTarget(connectId, deviceId);
2447
2448
  if (target.record) return { record: target.record };
2448
- const attached = await this._tryUsbAttach(signal, target.expectedMasterFingerprint);
2449
- _KeystoneAdapter._throwIfAborted(signal);
2450
- if (attached) return { record: attached };
2451
2449
  if (target.expectedMasterFingerprint) {
2452
2450
  return { record: createDeviceRecord(target.expectedMasterFingerprint) };
2453
2451
  }