aboutsummaryrefslogtreecommitdiffstats
path: root/packages/base-contract
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-03-28 22:26:05 +0800
committerGitHub <noreply@github.com>2018-03-28 22:26:05 +0800
commit8926dac78c3ac8d75ad5ffd5b4febe36def4e53c (patch)
tree01c1b3f8dba486beb4e83e67ad0bc35c3da6a14e /packages/base-contract
parent18cac3f0927a0424e3618fd56dba73fc9dfc0288 (diff)
parent01e27426d643b525661e044dbb8c8f27734329e7 (diff)
downloaddexon-sol-tools-8926dac78c3ac8d75ad5ffd5b4febe36def4e53c.tar
dexon-sol-tools-8926dac78c3ac8d75ad5ffd5b4febe36def4e53c.tar.gz
dexon-sol-tools-8926dac78c3ac8d75ad5ffd5b4febe36def4e53c.tar.bz2
dexon-sol-tools-8926dac78c3ac8d75ad5ffd5b4febe36def4e53c.tar.lz
dexon-sol-tools-8926dac78c3ac8d75ad5ffd5b4febe36def4e53c.tar.xz
dexon-sol-tools-8926dac78c3ac8d75ad5ffd5b4febe36def4e53c.tar.zst
dexon-sol-tools-8926dac78c3ac8d75ad5ffd5b4febe36def4e53c.zip
Merge pull request #482 from 0xProject/feature/web3-types
Move common types out of web3 types
Diffstat (limited to 'packages/base-contract')
-rw-r--r--packages/base-contract/package.json3
-rw-r--r--packages/base-contract/src/index.ts13
2 files changed, 7 insertions, 9 deletions
diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json
index 554f0a41c..e9015713c 100644
--- a/packages/base-contract/package.json
+++ b/packages/base-contract/package.json
@@ -34,8 +34,7 @@
"@0xproject/web3-wrapper": "^0.3.1",
"@0xproject/typescript-typings": "^0.0.1",
"ethers-contracts": "^2.2.1",
- "lodash": "^4.17.4",
- "web3": "^0.20.0"
+ "lodash": "^4.17.4"
},
"publishConfig": {
"access": "public"
diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts
index cc1e16a13..961da8842 100644
--- a/packages/base-contract/src/index.ts
+++ b/packages/base-contract/src/index.ts
@@ -1,16 +1,15 @@
-import { TxData, TxDataPayable } from '@0xproject/types';
+import { ContractAbi, DataItem, TxData, TxDataPayable } from '@0xproject/types';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as ethersContracts from 'ethers-contracts';
import * as _ from 'lodash';
-import * as Web3 from 'web3';
export class BaseContract {
protected _ethersInterface: ethersContracts.Interface;
protected _web3Wrapper: Web3Wrapper;
- public abi: Web3.ContractAbi;
+ public abi: ContractAbi;
public address: string;
protected static _transformABIData(
- abis: Web3.DataItem[],
+ abis: DataItem[],
values: any[],
transformation: (type: string, value: any) => any,
): any {
@@ -46,20 +45,20 @@ export class BaseContract {
// 2. Global config passed in at library instantiation
// 3. Gas estimate calculation + safety margin
const removeUndefinedProperties = _.pickBy;
- const txDataWithDefaults = {
+ const txDataWithDefaults = ({
to: this.address,
...removeUndefinedProperties(this._web3Wrapper.getContractDefaults()),
...removeUndefinedProperties(txData as any),
// HACK: TS can't prove that T is spreadable.
// Awaiting https://github.com/Microsoft/TypeScript/pull/13288 to be merged
- };
+ } as any) as TxData;
if (_.isUndefined(txDataWithDefaults.gas) && !_.isUndefined(estimateGasAsync)) {
const estimatedGas = await estimateGasAsync(txData);
txDataWithDefaults.gas = estimatedGas;
}
return txDataWithDefaults;
}
- constructor(web3Wrapper: Web3Wrapper, abi: Web3.ContractAbi, address: string) {
+ constructor(web3Wrapper: Web3Wrapper, abi: ContractAbi, address: string) {
this._web3Wrapper = web3Wrapper;
this.abi = abi;
this.address = address;