diff --git a/packages/contracts/src.ts/index.ts b/packages/contracts/src.ts/index.ts index c43dbfbf1d..60fe04c521 100644 --- a/packages/contracts/src.ts/index.ts +++ b/packages/contracts/src.ts/index.ts @@ -728,8 +728,8 @@ export class BaseContract { // are ambiguous { const name = fragment.name; - if (!uniqueNames[name]) { uniqueNames[name] = [ ]; } - uniqueNames[name].push(signature); + if (!uniqueNames[`%${ name }`]) { uniqueNames[`%${ name }`] = [ ]; } + uniqueNames[`%${ name }`].push(signature); } if ((this)[signature] == null) { @@ -757,11 +757,13 @@ export class BaseContract { }); Object.keys(uniqueNames).forEach((name) => { - // Ambiguous names to not get attached as bare names const signatures = uniqueNames[name]; if (signatures.length > 1) { return; } + // Strip off the leading "%" used for prototype protection + name = name.substring(1); + const signature = signatures[0]; // If overwriting a member property that is null, swallow the error