From cb7be61ecf0a4c554bba78fa11b5c7e32ecee264 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Tue, 9 Jan 2024 13:06:16 +0100 Subject: [PATCH] simplify implementation for lowlevel icon --- .../run-tab/src/lib/actions/account.ts | 17 -------------- .../src/lib/components/contractDropdownUI.tsx | 2 -- .../src/lib/components/contractGUI.tsx | 2 -- .../lib/components/instanceContainerUI.tsx | 1 - .../components/lowlevelInteractionIcon.tsx | 22 ------------------- .../src/lib/components/universalDappUI.tsx | 9 ++++++-- libs/remix-ui/run-tab/src/lib/run-tab.tsx | 3 --- libs/remix-ui/run-tab/src/lib/types/index.ts | 6 ----- 8 files changed, 7 insertions(+), 55 deletions(-) delete mode 100644 libs/remix-ui/run-tab/src/lib/components/lowlevelInteractionIcon.tsx diff --git a/libs/remix-ui/run-tab/src/lib/actions/account.ts b/libs/remix-ui/run-tab/src/lib/actions/account.ts index 3d68fb60c1..92879fd159 100644 --- a/libs/remix-ui/run-tab/src/lib/actions/account.ts +++ b/libs/remix-ui/run-tab/src/lib/actions/account.ts @@ -101,20 +101,3 @@ export const signMessageWithAddress = (plugin: RunTab, dispatch: React.Dispatch< dispatch(displayNotification('Signed Message', modalContent(msgHash, signedData), 'OK', null, () => {}, null)) }) } - -export const extractCompilerVersion = (runTab: RunTabState, dispatch: React.Dispatch) => -{ - const runtabState = Object.entries(runTab['contracts'] ?? {}) - const contractList = runtabState[0] ?? {} - const contractNameHolder = runtabState[4] ?? ['currentName', ''] - const contractName = contractNameHolder[1] ?? '' - const currentObj = contractList[1] ?? {} - const currObjDetails = currentObj[contractName as string] ?? {} - const currObjDetailsLength = currObjDetails.length -1 - const alias = currObjDetails[currObjDetailsLength]['alias'] ?? '' - const serializeTarget = currObjDetails[currObjDetailsLength]?.compiler?.data?.contracts[contractName as string][alias]?.metadata ?? '' - const obj = (serializeTarget as string).length > 0 ? JSON.parse(serializeTarget) : {} - const version = obj?.compiler?.version ?? '' - const compilerVersion = `v${version?.split('+commit')[0]}` ?? 'v' - dispatch({ type: 'EXTRACT_COMPILER_VERSION', payload: {compilerVersion, runTab }}) -} diff --git a/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx b/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx index 33dd92b9ad..87912eccc4 100644 --- a/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx @@ -481,8 +481,6 @@ export function ContractDropdownUI(props: ContractDropdownProps) { isValidProxyUpgrade={isValidProxyUpgrade} modal={props.modal} disabled={props.selectedAccount === ''} - dispatch={props.stateDispatch} - runTabState={props.runTabState} />
{ - extractCompilerVersion(props.runTabState, props.dispatch) if (deployState.deploy) { const proxyInitializeString = getMultiValsString(initializeFields.current) props.clickCallBack(props.initializerOptions.inputs.inputs, proxyInitializeString, ['Deploy with Proxy']) diff --git a/libs/remix-ui/run-tab/src/lib/components/instanceContainerUI.tsx b/libs/remix-ui/run-tab/src/lib/components/instanceContainerUI.tsx index 3b10a35968..4296867c67 100644 --- a/libs/remix-ui/run-tab/src/lib/components/instanceContainerUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/instanceContainerUI.tsx @@ -39,7 +39,6 @@ export function InstanceContainerUI(props: InstanceContainerProps) { {props.instances.instanceList.map((instance, index) => { return ( - }> - - - - - - ) -} diff --git a/libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx b/libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx index 9da8f5f1cd..ca644cb1c4 100644 --- a/libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx @@ -10,7 +10,6 @@ import {ContractGUI} from './contractGUI' import {TreeView, TreeViewItem} from '@remix-ui/tree-view' import {BN} from 'bn.js' import {CustomTooltip, is0XPrefixed, isHexadecimal, isNumeric, shortenAddress} from '@remix-ui/helper' -import { LowLevelInteractionIcon } from './lowlevelInteractionIcon' const txHelper = remixLib.execution.txHelper @@ -25,6 +24,8 @@ export function UniversalDappUI(props: UdappProps) { const [evmBC, setEvmBC] = useState(null) const [instanceBalance, setInstanceBalance] = useState(0) + const getVersion = () => window.location.href.split('=')[5].split('+')[0].split('-')[1] + useEffect(() => { if (!props.instance.abi) { const abi = txHelper.sortAbiFunction(props.instance.contractData.abi) @@ -285,7 +286,11 @@ export function UniversalDappUI(props: UdappProps) {
- + }> + + + +
diff --git a/libs/remix-ui/run-tab/src/lib/run-tab.tsx b/libs/remix-ui/run-tab/src/lib/run-tab.tsx index 7328435c0b..9f68cc9944 100644 --- a/libs/remix-ui/run-tab/src/lib/run-tab.tsx +++ b/libs/remix-ui/run-tab/src/lib/run-tab.tsx @@ -299,8 +299,6 @@ export function RunTabUI(props: RunTabProps) { isValidProxyAddress={isValidProxyAddress} isValidProxyUpgrade={isValidProxyUpgrade} proxy={runTab.proxy} - stateDispatch={dispatch} - runTabState={runTab} />
diff --git a/libs/remix-ui/run-tab/src/lib/types/index.ts b/libs/remix-ui/run-tab/src/lib/types/index.ts index 1f12c3957c..eddaa892ed 100644 --- a/libs/remix-ui/run-tab/src/lib/types/index.ts +++ b/libs/remix-ui/run-tab/src/lib/types/index.ts @@ -225,8 +225,6 @@ export type MainnetPrompt = ( ) => JSX.Element export interface ContractDropdownProps { - stateDispatch: React.Dispatch, - runTabState: RunTabState, selectedAccount: string, exEnvironment: string, contracts: { @@ -286,7 +284,6 @@ export interface RecorderProps { } export interface InstanceContainerProps { - state: RunTabState, instances: { instanceList: { contractData?: ContractData, @@ -373,8 +370,6 @@ export interface ContractGUIProps { isValidProxyAddress?: (address: string) => Promise, isValidProxyUpgrade?: (proxyAddress: string) => Promise, modal?: (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void, okBtnClass?: string, cancelBtnClass?: string) => void - dispatch?: React.Dispatch - runTabState?: RunTabState } export interface MainnetProps { network: Network, @@ -402,7 +397,6 @@ export interface UdappProps { decodedResponse?: Record, abi?: any }, - state: RunTabState, context: 'memory' | 'blockchain', removeInstance: (index: number) => void, index: number,