Normalise subprovider names
This commit is contained in:
parent
1d584b1329
commit
50bf6a991d
@ -5,7 +5,7 @@ import {JSONRPCPayload} from '../../../src/types';
|
|||||||
* that the provider has no addresses when queried.
|
* that the provider has no addresses when queried.
|
||||||
* Source: https://github.com/MetaMask/provider-engine/blob/master/subproviders/subprovider.js
|
* Source: https://github.com/MetaMask/provider-engine/blob/master/subproviders/subprovider.js
|
||||||
*/
|
*/
|
||||||
export class EmptyWalletSubProvider {
|
export class EmptyWalletSubprovider {
|
||||||
// This method needs to be here to satisfy the interface but linter wants it to be static.
|
// This method needs to be here to satisfy the interface but linter wants it to be static.
|
||||||
// tslint:disable-next-line:prefer-function-over-method
|
// tslint:disable-next-line:prefer-function-over-method
|
||||||
public handleRequest(payload: JSONRPCPayload, next: () => void, end: (err: Error|null, result: any) => void) {
|
public handleRequest(payload: JSONRPCPayload, next: () => void, end: (err: Error|null, result: any) => void) {
|
||||||
|
@ -5,7 +5,7 @@ import {JSONRPCPayload} from '../../../src/types';
|
|||||||
* the constant gas estimate when queried.
|
* the constant gas estimate when queried.
|
||||||
* Source: https://github.com/MetaMask/provider-engine/blob/master/subproviders/subprovider.js
|
* Source: https://github.com/MetaMask/provider-engine/blob/master/subproviders/subprovider.js
|
||||||
*/
|
*/
|
||||||
export class FakeGasEstimateProvider {
|
export class FakeGasEstimateSubprovider {
|
||||||
private constantGasAmount: number;
|
private constantGasAmount: number;
|
||||||
constructor(constantGasAmount: number) {
|
constructor(constantGasAmount: number) {
|
||||||
this.constantGasAmount = constantGasAmount;
|
this.constantGasAmount = constantGasAmount;
|
||||||
|
@ -7,8 +7,8 @@ import * as Web3 from 'web3';
|
|||||||
import ProviderEngine = require('web3-provider-engine');
|
import ProviderEngine = require('web3-provider-engine');
|
||||||
import RpcSubprovider = require('web3-provider-engine/subproviders/rpc');
|
import RpcSubprovider = require('web3-provider-engine/subproviders/rpc');
|
||||||
|
|
||||||
import {EmptyWalletSubProvider} from './subproviders/empty_wallet_subprovider';
|
import {EmptyWalletSubprovider} from './subproviders/empty_wallet_subprovider';
|
||||||
import {FakeGasEstimateProvider} from './subproviders/fake_gas_estimate_subprovider';
|
import {FakeGasEstimateSubprovider} from './subproviders/fake_gas_estimate_subprovider';
|
||||||
|
|
||||||
import {constants} from './constants';
|
import {constants} from './constants';
|
||||||
|
|
||||||
@ -23,9 +23,9 @@ export const web3Factory = {
|
|||||||
const provider = new ProviderEngine();
|
const provider = new ProviderEngine();
|
||||||
const rpcUrl = `http://${constants.RPC_HOST}:${constants.RPC_PORT}`;
|
const rpcUrl = `http://${constants.RPC_HOST}:${constants.RPC_PORT}`;
|
||||||
if (!hasAddresses) {
|
if (!hasAddresses) {
|
||||||
provider.addProvider(new EmptyWalletSubProvider());
|
provider.addProvider(new EmptyWalletSubprovider());
|
||||||
}
|
}
|
||||||
provider.addProvider(new FakeGasEstimateProvider(constants.GAS_ESTIMATE));
|
provider.addProvider(new FakeGasEstimateSubprovider(constants.GAS_ESTIMATE));
|
||||||
provider.addProvider(new RpcSubprovider({
|
provider.addProvider(new RpcSubprovider({
|
||||||
rpcUrl,
|
rpcUrl,
|
||||||
}));
|
}));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user