From e0bff860514ce59aa8f7532dd6df545a017ffb49 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Sat, 30 Dec 2023 01:01:53 +0100 Subject: [PATCH] fix version determination so it updates on deploy --- .../lib/components/instanceContainerUI.tsx | 1 + .../components/lowlevelInteractionIcon.tsx | 28 +++++++++++++++++-- .../src/lib/components/universalDappUI.tsx | 2 +- libs/remix-ui/run-tab/src/lib/run-tab.tsx | 1 + libs/remix-ui/run-tab/src/lib/types/index.ts | 2 ++ 5 files changed, 30 insertions(+), 4 deletions(-) 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 4296867c67..89ffdb976e 100644 --- a/libs/remix-ui/run-tab/src/lib/components/instanceContainerUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/instanceContainerUI.tsx @@ -39,6 +39,7 @@ export function InstanceContainerUI(props: InstanceContainerProps) { {props.instances.instanceList.map((instance, index) => { return ( window.location.href.split('=')[5].split('+')[0].split('-')[1] + const [version, setVersion] = useState(() => getVersion()) + + useEffect(() => { + const listenForCompileFinished = async () => { + props.plugin.on('solidity', 'compilationFinished', + (file: string, source, languageVersion, data, input, version) => { + const versionUpdate = `v${version.split('+')[0]}` // remove commit hash + console.log(versionUpdate) + setVersion(versionUpdate) + }) + } + listenForCompileFinished() + + return () => { + props.plugin.off('solidity', 'compilationFinished') + } + }, []) 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 fcc643abcf..561c0ad97b 100644 --- a/libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx @@ -285,7 +285,7 @@ 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 9f68cc9944..0e032d8651 100644 --- a/libs/remix-ui/run-tab/src/lib/run-tab.tsx +++ b/libs/remix-ui/run-tab/src/lib/run-tab.tsx @@ -322,6 +322,7 @@ export function RunTabUI(props: RunTabProps) { runTransactions={executeTransactions} sendValue={runTab.sendValue} getFuncABIInputs={getFuncABIValues} + plugin={props.plugin} />
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 93ac6990b1..679ea6b72c 100644 --- a/libs/remix-ui/run-tab/src/lib/types/index.ts +++ b/libs/remix-ui/run-tab/src/lib/types/index.ts @@ -283,6 +283,7 @@ export interface RecorderProps { } export interface InstanceContainerProps { + plugin: RunTab, instances: { instanceList: { contractData?: ContractData, @@ -396,6 +397,7 @@ export interface UdappProps { decodedResponse?: Record, abi?: any }, + plugin: RunTab, context: 'memory' | 'blockchain', removeInstance: (index: number) => void, index: number,