* 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: InterfaceAbi | Interface)
| 1210 | * a JSON-encoded ABI or any Human-Readable ABI format. |
| 1211 | */ |
| 1212 | static from(value: InterfaceAbi | Interface): Interface { |
| 1213 | // Already an Interface, which is immutable |
| 1214 | if (value instanceof Interface) { return value; } |
| 1215 | |
| 1216 | // JSON |
| 1217 | if (typeof(value) === "string") { return new Interface(JSON.parse(value)); } |
| 1218 | |
| 1219 | // Maybe an interface from an older version, or from a symlinked copy |
| 1220 | if (typeof((<any>value).format) === "function") { |
| 1221 | return new Interface((<any>value).format("json")); |
| 1222 | } |
| 1223 | |
| 1224 | // Array of fragments |
| 1225 | return new Interface(value); |
| 1226 | } |
| 1227 | } |
no test coverage detected