* 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)
| 1086 | * a JSON-encoded ABI or any Human-Readable ABI format. |
| 1087 | */ |
| 1088 | static from(value) { |
| 1089 | // Already an Interface, which is immutable |
| 1090 | if (value instanceof Interface) { |
| 1091 | return value; |
| 1092 | } |
| 1093 | // JSON |
| 1094 | if (typeof (value) === "string") { |
| 1095 | return new Interface(JSON.parse(value)); |
| 1096 | } |
| 1097 | // An Interface; possibly from another v6 instance |
| 1098 | if (typeof (value.formatJson) === "function") { |
| 1099 | return new Interface(value.formatJson()); |
| 1100 | } |
| 1101 | // A legacy Interface; from an older version |
| 1102 | if (typeof (value.format) === "function") { |
| 1103 | return new Interface(value.format("json")); |
| 1104 | } |
| 1105 | // Array of fragments |
| 1106 | return new Interface(value); |
| 1107 | } |
| 1108 | } |
| 1109 | exports.Interface = Interface; |
| 1110 | //# sourceMappingURL=interface.js.map |
no test coverage detected