Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(opts?: SubproviderOptions,
providerUrl?: string) {
opts = Object.assign({
accountsLength: 5
}, opts);
const getTransport = () => TransportU2F.create();
const ledger = createLedgerSubprovider(getTransport, opts);
const rpcProvider = new RpcSubprovider({
rpcUrl: providerUrl || DEFAULT_RPC_URL
});
this.engine = new ProviderEngine({pollingInterval: 10000});
this.engine.addProvider(ledger);
this.engine.addProvider(rpcProvider);
this.engine.start(); // Required by the provider engine.
}
window.provider = (config) => {
const basicProvider = new ethers.providers.InfuraProvider(config.provider.network);
const engine = new ProviderEngine();
const getTransport = () => TransportU2F.create();
const ledger = createLedgerSubprovider(getTransport, { accountsLength: 1 });
engine.addProvider(ledger);
engine.addProvider(new RpcSubprovider({ rpcUrl: '${basicProvider.baseUrl}/api' }));
engine.start();
return engine;
}
constructor(options, url) {
const getTransport = () => TransportU2F.create()
const ledger = createLedgerSubprovider(getTransport, options)
this.engine = new ProviderEngine()
this.engine.addProvider(ledger)
this.engine.addProvider(new FiltersSubprovider())
Web3.providers.HttpProvider.prototype.sendAsync = Web3.providers.HttpProvider.prototype.send
this.engine.addProvider(new ProviderSubprovider(new Web3.providers.HttpProvider(url)))
this.engine.start()
}