{"name":"solc","version":"0.8.35","keywords":["ethereum","solidity","compiler"],"author":{"name":"chriseth"},"license":"MIT","_id":"solc@0.8.35","maintainers":[{"name":"ekpyron","email":"daniel.kirchner@ethereum.org"},{"name":"cameel","email":"cameel2@gmail.com"},{"name":"r0qs","email":"rodrigo.saramago@argot.org"},{"name":"matheus.pit","email":"matheus.pit@gmail.com"},{"name":"clonker","email":"moritz.hoffmann91@gmail.com"},{"name":"nikola-matic","email":"nikola@argot.org"}],"homepage":"https://github.com/ethereum/solc-js#readme","bugs":{"url":"https://github.com/ethereum/solc-js/issues"},"bin":{"solcjs":"solc.js"},"nyc":{"exclude":["soljson.js","dist"]},"dist":{"shasum":"48f48d82d2ed49929953243066229fbf308938cb","tarball":"http://registry-npm.ywwl.com/solc/download/solc-0.8.35.tgz","fileCount":39,"integrity":"sha512-OaP/4zyoKRo2CjqZDxbtkeRlEo6MxP4FLCxntw1Agf9OSoecmwYKoFBSB34UcSKBFBucrTh3Mb0nRoJou62ibw==","signatures":[{"sig":"MEQCIBv/vq78EOLFiFyOpMlH0cWKls5rXhjWcqeikEUaJWc8AiBl5+7oNAEdE5+JvpS8xf9N/O8MGZPc71NlY186Rky8Yg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9476843,"size":6578305,"noattachment":false,"key":"/solc/-/solc-0.8.35.tgz"},"main":"index.js","_from":"file:solc-0.8.35.tgz","types":"index.d.ts","engines":{"node":">=12.0.0"},"scripts":{"lint":"eslint --ext .js,.ts .","test":"cd dist && tape ./test/index.js","build":"tsc","prepack":"node build/pack-publish-block.js","pretest":"npm run lint && npm run build && npm run copyTestFiles","coverage":"nyc npm run test","lint:fix":"eslint --fix --ext .js,.ts .","coveralls":"npm run coverage && coveralls <coverage/lcov.info","postbuild":"node build/postbuild.js && cp README.md LICENSE dist/","tarballName":"jq --raw-output '.name + \"-\" + .version + \".tgz\"' package.json","updateBinary":"node build/clean.js && ts-node ./downloadCurrentVersion.ts && ts-node ./verifyVersion.ts","build:tarball":"npm run updateBinary && npm run build && BYPASS_SAFETY_CHECK=true npm pack ./dist","copyTestFiles":"cp -r ./test/resources ./dist/test/","publish:tarball":"tarball=$(npm run --silent tarballName) && ls \"$tarball\" && BYPASS_SAFETY_CHECK=true npm publish \"$tarball\""},"_npmUser":{"name":"nikola-matic","email":"nikola@argot.org"},"_resolved":"/Users/stellarossa/Repos/solc-js/solc-0.8.35.tgz","_integrity":"sha512-OaP/4zyoKRo2CjqZDxbtkeRlEo6MxP4FLCxntw1Agf9OSoecmwYKoFBSB34UcSKBFBucrTh3Mb0nRoJou62ibw==","repository":{"url":"git+https://github.com/ethereum/solc-js.git","type":"git"},"_npmVersion":"11.5.1","description":"Solidity compiler","directories":{},"_nodeVersion":"24.5.0","dependencies":{"tmp":"0.0.33","semver":"^5.5.0","js-sha3":"0.8.0","commander":"^8.1.0","memorystream":"^0.3.1","command-exists":"^1.2.8","follow-redirects":"^1.12.1"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","tape":"^4.11.0","eslint":"^7.32.0","ts-node":"^10.4.0","coveralls":"^3.0.0","@types/tmp":"^0.2.3","tape-spawn":"^1.4.2","typescript":"^4.5.4","@types/node":"^16.11.7","@types/tape":"^4.13.2","@types/semver":"^7.3.9","eslint-plugin-node":"^11.1.0","eslint-plugin-import":"^2.25.3","eslint-plugin-promise":"^5.1.1","eslint-config-standard":"^16.0.3","@typescript-eslint/parser":"^5.8.0","@typescript-eslint/eslint-plugin":"^5.8.0"},"_npmOperationalInternal":{"tmp":"tmp/solc_0.8.35_1777457196143_0.0006962381733679468","host":"s3://npm-registry-packages-npm-production"},"readme":"[![CircleCI](https://img.shields.io/circleci/project/github/ethereum/solc-js/master.svg?style=flat-square)](https://circleci.com/gh/ethereum/solc-js/tree/master)\n[![Coverage Status](https://img.shields.io/coveralls/ethereum/solc-js.svg?style=flat-square)](https://coveralls.io/r/ethereum/solc-js)\n\n# solc-js\n\nJavaScript bindings for the [Solidity compiler](https://github.com/ethereum/solidity).\n\nUses the Emscripten compiled Solidity found in the [solc-bin repository](https://github.com/ethereum/solc-bin).\n\n## Node.js Usage\n\nTo use the latest stable version of the Solidity compiler via Node.js you can install it via npm:\n\n```bash\nnpm install solc\n```\n\n### Usage on the Command-Line\n\nIf this package is installed globally (`npm install -g solc`), a command-line tool called `solcjs` will be available.\n\nTo see all the supported features, execute:\n\n```bash\nsolcjs --help\n```\n\nTo compile a contract that imports other contracts via relative paths:\n```bash\nsolcjs --bin --include-path node_modules/ --base-path . MainContract.sol\n```\nUse the ``--base-path`` and ``--include-path`` options to describe the layout of your project.\n``--base-path`` represents the root of your own source tree while ``--include-path`` allows you to\nspecify extra locations containing external code (e.g. libraries installed with a package manager).\n\nNote: ensure that all the files you specify on the command line are located inside the base path or\none of the include paths.\nThe compiler refers to files from outside of these directories using absolute paths.\nHaving absolute paths in contract metadata will result in your bytecode being reproducible only\nwhen it's placed in these exact absolute locations.\n\nNote: this commandline interface is not compatible with `solc` provided by the Solidity compiler package and thus cannot be\nused in combination with an Ethereum client via the `eth.compile.solidity()` RPC method. Please refer to the\n[Solidity compiler documentation](https://solidity.readthedocs.io/) for instructions to install `solc`.\nFurthermore, the commandline interface to solc-js provides fewer features than the binary release.\n\n### Usage in Projects\n\nThere are two ways to use `solc`:\n\n1. Through a high-level API giving a uniform interface to all compiler versions\n2. Through a low-level API giving access to all the compiler interfaces, which depend on the version of the compiler\n\n#### High-level API\n\nThe high-level API consists of a single method, `compile`, which expects the [Compiler Standard Input and Output JSON](https://solidity.readthedocs.io/en/v0.5.0/using-the-compiler.html#compiler-input-and-output-json-description).\n\nIt also accepts an optional set of callback functions, which include the ``import`` and the ``smtSolver`` callbacks.\nStarting 0.6.0 it only accepts an object in place of the callback to supply the callbacks.\n\nThe ``import`` callback function is used to resolve unmet dependencies.\nThis callback receives a path and must synchronously return either an error or the content of the dependency\nas a string.  It cannot be used together with callback-based, asynchronous,\nfilesystem access. A workaround is to collect the names of dependencies, return\nan error, and keep re-running the compiler until all of them are resolved.\n\n#### Example usage without the import callback\n\nExample:\n\n```javascript\nvar solc = require('solc');\n\nvar input = {\n  language: 'Solidity',\n  sources: {\n    'test.sol': {\n      content: 'contract C { function f() public { } }'\n    }\n  },\n  settings: {\n    outputSelection: {\n      '*': {\n        '*': ['*']\n      }\n    }\n  }\n};\n\nvar output = JSON.parse(solc.compile(JSON.stringify(input)));\n\n// `output` here contains the JSON output as specified in the documentation\nfor (var contractName in output.contracts['test.sol']) {\n  console.log(\n    contractName +\n      ': ' +\n      output.contracts['test.sol'][contractName].evm.bytecode.object\n  );\n}\n```\n\n#### Example usage with import callback\n\n```javascript\nvar solc = require('solc');\n\nvar input = {\n  language: 'Solidity',\n  sources: {\n    'test.sol': {\n      content: 'import \"lib.sol\"; contract C { function f() public { L.f(); } }'\n    }\n  },\n  settings: {\n    outputSelection: {\n      '*': {\n        '*': ['*']\n      }\n    }\n  }\n};\n\nfunction findImports(path) {\n  if (path === 'lib.sol')\n    return {\n      contents:\n        'library L { function f() internal returns (uint) { return 7; } }'\n    };\n  else return { error: 'File not found' };\n}\n\n// New syntax (supported from 0.5.12, mandatory from 0.6.0)\nvar output = JSON.parse(\n  solc.compile(JSON.stringify(input), { import: findImports })\n);\n\n// `output` here contains the JSON output as specified in the documentation\nfor (var contractName in output.contracts['test.sol']) {\n  console.log(\n    contractName +\n      ': ' +\n      output.contracts['test.sol'][contractName].evm.bytecode.object\n  );\n}\n```\n\nSince version 0.5.1, the ``smtSolver`` callback function is used to solve SMT queries generated by\nSolidity's SMTChecker.  If you have an SMT solver installed locally, it can\nbe used to solve the given queries, where the callback must synchronously\nreturn either an error or the result from the solver.  A default\n``smtSolver`` callback is included in this package via the module\n``smtchecker.js`` which exports the ``smtCallback`` function that takes 1) a\nfunction that takes queries and returns the solving result, and 2) a solver\nconfiguration object. The module ``smtsolver.js`` has a few predefined solver\nconfigurations, and relies on Z3, Eldarica or cvc5 being installed locally.  It\nexports the list of locally found solvers and a function that invokes a given\nsolver.\n\nThe API of the SMT callback is **experimental** and can change at any time.\nThe last change was in version 0.8.11.\n\n#### Example usage with smtSolver callback\n\n```javascript\nvar solc = require('solc');\nconst smtchecker = require('solc/smtchecker');\nconst smtsolver = require('solc/smtsolver');\n// Note that this example only works via node and not in the browser.\n\nvar input = {\n  language: 'Solidity',\n  sources: {\n    'test.sol': {\n      content: 'contract C { function f(uint x) public { assert(x > 0); } }'\n    }\n  },\n  settings: {\n    modelChecker: {\n      engine: \"chc\",\n      solvers: [ \"smtlib2\" ]\n    }\n  }\n};\n\nvar output = JSON.parse(\n  solc.compile(\n    JSON.stringify(input),\n    { smtSolver: smtchecker.smtCallback(smtsolver.smtSolver, smtsolver.availableSolvers[0]) }\n  )\n);\n\n```\nThe assertion is clearly false, and an ``assertion failure`` warning\nshould be returned, together with a counterexample.\n\n#### Low-level API\n\nThe low-level API is as follows:\n\n- `solc.lowlevel.compileSingle`: the original entry point, supports only a single file\n- `solc.lowlevel.compileMulti`: this supports multiple files, introduced in 0.1.6\n- `solc.lowlevel.compileCallback`: this supports callbacks, introduced in 0.2.1\n- `solc.lowlevel.compileStandard`: this works just like `compile` above, but is only present in compilers after (and including) 0.4.11\n\nFor examples how to use them, please refer to the README of the above mentioned solc-js releases.\n\n**Note**: These low-level functions remain available for compatibility reasons.\nHowever, they were superseded by the `compile()` function and are no longer required.\nStarting from version `0.5.0+commit.1d4f565a`, the functions `compileSingle`, `compileMulti`, and `compileCallback` are always `null` when using newer solc binary versions.\nIt is recommended to use the latest release of solc-js, but it should also handle all the older solc binaries down to `0.1.x`.\n\n### Using with Electron\n\n**Note:**\nIf you are using Electron, `nodeIntegration` is on for `BrowserWindow` by default. If it is on, Electron will provide a `require` method which will not behave as expected and this may cause calls, such as `require('solc')`, to fail.\n\nTo turn off `nodeIntegration`, use the following:\n\n```javascript\nnew BrowserWindow({\n  webPreferences: {\n    nodeIntegration: false\n  }\n});\n```\n\n### Using a Legacy Version\n\nIn order to compile contracts using a specific version of Solidity, the `solc.loadRemoteVersion(version, callback)` method is available. This returns a new `solc` object that uses a version of the compiler specified.\n\nYou can also load the \"binary\" manually and use `setupMethods` to create the familiar wrapper functions described above:\n`var solc = solc.setupMethods(require(\"/my/local/soljson.js\"))`.\n\n### Using the Latest Development Snapshot\n\nBy default, the npm version is only created for releases. This prevents people from deploying contracts with non-release versions because they are less stable and harder to verify. If you would like to use the latest development snapshot (at your own risk!), you may use the following example code.\n\n```javascript\nvar solc = require('solc');\n\n// getting the development snapshot\nsolc.loadRemoteVersion('latest', function(err, solcSnapshot) {\n  if (err) {\n    // An error was encountered, display and quit\n  } else {\n    // NOTE: Use `solcSnapshot` here with the same interface `solc` has\n    // For example:\n    const output = solcSnapshot.compile(/* ... */)\n  }\n});\n```\n\nThe version **must** be in the long format.\nThus, if you would like to use version `v0.8.17` you need to include the commit hash of the release.\nYou can extract the long version string for each version from the [publicly available release list](https://binaries.soliditylang.org/bin/list.json).\n\n```javascript\nsolc.loadRemoteVersion('v0.8.17+commit.8df45f5f', function(err, solcSnapshot) { /* ... */ });\n```\n\n### Linking Bytecode\n\nWhen using libraries, the resulting bytecode will contain placeholders for the real addresses of the referenced libraries. These have to be updated, via a process called linking, before deploying the contract.\n\nThe `linker` module (`require('solc/linker')`) offers helpers to accomplish this.\n\nThe `linkBytecode` method provides a simple helper for linking:\n\n```javascript\nvar linker = require('solc/linker');\n\nbytecode = linker.linkBytecode(bytecode, { MyLibrary: '0x123456...' });\n```\n\nAs of Solidity 0.4.11 the compiler supports [standard JSON input and output](https://solidity.readthedocs.io/en/develop/using-the-compiler.html#compiler-input-and-output-json-description) which outputs a _link references_ map. This gives a map of library names to offsets in the bytecode to replace the addresses at. It also doesn't have the limitation on library file and contract name lengths.\n\nThere is a method available in the `linker` module called `findLinkReferences` which can find such link references in bytecode produced by an older compiler:\n\n```javascript\nvar linker = require('solc/linker');\n\nvar linkReferences = linker.findLinkReferences(bytecode);\n```\n\n### Updating the ABI\n\nThe ABI generated by Solidity versions can differ slightly, due to new features introduced. There is a tool included which aims to translate the ABI generated by an older Solidity version to conform to the latest standard.\n\nIt can be used as:\n\n```javascript\nvar abi = require('solc/abi');\n\nvar inputABI = [\n  {\n    constant: false,\n    inputs: [],\n    name: 'hello',\n    outputs: [{ name: '', type: 'string' }],\n    payable: false,\n    type: 'function'\n  }\n];\nvar outputABI = abi.update('0.3.6', inputABI);\n// Output contains: [{\"constant\":false,\"inputs\":[],\"name\":\"hello\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":true,\"type\":\"function\"},{\"type\":\"fallback\",\"payable\":true}]\n```\n\n### Formatting old JSON assembly output\n\nThere is a helper available to format old JSON assembly output into a text familiar to earlier users of Remix IDE.\n\n```\nvar translate = require('solc/translate')\n\n// assemblyJSON refers to the JSON of the given assembly and sourceCode is the source of which the assembly was generated from\nvar output = translate.prettyPrintLegacyAssemblyJSON(assemblyJSON, sourceCode)\n```\n\n## Browser Usage\n\nCompilation is generally a long-running and resource intensive task that cannot reasonably be performed in the main thread of the browser.\nSome browsers even disallow synchronous compilation on the main thread if the module is larger than 4KB.\nThus, the only supported way to use `solc` in a web browser is through a [web worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers).\n\n### Loading solc with web workers\n\nWeb Workers allow you to run javascript in the background in the browser, letting the browser's main thread free to do whatever it needs to do.\nPlease, see the minimal example of how to use `solc` with web workers below or check out this [repository](https://github.com/r0qs/solcjs-webworker-example) for a full demo.\n\n* index.html\n```html\n<!DOCTYPE html>\n<html>\n\n<head>\n\t<meta charset=\"utf-8\" />\n</head>\n\n<body>\n\t<script>\n\t\tvar worker = new Worker('./dist/bundle.js');\n\t\tworker.addEventListener('message', function (e) {\n\t\t\tconsole.log(e.data.version)\n\t\t}, false);\n\n\t\tworker.postMessage({})\n\t</script>\n</body>\n\n</html>\n```\n\n* worker.js:\n```javascript\nimportScripts('https://binaries.soliditylang.org/bin/soljson-v0.8.19+commit.7dd6d404.js')\nimport wrapper from 'solc/wrapper';\n\nself.addEventListener('message', () => {\n\tconst compiler = wrapper(self.Module)\n\tself.postMessage({\n\t\tversion: compiler.version()\n\t})\n}, false)\n```\n","publish_time":1777457196578,"_cnpm_publish_time":1777457196578,"dist-tags":{"latest":"0.8.38","series0.4":"0.4.26","series0.5":"0.5.17"}}