Skip to content

Commit

Permalink
fixes to getVersion function
Browse files Browse the repository at this point in the history
  • Loading branch information
joeizang committed Jun 11, 2024
1 parent e6eec05 commit b4e6865
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions libs/remix-ui/run-tab/src/lib/run-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,18 @@ export function RunTabUI(props: RunTabProps) {
const [solcVersion, setSolcVersion] = useState<{version: string, canReceive: boolean}>({ version: '', canReceive: true })

const getVersion = () => {
let version = ''
let version = '0.8.25'
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) {
setSolcVersion({ version: version, canReceive: false })
} else {
setSolcVersion({ version: version, canReceive: true })
}
setSolcVersion({ version: version, canReceive: true })
} catch (e) {
version = window.location.href.split('=')[5].split('+')[0].split('-')[1].slice(1) ?? 'v0.8.25'
setSolcVersion({ version, canReceive: true })
console.log(e)
}
return version
}

useEffect(() => {
Expand Down
6 changes: 3 additions & 3 deletions libs/remix-ui/run-tab/src/lib/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export interface ContractDropdownProps {
setCompilerVersion: React.Dispatch<React.SetStateAction<{
version: string;
canReceive: boolean;}>>
getCompilerVersion: () => string
getCompilerVersion: () => void
}

export interface RecorderProps {
Expand Down Expand Up @@ -349,7 +349,7 @@ export interface InstanceContainerProps {
editInstance: (instance) => void
plugin: RunTab
solcVersion: { version: string, canReceive: boolean }
getVersion: () => string
getVersion: any
}

export interface Modal {
Expand Down Expand Up @@ -408,7 +408,7 @@ export interface ContractGUIProps {
setSolcVersion?: React.Dispatch<React.SetStateAction<{
version: string;
canReceive: boolean;}>>
getVersion: () => string
getVersion: () => void
}
export interface MainnetProps {
network: Network,
Expand Down

0 comments on commit b4e6865

Please sign in to comment.