Skip to main content
logo

solc

nest badge

⚠️ Highly experimental!

Solidity v0.8.7 bindings for Deno, based on solc-js.

Docs

See solc-js README.

Example

import { solc } from 'https://x.nest.land/solc@0.0.4/mod.ts'

const input = {
  sources: {
    'test.sol': {
      content: 'contract C { function f() public { } }'
    }
  },
  settings: {
    outputSelection: {
      '*': {
        '*': ['*']
      }
    }
  }
}

const { contracts } = JSON.parse(solc.compile(JSON.stringify(input)))

// `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}`)
}

And then run with

deno run -A --unstable --no-check mod.js