diff options
author | Fabio Berger <me@fabioberger.com> | 2017-12-06 05:45:35 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-12-06 05:45:35 +0800 |
commit | 038668efdfdd2eac85c30206e17128b0af2b48ce (patch) | |
tree | dd89073024f6fc89ac6306629d4bd14cd1ac5e5e /packages/subproviders/src/index.ts | |
parent | 47789d770d08c20f33dbd839fcbd7bfa23d252a3 (diff) | |
download | dexon-sol-tools-038668efdfdd2eac85c30206e17128b0af2b48ce.tar.gz dexon-sol-tools-038668efdfdd2eac85c30206e17128b0af2b48ce.tar.zst dexon-sol-tools-038668efdfdd2eac85c30206e17128b0af2b48ce.zip |
Port subproviders over to mono repo, refactor LedgerSubprovider to no longer rely on hookedWalletSubprovider. Added unit and integration tests.
Diffstat (limited to 'packages/subproviders/src/index.ts')
-rw-r--r-- | packages/subproviders/src/index.ts | 30 |
1 files changed, 30 insertions, 0 deletions
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<LedgerEthereumClient> { + const ledgerConnection = await LedgerBrowserCommunication.create_async(); + const ledgerEthClient = new LedgerEthereumClientFn(ledgerConnection); + return ledgerEthClient; +} + +export async function ledgerEthereumNodeJsClientFactoryAsync(): Promise<LedgerEthereumClient> { + const ledgerConnection = await LedgerNodeCommunication.create_async(); + const ledgerEthClient = new LedgerEthereumClientFn(ledgerConnection); + return ledgerEthClient; +} |