Merge branch 'master' into desktope2e-remixai

pull/5100/head
STetsing 2 months ago committed by GitHub
commit a0ca48c023
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 34
      apps/remix-ide-e2e/src/tests/pinned_contracts.test.ts
  2. 12
      apps/remix-ide/src/app/tabs/locales/en/udapp.json
  3. 10
      apps/remix-ide/src/app/udapp/run-tab.js
  4. 22
      libs/remix-ui/run-tab/src/lib/actions/actions.ts
  5. 8
      libs/remix-ui/run-tab/src/lib/actions/deploy.ts
  6. 17
      libs/remix-ui/run-tab/src/lib/actions/events.ts
  7. 8
      libs/remix-ui/run-tab/src/lib/actions/index.ts
  8. 38
      libs/remix-ui/run-tab/src/lib/actions/payload.ts
  9. 68
      libs/remix-ui/run-tab/src/lib/components/instanceContainerUI.tsx
  10. 41
      libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx
  11. 4
      libs/remix-ui/run-tab/src/lib/constants/index.ts
  12. 99
      libs/remix-ui/run-tab/src/lib/reducers/runTab.ts
  13. 5
      libs/remix-ui/run-tab/src/lib/run-tab.tsx
  14. 39
      libs/remix-ui/run-tab/src/lib/types/index.ts

@ -7,13 +7,11 @@ module.exports = {
before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done)
},
'Should show text in pinned contracts section #group1': function (browser: NightwatchBrowser) {
'Should show badge in deployed contracts section #group1': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('udapp')
.assert.elementPresent('*[data-id="pinnedContracts"]')
.assert.textContains('*[data-id="pinnedContractsSublabel"]', '(network: vm-cancun)')
.assert.elementPresent('*[data-id="NoPinnedInstanceText"]')
.assert.textContains('*[data-id="NoPinnedInstanceText"]', 'No pinned contracts found for selected workspace & network')
.assert.elementPresent('*[data-id="deployedContracts"]')
.assert.textContains('*[data-id="deployedContractsBadge"]', '0')
},
'Deploy & pin contract #group1': function (browser: NightwatchBrowser) {
browser
@ -24,22 +22,18 @@ module.exports = {
.clickLaunchIcon('udapp')
.click('*[data-id="Deploy - transact (not payable)"]')
.assert.elementPresent('*[data-id="unpinnedInstance0xd9145CCE52D386f254917e481eB44e9943F39138"]')
.assert.textContains('*[data-id="deployedContractsBadge"]', '1')
.click('*[data-id="universalDappUiUdappPin"]')
.assert.elementPresent('*[data-id="deployAndRunNoInstanceText"]')
.assert.textContains('*[data-id="deployAndRunNoInstanceText"]', 'Currently you have no unpinned contracts to interact with.')
.assert.not.elementPresent('*[data-id="NoPinnedInstanceText"]')
.assert.elementPresent('*[data-id="universalDappUiUdappUnpin"]')
.assert.elementPresent('*[data-id="pinnedInstance0xd9145CCE52D386f254917e481eB44e9943F39138"]')
},
'Test pinned contract loading on environment change #group1': function (browser: NightwatchBrowser) {
browser
.switchEnvironment('vm-shanghai')
.assert.elementPresent('*[data-id="pinnedContracts"]')
.assert.textContains('*[data-id="pinnedContractsSublabel"]', '(network: vm-shanghai)')
.assert.elementPresent('*[data-id="NoPinnedInstanceText"]')
.assert.textContains('*[data-id="NoPinnedInstanceText"]', 'No pinned contracts found for selected workspace & network')
.assert.elementPresent('*[data-id="deployedContracts"]')
.assert.textContains('*[data-id="deployedContractsBadge"]', '0')
.switchEnvironment('vm-cancun')
.assert.textContains('*[data-id="pinnedContractsSublabel"]', '(network: vm-cancun)')
.assert.not.elementPresent('*[data-id="NoPinnedInstanceText"]')
.assert.textContains('*[data-id="deployedContractsBadge"]', '1')
.assert.elementPresent('*[data-id="pinnedInstance0xd9145CCE52D386f254917e481eB44e9943F39138"]')
},
'Interact with pinned contract #group1': function (browser: NightwatchBrowser) {
@ -71,9 +65,6 @@ module.exports = {
'Unpin & interact #group1': function (browser: NightwatchBrowser) {
browser
.click('*[data-id="universalDappUiUdappUnpin"]')
.assert.textContains('*[data-id="NoPinnedInstanceText"]', 'No pinned contracts found for selected workspace & network')
.assert.not.elementPresent('*[data-id="deployAndRunNoInstanceText"]')
.click('*[data-id="universalDappUiTitleExpander0"]')
.assert.not.elementPresent('*[data-id="instanceContractPinnedAt"]')
.assert.not.elementPresent('*[data-id="instanceContractFilePath"]')
.clickFunction('retrieve - call')
@ -95,12 +86,11 @@ module.exports = {
'decoded output': { "0": "uint256: 55" }
})
},
'Re-pin & delete immediately #group1': function (browser: NightwatchBrowser) {
'Re-pin & remove from list #group1': function (browser: NightwatchBrowser) {
browser
.click('*[data-id="universalDappUiUdappPin"]')
.assert.elementPresent('*[data-id="deployAndRunNoInstanceText"]')
.click('*[data-id="universalDappUiUdappDelete"]')
.assert.textContains('*[data-id="NoPinnedInstanceText"]', 'No pinned contracts found for selected workspace & network')
.assert.textContains('*[data-id="deployAndRunNoInstanceText"]', 'Currently you have no unpinned contracts to interact with.')
.assert.textContains('*[data-id="deployedContractsBadge"]', '1')
.click('*[data-id="universalDappUiUdappClose"]')
.assert.textContains('*[data-id="deployedContractsBadge"]', '0')
},
}

@ -67,16 +67,16 @@
"udapp.tooltipText3": "Click to open a bridge for converting L1 mainnet ETH to the selected network currency.",
"udapp._comment_instanceContainerUI.tsx": "libs/remix-ui/run-tab/src/lib/components/instanceContainerUI.tsx",
"udapp.deployedContracts": "Deployed/Unpinned Contracts",
"udapp.deployAndRunClearInstances": "Clear instances list and reset recorder",
"udapp.deployedContracts": "Deployed Contracts",
"udapp.deployAndRunClearInstances": "Clear all deployed contracts (including pinned) and reset recorder",
"udapp.deployAndRunNoInstanceText": "Currently you have no unpinned contracts to interact with.",
"udapp.tooltipText6": "Autogenerated generic user interfaces for interaction with deployed/unpinned contracts",
"udapp.tooltipText6": "Autogenerated generic user interfaces for interaction with deployed contracts",
"udapp.pinnedContracts": "Pinned Contracts",
"udapp.tooltipTextPinnedContracts": "List of pinned contracts for selected workspace & network",
"udapp.NoPinnedInstanceText": "No pinned contracts found for selected workspace & network",
"udapp.tooltipTextDelete": "Delete immediately",
"udapp.tooltipTextUnpin": "Unpin contract",
"udapp.tooltipTextUnpin": "Unpin contract to delete after reload",
"udapp.pinnedAt": "Pinned at",
"udapp.filePath": "File path",
@ -108,9 +108,9 @@
"udapp.tooltipText13": "Deployed {date}",
"udapp._comment_universalDappUI.tsx": "libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx",
"udapp.tooltipTextRemove": "Remove from the list",
"udapp.tooltipTextRemove": "Permanently remove from the list",
"udapp.tooltipTextEdit": "Create a DApp using this contract in the main panel",
"udapp.tooltipTextPin": "Pin contract",
"udapp.tooltipTextPin": "Pin contract for current workspace and network to persist after reload",
"udapp.tooltipText8": "Click for docs about using 'receive'/'fallback'",
"udapp.tooltipText9": "The Calldata to send to fallback function of the contract.",
"udapp.tooltipText10": "Send data to contract.",

@ -31,9 +31,7 @@ const profile = {
'getSettings',
'setEnvironmentMode',
'clearAllInstances',
'clearAllPinnedInstances',
'addInstance',
'addPinnedInstance',
'resolveContractAndAddInstance'
]
}
@ -85,18 +83,10 @@ export class RunTab extends ViewPlugin {
this.emit('clearAllInstancesReducer')
}
clearAllPinnedInstances() {
this.emit('clearAllPinnedInstancesReducer')
}
addInstance(address, abi, name, contractData) {
this.emit('addInstanceReducer', address, abi, name, contractData)
}
addPinnedInstance(address, abi, name, pinnedAt, filePath) {
this.emit('addPinnedInstanceReducer', address, abi, name, pinnedAt, filePath)
}
createVMAccount(newAccount) {
return this.blockchain.createVMAccount(newAccount)
}

@ -1,5 +1,5 @@
import { ContractData } from "@remix-project/core-plugin"
import { addNewInstance, addNewPinnedInstance, addProvider, clearAllInstances, clearAllPinnedInstances, clearRecorderCount, hidePopUp, newProxyDeployment, removeExistingInstance, removeProvider, setBaseFeePerGas, setConfirmSettings, setCurrentContract, setExecutionEnvironment, setExternalEndpoint, setGasLimit, setGasPrice, setGasPriceStatus, setMatchPassphrase, setMaxFee, setMaxPriorityFee, setNetworkName, setChainId, setPassphrase, setPathToScenario, setSelectedAccount, setSendUnit, setSendValue } from "./payload"
import { addNewInstance, pinUnpinnedInstance, unpinPinnedInstance, addProvider, clearAllInstances, clearRecorderCount, hidePopUp, newProxyDeployment, removeExistingInstance, removeProvider, setBaseFeePerGas, setConfirmSettings, setCurrentContract, setExecutionEnvironment, setExternalEndpoint, setGasLimit, setGasPrice, setGasPriceStatus, setMatchPassphrase, setMaxFee, setMaxPriorityFee, setNetworkName, setChainId, setPassphrase, setPathToScenario, setSelectedAccount, setSendUnit, setSendValue } from "./payload"
export const setAccount = (dispatch: React.Dispatch<any>, account: string) => {
dispatch(setSelectedAccount(account))
@ -69,27 +69,25 @@ export const updateGasPrice = (dispatch: React.Dispatch<any>, price: string) =>
dispatch(setGasPrice(price))
}
export const addInstance = (dispatch: React.Dispatch<any>, instance: { contractData?: ContractData, address: string, name: string, abi?: any, decodedResponse?: Record<number, any> }) => {
export const addInstance = (dispatch: React.Dispatch<any>, instance: { contractData?: ContractData, address: string, name: string, abi?: any, decodedResponse?: Record<number, any>, isPinned?: boolean, pinnedAt?: number, filePath?: string }) => {
instance.decodedResponse = {}
dispatch(addNewInstance(instance))
}
export const addPinnedInstance = (dispatch: React.Dispatch<any>, instance: { contractData?: ContractData, address: string, name: string, abi?: any, decodedResponse?: Record<number, any>, pinnedAt?: number, filePath?: string }) => {
instance.decodedResponse = {}
dispatch(addNewPinnedInstance(instance))
export const pinInstance = (dispatch: React.Dispatch<any>, index: number, pinnedAt: number, filePath: string) => {
dispatch(pinUnpinnedInstance(index, pinnedAt, filePath))
}
export const removeInstance = (dispatch: React.Dispatch<any>, index: number, isPinnedContract: boolean, shouldDelete: boolean) => {
dispatch(removeExistingInstance(index, isPinnedContract, shouldDelete))
export const unpinInstance = (dispatch: React.Dispatch<any>, index: number) => {
dispatch(unpinPinnedInstance(index))
}
export const clearInstances = (dispatch: React.Dispatch<any>) => {
dispatch(clearAllInstances())
dispatch(clearRecorderCount())
export const removeInstance = (dispatch: React.Dispatch<any>, index: number) => {
dispatch(removeExistingInstance(index))
}
export const clearPinnedInstances = (dispatch: React.Dispatch<any>) => {
dispatch(clearAllPinnedInstances())
export const clearInstances = (dispatch: React.Dispatch<any>) => {
dispatch(clearAllInstances())
dispatch(clearRecorderCount())
}

@ -286,7 +286,6 @@ export const runTransactions = (
plugin: RunTab,
dispatch: React.Dispatch<any>,
instanceIndex: number,
isPinnedContract: boolean,
lookupOnly: boolean,
funcABI: FuncABI,
inputsValues: string,
@ -323,7 +322,7 @@ export const runTransactions = (
(returnValue) => {
const response = txFormat.decodeResponse(returnValue, funcABI)
dispatch(setDecodedResponse(instanceIndex, response, funcIndex, isPinnedContract))
dispatch(setDecodedResponse(instanceIndex, response, funcIndex))
},
(network, tx, gasEstimation, continueTxExecution, cancelCb) => {
confirmationHandler(plugin, dispatch, mainnetPrompt, network, tx, gasEstimation, continueTxExecution, cancelCb)
@ -342,9 +341,8 @@ export const getFuncABIInputs = (plugin: RunTab, funcABI: FuncABI) => {
}
export const updateInstanceBalance = async (plugin: RunTab, dispatch: React.Dispatch<any>) => {
if (plugin.REACT_API?.instances?.instanceList?.length || plugin.REACT_API?.pinnedInstances?.instanceList?.length) {
let instances = plugin.REACT_API?.instances?.instanceList?.length ? plugin.REACT_API?.instances?.instanceList : []
instances = plugin.REACT_API?.pinnedInstances?.instanceList.length ? instances.concat(plugin.REACT_API.pinnedInstances.instanceList) : instances
if (plugin.REACT_API?.instances?.instanceList?.length) {
const instances = plugin.REACT_API?.instances?.instanceList?.length ? plugin.REACT_API?.instances?.instanceList : []
for (const instance of instances) {
const balInEth = await plugin.blockchain.getBalanceInEther(instance.address)
instance.balance = balInEth

@ -1,8 +1,8 @@
import { envChangeNotification } from "@remix-ui/helper"
import { RunTab } from "../types/run-tab"
import { setExecutionContext, setFinalContext, updateAccountBalances, fillAccountsList } from "./account"
import { addExternalProvider, addInstance, addPinnedInstance, addNewProxyDeployment, removeExternalProvider, setNetworkNameFromProvider, setPinnedChainId } from "./actions"
import { addDeployOption, clearAllInstances, clearAllPinnedInstances, clearRecorderCount, fetchContractListSuccess, resetProxyDeployments, resetUdapp, setCurrentContract, setCurrentFile, setLoadType, setRecorderCount, setRemixDActivated, setSendValue, fetchAccountsListSuccess } from "./payload"
import { addExternalProvider, addInstance, addNewProxyDeployment, removeExternalProvider, setNetworkNameFromProvider, setPinnedChainId } from "./actions"
import { addDeployOption, clearAllInstances, clearRecorderCount, fetchContractListSuccess, resetProxyDeployments, resetUdapp, setCurrentContract, setCurrentFile, setLoadType, setRecorderCount, setRemixDActivated, setSendValue, fetchAccountsListSuccess } from "./payload"
import { updateInstanceBalance } from './deploy'
import { CompilerAbstract } from '@remix-project/remix-solidity'
import BN from 'bn.js'
@ -100,18 +100,10 @@ export const setupEvents = (plugin: RunTab) => {
dispatch(clearAllInstances())
})
plugin.on('udapp', 'clearAllPinnedInstancesReducer', () => {
dispatch(clearAllPinnedInstances())
})
plugin.on('udapp', 'addInstanceReducer', (address, abi, name, contractData?) => {
addInstance(dispatch, { contractData, abi, address, name })
})
plugin.on('udapp', 'addPinnedInstanceReducer', (address, abi, name, pinnedAt, filePath) => {
addPinnedInstance(dispatch, { abi, address, name, pinnedAt, filePath })
})
plugin.on('filePanel', 'setWorkspace', async () => {
dispatch(resetUdapp())
resetAndInit(plugin)
@ -182,7 +174,7 @@ export const setupEvents = (plugin: RunTab) => {
}
const loadPinnedContracts = async (plugin, dispatch, dirName) => {
await plugin.call('udapp', 'clearAllPinnedInstances')
await plugin.call('udapp', 'clearAllInstances')
const isPinnedAvailable = await plugin.call('fileManager', 'exists', `.deploys/pinned-contracts/${dirName}`)
if (isPinnedAvailable) {
try {
@ -191,7 +183,8 @@ const loadPinnedContracts = async (plugin, dispatch, dirName) => {
for (const file of filePaths) {
const pinnedContract = await plugin.call('fileManager', 'readFile', file)
const pinnedContractObj = JSON.parse(pinnedContract)
if (pinnedContractObj) addPinnedInstance(dispatch, pinnedContractObj)
pinnedContractObj.isPinned = true
if (pinnedContractObj) addInstance(dispatch, pinnedContractObj)
}
} catch (err) {
console.log(err)

@ -3,7 +3,7 @@ import React from 'react'
import { RunTab } from '../types/run-tab'
import { resetAndInit, setupEvents, setEventsDispatch } from './events'
import { createNewBlockchainAccount, setExecutionContext, signMessageWithAddress } from './account'
import { clearInstances, clearPopUp, removeInstance, setAccount, setGasFee, setMatchPassphrasePrompt,
import { clearInstances, clearPopUp, removeInstance, pinInstance, unpinInstance, 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, isValidContractUpgrade } from './deploy'
@ -50,10 +50,12 @@ export const setGasPrice = (price: string) => updateGasPrice(dispatch, price)
export const setGasPriceStatus = (status: boolean) => updateGasPriceStatus(dispatch, status)
export const setMaxFee = (fee: string) => updateMaxFee(dispatch, fee)
export const setMaxPriorityFee = (fee: string) => updateMaxPriorityFee(dispatch, fee)
export const pinUnpinnedInstance = (index: number, pinnedAt: number, filePath: string) => pinInstance(dispatch, index, pinnedAt, filePath)
export const unpinPinnedInstance = (index: number) => unpinInstance(dispatch, index)
export const removeInstances = () => clearInstances(dispatch)
export const removeSingleInstance = (index: number, isPinnedContract: boolean, shouldDelete: boolean) => removeInstance(dispatch, index, isPinnedContract, shouldDelete)
export const removeSingleInstance = (index: number) => removeInstance(dispatch, index)
export const getExecutionContext = () => getContext(plugin)
export const executeTransactions = (instanceIndex: number, isPinnedContract: boolean, lookupOnly: boolean, funcABI: FuncABI, inputsValues: string, contractName: string, contractABI, contract, address, logMsg:string, mainnetPrompt: MainnetPrompt, gasEstimationPrompt: (msg: string) => JSX.Element, passphrasePrompt: (msg: string) => JSX.Element, funcIndex?: number) => runTransactions(plugin, dispatch, instanceIndex, isPinnedContract, lookupOnly, funcABI, inputsValues, contractName, contractABI, contract, address, logMsg, mainnetPrompt, gasEstimationPrompt, passphrasePrompt, funcIndex)
export const executeTransactions = (instanceIndex: number, lookupOnly: boolean, funcABI: FuncABI, inputsValues: string, contractName: string, contractABI, contract, address, logMsg:string, mainnetPrompt: MainnetPrompt, gasEstimationPrompt: (msg: string) => JSX.Element, passphrasePrompt: (msg: string) => JSX.Element, funcIndex?: number) => runTransactions(plugin, dispatch, instanceIndex, lookupOnly, funcABI, inputsValues, contractName, contractABI, contract, address, logMsg, mainnetPrompt, gasEstimationPrompt, passphrasePrompt, funcIndex)
export const loadFromAddress = (contract: ContractData, address: string) => loadAddress(plugin, dispatch, contract, address)
export const storeNewScenario = async (prompt: (msg: string, defaultValue: string) => JSX.Element) => storeScenario(plugin, dispatch, prompt)
export const runScenario = (liveMode: boolean, gasEstimationPrompt: (msg: string) => JSX.Element, passphrasePrompt: (msg: string) => JSX.Element, confirmDialogContent: MainnetPrompt) => runCurrentScenario(liveMode, plugin, dispatch, gasEstimationPrompt, passphrasePrompt, confirmDialogContent)

@ -1,5 +1,5 @@
import { ContractData } from '@remix-project/core-plugin'
import { ADD_DEPLOY_OPTION, ADD_INSTANCE, ADD_PINNED_INSTANCE, UPDATE_INSTANCES_BALANCE, ADD_PROVIDER, CLEAR_INSTANCES, CLEAR_PINNED_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_CHAIN_ID, 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, EXTRACT_COMPILER_VERSION } from '../constants'
import { ADD_DEPLOY_OPTION, ADD_INSTANCE, PIN_INSTANCE, UNPIN_INSTANCE, UPDATE_INSTANCES_BALANCE, 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_CHAIN_ID, 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, EXTRACT_COMPILER_VERSION } from '../constants'
import { ContractList, DeployOptions } from '../types'
export const fetchAccountsListRequest = () => {
@ -230,51 +230,55 @@ export const updateInstancesBalance = (instances: Array<{ contractData?: Contrac
}
}
export const addNewInstance = (instance: { contractData?: ContractData, address: string, name: string, abi?: any }) => {
export const addNewInstance = (instance: { contractData?: ContractData, address: string, name: string, abi?: any, isPinned?: boolean, pinnedAt?: number }) => {
return {
type: ADD_INSTANCE,
payload: instance
}
}
export const addNewPinnedInstance = (instance: { contractData?: ContractData, address: string, name: string, abi?: any, pinnedAt?: number }) => {
export const pinUnpinnedInstance = (index: number, pinnedAt: number, filePath: string) => {
return {
type: ADD_PINNED_INSTANCE,
payload: instance
type: PIN_INSTANCE,
payload: {
index,
pinnedAt,
filePath
}
}
}
export const removeExistingInstance = (index: number, isPinnedContract: boolean, shouldDelete: boolean) => {
export const unpinPinnedInstance = (index: number) => {
return {
type: REMOVE_INSTANCE,
type: UNPIN_INSTANCE,
payload: {
index,
isPinnedContract,
shouldDelete
index
}
}
}
export const clearAllInstances = () => {
export const removeExistingInstance = (index: number) => {
return {
type: CLEAR_INSTANCES
type: REMOVE_INSTANCE,
payload: {
index
}
}
}
export const clearAllPinnedInstances = () => {
export const clearAllInstances = () => {
return {
type: CLEAR_PINNED_INSTANCES
type: CLEAR_INSTANCES
}
}
export const setDecodedResponse = (instanceIndex: number, response, funcIndex?: number, isPinnedContract?: boolean) => {
export const setDecodedResponse = (instanceIndex: number, response, funcIndex?: number) => {
return {
type: SET_DECODED_RESPONSE,
payload: {
instanceIndex,
funcIndex,
response,
isPinnedContract
response
}
}
}

@ -8,60 +8,24 @@ import { UniversalDappUI } from './universalDappUI'
export function InstanceContainerUI(props: InstanceContainerProps) {
const { instanceList } = props.instances
const clearInstance = () => {
const clearInstance = async() => {
const isPinnedAvailable = await props.plugin.call('fileManager', 'exists', `.deploys/pinned-contracts/${props.plugin.REACT_API.chainId}`)
if (isPinnedAvailable) await props.plugin.call('fileManager', 'remove', `.deploys/pinned-contracts/${props.plugin.REACT_API.chainId}`)
props.clearInstances()
}
return (
<div className="udapp_instanceContainer mt-3 border-0 list-group-item">
<div className="d-flex justify-content-between align-items-center pl-2">
<CustomTooltip placement="top-start" tooltipClasses="text-nowrap" tooltipId="deployAndRunPinnedContractsTooltip" tooltipText={<FormattedMessage id="udapp.tooltipTextPinnedContracts" />}>
<label className="udapp_deployedContracts" data-id="pinnedContracts">
<FormattedMessage id="udapp.pinnedContracts" />
<span style={{ fontSize: '0.75rem' }} data-id="pinnedContractsSublabel"> (network: {props.plugin.REACT_API.chainId}) </span>
</label>
</CustomTooltip>
</div>
{props.pinnedInstances.instanceList.length > 0 ? (
<div>
{' '}
{props.pinnedInstances.instanceList.map((instance, index) => {
return (
<UniversalDappUI
key={index}
instance={instance}
isPinnedContract={true}
context={props.getContext()}
removeInstance={props.removeInstance}
index={index}
gasEstimationPrompt={props.gasEstimationPrompt}
passphrasePrompt={props.passphrasePrompt}
mainnetPrompt={props.mainnetPrompt}
runTransactions={props.runTransactions}
sendValue={props.sendValue}
getFuncABIInputs={props.getFuncABIInputs}
plugin={props.plugin}
exEnvironment={props.exEnvironment}
editInstance={props.editInstance}
solcVersion={props.solcVersion}
getVersion={props.getVersion}
/>
)
})}
</div>
) : (
<span className="mx-2 mt-3 alert alert-secondary" data-id="NoPinnedInstanceText">
<FormattedMessage id="udapp.NoPinnedInstanceText" />
</span>
)}
<div className="d-flex justify-content-between align-items-center pl-2 mb-2 mt-2">
<div className="udapp_instanceContainer mt-2 border-0 list-group-item">
<div className="d-flex justify-content-between align-items-center p-2">
<CustomTooltip placement="top-start" tooltipClasses="text-nowrap" tooltipId="deployAndRunClearInstancesTooltip" tooltipText={<FormattedMessage id="udapp.tooltipText6" />}>
<label className="udapp_deployedContracts" data-id="unpinnedContracts">
<label className="udapp_deployedContracts text-nowrap" data-id="deployedContracts">
<FormattedMessage id="udapp.deployedContracts" />
</label>
</CustomTooltip>
<CustomTooltip placement="top-start" tooltipClasses="text-nowrap" tooltipId="numOfDeployedInstancesTooltip" tooltipText="Number of deployed contracts">
<div className="badge badge-pill badge-primary text-center ml-2 mb-1" data-id="deployedContractsBadge">{instanceList.length}</div>
</CustomTooltip>
<div className="w-100"></div>
{instanceList.length > 0 ? (
<CustomTooltip
placement={'auto-end'}
@ -69,10 +33,11 @@ export function InstanceContainerUI(props: InstanceContainerProps) {
tooltipId="deployAndRunClearInstancesTooltip"
tooltipText={<FormattedMessage id="udapp.deployAndRunClearInstances" />}
>
<i className="mr-1 p-2 udapp_icon far fa-trash-alt" data-id="deployAndRunClearInstances" onClick={clearInstance} aria-hidden="true"></i>
<i className="far fa-trash-alt udapp_icon mr-1 mb-2" data-id="deployAndRunClearInstances" onClick={clearInstance} aria-hidden="true"></i>
</CustomTooltip>
) : null}
</div>
{instanceList.length > 0 ? (
<div>
{' '}
@ -81,8 +46,9 @@ export function InstanceContainerUI(props: InstanceContainerProps) {
<UniversalDappUI
key={index}
instance={instance}
isPinnedContract={false}
context={props.getContext()}
pinInstance={props.pinInstance}
unpinInstance={props.unpinInstance}
removeInstance={props.removeInstance}
index={index}
gasEstimationPrompt={props.gasEstimationPrompt}
@ -100,11 +66,7 @@ export function InstanceContainerUI(props: InstanceContainerProps) {
)
})}
</div>
) : (
<span className="mx-2 mt-3 alert alert-secondary" data-id="deployAndRunNoInstanceText" role="alert">
<FormattedMessage id="udapp.deployAndRunNoInstanceText" />
</span>
)}
) : ''}
</div>
)
}

@ -115,17 +115,17 @@ export function UniversalDappUI(props: UdappProps) {
}
const remove = async() => {
if (props.isPinnedContract) {
if (props.instance.isPinned) {
await unsavePinnedContract()
_paq.push(['trackEvent', 'udapp', 'pinContracts', 'unpinned'])
_paq.push(['trackEvent', 'udapp', 'pinContracts', 'removePinned'])
}
props.removeInstance(props.index, props.isPinnedContract, false)
props.removeInstance(props.index)
}
const deletePinnedContract = async() => {
const unpinContract = async() => {
await unsavePinnedContract()
_paq.push(['trackEvent', 'udapp', 'pinContracts', 'deletePinned'])
props.removeInstance(props.index, props.isPinnedContract, true)
_paq.push(['trackEvent', 'udapp', 'pinContracts', 'unpinned'])
props.unpinInstance(props.index)
}
const pinContract = async() => {
@ -138,21 +138,17 @@ export function UniversalDappUI(props: UdappProps) {
pinnedAt: Date.now()
}
await props.plugin.call('fileManager', 'writeFile', `.deploys/pinned-contracts/${props.plugin.REACT_API.chainId}/${props.instance.address}.json`, JSON.stringify(objToSave, null, 2))
// Add contract to saved contracts list on UI
await props.plugin.call('udapp', 'addPinnedInstance', objToSave.address, objToSave.abi, objToSave.name, objToSave.pinnedAt, objToSave.filePath)
_paq.push(['trackEvent', 'udapp', 'pinContracts', `pinned at ${props.plugin.REACT_API.chainId}`])
// Remove contract from deployed contracts list on UI
props.removeInstance(props.index, false, false)
props.pinInstance(props.index, objToSave.pinnedAt, objToSave.filePath)
}
const runTransaction = (lookupOnly, funcABI: FuncABI, valArr, inputsValues, funcIndex?: number) => {
if (props.isPinnedContract) _paq.push(['trackEvent', 'udapp', 'pinContracts', 'interactWithPinned'])
if (props.instance.isPinned) _paq.push(['trackEvent', 'udapp', 'pinContracts', 'interactWithPinned'])
const functionName = funcABI.type === 'function' ? funcABI.name : `(${funcABI.type})`
const logMsg = `${lookupOnly ? 'call' : 'transact'} to ${props.instance.name}.${functionName}`
props.runTransactions(
props.index,
props.isPinnedContract,
lookupOnly,
funcABI,
inputsValues,
@ -248,7 +244,7 @@ export function UniversalDappUI(props: UdappProps) {
className={`instance udapp_instance udapp_run-instance border-dark ${toggleExpander ? 'udapp_hidesub' : 'bg-light'}`}
id={`instance${address}`}
data-shared="universalDappUiInstance"
data-id={props.isPinnedContract ? `pinnedInstance${address}` : `unpinnedInstance${address}`}
data-id={props.instance.isPinned ? `pinnedInstance${address}` : `unpinnedInstance${address}`}
>
<div className="udapp_title pb-0 alert alert-secondary">
<span data-id={`universalDappUiTitleExpander${props.index}`} className="btn udapp_titleExpander" onClick={toggleClass} style={{ padding: "0.45rem" }}>
@ -256,7 +252,7 @@ export function UniversalDappUI(props: UdappProps) {
</span>
<div className="input-group udapp_nameNbuts">
<div className="udapp_titleText input-group-prepend">
{ props.isPinnedContract ? ( <CustomTooltip placement="top" tooltipClasses="text-nowrap" tooltipId="udapp_udappUnpinTooltip" tooltipText={props.isPinnedContract ? `Contract: ${props.instance.name}, Address: ${address}, Pinned at: ${new Date(props.instance.pinnedAt).toLocaleString()}` : '' }>
{ props.instance.isPinned ? ( <CustomTooltip placement="top" tooltipClasses="text-nowrap" tooltipId="udapp_udappUnpinTooltip" tooltipText={props.instance.isPinned ? `Pinned for network: ${props.plugin.REACT_API.chainId}, at: ${new Date(props.instance.pinnedAt).toLocaleString()}` : '' }>
<span className="input-group-text udapp_spanTitleText">
{props.instance.name} at {shortenAddress(address)}
</span>
@ -267,9 +263,9 @@ export function UniversalDappUI(props: UdappProps) {
<div className="btn" style={{ padding: '0.15rem' }}>
<CopyToClipboard tip={intl.formatMessage({ id: 'udapp.copyAddress' })} content={address} direction={'top'} />
</div>
{ props.isPinnedContract ? ( <div className="btn" style={{ padding: '0.15rem', marginLeft: '-0.5rem' }}>
{ props.instance.isPinned ? ( <div className="btn" style={{ padding: '0.15rem', marginLeft: '-0.5rem' }}>
<CustomTooltip placement="top" tooltipClasses="text-nowrap" tooltipId="udapp_udappUnpinTooltip" tooltipText={<FormattedMessage id="udapp.tooltipTextUnpin" />}>
<i className="fas fa-thumbtack p-2" aria-hidden="true" data-id="universalDappUiUdappUnpin" onClick={remove}></i>
<i className="fas fa-thumbtack p-2" aria-hidden="true" data-id="universalDappUiUdappUnpin" onClick={unpinContract}></i>
</CustomTooltip>
</div> ) : ( <div className="btn" style={{ padding: '0.15rem', marginLeft: '-0.5rem' }}>
<CustomTooltip placement="top" tooltipClasses="text-nowrap" tooltipId="udapp_udappPinTooltip" tooltipText={<FormattedMessage id="udapp.tooltipTextPin" />}>
@ -278,16 +274,11 @@ export function UniversalDappUI(props: UdappProps) {
</div> )
}
</div>
{ props.isPinnedContract ? ( <div className="btn" style={{ padding: '0.15rem', marginLeft: '-0.5rem' }}>
<CustomTooltip placement="top" tooltipClasses="text-nowrap" tooltipId="udapp_udappDeleteTooltip" tooltipText={<FormattedMessage id="udapp.tooltipTextDelete" />}>
<i className="far fa-trash p-2" aria-hidden="true" data-id="universalDappUiUdappDelete" onClick={deletePinnedContract}></i>
</CustomTooltip>
</div> ) : ( <div className="btn" style={{ padding: '0.15rem', marginLeft: '-0.5rem' }}>
<div className="btn" style={{ padding: '0.15rem', marginLeft: '-0.5rem' }}>
<CustomTooltip placement="top" tooltipClasses="text-nowrap" tooltipId="udapp_udappCloseTooltip" tooltipText={<FormattedMessage id="udapp.tooltipTextRemove" />}>
<i className="fas fa-times p-2" aria-hidden="true" data-id="universalDappUiUdappClose" onClick={remove}></i>
</CustomTooltip>
</div> )
}
</div>
</div>
<div className="udapp_cActionsWrapper" data-id="universalDappUiContractActionWrapper">
<div className="udapp_contractActionsContainer">
@ -310,14 +301,14 @@ export function UniversalDappUI(props: UdappProps) {
)}
</div>
</div>
{ props.isPinnedContract && props.instance.pinnedAt ? (
{ props.instance.isPinned && props.instance.pinnedAt ? (
<div className="d-flex" data-id="instanceContractPinnedAt">
<label>
<b><FormattedMessage id="udapp.pinnedAt" />:</b> {(new Date(props.instance.pinnedAt)).toLocaleString()}
</label>
</div>
) : null }
{ props.isPinnedContract && props.instance.filePath ? (
{ props.instance.isPinned && props.instance.filePath ? (
<div className="d-flex" data-id="instanceContractFilePath" style={{ textAlign: "start", lineBreak: "anywhere" }}>
<label>
<b><FormattedMessage id="udapp.filePath" />:</b> {props.instance.filePath}

@ -33,11 +33,11 @@ export const SET_MAX_PRIORITY_FEE = 'SET_MAX_PRIORITY_FEE'
export const SET_BASE_FEE_PER_GAS = 'SET_BASE_FEE_PER_GAS'
export const SET_GAS_PRICE = 'SET_GAS_PRICE'
export const ADD_INSTANCE = 'ADD_INSTANCE'
export const ADD_PINNED_INSTANCE = 'ADD_PINNED_INSTANCE'
export const PIN_INSTANCE = 'PIN_INSTANCE'
export const UNPIN_INSTANCE = 'UNPIN_INSTANCE'
export const UPDATE_INSTANCES_BALANCE = 'UPDATE_INSTANCES_BALANCE'
export const REMOVE_INSTANCE = 'REMOVE_INSTANCE'
export const CLEAR_INSTANCES = 'CLEAR_INSTANCES'
export const CLEAR_PINNED_INSTANCES = 'CLEAR_PINNED_INSTANCES'
export const SET_DECODED_RESPONSE = 'SET_DECODED_RESPONSE'
export const SET_PATH_TO_SCENARIO = 'SET_PATH_TO_SCENARIO'
export const SET_RECORDER_COUNT = 'SET_RECORDER_COUNT'

@ -1,6 +1,6 @@
import { ContractData } from '@remix-project/core-plugin'
import { ContractList, DeployOptions, RunTabState } from '../types'
import { ADD_INSTANCE, ADD_PINNED_INSTANCE, UPDATE_INSTANCES_BALANCE, ADD_PROVIDER, CLEAR_INSTANCES, CLEAR_PINNED_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_CHAIN_ID, 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, EXTRACT_COMPILER_VERSION } from '../constants'
import { ADD_INSTANCE, PIN_INSTANCE, UNPIN_INSTANCE, UPDATE_INSTANCES_BALANCE, 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_CHAIN_ID, 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, EXTRACT_COMPILER_VERSION } from '../constants'
declare const window: any
interface Action {
@ -64,10 +64,6 @@ export const runTabInitialState: RunTabState = {
instanceList: [],
error: null
},
pinnedInstances: {
instanceList: [],
error: null
},
recorder: {
pathToScenario: 'scenario.json',
transactionCount: 0
@ -488,7 +484,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
case ADD_INSTANCE: {
const payload: { contractData: ContractData, address: string, name: string, abi?: any, decodedResponse?: Record<number, any> } = action.payload
const payload: { contractData?: ContractData, address: string, name: string, abi?: any, isPinned?: boolean, pinnedAt?: number } = action.payload
return {
...state,
@ -499,17 +495,6 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case ADD_PINNED_INSTANCE: {
const payload: { contractData: ContractData, address: string, name: string, abi?: any, pinnedAt: number, decodedResponse?: Record<number, any> } = action.payload
return {
...state,
pinnedInstances: {
...state.pinnedInstances,
instanceList: [...state.pinnedInstances.instanceList, payload]
}
}
}
case UPDATE_INSTANCES_BALANCE: {
const payload: Array<{ contractData: ContractData, address: string, balance: number, name: string, abi?: any, decodedResponse?: Record<number, any> }> = action.payload
@ -523,28 +508,8 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
case REMOVE_INSTANCE: {
const payload: { index: number, isPinnedContract: boolean, shouldDelete: boolean } = action.payload
if (payload.isPinnedContract) {
if (payload.shouldDelete) return {
...state,
pinnedInstances: {
...state.pinnedInstances,
instanceList: state.pinnedInstances.instanceList.filter((_, index) => index !== payload.index)
}
}
else return {
...state,
pinnedInstances: {
...state.pinnedInstances,
instanceList: state.pinnedInstances.instanceList.filter((_, index) => index !== payload.index)
},
instances: {
...state.instances,
instanceList: [...state.instances.instanceList, state.pinnedInstances.instanceList[payload.index]]
}
}
} else return {
const payload: { index: number } = action.payload
return {
...state,
instances: {
...state.instances,
@ -553,20 +518,34 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case CLEAR_INSTANCES: {
case PIN_INSTANCE: {
const payload: { index: number, pinnedAt: number, filePath: string } = action.payload
state.instances.instanceList[payload.index].isPinned = true
state.instances.instanceList[payload.index].pinnedAt = payload.pinnedAt
state.instances.instanceList[payload.index].filePath = payload.filePath
return {
...state,
instances: {
instanceList: [],
error: null
...state.instances,
}
}
}
case CLEAR_PINNED_INSTANCES: {
case UNPIN_INSTANCE: {
const payload: { index: number } = action.payload
state.instances.instanceList[payload.index].isPinned = false
return {
...state,
pinnedInstances: {
instances: {
...state.instances,
}
}
}
case CLEAR_INSTANCES: {
return {
...state,
instances: {
instanceList: [],
error: null
}
@ -574,29 +553,17 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
case SET_DECODED_RESPONSE: {
const payload: { instanceIndex: number, funcIndex: number, response: any, isPinnedContract: boolean } = action.payload
if (action.payload.isPinnedContract)
return {
...state,
pinnedInstances: {
...state.pinnedInstances,
instanceList: state.pinnedInstances.instanceList.map((instance, index) => {
if (payload.instanceIndex === index) instance.decodedResponse[payload.funcIndex] = payload.response
return instance
})
}
}
else
return {
...state,
instances: {
...state.instances,
instanceList: state.instances.instanceList.map((instance, index) => {
if (payload.instanceIndex === index) instance.decodedResponse[payload.funcIndex] = payload.response
return instance
})
}
const payload: { instanceIndex: number, funcIndex: number, response: any } = action.payload
return {
...state,
instances: {
...state.instances,
instanceList: state.instances.instanceList.map((instance, index) => {
if (payload.instanceIndex === index) instance.decodedResponse[payload.funcIndex] = payload.response
return instance
})
}
}
}
case SET_PATH_TO_SCENARIO: {

@ -32,6 +32,8 @@ import {
setGasPriceStatus,
setMaxFee,
setMaxPriorityFee,
unpinPinnedInstance,
pinUnpinnedInstance,
removeInstances,
removeSingleInstance,
getExecutionContext,
@ -342,8 +344,9 @@ export function RunTabUI(props: RunTabProps) {
<InstanceContainerUI
plugin={plugin}
instances={runTab.instances}
pinnedInstances={runTab.pinnedInstances}
clearInstances={removeInstances}
unpinInstance={unpinPinnedInstance}
pinInstance={pinUnpinnedInstance}
removeInstance={removeSingleInstance}
getContext={getExecutionContext}
gasEstimationPrompt={gasEstimationPrompt}

@ -98,17 +98,6 @@ export interface RunTabState {
baseFeePerGas: string,
gasPrice: string,
instances: {
instanceList: {
contractData?: ContractData,
address: string,
balance?: number,
name: string,
decodedResponse?: Record<number, any>,
abi?: any
}[],
error: string
},
pinnedInstances: {
instanceList: {
contractData?: ContractData,
address: string,
@ -116,7 +105,9 @@ export interface RunTabState {
name: string,
decodedResponse?: Record<number, any>,
abi?: any,
pinnedAt?: number
isPinned?: boolean,
pinnedAt?: number,
filePath?: string
}[],
error: string
},
@ -300,17 +291,6 @@ export interface RecorderProps {
export interface InstanceContainerProps {
instances: {
instanceList: {
contractData?: ContractData,
address: string,
balance?: number,
name: string,
decodedResponse?: Record<number, any>,
abi?: any
}[],
error: string
},
pinnedInstances: {
instanceList: {
contractData?: ContractData,
address: string,
@ -318,17 +298,19 @@ export interface InstanceContainerProps {
name: string,
decodedResponse?: Record<number, any>,
abi?: any,
isPinned?: boolean,
pinnedAt?: number,
filePath?: string
}[],
error: string
},
clearInstances: () => void,
removeInstance: (index: number, isPinnedContract:boolean, shouldDelete: boolean) => void,
removeInstance: (index: number) => void,
pinInstance: (index: number, pinnedAt: number, filePath: string) => void,
unpinInstance: (index: number) => void,
getContext: () => 'memory' | 'blockchain',
runTransactions: (
instanceIndex: number,
isPinnedContract: boolean,
lookupOnly: boolean,
funcABI: FuncABI,
inputsValues: string,
@ -435,19 +417,20 @@ export interface UdappProps {
name: string,
decodedResponse?: Record<number, any>,
abi?: any,
isPinned?: boolean
pinnedAt?: number,
filePath?: string
},
context: 'memory' | 'blockchain',
isPinnedContract?: boolean
removeInstance: (index: number, isPinnedContract: boolean, shouldDelete: boolean) => void,
removeInstance: (index: number) => void,
pinInstance: (index: number, pinnedAt: number, filePath: string) => void,
unpinInstance: (index: number) => void,
index: number,
gasEstimationPrompt: (msg: string) => JSX.Element,
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,
runTransactions: (
instanceIndex: number,
isPinnedContract: boolean,
lookupOnly: boolean,
funcABI: FuncABI,
inputsValues: string,

Loading…
Cancel
Save