handle various compiler version from URL

pull/2707/head
Aniket-Engg 2 years ago committed by Aniket
parent c8b3ce3489
commit 8a7a53762e
  1. 9
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx

@ -309,7 +309,14 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
allVersions = [...allVersions, ...versions]
selectedVersion = state.defaultVersion
if (api.getCompilerParameters().version) selectedVersion = api.getCompilerParameters().version
if (api.getCompilerParameters().version) {
const versionFromURL = api.getCompilerParameters().version
// URL version can be like 0.8.7+commit.e28d00a7, 0.8.7 or soljson-v0.8.7+commit.e28d00a7.js
const selectedVersionArr = versions.filter(obj => obj.path === versionFromURL || obj.longVersion === versionFromURL || obj.version === versionFromURL)
// for version like 0.8.15, there will be more than one elements in the array
// In that case too, index 0 will have non-nightly version object
if (selectedVersionArr.length) selectedVersion = selectedVersionArr[0].path
}
// Check if version is a URL and corresponding filename starts with 'soljson'
if (selectedVersion.startsWith('https://')) {
const urlArr = selectedVersion.split('/')

Loading…
Cancel
Save