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