fix issues identified by @ryestew and @LianaHus

pull/5367/head
Joseph Izang 2 weeks ago committed by Aniket
parent aa8dbb3520
commit 5c3f507c43
  1. 1
      libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx
  2. 63
      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} setSolcVersion={props.setCompilerVersion}
getVersion={props.getCompilerVersion} getVersion={props.getCompilerVersion}
evmCheckComplete={props.evmCheckComplete} evmCheckComplete={props.evmCheckComplete}
setEvmCheckComplete={props.setEvmCheckComplete}
plugin={props.plugin} plugin={props.plugin}
runTabState={props.runTabState} runTabState={props.runTabState}
/> />

@ -172,10 +172,7 @@ export function ContractGUI(props: ContractGUIProps) {
} }
} }
const handleActionClick = async () => { const handleDeploy = async () => {
props.getVersion()
if (props.runTabState.selectExEnv.toLowerCase().startsWith('vm-') || props.runTabState.selectExEnv.toLowerCase().includes('basic-http-provider')) {
if (deployState.deploy) { if (deployState.deploy) {
const proxyInitializeString = getMultiValsString(initializeFields.current) const proxyInitializeString = getMultiValsString(initializeFields.current)
props.clickCallBack(props.initializerOptions.inputs.inputs, proxyInitializeString, ['Deploy with Proxy']) props.clickCallBack(props.initializerOptions.inputs.inputs, proxyInitializeString, ['Deploy with Proxy'])
@ -225,61 +222,21 @@ export function ContractGUI(props: ContractGUIProps) {
} else { } else {
props.clickCallBack(props.funcABI.inputs, basicInput) 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 { } else {
const status = await props.getCompilerDetails() const status = await props.getCompilerDetails()
console.log('exenv', props.runTabState.selectExEnv)
if (status === 'Failed') { if (status === 'Failed') {
props.plugin.call('terminal', 'log', { type: 'log', value: 'Consider opening an issue to update our internal store with your desired chainId.' }) props.plugin.call('terminal', 'log', { type: 'log', value: 'Consider opening an issue to update our internal store with your desired chainId.' })
return return
} }
if (deployState.deploy) { if (props.evmCheckComplete) {
const proxyInitializeString = getMultiValsString(initializeFields.current) await handleDeploy()
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)
} }
} }
} }

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

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

Loading…
Cancel
Save