Attributes
Includes Deno configuration
Repository
Current version released
2 years ago
Solidity bindings for Deno, based on solc-js.
Solidity 0.7+ is supported.
Docs
See solc-js README and Deno doc.
Example
import { wrapper } from 'https://deno.land/x/solc/mod.ts'
import { Input } from 'https://deno.land/x/solc/types.ts'
import { download } from 'https://deno.land/x/solc/download.ts'
import { createRequire } from 'https://deno.land/std@0.177.0/node/module.ts'
// Download latest Solidity compiler
await download()
const solc = wrapper(createRequire(import.meta.url)('./soljson.js'))
const MyToken = await Deno.readTextFile('./MyToken.sol')
const ERC20 = await Deno.readTextFile('./ERC20.sol')
const input: Input = {
language: 'Solidity',
sources: {
'MyToken.sol': {
content: MyToken,
},
'ERC20.sol': {
content: ERC20,
},
},
settings: {
outputSelection: {
'*': {
'*': ['*'],
},
},
},
}
console.log(JSON.parse(solc.compile(JSON.stringify(input))))
And then run with
deno run -allow-net --allow-read --allow-write mod.ts