{"library":"solc-js","title":"solc-js","type":"library","description":"solc-js v1.0.1 is a cross-browser JavaScript bindings for the Solidity compiler, using Emscripten-compiled solc binaries from the solc-bin repository. It is designed as a smaller and faster alternative to the solc package for browser-only environments, while solc or solc-native are recommended for Node.js. It provides an async API to fetch compiler versions, compile Solidity source code, and resolve imports. It has a moderate release cadence and is maintained as part of the ethereum-play project on GitHub.","language":"javascript","status":"active","last_verified":"Fri May 01","install":{"commands":["npm install solc-js"],"cli":null},"imports":["import solcjs from 'solc-js'","import type { SolcJS, CompilerOutput } from 'solc-js'","const { versions } = await import('solc-js')","const { version2url } = await import('solc-js')"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":"https://ethereum.org","github":"https://github.com/ethereum-play/solc-js","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/solc-js","openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import solcjs, { versions } from 'solc-js';\n\nasync function compile() {\n  const allVersions = await versions();\n  console.log('Available releases:', allVersions.releases);\n  const version = allVersions.releases[0] || 'v0.8.20-stable-2023.06.13';\n  const compiler = await solcjs(version);\n  const source = `\n    pragma solidity ^0.8.0;\n    contract HelloWorld {\n      string public greeting = \"Hello, World!\";\n    }\n  `;\n  const output = await compiler(source);\n  console.log('Compiled bytecode:', output.bytecode);\n}\ncompile().catch(console.error);","lang":"typescript","description":"Import solc-js, fetch available versions, load a specific compiler, and compile a simple Solidity contract.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}