"use strict";
// Goal of this file is to inject all necessary device/signer dependency to coin-modules
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.messageSigner = exports.resolver = exports.cliTools = void 0;
const cli_transaction_1 = __importDefault(require("@ledgerhq/coin-evm/cli-transaction"));
const hw_getAddress_1 = __importDefault(require("@ledgerhq/coin-evm/hw-getAddress"));
const hw_signMessage_1 = require("@ledgerhq/coin-evm/hw-signMessage");
const setup_1 = require("../../bridge/setup");
const live_signer_evm_1 = require("@ledgerhq/live-signer-evm");
const createSigner = (transport) => {
    if (isDmkTransport(transport)) {
        return new live_signer_evm_1.DmkSignerEth(transport.dmk, transport.sessionId);
    }
    return new live_signer_evm_1.LegacySignerEth(transport);
};
const isDmkTransport = (transport) => {
    return ("dmk" in transport &&
        transport.dmk !== undefined &&
        "sessionId" in transport &&
        transport.sessionId !== undefined);
};
const messageSigner = {
    prepareMessageToSign: hw_signMessage_1.prepareMessageToSign,
    signMessage: (0, setup_1.createMessageSigner)(createSigner, hw_signMessage_1.signMessage),
};
exports.messageSigner = messageSigner;
const resolver = (0, setup_1.createResolver)(createSigner, hw_getAddress_1.default);
exports.resolver = resolver;
const cliTools = (0, cli_transaction_1.default)();
exports.cliTools = cliTools;
//# sourceMappingURL=setup.js.map