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