aboutsummaryrefslogtreecommitdiffstats
path: root/packages/subproviders/src/index.ts
blob: 9560c3597a8fccc9266e20881a7a8d983bfbed1e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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;
}