How to use the @0x/sol-compiler.Compiler.getSolcAsync function in @0x/sol-compiler

To help you get started, we’ve selected a few @0x/sol-compiler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 0xProject / 0x-monorepo / packages / sol-meta / src / solc_wrapper.ts View on Github external
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: {

@0x/sol-compiler

Solidity compiler wrapper and artifactor

Apache-2.0
Latest version published 2 years ago

Package Health Score

58 / 100
Full package analysis

Similar packages