fix issues identified by @ryestew and @LianaHus

pull/5367/head
Joseph Izang 3 weeks ago committed by Aniket
parent aa8dbb3520
commit 5c3f507c43
  1. 1
      libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx
  2. 151
      libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx
  3. 3
      libs/remix-ui/run-tab/src/lib/run-tab.tsx
  4. 8
      libs/remix-ui/run-tab/src/lib/types/index.ts

@ -483,6 +483,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
setSolcVersion={props.setCompilerVersion}
getVersion={props.getCompilerVersion}
evmCheckComplete={props.evmCheckComplete}
setEvmCheckComplete={props.setEvmCheckComplete}
plugin={props.plugin}
runTabState={props.runTabState}
/>

@ -172,114 +172,71 @@ export function ContractGUI(props: ContractGUIProps) {
}
}
const handleActionClick = async () => {
props.getVersion()
if (props.runTabState.selectExEnv.toLowerCase().startsWith('vm-') || props.runTabState.selectExEnv.toLowerCase().includes('basic-http-provider')) {
if (deployState.deploy) {
const proxyInitializeString = getMultiValsString(initializeFields.current)
props.clickCallBack(props.initializerOptions.inputs.inputs, proxyInitializeString, ['Deploy with Proxy'])
} else if (deployState.upgrade) {
if (proxyAddress === '') {
setProxyAddressError(intl.formatMessage({ id: 'udapp.proxyAddressError1' }))
} else {
const isValidProxyAddress = await props.isValidProxyAddress(proxyAddress)
if (isValidProxyAddress) {
setProxyAddressError('')
const upgradeReport: any = await props.isValidProxyUpgrade(proxyAddress)
if (upgradeReport.ok) {
!proxyAddressError && props.clickCallBack(props.funcABI.inputs, proxyAddress, ['Upgrade with Proxy'])
const handleDeploy = async () => {
if (deployState.deploy) {
const proxyInitializeString = getMultiValsString(initializeFields.current)
props.clickCallBack(props.initializerOptions.inputs.inputs, proxyInitializeString, ['Deploy with Proxy'])
} else if (deployState.upgrade) {
if (proxyAddress === '') {
setProxyAddressError(intl.formatMessage({ id: 'udapp.proxyAddressError1' }))
} else {
const isValidProxyAddress = await props.isValidProxyAddress(proxyAddress)
if (isValidProxyAddress) {
setProxyAddressError('')
const upgradeReport: any = await props.isValidProxyUpgrade(proxyAddress)
if (upgradeReport.ok) {
!proxyAddressError && props.clickCallBack(props.funcABI.inputs, proxyAddress, ['Upgrade with Proxy'])
} else {
if (upgradeReport.warning) {
props.modal(
'Proxy Upgrade Warning',
unavailableProxyLayoutMsg(),
'Proceed',
() => {
!proxyAddressError && props.clickCallBack(props.funcABI.inputs, proxyAddress, ['Upgrade with Proxy'])
},
'Cancel',
() => {},
'btn-warning',
'btn-secondary'
)
} else {
if (upgradeReport.warning) {
props.modal(
'Proxy Upgrade Warning',
unavailableProxyLayoutMsg(),
'Proceed',
() => {
!proxyAddressError && props.clickCallBack(props.funcABI.inputs, proxyAddress, ['Upgrade with Proxy'])
},
'Cancel',
() => {},
'btn-warning',
'btn-secondary'
)
} else {
props.modal(
'Proxy Upgrade Error',
upgradeReportMsg(upgradeReport),
'Continue anyway ',
() => {
!proxyAddressError && props.clickCallBack(props.funcABI.inputs, proxyAddress, ['Upgrade with Proxy'])
},
'Cancel',
() => {},
'btn-warning',
'btn-secondary'
)
}
props.modal(
'Proxy Upgrade Error',
upgradeReportMsg(upgradeReport),
'Continue anyway ',
() => {
!proxyAddressError && props.clickCallBack(props.funcABI.inputs, proxyAddress, ['Upgrade with Proxy'])
},
'Cancel',
() => {},
'btn-warning',
'btn-secondary'
)
}
} else {
setProxyAddressError(intl.formatMessage({ id: 'udapp.proxyAddressError2' }))
}
} else {
setProxyAddressError(intl.formatMessage({ id: 'udapp.proxyAddressError2' }))
}
} else {
props.clickCallBack(props.funcABI.inputs, basicInput)
}
} else {
props.clickCallBack(props.funcABI.inputs, basicInput)
}
}
const handleActionClick = async () => {
props.getVersion()
if (props.runTabState.selectExEnv.toLowerCase().startsWith('vm-') || props.runTabState.selectExEnv.toLowerCase().includes('basic-http-provider')) {
await handleDeploy()
} else {
const status = await props.getCompilerDetails()
console.log('exenv', props.runTabState.selectExEnv)
if (status === 'Failed') {
props.plugin.call('terminal', 'log', { type: 'log', value: 'Consider opening an issue to update our internal store with your desired chainId.' })
return
}
if (deployState.deploy) {
const proxyInitializeString = getMultiValsString(initializeFields.current)
props.clickCallBack(props.initializerOptions.inputs.inputs, proxyInitializeString, ['Deploy with Proxy'])
} else if (deployState.upgrade) {
if (proxyAddress === '') {
setProxyAddressError(intl.formatMessage({ id: 'udapp.proxyAddressError1' }))
} else {
const isValidProxyAddress = await props.isValidProxyAddress(proxyAddress)
if (isValidProxyAddress) {
setProxyAddressError('')
const upgradeReport: any = await props.isValidProxyUpgrade(proxyAddress)
if (upgradeReport.ok) {
!proxyAddressError && props.clickCallBack(props.funcABI.inputs, proxyAddress, ['Upgrade with Proxy'])
} else {
if (upgradeReport.warning) {
props.modal(
'Proxy Upgrade Warning',
unavailableProxyLayoutMsg(),
'Proceed',
() => {
!proxyAddressError && props.clickCallBack(props.funcABI.inputs, proxyAddress, ['Upgrade with Proxy'])
},
'Cancel',
() => {},
'btn-warning',
'btn-secondary'
)
} else {
props.modal(
'Proxy Upgrade Error',
upgradeReportMsg(upgradeReport),
'Continue anyway ',
() => {
!proxyAddressError && props.clickCallBack(props.funcABI.inputs, proxyAddress, ['Upgrade with Proxy'])
},
'Cancel',
() => {},
'btn-warning',
'btn-secondary'
)
}
}
} else {
setProxyAddressError(intl.formatMessage({ id: 'udapp.proxyAddressError2' }))
}
}
} else {
props.clickCallBack(props.funcABI.inputs, basicInput)
if (props.evmCheckComplete) {
await handleDeploy()
}
}
}

@ -124,6 +124,7 @@ export function RunTabUI(props: RunTabProps) {
await plugin.call('solidity', 'setCompilerConfig', compilerParams)
const currentFile = await plugin.call('fileManager', 'getCurrentFile')
await plugin.call('solidity', 'compile', currentFile)
setEvmCheckComplete(true)
}
const checkEvmChainCompatibility = async () => {
@ -141,7 +142,6 @@ export function RunTabUI(props: RunTabProps) {
plugin.call('terminal', 'log', { type: 'log', value: 'No compatible chain found for the selected EVM version.' })
return 'Failed'
} else {
setEvmCheckComplete(true)
if (!IsCompatible) {
//show modal
plugin.call('notification', 'modal', {
@ -400,6 +400,7 @@ export function RunTabUI(props: RunTabProps) {
getCompilerVersion={getVersion}
getCompilerDetails={getCompilerDetails}
evmCheckComplete={evmCheckComplete}
setEvmCheckComplete={setEvmCheckComplete}
plugin={plugin}
runTabState={runTab}
/>

@ -1,4 +1,4 @@
import { Ref } from 'react'
import { Dispatch, Ref } from 'react'
import { CompilerAbstract } from '@remix-project/remix-solidity'
import { ContractData, FuncABI, OverSizeLimit } from '@remix-project/core-plugin'
import { RunTab } from './run-tab'
@ -234,7 +234,8 @@ export type MainnetPrompt = (
export interface ContractDropdownProps {
getCompilerDetails: () => Promise<CheckStatus>
evmCheckComplete: boolean,
evmCheckComplete?: boolean,
setEvmCheckComplete?: Dispatch<React.SetStateAction<boolean>>,
plugin: RunTab,
runTabState: RunTabState
selectedAccount: string,
@ -385,7 +386,8 @@ export interface DeployOptions {
export interface ContractGUIProps {
getCompilerDetails: () => Promise<CheckStatus>
evmCheckComplete: boolean,
evmCheckComplete?: boolean,
setEvmCheckComplete?: React.Dispatch<React.SetStateAction<boolean>>,
plugin: RunTab,
runTabState: RunTabState
title?: string,

Loading…
Cancel
Save