From 064608a8ef5c332e09fefaadd3b4c1155d4853c9 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Wed, 30 May 2018 11:10:30 -0700 Subject: Add awaitTransactionSuccess where needed --- .../contracts/src/utils/token_registry_wrapper.ts | 8 ++- packages/contracts/test/asset_proxy_owner.ts | 10 +++- packages/contracts/test/ether_token.ts | 5 +- .../contracts/test/unlimited_allowance_token.ts | 58 +++++++++++++++------- 4 files changed, 59 insertions(+), 22 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/src/utils/token_registry_wrapper.ts b/packages/contracts/src/utils/token_registry_wrapper.ts index 86daeca62..99f17050a 100644 --- a/packages/contracts/src/utils/token_registry_wrapper.ts +++ b/packages/contracts/src/utils/token_registry_wrapper.ts @@ -4,13 +4,16 @@ import { TokenRegistryContract } from '../contract_wrappers/generated/token_regi import { Token } from './types'; +import { constants } from './constants'; +import { web3Wrapper } from './web3_wrapper'; + export class TokenRegWrapper { private _tokenReg: TokenRegistryContract; constructor(tokenRegContract: TokenRegistryContract) { this._tokenReg = tokenRegContract; } public async addTokenAsync(token: Token, from: string): Promise { - const tx = this._tokenReg.addToken.sendTransactionAsync( + const txHash = await this._tokenReg.addToken.sendTransactionAsync( token.address as string, token.name, token.symbol, @@ -19,7 +22,8 @@ export class TokenRegWrapper { token.swarmHash, { from }, ); - return tx; + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); + return txHash; } public async getTokenMetaDataAsync(tokenAddress: string): Promise { const data = await this._tokenReg.getTokenMetaData.callAsync(tokenAddress); diff --git a/packages/contracts/test/asset_proxy_owner.ts b/packages/contracts/test/asset_proxy_owner.ts index db68b5678..420cd9934 100644 --- a/packages/contracts/test/asset_proxy_owner.ts +++ b/packages/contracts/test/asset_proxy_owner.ts @@ -60,8 +60,14 @@ describe('AssetProxyOwner', () => { SECONDS_TIME_LOCKED, ); multiSigWrapper = new MultiSigWrapper(multiSig, provider); - await erc20Proxy.transferOwnership.sendTransactionAsync(multiSig.address, { from: initialOwner }); - await erc721Proxy.transferOwnership.sendTransactionAsync(multiSig.address, { from: initialOwner }); + await web3Wrapper.awaitTransactionSuccessAsync( + await erc20Proxy.transferOwnership.sendTransactionAsync(multiSig.address, { from: initialOwner }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); + await web3Wrapper.awaitTransactionSuccessAsync( + await erc721Proxy.transferOwnership.sendTransactionAsync(multiSig.address, { from: initialOwner }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); }); beforeEach(async () => { await blockchainLifecycle.startAsync(); diff --git a/packages/contracts/test/ether_token.ts b/packages/contracts/test/ether_token.ts index 10dd635fe..4e52b658f 100644 --- a/packages/contracts/test/ether_token.ts +++ b/packages/contracts/test/ether_token.ts @@ -83,7 +83,10 @@ describe('EtherToken', () => { it('should convert ether tokens to ether with sufficient balance', async () => { const ethToDeposit = new BigNumber(Web3Wrapper.toWei(new BigNumber(1))); - await etherToken.deposit.sendTransactionAsync({ value: ethToDeposit }); + await web3Wrapper.awaitTransactionSuccessAsync( + await etherToken.deposit.sendTransactionAsync({ value: ethToDeposit }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); const initEthTokenBalance = await etherToken.balanceOf.callAsync(account); const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account); const ethTokensToWithdraw = initEthTokenBalance; diff --git a/packages/contracts/test/unlimited_allowance_token.ts b/packages/contracts/test/unlimited_allowance_token.ts index c68d8bdcf..b2acdebaa 100644 --- a/packages/contracts/test/unlimited_allowance_token.ts +++ b/packages/contracts/test/unlimited_allowance_token.ts @@ -64,7 +64,10 @@ describe('UnlimitedAllowanceToken', () => { const receiver = spender; const initOwnerBalance = await token.balanceOf.callAsync(owner); const amountToTransfer = new BigNumber(1); - await token.transfer.sendTransactionAsync(receiver, amountToTransfer, { from: owner }); + await web3Wrapper.awaitTransactionSuccessAsync( + await token.transfer.sendTransactionAsync(receiver, amountToTransfer, { from: owner }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); const finalOwnerBalance = await token.balanceOf.callAsync(owner); const finalReceiverBalance = await token.balanceOf.callAsync(receiver); @@ -86,7 +89,10 @@ describe('UnlimitedAllowanceToken', () => { it('should throw if owner has insufficient balance', async () => { const ownerBalance = await token.balanceOf.callAsync(owner); const amountToTransfer = ownerBalance.plus(1); - await token.approve.sendTransactionAsync(spender, amountToTransfer, { from: owner }); + await web3Wrapper.awaitTransactionSuccessAsync( + await token.approve.sendTransactionAsync(spender, amountToTransfer, { from: owner }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); return expect( token.transferFrom.callAsync(owner, spender, amountToTransfer, { from: spender, @@ -121,11 +127,17 @@ describe('UnlimitedAllowanceToken', () => { const initOwnerBalance = await token.balanceOf.callAsync(owner); const amountToTransfer = initOwnerBalance; const initSpenderAllowance = constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS; - await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner }); - await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, { - from: spender, - gas: constants.MAX_TOKEN_TRANSFERFROM_GAS, - }); + await web3Wrapper.awaitTransactionSuccessAsync( + await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); + await web3Wrapper.awaitTransactionSuccessAsync( + await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, { + from: spender, + gas: constants.MAX_TOKEN_TRANSFERFROM_GAS, + }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); const newSpenderAllowance = await token.allowance.callAsync(owner, spender); expect(initSpenderAllowance).to.be.bignumber.equal(newSpenderAllowance); @@ -135,11 +147,17 @@ describe('UnlimitedAllowanceToken', () => { const initOwnerBalance = await token.balanceOf.callAsync(owner); const amountToTransfer = initOwnerBalance; const initSpenderAllowance = initOwnerBalance; - await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner }); - await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, { - from: spender, - gas: constants.MAX_TOKEN_TRANSFERFROM_GAS, - }); + await web3Wrapper.awaitTransactionSuccessAsync( + await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); + await web3Wrapper.awaitTransactionSuccessAsync( + await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, { + from: spender, + gas: constants.MAX_TOKEN_TRANSFERFROM_GAS, + }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); const newOwnerBalance = await token.balanceOf.callAsync(owner); const newSpenderBalance = await token.balanceOf.callAsync(spender); @@ -152,11 +170,17 @@ describe('UnlimitedAllowanceToken', () => { const initOwnerBalance = await token.balanceOf.callAsync(owner); const amountToTransfer = initOwnerBalance; const initSpenderAllowance = initOwnerBalance; - await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner }); - await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, { - from: spender, - gas: constants.MAX_TOKEN_TRANSFERFROM_GAS, - }); + await web3Wrapper.awaitTransactionSuccessAsync( + await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); + await web3Wrapper.awaitTransactionSuccessAsync( + await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, { + from: spender, + gas: constants.MAX_TOKEN_TRANSFERFROM_GAS, + }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); const newSpenderAllowance = await token.allowance.callAsync(owner, spender); expect(newSpenderAllowance).to.be.bignumber.equal(0); -- cgit From a6d669453f9af7993bdd132862fa5d2da18a62f7 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Wed, 30 May 2018 17:54:12 -0700 Subject: Pass in a provider and instantiate a new web3Wrapper in token_registry_wrapper --- packages/contracts/src/utils/token_registry_wrapper.ts | 10 ++++++---- packages/contracts/test/token_registry.ts | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/src/utils/token_registry_wrapper.ts b/packages/contracts/src/utils/token_registry_wrapper.ts index 99f17050a..6e3abb26b 100644 --- a/packages/contracts/src/utils/token_registry_wrapper.ts +++ b/packages/contracts/src/utils/token_registry_wrapper.ts @@ -1,16 +1,18 @@ -import * as Web3 from 'web3'; +import { Provider } from '@0xproject/types'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { TokenRegistryContract } from '../contract_wrappers/generated/token_registry'; import { Token } from './types'; import { constants } from './constants'; -import { web3Wrapper } from './web3_wrapper'; export class TokenRegWrapper { private _tokenReg: TokenRegistryContract; - constructor(tokenRegContract: TokenRegistryContract) { + private _web3Wrapper: Web3Wrapper; + constructor(tokenRegContract: TokenRegistryContract, provider: Provider) { this._tokenReg = tokenRegContract; + this._web3Wrapper = new Web3Wrapper(provider); } public async addTokenAsync(token: Token, from: string): Promise { const txHash = await this._tokenReg.addToken.sendTransactionAsync( @@ -22,7 +24,7 @@ export class TokenRegWrapper { token.swarmHash, { from }, ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); + await this._web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); return txHash; } public async getTokenMetaDataAsync(tokenAddress: string): Promise { diff --git a/packages/contracts/test/token_registry.ts b/packages/contracts/test/token_registry.ts index 1cc519c53..9faa67e20 100644 --- a/packages/contracts/test/token_registry.ts +++ b/packages/contracts/test/token_registry.ts @@ -34,7 +34,7 @@ describe('TokenRegistry', () => { owner = accounts[0]; notOwner = accounts[1]; tokenReg = await TokenRegistryContract.deployFrom0xArtifactAsync(artifacts.TokenRegistry, provider, txDefaults); - tokenRegWrapper = new TokenRegWrapper(tokenReg); + tokenRegWrapper = new TokenRegWrapper(tokenReg, provider); }); beforeEach(async () => { await blockchainLifecycle.startAsync(); -- cgit From 224a6c192bcba61bd0796cd73a9c88dd1ade2980 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Thu, 31 May 2018 10:19:10 -0700 Subject: Fix build --- packages/contracts/test/exchange/transactions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/contracts') diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts index 6b3083ae5..fc7aa8404 100644 --- a/packages/contracts/test/exchange/transactions.ts +++ b/packages/contracts/test/exchange/transactions.ts @@ -221,7 +221,7 @@ describe('Exchange transactions', () => { ); const isApproved = true; await web3Wrapper.awaitTransactionSuccessAsync( - await exchange.approveSignatureValidator.sendTransactionAsync(whitelist.address, isApproved, { + await exchange.setSignatureValidatorApproval.sendTransactionAsync(whitelist.address, isApproved, { from: takerAddress, }), ); -- cgit From 1a3958ed602a2abd55a41289fddd2ee1d930d159 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 30 May 2018 11:35:22 -0700 Subject: Remove some types --- packages/contracts/package.json | 2 ++ 1 file changed, 2 insertions(+) (limited to 'packages/contracts') diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 7bd0cf571..d7fd9b056 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -48,7 +48,9 @@ "@0xproject/subproviders": "^0.10.1", "@0xproject/sol-cov": "^0.0.11", "@types/lodash": "4.14.104", + "@types/bn.js": "^4.11.0", "@types/node": "^8.0.53", + "@types/ethereumjs-abi": "^0.6.0", "@types/yargs": "^10.0.0", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", -- cgit From a7fc9caacb7b98c7d79333e60ee9862945a67ecc Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 30 May 2018 14:41:36 -0700 Subject: Introduce ethereum-types package --- packages/contracts/package.json | 1 + packages/contracts/src/utils/erc20_wrapper.ts | 2 +- packages/contracts/src/utils/erc721_wrapper.ts | 2 +- packages/contracts/src/utils/exchange_wrapper.ts | 3 ++- packages/contracts/src/utils/log_decoder.ts | 8 +------- packages/contracts/src/utils/match_order_tester.ts | 3 ++- packages/contracts/src/utils/multi_sig_wrapper.ts | 2 +- packages/contracts/src/utils/types.ts | 3 ++- packages/contracts/src/utils/web3_wrapper.ts | 2 +- packages/contracts/test/asset_proxy_owner.ts | 2 +- packages/contracts/test/exchange/core.ts | 3 ++- packages/contracts/test/exchange/match_orders.ts | 3 ++- packages/contracts/test/libraries/lib_bytes.ts | 2 +- packages/contracts/test/multi_sig_with_time_lock.ts | 2 +- packages/contracts/test/tutorials/arbitrage.ts | 2 +- 15 files changed, 20 insertions(+), 20 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/package.json b/packages/contracts/package.json index d7fd9b056..300a5331a 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -75,6 +75,7 @@ "@0xproject/typescript-typings": "^0.3.2", "@0xproject/utils": "^0.6.2", "@0xproject/web3-wrapper": "^0.6.4", + "ethereum-types": "^0.0.1", "bn.js": "^4.11.8", "ethereumjs-abi": "^0.6.4", "ethereumjs-util": "^5.1.1", diff --git a/packages/contracts/src/utils/erc20_wrapper.ts b/packages/contracts/src/utils/erc20_wrapper.ts index 92cf01cc2..733021368 100644 --- a/packages/contracts/src/utils/erc20_wrapper.ts +++ b/packages/contracts/src/utils/erc20_wrapper.ts @@ -1,4 +1,4 @@ -import { Provider } from '@0xproject/types'; +import { Provider } from 'ethereum-types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; diff --git a/packages/contracts/src/utils/erc721_wrapper.ts b/packages/contracts/src/utils/erc721_wrapper.ts index bea801f3d..4e27b24ad 100644 --- a/packages/contracts/src/utils/erc721_wrapper.ts +++ b/packages/contracts/src/utils/erc721_wrapper.ts @@ -1,5 +1,5 @@ import { generatePseudoRandomSalt } from '@0xproject/order-utils'; -import { Provider } from '@0xproject/types'; +import { Provider } from 'ethereum-types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts index ca587f220..14d183b09 100644 --- a/packages/contracts/src/utils/exchange_wrapper.ts +++ b/packages/contracts/src/utils/exchange_wrapper.ts @@ -1,6 +1,7 @@ -import { Provider, SignedOrder, TransactionReceiptWithDecodedLogs } from '@0xproject/types'; +import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { LogEntry, Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import * as _ from 'lodash'; import { ExchangeContract } from '../contract_wrappers/generated/exchange'; diff --git a/packages/contracts/src/utils/log_decoder.ts b/packages/contracts/src/utils/log_decoder.ts index 32819b657..2839cfe84 100644 --- a/packages/contracts/src/utils/log_decoder.ts +++ b/packages/contracts/src/utils/log_decoder.ts @@ -1,13 +1,7 @@ import { ContractArtifact } from '@0xproject/sol-compiler'; -import { - AbiDefinition, - LogEntry, - LogWithDecodedArgs, - RawLog, - TransactionReceiptWithDecodedLogs, -} from '@0xproject/types'; import { AbiDecoder, BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { AbiDefinition, LogEntry, LogWithDecodedArgs, RawLog, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import * as _ from 'lodash'; import { artifacts } from './artifacts'; diff --git a/packages/contracts/src/utils/match_order_tester.ts b/packages/contracts/src/utils/match_order_tester.ts index 87399b9f6..ec8931a20 100644 --- a/packages/contracts/src/utils/match_order_tester.ts +++ b/packages/contracts/src/utils/match_order_tester.ts @@ -1,7 +1,8 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { LogWithDecodedArgs, SignedOrder } from '@0xproject/types'; +import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; +import { LogWithDecodedArgs } from 'ethereum-types'; import ethUtil = require('ethereumjs-util'); import * as _ from 'lodash'; diff --git a/packages/contracts/src/utils/multi_sig_wrapper.ts b/packages/contracts/src/utils/multi_sig_wrapper.ts index d67692194..9971e8f6e 100644 --- a/packages/contracts/src/utils/multi_sig_wrapper.ts +++ b/packages/contracts/src/utils/multi_sig_wrapper.ts @@ -1,6 +1,6 @@ -import { Provider, TransactionReceiptWithDecodedLogs } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import * as _ from 'lodash'; import { AssetProxyOwnerContract } from '../contract_wrappers/generated/asset_proxy_owner'; diff --git a/packages/contracts/src/utils/types.ts b/packages/contracts/src/utils/types.ts index 1eeffc70e..d68a81b51 100644 --- a/packages/contracts/src/utils/types.ts +++ b/packages/contracts/src/utils/types.ts @@ -1,5 +1,6 @@ -import { AbiDefinition, ContractAbi, Order } from '@0xproject/types'; +import { Order } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; +import { AbiDefinition, ContractAbi } from 'ethereum-types'; export interface ERC20BalancesByOwner { [ownerAddress: string]: { diff --git a/packages/contracts/src/utils/web3_wrapper.ts b/packages/contracts/src/utils/web3_wrapper.ts index 4b8512222..2dd0dd1a3 100644 --- a/packages/contracts/src/utils/web3_wrapper.ts +++ b/packages/contracts/src/utils/web3_wrapper.ts @@ -1,6 +1,6 @@ import { devConstants, env, EnvVars, web3Factory } from '@0xproject/dev-utils'; import { prependSubprovider } from '@0xproject/subproviders'; -import { Provider } from '@0xproject/types'; +import { Provider } from 'ethereum-types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { coverage } from './coverage'; diff --git a/packages/contracts/test/asset_proxy_owner.ts b/packages/contracts/test/asset_proxy_owner.ts index f95679e20..b0a78c601 100644 --- a/packages/contracts/test/asset_proxy_owner.ts +++ b/packages/contracts/test/asset_proxy_owner.ts @@ -1,5 +1,5 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { LogWithDecodedArgs } from '@0xproject/types'; +import { LogWithDecodedArgs } from 'ethereum-types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import * as _ from 'lodash'; diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index bc476a5ee..6282a51ea 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -1,8 +1,9 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { LogWithDecodedArgs, SignedOrder } from '@0xproject/types'; +import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; +import { LogWithDecodedArgs } from 'ethereum-types'; import ethUtil = require('ethereumjs-util'); import 'make-promises-safe'; diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts index 0da0287bc..c901c29b9 100644 --- a/packages/contracts/test/exchange/match_orders.ts +++ b/packages/contracts/test/exchange/match_orders.ts @@ -1,8 +1,9 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { LogWithDecodedArgs, SignedOrder } from '@0xproject/types'; +import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; +import { LogWithDecodedArgs } from 'ethereum-types'; import ethUtil = require('ethereumjs-util'); import * as _ from 'lodash'; diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts index e817951ab..4b261904a 100644 --- a/packages/contracts/test/libraries/lib_bytes.ts +++ b/packages/contracts/test/libraries/lib_bytes.ts @@ -1,5 +1,5 @@ import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils'; -import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from '@0xproject/types'; +import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import BN = require('bn.js'); diff --git a/packages/contracts/test/multi_sig_with_time_lock.ts b/packages/contracts/test/multi_sig_with_time_lock.ts index 7b7885a00..1302d0fa0 100644 --- a/packages/contracts/test/multi_sig_with_time_lock.ts +++ b/packages/contracts/test/multi_sig_with_time_lock.ts @@ -1,8 +1,8 @@ import { BlockchainLifecycle, web3Factory } from '@0xproject/dev-utils'; -import { LogWithDecodedArgs } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; +import { LogWithDecodedArgs } from 'ethereum-types'; import * as _ from 'lodash'; import 'make-promises-safe'; import * as Web3 from 'web3'; diff --git a/packages/contracts/test/tutorials/arbitrage.ts b/packages/contracts/test/tutorials/arbitrage.ts index e5787d5b8..df01f31bb 100644 --- a/packages/contracts/test/tutorials/arbitrage.ts +++ b/packages/contracts/test/tutorials/arbitrage.ts @@ -1,6 +1,6 @@ // import { ECSignature, SignedOrder, ZeroEx } from '0x.js'; // import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils'; -// import { ExchangeContractErrs } from '@0xproject/types'; +// import { ExchangeContractErrs } from 'ethereum-types'; // import { BigNumber } from '@0xproject/utils'; // import { Web3Wrapper } from '@0xproject/web3-wrapper'; // import * as chai from 'chai'; -- cgit From fa3d011f68630e36b1a3812dd493a5144ebc6c53 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 31 May 2018 10:14:23 -0700 Subject: Add ethereum-types to extraFileIncludes --- packages/contracts/src/utils/log_decoder.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/src/utils/log_decoder.ts b/packages/contracts/src/utils/log_decoder.ts index 2839cfe84..07d10e69d 100644 --- a/packages/contracts/src/utils/log_decoder.ts +++ b/packages/contracts/src/utils/log_decoder.ts @@ -1,7 +1,14 @@ import { ContractArtifact } from '@0xproject/sol-compiler'; import { AbiDecoder, BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import { AbiDefinition, LogEntry, LogWithDecodedArgs, RawLog, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; +import { + AbiDefinition, + DecodedLogArgs, + LogEntry, + LogWithDecodedArgs, + RawLog, + TransactionReceiptWithDecodedLogs, +} from 'ethereum-types'; import * as _ from 'lodash'; import { artifacts } from './artifacts'; @@ -30,7 +37,7 @@ export class LogDecoder { }); this._abiDecoder = new AbiDecoder(abiArrays); } - public decodeLogOrThrow(log: LogEntry): LogWithDecodedArgs | RawLog { + public decodeLogOrThrow(log: LogEntry): LogWithDecodedArgs | RawLog { const logWithDecodedArgsOrLog = this._abiDecoder.tryToDecodeLogOrNoop(log); if (_.isUndefined((logWithDecodedArgsOrLog as LogWithDecodedArgs).args)) { throw new Error(`Unable to decode log: ${JSON.stringify(log)}`); -- cgit From a2fc9a964ba6dd5379924e786df430c4fce3fc7a Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 31 May 2018 11:18:38 -0700 Subject: Fix linter errors --- packages/contracts/src/utils/erc20_wrapper.ts | 2 +- packages/contracts/src/utils/erc721_wrapper.ts | 2 +- packages/contracts/src/utils/token_registry_wrapper.ts | 2 +- packages/contracts/src/utils/web3_wrapper.ts | 2 +- packages/contracts/test/asset_proxy_owner.ts | 2 +- packages/contracts/test/libraries/lib_bytes.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/src/utils/erc20_wrapper.ts b/packages/contracts/src/utils/erc20_wrapper.ts index 733021368..0f45fb1e6 100644 --- a/packages/contracts/src/utils/erc20_wrapper.ts +++ b/packages/contracts/src/utils/erc20_wrapper.ts @@ -1,6 +1,6 @@ -import { Provider } from 'ethereum-types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { Provider } from 'ethereum-types'; import * as _ from 'lodash'; import { DummyERC20TokenContract } from '../contract_wrappers/generated/dummy_e_r_c20_token'; diff --git a/packages/contracts/src/utils/erc721_wrapper.ts b/packages/contracts/src/utils/erc721_wrapper.ts index 4e27b24ad..11a012602 100644 --- a/packages/contracts/src/utils/erc721_wrapper.ts +++ b/packages/contracts/src/utils/erc721_wrapper.ts @@ -1,7 +1,7 @@ import { generatePseudoRandomSalt } from '@0xproject/order-utils'; -import { Provider } from 'ethereum-types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { Provider } from 'ethereum-types'; import * as _ from 'lodash'; import { DummyERC721TokenContract } from '../contract_wrappers/generated/dummy_e_r_c721_token'; diff --git a/packages/contracts/src/utils/token_registry_wrapper.ts b/packages/contracts/src/utils/token_registry_wrapper.ts index 6e3abb26b..240c06fdc 100644 --- a/packages/contracts/src/utils/token_registry_wrapper.ts +++ b/packages/contracts/src/utils/token_registry_wrapper.ts @@ -1,5 +1,5 @@ -import { Provider } from '@0xproject/types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { Provider } from 'ethereum-types'; import { TokenRegistryContract } from '../contract_wrappers/generated/token_registry'; diff --git a/packages/contracts/src/utils/web3_wrapper.ts b/packages/contracts/src/utils/web3_wrapper.ts index 2dd0dd1a3..1049ab967 100644 --- a/packages/contracts/src/utils/web3_wrapper.ts +++ b/packages/contracts/src/utils/web3_wrapper.ts @@ -1,7 +1,7 @@ import { devConstants, env, EnvVars, web3Factory } from '@0xproject/dev-utils'; import { prependSubprovider } from '@0xproject/subproviders'; -import { Provider } from 'ethereum-types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { Provider } from 'ethereum-types'; import { coverage } from './coverage'; diff --git a/packages/contracts/test/asset_proxy_owner.ts b/packages/contracts/test/asset_proxy_owner.ts index b0a78c601..4c16b5cff 100644 --- a/packages/contracts/test/asset_proxy_owner.ts +++ b/packages/contracts/test/asset_proxy_owner.ts @@ -1,7 +1,7 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { LogWithDecodedArgs } from 'ethereum-types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; +import { LogWithDecodedArgs } from 'ethereum-types'; import * as _ from 'lodash'; import 'make-promises-safe'; import * as Web3 from 'web3'; diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts index 4b261904a..f8d75080a 100644 --- a/packages/contracts/test/libraries/lib_bytes.ts +++ b/packages/contracts/test/libraries/lib_bytes.ts @@ -1,9 +1,9 @@ import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils'; -import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import BN = require('bn.js'); import * as chai from 'chai'; +import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import ethUtil = require('ethereumjs-util'); import * as Web3 from 'web3'; -- cgit