1.0.4 • Published 8 months ago

@ethereum-sourcify/compilers v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

compilers

Wrapper around multiple compilers to download the right version and invoke the compilation with a common interface.

Install

npm i @ethereum-sourcify/compilers

Usage

import {
  SolidityOutput,
  ISolidityCompiler,
  JsonInput,
} from '@ethereum-sourcify/lib-sourcify';
import { useSolidityCompiler } from '@ethereum-sourcify/compilers';

class SolcLocal implements ISolidityCompiler {
  constructor(
    private solcRepoPath: string,
    private solJsonRepoPath: string,
  ) {}

  async compile(
    version: string,
    solcJsonInput: JsonInput,
    forceEmscripten: boolean = false,
  ): Promise<SolidityOutput> {
    return await useSolidityCompiler(
      this.solcRepoPath,
      this.solJsonRepoPath,
      version,
      solcJsonInput,
      forceEmscripten,
    );
  }
}

The SolcLocal class can then be used as the solidityCompiler argument of the constructor of SolidityCheckedContract. Vyper follows the same pattern.

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

9 months ago

1.0.0

10 months ago