Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ class EthereumChainService extends EventEmitter {
_exitHandler(code, signal) {
this._child = null;
if (code != null) {
this.emit("message",
this.emit("message",
"error",
`Blockchain process exited prematurely with code '${code}', due to signal '${signal}'.`,
);
} else {
this.emit("message",
this.emit("message",
"error",
`Blockchain process exited prematurely due to signal '${signal}'.`,
);
Expand All @@ -163,7 +163,7 @@ class EthereumChainService extends EventEmitter {

_stdHandler (stdio, data) {
// Remove all \r's and the final line ending
this.emit("message",
this.emit("message",
stdio,
data
.toString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,35 @@ class ServerScreen extends Component {
</div>
</section>

<section>
<h4>CONNECT TO SERVER</h4>
<div className="Row">
<div className="RowItem">
<div className="Switch">
<input
type="checkbox"
name="workspace.server.connectToServer"
id="workspace.server.connectToServer"
defaultChecked={
this.props.config.settings.workspace.server
.connectToServer
}
onChange={this.props.handleInputChange}
/>
<label htmlFor="workspace.server.connectToServer">
ENABLED
</label>
</div>
</div>
<div className="RowItem">
<p>
Connect to server specified above, or start a server with those settings.
Enabling this feature expects that you have a Ganache server running.
</p>
</div>
</div>
</section>

<section>
<h4>AUTOMINE</h4>
<div className="Row">
Expand Down Expand Up @@ -330,7 +359,7 @@ class ServerScreen extends Component {
</div>
</section>
</OnlyIf>

<section>
<h2>CHAIN FORKING</h2>
<OnlyIf test={!enabled}>
Expand Down Expand Up @@ -372,54 +401,54 @@ class ServerScreen extends Component {
<div className="RowItem">
<div className="Radio">
<label>
<input type="radio"
value={FORK_URLS.mainnet}
<input type="radio"
value={FORK_URLS.mainnet}
name="workspace.server.fork"
checked={this.props.config.settings.workspace.server.fork === FORK_URLS.mainnet}
onChange={this.validateChange.bind(this)}
checked={this.props.config.settings.workspace.server.fork === FORK_URLS.mainnet}
onChange={this.validateChange.bind(this)}
/>
Main Ethereum Network
</label>
</div>
<div className="Radio">
<label>
<input type="radio"
<input type="radio"
value={FORK_URLS.ropsten}
name="workspace.server.fork"
checked={this.props.config.settings.workspace.server.fork === FORK_URLS.ropsten}
onChange={this.validateChange.bind(this)}
checked={this.props.config.settings.workspace.server.fork === FORK_URLS.ropsten}
onChange={this.validateChange.bind(this)}
/>
Ropsten
</label>
</div>
<div className="Radio">
<label>
<input type="radio"
value={FORK_URLS.kovan}
<input type="radio"
value={FORK_URLS.kovan}
name="workspace.server.fork"
checked={this.props.config.settings.workspace.server.fork === FORK_URLS.kovan}
onChange={this.validateChange.bind(this)}
checked={this.props.config.settings.workspace.server.fork === FORK_URLS.kovan}
onChange={this.validateChange.bind(this)}
/>
Kovan
</label>
</div>
<div className="Radio">
<label>
<input type="radio"
value={FORK_URLS.rinkeby}
<input type="radio"
value={FORK_URLS.rinkeby}
name="workspace.server.fork"
checked={this.props.config.settings.workspace.server.fork === FORK_URLS.rinkeby}
onChange={this.validateChange.bind(this)}
checked={this.props.config.settings.workspace.server.fork === FORK_URLS.rinkeby}
onChange={this.validateChange.bind(this)}
/>
Rinkeby
</label>
</div><div className="Radio">
<label>
<input type="radio"
value={FORK_URLS.goerli}
<input type="radio"
value={FORK_URLS.goerli}
name="workspace.server.fork"
checked={this.props.config.settings.workspace.server.fork === FORK_URLS.goerli}
onChange={this.validateChange.bind(this)}
checked={this.props.config.settings.workspace.server.fork === FORK_URLS.goerli}
onChange={this.validateChange.bind(this)}
/>
Görli
</label>
Expand Down Expand Up @@ -452,13 +481,13 @@ class ServerScreen extends Component {
value={this.props.config.settings.workspace.server.fork_block_number || ""}
onChange={this.validateChange.bind(this)}
/>
</div>
</div>
<div className="RowItem">
<p>The URL of the block number to fork from, e.g., 56789</p>
</div>
</div>
</div>
</section>
</OnlyIf>
</OnlyIf>
</OnlyIf>
</section>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/main/types/settings/flavors/ethereum.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
unlocked_accounts: [],
locked: false,
vmErrorsOnRPCResponse: true,
connectToServer: true,
logger: null,
verbose: false,
gasLimit: 6721975,
Expand All @@ -22,4 +23,4 @@ module.exports = {
fork_block_number: null
},
projects: [],
}
}
8 changes: 7 additions & 1 deletion static/node/chain/chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ async function stopServer() {

async function startServer(options) {
await stopServer();

if (options.connectToServer) {
process.send({ type: "server-started", data: {

} });
return
}

let sanitizedOptions = Object.assign({}, options);
delete sanitizedOptions.mnemonic;

Expand Down