Skip to content

Commit

Permalink
Merge pull request #13 from tintinweb/ganacheErrorhandling
Browse files Browse the repository at this point in the history
better ganache errorhandling
  • Loading branch information
tintinweb authored Mar 7, 2022
2 parents 2ce7932 + 044c146 commit eee83c1
Show file tree
Hide file tree
Showing 6 changed files with 862 additions and 965 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Change Log
All notable changes will be documented in this file.

## v0.0.11
- new: configurable call and deploy gas
- new: `.restartblockchain` command to restart ganache e.g. after config changes
- fix: fixed returnval for some keywords
- fix: show result for functions declaring multiple return vals
- fix: naive fix to resolve function declarations for multi returnval function invocations.

<img width="670" alt="image" src="https://user-images.githubusercontent.com/2865694/157049887-d8e8f763-94e4-43fa-bf23-042e2bbe90d9.png">

## v0.0.10
- new: update to solc@0.8.11
- new: basic autocomplete for built-ins (configurable via `.config`) - #11
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ An interactive Solidity shell with lightweight session recording and remote comp
352
```

Oh, did you know that we automatically fetch a matching remote compiler when you change the solidity pragma? It is as easy as typing `pgrama solidity 0.5.0` and solidity-shell will do the rest 🙌.
Oh, did you know that we automatically fetch a matching remote compiler when you change the solidity pragma? It is as easy as typing `pragma solidity 0.5.0` and solidity-shell will do the rest 🙌.



### Hints

* `pragma solidity <version>` attempts to dynamically load the selected compiler version (remote compiler, may take a couple of seconds).
* use `{ <statement>; }` to ignore a calls return value.
* Sessions can be saved and restored using the `.session` command. Your previous session is always stored and can be loaded via `.session load previous` (not safe when running concurrent shells).
* `.reset` completely removes all statements. `.undo` removes the last statement.
* See what's been generated under the hood? call `.dump`.
Expand Down
15 changes: 12 additions & 3 deletions bin/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ vorpal
${c.bold('General:')}
.help ... this help :)
.exit ... exit the shell
.restartblockchain ... restart the ganache blockchain service
${c.bold('Settings:')}
.config ... show settings
Expand All @@ -128,6 +129,7 @@ cheers 🙌

break; //show usage
case '.exit': process.exit(); break; //exit -> no more cb()
case '.restartblockchain': shell.blockchain.restartService(); break; //restart ganache
case '.reset': shell.reset(); break; //reset complete state
case '.undo': shell.revert(); break; //revert last action
case '.config':
Expand Down Expand Up @@ -187,10 +189,15 @@ cheers 🙌
/* REPL cmd */
shell.run(statement).then(res => {
if(!Array.isArray(res) && typeof res === 'object'){
return cb();
}
LAST_KNOWN_RESULT = res;
if(Object.keys(res).length === 0) {
// empty response, hide
return cb();
}
res = JSON.stringify(res); //stringify the result
}
LAST_KNOWN_RESULT = res; // can only store last result for simple types
cb(c.bold(c.yellow(res)));

}).catch(errors => {
console.error(errors)
cb()
Expand All @@ -206,6 +213,8 @@ vorpal
vorpal
.command(".exit")
.alias("exit")
vorpal
.command(".restartblockchain")
vorpal
.command(".config")
.autocomplete(["set","unset"])
Expand Down
Loading

0 comments on commit eee83c1

Please sign in to comment.