// Goal of this file is to inject all necessary device/signer dependency to coin-modules
import { createBridges } from "@ledgerhq/coin-cosmos/bridge/index";
import makeCliTools from "@ledgerhq/coin-cosmos/cli";
import cosmosResolver from "@ledgerhq/coin-cosmos/hw-getAddress";
import Cosmos from "@ledgerhq/hw-app-cosmos";
import { CosmosApp } from "@zondax/ledger-cosmos-js";
import { createResolver, executeWithSigner } from "../../bridge/setup";
import { getCurrencyConfiguration } from "../../config";
const createSigner = (transport) => {
    const cosmos = new CosmosApp(transport);
    const hwCosmos = new Cosmos(transport);
    return {
        getAddressAndPubKey: cosmos.getAddressAndPubKey.bind(cosmos),
        sign: cosmos.sign.bind(cosmos),
        getAddress: hwCosmos.getAddress.bind(hwCosmos),
    };
};
const getCurrencyConfig = (currency) => {
    if (!currency) {
        throw new Error("No currency provided");
    }
    return getCurrencyConfiguration(currency);
};
const bridge = createBridges(executeWithSigner(createSigner), getCurrencyConfig);
const resolver = createResolver(createSigner, cosmosResolver);
const cliTools = makeCliTools();
export { bridge, cliTools, resolver };
//# sourceMappingURL=setup.js.map