From c6457b0ca76f8b343a3c74a1852ef3166356aa1f Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 22 Feb 2024 16:14:05 +0530 Subject: [PATCH] allow saving only for injected web3 --- .../run-tab/src/lib/components/universalDappUI.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 afd68379e2..361af61a07 100644 --- a/libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx @@ -1,5 +1,5 @@ // eslint-disable-next-line no-use-before-define -import React, {useEffect, useState} from 'react' +import React, {useEffect, useState, useRef} from 'react' import {FormattedMessage, useIntl} from 'react-intl' import {UdappProps} from '../types' import {FuncABI} from '@remix-project/core-plugin' @@ -23,6 +23,7 @@ export function UniversalDappUI(props: UdappProps) { const [calldataValue, setCalldataValue] = useState('') const [evmBC, setEvmBC] = useState(null) const [instanceBalance, setInstanceBalance] = useState(0) + const env = useRef() const getVersion = () => window.location.href.split('=')[5].split('+')[0].split('-')[1] @@ -57,6 +58,13 @@ export function UniversalDappUI(props: UdappProps) { } }, [props.instance.balance]) + useEffect(() => { + const getEnv = async () => { + env.current = await props.plugin.call('blockchain', 'getProvider') + } + getEnv() + }, []) + const sendData = () => { setLlIError('') const fallback = txHelper.getFallbackInterface(contractABI) @@ -267,7 +275,7 @@ export function UniversalDappUI(props: UdappProps) {
- { !props.isSavedContract ? (
+ { !props.isSavedContract && env.current === 'injected' ? (
}>