Interface Compiler<CompilationContext, Configuration, ProgramState>

A Compiler is a wrapper around a specific CompilerConfiguration that exposes a purely-functional interface and allows for stronger type checking.

Type Parameters

Hierarchy

  • Compiler

Properties

configuration: Configuration
generateBytecode: (<Debug>(__namedParameters: {
    data: CompilationData<CompilationContext>;
    debug?: Debug;
    scriptId: string;
}) => Debug extends true ? CompilationResult<ProgramState> : BytecodeGenerationResult<ProgramState>)

Type declaration

    • <Debug>(__namedParameters: {
          data: CompilationData<CompilationContext>;
          debug?: Debug;
          scriptId: string;
      }): Debug extends true ? CompilationResult<ProgramState> : BytecodeGenerationResult<ProgramState>
    • Generate the bytecode for the given script and compilation data.

      Type Parameters

      • Debug extends boolean

      Parameters

      • __namedParameters: {
            data: CompilationData<CompilationContext>;
            debug?: Debug;
            scriptId: string;
        }
        • data: CompilationData<CompilationContext>

          The compilation data required to compile this script

        • Optional debug?: Debug

          Enable compilation debugging information (default: false)

        • scriptId: string

          The identifier of the script to compile

      Returns Debug extends true ? CompilationResult<ProgramState> : BytecodeGenerationResult<ProgramState>

generateScenario: (<Debug>(__namedParameters: {
    debug?: Debug;
    lockingScriptId?: string;
    scenarioId?: string;
    unlockingScriptId?: string;
}) => string | (Debug extends true ? ScenarioGenerationDebuggingResult<ProgramState> : Scenario))

Type declaration

    • <Debug>(__namedParameters: {
          debug?: Debug;
          lockingScriptId?: string;
          scenarioId?: string;
          unlockingScriptId?: string;
      }): string | (Debug extends true ? ScenarioGenerationDebuggingResult<ProgramState> : Scenario)
    • Generate a scenario given this compiler's configuration.

      If no scenarioId is specified, the default scenario is used. If no unlockingScriptId is used, an empty script is used for all ["slot"] and ["copy"] locations in the generated transaction (useful for testing isolated scripts, i.e. scripts without either tests or any corresponding unlocking scripts).

      Type Parameters

      • Debug extends boolean

      Parameters

      • __namedParameters: {
            debug?: Debug;
            lockingScriptId?: string;
            scenarioId?: string;
            unlockingScriptId?: string;
        }
        • Optional debug?: Debug

          Enable compilation debugging information (default: false)

        • Optional lockingScriptId?: string

          If no unlocking script is used in the scenario, the identifier of the locking script to use in the source output slot. (Note: lockingScriptId should only be defined if unlockingScriptId is undefined.)

        • Optional scenarioId?: string

          The identifier of the scenario to generate

        • Optional unlockingScriptId?: string

          The identifier of the unlocking script to use in the scenario's input slot (the matching locking script will be used in the source output slot)

      Returns string | (Debug extends true ? ScenarioGenerationDebuggingResult<ProgramState> : Scenario)

Generated using TypeDoc