fix function

pull/5367/head
Joseph Izang 3 weeks ago committed by Aniket
parent db26b53327
commit 6b79df94c4
  1. 16
      libs/remix-ui/run-tab/src/lib/components/environment.tsx
  2. 6
      libs/remix-ui/run-tab/src/lib/run-tab.tsx

@ -11,16 +11,6 @@ export function EnvironmentUI(props: EnvironmentProps) {
Object.entries(props.providers.providerList.filter((provider) => { return provider.isInjected }))
Object.entries(props.providers.providerList.filter((provider) => { return !(provider.isVM || provider.isInjected) }))
const EvaluateSelectionForCorrectness = async () => {
// if the evmVersion is not provided in the url, we use the default value
// and the default would be the latest evmFork, which is now cancun.
// checking both url and compiler details
const url = window.location.href
const regVersion = url.match(/evmVersion=([a-zA-Z]+)/)?.[1]
const fetched = await props.checkSelectionCorrectness()
return { regVersion, fetched }
}
const handleChangeExEnv = (env: string) => {
const provider = props.providers.providerList.find((exEnv) => exEnv.name === env)
const context = provider.name
@ -76,12 +66,10 @@ export function EnvironmentUI(props: EnvironmentProps) {
{ (props.providers.providerList.filter((provider) => { return provider.isInjected })).map(({ name, displayName }) => (
<Dropdown.Item
key={name}
onClick={() => {
onClick={async () => {
await props.checkSelectionCorrectness()
handleChangeExEnv(name)
}}
onSelect={() => {
EvaluateSelectionForCorrectness()
}}
data-id={`dropdown-item-${name}`}
>
<span className="">

@ -124,12 +124,10 @@ export function RunTabUI(props: RunTabProps) {
}
const checkEvmChainCompatibility = async () => {
const isVm = await plugin.call('blockchain', 'getProvider')
const fetchDetails = await plugin.call('solidity', 'getCompilerQueryParameters')
const compilerState = await plugin.call('solidity', 'getCompilerState')
console.log('compilerState', compilerState)
console.log('runTab', runTab)
if (!isVm.startsWith('vm') && compilerState.target !== null) { //vms are exempt from this treatment & if no contract file is open, don't do anything
// if no contract file is open, don't do anything
if (compilerState.target !== null) {
const targetChainId = runTab.chainId ? parseInt(runTab.chainId) : runTab.chainId
const IsCompatible = isChainCompatible(fetchDetails.evmVersion ?? 'cancun', targetChainId)
if (!IsCompatible) {

Loading…
Cancel
Save