2
GitHub - deno-web3/solc: 💎 Solidity bindings for Deno
source link: https://github.com/deno-web3/solc
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Example
import { download } from 'https://deno.land/x/solc/download.ts' import { setupMethods } from 'https://deno.land/x/solc/wrapper.ts' import 'https://deno.land/x/solc/process.ts' import { createRequire } from 'https://deno.land/[email protected]/node/module.ts' import { exists } from 'https://deno.land/x/solc/utils.ts' if (!(await exists('./soljson.js'))) download('./soljson.js') const require = createRequire(import.meta.url) const solc = setupMethods(require('./soljson.js')) const input = { language: 'Solidity', sources: { 'test.sol': { content: 'contract C { function f() public { } }' } }, settings: { outputSelection: { '*': { '*': ['*'] } } } } const result = JSON.parse(solc.compile(JSON.stringify(input))) const { contracts } = result // `output` here contains the JSON output as specified in the documentation for (const contractName in contracts['test.sol']) { console.log(`${contractName}: ${contracts['test.sol'][contractName].evm.bytecode.object}`) }
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK