diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-03-30 01:02:46 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-03-30 01:02:46 +0800 |
commit | 665011174bab7cfc6ec53e0044d60e1463222aee (patch) | |
tree | 44bc55bd390044d6cbfe8e0f7dddb621a8be7249 /packages/deployer/src/utils/contract.ts | |
parent | d106079d9b69191d9cdc6d9323dbae3e4b45daf2 (diff) | |
parent | c4dd9658e791a9f821ea3b6eb4326bcba53b081a (diff) | |
download | dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.gz dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.bz2 dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.lz dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.xz dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.zst dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.zip |
Merge branch 'development' into feature/website/wallet-wrap
* development: (35 commits)
Fix CHANGELOG
Update Yarn.lock
Standardize changelog dates and format
Fix stubbing of a non-existent property
Remove redundant cast
Move common types out of web3 types
Add monorepo_scripts to npmignore
Add typeRoots
Add clean-state tests
Remove nested .gitignore files since `yarn publish` gets confused by them and ignores their contents on the top-level scope
Remove WETH hack now that updated WETH address is in TokenRegistry
Revert TokenRegistry address on Kovan
Improve rounding error message
Portal fill with mixed decimals
Add error popover if TokenRegistry on network user is browsing on don't include the requisite default tokens for 0x Portal to function
Set timeout for compiler tests
Remove redundant types
Add missing param comments
Fix a comment
Add a comment
...
Diffstat (limited to 'packages/deployer/src/utils/contract.ts')
-rw-r--r-- | packages/deployer/src/utils/contract.ts | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/packages/deployer/src/utils/contract.ts b/packages/deployer/src/utils/contract.ts index 9c57751ff..9b7baac11 100644 --- a/packages/deployer/src/utils/contract.ts +++ b/packages/deployer/src/utils/contract.ts @@ -1,4 +1,5 @@ import { schemas, SchemaValidator } from '@0xproject/json-schemas'; +import { ContractAbi, EventAbi, FunctionAbi, MethodAbi, TxData } from '@0xproject/types'; import { promisify } from '@0xproject/utils'; import * as _ from 'lodash'; import * as Web3 from 'web3'; @@ -7,14 +8,14 @@ import { AbiType } from './types'; export class Contract implements Web3.ContractInstance { public address: string; - public abi: Web3.ContractAbi; + public abi: ContractAbi; private _contract: Web3.ContractInstance; - private _defaults: Partial<Web3.TxData>; + private _defaults: Partial<TxData>; private _validator: SchemaValidator; // This class instance is going to be populated with functions and events depending on the ABI // and we don't know their types in advance [name: string]: any; - constructor(web3ContractInstance: Web3.ContractInstance, defaults: Partial<Web3.TxData>) { + constructor(web3ContractInstance: Web3.ContractInstance, defaults: Partial<TxData>) { this._contract = web3ContractInstance; this.address = web3ContractInstance.address; this.abi = web3ContractInstance.abi; @@ -24,8 +25,8 @@ export class Contract implements Web3.ContractInstance { this._validator = new SchemaValidator(); } private _populateFunctions(): void { - const functionsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Function) as Web3.FunctionAbi[]; - _.forEach(functionsAbi, (functionAbi: Web3.MethodAbi) => { + const functionsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Function) as FunctionAbi[]; + _.forEach(functionsAbi, (functionAbi: MethodAbi) => { if (functionAbi.constant) { const cbStyleCallFunction = this._contract[functionAbi.name].call; this[functionAbi.name] = promisify(cbStyleCallFunction, this._contract); @@ -42,8 +43,8 @@ export class Contract implements Web3.ContractInstance { }); } private _populateEvents(): void { - const eventsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Event) as Web3.EventAbi[]; - _.forEach(eventsAbi, (eventAbi: Web3.EventAbi) => { + const eventsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Event) as EventAbi[]; + _.forEach(eventsAbi, (eventAbi: EventAbi) => { this[eventAbi.name] = this._contract[eventAbi.name]; }); } @@ -51,7 +52,7 @@ export class Contract implements Web3.ContractInstance { const promisifiedWithDefaultParams = async (...args: any[]) => { const promise = new Promise((resolve, reject) => { const lastArg = args[args.length - 1]; - let txData: Partial<Web3.TxData> = {}; + let txData: Partial<TxData> = {}; if (this._isTxData(lastArg)) { txData = args.pop(); } |