aboutsummaryrefslogtreecommitdiffstats
path: root/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/subproviders/src/subproviders/empty_wallet_subprovider.ts')
-rw-r--r--packages/subproviders/src/subproviders/empty_wallet_subprovider.ts24
1 files changed, 14 insertions, 10 deletions
diff --git a/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts b/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts
index f5983dd9b..dc570b152 100644
--- a/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts
+++ b/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts
@@ -1,20 +1,24 @@
import * as Web3 from 'web3';
+import { Callback, ErrorCallback } from '../types';
+
import { Subprovider } from './subprovider';
-/*
- * This class implements the web3-provider-engine subprovider interface and returns
- * that the provider has no addresses when queried.
- * Source: https://github.com/MetaMask/provider-engine/blob/master/subproviders/subprovider.js
+/**
+ * This class implements the [web3-provider-engine](https://github.com/MetaMask/provider-engine) subprovider interface.
+ * It intercepts the `eth_accounts` JSON RPC requests and never returns any addresses when queried.
*/
export class EmptyWalletSubprovider extends Subprovider {
- // This method needs to be here to satisfy the interface but linter wants it to be static.
+ /**
+ * 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: () => void,
- end: (err: Error | null, result: any) => void,
- ) {
+ public handleRequest(payload: Web3.JSONRPCRequestPayload, next: Callback, end: ErrorCallback) {
switch (payload.method) {
case 'eth_accounts':
end(null, []);