Commit a7264aeb authored by tom's avatar tom

remove is_vyper_contract field

parent da56e084
...@@ -27,7 +27,6 @@ export interface SmartContract { ...@@ -27,7 +27,6 @@ export interface SmartContract {
constructor_args: string | null; constructor_args: string | null;
decoded_constructor_args: Array<SmartContractDecodedConstructorArg> | null; decoded_constructor_args: Array<SmartContractDecodedConstructorArg> | null;
can_be_visualized_via_sol2uml: boolean | null; can_be_visualized_via_sol2uml: boolean | null;
is_vyper_contract: boolean | null;
file_path: string; file_path: string;
additional_sources: Array<{ file_path: string; source_code: string }>; additional_sources: Array<{ file_path: string; source_code: string }>;
external_libraries: Array<SmartContractExternalLibrary> | null; external_libraries: Array<SmartContractExternalLibrary> | null;
......
...@@ -23,9 +23,19 @@ function getEditorData(contractInfo: SmartContract | undefined) { ...@@ -23,9 +23,19 @@ function getEditorData(contractInfo: SmartContract | undefined) {
return undefined; return undefined;
} }
const defaultName = contractInfo.is_vyper_contract ? '/index.vy' : '/index.sol'; const extension = (() => {
switch (contractInfo.language) {
case 'vyper':
return 'vy';
case 'yul':
return 'yul';
default:
return 'sol';
}
})();
return [ return [
{ file_path: formatFilePath(contractInfo.file_path || defaultName), source_code: contractInfo.source_code }, { file_path: formatFilePath(contractInfo.file_path || `index.${ extension }`), source_code: contractInfo.source_code },
...(contractInfo.additional_sources || []).map((source) => ({ ...source, file_path: formatFilePath(source.file_path) })), ...(contractInfo.additional_sources || []).map((source) => ({ ...source, file_path: formatFilePath(source.file_path) })),
]; ];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment