From 4d2d90f5cea2eb2f9559e490a34aa1567c8c4c14 Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Tue, 30 Apr 2024 22:45:36 -0400 Subject: [PATCH] Prevent bad Interface clone when using two different versions of v6 (#4689). --- src.ts/abi/interface.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src.ts/abi/interface.ts b/src.ts/abi/interface.ts index 113364c3c8..2dcee74f1c 100644 --- a/src.ts/abi/interface.ts +++ b/src.ts/abi/interface.ts @@ -1255,7 +1255,12 @@ export class Interface { // JSON if (typeof(value) === "string") { return new Interface(JSON.parse(value)); } - // Maybe an interface from an older version, or from a symlinked copy + // An Interface; possibly from another v6 instance + if (typeof((value).formatJson) === "function") { + return new Interface((value).formatJson()); + } + + // A legacy Interface; from an older version if (typeof((value).format) === "function") { return new Interface((value).format("json")); }