You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `compile()` method always returns an object, which can contain `errors`, `sources` and `contracts` fields. `errors` is a list of error mesages.
@@ -87,6 +88,8 @@ The `compile()` method always returns an object, which can contain `errors`, `so
87
88
88
89
Starting from version 0.4.11 there is a new entry point named `compileStandardWrapper()` which supports Solidity's [standard JSON input and output](https://solidity.readthedocs.io/en/develop/using-the-compiler.html#compiler-input-and-output-json-description). It also maps old compiler output to it.
89
90
91
+
### Using with Electron
92
+
90
93
**Note:**
91
94
If you are using Electron, `nodeIntegration` is on for `BrowserWindow` by default. If it is on, Electron will provide a `require` method which will not behave as expected and this may cause calls, such as `require('solc')`, to fail.
92
95
@@ -97,21 +100,21 @@ new BrowserWindow({
97
100
webPreferences: {
98
101
nodeIntegration:false
99
102
}
100
-
});
103
+
})
101
104
```
102
105
103
106
### Using a Legacy Version
104
107
105
108
In order to compile contracts using a specific version of Solidity, the `solc.useVersion` method is available. This returns a new `solc` object that uses a version of the compiler specified. **Note**: version strings must match the version substring of the files available in `/bin/soljson-*.js`. See below for an example.
106
109
107
110
```javascript
108
-
var solc =require('solc');
111
+
var solc =require('solc')
109
112
// by default the latest version is used
110
113
// ie: solc.useVersion('latest')
111
114
112
115
// getting a legacy version
113
-
var solcV011 =solc.useVersion('v0.1.1-2015-08-04-6ff4cd6');
114
-
var output =solcV011.compile('contract t { function g() {} }', 1);
116
+
var solcV011 =solc.useVersion('v0.1.1-2015-08-04-6ff4cd6')
117
+
var output =solcV011.compile('contract t { function g() {} }', 1)
115
118
```
116
119
117
120
If the version is not available locally, you can use `solc.loadRemoteVersion(version, callback)` to load it directly from GitHub.
@@ -124,15 +127,15 @@ You can also load the "binary" manually and use `setupMethods` to create the fam
124
127
By default, the npm version is only created for releases. This prevents people from deploying contracts with non-release versions because they are less stable and harder to verify. If you would like to use the latest development snapshot (at your own risk!), you may use the following example code.
Note: in future versions of Solidity a more sophisticated linker architecture will be introduced. Once that changes, this method will still be usable for output created by old versions of Solidity.
@@ -153,9 +156,9 @@ The ABI generated by Solidity versions can differ slightly, due to new features
153
156
154
157
It can be used as:
155
158
```javascript
156
-
var abi =require('solc/abi');
159
+
var abi =require('solc/abi')
157
160
158
-
var inputABI = [{"constant":false,"inputs":[],"name":"hello","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"}];
161
+
var inputABI = [{"constant":false,"inputs":[],"name":"hello","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"}]
0 commit comments