diff --git a/libs/ledger-live-common/package.json b/libs/ledger-live-common/package.json index f28e9e05ddf4..3b6da367e6a0 100644 --- a/libs/ledger-live-common/package.json +++ b/libs/ledger-live-common/package.json @@ -162,6 +162,7 @@ "@ledgerhq/hw-app-aptos": "workspace:^", "@ledgerhq/hw-app-btc": "workspace:^", "@ledgerhq/hw-app-cosmos": "workspace:^", + "@ledgerhq/hw-app-dmk-eth": "workspace:^", "@ledgerhq/hw-app-elrond": "workspace:^", "@ledgerhq/hw-app-eth": "workspace:^", "@ledgerhq/hw-app-exchange": "workspace:^", @@ -251,6 +252,7 @@ "zod": "^3.22.4" }, "devDependencies": { + "@ledgerhq/device-management-kit": "0.0.0-develop-20250106155719", "@ledgerhq/device-react": "workspace:^", "@ledgerhq/types-cryptoassets": "workspace:^", "@ledgerhq/types-devices": "workspace:^", diff --git a/libs/ledger-live-common/src/families/evm/setup.ts b/libs/ledger-live-common/src/families/evm/setup.ts index 54f506c3f028..7901161884a7 100644 --- a/libs/ledger-live-common/src/families/evm/setup.ts +++ b/libs/ledger-live-common/src/families/evm/setup.ts @@ -14,15 +14,32 @@ import { } from "../../bridge/setup"; import { Resolver } from "../../hw/getAddress/types"; import Transport from "@ledgerhq/hw-transport"; -import { Bridge } from "@ledgerhq/types-live"; +import type { Bridge, EvmSigner } from "@ledgerhq/types-live"; import { getCurrencyConfiguration } from "../../config"; import { CryptoCurrency } from "@ledgerhq/types-cryptoassets"; import { EvmConfigInfo } from "@ledgerhq/coin-evm/config"; +import { DeviceManagementKit } from "@ledgerhq/device-management-kit"; +import { DmkSignerEth } from "@ledgerhq/hw-app-dmk-eth"; + +const createSigner: CreateSigner = (transport: Transport) => { + if (isDmkTransport(transport)) { + return new DmkSignerEth(transport.sdk, transport.sessionId); + } -const createSigner: CreateSigner = (transport: Transport) => { return new Eth(transport); }; +const isDmkTransport = ( + transport: Transport, +): transport is Transport & { sdk: DeviceManagementKit; sessionId: string } => { + return ( + "sdk" in transport && + transport.sdk !== undefined && + "sessionId" in transport && + transport.sessionId !== undefined + ); +}; + const getCurrencyConfig = (currency: CryptoCurrency) => { return { info: getCurrencyConfiguration(currency) }; }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c2d28d7a57d6..fdca5d212afe 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3995,6 +3995,9 @@ importers: '@ledgerhq/hw-app-cosmos': specifier: workspace:^ version: link:../ledgerjs/packages/hw-app-cosmos + '@ledgerhq/hw-app-dmk-eth': + specifier: workspace:^ + version: link:../ledgerjs/packages/hw-app-dmk-eth '@ledgerhq/hw-app-elrond': specifier: workspace:^ version: link:../ledgerjs/packages/hw-app-elrond @@ -4257,6 +4260,9 @@ importers: specifier: ^3.22.4 version: 3.23.8 devDependencies: + '@ledgerhq/device-management-kit': + specifier: 0.0.0-develop-20250106155719 + version: 0.0.0-develop-20250106155719(rxjs@7.8.1)(ws@7.5.10) '@ledgerhq/device-react': specifier: workspace:^ version: link:../device-react @@ -38483,6 +38489,22 @@ snapshots: '@ledgerhq/live-env': 2.4.1 axios: 1.7.7 + '@ledgerhq/device-management-kit@0.0.0-develop-20250106155719(rxjs@7.8.1)(ws@7.5.10)': + dependencies: + '@sentry/minimal': 6.19.7 + '@statelyai/inspect': 0.4.0(ws@7.5.10)(xstate@5.19.1) + axios: 1.7.9 + inversify: 6.2.1(reflect-metadata@0.2.2) + inversify-logger-middleware: 3.1.0 + purify-ts: 2.1.0 + reflect-metadata: 0.2.2 + rxjs: 7.8.1 + semver: 7.6.3 + uuid: 11.0.4 + xstate: 5.19.1 + transitivePeerDependencies: + - ws + '@ledgerhq/device-management-kit@0.0.0-develop-20250106155719(rxjs@7.8.1)(ws@8.18.0)': dependencies: '@sentry/minimal': 6.19.7 @@ -42884,6 +42906,18 @@ snapshots: transitivePeerDependencies: - encoding + '@statelyai/inspect@0.4.0(ws@7.5.10)(xstate@5.19.1)': + dependencies: + fast-safe-stringify: 2.1.1 + isomorphic-ws: 5.0.0(ws@7.5.10) + partysocket: 0.0.25 + safe-stable-stringify: 2.4.3 + superjson: 1.13.3 + uuid: 9.0.1 + xstate: 5.19.1 + transitivePeerDependencies: + - ws + '@statelyai/inspect@0.4.0(ws@8.18.0)(xstate@5.19.1)': dependencies: fast-safe-stringify: 2.1.1