Class CompilerCli

A wrapper around aesophia_cli, available only in Node.js. Requires Erlang installed, assumes that escript is available in PATH.

Hierarchy

Constructors

  • Parameters

    • compilerPath: string = ...

      A path to aesophia_cli binary, by default uses the integrated one

    • options: {
          ignoreVersion?: boolean;
      } = {}

      Options

      • Optional ignoreVersion?: boolean

        Don't ensure that the compiler is supported

    Returns CompilerCli

Methods

  • Compile contract by contract's path Available only in Node.js

    Parameters

    • path: string

      Path to contract source code

    Returns Promise<{
        aci: Aci;
        bytecode: `cb_${string}`;
    }>

    ACI and bytecode

  • Compile contract by contract's source code

    Parameters

    • sourceCode: string

      Contract source code as string

    • Optional fileSystem: Record<string, string>

      A map of contract filename to the corresponding contract source code to include into the main contract

    Returns Promise<{
        aci: Aci;
        bytecode: `cb_${string}`;
    }>

    ACI and bytecode

    Example

    {
    'library.aes': 'namespace TestLib =\n function sum(x: int, y: int) : int = x + y'
    }
  • Generate contract's ACI by contract's source code

    Parameters

    • sourceCode: string

      Contract source code as string

    • Optional fileSystem: Record<string, string>

      A map of contract filename to the corresponding contract source code to include into the main contract

    Returns Promise<Aci>

    ACI

    Example

    {
    'library.aes': 'namespace TestLib =\n function sum(x: int, y: int) : int = x + y'
    }
  • Verify that a contract bytecode is the result of compiling the given source code Available only in Node.js

    Parameters

    • bytecode: `cb_${string}`

      Contract bytecode to verify

    • path: string

      Path to contract source code

    Returns Promise<boolean>

    ACI and bytecode

  • Verify that a contract bytecode is the result of compiling the given source code

    Parameters

    • bytecode: `cb_${string}`

      Contract bytecode to verify

    • sourceCode: string

      Contract source code as string

    • Optional fileSystem: Record<string, string>

      A map of contract filename to the corresponding contract source code to include into the main contract

    Returns Promise<boolean>

    Example

    {
    'library.aes': 'namespace TestLib =\n function sum(x: int, y: int) : int = x + y'
    }

Generated using TypeDoc