Type alias Compiler<CompilationContext, Configuration, ProgramState>

Compiler<CompilationContext, Configuration, ProgramState>: {
    configuration: Configuration;
    generateBytecode: (<Debug>({ data, debug, scriptId, }) => Debug extends true
        ? CompilationResult<ProgramState>
        : BytecodeGenerationResult<ProgramState>);
    generateScenario: (<Debug>({ debug, lockingScriptId, scenarioId, unlockingScriptId, }) => string | (Debug extends true
        ? ScenarioGenerationDebuggingResult<ProgramState>
        : Scenario));
}

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

Type Parameters

Type declaration

  • configuration: Configuration
  • generateBytecode: (<Debug>({ data, debug, scriptId, }) => Debug extends true
        ? CompilationResult<ProgramState>
        : BytecodeGenerationResult<ProgramState>)

    Generate the bytecode for the given script and compilation data.

  • generateScenario: (<Debug>({ debug, lockingScriptId, scenarioId, unlockingScriptId, }) => 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).

      • <Debug>({ debug, lockingScriptId, scenarioId, unlockingScriptId, }): 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 = false

        Parameters

        • { debug, lockingScriptId, scenarioId, unlockingScriptId, }: {
              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