aboutsummaryrefslogtreecommitdiffstats
path: root/packages/subproviders
diff options
context:
space:
mode:
Diffstat (limited to 'packages/subproviders')
-rw-r--r--packages/subproviders/CHANGELOG.md2
-rw-r--r--packages/subproviders/src/subproviders/empty_wallet_subprovider.ts13
-rw-r--r--packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts13
-rw-r--r--packages/subproviders/src/subproviders/ganache.ts13
-rw-r--r--packages/subproviders/src/subproviders/injected_web3.ts13
-rw-r--r--packages/subproviders/src/subproviders/ledger.ts13
-rw-r--r--packages/subproviders/src/subproviders/nonce_tracker.ts13
-rw-r--r--packages/subproviders/src/subproviders/redundant_rpc.ts13
8 files changed, 70 insertions, 23 deletions
diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md
index 2947bb32e..cdf98cba3 100644
--- a/packages/subproviders/CHANGELOG.md
+++ b/packages/subproviders/CHANGELOG.md
@@ -4,8 +4,6 @@
* Introduce `JSONRPCRequestPayloadWithMethod` type (#465)
* Export `ErrorCallback` type. (#465)
- * Make `handleRequest` private in `LedgerSubprovider` since it should only be used
- internally by the providerEngine. (#465)
## v0.8.0 - _March 18, 2018_
diff --git a/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts b/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts
index 4cf3ece69..dc570b152 100644
--- a/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts
+++ b/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts
@@ -9,9 +9,16 @@ import { Subprovider } from './subprovider';
* It intercepts the `eth_accounts` JSON RPC requests and never returns any addresses when queried.
*/
export class EmptyWalletSubprovider extends Subprovider {
- // This method must conform to the web3-provider-engine interface
- // tslint:disable-next-line:prefer-function-over-method underscore-private-and-protected
- private handleRequest(payload: Web3.JSONRPCRequestPayload, next: Callback, end: ErrorCallback) {
+ /**
+ * This method conforms to the web3-provider-engine interface.
+ * It is called internally by the ProviderEngine when it is this subproviders
+ * turn to handle a JSON RPC request.
+ * @param payload JSON RPC payload
+ * @param next Callback to call if this subprovider decides not to handle the request
+ * @param end Callback to call if subprovider handled the request and wants to pass back the request.
+ */
+ // tslint:disable-next-line:prefer-function-over-method
+ public handleRequest(payload: Web3.JSONRPCRequestPayload, next: Callback, end: ErrorCallback) {
switch (payload.method) {
case 'eth_accounts':
end(null, []);
diff --git a/packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts b/packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts
index eff4439b4..a6f978db1 100644
--- a/packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts
+++ b/packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts
@@ -23,9 +23,16 @@ export class FakeGasEstimateSubprovider extends Subprovider {
super();
this._constantGasAmount = constantGasAmount;
}
- // This method must conform to the web3-provider-engine interface
- // tslint:disable-next-line:prefer-function-over-method underscore-private-and-protected
- private handleRequest(payload: Web3.JSONRPCRequestPayload, next: Callback, end: ErrorCallback) {
+ /**
+ * This method conforms to the web3-provider-engine interface.
+ * It is called internally by the ProviderEngine when it is this subproviders
+ * turn to handle a JSON RPC request.
+ * @param payload JSON RPC payload
+ * @param next Callback to call if this subprovider decides not to handle the request
+ * @param end Callback to call if subprovider handled the request and wants to pass back the request.
+ */
+ // tslint:disable-next-line:prefer-function-over-method
+ public handleRequest(payload: Web3.JSONRPCRequestPayload, next: Callback, end: ErrorCallback) {
switch (payload.method) {
case 'eth_estimateGas':
end(null, this._constantGasAmount);
diff --git a/packages/subproviders/src/subproviders/ganache.ts b/packages/subproviders/src/subproviders/ganache.ts
index feb17f8c5..fc0b9c3d2 100644
--- a/packages/subproviders/src/subproviders/ganache.ts
+++ b/packages/subproviders/src/subproviders/ganache.ts
@@ -19,9 +19,16 @@ export class GanacheSubprovider extends Subprovider {
super();
this._ganacheProvider = Ganache.provider(opts);
}
- // This method must conform to the web3-provider-engine interface
- // tslint:disable-next-line:prefer-function-over-method underscore-private-and-protected
- private handleRequest(payload: Web3.JSONRPCRequestPayload, next: Callback, end: ErrorCallback) {
+ /**
+ * This method conforms to the web3-provider-engine interface.
+ * It is called internally by the ProviderEngine when it is this subproviders
+ * turn to handle a JSON RPC request.
+ * @param payload JSON RPC payload
+ * @param next Callback to call if this subprovider decides not to handle the request
+ * @param end Callback to call if subprovider handled the request and wants to pass back the request.
+ */
+ // tslint:disable-next-line:prefer-function-over-method
+ public handleRequest(payload: Web3.JSONRPCRequestPayload, next: Callback, end: ErrorCallback) {
this._ganacheProvider.sendAsync(payload, (err: Error | null, result: any) => {
end(err, result && result.result);
});
diff --git a/packages/subproviders/src/subproviders/injected_web3.ts b/packages/subproviders/src/subproviders/injected_web3.ts
index 73c7e59db..cd9b0b603 100644
--- a/packages/subproviders/src/subproviders/injected_web3.ts
+++ b/packages/subproviders/src/subproviders/injected_web3.ts
@@ -21,9 +21,16 @@ export class InjectedWeb3Subprovider extends Subprovider {
super();
this._injectedWeb3 = new Web3(provider);
}
- // This method must conform to the web3-provider-engine interface
- // tslint:disable-next-line:prefer-function-over-method underscore-private-and-protected
- private handleRequest(payload: Web3.JSONRPCRequestPayload, next: Callback, end: ErrorCallback) {
+ /**
+ * This method conforms to the web3-provider-engine interface.
+ * It is called internally by the ProviderEngine when it is this subproviders
+ * turn to handle a JSON RPC request.
+ * @param payload JSON RPC payload
+ * @param next Callback to call if this subprovider decides not to handle the request
+ * @param end Callback to call if subprovider handled the request and wants to pass back the request.
+ */
+ // tslint:disable-next-line:prefer-function-over-method
+ public handleRequest(payload: Web3.JSONRPCRequestPayload, next: Callback, end: ErrorCallback) {
switch (payload.method) {
case 'web3_clientVersion':
this._injectedWeb3.version.getNode(end);
diff --git a/packages/subproviders/src/subproviders/ledger.ts b/packages/subproviders/src/subproviders/ledger.ts
index 3a63ff80f..8bc70d8b6 100644
--- a/packages/subproviders/src/subproviders/ledger.ts
+++ b/packages/subproviders/src/subproviders/ledger.ts
@@ -198,9 +198,16 @@ export class LedgerSubprovider extends Subprovider {
throw err;
}
}
- // Required to implement this public interface which doesn't conform to our linting rule.
- // tslint:disable-next-line:async-suffix underscore-private-and-protected
- private async handleRequest(
+ /**
+ * This method conforms to the web3-provider-engine interface.
+ * It is called internally by the ProviderEngine when it is this subproviders
+ * turn to handle a JSON RPC request.
+ * @param payload JSON RPC payload
+ * @param next Callback to call if this subprovider decides not to handle the request
+ * @param end Callback to call if subprovider handled the request and wants to pass back the request.
+ */
+ // tslint:disable-next-line:async-suffix
+ public async handleRequest(
payload: Web3.JSONRPCRequestPayload,
next: Callback,
end: (err: Error | null, result?: any) => void,
diff --git a/packages/subproviders/src/subproviders/nonce_tracker.ts b/packages/subproviders/src/subproviders/nonce_tracker.ts
index 919aa861f..249f16199 100644
--- a/packages/subproviders/src/subproviders/nonce_tracker.ts
+++ b/packages/subproviders/src/subproviders/nonce_tracker.ts
@@ -46,9 +46,16 @@ export class NonceTrackerSubprovider extends Subprovider {
throw new Error(NonceSubproviderErrors.CannotDetermineAddressFromPayload);
}
}
- // This method must conform to the web3-provider-engine interface
- // tslint:disable-next-line:prefer-function-over-method underscore-private-and-protected
- private async handleRequest(
+ /**
+ * This method conforms to the web3-provider-engine interface.
+ * It is called internally by the ProviderEngine when it is this subproviders
+ * turn to handle a JSON RPC request.
+ * @param payload JSON RPC payload
+ * @param next Callback to call if this subprovider decides not to handle the request
+ * @param end Callback to call if subprovider handled the request and wants to pass back the request.
+ */
+ // tslint:disable-next-line:async-suffix
+ public async handleRequest(
payload: Web3.JSONRPCRequestPayload,
next: NextCallback,
end: ErrorCallback,
diff --git a/packages/subproviders/src/subproviders/redundant_rpc.ts b/packages/subproviders/src/subproviders/redundant_rpc.ts
index 55b4128f4..ace2ed3c8 100644
--- a/packages/subproviders/src/subproviders/redundant_rpc.ts
+++ b/packages/subproviders/src/subproviders/redundant_rpc.ts
@@ -45,9 +45,16 @@ export class RedundantRPCSubprovider extends Subprovider {
});
});
}
- // This method must conform to the web3-provider-engine interface
- // tslint:disable-next-line:prefer-function-over-method underscore-private-and-protected
- private async handleRequest(
+ /**
+ * This method conforms to the web3-provider-engine interface.
+ * It is called internally by the ProviderEngine when it is this subproviders
+ * turn to handle a JSON RPC request.
+ * @param payload JSON RPC payload
+ * @param next Callback to call if this subprovider decides not to handle the request
+ * @param end Callback to call if subprovider handled the request and wants to pass back the request.
+ */
+ // tslint:disable-next-line:async-suffix
+ public async handleRequest(
payload: Web3.JSONRPCRequestPayload,
next: Callback,
end: (err: Error | null, data?: any) => void,