Use AbiType

This commit is contained in:
Leonid Logvinov
2017-09-05 15:34:52 +02:00
parent ee00769be1
commit dff63f9b89
3 changed files with 6 additions and 6 deletions

View File

@@ -86,7 +86,7 @@
"types-ethereumjs-util": "^0.0.5",
"typescript": "^2.4.1",
"web3-provider-engine": "^13.0.1",
"web3-typescript-typings": "^0.4.1",
"web3-typescript-typings": "^0.5.0",
"webpack": "^3.1.0"
},
"dependencies": {

View File

@@ -22,7 +22,7 @@ export class Contract implements Web3.ContractInstance {
this.validator = new SchemaValidator();
}
private populateFunctions(): void {
const functionsAbi = _.filter(this.abi, abiPart => abiPart.type === 'function');
const functionsAbi = _.filter(this.abi, abiPart => abiPart.type === Web3.AbiType.Function);
_.forEach(functionsAbi, (functionAbi: Web3.MethodAbi) => {
if (functionAbi.constant) {
const cbStyleCallFunction = this.contract[functionAbi.name].call;
@@ -40,7 +40,7 @@ export class Contract implements Web3.ContractInstance {
});
}
private populateEvents(): void {
const eventsAbi = _.filter(this.abi, abiPart => abiPart.type === 'event');
const eventsAbi = _.filter(this.abi, abiPart => abiPart.type === Web3.AbiType.Event);
_.forEach(eventsAbi, (eventAbi: Web3.EventAbi) => {
this[eventAbi.name] = this.contract[eventAbi.name];
});

View File

@@ -5005,9 +5005,9 @@ web3-provider-engine@^8.4.0:
xhr "^2.2.0"
xtend "^4.0.1"
web3-typescript-typings@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/web3-typescript-typings/-/web3-typescript-typings-0.4.1.tgz#077f5c042c1d2625b4cabedad88b9e9427b38fb3"
web3-typescript-typings@^0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/web3-typescript-typings/-/web3-typescript-typings-0.5.0.tgz#a598ad5d4600c53d8e865c52e52b62f2ad04ec84"
dependencies:
bignumber.js "^4.0.2"