// Goal of this file is to inject all necessary device/signer dependency to coin-modules
import makeCliTools from "@ledgerhq/coin-evm/cli-transaction";
import evmResolver from "@ledgerhq/coin-evm/hw-getAddress";
import { prepareMessageToSign, signMessage } from "@ledgerhq/coin-evm/hw-signMessage";
import { createMessageSigner, createResolver } from "../../bridge/setup";
import { DmkSignerEth, LegacySignerEth } from "@ledgerhq/live-signer-evm";
const createSigner = (transport) => {
    if (isDmkTransport(transport)) {
        return new DmkSignerEth(transport.dmk, transport.sessionId);
    }
    return new LegacySignerEth(transport);
};
const isDmkTransport = (transport) => {
    return ("dmk" in transport &&
        transport.dmk !== undefined &&
        "sessionId" in transport &&
        transport.sessionId !== undefined);
};
const messageSigner = {
    prepareMessageToSign,
    signMessage: createMessageSigner(createSigner, signMessage),
};
const resolver = createResolver(createSigner, evmResolver);
const cliTools = makeCliTools();
export { cliTools, resolver, messageSigner };
//# sourceMappingURL=setup.js.map