Merge pull request #15 from d11e9/organise-libs

organise libs, add readme and npm package.json
pull/1/head
chriseth 9 years ago
commit e0cf13c740
  1. 18
      README.md
  2. 211
      index.html
  3. 11
      index.js
  4. 0
      libs/mode-solidity.js
  5. 0
      libs/web3.min.js
  6. 24
      package.json
  7. 204
      stylesheets/browser-solidity.css

@ -0,0 +1,18 @@
#Browser-solidity
Browser solidity is a browser based solidity compiler. To use either visit [https://chriseth.github.io/browser-solidity](https://chriseth.github.io/browser-solidity) or clone/download this repo and open `index.html` in your browser.
#Nodejs usage
To use the solidity compiler via nodejs you can install it via npm
npm install --save solc
And then use it like so:
var solc = require('solc');
var input = "contract x { function g() {} }";
var output = solc.compile(input, 1); // 1 activates the optimiser
for (var contractName in output.contracts)
console.log(contractName + ': ' + output.contracts[contractName].bytecode);

@ -30,220 +30,17 @@ THE SOFTWARE.
<title>Solidity realtime compiler and runtime</title>
<link rel="stylesheet" href="stylesheets/styles.css">
<link rel="stylesheet" href="stylesheets/pygment_trac.css">
<link rel="stylesheet" href="stylesheets/browser-solidity.css">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<style type="text/css">
body {
padding: 0px;
font-size: 12px;
color: #111111;
}
#editor {
position: absolute;
top: 0;
left: 0px;
width: auto;
bottom: 0px;
right: 37em;
}
#input {
font-size: 15px;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
min-width: 20vw;
}
#righthand-panel {
position: absolute;
top: 0;
width: 37em;
max-width: 80vw;
right: 0;
bottom: 0px;
overflow: auto;
border-left: 1px dotted black;
box-sizing: border-box;
}
#output {
border-top: 1px dotted black;
display: block;
}
#header {
font-size: 14px;
padding: 1em;
font-size: 12px;
}
#header h1 {
margin-top: 0;
}
#header .info { clear: left; }
#header #solIcon {
float: left;
height: 5em;
}
.col1 {
width: 30%;
float: left;
}
.col2 {
width: 70%;
float: left;
}
.row {
overflow: auto;
}
.gethDeployText {
border-color: #bebebe;
height: 2.5em;
width: 100%;
display: block;
}
.contractInstance {
background-color: #ccc;
margin-bottom: 1em;
padding: 0.6em;
}
.contractInstance.hide > *:not(.title) {
display: none;
}
.contractInstance .contractProperty input,
.contractInstance .contractProperty button {
text-align: left;
padding: 0.3em;
width: 50%;
margin: 0;
}
.contractOutput .contractInstance .contractProperty {
margin-bottom: 0;
}
.contractOutput .contractInstance .contractProperty .output {
padding: 0.4em;
background-color: #333;
color: white;
margin-bottom: 1em;
display: block;
}
.contractInstance .contractProperty .output:empty { display: none; }
.contractOutput {
border-bottom: 1px dotted black;
padding: 0.6em;
box-sizing: border-box;
}
.contractOutput .contractProperty {
margin-bottom: 0.6em;
}
.contractOutput .contractProperty .output {
display: inline;
}
.contractOutput .body {
margin-top: 10px;
}
.contractOutput.hide {
background-color: #4C4C67;
color: white;
}
.contractOutput.hide > *:not(.title) {
display: none;
}
.title {
margin: 0;
cursor: pointer;
font-family: monospace;
font-weight: bold;
}
.title:before {
content: "\25BC";
opacity: 0.5;
margin-right: 0.4em;
font-size: 10px;
}
.hide > .title:before {
content: "\25B6";
}
.contractOutput > .title {
border-bottom: #4C4C67;
}
.title .size {
font-weight: normal;
float: right;
}
.solError {
position: absolute;
background-color: rgba(255, 0, 0, 0.2);
z-index:40;
}
.error {
background-color: rgba(255, 0, 0, 0.5);
border-radius: 0;
word-wrap: break-word;
border: 1px solid #D00909;
}
#ghostbar {
width: 1px;
background-color: red;
opacity: 0.5;
position: absolute;
cursor: col-resize;
z-index: 9999;
top: 0;
bottom: 0;
}
#dragbar{
background-color: transparent;
position: absolute;
width: 5px;
left: 0;
top: 0;
bottom: 0;
cursor: col-resize;
z-index: 999;
}
input[readonly] {
padding: .4em;
border: 1px solid #ccc;
box-sizing: border-box;
display: block;
width: 100%;
}
</style>
<script src="libs/jquery-2.1.3.min.js"></script>
<script src="libs/ace.js"></script>
<script src="mode-solidity.js"></script>
<script src="libs/mode-solidity.js"></script>
<script src="bin/soljson-latest.js"></script>
<script src="ethereumjs-vm.js"></script>
<script src="web3.min.js"></script>
<script src="libs/ethereumjs-vm.js"></script>
<script src="libs/web3.min.js"></script>
<script src="ballot.sol.js"></script>

@ -0,0 +1,11 @@
var soljson = require('./bin/soljson-latest.js');
compileJSON = soljson.cwrap("compileJSON", "string", ["string", "number"]);
module.exports = {
compile: function(input, optimise){
return JSON.parse( compileJSON(input, optimise) );
},
version: soljson.cwrap("version", "string", [])
}

@ -0,0 +1,24 @@
{
"name": "solc",
"version": "0.1.3-2",
"description": "Solidity compiler",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/chriseth/browser-solidity.git"
},
"keywords": [
"ethereum",
"solidity",
"compiler"
],
"author": "chriseth",
"license": "MIT",
"bugs": {
"url": "https://github.com/chriseth/browser-solidity/issues"
},
"homepage": "https://github.com/chriseth/browser-solidity#readme"
}

@ -0,0 +1,204 @@
body {
padding: 0px;
font-size: 12px;
color: #111111;
}
#editor {
position: absolute;
top: 0;
left: 0px;
width: auto;
bottom: 0px;
right: 37em;
}
#input {
font-size: 15px;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
min-width: 20vw;
}
#righthand-panel {
position: absolute;
top: 0;
width: 37em;
max-width: 80vw;
right: 0;
bottom: 0px;
overflow: auto;
border-left: 1px dotted black;
box-sizing: border-box;
}
#output {
border-top: 1px dotted black;
display: block;
}
#header {
font-size: 14px;
padding: 1em;
font-size: 12px;
}
#header h1 {
margin-top: 0;
}
#header .info { clear: left; }
#header #solIcon {
float: left;
height: 5em;
}
.col1 {
width: 30%;
float: left;
}
.col2 {
width: 70%;
float: left;
}
.row {
overflow: auto;
}
.gethDeployText {
border-color: #bebebe;
height: 2.5em;
width: 100%;
display: block;
}
.contractInstance {
background-color: #ccc;
margin-bottom: 1em;
padding: 0.6em;
}
.contractInstance.hide > *:not(.title) {
display: none;
}
.contractInstance .contractProperty input,
.contractInstance .contractProperty button {
text-align: left;
padding: 0.3em;
width: 50%;
margin: 0;
}
.contractOutput .contractInstance .contractProperty {
margin-bottom: 0;
}
.contractOutput .contractInstance .contractProperty .output {
padding: 0.4em;
background-color: #333;
color: white;
margin-bottom: 1em;
display: block;
}
.contractInstance .contractProperty .output:empty { display: none; }
.contractOutput {
border-bottom: 1px dotted black;
padding: 0.6em;
box-sizing: border-box;
}
.contractOutput .contractProperty {
margin-bottom: 0.6em;
}
.contractOutput .contractProperty .output {
display: inline;
}
.contractOutput .body {
margin-top: 10px;
}
.contractOutput.hide {
background-color: #4C4C67;
color: white;
}
.contractOutput.hide > *:not(.title) {
display: none;
}
.title {
margin: 0;
cursor: pointer;
font-family: monospace;
font-weight: bold;
}
.title:before {
content: "\25BC";
opacity: 0.5;
margin-right: 0.4em;
font-size: 10px;
}
.hide > .title:before {
content: "\25B6";
}
.contractOutput > .title {
border-bottom: #4C4C67;
}
.title .size {
font-weight: normal;
float: right;
}
.solError {
position: absolute;
background-color: rgba(255, 0, 0, 0.2);
z-index:40;
}
.error {
background-color: rgba(255, 0, 0, 0.5);
border-radius: 0;
word-wrap: break-word;
border: 1px solid #D00909;
}
#ghostbar {
width: 1px;
background-color: red;
opacity: 0.5;
position: absolute;
cursor: col-resize;
z-index: 9999;
top: 0;
bottom: 0;
}
#dragbar{
background-color: transparent;
position: absolute;
width: 5px;
left: 0;
top: 0;
bottom: 0;
cursor: col-resize;
z-index: 999;
}
input[readonly] {
padding: .4em;
border: 1px solid #ccc;
box-sizing: border-box;
display: block;
width: 100%;
}
Loading…
Cancel
Save