aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/contract-wrappers/src/utils/decorators.ts8
-rw-r--r--packages/contract-wrappers/src/utils/exchange_transfer_simulator.ts3
-rw-r--r--packages/contract-wrappers/src/utils/filter_utils.ts4
-rw-r--r--packages/contract-wrappers/test/ether_token_wrapper_test.ts4
-rw-r--r--packages/contract-wrappers/test/exchange_wrapper_test.ts4
-rw-r--r--packages/contract-wrappers/test/subscription_test.ts2
-rw-r--r--packages/contract-wrappers/test/token_wrapper_test.ts4
-rw-r--r--packages/order-watcher/src/order_watcher/order_watcher.ts33
-rw-r--r--packages/subproviders/test/unit/eth_lightwallet_subprovider_test.ts10
9 files changed, 31 insertions, 41 deletions
diff --git a/packages/contract-wrappers/src/utils/decorators.ts b/packages/contract-wrappers/src/utils/decorators.ts
index 494575e7b..ccb4c6e11 100644
--- a/packages/contract-wrappers/src/utils/decorators.ts
+++ b/packages/contract-wrappers/src/utils/decorators.ts
@@ -30,8 +30,8 @@ const schemaErrorTransformer = (error: Error) => {
*/
const asyncErrorHandlerFactory = (errorTransformer: ErrorTransformer) => {
const asyncErrorHandlingDecorator = (
- target: object,
- key: string | symbol,
+ _target: object,
+ _key: string | symbol,
descriptor: TypedPropertyDescriptor<AsyncMethod>,
) => {
const originalMethod = descriptor.value as AsyncMethod;
@@ -57,8 +57,8 @@ const asyncErrorHandlerFactory = (errorTransformer: ErrorTransformer) => {
const syncErrorHandlerFactory = (errorTransformer: ErrorTransformer) => {
const syncErrorHandlingDecorator = (
- target: object,
- key: string | symbol,
+ _target: object,
+ _key: string | symbol,
descriptor: TypedPropertyDescriptor<SyncMethod>,
) => {
const originalMethod = descriptor.value as SyncMethod;
diff --git a/packages/contract-wrappers/src/utils/exchange_transfer_simulator.ts b/packages/contract-wrappers/src/utils/exchange_transfer_simulator.ts
index 527b8575d..279f2a796 100644
--- a/packages/contract-wrappers/src/utils/exchange_transfer_simulator.ts
+++ b/packages/contract-wrappers/src/utils/exchange_transfer_simulator.ts
@@ -1,8 +1,7 @@
-import { BlockParamLiteral, ExchangeContractErrs } from '@0xproject/types';
+import { ExchangeContractErrs } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { AbstractBalanceAndProxyAllowanceLazyStore } from '../abstract/abstract_balance_and_proxy_allowance_lazy_store';
-import { TokenWrapper } from '../contract_wrappers/token_wrapper';
import { TradeSide, TransferType } from '../types';
import { constants } from '../utils/constants';
diff --git a/packages/contract-wrappers/src/utils/filter_utils.ts b/packages/contract-wrappers/src/utils/filter_utils.ts
index 5256d010f..f96dc573f 100644
--- a/packages/contract-wrappers/src/utils/filter_utils.ts
+++ b/packages/contract-wrappers/src/utils/filter_utils.ts
@@ -30,7 +30,7 @@ export const filterUtils = {
blockRange?: BlockRange,
): FilterObject {
const eventAbi = _.find(abi, { name: eventName }) as EventAbi;
- const eventSignature = filterUtils.getEventSignatureFromAbiByName(eventAbi, eventName);
+ const eventSignature = filterUtils.getEventSignatureFromAbiByName(eventAbi);
const topicForEventSignature = ethUtil.addHexPrefix(jsSHA3.keccak256(eventSignature));
const topicsForIndexedArgs = filterUtils.getTopicsForIndexedArgs(eventAbi, indexFilterValues);
const topics = [topicForEventSignature, ...topicsForIndexedArgs];
@@ -46,7 +46,7 @@ export const filterUtils = {
}
return filter;
},
- getEventSignatureFromAbiByName(eventAbi: EventAbi, eventName: ContractEvents): string {
+ getEventSignatureFromAbiByName(eventAbi: EventAbi): string {
const types = _.map(eventAbi.inputs, 'type');
const signature = `${eventAbi.name}(${types.join(',')})`;
return signature;
diff --git a/packages/contract-wrappers/test/ether_token_wrapper_test.ts b/packages/contract-wrappers/test/ether_token_wrapper_test.ts
index b13ac72bb..f401ef90a 100644
--- a/packages/contract-wrappers/test/ether_token_wrapper_test.ts
+++ b/packages/contract-wrappers/test/ether_token_wrapper_test.ts
@@ -277,7 +277,7 @@ describe('EtherTokenWrapper', () => {
it('should cancel outstanding subscriptions when ZeroEx.setProvider is called', (done: DoneCallback) => {
(async () => {
const callbackNeverToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)(
- (logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
+ (_logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
done(new Error('Expected this subscription to have been cancelled'));
},
);
@@ -307,7 +307,7 @@ describe('EtherTokenWrapper', () => {
it('Should cancel subscription when unsubscribe called', (done: DoneCallback) => {
(async () => {
const callbackNeverToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)(
- (logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
+ (_logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
done(new Error('Expected this subscription to have been cancelled'));
},
);
diff --git a/packages/contract-wrappers/test/exchange_wrapper_test.ts b/packages/contract-wrappers/test/exchange_wrapper_test.ts
index cf69d4813..c945b4c70 100644
--- a/packages/contract-wrappers/test/exchange_wrapper_test.ts
+++ b/packages/contract-wrappers/test/exchange_wrapper_test.ts
@@ -999,7 +999,7 @@ describe('ExchangeWrapper', () => {
it('Outstanding subscriptions are cancelled when contractWrappers.setProvider called', (done: DoneCallback) => {
(async () => {
const callbackNeverToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)(
- (logEvent: DecodedLogEvent<LogFillContractEventArgs>) => {
+ (_logEvent: DecodedLogEvent<LogFillContractEventArgs>) => {
done(new Error('Expected this subscription to have been cancelled'));
},
);
@@ -1024,7 +1024,7 @@ describe('ExchangeWrapper', () => {
it('Should cancel subscription when unsubscribe called', (done: DoneCallback) => {
(async () => {
const callbackNeverToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)(
- (logEvent: DecodedLogEvent<LogFillContractEventArgs>) => {
+ (_logEvent: DecodedLogEvent<LogFillContractEventArgs>) => {
done(new Error('Expected this subscription to have been cancelled'));
},
);
diff --git a/packages/contract-wrappers/test/subscription_test.ts b/packages/contract-wrappers/test/subscription_test.ts
index 4d638bf9b..b9417ca3d 100644
--- a/packages/contract-wrappers/test/subscription_test.ts
+++ b/packages/contract-wrappers/test/subscription_test.ts
@@ -80,7 +80,7 @@ describe('SubscriptionTest', () => {
});
it('Should allow unsubscribeAll to be called successfully after an error', (done: DoneCallback) => {
(async () => {
- const callback = (err: Error | null, logEvent?: DecodedLogEvent<ApprovalContractEventArgs>) => _.noop;
+ const callback = (_err: Error | null, _logEvent?: DecodedLogEvent<ApprovalContractEventArgs>) => _.noop;
contractWrappers.token.subscribe(tokenAddress, TokenEvents.Approval, indexFilterValues, callback);
stubs = [
Sinon.stub((contractWrappers as any)._web3Wrapper, 'getBlockAsync').throws(
diff --git a/packages/contract-wrappers/test/token_wrapper_test.ts b/packages/contract-wrappers/test/token_wrapper_test.ts
index c9722c7b4..86b93b3f9 100644
--- a/packages/contract-wrappers/test/token_wrapper_test.ts
+++ b/packages/contract-wrappers/test/token_wrapper_test.ts
@@ -484,7 +484,7 @@ describe('TokenWrapper', () => {
it('Outstanding subscriptions are cancelled when contractWrappers.setProvider called', (done: DoneCallback) => {
(async () => {
const callbackNeverToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)(
- (logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
+ (_logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
done(new Error('Expected this subscription to have been cancelled'));
},
);
@@ -508,7 +508,7 @@ describe('TokenWrapper', () => {
it('Should cancel subscription when unsubscribe called', (done: DoneCallback) => {
(async () => {
const callbackNeverToBeCalled = callbackErrorReporter.reportNodeCallbackErrors(done)(
- (logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
+ (_logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
done(new Error('Expected this subscription to have been cancelled'));
},
);
diff --git a/packages/order-watcher/src/order_watcher/order_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts
index 140aa341b..d0acf2e6b 100644
--- a/packages/order-watcher/src/order_watcher/order_watcher.ts
+++ b/packages/order-watcher/src/order_watcher/order_watcher.ts
@@ -19,24 +19,9 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import { artifacts } from '../artifacts';
-import {
- DepositContractEventArgs,
- EtherTokenContractEventArgs,
- EtherTokenEvents,
- WithdrawalContractEventArgs,
-} from '../generated_contract_wrappers/ether_token';
-import {
- ExchangeContractEventArgs,
- ExchangeEvents,
- LogCancelContractEventArgs,
- LogFillContractEventArgs,
-} from '../generated_contract_wrappers/exchange';
-import {
- ApprovalContractEventArgs,
- TokenContractEventArgs,
- TokenEvents,
- TransferContractEventArgs,
-} from '../generated_contract_wrappers/token';
+import { EtherTokenContractEventArgs, EtherTokenEvents } from '../generated_contract_wrappers/ether_token';
+import { ExchangeContractEventArgs, ExchangeEvents } from '../generated_contract_wrappers/exchange';
+import { TokenContractEventArgs, TokenEvents } from '../generated_contract_wrappers/token';
import { OnOrderStateChangeCallback, OrderWatcherConfig, OrderWatcherError } from '../types';
import { assert } from '../utils/assert';
@@ -252,7 +237,7 @@ export class OrderWatcher {
switch (decodedLog.event) {
case TokenEvents.Approval: {
// Invalidate cache
- const args = decodedLog.args as ApprovalContractEventArgs;
+ const args = decodedLog.args;
this._balanceAndProxyAllowanceLazyStore.deleteProxyAllowance(decodedLog.address, args._owner);
// Revalidate orders
makerToken = decodedLog.address;
@@ -268,7 +253,7 @@ export class OrderWatcher {
}
case TokenEvents.Transfer: {
// Invalidate cache
- const args = decodedLog.args as TransferContractEventArgs;
+ const args = decodedLog.args;
this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._from);
this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._to);
// Revalidate orders
@@ -285,7 +270,7 @@ export class OrderWatcher {
}
case EtherTokenEvents.Deposit: {
// Invalidate cache
- const args = decodedLog.args as DepositContractEventArgs;
+ const args = decodedLog.args;
this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._owner);
// Revalidate orders
makerToken = decodedLog.address;
@@ -301,7 +286,7 @@ export class OrderWatcher {
}
case EtherTokenEvents.Withdrawal: {
// Invalidate cache
- const args = decodedLog.args as WithdrawalContractEventArgs;
+ const args = decodedLog.args;
this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._owner);
// Revalidate orders
makerToken = decodedLog.address;
@@ -317,7 +302,7 @@ export class OrderWatcher {
}
case ExchangeEvents.LogFill: {
// Invalidate cache
- const args = decodedLog.args as LogFillContractEventArgs;
+ const args = decodedLog.args;
this._orderFilledCancelledLazyStore.deleteFilledTakerAmount(args.orderHash);
// Revalidate orders
const orderHash = args.orderHash;
@@ -329,7 +314,7 @@ export class OrderWatcher {
}
case ExchangeEvents.LogCancel: {
// Invalidate cache
- const args = decodedLog.args as LogCancelContractEventArgs;
+ const args = decodedLog.args;
this._orderFilledCancelledLazyStore.deleteCancelledTakerAmount(args.orderHash);
// Revalidate orders
const orderHash = args.orderHash;
diff --git a/packages/subproviders/test/unit/eth_lightwallet_subprovider_test.ts b/packages/subproviders/test/unit/eth_lightwallet_subprovider_test.ts
index 51308b6c2..77a1ac58e 100644
--- a/packages/subproviders/test/unit/eth_lightwallet_subprovider_test.ts
+++ b/packages/subproviders/test/unit/eth_lightwallet_subprovider_test.ts
@@ -33,6 +33,9 @@ describe('EthLightwalletSubprovider', () => {
return new Promise<lightwallet.keystore>(resolve => {
// Create Vault
lightwallet.keystore.createVault(vaultOptions, (err: Error, vaultKeystore) => {
+ if (err) {
+ throw new Error(`Failed to createVault: ${err}`);
+ }
resolve(vaultKeystore);
});
});
@@ -41,6 +44,9 @@ describe('EthLightwalletSubprovider', () => {
const deriveKeyFromPasswordAsync = async (vaultKeystore: lightwallet.keystore) => {
return new Promise<Uint8Array>(resolve => {
vaultKeystore.keyFromPassword(PASSWORD, (err: Error, passwordDerivedKey: Uint8Array) => {
+ if (err) {
+ throw new Error(`Failed to get key from password: ${err}`);
+ }
resolve(passwordDerivedKey);
});
});
@@ -154,7 +160,7 @@ describe('EthLightwalletSubprovider', () => {
params: ['0x0000000000000000000000000000000000000000', nonHexMessage],
id: 1,
};
- const callback = reportCallbackErrors(done)((err: Error, response: JSONRPCResponsePayload) => {
+ const callback = reportCallbackErrors(done)((err: Error, _response: JSONRPCResponsePayload) => {
expect(err).to.not.be.a('null');
expect(err.message).to.be.equal('Expected data to be of type HexString, encountered: hello world');
done();
@@ -169,7 +175,7 @@ describe('EthLightwalletSubprovider', () => {
params: [nonHexMessage, '0x0000000000000000000000000000000000000000'],
id: 1,
};
- const callback = reportCallbackErrors(done)((err: Error, response: JSONRPCResponsePayload) => {
+ const callback = reportCallbackErrors(done)((err: Error, _response: JSONRPCResponsePayload) => {
expect(err).to.not.be.a('null');
expect(err.message).to.be.equal('Expected data to be of type HexString, encountered: hello world');
done();