Skip to content

Commit 21f68ba

Browse files
authored
Merge pull request #2987 from ethereum/dropdowncontracts
Dropdowncontracts
2 parents 4b7ac36 + 5c482da commit 21f68ba

File tree

8 files changed

+124
-79
lines changed

8 files changed

+124
-79
lines changed

libs/remix-ui/run-tab/src/lib/actions/events.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import { envChangeNotification } from "@remix-ui/helper"
22
import { RunTab } from "../types/run-tab"
33
import { setExecutionContext, setFinalContext, updateAccountBalances } from "./account"
44
import { addExternalProvider, addInstance, removeExternalProvider, setNetworkNameFromProvider } from "./actions"
5-
import { addDeployOption, clearAllInstances, clearRecorderCount, fetchContractListSuccess, resetUdapp, setCompilationSource, setCurrentContract, setCurrentFile, setLoadType, setProxyEnvAddress, setRecorderCount, setSendValue } from "./payload"
5+
import { addDeployOption, clearAllInstances, clearRecorderCount, fetchContractListSuccess, resetUdapp, setCurrentContract, setCurrentFile, setLoadType, setProxyEnvAddress, setRecorderCount, setRemixDActivated, setSendValue } from "./payload"
66
import { CompilerAbstract } from '@remix-project/remix-solidity'
77
import * as ethJSUtil from 'ethereumjs-util'
88
import Web3 from 'web3'
9+
import { Plugin } from "@remixproject/engine"
910
const _paq = window._paq = window._paq || []
1011

1112
export const setupEvents = (plugin: RunTab, dispatch: React.Dispatch<any>) => {
@@ -74,6 +75,21 @@ export const setupEvents = (plugin: RunTab, dispatch: React.Dispatch<any>) => {
7475
plugin.on('filePanel', 'setWorkspace', () => {
7576
dispatch(resetUdapp())
7677
resetAndInit(plugin)
78+
plugin.call('manager', 'isActive', 'remixd').then((activated) => {
79+
dispatch(setRemixDActivated(activated))
80+
})
81+
})
82+
83+
plugin.on('manager', 'pluginActivated', (plugin: Plugin) => {
84+
if (plugin.name === 'remixd') {
85+
dispatch(setRemixDActivated(true))
86+
}
87+
})
88+
89+
plugin.on('manager', 'pluginDeactivated', (plugin: Plugin) => {
90+
if (plugin.name === 'remixd') {
91+
dispatch(setRemixDActivated(false))
92+
}
7793
})
7894

7995
plugin.fileManager.events.on('currentFileChanged', (currentFile: string) => {
@@ -107,7 +123,7 @@ const broadcastCompilationResult = async (compilerName: string, plugin: RunTab,
107123
plugin.compilersArtefacts.__last = compiler
108124

109125
const contracts = getCompiledContracts(compiler).map((contract) => {
110-
return { name: languageVersion, alias: contract.name, file: contract.file, compiler }
126+
return { name: languageVersion, alias: contract.name, file: contract.file, compiler, compilerName }
111127
})
112128
if ((contracts.length > 0)) {
113129
const contractsInCompiledFile = contracts.filter(obj => obj.file === file)
@@ -127,7 +143,6 @@ const broadcastCompilationResult = async (compilerName: string, plugin: RunTab,
127143
}
128144
dispatch(fetchContractListSuccess({ [file]: contracts }))
129145
dispatch(setCurrentFile(file))
130-
dispatch(setCompilationSource(compilerName))
131146
// TODO: set current contract
132147
}
133148

libs/remix-ui/run-tab/src/lib/actions/payload.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ContractList } from '../reducers/runTab'
22
import { ContractData } from '@remix-project/core-plugin'
3-
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_COMPILATION_SOURCE, 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 } from '../constants'
3+
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 } from '../constants'
44
import { DeployMode, DeployOptions } from '../types'
55

66
export const fetchAccountsListRequest = () => {
@@ -168,13 +168,6 @@ export const setCurrentFile = (file: string) => {
168168
}
169169
}
170170

171-
export const setCompilationSource = (source: string) => {
172-
return {
173-
type: SET_COMPILATION_SOURCE,
174-
payload: source
175-
}
176-
}
177-
178171
export const setIpfsCheckedState = (state: boolean) => {
179172
return {
180173
type: SET_IPFS_CHECKED_STATE,
@@ -315,3 +308,10 @@ export const setProxyEnvAddress = (key: string) => {
315308
type: SET_PROXY_ENV_ADDRESS
316309
}
317310
}
311+
312+
export const setRemixDActivated = (activated: boolean) => {
313+
return {
314+
payload: activated,
315+
type: SET_REMIXD_ACTIVATED
316+
}
317+
}

libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx

Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,27 @@ import { deployWithProxyMsg, upgradeWithProxyMsg } from '@remix-ui/helper'
88
import { OverlayTrigger, Tooltip } from 'react-bootstrap'
99
const _paq = window._paq = window._paq || []
1010

11-
export function ContractDropdownUI (props: ContractDropdownProps) {
11+
export function ContractDropdownUI(props: ContractDropdownProps) {
1212
const [abiLabel, setAbiLabel] = useState<{
1313
display: string,
1414
content: string
1515
}>({
1616
display: '',
1717
content: ''
1818
})
19-
const [atAddressOptions, setAtAddressOptions] = useState<{title: string, disabled: boolean}>({
19+
const [atAddressOptions, setAtAddressOptions] = useState<{ title: string, disabled: boolean }>({
2020
title: 'address of contract',
2121
disabled: true
2222
})
2323
const [loadedAddress, setLoadedAddress] = useState<string>('')
24-
const [contractOptions, setContractOptions] = useState<{title: string, disabled: boolean}>({
24+
const [contractOptions, setContractOptions] = useState<{ title: string, disabled: boolean }>({
2525
title: 'Please compile *.sol file to deploy or access a contract',
2626
disabled: true
2727
})
2828
const [loadedContractData, setLoadedContractData] = useState<ContractData>(null)
2929
const [constructorInterface, setConstructorInterface] = useState<FuncABI>(null)
3030
const [constructorInputs, setConstructorInputs] = useState(null)
31+
const [compilerName, setCompilerName] = useState<string>('')
3132
const contractsRef = useRef<HTMLSelectElement>(null)
3233
const atAddressValue = useRef<HTMLInputElement>(null)
3334
const { contractList, loadType, currentFile, compilationSource, currentContract, compilationCount, deployOptions, proxyKey } = props.contracts
@@ -98,20 +99,23 @@ export function ContractDropdownUI (props: ContractDropdownProps) {
9899

99100
useEffect(() => {
100101
initSelectedContract()
102+
updateCompilerName()
101103
}, [contractList])
102104

103105
useEffect(() => {
104106
// if the file change the ui is already feed with another bunch of contracts.
105107
// we also need to update the state
106-
const contracts = contractList[currentFile]
108+
const contracts = contractList[currentFile]
107109
if (contracts && contracts.length > 0) {
108110
props.setSelectedContract(contracts[0].alias)
109111
}
112+
updateCompilerName()
110113
}, [currentFile])
111114

112115
const initSelectedContract = () => {
113116
const contracts = contractList[currentFile]
114-
117+
118+
115119
if (contracts && contracts.length > 0) {
116120
const contract = contracts.find(contract => contract.alias === currentContract)
117121

@@ -123,9 +127,9 @@ export function ContractDropdownUI (props: ContractDropdownProps) {
123127

124128
const isContractFile = (file) => {
125129
return /.(.sol)$/.exec(file) ||
126-
/.(.vy)$/.exec(file) || // vyper
127-
/.(.lex)$/.exec(file) || // lexon
128-
/.(.contract)$/.exec(file)
130+
/.(.vy)$/.exec(file) || // vyper
131+
/.(.lex)$/.exec(file) || // lexon
132+
/.(.contract)$/.exec(file)
129133
}
130134

131135
const enableAtAddress = (enable: boolean) => {
@@ -162,20 +166,20 @@ export function ContractDropdownUI (props: ContractDropdownProps) {
162166

163167
const createInstance = (selectedContract, args, deployMode?: DeployMode[]) => {
164168
if (selectedContract.bytecodeObject.length === 0) {
165-
return props.modal('Alert', 'This contract may be abstract, it may not implement an abstract parent\'s methods completely or it may not invoke an inherited contract\'s constructor correctly.', 'OK', () => {})
169+
return props.modal('Alert', 'This contract may be abstract, it may not implement an abstract parent\'s methods completely or it may not invoke an inherited contract\'s constructor correctly.', 'OK', () => { })
166170
}
167171
if ((selectedContract.name !== currentContract) && (selectedContract.name === 'ERC1967Proxy')) selectedContract.name = currentContract
168172
const isProxyDeployment = (deployMode || []).find(mode => mode === 'Deploy with Proxy')
169173
const isContractUpgrade = (deployMode || []).find(mode => mode === 'Upgrade with Proxy')
170-
174+
171175
if (isProxyDeployment) {
172176
props.modal('Deploy Implementation & Proxy (ERC1967)', deployWithProxyMsg(), 'Proceed', () => {
173177
props.createInstance(loadedContractData, props.gasEstimationPrompt, props.passphrasePrompt, props.publishToStorage, props.mainnetPrompt, isOverSizePrompt, args, deployMode)
174-
}, 'Cancel', () => {})
178+
}, 'Cancel', () => { })
175179
} else if (isContractUpgrade) {
176180
props.modal('Deploy Implementation & Update Proxy', upgradeWithProxyMsg(), 'Proceed', () => {
177181
props.createInstance(loadedContractData, props.gasEstimationPrompt, props.passphrasePrompt, props.publishToStorage, props.mainnetPrompt, isOverSizePrompt, args, deployMode)
178-
}, 'Cancel', () => {})
182+
}, 'Cancel', () => { })
179183
} else {
180184
props.createInstance(loadedContractData, props.gasEstimationPrompt, props.passphrasePrompt, props.publishToStorage, props.mainnetPrompt, isOverSizePrompt, args, deployMode)
181185
}
@@ -212,9 +216,21 @@ export function ContractDropdownUI (props: ContractDropdownProps) {
212216
window.localStorage.setItem(`ipfs/${props.exEnvironment}/${props.networkName}`, checkedState.toString())
213217
}
214218

219+
const updateCompilerName = () => {
220+
if (contractsRef.current.value) {
221+
contractList[currentFile].forEach(contract => {
222+
if (contract.alias === contractsRef.current.value) {
223+
setCompilerName(contract.compilerName)
224+
}
225+
})
226+
} else{
227+
setCompilerName('')
228+
}
229+
}
230+
215231
const handleContractChange = (e) => {
216232
const value = e.target.value
217-
233+
updateCompilerName()
218234
props.setSelectedContract(value)
219235
}
220236

@@ -231,7 +247,7 @@ export function ContractDropdownUI (props: ContractDropdownProps) {
231247
const isOverSizePrompt = () => {
232248
return (
233249
<div>Contract creation initialization returns data with length of more than 24576 bytes. The deployment will likely fails. <br />
234-
More info: <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-170.md" target="_blank" rel="noreferrer">eip-170</a>
250+
More info: <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-170.md" target="_blank" rel="noreferrer">eip-170</a>
235251
</div>
236252
)
237253
}
@@ -241,33 +257,37 @@ export function ContractDropdownUI (props: ContractDropdownProps) {
241257
<div className='d-flex justify-content-between'>
242258
<div className="d-flex justify-content-between align-items-end">
243259
<label className="udapp_settingsLabel pr-1">Contract</label>
244-
<div className="d-flex">{ Object.keys(props.contracts.contractList).length > 0 && compilationSource !== '' && <label className="text-capitalize" style={{maxHeight: '0.6rem', lineHeight: '1rem'}} data-id="udappCompiledBy">(Compiled by {compilationSource})</label>}</div>
260+
<div className="d-flex">{compilerName && compilerName !== '' && <label className="text-capitalize" style={{ maxHeight: '0.6rem', lineHeight: '1rem' }} data-id="udappCompiledBy">(Compiled by {compilerName})</label>}</div>
245261
</div>
246-
<OverlayTrigger placement={'right'} overlay={
247-
<Tooltip className="text-nowrap" id="info-sync-compiled-contract">
248-
<div>Click here to import contracts compiled from an external framework.</div>
249-
<div>This action is enabled when Remix is connected to an external framework (hardhat, truffle, foundry) through remixd.</div>
250-
</Tooltip>
251-
}>
252-
<button className="btn d-flex py-0" onClick={_ => {
262+
{props.remixdActivated ?
263+
<OverlayTrigger placement={'right'} overlay={
264+
<Tooltip className="text-nowrap" id="info-sync-compiled-contract">
265+
<div>Click here to import contracts compiled from an external framework.</div>
266+
<div>This action is enabled when Remix is connected to an external framework (hardhat, truffle, foundry) through remixd.</div>
267+
</Tooltip>
268+
}>
269+
<button className="btn d-flex py-0" onClick={_ => {
253270
props.syncContracts()
254271
_paq.push(['trackEvent', 'udapp', 'syncContracts', compilationSource])
255272
}}>
256-
<i style={{ cursor: 'pointer' }} className="fa fa-refresh mr-2 mt-2" aria-hidden="true"></i>
257-
</button>
258-
</OverlayTrigger>
273+
<i style={{ cursor: 'pointer' }} className="fa fa-refresh mr-2 mt-2" aria-hidden="true"></i>
274+
</button>
275+
</OverlayTrigger>
276+
: null}
259277
</div>
260278
<div className="udapp_subcontainer">
261-
<select ref={contractsRef} value={currentContract} onChange={handleContractChange} className="udapp_contractNames custom-select" disabled={contractOptions.disabled} title={contractOptions.title} style={{ display: loadType === 'abi' && !isContractFile(currentFile) ? 'none' : 'block' }}>
262-
{ (contractList[currentFile] || []).map((contract, index) => {
263-
return <option key={index} value={contract.alias}>{contract.alias} - {contract.file}</option>
264-
}) }
279+
<select ref={contractsRef} value={currentContract} onChange={handleContractChange} className="udapp_contractNames custom-select" disabled={contractOptions.disabled} title={contractOptions.title} style={{ display: loadType === 'abi' && !isContractFile(currentFile) ? 'none' : 'block' }}>
280+
{(contractList[currentFile] || []).map((contract, index) => {
281+
return <option key={index} value={contract.alias}>
282+
{contract.alias} - {contract.file}
283+
</option>
284+
})}
265285
</select>
266-
<span className="py-1" style={{ display: abiLabel.display }}>{ abiLabel.content }</span>
286+
<span className="py-1" style={{ display: abiLabel.display }}>{abiLabel.content}</span>
267287
</div>
268288
<div>
269289
<div className="udapp_deployDropdown">
270-
{ ((contractList[currentFile] && contractList[currentFile].filter(contract => contract)) || []).length <= 0 ? 'No compiled contracts'
290+
{((contractList[currentFile] && contractList[currentFile].filter(contract => contract)) || []).length <= 0 ? 'No compiled contracts'
271291
: loadedContractData ? <div>
272292
<ContractGUI
273293
title='Deploy'

libs/remix-ui/run-tab/src/lib/constants/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export const FETCH_CONTRACT_LIST_SUCCESS = 'FETCH_CONTRACT_LIST_SUCCESS'
2525
export const FETCH_CONTRACT_LIST_FAILED = 'FETCH_CONTRACT_LIST_FAILED'
2626
export const SET_LOAD_TYPE = 'SET_LOAD_TYPE'
2727
export const SET_CURRENT_FILE = 'SET_CURRENT_FILE'
28-
export const SET_COMPILATION_SOURCE = 'SET_COMPILATION_SOURCE'
2928
export const SET_IPFS_CHECKED_STATE = 'SET_IPFS_CHECKED_STATE'
3029
export const SET_GAS_PRICE_STATUS = 'SET_GAS_PRICE_STATUS'
3130
export const SET_CONFIRM_SETTINGS = 'SET_CONFIRM_SETTINGS'
@@ -46,3 +45,4 @@ export const REMOVE_DEPLOY_OPTION = 'REMOVE_DEPLOY_OPTION'
4645
export const SET_DEPLOY_OPTIONS = 'SET_DEPLOY_OPTIONS'
4746
export const SET_CURRENT_CONTRACT = 'SET_CURRENT_CONTRACT'
4847
export const SET_PROXY_ENV_ADDRESS = 'SET_PROXY_ENV_ADDRESS'
48+
export const SET_REMIXD_ACTIVATED = 'SET_REMIXD_ACTIVATED'

libs/remix-ui/run-tab/src/lib/reducers/runTab.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { CompilerAbstract } from '@remix-project/remix-solidity-ts'
22
import { ContractData } from '@remix-project/core-plugin'
33
import { DeployOptions } from '../types'
4-
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_COMPILATION_SOURCE } from '../constants'
4+
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 } from '../constants'
55

66
declare const window: any
77
interface Action {
@@ -12,7 +12,8 @@ export interface Contract {
1212
name: string,
1313
alias: string,
1414
file: string,
15-
compiler: CompilerAbstract
15+
compiler: CompilerAbstract,
16+
compilerName: string
1617
}
1718

1819
export interface ContractList {
@@ -64,6 +65,7 @@ export interface RunTabState {
6465
alias: string,
6566
file: string,
6667
compiler: CompilerAbstract
68+
compilerName: string
6769
}[]
6870
},
6971
deployOptions: { [file: string]: { [name: string]: DeployOptions } },
@@ -99,6 +101,7 @@ export interface RunTabState {
99101
pathToScenario: string,
100102
transactionCount: number
101103
}
104+
remixdActivated: boolean
102105
}
103106

104107
export const runTabInitialState: RunTabState = {
@@ -180,7 +183,8 @@ export const runTabInitialState: RunTabState = {
180183
recorder: {
181184
pathToScenario: 'scenario.json',
182185
transactionCount: 0
183-
}
186+
},
187+
remixdActivated: false
184188
}
185189

186190
type AddProvider = {
@@ -518,19 +522,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
518522
}
519523
}
520524
}
521-
522-
case SET_COMPILATION_SOURCE: {
523-
const payload: string = action.payload
524-
525-
return {
526-
...state,
527-
contracts: {
528-
...state.contracts,
529-
compilationSource: payload,
530-
}
531-
}
532-
}
533-
525+
534526
case SET_IPFS_CHECKED_STATE: {
535527
const payload: boolean = action.payload
536528

@@ -734,6 +726,14 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
734726
}
735727
}
736728

729+
case SET_REMIXD_ACTIVATED: {
730+
const payload: boolean = action.payload
731+
return {
732+
...state,
733+
remixdActivated: payload
734+
}
735+
}
736+
737737
default:
738738
return state
739739
}

0 commit comments

Comments
 (0)