Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const compile = async (sources: SourceCollection, ast: S.SourceUnit) => {
// Extract required version from pragma of ast
const version =
_.map(utils.pragmaNodes(ast).filter(({ name }) => name === 'solidity'), ({ value }) => value)[0] || 'latest';
// Get Solidity compiler
const compiler = await Solc.getSolcAsync(version);
// Solidity standard JSON input
// TODO: Typescript typings
// See: https://solidity.readthedocs.io/en/develop/using-the-compiler.html#compiler-input-and-output-json-description
const input = {
language: 'Solidity',
sources: {
...utils.objectMap(sources, ({ source: content }) => ({ content })),
TARGET_: { content: unparse(ast) },
},
settings: {
remappings: {
// TODO
},
},
outputSelection: {