Fix Tslint issues
This commit is contained in:
parent
7ce1e9b18d
commit
87d66ccf6c
@ -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;
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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'));
|
||||
},
|
||||
);
|
||||
|
@ -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'));
|
||||
},
|
||||
);
|
||||
|
@ -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(
|
||||
|
@ -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'));
|
||||
},
|
||||
);
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user