tintinweb / solidity-shell Goto Github PK
View Code? Open in Web Editor NEWAn interactive Solidity Shell
Home Page: https://www.npmjs.com/package/solidity-shell
An interactive Solidity Shell
Home Page: https://www.npmjs.com/package/solidity-shell
It seems that the truffle suite is being sunset based on this announcement of Consensys.
Might some migrations be taken to keep this package more up-to-date?
Maybe it's me but reading https://eips.ethereum.org/EIPS/eip-1155 I see
Inside the contract code the two pieces of data needed to access the individual non-fungible can be extracted with uint128(~0) and the same mask shifted by 128.
But solidity shell throws when inputting uint128(~0)
with:
{
component: 'general',
errorCode: '9640',
formattedMessage: 'TypeError: Explicit type conversion not allowed from "int_const -1" to "uint128".\n' +
'\n',
message: 'Explicit type conversion not allowed from "int_const -1" to "uint128".',
severity: 'error',
sourceLocation: { end: 276, file: '', start: 265 },
type: 'TypeError'
}
Recently when I run this script some compiling error occurred permanently!
The error is => ( SyntaxError: Unexpected token '.' ) which is related to the web3-core-method folder!
I looked for a relevant solution but I can't find anything :(
FYI, the solidity-shell npm module fails to install if ganache-cli is not present on the system. You may want to include a blurb about installing that first or maybe include it in your dependencies.
I am trying to do a for loop, but failing, am I doing something wrong?
» uint[] memory a = new uint[](2)
» for (uint i; i < 2; i++) {
multi> a[i] = i;
multi> }
» a
[
{
component: 'general',
errorCode: '6933',
formattedMessage: 'ParserError: Expected primary expression.\n\n',
message: 'Expected primary expression.',
severity: 'error',
sourceLocation: { end: 255, file: '', start: 254 },
type: 'ParserError'
}
]
Inlining doesn't help either:
» .undo
» for (uint i; i<2; i++) { a[i] = i; }
» a
[
{
component: 'general',
errorCode: '6933',
formattedMessage: 'ParserError: Expected primary expression.\n\n',
message: 'Expected primary expression.',
severity: 'error',
sourceLocation: { end: 255, file: '', start: 254 },
type: 'ParserError'
}
]
I retried on windows
node v16.13.2
npm 8.5.4
npm install -g solidity-shell ganache-cli
starting solidity-shell
was giving:
🚀 Entering interactive Solidity ^0.8.11 shell. '.help' and '.exit' are your friends.
» ℹ️ ganache-mgr: starting temp. ganache instance ...
»
🧨 Unable to launch blockchain serivce: ➜ ℹ️ Error: spawn ganache-cli ENOENT
Please verify that 'ganache-cli' (or similar service) is installed and available in your PATH.
Otherwise, you can disable autostart by setting 'autostartGanache' to false in your settings or configure a different service and
'.restartblockchain'.
I had to npm install -g ganache
and ganache
running in one terminal before starting solidity-shell
in another. Cheers
As the title suggests, it looks like block and other global variables are missing on this shell
Here's my console output:
» block
[
{
component: 'general',
errorCode: '5172',
formattedMessage: 'TypeError: Name has to refer to a struct, enum or contract.\n\n',
message: 'Name has to refer to a struct, enum or contract.',
severity: 'error',
sourceLocation: { end: 144, file: '', start: 139 },
type: 'TypeError'
}
]
Whereas msg
seems to be there, even though you can refer to it (!?) But just to its internal properties
» msg
[
{
component: 'general',
errorCode: '5172',
formattedMessage: 'TypeError: Name has to refer to a struct, enum or contract.\n\n',
message: 'Name has to refer to a struct, enum or contract.',
severity: 'error',
sourceLocation: { end: 142, file: '', start: 139 },
type: 'TypeError'
}
]
» msg.data
0xdffeadd0
I noticed that this project is invoking abi-to-sol by asking for Solidity v0.8.9, which differs from this project's solc dependency version of ^0.8.15
. This probably isn't a big deal, but in the future it might make sense to align this generateSolidity({ solidityVersion })
field more formally with the version of solc that's running in this shell.
Note that this field accepts a semver range, and abi-to-sol seeks to output Solidity that is valid across all versions in that range... so you can probably start by doing a require("../../package.json").dependencies["solc"]
or such and just use that instead of hardcoding some kind of version or version range literal.
Recently when I run this script some compiling error occurred permanently!
The error is => ( SyntaxError: Unexpected token '.' ) which is related to the web3-core-method folder!
I looked for a relevant solution but I can't find anything :(
Issue: while fetching interfaces, the Ethescan api rate limit of 1req/5sec is hit.
Solution: allowing users to set an Etherscan api key, which would then be used (adding &apiKey=...
to
Hi, I am new to solidity and I am looking for a way how to quickly test snippets of solidity code, much like I am using dev tools in a browser. I heard yours is a good solution.
I just tried to install your package and I get this error with ganache-mgr
. Do you know what might be the problem?
C:\Users\Qwerty>npm i solidity-shell -g
npm WARN deprecated [email protected]: This package is broken and no longer maintained. 'mkdirp' itself supports promises now, please switch to that.
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
added 426 packages, and audited 428 packages in 1m
3 vulnerabilities (2 high, 1 critical)
Some issues need review, and may require choosing
a different dependency.
Run `npm audit` for details.
C:\Users\Qwerty>solidity-shell
🚀 Entering interactive Solidity ^0.8.7 shell. '.help' and '.exit' are your friends.
» ℹ️ ganache-mgr: starting temp. ganache instance ...
»
💀 ganache-mgr: stopping temp. ganache instance
events.js:353
throw er; // Unhandled 'error' event
^
Error: spawn ganache-cli ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
at onErrorNT (internal/child_process.js:467:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
at onErrorNT (internal/child_process.js:467:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn ganache-cli',
path: 'ganache-cli',
spawnargs: []
}
C:\Users\Qwerty>npm -v
7.24.2
C:\Users\Qwerty>node -v
v14.17.0
:)
Thanks for the work.
This line throws after a fresh install on Big Sur. I fixed it by changing the ~/.solidity-shell/.config
providerUrl
value from http://localhost:8545
to http://127.0.0.1:8545
. I was going to submit a PR, but assumed there might be security implications to this change. Given it's a one-liner, you can make it if you deem it safe enough :)
» address[] storage arr;
» arr
[
{
component: 'general',
errorCode: '6651',
formattedMessage: 'TypeError: Data location must be "memory" or "calldata" for return parameter in function, but "storage" was given.\n' +
'\n',
message: 'Data location must be "memory" or "calldata" for return parameter in function, but "storage" was given.',
severity: 'error',
sourceLocation: { end: 165, file: '', start: 140 },
type: 'TypeError'
}
]
» address[] memory arr2;
» arr2
» type(arr2)
BUG: cannot resolve type ://
[
{
component: 'general',
errorCode: '4259',
formattedMessage: 'TypeError: Invalid type for argument in the function call. An enum type, contract type or an integer type is required, but address[] provided.\n' +
'\n',
message: 'Invalid type for argument in the function call. An enum type, contract type or an integer type is required, but address[] provided.',
severity: 'error',
sourceLocation: { end: 248, file: '', start: 244 },
type: 'TypeError'
}
]
»
What should be done?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.