aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/contract_wrappers/exchange_wrapper.ts1
-rw-r--r--src/contract_wrappers/token_wrapper.ts2
-rw-r--r--src/subproviders/empty_wallet_subprovider.ts25
-rw-r--r--src/types.ts5
4 files changed, 30 insertions, 3 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts
index d601b5155..a324b8554 100644
--- a/src/contract_wrappers/exchange_wrapper.ts
+++ b/src/contract_wrappers/exchange_wrapper.ts
@@ -711,7 +711,6 @@ export class ExchangeWrapper extends ContractWrapper {
private async _isRoundingErrorAsync(numerator: BigNumber.BigNumber,
demoninator: BigNumber.BigNumber,
makerTokenAmount: BigNumber.BigNumber): Promise<boolean> {
- await assert.isUserAddressAvailableAsync(this._web3Wrapper);
const exchangeInstance = await this._getExchangeContractAsync();
const isRoundingError = await exchangeInstance.isRoundingError.call(
numerator, demoninator, makerTokenAmount,
diff --git a/src/contract_wrappers/token_wrapper.ts b/src/contract_wrappers/token_wrapper.ts
index 9c073f30b..9b529f64f 100644
--- a/src/contract_wrappers/token_wrapper.ts
+++ b/src/contract_wrappers/token_wrapper.ts
@@ -45,7 +45,6 @@ export class TokenWrapper extends ContractWrapper {
public async getBalanceAsync(tokenAddress: string, ownerAddress: string): Promise<BigNumber.BigNumber> {
assert.isETHAddressHex('ownerAddress', ownerAddress);
assert.isETHAddressHex('tokenAddress', tokenAddress);
- await assert.isUserAddressAvailableAsync(this._web3Wrapper);
const tokenContract = await this._getTokenContractAsync(tokenAddress);
let balance = await tokenContract.balanceOf.call(ownerAddress);
@@ -90,7 +89,6 @@ export class TokenWrapper extends ContractWrapper {
public async getAllowanceAsync(tokenAddress: string, ownerAddress: string, spenderAddress: string) {
assert.isETHAddressHex('ownerAddress', ownerAddress);
assert.isETHAddressHex('tokenAddress', tokenAddress);
- await assert.isUserAddressAvailableAsync(this._web3Wrapper);
const tokenContract = await this._getTokenContractAsync(tokenAddress);
let allowanceInBaseUnits = await tokenContract.allowance.call(ownerAddress, spenderAddress);
diff --git a/src/subproviders/empty_wallet_subprovider.ts b/src/subproviders/empty_wallet_subprovider.ts
new file mode 100644
index 000000000..0d037042d
--- /dev/null
+++ b/src/subproviders/empty_wallet_subprovider.ts
@@ -0,0 +1,25 @@
+import * as Web3 from 'web3';
+import {JSONRPCPayload} from '../types';
+
+/*
+ * 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: JSONRPCPayload, 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
+ }
+}
diff --git a/src/types.ts b/src/types.ts
index 9b22351bd..81ff30dc5 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -367,3 +367,8 @@ export interface ContractArtifact {
};
};
}
+
+export interface JSONRPCPayload {
+ params: any[];
+ method: string;
+}