diff options
Diffstat (limited to 'packages/contract-wrappers')
22 files changed, 23 insertions, 35 deletions
diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index d49536b6f..71c2ee780 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -14,8 +14,8 @@ "watch_without_deps": "yarn pre_build && tsc -w", "build": "yarn pre_build && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "pre_build": "run-s generate_contract_wrappers update_test_artifacts update_compact_artifacts", - "generate_contract_wrappers": "abi-gen --abis 'src/compact_artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken|TokenRegistry|DummyToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers", - "lint": "tslint --project .", + "generate_contract_wrappers": "abi-gen --abis 'src/compact_artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken|TokenRegistry|DummyToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'", + "lint": "tslint --project . --exclude **/src/contract_wrappers/**/* --exclude **/lib/**/*", "test:circleci": "run-s test:coverage", "test": "yarn run_mocha", "rebuild_and_test": "run-s build test", diff --git a/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts index f255ced62..e646bae78 100644 --- a/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts @@ -7,7 +7,7 @@ import { LogWithDecodedArgs, RawLog, } from '@0xproject/types'; -import { AbiDecoder, intervalUtils } from '@0xproject/utils'; +import { intervalUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { Block, BlockAndLogStreamer } from 'ethereumjs-blockstream'; import * as _ from 'lodash'; @@ -185,6 +185,7 @@ export class ContractWrapper { this._unsubscribe(filterToken, err); }); } + // tslint:disable-next-line:no-unused-variable private _setNetworkId(networkId: number): void { this._networkId = networkId; } diff --git a/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts index 1bd65270b..713d4d3f6 100644 --- a/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts @@ -1,6 +1,6 @@ import { schemas } from '@0xproject/json-schemas'; import { LogWithDecodedArgs } from '@0xproject/types'; -import { AbiDecoder, BigNumber } from '@0xproject/utils'; +import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; @@ -181,6 +181,7 @@ export class EtherTokenWrapper extends ContractWrapper { : networkSpecificArtifact.address; return contractAddressIfExists; } + // tslint:disable-next-line:no-unused-variable private _invalidateContractInstance(): void { this.unsubscribeAll(); this._etherTokenContractsByAddress = {}; diff --git a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts index fc177dd42..2d5261900 100644 --- a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts @@ -8,12 +8,10 @@ import { LogEntry, LogWithDecodedArgs, Order, - OrderAddresses, OrderState, - OrderValues, SignedOrder, } from '@0xproject/types'; -import { AbiDecoder, BigNumber } from '@0xproject/utils'; +import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; @@ -35,7 +33,6 @@ import { assert } from '../utils/assert'; import { decorators } from '../utils/decorators'; import { ExchangeTransferSimulator } from '../utils/exchange_transfer_simulator'; import { OrderValidationUtils } from '../utils/order_validation_utils'; -import { utils } from '../utils/utils'; import { ContractWrapper } from './contract_wrapper'; import { @@ -888,6 +885,7 @@ export class ExchangeWrapper extends ContractWrapper { const contractAddress = this._getContractAddress(artifacts.ZRX, this._zrxContractAddressIfExists); return contractAddress; } + // tslint:disable:no-unused-variable private _invalidateContractInstances(): void { this.unsubscribeAll(); delete this._exchangeContractIfExists; @@ -919,6 +917,7 @@ export class ExchangeWrapper extends ContractWrapper { const orderHashHex = await exchangeInstance.getOrderHash.callAsync(orderAddresses, orderValues); return orderHashHex; } + // tslint:enable:no-unused-variable private async _getExchangeContractAsync(): Promise<ExchangeContract> { if (!_.isUndefined(this._exchangeContractIfExists)) { return this._exchangeContractIfExists; diff --git a/packages/contract-wrappers/src/contract_wrappers/token_registry_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/token_registry_wrapper.ts index e75973658..fb9396281 100644 --- a/packages/contract-wrappers/src/contract_wrappers/token_registry_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/token_registry_wrapper.ts @@ -108,6 +108,7 @@ export class TokenRegistryWrapper extends ContractWrapper { const contractAddress = this._getContractAddress(artifacts.TokenRegistry, this._contractAddressIfExists); return contractAddress; } + // tslint:disable-next-line:no-unused-variable private _invalidateContractInstance(): void { delete this._tokenRegistryContractIfExists; } diff --git a/packages/contract-wrappers/src/contract_wrappers/token_transfer_proxy_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/token_transfer_proxy_wrapper.ts index 02a2e19d0..2fe3e6620 100644 --- a/packages/contract-wrappers/src/contract_wrappers/token_transfer_proxy_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/token_transfer_proxy_wrapper.ts @@ -49,6 +49,7 @@ export class TokenTransferProxyWrapper extends ContractWrapper { const contractAddress = this._getContractAddress(artifacts.TokenTransferProxy, this._contractAddressIfExists); return contractAddress; } + // tslint:disable-next-line:no-unused-variable private _invalidateContractInstance(): void { delete this._tokenTransferProxyContractIfExists; } diff --git a/packages/contract-wrappers/src/contract_wrappers/token_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/token_wrapper.ts index 844318c79..ba1422b7e 100644 --- a/packages/contract-wrappers/src/contract_wrappers/token_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/token_wrapper.ts @@ -1,6 +1,6 @@ import { schemas } from '@0xproject/json-schemas'; import { LogWithDecodedArgs } from '@0xproject/types'; -import { AbiDecoder, BigNumber } from '@0xproject/utils'; +import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; @@ -414,6 +414,7 @@ export class TokenWrapper extends ContractWrapper { ); return logs; } + // tslint:disable:no-unused-variable private _invalidateContractInstances(): void { this.unsubscribeAll(); this._tokenContractsByAddress = {}; diff --git a/packages/contract-wrappers/src/types.ts b/packages/contract-wrappers/src/types.ts index 384f032c2..0c1c58486 100644 --- a/packages/contract-wrappers/src/types.ts +++ b/packages/contract-wrappers/src/types.ts @@ -2,11 +2,7 @@ import { BigNumber } from '@0xproject/utils'; import { BlockParam, - BlockParamLiteral, - ContractAbi, ContractEventArg, - ExchangeContractErrs, - FilterObject, LogEntryEvent, LogWithDecodedArgs, Order, diff --git a/packages/contract-wrappers/src/utils/assert.ts b/packages/contract-wrappers/src/utils/assert.ts index c74ed341f..bc4114d56 100644 --- a/packages/contract-wrappers/src/utils/assert.ts +++ b/packages/contract-wrappers/src/utils/assert.ts @@ -4,9 +4,7 @@ import { assert as sharedAssert } from '@0xproject/assert'; 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'; -import * as _ from 'lodash'; import { isValidSignature } from '@0xproject/order-utils'; diff --git a/packages/contract-wrappers/src/utils/exchange_transfer_simulator.ts b/packages/contract-wrappers/src/utils/exchange_transfer_simulator.ts index b575285a1..395945fe3 100644 --- a/packages/contract-wrappers/src/utils/exchange_transfer_simulator.ts +++ b/packages/contract-wrappers/src/utils/exchange_transfer_simulator.ts @@ -1,6 +1,5 @@ import { BlockParamLiteral, ExchangeContractErrs } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; -import * as _ from 'lodash'; import { TokenWrapper } from '../contract_wrappers/token_wrapper'; import { BalanceAndProxyAllowanceLazyStore } from '../stores/balance_proxy_allowance_lazy_store'; diff --git a/packages/contract-wrappers/src/utils/filter_utils.ts b/packages/contract-wrappers/src/utils/filter_utils.ts index 4ec9e256b..0dab61c02 100644 --- a/packages/contract-wrappers/src/utils/filter_utils.ts +++ b/packages/contract-wrappers/src/utils/filter_utils.ts @@ -1,11 +1,8 @@ import { - ConstructorAbi, ContractAbi, EventAbi, - FallbackAbi, FilterObject, LogEntry, - MethodAbi, } from '@0xproject/types'; import * as ethUtil from 'ethereumjs-util'; import * as jsSHA3 from 'js-sha3'; diff --git a/packages/contract-wrappers/src/utils/order_validation_utils.ts b/packages/contract-wrappers/src/utils/order_validation_utils.ts index 362c605de..b6b3334a6 100644 --- a/packages/contract-wrappers/src/utils/order_validation_utils.ts +++ b/packages/contract-wrappers/src/utils/order_validation_utils.ts @@ -4,7 +4,7 @@ import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper'; -import { ContractWrappersError, TradeSide, TransferType } from '../types'; +import { TradeSide, TransferType } from '../types'; import { constants } from '../utils/constants'; import { utils } from '../utils/utils'; diff --git a/packages/contract-wrappers/test/artifacts_test.ts b/packages/contract-wrappers/test/artifacts_test.ts index eaaa89c48..34e6bbde8 100644 --- a/packages/contract-wrappers/test/artifacts_test.ts +++ b/packages/contract-wrappers/test/artifacts_test.ts @@ -1,5 +1,4 @@ import { web3Factory } from '@0xproject/dev-utils'; -import * as fs from 'fs'; import 'make-promises-safe'; import { ContractWrappers } from '../src'; diff --git a/packages/contract-wrappers/test/ether_token_wrapper_test.ts b/packages/contract-wrappers/test/ether_token_wrapper_test.ts index a2154c2bd..d08f26c53 100644 --- a/packages/contract-wrappers/test/ether_token_wrapper_test.ts +++ b/packages/contract-wrappers/test/ether_token_wrapper_test.ts @@ -1,4 +1,4 @@ -import { BlockchainLifecycle, callbackErrorReporter, devConstants, web3Factory } from '@0xproject/dev-utils'; +import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils'; import { DoneCallback } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; diff --git a/packages/contract-wrappers/test/exchange_transfer_simulator_test.ts b/packages/contract-wrappers/test/exchange_transfer_simulator_test.ts index cf7520ea0..8bbe04d6c 100644 --- a/packages/contract-wrappers/test/exchange_transfer_simulator_test.ts +++ b/packages/contract-wrappers/test/exchange_transfer_simulator_test.ts @@ -1,4 +1,4 @@ -import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils'; +import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { BlockParamLiteral, Token } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; diff --git a/packages/contract-wrappers/test/exchange_wrapper_test.ts b/packages/contract-wrappers/test/exchange_wrapper_test.ts index d35d2b819..a418f5f22 100644 --- a/packages/contract-wrappers/test/exchange_wrapper_test.ts +++ b/packages/contract-wrappers/test/exchange_wrapper_test.ts @@ -1,11 +1,10 @@ -import { BlockchainLifecycle, callbackErrorReporter, devConstants, web3Factory } from '@0xproject/dev-utils'; +import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils'; import { FillScenarios } from '@0xproject/fill-scenarios'; import { getOrderHashHex } from '@0xproject/order-utils'; import { BlockParamLiteral, DoneCallback, OrderState } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; -import * as _ from 'lodash'; import 'make-promises-safe'; import 'mocha'; diff --git a/packages/contract-wrappers/test/global_hooks.ts b/packages/contract-wrappers/test/global_hooks.ts index 6d2c3219b..9d6903af5 100644 --- a/packages/contract-wrappers/test/global_hooks.ts +++ b/packages/contract-wrappers/test/global_hooks.ts @@ -1,8 +1,6 @@ import { devConstants } from '@0xproject/dev-utils'; import { runV1MigrationsAsync } from '@0xproject/migrations'; -import * as path from 'path'; -import { constants } from './utils/constants'; import { provider } from './utils/web3_wrapper'; before('migrate contracts', async function(): Promise<void> { diff --git a/packages/contract-wrappers/test/order_validation_test.ts b/packages/contract-wrappers/test/order_validation_test.ts index a14dc24b6..a42a6a368 100644 --- a/packages/contract-wrappers/test/order_validation_test.ts +++ b/packages/contract-wrappers/test/order_validation_test.ts @@ -1,4 +1,4 @@ -import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils'; +import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { FillScenarios } from '@0xproject/fill-scenarios'; import { OrderError } from '@0xproject/order-utils'; import { BlockParamLiteral } from '@0xproject/types'; @@ -7,7 +7,7 @@ import * as chai from 'chai'; import 'make-promises-safe'; import * as Sinon from 'sinon'; -import { ContractWrappers, ContractWrappersError, ExchangeContractErrs, SignedOrder, Token } from '../src'; +import { ContractWrappers, ExchangeContractErrs, SignedOrder, Token } from '../src'; import { TradeSide, TransferType } from '../src/types'; import { ExchangeTransferSimulator } from '../src/utils/exchange_transfer_simulator'; import { OrderValidationUtils } from '../src/utils/order_validation_utils'; diff --git a/packages/contract-wrappers/test/subscription_test.ts b/packages/contract-wrappers/test/subscription_test.ts index 65c76e47f..3232fd03c 100644 --- a/packages/contract-wrappers/test/subscription_test.ts +++ b/packages/contract-wrappers/test/subscription_test.ts @@ -1,4 +1,4 @@ -import { BlockchainLifecycle, callbackErrorReporter, devConstants } from '@0xproject/dev-utils'; +import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils'; import { DoneCallback } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; diff --git a/packages/contract-wrappers/test/token_registry_wrapper_test.ts b/packages/contract-wrappers/test/token_registry_wrapper_test.ts index 0e9ddd245..e2881d022 100644 --- a/packages/contract-wrappers/test/token_registry_wrapper_test.ts +++ b/packages/contract-wrappers/test/token_registry_wrapper_test.ts @@ -1,4 +1,4 @@ -import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils'; +import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { schemas, SchemaValidator } from '@0xproject/json-schemas'; import * as chai from 'chai'; import * as _ from 'lodash'; diff --git a/packages/contract-wrappers/test/token_wrapper_test.ts b/packages/contract-wrappers/test/token_wrapper_test.ts index 12bf72d85..6cb1869fc 100644 --- a/packages/contract-wrappers/test/token_wrapper_test.ts +++ b/packages/contract-wrappers/test/token_wrapper_test.ts @@ -1,4 +1,4 @@ -import { BlockchainLifecycle, callbackErrorReporter, devConstants } from '@0xproject/dev-utils'; +import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils'; import { EmptyWalletSubprovider } from '@0xproject/subproviders'; import { DoneCallback, Provider } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; @@ -218,7 +218,6 @@ describe('TokenWrapper', () => { describe('With provider without accounts', () => { let zeroExContractWithoutAccounts: ContractWrappers; before(async () => { - const hasAddresses = false; const emptyWalletProvider = addEmptyWalletSubprovider(provider); zeroExContractWithoutAccounts = new ContractWrappers(emptyWalletProvider, config); }); @@ -361,7 +360,6 @@ describe('TokenWrapper', () => { describe('With provider without accounts', () => { let zeroExContractWithoutAccounts: ContractWrappers; before(async () => { - const hasAddresses = false; const emptyWalletProvider = addEmptyWalletSubprovider(provider); zeroExContractWithoutAccounts = new ContractWrappers(emptyWalletProvider, config); }); diff --git a/packages/contract-wrappers/test/utils/web3_wrapper.ts b/packages/contract-wrappers/test/utils/web3_wrapper.ts index 71a0dc1c2..f7d11f138 100644 --- a/packages/contract-wrappers/test/utils/web3_wrapper.ts +++ b/packages/contract-wrappers/test/utils/web3_wrapper.ts @@ -1,4 +1,4 @@ -import { devConstants, web3Factory } from '@0xproject/dev-utils'; +import { web3Factory } from '@0xproject/dev-utils'; import { Provider } from '@0xproject/types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; |