aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/src')
-rw-r--r--packages/contracts/src/utils/erc20_wrapper.ts2
-rw-r--r--packages/contracts/src/utils/erc721_wrapper.ts2
-rw-r--r--packages/contracts/src/utils/exchange_wrapper.ts3
-rw-r--r--packages/contracts/src/utils/log_decoder.ts9
-rw-r--r--packages/contracts/src/utils/match_order_tester.ts3
-rw-r--r--packages/contracts/src/utils/multi_sig_wrapper.ts2
-rw-r--r--packages/contracts/src/utils/token_registry_wrapper.ts14
-rw-r--r--packages/contracts/src/utils/types.ts3
-rw-r--r--packages/contracts/src/utils/web3_wrapper.ts2
9 files changed, 25 insertions, 15 deletions
diff --git a/packages/contracts/src/utils/erc20_wrapper.ts b/packages/contracts/src/utils/erc20_wrapper.ts
index 92cf01cc2..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 '@0xproject/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 bea801f3d..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 '@0xproject/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/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts
index 8f5915d97..dd278e77c 100644
--- a/packages/contracts/src/utils/exchange_wrapper.ts
+++ b/packages/contracts/src/utils/exchange_wrapper.ts
@@ -1,6 +1,7 @@
-import { AssetProxyId, Provider, SignedOrder, TransactionReceiptWithDecodedLogs } from '@0xproject/types';
+import { AssetProxyId, 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..07d10e69d 100644
--- a/packages/contracts/src/utils/log_decoder.ts
+++ b/packages/contracts/src/utils/log_decoder.ts
@@ -1,13 +1,14 @@
import { ContractArtifact } from '@0xproject/sol-compiler';
+import { AbiDecoder, BigNumber } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
import {
AbiDefinition,
+ DecodedLogArgs,
LogEntry,
LogWithDecodedArgs,
RawLog,
TransactionReceiptWithDecodedLogs,
-} from '@0xproject/types';
-import { AbiDecoder, BigNumber } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
+} from 'ethereum-types';
import * as _ from 'lodash';
import { artifacts } from './artifacts';
@@ -36,7 +37,7 @@ export class LogDecoder {
});
this._abiDecoder = new AbiDecoder(abiArrays);
}
- public decodeLogOrThrow<ArgsType>(log: LogEntry): LogWithDecodedArgs<ArgsType> | RawLog {
+ public decodeLogOrThrow<ArgsType extends DecodedLogArgs>(log: LogEntry): LogWithDecodedArgs<ArgsType> | RawLog {
const logWithDecodedArgsOrLog = this._abiDecoder.tryToDecodeLogOrNoop(log);
if (_.isUndefined((logWithDecodedArgsOrLog as LogWithDecodedArgs<ArgsType>).args)) {
throw new Error(`Unable to decode log: ${JSON.stringify(log)}`);
diff --git a/packages/contracts/src/utils/match_order_tester.ts b/packages/contracts/src/utils/match_order_tester.ts
index 85348b14d..09c0d8083 100644
--- a/packages/contracts/src/utils/match_order_tester.ts
+++ b/packages/contracts/src/utils/match_order_tester.ts
@@ -1,8 +1,9 @@
import { BlockchainLifecycle } from '@0xproject/dev-utils';
import { assetProxyUtils, crypto, orderHashUtils } from '@0xproject/order-utils';
-import { AssetProxyId, LogWithDecodedArgs, SignedOrder } from '@0xproject/types';
+import { AssetProxyId, 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/token_registry_wrapper.ts b/packages/contracts/src/utils/token_registry_wrapper.ts
index 86daeca62..240c06fdc 100644
--- a/packages/contracts/src/utils/token_registry_wrapper.ts
+++ b/packages/contracts/src/utils/token_registry_wrapper.ts
@@ -1,16 +1,21 @@
-import * as Web3 from 'web3';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import { Provider } from 'ethereum-types';
import { TokenRegistryContract } from '../contract_wrappers/generated/token_registry';
import { Token } from './types';
+import { constants } from './constants';
+
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<string> {
- const tx = this._tokenReg.addToken.sendTransactionAsync(
+ const txHash = await this._tokenReg.addToken.sendTransactionAsync(
token.address as string,
token.name,
token.symbol,
@@ -19,7 +24,8 @@ export class TokenRegWrapper {
token.swarmHash,
{ from },
);
- return tx;
+ await this._web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
+ return txHash;
}
public async getTokenMetaDataAsync(tokenAddress: string): Promise<Token> {
const data = await this._tokenReg.getTokenMetaData.callAsync(tokenAddress);
diff --git a/packages/contracts/src/utils/types.ts b/packages/contracts/src/utils/types.ts
index a6c90dae0..6340c4a51 100644
--- a/packages/contracts/src/utils/types.ts
+++ b/packages/contracts/src/utils/types.ts
@@ -1,5 +1,6 @@
-import { AbiDefinition, ContractAbi, Order, OrderWithoutExchangeAddress } from '@0xproject/types';
+import { Order, OrderWithoutExchangeAddress } 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..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 '@0xproject/types';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import { Provider } from 'ethereum-types';
import { coverage } from './coverage';