solc-js icon indicating copy to clipboard operation
solc-js copied to clipboard

Better document loadRemoteVersion

Open PatrickAlphaC opened this issue 2 years ago • 6 comments

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?

PatrickAlphaC avatar Jan 20 '22 02:01 PatrickAlphaC

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?

PatrickAlphaC avatar Jan 20 '22 02:01 PatrickAlphaC

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?

PatrickAlphaC avatar Jan 20 '22 03:01 PatrickAlphaC

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...

ekpyron avatar Jan 20 '22 09:01 ekpyron

Aha! I see! Thanks!

Could I leave this issue open for the moment till we get a docs PR in?

PatrickAlphaC avatar Jan 21 '22 00:01 PatrickAlphaC

Yes please, keep it open 🙏 that's secret knowledge otherwise

Elyx0 avatar Jan 21 '22 02:01 Elyx0

Yay open source :)

PatrickAlphaC avatar Jan 21 '22 03:01 PatrickAlphaC

I believe this issue can be closed @ekpyron

alexreyes avatar Jan 24 '23 20:01 alexreyes

True. @r0qs fixed it in #658. Closing.

cameel avatar Jan 25 '23 00:01 cameel