fix external provider failure

pull/5367/head
Joseph Izang 2 weeks ago committed by Aniket
parent 9c0433f9c5
commit 2b052f8e05
  1. 29
      libs/remix-ui/run-tab/src/lib/actions/evmmap.ts
  2. 60
      libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx
  3. 7
      libs/remix-ui/run-tab/src/lib/run-tab.tsx
  4. 9
      libs/remix-ui/run-tab/src/lib/types/index.ts

@ -41,7 +41,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
{ id: 59141, name: "Linea Testnet" },
{ id: 421614, name: "Arbitrum Sepolia" },
{ id: 534352, name: "Scroll" },
// { id: 11155111, name: "Sepolia" }
{ id: 11155111, name: "Sepolia" }
],
minCompilerVersion: "0.8.24+commit.e11b9ed9",
evmVersion: 'cancun'
@ -73,7 +73,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
{ id: 59902, name: "Metis Sepolia Testnet" },
{ id: 421614, name: "Arbitrum Sepolia" },
{ id: 534352, name: "Scroll" },
// { id: 11155111, name: "Sepolia" },
{ id: 11155111, name: "Sepolia" },
{ id: 11155420, name: "Optimism Sepolia Testnet" },
{ id: 1666600000, name: "Harmony Mainnet Shard 0" }
],
@ -109,7 +109,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
{ id: 59902, name: "Metis Sepolia Testnet" },
{ id: 421614, name: "Arbitrum Sepolia" },
{ id: 534352, name: "Scroll" },
// { id: 11155111, name: "Sepolia" },
{ id: 11155111, name: "Sepolia" },
{ id: 11155420, name: "Optimism Sepolia Testnet" },
{ id: 1666600000, name: "Harmony Mainnet Shard 0" }
],
@ -132,7 +132,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
{ id: 42220, name: "Celo Mainnet" },
{ id: 59144, name: "Linea Mainnet" },
{ id: 59141, name: "Linea Testnet" },
// { id: 11155111, name: "Sepolia" },
{ id: 11155111, name: "Sepolia" },
],
minCompilerVersion: "0.8.7+commit.e28d00a7",
evmVersion: 'london'
@ -153,7 +153,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
{ id: 42220, name: "Celo Mainnet" },
{ id: 59144, name: "Linea Mainnet" },
{ id: 59141, name: "Linea Testnet" },
// { id: 11155111, name: "Sepolia" }
{ id: 11155111, name: "Sepolia" }
],
minCompilerVersion: "0.8.5+commit.a4f2e591",
evmVersion: 'berlin'
@ -174,7 +174,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
{ id: 42220, name: "Celo Mainnet" },
{ id: 59144, name: "Linea Mainnet" },
{ id: 59141, name: "Linea Testnet" },
// { id: 11155111, name: "Sepolia" }
{ id: 11155111, name: "Sepolia" }
],
minCompilerVersion: "0.5.14+commit.01f1aaa4",
evmVersion: 'istanbul'
@ -183,7 +183,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
chainId: [
{ id: 1, name: "Ethereum Mainnet" },
{ id: 5, name: "Goerli" },
// { id: 11155111, name: "Sepolia" }
{ id: 11155111, name: "Sepolia" }
],
minCompilerVersion: "0.5.5+commit.47a71e8f",
evmVersion: 'petersburg'
@ -192,7 +192,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
chainId: [
{ id: 1, name: "Ethereum Mainnet" },
{ id: 5, name: "Goerli" },
// { id: 11155111, name: "Sepolia" }
{ id: 11155111, name: "Sepolia" }
],
minCompilerVersion: "0.5.5+commit.47a71e8f",
evmVersion: 'constantinople'
@ -222,7 +222,7 @@ export const evmMap: Map<HardFork, { chainId: ChainInfo[], minCompilerVersion: s
chainId: [
{ id: 1, name: "Ethereum Mainnet" },
{ id: 5, name: "Goerli" },
// { id: 11155111, name: "Sepolia" }
{ id: 11155111, name: "Sepolia" }
],
minCompilerVersion: "0.1.2+commit.d0d36e3",
evmVersion: 'homestead'
@ -247,17 +247,6 @@ export function getCompatibleChain(
fork: HardFork,
chainId: number
): ChainCompatibleInfo | undefined {
// const forkData = evmMap.get(fork)
// if (!forkData) return undefined
// const compatibleChain = forkData.chainId.find(chain => chain.id === chainId)
// if (compatibleChain) {
// return {
// chain: compatibleChain,
// minCompilerVersion: forkData.minCompilerVersion,
// evmVersion: fork
// }
// }
for (const [forkKey, forkData] of evmMap) {
const compatibleChain = forkData.chainId.find(chain => chain.id === chainId)

@ -174,8 +174,13 @@ export function ContractGUI(props: ContractGUIProps) {
const handleActionClick = async () => {
props.getVersion()
await props.getCompilerDetails()
if (props.evmCheckComplete === false && !props.runTabState.selectExEnv.toLowerCase().includes('vm-')) return
if (!props.runTabState.selectExEnv.toLowerCase().includes('vm-') || !props.runTabState.selectExEnv.toLowerCase().includes('basic-http-provider')) {
const status = await props.getCompilerDetails()
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'])
@ -225,6 +230,57 @@ export function ContractGUI(props: ContractGUIProps) {
} else {
props.clickCallBack(props.funcABI.inputs, basicInput)
}
} else {
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)
}
}
}
const handleBasicInput = (e) => {

@ -58,6 +58,8 @@ import { ScenarioPrompt } from './components/scenario'
import { setIpfsCheckedState, setRemixDActivated } from './actions/payload'
import { ChainCompatibleInfo, getCompatibleChain, getCompatibleChains, HardFork, isChainCompatible, isChainCompatibleWithAnyFork } from './actions/evmmap'
export type CheckStatus = 'Passed' | 'Failed'
export function RunTabUI(props: RunTabProps) {
const { plugin } = props
const [focusModal, setFocusModal] = useState<Modal>({
@ -129,7 +131,7 @@ export function RunTabUI(props: RunTabProps) {
const compilerState = await plugin.call('solidity', 'getCompilerState')
// if no contract file is open, don't do anything
if (compilerState.target !== null && !runTab.networkName.toLowerCase().includes('vm')) {
if (compilerState.target !== null) {
const targetChainId = runTab.chainId
const ideDefault = fetchDetails && fetchDetails.evmVersion !== null ? fetchDetails.evmVersion : 'cancun'
const IsCompatible = isChainCompatible(ideDefault, targetChainId)
@ -137,7 +139,7 @@ export function RunTabUI(props: RunTabProps) {
if (chain === undefined) {
//show modal
plugin.call('terminal', 'log', { type: 'log', value: 'No compatible chain found for the selected EVM version.' })
return
return 'Failed'
} else {
setEvmCheckComplete(true)
if (!IsCompatible) {
@ -161,6 +163,7 @@ export function RunTabUI(props: RunTabProps) {
})
}
}
return 'Passed'
}
}

@ -4,6 +4,7 @@ import { ContractData, FuncABI, OverSizeLimit } from '@remix-project/core-plugin
import { RunTab } from './run-tab'
import { SolcInput, SolcOutput } from '@openzeppelin/upgrades-core'
import { LayoutCompatibilityReport } from '@openzeppelin/upgrades-core/dist/storage/report'
import { CheckStatus } from '../run-tab'
export interface RunTabProps {
plugin: RunTab,
initialState?: RunTabState
@ -232,7 +233,7 @@ export type MainnetPrompt = (
) => JSX.Element
export interface ContractDropdownProps {
getCompilerDetails: () => Promise<any>
getCompilerDetails: () => Promise<CheckStatus>
evmCheckComplete: boolean,
plugin: RunTab,
runTabState: RunTabState
@ -300,7 +301,7 @@ export interface RecorderProps {
}
export interface InstanceContainerProps {
getCompilerDetails: () => Promise<any>
getCompilerDetails: () => Promise<CheckStatus>
runTabState: RunTabState
instances: {
instanceList: {
@ -383,7 +384,7 @@ export interface DeployOptions {
}
export interface ContractGUIProps {
getCompilerDetails: () => Promise<any>
getCompilerDetails: () => Promise<CheckStatus>
evmCheckComplete: boolean,
plugin: RunTab,
runTabState: RunTabState
@ -426,7 +427,7 @@ export interface MainnetProps {
}
export interface UdappProps {
getCompilerDetails: () => Promise<any>
getCompilerDetails: () => Promise<CheckStatus>
runTabState: RunTabState
instance: {
contractData?: ContractData,

Loading…
Cancel
Save