Get build and tests to pass

This commit is contained in:
fragosti 2018-06-06 15:26:40 -07:00
parent 6a2da6dc06
commit a97d77064a
33 changed files with 1440 additions and 1524 deletions

View File

@ -6,7 +6,7 @@ import * as _ from 'lodash';
import 'make-promises-safe';
import 'mocha';
import { TokenEvents, ZeroEx } from '../src';
import { ApprovalContractEventArgs, LogWithDecodedArgs, Order, TokenEvents, ZeroEx } from '../src';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';

View File

@ -414,7 +414,7 @@ export class TokenWrapper extends ContractWrapper {
);
return logs;
}
// tslint:disable:no-unused-variable
// tslint:disable-next-line:no-unused-variable
private _invalidateContractInstances(): void {
this.unsubscribeAll();
this._tokenContractsByAddress = {};

View File

@ -1,10 +1,11 @@
import { assert as sharedAssert } from '@0xproject/assert';
// We need those two unused imports because they're actually used by sharedAssert which gets injected here
// tslint:disable-next-line:no-unused-variable
// tslint:disable:no-unused-variable
import { Schema } from '@0xproject/json-schemas';
// tslint:disable-next-line:no-unused-variable
import { ECSignature } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
// tslint:enable:no-unused-variable
import { isValidSignature } from '@0xproject/order-utils';

View File

@ -1,9 +1,14 @@
// tslint:disable:no-unused-variable
import {
ConstructorAbi,
ContractAbi,
EventAbi,
FallbackAbi,
FilterObject,
LogEntry,
MethodAbi,
} from '@0xproject/types';
// tslint:enable:no-unused-variable
import * as ethUtil from 'ethereumjs-util';
import * as jsSHA3 from 'js-sha3';
import * as _ from 'lodash';

View File

@ -3,14 +3,15 @@
* Templates can be found at https://github.com/0xProject/0x-monorepo/tree/development/packages/contract_templates.
*/
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace
// tslint:disable-next-line:no-unused-variable
// tslint:disable:no-unused-variable
import { BaseContract } from '@0xproject/base-contract';
import { ContractArtifact } from '@0xproject/sol-compiler';
import { BlockParam, CallData, ContractAbi, DecodedLogArgs, MethodAbi, Provider, TxData } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0xproject/utils';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, DataItem, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils, promisify } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
{{#if events}}
export type {{contractName}}ContractEventArgs =

View File

@ -39,7 +39,8 @@ export class LogDecoder {
}
public decodeLogOrThrow<ArgsType extends DecodedLogArgs>(log: LogEntry): LogWithDecodedArgs<ArgsType> | RawLog {
const logWithDecodedArgsOrLog = this._abiDecoder.tryToDecodeLogOrNoop(log);
if (_.isUndefined((logWithDecodedArgsOrLog).args)) {
// tslint:disable-next-line:no-unnecessary-type-assertion
if (_.isUndefined((logWithDecodedArgsOrLog as LogWithDecodedArgs<ArgsType>).args)) {
throw new Error(`Unable to decode log: ${JSON.stringify(log)}`);
}
LogDecoder.wrapLogBigNumbers(logWithDecodedArgsOrLog);

View File

@ -668,5 +668,11 @@
}
}
},
"networks": {}
"networks": {
"50": {
"address": "0x48bacb9266a570d521063ef5dd96e61686dbe788",
"links": {},
"constructorArgs": "[\"0x1d7022f5b17d2f8b695918fb48fa1089c9f85401\",\"0x1dc4c1cefef38a777b15aa20260a54e584b16c48\"]"
}
}
}

View File

@ -715,5 +715,11 @@
}
}
},
"networks": {}
"networks": {
"50": {
"address": "0x34d402f14d58e001d8efbe6585051bf9706aa064",
"links": {},
"constructorArgs": "[[\"0x5409ed021d9299bf6814279a6a1411a7e866a631\",\"0x6ecbe1db9ef729cbe972c83fb886247691fb6beb\"],\"2\",\"0\",\"0x1dc4c1cefef38a777b15aa20260a54e584b16c48\"]"
}
}
}

View File

@ -590,5 +590,11 @@
}
}
},
"networks": {}
"networks": {
"50": {
"address": "0x0b1ba0af832d7c05fd64161e0db78e85978e8082",
"links": {},
"constructorArgs": "[]"
}
}
}

View File

@ -226,5 +226,11 @@
}
}
},
"networks": {}
"networks": {
"50": {
"address": "0x1dc4c1cefef38a777b15aa20260a54e584b16c48",
"links": {},
"constructorArgs": "[]"
}
}
}

View File

@ -322,5 +322,11 @@
}
}
},
"networks": {}
"networks": {
"50": {
"address": "0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c",
"links": {},
"constructorArgs": "[]"
}
}
}

View File

@ -278,5 +278,11 @@
}
}
},
"networks": {}
"networks": {
"50": {
"address": "0x1d7022f5b17d2f8b695918fb48fa1089c9f85401",
"links": {},
"constructorArgs": "[]"
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,11 @@
import { assert as sharedAssert } from '@0xproject/assert';
// We need those two unused imports because they're actually used by sharedAssert which gets injected here
// tslint:disable-next-line:no-unused-variable
// tslint:disable:no-unused-variable
import { Schema } from '@0xproject/json-schemas';
// tslint:disable-next-line:no-unused-variable
import { ECSignature, SignatureType } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
// tslint:enable:no-unused-variable
import * as _ from 'lodash';
import { utils } from './utils';

View File

@ -1,9 +1,10 @@
import { assert as sharedAssert } from '@0xproject/assert';
// We need those two unused imports because they're actually used by sharedAssert which gets injected here
// tslint:disable-next-line:no-unused-variable
// tslint:disable:no-unused-variable
import { Schema } from '@0xproject/json-schemas';
// tslint:disable-next-line:no-unused-variable
import { ECSignature } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
// tslint:enable:no-unused-variable
import { isValidSignature } from '@0xproject/order-utils';

View File

@ -1,8 +1,9 @@
// tslint:disable:no-unnecessary-type-assertion
import { ContractWrappers } from '@0xproject/contract-wrappers';
import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils';
import { FillScenarios } from '@0xproject/fill-scenarios';
import { getOrderHashHex } from '@0xproject/order-utils';
import { DoneCallback, ExchangeContractErrs, OrderState, SignedOrder, Token } from '@0xproject/types';
import { DoneCallback, ExchangeContractErrs, OrderState, OrderStateInvalid, SignedOrder, Token, OrderStateValid } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as chai from 'chai';
@ -132,7 +133,7 @@ describe('OrderWatcher', () => {
orderWatcher.addOrder(signedOrder);
const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.false();
const invalidOrderState = orderState;
const invalidOrderState = orderState as OrderStateInvalid;
expect(invalidOrderState.orderHash).to.be.equal(orderHash);
expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.InsufficientMakerAllowance);
});
@ -181,7 +182,7 @@ describe('OrderWatcher', () => {
orderWatcher.addOrder(signedOrder);
const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.false();
const invalidOrderState = orderState;
const invalidOrderState = orderState as OrderStateInvalid;
expect(invalidOrderState.orderHash).to.be.equal(orderHash);
expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.InsufficientMakerBalance);
});
@ -205,7 +206,7 @@ describe('OrderWatcher', () => {
const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.false();
const invalidOrderState = orderState;
const invalidOrderState = orderState as OrderStateInvalid;
expect(invalidOrderState.orderHash).to.be.equal(orderHash);
expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.OrderRemainingFillAmountZero);
});
@ -237,7 +238,7 @@ describe('OrderWatcher', () => {
const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.true();
const validOrderState = orderState;
const validOrderState = orderState as OrderStateValid;
expect(validOrderState.orderHash).to.be.equal(orderHash);
const orderRelevantState = validOrderState.orderRelevantState;
const remainingMakerBalance = makerBalance.sub(fillAmountInBaseUnits);
@ -298,7 +299,7 @@ describe('OrderWatcher', () => {
orderWatcher.addOrder(signedOrder);
const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.true();
const validOrderState = orderState;
const validOrderState = orderState as OrderStateValid;
expect(validOrderState.orderHash).to.be.equal(orderHash);
const orderRelevantState = validOrderState.orderRelevantState;
expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal(
@ -332,7 +333,7 @@ describe('OrderWatcher', () => {
orderWatcher.addOrder(signedOrder);
const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
const validOrderState = orderState;
const validOrderState = orderState as OrderStateValid;
const orderRelevantState = validOrderState.orderRelevantState;
expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal(
changedMakerApprovalAmount,
@ -367,7 +368,7 @@ describe('OrderWatcher', () => {
const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.true();
const validOrderState = orderState;
const validOrderState = orderState as OrderStateValid;
const orderRelevantState = validOrderState.orderRelevantState;
expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal(
remainingAmount,
@ -407,7 +408,7 @@ describe('OrderWatcher', () => {
const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.true();
const validOrderState = orderState;
const validOrderState = orderState as OrderStateValid;
const orderRelevantState = validOrderState.orderRelevantState;
expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal(
remainingTokenAmount,
@ -440,7 +441,7 @@ describe('OrderWatcher', () => {
orderWatcher.addOrder(signedOrder);
const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
const validOrderState = orderState;
const validOrderState = orderState as OrderStateValid;
const orderRelevantState = validOrderState.orderRelevantState;
expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal(
remainingFeeAmount,
@ -475,7 +476,7 @@ describe('OrderWatcher', () => {
orderWatcher.addOrder(signedOrder);
const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
const validOrderState = orderState;
const validOrderState = orderState as OrderStateValid;
const orderRelevantState = validOrderState.orderRelevantState;
expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal(
fillableAmount,
@ -504,7 +505,7 @@ describe('OrderWatcher', () => {
const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.false();
const invalidOrderState = orderState;
const invalidOrderState = orderState as OrderStateInvalid;
expect(invalidOrderState.orderHash).to.be.equal(orderHash);
expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.OrderRemainingFillAmountZero);
});
@ -528,7 +529,7 @@ describe('OrderWatcher', () => {
const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.false();
const invalidOrderState = orderState;
const invalidOrderState = orderState as OrderStateInvalid;
expect(invalidOrderState.orderHash).to.be.equal(orderHash);
expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.OrderFillRoundingError);
});
@ -555,7 +556,7 @@ describe('OrderWatcher', () => {
const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.true();
const validOrderState = orderState;
const validOrderState = orderState as OrderStateValid;
expect(validOrderState.orderHash).to.be.equal(orderHash);
const orderRelevantState = validOrderState.orderRelevantState;
expect(orderRelevantState.cancelledTakerTokenAmount).to.be.bignumber.equal(cancelAmountInBaseUnits);

View File

@ -9,7 +9,7 @@ import { TopBar } from 'ts/components/top_bar/top_bar';
import { CallToAction } from 'ts/components/ui/button';
import { Container } from 'ts/components/ui/container';
import { Dispatcher } from 'ts/redux/dispatcher';
import { Deco, Key, ScreenWidths, WebsitePaths } from 'ts/types';
import { Deco, Key, Language, ScreenWidths, WebsitePaths } from 'ts/types';
import { constants } from 'ts/utils/constants';
import { Translate } from 'ts/utils/translate';
import { utils } from 'ts/utils/utils';