From 104c9a694ae416463e42fdc1654f1a3db43fe46f Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Tue, 31 Jan 2023 15:19:14 +0100 Subject: [PATCH] List shortened addresses --- apps/remix-ide/src/blockchain/blockchain.js | 5 ++- .../helper/src/lib/remix-ui-helper.ts | 6 +++ .../run-tab/src/lib/actions/actions.ts | 7 +++- .../run-tab/src/lib/actions/deploy.ts | 23 +---------- .../run-tab/src/lib/actions/events.ts | 39 +++++++++++++++++-- .../remix-ui/run-tab/src/lib/actions/index.ts | 5 +-- .../run-tab/src/lib/actions/payload.ts | 9 +---- .../src/lib/components/contractDropdownUI.tsx | 4 +- .../src/lib/components/contractGUI.tsx | 8 ++-- .../run-tab/src/lib/constants/index.ts | 1 - .../run-tab/src/lib/reducers/runTab.ts | 15 +------ libs/remix-ui/run-tab/src/lib/run-tab.tsx | 1 + .../run-tab/src/lib/types/blockchain.d.ts | 6 ++- libs/remix-ui/run-tab/src/lib/types/index.ts | 7 ++-- 14 files changed, 69 insertions(+), 67 deletions(-) diff --git a/apps/remix-ide/src/blockchain/blockchain.js b/apps/remix-ide/src/blockchain/blockchain.js index 733b07899d..ae17c92cb7 100644 --- a/apps/remix-ide/src/blockchain/blockchain.js +++ b/apps/remix-ide/src/blockchain/blockchain.js @@ -180,7 +180,8 @@ export class Blockchain extends Plugin { _paq.push(['trackEvent', 'blockchain', 'Deploy With Proxy', 'Proxy deployment failed: ' + error]) return this.call('terminal', 'logHtml', log) } - if (networkInfo.name !== 'VM') await this.saveDeployedContractStorageLayout(implementationContractObject, address, networkInfo) + await this.saveDeployedContractStorageLayout(implementationContractObject, address, networkInfo) + this.events.emit('newProxyDeployment', address, new Date().toISOString()) _paq.push(['trackEvent', 'blockchain', 'Deploy With Proxy', 'Proxy deployment successful']) this.call('udapp', 'addInstance', addressToString(address), implementationContractObject.abi, implementationContractObject.name) } @@ -226,7 +227,7 @@ export class Blockchain extends Plugin { _paq.push(['trackEvent', 'blockchain', 'Upgrade With Proxy', 'Upgrade failed']) return this.call('terminal', 'logHtml', log) } - if (networkInfo.name !== 'VM') await this.saveDeployedContractStorageLayout(newImplementationContractObject, proxyAddress, networkInfo) + await this.saveDeployedContractStorageLayout(newImplementationContractObject, proxyAddress, networkInfo) _paq.push(['trackEvent', 'blockchain', 'Upgrade With Proxy', 'Upgrade Successful']) this.call('udapp', 'addInstance', addressToString(proxyAddress), newImplementationContractObject.abi, newImplementationContractObject.name) } diff --git a/libs/remix-ui/helper/src/lib/remix-ui-helper.ts b/libs/remix-ui/helper/src/lib/remix-ui-helper.ts index d9d0f193ce..c4d6ce6cb8 100644 --- a/libs/remix-ui/helper/src/lib/remix-ui-helper.ts +++ b/libs/remix-ui/helper/src/lib/remix-ui-helper.ts @@ -128,3 +128,9 @@ export const addSlash = (file: string) => { if (!file.startsWith('/'))file = '/' + file return file } + +export const shortenDeploymentAddresses = (address: string, date: Date) => { + const len = address.length + + return address.slice(0, 5) + '...' + address.slice(len - 5, len) + ' (' + date.toString() + ')' +} diff --git a/libs/remix-ui/run-tab/src/lib/actions/actions.ts b/libs/remix-ui/run-tab/src/lib/actions/actions.ts index 669851a869..09302b7284 100644 --- a/libs/remix-ui/run-tab/src/lib/actions/actions.ts +++ b/libs/remix-ui/run-tab/src/lib/actions/actions.ts @@ -1,5 +1,5 @@ import { ContractData } from "@remix-project/core-plugin" -import { addNewInstance, addProvider, clearAllInstances, clearRecorderCount, hidePopUp, removeExistingInstance, removeProvider, setBaseFeePerGas, setConfirmSettings, setCurrentContract, setExecutionEnvironment, setExternalEndpoint, setGasLimit, setGasPrice, setGasPriceStatus, setMatchPassphrase, setMaxFee, setMaxPriorityFee, setNetworkName, setPassphrase, setPathToScenario, setSelectedAccount, setSendUnit, setSendValue } from "./payload" +import { addNewInstance, addProvider, clearAllInstances, clearRecorderCount, hidePopUp, newProxyDeployment, removeExistingInstance, removeProvider, setBaseFeePerGas, setConfirmSettings, setCurrentContract, setExecutionEnvironment, setExternalEndpoint, setGasLimit, setGasPrice, setGasPriceStatus, setMatchPassphrase, setMaxFee, setMaxPriorityFee, setNetworkName, setPassphrase, setPathToScenario, setSelectedAccount, setSendUnit, setSendValue } from "./payload" export const setAccount = (dispatch: React.Dispatch, account: string) => { dispatch(setSelectedAccount(account)) @@ -89,4 +89,9 @@ export const updateScenarioPath = (dispatch: React.Dispatch, path: string) export const setSendTransactionValue = (dispatch: React.Dispatch, value: string) => { dispatch(setSendValue(value)) +} + +export const addNewProxyDeployment = (dispatch: React.Dispatch, address: string, date: Date) => { + console.log('called deployement: ', address, date) + dispatch(newProxyDeployment({ address, date })) } \ No newline at end of file diff --git a/libs/remix-ui/run-tab/src/lib/actions/deploy.ts b/libs/remix-ui/run-tab/src/lib/actions/deploy.ts index 6c86901bf9..7a0f44e0dc 100644 --- a/libs/remix-ui/run-tab/src/lib/actions/deploy.ts +++ b/libs/remix-ui/run-tab/src/lib/actions/deploy.ts @@ -3,7 +3,7 @@ import { RunTab } from "../types/run-tab" import { CompilerAbstract as CompilerAbstractType } from '@remix-project/remix-solidity' import * as remixLib from '@remix-project/remix-lib' import { DeployMode, MainnetPrompt } from "../types" -import { displayNotification, displayPopUp, fetchProxyDeploymentsSuccess, setDecodedResponse } from "./payload" +import { displayNotification, displayPopUp, setDecodedResponse } from "./payload" import { addInstance } from "./actions" import { addressToString, logBuilder } from "@remix-ui/helper" import Web3 from "web3" @@ -336,24 +336,3 @@ export const isValidContractAddress = async (plugin: RunTab, address: string) => } } } - -export const getNetworkProxyAddresses = async (plugin: RunTab) => { - const identifier = plugin.blockchain.networkStatus.name === 'custom' ? plugin.blockchain.networkStatus.name + '-' + plugin.blockchain.networkStatus.id : plugin.REACT_API.networkName - const networkFile: { - id: string, - network: string, - deployments: { - [proxyAddress: string]: { - date: Date, - contractName: string, - fork: string, - implementationAddress: string, - layout: any - } - }[]} = await plugin.call('fileManager', 'readdir', `.deploys/upgradeable-contracts/${identifier}/UUPS.json`) - const deployments = Object.keys(networkFile.deployments).map(proxyAddress => { - return { address: proxyAddress, date: networkFile.deployments[proxyAddress].date } - }) - - fetchProxyDeploymentsSuccess(deployments) -} \ No newline at end of file diff --git a/libs/remix-ui/run-tab/src/lib/actions/events.ts b/libs/remix-ui/run-tab/src/lib/actions/events.ts index 9b75061011..7063afedd8 100644 --- a/libs/remix-ui/run-tab/src/lib/actions/events.ts +++ b/libs/remix-ui/run-tab/src/lib/actions/events.ts @@ -1,8 +1,8 @@ import { envChangeNotification } from "@remix-ui/helper" import { RunTab } from "../types/run-tab" import { setExecutionContext, setFinalContext, updateAccountBalances } from "./account" -import { addExternalProvider, addInstance, removeExternalProvider, setNetworkNameFromProvider } from "./actions" -import { addDeployOption, clearAllInstances, clearRecorderCount, fetchContractListSuccess, resetUdapp, setCurrentContract, setCurrentFile, setLoadType, setProxyEnvAddress, setRecorderCount, setRemixDActivated, setSendValue } from "./payload" +import { addExternalProvider, addInstance, addNewProxyDeployment, removeExternalProvider, setNetworkNameFromProvider } from "./actions" +import { addDeployOption, clearAllInstances, clearRecorderCount, fetchContractListSuccess, fetchProxyDeploymentsSuccess, resetProxyDeployments, resetUdapp, setCurrentContract, setCurrentFile, setLoadType, setRecorderCount, setRemixDActivated, setSendValue } from "./payload" import { CompilerAbstract } from '@remix-project/remix-solidity' import BN from 'bn.js' import Web3 from 'web3' @@ -21,6 +21,8 @@ export const setupEvents = (plugin: RunTab, dispatch: React.Dispatch) => { }) plugin.blockchain.event.register('contextChanged', (context, silent) => { + dispatch(resetProxyDeployments()) + if (context !== 'vm') getNetworkProxyAddresses(plugin, dispatch) setFinalContext(plugin, dispatch) }) @@ -35,14 +37,14 @@ export const setupEvents = (plugin: RunTab, dispatch: React.Dispatch) => { const netUI = !networkProvider().startsWith('vm') ? `${network.name} (${network.id || '-'}) network` : 'VM' setNetworkNameFromProvider(dispatch, netUI) - if (network.name === 'VM') dispatch(setProxyEnvAddress(plugin.config.get('vm/proxy'))) - else dispatch(setProxyEnvAddress(plugin.config.get(`${network.name}/${network.currentFork}/${network.id}/proxy`))) }) plugin.blockchain.event.register('addProvider', provider => addExternalProvider(dispatch, provider)) plugin.blockchain.event.register('removeProvider', name => removeExternalProvider(dispatch, name)) + plugin.blockchain.events.on('newProxyDeployment', (address, date) => addNewProxyDeployment(dispatch, address, date)) + plugin.on('solidity', 'compilationFinished', (file, source, languageVersion, data, input, version) => broadcastCompilationResult('remix', plugin, dispatch, file, source, languageVersion, data, input)) plugin.on('vyper', 'compilationFinished', (file, source, languageVersion, data) => broadcastCompilationResult('vyper', plugin, dispatch, file, source, languageVersion, data)) @@ -180,4 +182,33 @@ export const resetAndInit = (plugin: RunTab) => { } } }) +} + +const getNetworkProxyAddresses = async (plugin: RunTab, dispatch: React.Dispatch) => { + const network = plugin.blockchain.networkStatus.network + const identifier = network.name === 'custom' ? network.name + '-' + network.id : network.name + const networkDeploymentsExists = await plugin.call('fileManager', 'exists', `.deploys/upgradeable-contracts/${identifier}/UUPS.json`) + + if (networkDeploymentsExists) { + const networkFile: string = await plugin.call('fileManager', 'readFile', `.deploys/upgradeable-contracts/${identifier}/UUPS.json`) + const parsedNetworkFile: { + id: string, + network: string, + deployments: { + [proxyAddress: string]: { + date: Date, + contractName: string, + fork: string, + implementationAddress: string, + layout: any + } + }[]} = JSON.parse(networkFile) + const deployments = Object.keys(parsedNetworkFile.deployments).map(proxyAddress => { + return { address: proxyAddress, date: parsedNetworkFile.deployments[proxyAddress].date } + }) + + dispatch(fetchProxyDeploymentsSuccess(deployments)) + } else { + dispatch(fetchProxyDeploymentsSuccess([])) + } } \ No newline at end of file diff --git a/libs/remix-ui/run-tab/src/lib/actions/index.ts b/libs/remix-ui/run-tab/src/lib/actions/index.ts index 48f3c7bbdd..6fd0182d8e 100644 --- a/libs/remix-ui/run-tab/src/lib/actions/index.ts +++ b/libs/remix-ui/run-tab/src/lib/actions/index.ts @@ -6,7 +6,7 @@ import { createNewBlockchainAccount, fillAccountsList, setExecutionContext, sign import { clearInstances, clearPopUp, removeInstance, setAccount, setGasFee, setMatchPassphrasePrompt, setNetworkNameFromProvider, setPassphrasePrompt, setSelectedContract, setSendTransactionValue, setUnit, updateBaseFeePerGas, updateConfirmSettings, updateGasPrice, updateGasPriceStatus, updateMaxFee, updateMaxPriorityFee, updateScenarioPath } from './actions' -import { createInstance, getContext, getFuncABIInputs, getSelectedContract, loadAddress, runTransactions, updateInstanceBalance, syncContractsInternal, isValidContractAddress, getNetworkProxyAddresses } from './deploy' +import { createInstance, getContext, getFuncABIInputs, getSelectedContract, loadAddress, runTransactions, updateInstanceBalance, syncContractsInternal, isValidContractAddress } from './deploy' import { CompilerAbstract as CompilerAbstractType } from '@remix-project/remix-solidity' import { ContractData, FuncABI } from "@remix-project/core-plugin" import { DeployMode, MainnetPrompt } from '../types' @@ -62,5 +62,4 @@ export const getFuncABIValues = (funcABI: FuncABI) => getFuncABIInputs(plugin, f export const setNetworkName = (networkName: string) => setNetworkNameFromProvider(dispatch, networkName) export const updateSelectedContract = (contractName) => setSelectedContract(dispatch, contractName) export const syncContracts = () => syncContractsInternal(plugin) -export const isValidProxyAddress = (address: string) => isValidContractAddress(plugin, address) -export const fetchProxyAddresses = () => getNetworkProxyAddresses(plugin) \ No newline at end of file +export const isValidProxyAddress = (address: string) => isValidContractAddress(plugin, address) \ No newline at end of file diff --git a/libs/remix-ui/run-tab/src/lib/actions/payload.ts b/libs/remix-ui/run-tab/src/lib/actions/payload.ts index 6ac98aef41..44fba14c9c 100644 --- a/libs/remix-ui/run-tab/src/lib/actions/payload.ts +++ b/libs/remix-ui/run-tab/src/lib/actions/payload.ts @@ -1,5 +1,5 @@ import { ContractData } from '@remix-project/core-plugin' -import { ADD_DEPLOY_OPTION, ADD_INSTANCE, ADD_PROVIDER, CLEAR_INSTANCES, CLEAR_RECORDER_COUNT, DISPLAY_NOTIFICATION, DISPLAY_POPUP_MESSAGE, FETCH_ACCOUNTS_LIST_FAILED, FETCH_ACCOUNTS_LIST_REQUEST, FETCH_ACCOUNTS_LIST_SUCCESS, FETCH_CONTRACT_LIST_FAILED, FETCH_CONTRACT_LIST_REQUEST, FETCH_CONTRACT_LIST_SUCCESS, HIDE_NOTIFICATION, HIDE_POPUP_MESSAGE, REMOVE_DEPLOY_OPTION, REMOVE_INSTANCE, REMOVE_PROVIDER, RESET_STATE, SET_BASE_FEE_PER_GAS, SET_CONFIRM_SETTINGS, SET_CURRENT_CONTRACT, SET_CURRENT_FILE, SET_DECODED_RESPONSE, SET_DEPLOY_OPTIONS, SET_EXECUTION_ENVIRONMENT, SET_EXTERNAL_WEB3_ENDPOINT, SET_GAS_LIMIT, SET_GAS_PRICE, SET_GAS_PRICE_STATUS, SET_IPFS_CHECKED_STATE, SET_LOAD_TYPE, SET_MATCH_PASSPHRASE, SET_MAX_FEE, SET_MAX_PRIORITY_FEE, SET_NETWORK_NAME, SET_PASSPHRASE, SET_PATH_TO_SCENARIO, SET_PERSONAL_MODE, SET_PROXY_ENV_ADDRESS, SET_RECORDER_COUNT, SET_SELECTED_ACCOUNT, SET_SEND_UNIT, SET_SEND_VALUE, SET_REMIXD_ACTIVATED, FETCH_PROXY_DEPLOYMENTS, NEW_PROXY_DEPLOYMENT, RESET_PROXY_DEPLOYMENTS } from '../constants' +import { ADD_DEPLOY_OPTION, ADD_INSTANCE, ADD_PROVIDER, CLEAR_INSTANCES, CLEAR_RECORDER_COUNT, DISPLAY_NOTIFICATION, DISPLAY_POPUP_MESSAGE, FETCH_ACCOUNTS_LIST_FAILED, FETCH_ACCOUNTS_LIST_REQUEST, FETCH_ACCOUNTS_LIST_SUCCESS, FETCH_CONTRACT_LIST_FAILED, FETCH_CONTRACT_LIST_REQUEST, FETCH_CONTRACT_LIST_SUCCESS, HIDE_NOTIFICATION, HIDE_POPUP_MESSAGE, REMOVE_DEPLOY_OPTION, REMOVE_INSTANCE, REMOVE_PROVIDER, RESET_STATE, SET_BASE_FEE_PER_GAS, SET_CONFIRM_SETTINGS, SET_CURRENT_CONTRACT, SET_CURRENT_FILE, SET_DECODED_RESPONSE, SET_DEPLOY_OPTIONS, SET_EXECUTION_ENVIRONMENT, SET_EXTERNAL_WEB3_ENDPOINT, SET_GAS_LIMIT, SET_GAS_PRICE, SET_GAS_PRICE_STATUS, SET_IPFS_CHECKED_STATE, SET_LOAD_TYPE, SET_MATCH_PASSPHRASE, SET_MAX_FEE, SET_MAX_PRIORITY_FEE, SET_NETWORK_NAME, SET_PASSPHRASE, SET_PATH_TO_SCENARIO, SET_PERSONAL_MODE, SET_RECORDER_COUNT, SET_SELECTED_ACCOUNT, SET_SEND_UNIT, SET_SEND_VALUE, SET_REMIXD_ACTIVATED, FETCH_PROXY_DEPLOYMENTS, NEW_PROXY_DEPLOYMENT, RESET_PROXY_DEPLOYMENTS } from '../constants' import { ContractList, DeployOptions } from '../types' export const fetchAccountsListRequest = () => { @@ -301,13 +301,6 @@ export const setCurrentContract = (contractName: string) => { } } -export const setProxyEnvAddress = (key: string) => { - return { - payload: key, - type: SET_PROXY_ENV_ADDRESS - } -} - export const setRemixDActivated = (activated: boolean) => { return { payload: activated, 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 ebf6af657a..7e11803b0c 100644 --- a/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx @@ -32,7 +32,7 @@ export function ContractDropdownUI (props: ContractDropdownProps) { const [compilerName, setCompilerName] = useState('') const contractsRef = useRef(null) const atAddressValue = useRef(null) - const { contractList, loadType, currentFile, compilationSource, currentContract, compilationCount, deployOptions, proxyKey } = props.contracts + const { contractList, loadType, currentFile, compilationSource, currentContract, compilationCount, deployOptions } = props.contracts useEffect(() => { enableContractNames(Object.keys(props.contracts.contractList).length > 0) @@ -311,7 +311,7 @@ export function ContractDropdownUI (props: ContractDropdownProps) { widthClass='w-50' evmBC={loadedContractData.bytecodeObject} lookupOnly={false} - savedProxyAddress={proxyKey} + proxy={props.proxy} isValidProxyAddress={props.isValidProxyAddress} />
diff --git a/libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx b/libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx index 1af2272da5..33bbd3a8ec 100644 --- a/libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx @@ -4,7 +4,7 @@ import { FormattedMessage, useIntl } from 'react-intl' import * as remixLib from '@remix-project/remix-lib' import { ContractGUIProps } from '../types' import { CopyToClipboard } from '@remix-ui/clipboard' -import { CustomTooltip } from '@remix-ui/helper' +import { CustomTooltip, shortenDeploymentAddresses } from '@remix-ui/helper' const txFormat = remixLib.execution.txFormat const txHelper = remixLib.execution.txHelper @@ -218,14 +218,14 @@ export function ContractGUI (props: ContractGUIProps) { setToggleUpgradeImp(value) if (value) { setToggleDeployProxy(false) - if (useLastProxy) setProxyAddress(props.savedProxyAddress) + // if (useLastProxy) setProxyAddress(props.savedProxyAddress) } setDeployState({ deploy: false, upgrade: value }) } const handleUseLastProxySelect = (e) => { const value = e.target.checked - const address = props.savedProxyAddress + const address = '' /* props.savedProxyAddress */ if (value) { if (address) { @@ -558,7 +558,7 @@ export function ContractGUI (props: ContractGUIProps) {
: } diff --git a/libs/remix-ui/run-tab/src/lib/constants/index.ts b/libs/remix-ui/run-tab/src/lib/constants/index.ts index cfd5518e6e..dbd04e9e27 100644 --- a/libs/remix-ui/run-tab/src/lib/constants/index.ts +++ b/libs/remix-ui/run-tab/src/lib/constants/index.ts @@ -44,7 +44,6 @@ export const ADD_DEPLOY_OPTION = 'ADD_DEPLOY_OPTION' export const REMOVE_DEPLOY_OPTION = 'REMOVE_DEPLOY_OPTION' export const SET_DEPLOY_OPTIONS = 'SET_DEPLOY_OPTIONS' export const SET_CURRENT_CONTRACT = 'SET_CURRENT_CONTRACT' -export const SET_PROXY_ENV_ADDRESS = 'SET_PROXY_ENV_ADDRESS' export const SET_REMIXD_ACTIVATED = 'SET_REMIXD_ACTIVATED' export const FETCH_PROXY_DEPLOYMENTS = 'FETCH_PROXY_DEPLOYMENTS' export const NEW_PROXY_DEPLOYMENT = 'NEW_PROXY_DEPLOYMENT' diff --git a/libs/remix-ui/run-tab/src/lib/reducers/runTab.ts b/libs/remix-ui/run-tab/src/lib/reducers/runTab.ts index 13c5faf3ce..49bbfbe70d 100644 --- a/libs/remix-ui/run-tab/src/lib/reducers/runTab.ts +++ b/libs/remix-ui/run-tab/src/lib/reducers/runTab.ts @@ -1,6 +1,6 @@ import { ContractData } from '@remix-project/core-plugin' import { ContractList, DeployOptions, RunTabState } from '../types' -import { ADD_INSTANCE, ADD_PROVIDER, CLEAR_INSTANCES, CLEAR_RECORDER_COUNT, DISPLAY_NOTIFICATION, DISPLAY_POPUP_MESSAGE, FETCH_ACCOUNTS_LIST_FAILED, FETCH_ACCOUNTS_LIST_REQUEST, FETCH_ACCOUNTS_LIST_SUCCESS, FETCH_CONTRACT_LIST_FAILED, FETCH_CONTRACT_LIST_REQUEST, FETCH_CONTRACT_LIST_SUCCESS, FETCH_PROVIDER_LIST_FAILED, FETCH_PROVIDER_LIST_REQUEST, FETCH_PROVIDER_LIST_SUCCESS, HIDE_NOTIFICATION, HIDE_POPUP_MESSAGE, REMOVE_INSTANCE, REMOVE_PROVIDER, RESET_STATE, SET_BASE_FEE_PER_GAS, SET_CONFIRM_SETTINGS, SET_CURRENT_CONTRACT, SET_CURRENT_FILE, SET_DECODED_RESPONSE, SET_DEPLOY_OPTIONS, SET_EXECUTION_ENVIRONMENT, SET_EXTERNAL_WEB3_ENDPOINT, SET_GAS_LIMIT, SET_GAS_PRICE, SET_GAS_PRICE_STATUS, SET_IPFS_CHECKED_STATE, SET_LOAD_TYPE, SET_MATCH_PASSPHRASE, SET_MAX_FEE, SET_MAX_PRIORITY_FEE, SET_NETWORK_NAME, SET_PASSPHRASE, SET_PATH_TO_SCENARIO, SET_PERSONAL_MODE, SET_RECORDER_COUNT, SET_SELECTED_ACCOUNT, SET_SEND_UNIT, SET_SEND_VALUE, SET_PROXY_ENV_ADDRESS, ADD_DEPLOY_OPTION, REMOVE_DEPLOY_OPTION, SET_REMIXD_ACTIVATED, FETCH_PROXY_DEPLOYMENTS, NEW_PROXY_DEPLOYMENT, RESET_PROXY_DEPLOYMENTS } from '../constants' +import { ADD_INSTANCE, ADD_PROVIDER, CLEAR_INSTANCES, CLEAR_RECORDER_COUNT, DISPLAY_NOTIFICATION, DISPLAY_POPUP_MESSAGE, FETCH_ACCOUNTS_LIST_FAILED, FETCH_ACCOUNTS_LIST_REQUEST, FETCH_ACCOUNTS_LIST_SUCCESS, FETCH_CONTRACT_LIST_FAILED, FETCH_CONTRACT_LIST_REQUEST, FETCH_CONTRACT_LIST_SUCCESS, FETCH_PROVIDER_LIST_FAILED, FETCH_PROVIDER_LIST_REQUEST, FETCH_PROVIDER_LIST_SUCCESS, HIDE_NOTIFICATION, HIDE_POPUP_MESSAGE, REMOVE_INSTANCE, REMOVE_PROVIDER, RESET_STATE, SET_BASE_FEE_PER_GAS, SET_CONFIRM_SETTINGS, SET_CURRENT_CONTRACT, SET_CURRENT_FILE, SET_DECODED_RESPONSE, SET_DEPLOY_OPTIONS, SET_EXECUTION_ENVIRONMENT, SET_EXTERNAL_WEB3_ENDPOINT, SET_GAS_LIMIT, SET_GAS_PRICE, SET_GAS_PRICE_STATUS, SET_IPFS_CHECKED_STATE, SET_LOAD_TYPE, SET_MATCH_PASSPHRASE, SET_MAX_FEE, SET_MAX_PRIORITY_FEE, SET_NETWORK_NAME, SET_PASSPHRASE, SET_PATH_TO_SCENARIO, SET_PERSONAL_MODE, SET_RECORDER_COUNT, SET_SELECTED_ACCOUNT, SET_SEND_UNIT, SET_SEND_VALUE, ADD_DEPLOY_OPTION, REMOVE_DEPLOY_OPTION, SET_REMIXD_ACTIVATED, FETCH_PROXY_DEPLOYMENTS, NEW_PROXY_DEPLOYMENT, RESET_PROXY_DEPLOYMENTS } from '../constants' declare const window: any interface Action { @@ -43,7 +43,6 @@ export const runTabInitialState: RunTabState = { contracts: { contractList: {}, deployOptions: {} as any, - proxyKey: '', compilationSource: '', loadType: 'other', currentFile: '', @@ -604,18 +603,6 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A } } - case SET_PROXY_ENV_ADDRESS: { - const payload: string = action.payload - - return { - ...state, - contracts: { - ...state.contracts, - proxyKey: payload - } - } - } - case SET_REMIXD_ACTIVATED: { const payload: boolean = action.payload return { 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 e5fb961364..05b2614151 100644 --- a/libs/remix-ui/run-tab/src/lib/run-tab.tsx +++ b/libs/remix-ui/run-tab/src/lib/run-tab.tsx @@ -242,6 +242,7 @@ export function RunTabUI (props: RunTabProps) { setSelectedContract={updateSelectedContract} remixdActivated={runTab.remixdActivated} isValidProxyAddress={isValidProxyAddress} + proxy={runTab.proxy} /> { txRunner: any; networkcallid: number; networkStatus: { - name: string; - id: string; + network: { + name: string; + id: string; + }; }; setupEvents(): void; getCurrentNetworkStatus(): { 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 cc2ca3cc99..470b45bb23 100644 --- a/libs/remix-ui/run-tab/src/lib/types/index.ts +++ b/libs/remix-ui/run-tab/src/lib/types/index.ts @@ -67,7 +67,6 @@ export interface RunTabState { }[] }, deployOptions: { [file: string]: { [name: string]: DeployOptions } }, - proxyKey: string, loadType: 'abi' | 'sol' | 'other' currentFile: string, compilationSource: string, @@ -227,7 +226,6 @@ export interface ContractDropdownProps { contracts: { contractList: ContractList, deployOptions: { [file: string]: { [name: string]: DeployOptions } }, - proxyKey: string, loadType: 'abi' | 'sol' | 'other', currentFile: string, compilationSource: string @@ -264,7 +262,8 @@ export interface ContractDropdownProps { setNetworkName: (name: string) => void, setSelectedContract: (contractName: string) => void remixdActivated: boolean, - isValidProxyAddress?: (address: string) => Promise + isValidProxyAddress?: (address: string) => Promise, + proxy: { deployments: { address: string, date: Date }[] } } export interface RecorderProps { @@ -359,7 +358,7 @@ export interface ContractGUIProps { isDeploy?: boolean, deployOption?: { title: DeployMode, active: boolean }[], initializerOptions?: DeployOption, - savedProxyAddress?: string, + proxy?: { deployments: { address: string, date: Date }[] }, isValidProxyAddress?: (address: string) => Promise } export interface MainnetProps {