@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.js +22 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -241,7 +241,7 @@ var _LedgerAdapter = class _LedgerAdapter {
|
|
|
241
241
|
async searchDevices() {
|
|
242
242
|
await this._ensureDevicePermission();
|
|
243
243
|
const devices = await this.connector.searchDevices();
|
|
244
|
-
console.log("[
|
|
244
|
+
console.log("[DMK] adapter.searchDevices raw:", JSON.stringify(devices));
|
|
245
245
|
for (const d of devices) {
|
|
246
246
|
if (d.connectId && !this._discoveredDevices.has(d.connectId)) {
|
|
247
247
|
this._discoveredDevices.set(d.connectId, this.connectorDeviceToDeviceInfo(d));
|
|
@@ -363,7 +363,7 @@ var _LedgerAdapter = class _LedgerAdapter {
|
|
|
363
363
|
// EVM methods
|
|
364
364
|
// ---------------------------------------------------------------------------
|
|
365
365
|
async evmGetAddress(connectId, _deviceId, params) {
|
|
366
|
-
console.log("[
|
|
366
|
+
console.log("[DMK] adapter.evmGetAddress called:", { connectId, _deviceId, path: params.path, showOnDevice: params.showOnDevice, chainId: params.chainId });
|
|
367
367
|
await this._ensureDevicePermission(connectId, _deviceId);
|
|
368
368
|
if (!await this._verifyDeviceFingerprint(connectId, _deviceId, "evm")) {
|
|
369
369
|
return (0, import_hardware_wallet_core2.failure)(import_hardware_wallet_core2.HardwareErrorCode.DeviceMismatch, "Wrong device connected");
|
|
@@ -927,6 +927,15 @@ var LedgerDeviceManager = class {
|
|
|
927
927
|
if (resolved) return;
|
|
928
928
|
resolved = true;
|
|
929
929
|
this._discovered.clear();
|
|
930
|
+
console.log("[DMK] enumerate raw devices:", JSON.stringify(devices.map((d) => ({
|
|
931
|
+
id: d.id,
|
|
932
|
+
deviceModel: d.deviceModel,
|
|
933
|
+
transport: d.transport,
|
|
934
|
+
name: d.name,
|
|
935
|
+
rssi: d.rssi,
|
|
936
|
+
// Dump all keys to see what else is available
|
|
937
|
+
_keys: Object.keys(d)
|
|
938
|
+
}))));
|
|
930
939
|
for (const d of devices) {
|
|
931
940
|
this._discovered.set(d.id, d);
|
|
932
941
|
}
|
|
@@ -972,7 +981,7 @@ var LedgerDeviceManager = class {
|
|
|
972
981
|
const currentIds = new Set(devices.map((d) => d.id));
|
|
973
982
|
for (const d of devices) {
|
|
974
983
|
this._discovered.set(d.id, d);
|
|
975
|
-
console.log("[
|
|
984
|
+
console.log("[DMK] listen device:", JSON.stringify({
|
|
976
985
|
id: d.id,
|
|
977
986
|
deviceModel: d.deviceModel,
|
|
978
987
|
name: d.name
|
|
@@ -1066,6 +1075,13 @@ function deviceActionToPromise(action, onInteraction) {
|
|
|
1066
1075
|
let sub;
|
|
1067
1076
|
sub = action.observable.subscribe({
|
|
1068
1077
|
next: (state) => {
|
|
1078
|
+
console.log("[DMK-Observable] state:", JSON.stringify({
|
|
1079
|
+
status: state.status,
|
|
1080
|
+
interaction: state.intermediateValue?.requiredUserInteraction,
|
|
1081
|
+
intermediateValue: state.intermediateValue,
|
|
1082
|
+
hasOutput: !!state.output,
|
|
1083
|
+
hasError: !!state.error
|
|
1084
|
+
}));
|
|
1069
1085
|
if (settled) return;
|
|
1070
1086
|
if (state.status === "completed") {
|
|
1071
1087
|
settled = true;
|
|
@@ -1116,7 +1132,7 @@ var SignerEth = class {
|
|
|
1116
1132
|
}
|
|
1117
1133
|
async getAddress(derivationPath, options) {
|
|
1118
1134
|
const checkOnDevice = options?.checkOnDevice ?? false;
|
|
1119
|
-
console.log("[
|
|
1135
|
+
console.log("[DMK] getAddress \u2192 DMK:", { derivationPath, checkOnDevice });
|
|
1120
1136
|
const action = this._sdk.getAddress(derivationPath, {
|
|
1121
1137
|
checkOnDevice
|
|
1122
1138
|
});
|
|
@@ -1369,7 +1385,7 @@ var LedgerConnectorBase = class {
|
|
|
1369
1385
|
// IConnector -- Method dispatch
|
|
1370
1386
|
// ---------------------------------------------------------------------------
|
|
1371
1387
|
async call(sessionId, method, params) {
|
|
1372
|
-
console.log("[
|
|
1388
|
+
console.log("[DMK] call:", method, JSON.stringify(params));
|
|
1373
1389
|
switch (method) {
|
|
1374
1390
|
case "evmGetAddress":
|
|
1375
1391
|
return this._evmGetAddress(sessionId, params);
|
|
@@ -1428,7 +1444,7 @@ var LedgerConnectorBase = class {
|
|
|
1428
1444
|
const signer = await this._getEthSigner(sessionId);
|
|
1429
1445
|
const path = normalizePath(params.path);
|
|
1430
1446
|
const checkOnDevice = params.showOnDevice ?? false;
|
|
1431
|
-
console.log("[
|
|
1447
|
+
console.log("[DMK] _evmGetAddress \u2192 signer.getAddress:", { path, checkOnDevice });
|
|
1432
1448
|
try {
|
|
1433
1449
|
const result = await signer.getAddress(path, {
|
|
1434
1450
|
checkOnDevice
|