// Goal of this file is to inject all necessary device/signer dependency to coin-modules
import { createBridges } from "@ledgerhq/coin-internet_computer/bridge/index";
import ICP from "@zondax/ledger-icp";
import icpResolver from "@ledgerhq/coin-internet_computer/signer/index";
import { signMessage } from "@ledgerhq/coin-internet_computer/hw-signMessage";
import makeCliTools from "@ledgerhq/coin-internet_computer/test/cli";
import { createResolver, executeWithSigner } from "../../bridge/setup";
import { getPath, isError } from "./common";
const createSigner = (transport) => {
    const icp = new ICP(transport);
    return {
        showAddressAndPubKey: async (path) => {
            const r = await icp.showAddressAndPubKey(getPath(path));
            isError(r);
            return r;
        },
        getAddressAndPubKey: async (path) => {
            const r = await icp.getAddressAndPubKey(getPath(path));
            isError(r);
            return r;
        },
        sign: async (path, message) => {
            const r = await icp.sign(getPath(path), message, 0);
            isError(r);
            return r;
        },
    };
};
const bridge = createBridges(executeWithSigner(createSigner));
const messageSigner = {
    signMessage,
};
const resolver = createResolver(createSigner, icpResolver);
const cliTools = makeCliTools();
export { bridge, cliTools, messageSigner, resolver };
//# sourceMappingURL=setup.js.map