aboutsummaryrefslogtreecommitdiffstats
path: root/packages/subproviders/src/index.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-12-09 01:22:25 +0800
committerGitHub <noreply@github.com>2017-12-09 01:22:25 +0800
commit828dffffedf64e7ab5301284e2586082b6bc8f9c (patch)
tree6f429e6f2b3050de6dd7ce16e42c7f387bd5018a /packages/subproviders/src/index.ts
parent5eea829be9f5e8669c40dac965231051b668ed37 (diff)
parentaf8d24d0eb5af781f4731b5559979f2b02579785 (diff)
downloaddexon-sol-tools-828dffffedf64e7ab5301284e2586082b6bc8f9c.tar
dexon-sol-tools-828dffffedf64e7ab5301284e2586082b6bc8f9c.tar.gz
dexon-sol-tools-828dffffedf64e7ab5301284e2586082b6bc8f9c.tar.bz2
dexon-sol-tools-828dffffedf64e7ab5301284e2586082b6bc8f9c.tar.lz
dexon-sol-tools-828dffffedf64e7ab5301284e2586082b6bc8f9c.tar.xz
dexon-sol-tools-828dffffedf64e7ab5301284e2586082b6bc8f9c.tar.zst
dexon-sol-tools-828dffffedf64e7ab5301284e2586082b6bc8f9c.zip
Merge pull request #252 from 0xProject/feature/addSubproviders
Add Subproviders Subpackage
Diffstat (limited to 'packages/subproviders/src/index.ts')
-rw-r--r--packages/subproviders/src/index.ts38
1 files changed, 38 insertions, 0 deletions
diff --git a/packages/subproviders/src/index.ts b/packages/subproviders/src/index.ts
new file mode 100644
index 000000000..9b7cab3fa
--- /dev/null
+++ b/packages/subproviders/src/index.ts
@@ -0,0 +1,38 @@
+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';
+
+/**
+ * A factory method for creating a LedgerEthereumClient usable in a browser context.
+ * @return LedgerEthereumClient A browser client
+ */
+export async function ledgerEthereumBrowserClientFactoryAsync(): Promise<LedgerEthereumClient> {
+ const ledgerConnection = await LedgerBrowserCommunication.create_async();
+ const ledgerEthClient = new LedgerEthereumClientFn(ledgerConnection);
+ return ledgerEthClient;
+}
+
+/**
+ * A factory for creating a LedgerEthereumClient usable in a Node.js context.
+ * @return LedgerEthereumClient A Node.js client
+ */
+export async function ledgerEthereumNodeJsClientFactoryAsync(): Promise<LedgerEthereumClient> {
+ const ledgerConnection = await LedgerNodeCommunication.create_async();
+ const ledgerEthClient = new LedgerEthereumClientFn(ledgerConnection);
+ return ledgerEthClient;
+}