solc-js
solc-js copied to clipboard
Better document loadRemoteVersion
I'm trying to download versions of solidity using loadRemoteVersion
, however, when I run:
solc.loadRemoteVersion("0.8.7", (resp) => {})
If I do a console.log
where that method is defined, I get:
https://binaries.soliditylang.org/bin/soljson-v0.8.10.js
Which is blank. However https://binaries.soliditylang.org/bin/soljson-latest.js isn't
Am I doing something wrong?
Basically, I'm having a hard time installing or working with a different version. I can do it find with solc
and solc-select
via the command line.
But I'd love to be able to switch versions either in the command line or in my javascript.
Is this possible? Or do I have to write code to download different versions?
Or is the best way just to remove the package from node modules, change it in package-log.json, and then download the version I want?
You need to pass the long version string to loadRemoteVersion
, i.e.
solc.loadRemoteVersion("v0.8.7+commit.e28d00a7", (err, solc) => { console.log(err, solc); });
should work. You can extract the long version string for each version from https://binaries.soliditylang.org/bin/list.json
The full URL for 0.8.7 is https://binaries.soliditylang.org/bin/soljson-v0.8.7+commit.e28d00a7.js
We should probably document this much better...
Aha! I see! Thanks!
Could I leave this issue open for the moment till we get a docs PR in?
Yes please, keep it open 🙏 that's secret knowledge otherwise
Yay open source :)
I believe this issue can be closed @ekpyron
True. @r0qs fixed it in #658. Closing.