Skip to content

Commit 4d2d90f

Browse files
committed
Prevent bad Interface clone when using two different versions of v6 (ethers-io#4689).
1 parent 45b9b9c commit 4d2d90f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src.ts/abi/interface.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1255,7 +1255,12 @@ export class Interface {
12551255
// JSON
12561256
if (typeof(value) === "string") { return new Interface(JSON.parse(value)); }
12571257

1258-
// Maybe an interface from an older version, or from a symlinked copy
1258+
// An Interface; possibly from another v6 instance
1259+
if (typeof((<any>value).formatJson) === "function") {
1260+
return new Interface((<any>value).formatJson());
1261+
}
1262+
1263+
// A legacy Interface; from an older version
12591264
if (typeof((<any>value).format) === "function") {
12601265
return new Interface((<any>value).format("json"));
12611266
}

0 commit comments

Comments
 (0)