# remix-solidity

> Tool to load and run Solidity compiler

Latest version **0.3.31** (published 2020-06-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install remix-solidity
pnpm add remix-solidity
yarn add remix-solidity
bun add remix-solidity
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.31 |
| Published | 2020-06-26 |
| First published | 2017-11-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 58.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1165 |
| Author | Remix Team |
| Maintainers | aniket-engg, grandschtroumpf, iurimatias, lianahus, yann300 |

## Links

- npm: https://www.npmjs.com/package/remix-solidity
- Repository: https://github.com/ethereum/remix/tree/master/remix-solidity
- Homepage: https://github.com/ethereum/remix/tree/master/remix-solidity#readme
- Issues: https://github.com/ethereum/remix/issues
- npm.io page: https://npm.io/package/remix-solidity

## Dependencies (4)

- [solc](https://npm.io/package/solc.md) ^0.6.0
- [remix-lib](https://npm.io/package/remix-lib.md) 0.4.30
- [webworkify](https://npm.io/package/webworkify.md) ^1.2.1
- [eslint-scope](https://npm.io/package/eslint-scope.md) ^5.0.0

## Recent versions

- 0.3.31 (latest) — 2020-06-26
- 0.3.29 (Dev2742) — 2020-04-25
- 0.3.30 — 2020-04-28
- 0.3.28 — 2020-04-23
- 0.3.27 — 2020-03-31
- 0.3.26 — 2020-02-21
- 0.3.25 — 2020-01-29
- 0.3.24 — 2020-01-28
- 0.3.23 — 2020-01-28
- 0.3.22 — 2020-01-10
- 0.3.21 — 2019-12-23
- 0.3.20 — 2019-12-10
- 0.3.19 — 2019-12-06
- 0.3.18 — 2019-12-03
- 0.3.17 — 2019-09-30
- … 56 more at https://npm.io/package/remix-solidity/versions

## README

## Remix-Solidity
[![npm version](https://badge.fury.io/js/remix-solidity.svg)](https://www.npmjs.com/package/remix-solidity)
[![npm](https://img.shields.io/npm/dt/remix-solidity.svg?label=Total%20Downloads)](https://www.npmjs.com/package/remix-solidity)
[![npm](https://img.shields.io/npm/dw/remix-solidity.svg)](https://www.npmjs.com/package/remix-solidity)
[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/ethereum/remix/tree/master/LICENSE)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/ethereum/remix/issues)


`remix-solidity` is a tool to load and run solidity compiler. It works underneath Remix IDE plugin "Solidity Compiler" which is used to load different versions of compiler and compile the smart contracts. 

### Installation

`npm install remix-solidity`

### How to use

`remix-solidity` exports:
```
    {
        Compiler: Compiler,
        CompilerInput: CompilerInput
    }
```
`CompilerInput` can be used to form the [compiler input](https://github.com/ethereum/remix/blob/remix-solidity-readme/remix-solidity/src/compiler/types.ts#L1) by passing the [options](https://github.com/ethereum/remix/blob/remix-solidity-readme/remix-solidity/src/compiler/types.ts#L144)

`Compiler` is a class containing various methods to perform compiler related actions. Have a look to `Compiler` interface:

```
class Compiler {
    handleImportCall: (fileurl: string, cb: Function) => void;
    event: EventManager;
    state: CompilerState;
    constructor(handleImportCall: (fileurl: string, cb: Function) => void);
    /**
     * @dev Setter function for CompilerState's properties (used by IDE)
     * @param key key
     * @param value value of key in CompilerState
     */
    set<K extends keyof CompilerState>(key: K, value: CompilerState[K]): void;
    /**
     * @dev Internal function to compile the contract after gathering imports
     * @param files source file
     * @param missingInputs missing import file path list
     */
    internalCompile(files: Source, missingInputs?: string[]): void;
    /**
     * @dev Compile source files (used by IDE)
     * @param files source files
     * @param target target file name (This is passed as it is to IDE)
     */
    compile(files: Source, target: string): void;
    /**
     * @dev Called when compiler is loaded, set current compiler version
     * @param version compiler version
     */
    onCompilerLoaded(version: string): void;
    /**
     * @dev Called when compiler is loaded internally (without worker)
     */
    onInternalCompilerLoaded(): void;
    /**
     * @dev Called when compilation is finished
     * @param data compilation result data
     * @param missingInputs missing imports
     * @param source Source
     */
    onCompilationFinished(data: CompilationResult, missingInputs?: string[], source?: SourceWithTarget): void;
    /**
     * @dev Load compiler using given URL (used by IDE)
     * @param usingWorker if true, load compiler using worker
     * @param url URL to load compiler from
     */
    loadVersion(usingWorker: boolean, url: string): void;
    /**
     * @dev Load compiler using 'script' element (without worker)
     * @param url URL to load compiler from
     */
    loadInternal(url: string): void;
    /**
     * @dev Load compiler using web worker
     * @param url URL to load compiler from
     */
    loadWorker(url: string): void;
    /**
     * @dev Gather imports for compilation
     * @param files file sources
     * @param importHints import file list
     * @param cb callback
     */
    gatherImports(files: Source, importHints?: string[], cb?: gatherImportsCallbackInterface): void;
    /**
     * @dev Truncate version string
     * @param version version
     */
    truncateVersion(version: string): string;
    /**
     * @dev Update ABI according to current compiler version
     * @param data Compilation result
     */
    updateInterface(data: CompilationResult): CompilationResult;
    /**
     * @dev Get contract obj of the given contract name from last compilation result.
     * @param name contract name
     */
    getContract(name: string): Record<string, any> | null;
    /**
     * @dev Call the given callback for all the contracts from last compilation result
     * @param cb callback
     */
    visitContracts(cb: visitContractsCallbackInterface): void | null;
    /**
     * @dev Get the compiled contracts data from last compilation result
     */
    getContracts(): CompilationResult['contracts'] | null;
    /**
     * @dev Get sources from last compilation result
     */
    getSources(): Source | null | undefined;
    /**
     * @dev Get sources of passed file name from last compilation result
     * @param fileName file name
     */
    getSource(fileName: string): Source['filename'] | null;
    /**
     * @dev Get source name at passed index from last compilation result
     * @param index    - index of the source
     */
    getSourceName(index: number): string | null;
}
```

## Contribute

Please feel free to open an issue or a pull request. 

In case you want to add a code, do have a look to our contribution guidelnes [here](https://github.com/ethereum/remix/blob/master/CONTRIBUTING.md). Reach us in [Gitter](https://gitter.im/ethereum/remix) in case of any queries.

## License

[MIT](../LICENSE) © 2020 Remix Team

---
_Source: https://npm.io/package/remix-solidity · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
