aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils/src/abi_encoder/evm_data_types/tuple.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/utils/src/abi_encoder/evm_data_types/tuple.ts')
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/tuple.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/packages/utils/src/abi_encoder/evm_data_types/tuple.ts b/packages/utils/src/abi_encoder/evm_data_types/tuple.ts
index 54964235c..3d1cb5a92 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/tuple.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/tuple.ts
@@ -5,7 +5,6 @@ import { DataTypeFactory } from '../abstract_data_types/interfaces';
import { AbstractSetDataType } from '../abstract_data_types/types/set';
export class TupleDataType extends AbstractSetDataType {
- //private readonly _signature: string;
public static matchType(type: string): boolean {
return type === SolidityTypes.Tuple;
@@ -16,7 +15,6 @@ export class TupleDataType extends AbstractSetDataType {
if (!TupleDataType.matchType(dataItem.type)) {
throw new Error(`Tried to instantiate Tuple with bad input: ${dataItem}`);
}
- //this._signature =
}
public getSignatureType(): string {
@@ -24,9 +22,13 @@ export class TupleDataType extends AbstractSetDataType {
}
public getSignature(detailed?: boolean): string {
- if (_.isEmpty(this.getDataItem().name) || !detailed) return this.getSignatureType();
+ if (_.isEmpty(this.getDataItem().name) || !detailed) {
+ return this.getSignatureType();
+ }
const name = this.getDataItem().name;
- const shortName = name.indexOf('.') > 0 ? name.substr(name.lastIndexOf('.') + 1) : name;
+ const lastIndexOfScopeDelimiter = name.lastIndexOf('.');
+ const isScopedName = !_.isUndefined(lastIndexOfScopeDelimiter) && lastIndexOfScopeDelimiter > 0;
+ const shortName = isScopedName ? name.substr((lastIndexOfScopeDelimiter as number) + 1) : name;
const detailedSignature = `${shortName} ${this._computeSignatureOfMembers(detailed)}`;
return detailedSignature;
}