Fixed publish contract e2e

yann300-patch-36
David Disu 3 years ago committed by yann300
parent a2ddbed742
commit 21f1e1ca1f
  1. 8
      apps/remix-ide-e2e/src/tests/publishContract.test.ts
  2. 2
      libs/remix-ui/publish-to-storage/src/lib/publish-to-storage.tsx
  3. 1
      libs/remix-ui/publish-to-storage/src/lib/types/index.ts
  4. 10
      libs/remix-ui/run-tab/src/lib/actions/index.ts
  5. 20
      libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx
  6. 3
      libs/remix-ui/run-tab/src/lib/reducers/runTab.ts
  7. 13
      libs/remix-ui/run-tab/src/lib/run-tab.tsx
  8. 4
      libs/remix-ui/run-tab/src/lib/types/index.ts

@ -60,10 +60,12 @@ module.exports = {
.click('*[data-id="contractDropdownIpfsCheckbox"]')
.waitForElementVisible('*[data-id="Deploy - transact (not payable)"]')
.click('*[data-id="Deploy - transact (not payable)"]')
.pause(8000)
.getModalBody((value, done) => {
.pause(5000)
.waitForElementVisible('[data-id="udappModalDialogModalBody-react"]')
.getText('[data-id="udappModalDialogModalBody-react"]', (result) => {
const value = typeof result.value === 'string' ? result.value : null
if (value.indexOf('Metadata of "storage" was published successfully.') === -1) browser.assert.fail('ipfs deploy failed')
done()
})
.modalFooterOKClick()
},

@ -95,7 +95,7 @@ export const PublishToStorage = (props: RemixUiPublishToStorageProps) => {
return (
<ModalDialog
id='publishToStorage'
id={props.id || 'publishToStorage'}
title={ state.modal.title }
message={ state.modal.message }
hide={ state.modal.hide }

@ -1,4 +1,5 @@
export interface RemixUiPublishToStorageProps {
id?: string
api: any,
storage: 'swarm' | 'ipfs',
contract: any,

@ -3,7 +3,7 @@ import React from 'react'
import * as ethJSUtil from 'ethereumjs-util'
import Web3 from 'web3'
import { addressToString, createNonClashingNameAsync, shortenAddress } from '@remix-ui/helper'
import { addNewInstance, addProvider, clearAllInstances, clearRecorderCount, displayNotification, displayPopUp, fetchAccountsListFailed, fetchAccountsListRequest, fetchAccountsListSuccess, fetchContractListSuccess, hidePopUp, removeExistingInstance, removeProvider, setBaseFeePerGas, setConfirmSettings, setCurrentFile, setDecodedResponse, setEnvToasterContent, setExecutionEnvironment, setExternalEndpoint, setGasLimit, setGasPrice, setGasPriceStatus, setIpfsCheckedState, setLoadType, setMatchPassphrase, setMaxFee, setMaxPriorityFee, setNetworkName, setPassphrase, setPathToScenario, setRecorderCount, setSelectedAccount, setSendUnit, setSendValue, setTxFeeContent, setWeb3Dialog } from './payload'
import { addNewInstance, addProvider, clearAllInstances, clearRecorderCount, displayNotification, displayPopUp, fetchAccountsListFailed, fetchAccountsListRequest, fetchAccountsListSuccess, fetchContractListSuccess, hidePopUp, removeExistingInstance, removeProvider, setBaseFeePerGas, setConfirmSettings, setCurrentFile, setDecodedResponse, setEnvToasterContent, setExecutionEnvironment, setExternalEndpoint, setGasLimit, setGasPrice, setGasPriceStatus, setLoadType, setMatchPassphrase, setMaxFee, setMaxPriorityFee, setNetworkName, setPassphrase, setPathToScenario, setRecorderCount, setSelectedAccount, setSendUnit, setSendValue, setTxFeeContent, setWeb3Dialog } from './payload'
import { RunTab } from '../types/run-tab'
import { CompilerAbstract } from '@remix-project/remix-solidity'
import * as remixLib from '@remix-project/remix-lib'
@ -75,7 +75,7 @@ const setupEvents = () => {
return
}
const networkProvider = plugin.networkModule.getNetworkProvider.bind(plugin.networkModule)
const netUI = (networkProvider() !== 'vm') ? `${network.name} (${network.id || '-'}) network` : ''
const netUI = (networkProvider() !== 'vm') ? `${network.name} (${network.id || '-'}) network` : 'VM'
setNetworkNameFromProvider(netUI)
})
@ -231,7 +231,7 @@ const setExecEnv = (env: string) => {
dispatch(setExecutionEnvironment(env))
}
const setNetworkNameFromProvider = (networkName: string) => {
export const setNetworkNameFromProvider = (networkName: string) => {
dispatch(setNetworkName(networkName))
}
@ -522,10 +522,6 @@ const deployContract = (selectedContract, args, contractMetadata, compilerContra
plugin.blockchain.deployContractWithLibrary(selectedContract, args, contractMetadata, compilerContracts, callbacks, confirmationCb)
}
export const setCheckIpfs = (value: boolean) => {
dispatch(setIpfsCheckedState(value))
}
export const updateGasPriceStatus = (status: boolean) => {
dispatch(setGasPriceStatus(status))
}

@ -5,7 +5,6 @@ import * as ethJSUtil from 'ethereumjs-util'
import { ContractGUI } from './contractGUI'
export function ContractDropdownUI (props: ContractDropdownProps) {
const [networkName, setNetworkName] = useState<string>('')
const [abiLabel, setAbiLabel] = useState<{
display: string,
content: string
@ -31,10 +30,6 @@ export function ContractDropdownUI (props: ContractDropdownProps) {
useEffect(() => {
enableAtAddress(false)
const savedConfig = window.localStorage.getItem(`ipfs/${props.exEnvironment}/${networkName}`)
const isCheckedIPFS = savedConfig === 'true' ? true : false // eslint-disable-line
if (isCheckedIPFS) props.setIpfsCheckedState(true)
setAbiLabel({
display: 'none',
content: 'ABI file selected'
@ -42,8 +37,13 @@ export function ContractDropdownUI (props: ContractDropdownProps) {
}, [])
useEffect(() => {
if (props.exEnvironment === 'vm-london' || props.exEnvironment === 'vm-berlin') setNetworkName('VM')
}, [props.exEnvironment])
if (props.exEnvironment && props.networkName) {
const savedConfig = window.localStorage.getItem(`ipfs/${props.exEnvironment}/${props.networkName}`)
const isCheckedIPFS = savedConfig === 'true' ? true : false // eslint-disable-line
props.setIpfsCheckedState(isCheckedIPFS)
}
}, [props.exEnvironment, props.networkName])
useEffect(() => {
if (!loadFromAddress || !ethJSUtil.isValidAddress(loadedAddress)) enableAtAddress(false)
@ -164,8 +164,10 @@ export function ContractDropdownUI (props: ContractDropdownProps) {
}
const handleCheckedIPFS = () => {
props.setIpfsCheckedState(!props.ipfsCheckedState)
window.localStorage.setItem(`ipfs/${props.exEnvironment}/${networkName}`, props.ipfsCheckedState.toString())
const checkedState = !props.ipfsCheckedState
props.setIpfsCheckedState(checkedState)
window.localStorage.setItem(`ipfs/${props.exEnvironment}/${props.networkName}`, checkedState.toString())
}
const handleContractChange = (e) => {

@ -95,7 +95,7 @@ export const runTabInitialState: RunTabState = {
gasLimit: 3000000,
selectExEnv: 'vm-london',
personalMode: false,
networkName: '',
networkName: 'VM',
providers: {
providerList: [{
id: 'vm-mode-london',
@ -257,6 +257,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
return {
...state,
selectExEnv: payload,
networkName: state.selectExEnv === 'vm-london' || state.selectExEnv === 'vm-berlin' ? 'VM' : state.networkName,
accounts: {
...state.accounts,
selectedAccount: '',

@ -16,7 +16,7 @@ import {
clearPopUp, createNewBlockchainAccount,
setPassphrasePrompt, setMatchPassphrasePrompt,
signMessageWithAddress, getSelectedContract,
createInstance, setCheckIpfs,
createInstance,
updateBaseFeePerGas, updateConfirmSettings,
updateGasPrice, updateGasPriceStatus,
updateMaxFee, updateMaxPriorityFee,
@ -25,7 +25,7 @@ import {
runTransactions, loadAddress,
storeScenario, runCurrentScenario,
updateScenarioPath, initWebDialogs,
getFuncABIInputs
getFuncABIInputs, setNetworkNameFromProvider
} from './actions'
import './css/run-tab.css'
import { PublishToStorage } from '@remix-ui/publish-to-storage'
@ -33,6 +33,7 @@ import { PassphrasePrompt } from './components/passphrase'
import { MainnetPrompt } from './components/mainnet'
import { ScenarioPrompt } from './components/scenario'
import { Web3ProviderDialog } from './components/web3Dialog'
import { setIpfsCheckedState } from './actions/payload'
export function RunTabUI (props: RunTabProps) {
const { plugin } = props
@ -112,6 +113,10 @@ export function RunTabUI (props: RunTabProps) {
}
}, [runTab.popup])
const setCheckIpfs = (value: boolean) => {
dispatch(setIpfsCheckedState(value))
}
const modal = (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => {
setModals(modals => {
modals.push({ message, title, okLabel, okFn, cancelLabel, cancelFn })
@ -254,6 +259,8 @@ export function RunTabUI (props: RunTabProps) {
mainnetPrompt={mainnetPrompt}
tooltip={toast}
loadAddress={loadAddress}
networkName={runTab.networkName}
setNetworkName={setNetworkNameFromProvider}
/>
<RecorderUI
gasEstimationPrompt={gasEstimationPrompt}
@ -282,7 +289,7 @@ export function RunTabUI (props: RunTabProps) {
</div>
<ModalDialog id='fileSystem' { ...focusModal } handleHide={ handleHideModal } />
<Toaster message={focusToaster} handleHide={handleToaster} />
<PublishToStorage api={props.plugin} resetStorage={resetStorage} storage={publishData.storage} contract={publishData.contract} />
<PublishToStorage id='udapp' api={props.plugin} resetStorage={resetStorage} storage={publishData.storage} contract={publishData.contract} />
</Fragment>
)
}

@ -180,7 +180,9 @@ export interface ContractDropdownProps {
passphrasePrompt: (message: string) => JSX.Element,
mainnetPrompt: (tx: Tx, network: Network, amount: string, gasEstimation: string, gasFees: (maxFee: string, cb: (txFeeText: string, priceStatus: boolean) => void) => void, determineGasPrice: (cb: (txFeeText: string, gasPriceValue: string, gasPriceStatus: boolean) => void) => void) => JSX.Element,
tooltip: (toasterMsg: string | JSX.Element) => void,
loadAddress: (contract: ContractData, address: string) => void
loadAddress: (contract: ContractData, address: string) => void,
networkName: string,
setNetworkName: (name: string) => void
}
export interface RecorderProps {

Loading…
Cancel
Save