{"library":"remix-solidity","title":"remix-solidity","description":"Tool to load and run the Solidity compiler. Version 0.3.31 integrates with Remix IDE to compile smart contracts. It provides the Compiler class and CompilerInput helper for building compiler input JSON. Supports loading compiler versions via web worker or script tag, handling imports, and returning compilation results including ABI, bytecode, and source maps. Part of the Remix project, it is maintained with regular releases.","language":"javascript","status":"active","last_verified":"Fri May 01","install":{"commands":["npm install remix-solidity"],"cli":null},"imports":["import { Compiler } from 'remix-solidity'","import { CompilerInput } from 'remix-solidity'","import { CompilerInput } from 'remix-solidity'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { Compiler, CompilerInput } from 'remix-solidity';\n\n// Create a custom import handler\nconst handleImportCall = (fileurl: string, cb: (error: Error | null, content?: string) => void) => {\n  if (fileurl === 'imported.sol') {\n    cb(null, 'contract Imported {}');\n  } else {\n    cb(new Error('File not found'));\n  }\n};\n\n// Instantiate the compiler\nconst compiler = new Compiler(handleImportCall);\n\n// Define source files\nconst sources = {\n  'MyContract.sol': {\n    content: `\npragma solidity ^0.8.0;\ncontract MyContract {\n    uint256 public value;\n    constructor() {\n        value = 42;\n    }\n}`\n  }\n};\n\n// Listen for compilation events\ncompiler.event.register('compilationFinished', (success: boolean, data: any, source: any) => {\n  if (success) {\n    console.log('Compilation success:', data.contracts['MyContract.sol'].MyContract);\n  } else {\n    console.error('Compilation error:', data);\n  }\n});\n\n// Compile\ncompiler.compile(sources, 'MyContract.sol');","lang":"typescript","description":"Shows how to instantiate Compiler with a custom import handler, define a Solidity source, listen for compilation events, and compile.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}