diff options
Diffstat (limited to 'packages/utils/src/abi_encoder/abstract_data_types')
-rw-r--r-- | packages/utils/src/abi_encoder/abstract_data_types/data_type.ts | 10 | ||||
-rw-r--r-- | packages/utils/src/abi_encoder/abstract_data_types/types/set.ts | 4 |
2 files changed, 11 insertions, 3 deletions
diff --git a/packages/utils/src/abi_encoder/abstract_data_types/data_type.ts b/packages/utils/src/abi_encoder/abstract_data_types/data_type.ts index 13cc87e2a..5bd6aae03 100644 --- a/packages/utils/src/abi_encoder/abstract_data_types/data_type.ts +++ b/packages/utils/src/abi_encoder/abstract_data_types/data_type.ts @@ -51,8 +51,16 @@ export abstract class DataType { return value; } + public getSignature(detailed?: boolean): string { + if (_.isEmpty(this._dataItem.name) || !detailed) return this.getSignatureType(); + const name = this.getDataItem().name; + const shortName = name.indexOf('.') > 0 ? name.substr(name.lastIndexOf('.') + 1) : name; + const detailedSignature = `${shortName} ${this.getSignatureType()}`; + return detailedSignature; + } + public abstract generateCalldataBlock(value: any, parentBlock?: CalldataBlock): CalldataBlock; public abstract generateValue(calldata: RawCalldata, rules: DecodingRules): any; - public abstract getSignature(): string; + public abstract getSignatureType(): string; public abstract isStatic(): boolean; } diff --git a/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts b/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts index 73e9cf778..d7105ff5f 100644 --- a/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts +++ b/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts @@ -155,11 +155,11 @@ export abstract class AbstractSetDataType extends DataType { return block; } - protected _computeSignatureOfMembers(): string { + protected _computeSignatureOfMembers(detailed?: boolean): string { // Compute signature of members let signature = `(`; _.each(this._members, (member: DataType, i: number) => { - signature += member.getSignature(); + signature += member.getSignature(detailed); if (i < this._members.length - 1) { signature += ','; } |