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

Hierarchy (view full)

Constructors

  • Parameters

    • compilerPath: string = ...

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

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

      Options

      • OptionalignoreVersion?: boolean

        Print warning instead of throwing exception if compiler version is not supported, use with caution

    Returns CompilerCli

Methods

  • Compile contract by contract's source code

    Parameters

    • sourceCode: string

      Contract source code as string

    • OptionalfileSystem: Record<string, string>

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

    Returns CompileResult

    ACI and bytecode

    {
    '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

    • OptionalfileSystem: Record<string, string>

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

    Returns Promise<Aci>

    ACI

    {
    '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

    • OptionalfileSystem: Record<string, string>

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

    Returns Promise<boolean>

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