aboutsummaryrefslogtreecommitdiffstats
path: root/src/subproviders
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-08-17 06:34:09 +0800
committerFabio Berger <me@fabioberger.com>2017-08-17 06:34:09 +0800
commita32b94bac440f127c0b984d7a1e763cf4cb86792 (patch)
tree22aa4b13e067017220c579958bcc8225a5b22a84 /src/subproviders
parent6ec3c8728e639b74bd94ce222097fd0841bb0399 (diff)
downloaddexon-sol-tools-a32b94bac440f127c0b984d7a1e763cf4cb86792.tar
dexon-sol-tools-a32b94bac440f127c0b984d7a1e763cf4cb86792.tar.gz
dexon-sol-tools-a32b94bac440f127c0b984d7a1e763cf4cb86792.tar.bz2
dexon-sol-tools-a32b94bac440f127c0b984d7a1e763cf4cb86792.tar.lz
dexon-sol-tools-a32b94bac440f127c0b984d7a1e763cf4cb86792.tar.xz
dexon-sol-tools-a32b94bac440f127c0b984d7a1e763cf4cb86792.tar.zst
dexon-sol-tools-a32b94bac440f127c0b984d7a1e763cf4cb86792.zip
Remove isUserAddressAvailable assertion from getBalanceAsync and add regression test
Diffstat (limited to 'src/subproviders')
-rw-r--r--src/subproviders/empty_wallet_subprovider.ts25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/subproviders/empty_wallet_subprovider.ts b/src/subproviders/empty_wallet_subprovider.ts
new file mode 100644
index 000000000..40d3d418d
--- /dev/null
+++ b/src/subproviders/empty_wallet_subprovider.ts
@@ -0,0 +1,25 @@
+import * as _ from 'lodash';
+import Web3 = require('web3');
+
+/*
+ * 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
+ */
+export class EmptyWalletSubProvider {
+ public handleRequest(payload: any, next: () => void, end: (err: Error|null, result: any) => void) {
+ switch (payload.method) {
+ case 'eth_accounts':
+ end(null, []);
+ return;
+
+ default:
+ next();
+ return;
+ }
+ }
+ // Required to implement this method despite not needing it for this subprovider
+ public setEngine(engine: any) {
+ // noop
+ }
+}