From 76afb6b1163182446a1f3646b4bc89b5dc271738 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 14 Feb 2018 15:51:09 -0800 Subject: Add types for ABIv2 --- packages/deployer/src/utils/encoder.ts | 2 +- packages/web3-typescript-typings/CHANGELOG.md | 3 ++- packages/web3-typescript-typings/index.d.ts | 13 ++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/deployer/src/utils/encoder.ts b/packages/deployer/src/utils/encoder.ts index d5f807774..e3acde252 100644 --- a/packages/deployer/src/utils/encoder.ts +++ b/packages/deployer/src/utils/encoder.ts @@ -9,7 +9,7 @@ export const encoder = { const constructorTypes: string[] = []; _.each(abi, (element: Web3.AbiDefinition) => { if (element.type === AbiType.Constructor) { - _.each(element.inputs, (input: Web3.FunctionParameter) => { + _.each(element.inputs, (input: Web3.DataItem) => { constructorTypes.push(input.type); }); } diff --git a/packages/web3-typescript-typings/CHANGELOG.md b/packages/web3-typescript-typings/CHANGELOG.md index 88dac67f6..c4949ddf9 100644 --- a/packages/web3-typescript-typings/CHANGELOG.md +++ b/packages/web3-typescript-typings/CHANGELOG.md @@ -1,8 +1,9 @@ # CHANGELOG -## v0.9.11 - _TBD, 2018_ +## v0.10.0 - _TBD, 2018_ * Fix `web3.net.peerCount` to be of type number instead of boolean (#397) +* Support ABIv2 (#401) ## v0.9.3 - _January 11, 2018_ diff --git a/packages/web3-typescript-typings/index.d.ts b/packages/web3-typescript-typings/index.d.ts index 915c73b90..6155d10f0 100644 --- a/packages/web3-typescript-typings/index.d.ts +++ b/packages/web3-typescript-typings/index.d.ts @@ -62,8 +62,8 @@ declare module 'web3' { interface MethodAbi { type: AbiType.Function; name: string; - inputs: FunctionParameter[]; - outputs: FunctionParameter[]; + inputs: DataItem[]; + outputs: DataItem[]; constant: boolean; stateMutability: StateMutability; payable: boolean; @@ -71,7 +71,7 @@ declare module 'web3' { interface ConstructorAbi { type: AbiType.Constructor; - inputs: FunctionParameter[]; + inputs: DataItem[]; payable: boolean; stateMutability: ConstructorStateMutability; } @@ -81,9 +81,7 @@ declare module 'web3' { payable: boolean; } - interface EventParameter { - name: string; - type: string; + interface EventParameter extends DataItem { indexed: boolean; } @@ -94,9 +92,10 @@ declare module 'web3' { anonymous: boolean; } - interface FunctionParameter { + interface DataItem { name: string; type: string; + components: DataItem[]; } interface ContractInstance { -- cgit v1.2.3