0.5.45 • Published 8 months ago

@remix-project/remix-solidity v0.5.45

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

Remix-Solidity

npm version npm npm GitHub contributions welcome

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

Installation

@remix-project/remix-solidity is an NPM package and can be installed using NPM as:

yarn add @remix-project/remix-solidity

How to use

@remix-project/remix-solidity exports:

    {
        Compiler: Compiler,
        CompilerInput: CompilerInput
    }

CompilerInput can be used to form the compiler input by passing the options

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 some code, do have a look to our contribution guidelnes here. Reach us on Gitter in case of any queries.

License

MIT © 2018-21 Remix Team

0.5.45

8 months ago

0.5.44

8 months ago

0.5.43

9 months ago

0.5.41

10 months ago

0.5.42

10 months ago

0.5.40

10 months ago

0.5.38

12 months ago

0.5.39

11 months ago

0.5.36

1 year ago

0.5.37

12 months ago

0.5.35

1 year ago

0.5.34

1 year ago

0.5.33

1 year ago

0.5.32

1 year ago

0.5.31

1 year ago

0.5.30

1 year ago

0.5.29

1 year ago

0.5.28

1 year ago

0.5.27

1 year ago

0.5.26

1 year ago

0.5.25

1 year ago

0.5.24

1 year ago

0.5.18

2 years ago

0.5.19

2 years ago

0.5.16

2 years ago

0.5.17

2 years ago

0.5.15

2 years ago

0.5.21

2 years ago

0.5.22

2 years ago

0.5.20

2 years ago

0.5.23

2 years ago

0.5.14

2 years ago

0.5.12

2 years ago

0.5.13

2 years ago

0.5.11

2 years ago

0.5.11-alpha.0

2 years ago

0.5.11-alpha.1

2 years ago

0.5.11-alpha.2

2 years ago

0.5.11-alpha.3

2 years ago

0.5.11-alpha.4

2 years ago

0.5.11-alpha.5

2 years ago

0.5.11-alpha.6

2 years ago

0.5.11-alpha.7

2 years ago

0.5.11-alpha.8

2 years ago

0.5.11-alpha.9

2 years ago

0.5.11-alpha.10

2 years ago

0.5.11-alpha.12

2 years ago

0.5.11-alpha.11

2 years ago

0.5.11-alpha.14

2 years ago

0.5.11-alpha.13

2 years ago

0.5.11-alpha.16

2 years ago

0.5.11-alpha.15

2 years ago

0.5.11-alpha.17

2 years ago

0.5.10

2 years ago

0.5.8

2 years ago

0.5.9

2 years ago

0.5.7

3 years ago

0.5.8-alpha.3

2 years ago

0.5.8-alpha.2

2 years ago

0.5.8-alpha.1

2 years ago

0.5.8-alpha.0

2 years ago

0.5.8-alpha.5

2 years ago

0.5.8-alpha.4

2 years ago

0.5.8-beta.0

2 years ago

0.5.4

3 years ago

0.5.3

3 years ago

0.5.6

3 years ago

0.5.5

3 years ago

0.5.2

3 years ago

0.5.2-alpha.0

3 years ago

0.5.1

3 years ago

0.4.13

3 years ago

0.4.12

3 years ago

0.5.0

3 years ago

0.4.11

3 years ago

0.4.10

3 years ago

0.4.9

4 years ago

0.4.8

4 years ago

0.4.7

4 years ago

0.4.6

4 years ago

0.4.5

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.1

4 years ago

0.4.2

4 years ago

0.4.0

4 years ago

0.3.35

4 years ago

0.3.34

4 years ago

0.3.33

5 years ago

0.3.32

5 years ago

0.3.31

5 years ago