@bytezhang/ledger-adapter 0.0.15 → 0.0.16

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
@@ -207,7 +207,7 @@ var _LedgerAdapter = class _LedgerAdapter {
207
207
  async searchDevices() {
208
208
  await this._ensureDevicePermission();
209
209
  const devices = await this.connector.searchDevices();
210
- console.log("[LedgerAdapter] connector.searchDevices raw:", JSON.stringify(devices));
210
+ console.log("[DMK] adapter.searchDevices raw:", JSON.stringify(devices));
211
211
  for (const d of devices) {
212
212
  if (d.connectId && !this._discoveredDevices.has(d.connectId)) {
213
213
  this._discoveredDevices.set(d.connectId, this.connectorDeviceToDeviceInfo(d));
@@ -329,7 +329,7 @@ var _LedgerAdapter = class _LedgerAdapter {
329
329
  // EVM methods
330
330
  // ---------------------------------------------------------------------------
331
331
  async evmGetAddress(connectId, _deviceId, params) {
332
- console.log("[LedgerAdapter] evmGetAddress called:", { connectId, _deviceId, path: params.path, showOnDevice: params.showOnDevice, chainId: params.chainId });
332
+ console.log("[DMK] adapter.evmGetAddress called:", { connectId, _deviceId, path: params.path, showOnDevice: params.showOnDevice, chainId: params.chainId });
333
333
  await this._ensureDevicePermission(connectId, _deviceId);
334
334
  if (!await this._verifyDeviceFingerprint(connectId, _deviceId, "evm")) {
335
335
  return failure(HardwareErrorCode2.DeviceMismatch, "Wrong device connected");
@@ -893,6 +893,15 @@ var LedgerDeviceManager = class {
893
893
  if (resolved) return;
894
894
  resolved = true;
895
895
  this._discovered.clear();
896
+ console.log("[DMK] enumerate raw devices:", JSON.stringify(devices.map((d) => ({
897
+ id: d.id,
898
+ deviceModel: d.deviceModel,
899
+ transport: d.transport,
900
+ name: d.name,
901
+ rssi: d.rssi,
902
+ // Dump all keys to see what else is available
903
+ _keys: Object.keys(d)
904
+ }))));
896
905
  for (const d of devices) {
897
906
  this._discovered.set(d.id, d);
898
907
  }
@@ -938,7 +947,7 @@ var LedgerDeviceManager = class {
938
947
  const currentIds = new Set(devices.map((d) => d.id));
939
948
  for (const d of devices) {
940
949
  this._discovered.set(d.id, d);
941
- console.log("[LedgerDeviceManager] listen device:", JSON.stringify({
950
+ console.log("[DMK] listen device:", JSON.stringify({
942
951
  id: d.id,
943
952
  deviceModel: d.deviceModel,
944
953
  name: d.name
@@ -1032,6 +1041,13 @@ function deviceActionToPromise(action, onInteraction) {
1032
1041
  let sub;
1033
1042
  sub = action.observable.subscribe({
1034
1043
  next: (state) => {
1044
+ console.log("[DMK-Observable] state:", JSON.stringify({
1045
+ status: state.status,
1046
+ interaction: state.intermediateValue?.requiredUserInteraction,
1047
+ intermediateValue: state.intermediateValue,
1048
+ hasOutput: !!state.output,
1049
+ hasError: !!state.error
1050
+ }));
1035
1051
  if (settled) return;
1036
1052
  if (state.status === "completed") {
1037
1053
  settled = true;
@@ -1082,7 +1098,7 @@ var SignerEth = class {
1082
1098
  }
1083
1099
  async getAddress(derivationPath, options) {
1084
1100
  const checkOnDevice = options?.checkOnDevice ?? false;
1085
- console.log("[SignerEth] getAddress \u2192 DMK:", { derivationPath, checkOnDevice });
1101
+ console.log("[DMK] getAddress \u2192 DMK:", { derivationPath, checkOnDevice });
1086
1102
  const action = this._sdk.getAddress(derivationPath, {
1087
1103
  checkOnDevice
1088
1104
  });
@@ -1335,7 +1351,7 @@ var LedgerConnectorBase = class {
1335
1351
  // IConnector -- Method dispatch
1336
1352
  // ---------------------------------------------------------------------------
1337
1353
  async call(sessionId, method, params) {
1338
- console.log("[LedgerConnector] call:", method, JSON.stringify(params));
1354
+ console.log("[DMK] call:", method, JSON.stringify(params));
1339
1355
  switch (method) {
1340
1356
  case "evmGetAddress":
1341
1357
  return this._evmGetAddress(sessionId, params);
@@ -1394,7 +1410,7 @@ var LedgerConnectorBase = class {
1394
1410
  const signer = await this._getEthSigner(sessionId);
1395
1411
  const path = normalizePath(params.path);
1396
1412
  const checkOnDevice = params.showOnDevice ?? false;
1397
- console.log("[LedgerConnector] _evmGetAddress \u2192 signer.getAddress:", { path, checkOnDevice });
1413
+ console.log("[DMK] _evmGetAddress \u2192 signer.getAddress:", { path, checkOnDevice });
1398
1414
  try {
1399
1415
  const result = await signer.getAddress(path, {
1400
1416
  checkOnDevice