* Creates a new [[Interface]] from the ABI %%value%%. * * The %%value%% may be provided as an existing [[Interface]] object, * a JSON-encoded ABI or any Human-Readable ABI format.
(value)
| 1078 | * a JSON-encoded ABI or any Human-Readable ABI format. |
| 1079 | */ |
| 1080 | static from(value) { |
| 1081 | // Already an Interface, which is immutable |
| 1082 | if (value instanceof Interface) { |
| 1083 | return value; |
| 1084 | } |
| 1085 | // JSON |
| 1086 | if (typeof (value) === "string") { |
| 1087 | return new Interface(JSON.parse(value)); |
| 1088 | } |
| 1089 | // An Interface; possibly from another v6 instance |
| 1090 | if (typeof (value.formatJson) === "function") { |
| 1091 | return new Interface(value.formatJson()); |
| 1092 | } |
| 1093 | // A legacy Interface; from an older version |
| 1094 | if (typeof (value.format) === "function") { |
| 1095 | return new Interface(value.format("json")); |
| 1096 | } |
| 1097 | // Array of fragments |
| 1098 | return new Interface(value); |
| 1099 | } |
| 1100 | } |
| 1101 | //# sourceMappingURL=interface.js.map |
no test coverage detected