mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-22 20:48:01 +00:00
e07d0f0cb7
- Move npm package from paritytech/js-revive - Rename package to `@parity/resolc`
39 lines
773 B
JavaScript
39 lines
773 B
JavaScript
const { compile } = require("./revive.js");
|
|
|
|
const compilerStandardJsonInput = {
|
|
language: "Solidity",
|
|
sources: {
|
|
"MyContract.sol": {
|
|
content: `
|
|
// SPDX-License-Identifier: UNLICENSED
|
|
pragma solidity ^0.8.0;
|
|
contract MyContract {
|
|
function greet() public pure returns (string memory) {
|
|
return "Hello";
|
|
}
|
|
}
|
|
`,
|
|
},
|
|
},
|
|
settings: {
|
|
optimizer: {
|
|
enabled: true,
|
|
runs: 200,
|
|
},
|
|
outputSelection: {
|
|
"*": {
|
|
"*": ["abi"],
|
|
},
|
|
},
|
|
},
|
|
};
|
|
|
|
async function runCompiler() {
|
|
let output = await compile(compilerStandardJsonInput);
|
|
console.log("Output: " + output);
|
|
}
|
|
|
|
runCompiler().catch((err) => {
|
|
console.error("Error:", err);
|
|
});
|