From 038668efdfdd2eac85c30206e17128b0af2b48ce Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 5 Dec 2017 15:45:35 -0600 Subject: Port subproviders over to mono repo, refactor LedgerSubprovider to no longer rely on hookedWalletSubprovider. Added unit and integration tests. --- packages/subproviders/src/index.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 packages/subproviders/src/index.ts (limited to 'packages/subproviders/src/index.ts') diff --git a/packages/subproviders/src/index.ts b/packages/subproviders/src/index.ts new file mode 100644 index 000000000..9560c3597 --- /dev/null +++ b/packages/subproviders/src/index.ts @@ -0,0 +1,30 @@ +import { + comm_node as LedgerNodeCommunication, + comm_u2f as LedgerBrowserCommunication, + eth as LedgerEthereumClientFn, +} from 'ledgerco'; + +import {LedgerEthereumClient} from './types'; + +export {InjectedWeb3Subprovider} from './subproviders/injected_web3'; +export {RedundantRPCSubprovider} from './subproviders/redundant_rpc'; +export { + LedgerSubprovider, +} from './subproviders/ledger'; +export { + ECSignature, + LedgerWalletSubprovider, + LedgerCommunicationClient, +} from './types'; + +export async function ledgerEthereumBrowserClientFactoryAsync(): Promise { + const ledgerConnection = await LedgerBrowserCommunication.create_async(); + const ledgerEthClient = new LedgerEthereumClientFn(ledgerConnection); + return ledgerEthClient; +} + +export async function ledgerEthereumNodeJsClientFactoryAsync(): Promise { + const ledgerConnection = await LedgerNodeCommunication.create_async(); + const ledgerEthClient = new LedgerEthereumClientFn(ledgerConnection); + return ledgerEthClient; +} -- cgit v1.2.3