Socket
Socket
Sign inDemoInstall

browser-solc

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    browser-solc

A wrapper of solc so that you can compile contracts in the browser


Version published
Weekly downloads
18
increased by500%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

browser-solc

About the fork

Forked from https://github.com/ericxtang/browser-solc to wrap it into a npm package so that it can be easily imported into a Webpack (or another bundler) web app.

Solc

Solc is the solidity compiler. It usually runs on the Ethereum node. Browser-solidity is an example for Solc in the browser, but it's hard to pick apart just the solc library from the entire application. This repo is a wrapper that helps you do that. browser-solc is a browserified version of solc-js.

#Demo app

You should use browser-solc if you:

  • Want to do solc.compile() in your Dapp
  • Don't want to worry about browserify the solc-js npm package

Installation

npm install --save browser-solc

Usage:

import browserSolc from 'browser-solc';
// After importing, the BrowserSolc will be loaded into the window object. This is required as it was built with browserify.

//Get a list of all possibile solc versions
BrowserSolc.getVersions(function(soljsonSources, soljsonReleases) {
  console.log(soljsonSources);
  console.log(soljsonReleases);
});

//Load a specific compiler version
BrowserSolc.loadVersion("soljson-v0.4.6+commit.2dabbdf0.js", function(compiler) {
  source = 'contract x { function g() {} }';
  optimize = 1;
  result = compiler.compile(source, optimize);
  console.log(result);
});

Development

To build index.js, run npm run build.

Note: browser-solc does NOT implement the whole interface of solc-js.

Keywords

FAQs

Last updated on 09 Apr 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc