diff --git a/packages/contracts/src.ts/index.ts b/packages/contracts/src.ts/index.ts index 6a5c3d949b..3b10d1e05e 100644 --- a/packages/contracts/src.ts/index.ts +++ b/packages/contracts/src.ts/index.ts @@ -583,7 +583,7 @@ export type ContractInterface = string | Array type InterfaceFunc = (contractInterface: ContractInterface) => Interface; -export class Contract { +export class BaseContract { readonly address: string; readonly interface: Interface; @@ -598,9 +598,6 @@ export class Contract { readonly filters: { [ name: string ]: (...args: Array) => EventFilter }; - // The meta-class properties - readonly [ key: string ]: ContractFunction | any; - // This will always be an address. This will only differ from // address if an ENS name was used in the constructor readonly resolvedAddress: Promise; @@ -709,7 +706,7 @@ export class Contract { uniqueNames[name].push(signature); } - if (this[signature] == null) { + if ((this)[signature] == null) { defineReadOnly(this, signature, buildDefault(this, fragment, true)); } @@ -743,8 +740,8 @@ export class Contract { // If overwriting a member property that is null, swallow the error try { - if (this[name] == null) { - defineReadOnly(this, name, this[signature]); + if ((this)[name] == null) { + defineReadOnly(this, name, (this)[signature]); } } catch (e) { } @@ -1093,6 +1090,11 @@ export class Contract { } +export class Contract extends BaseContract { + // The meta-class properties + readonly [ key: string ]: ContractFunction | any; +} + export class ContractFactory { readonly interface: Interface;