JSPM

  • Created
  • Published
  • Downloads 50
  • Score
    100M100P100Q93311F
  • License MIT

Embark compiler module

Package Exports

  • embark-compiler

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (embark-compiler) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

embark-compiler

Embark compiler module

Abstracts the compiler interface and exposes a plugin api to register contract extensions and how to handle them. It accepts command requests to compile and returns the aggregated compilation result.

API

command: compiler:contracts:compile

arguments:

  • contractFiles -
  • options - config object {isCoverage: boolean (default: false)}

    response:

    • error
    • compiledObject - compilation result
      {
        runtimeBytecode: <deployed bytecode>
        realRuntimeByteCode: <deployed bytecode without swarm hash>
        code: <bytecode>
        abiDefinition: <abi object>
    
        swarmHash: (optional)
        gasEstimates: (optional)
        functionHashes: (optional)
        filename: (optional) <contract relative filename>
        originalFilename: (optional) <contract real filename>
      }

    example:

    import { File } from 'src/lib/core/file.js';
    const contractFiles = [(new File({path: "simplestorage.sol", type: "custom", resolver: (cb) => { return cb(".. contract code...") }}))];
    
    embark.events.request("compiler:contracts:compile", contractFiles, {}, (err, compiledObject) => {
    })
    

    Plugins

    This module enables the registerCompiler plugin API. see documentation

    embark.registerCompiler

    arguments:

    • extension - extension of the contract language (e.g .sol)
    • response callback
      • contractFiles: filenames matching the extension
      • callback(error, compiledObject)

    Visit framework.embarklabs.io to get started with Embark.