From e1b4657f6d5d15a5347bda884c8c955e555c035e Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 17 Jun 2024 18:29:08 +0200 Subject: [PATCH] fix get solidity version --- libs/remix-ui/run-tab/src/lib/run-tab.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/remix-ui/run-tab/src/lib/run-tab.tsx b/libs/remix-ui/run-tab/src/lib/run-tab.tsx index 262ffd3aba..68b66c13d6 100644 --- a/libs/remix-ui/run-tab/src/lib/run-tab.tsx +++ b/libs/remix-ui/run-tab/src/lib/run-tab.tsx @@ -1,5 +1,6 @@ // eslint-disable-next-line no-use-before-define import React, { Fragment, useEffect, useReducer, useState } from 'react' +import semver from 'semver' import { FormattedMessage } from 'react-intl' import { ModalDialog } from '@remix-ui/modal-dialog' // eslint-disable-next-line no-unused-vars @@ -85,8 +86,9 @@ export function RunTabUI(props: RunTabProps) { const getVersion = () => { let version = '0.8.25' try { - version = window.location.href.split('=')[5].split('+')[0].split('-')[1].slice(1) ?? '0.8.25' - if (parseFloat(version) < 0.6) { + const regVersion = window.location.href.match(/soljson-v(.*)\+commit/g) + if (regVersion && regVersion[1]) version = regVersion[1] + if (semver.lt(version, '0.6')) { setSolcVersion({ version: version, canReceive: false }) } else { setSolcVersion({ version: version, canReceive: true })