Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
8b9a212d
Commit
8b9a212d
authored
Oct 16, 2015
by
chriseth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated npm package.
parent
ef674daa
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
5 deletions
+30
-5
README.md
README.md
+13
-0
index.js
index.js
+16
-4
package.json
package.json
+1
-1
No files found.
README.md
View file @
8b9a212d
...
@@ -16,3 +16,16 @@ And then use it like so:
...
@@ -16,3 +16,16 @@ And then use it like so:
var output = solc.compile(input, 1); // 1 activates the optimiser
var output = solc.compile(input, 1); // 1 activates the optimiser
for (var contractName in output.contracts)
for (var contractName in output.contracts)
console.log(contractName + ': ' + output.contracts[contractName].bytecode);
console.log(contractName + ': ' + output.contracts[contractName].bytecode);
Starting from version 0.1.6, multiple files are supported with automatic import resolution by the compiler as follows:
var solc = require('solc');
var input = {
'lib.sol': 'library L { function f() returns (uint) { return 7; } }',
'cont.sol': 'import "lib.sol"; contract x { function g() { L.f(); } }'
};
var output = solc.compile({sources: input}, 1);
for (var contractName in output.contracts)
console.log(contractName + ': ' + output.contracts[contractName].bytecode);
Note that all input files that are imported have to be supplied, the compiler will not load any additional files on its own.
index.js
View file @
8b9a212d
var
soljson
=
require
(
'./bin/soljson-latest.js'
);
var
soljson
=
require
(
'./bin/soljson-latest.js'
);
compileJSON
=
soljson
.
cwrap
(
"compileJSON"
,
"string"
,
[
"string"
,
"number"
]);
var
compileJSON
=
soljson
.
cwrap
(
"compileJSON"
,
"string"
,
[
"string"
,
"number"
]);
var
compileJSONMulti
=
'_compileJSONMulti'
in
soljson
?
soljson
.
cwrap
(
"compileJSONMulti"
,
"string"
,
[
"string"
,
"number"
])
:
null
;
var
compile
=
function
(
input
,
optimise
)
{
var
result
=
''
;
if
(
typeof
(
input
)
!=
typeof
(
''
)
&&
compileJSONMulti
!==
null
)
result
=
compileJSONMulti
(
JSON
.
stringify
(
input
),
optimise
);
else
result
=
compileJSON
(
input
,
optimise
);
return
JSON
.
parse
(
result
);
}
module
.
exports
=
{
module
.
exports
=
{
compile
:
function
(
input
,
optimise
){
compile
:
compile
,
return
JSON
.
parse
(
compileJSON
(
input
,
optimise
)
);
},
version
:
soljson
.
cwrap
(
"version"
,
"string"
,
[])
version
:
soljson
.
cwrap
(
"version"
,
"string"
,
[])
}
}
package.json
View file @
8b9a212d
{
{
"name"
:
"
solc
"
,
"name"
:
"
solc
"
,
"version"
:
"0.1.5"
,
"version"
:
"0.1.5
-multi
"
,
"description"
:
"Solidity compiler"
,
"description"
:
"Solidity compiler"
,
"main"
:
"index.js"
,
"main"
:
"index.js"
,
"scripts"
:
{
"scripts"
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment