Solidity Compiler
Name in Remix:
solidity
kind:
compiler
|Type |Name |Description |
|———|———————–|————|
|event |compilationFinished
|Triggered when a compilation finishes.
|method |getCompilationResult
|Get the current result of the compilation.
|method |compile
|Run solidity compiler with a file.
Examples
Events
compilationFinished
:
client.solidity.on('compilationFinished', (fileName: string, source: CompilationFileSources, languageVersion: string, data: CompilationResult) => {
// Do something
})
// OR
client.on('solidity', 'compilationFinished', (fileName: string, source: CompilationFileSources, languageVersion: string, data: CompilationResult) => {
// Do something
})
Methods
getCompilationResult
:
const result = await client.solidity.getCompilationResult()
// OR
const result = await client.call('solidity', 'getCompilationResult')
compile
:
const fileName = 'browser/ballot.sol'
await client.solidity.compile(fileName)
// OR
await client.call('solidity', 'compile', 'fileName')
Types
CompilationFileSources
: A map with the file name as the key and the content as the value.
CompilationResult
: The result of the compilation matches the Solidity Compiler Output documentation.
Type Definitions can be found here