fixes to getVersion function

pull/5370/head
Joseph Izang 6 months ago
parent 944326113c
commit 06d70495ad
  1. 10
      libs/remix-ui/run-tab/src/lib/run-tab.tsx
  2. 6
      libs/remix-ui/run-tab/src/lib/types/index.ts

@ -83,18 +83,18 @@ export function RunTabUI(props: RunTabProps) {
const [solcVersion, setSolcVersion] = useState<{version: string, canReceive: boolean}>({ version: '', canReceive: true }) const [solcVersion, setSolcVersion] = useState<{version: string, canReceive: boolean}>({ version: '', canReceive: true })
const getVersion = () => { const getVersion = () => {
let version = '' let version = '0.8.25'
try { try {
version = window.location.href.split('=')[5].split('+')[0].split('-')[1].slice(1) ?? 'v0.8.25' version = window.location.href.split('=')[5].split('+')[0].split('-')[1].slice(1) ?? '0.8.25'
if (parseFloat(version) < 0.6) { if (parseFloat(version) < 0.6) {
setSolcVersion({ version: version, canReceive: false }) setSolcVersion({ version: version, canReceive: false })
} } else {
setSolcVersion({ version: version, canReceive: true }) setSolcVersion({ version: version, canReceive: true })
}
} catch (e) { } catch (e) {
version = window.location.href.split('=')[5].split('+')[0].split('-')[1].slice(1) ?? 'v0.8.25' setSolcVersion({ version, canReceive: true })
console.log(e) console.log(e)
} }
return version
} }
useEffect(() => { useEffect(() => {

@ -283,7 +283,7 @@ export interface ContractDropdownProps {
setCompilerVersion: React.Dispatch<React.SetStateAction<{ setCompilerVersion: React.Dispatch<React.SetStateAction<{
version: string; version: string;
canReceive: boolean;}>> canReceive: boolean;}>>
getCompilerVersion: () => string getCompilerVersion: () => void
} }
export interface RecorderProps { export interface RecorderProps {
@ -349,7 +349,7 @@ export interface InstanceContainerProps {
editInstance: (instance) => void editInstance: (instance) => void
plugin: RunTab plugin: RunTab
solcVersion: { version: string, canReceive: boolean } solcVersion: { version: string, canReceive: boolean }
getVersion: () => string getVersion: any
} }
export interface Modal { export interface Modal {
@ -408,7 +408,7 @@ export interface ContractGUIProps {
setSolcVersion?: React.Dispatch<React.SetStateAction<{ setSolcVersion?: React.Dispatch<React.SetStateAction<{
version: string; version: string;
canReceive: boolean;}>> canReceive: boolean;}>>
getVersion: () => string getVersion: () => void
} }
export interface MainnetProps { export interface MainnetProps {
network: Network, network: Network,

Loading…
Cancel
Save