diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-09-05 21:44:42 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-09-05 21:44:42 +0800 |
commit | b0547819fd97c9bace5e4eca3fe8666ec5e40f81 (patch) | |
tree | 8cc097928513d56e4790f03b3dcb141e7f2732b6 /src | |
parent | dff63f9b89a468ab09ac1be3c0c5e8ca157f8069 (diff) | |
download | dexon-sol-tools-b0547819fd97c9bace5e4eca3fe8666ec5e40f81.tar dexon-sol-tools-b0547819fd97c9bace5e4eca3fe8666ec5e40f81.tar.gz dexon-sol-tools-b0547819fd97c9bace5e4eca3fe8666ec5e40f81.tar.bz2 dexon-sol-tools-b0547819fd97c9bace5e4eca3fe8666ec5e40f81.tar.lz dexon-sol-tools-b0547819fd97c9bace5e4eca3fe8666ec5e40f81.tar.xz dexon-sol-tools-b0547819fd97c9bace5e4eca3fe8666ec5e40f81.tar.zst dexon-sol-tools-b0547819fd97c9bace5e4eca3fe8666ec5e40f81.zip |
Define AbiType
Diffstat (limited to 'src')
-rw-r--r-- | src/contract.ts | 5 | ||||
-rw-r--r-- | src/types.ts | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/contract.ts b/src/contract.ts index b9ab496b2..1aacc65dc 100644 --- a/src/contract.ts +++ b/src/contract.ts @@ -2,6 +2,7 @@ import * as Web3 from 'web3'; import * as _ from 'lodash'; import promisify = require('es6-promisify'); import {SchemaValidator, schemas} from '0x-json-schemas'; +import {AbiType} from './types'; export class Contract implements Web3.ContractInstance { public address: string; @@ -22,7 +23,7 @@ export class Contract implements Web3.ContractInstance { this.validator = new SchemaValidator(); } private populateFunctions(): void { - const functionsAbi = _.filter(this.abi, abiPart => abiPart.type === Web3.AbiType.Function); + const functionsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Function); _.forEach(functionsAbi, (functionAbi: Web3.MethodAbi) => { if (functionAbi.constant) { const cbStyleCallFunction = this.contract[functionAbi.name].call; @@ -40,7 +41,7 @@ export class Contract implements Web3.ContractInstance { }); } private populateEvents(): void { - const eventsAbi = _.filter(this.abi, abiPart => abiPart.type === Web3.AbiType.Event); + const eventsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Event); _.forEach(eventsAbi, (eventAbi: Web3.EventAbi) => { this[eventAbi.name] = this.contract[eventAbi.name]; }); diff --git a/src/types.ts b/src/types.ts index e47f57e5e..ddf449c16 100644 --- a/src/types.ts +++ b/src/types.ts @@ -390,3 +390,10 @@ export interface ZeroExConfig { } export type TransactionReceipt = Web3.TransactionReceipt; + +export enum AbiType { + Function = 'function', + Constructor = 'constructor', + Event = 'event', + Fallback = 'fallback', +} |