Define cases as constants

pull/5370/head
David Disu 3 years ago
parent 8e68f950d9
commit ebd3cad09e
  1. 2
      libs/remix-ui/run-tab/src/lib/actions/index.ts
  2. 97
      libs/remix-ui/run-tab/src/lib/actions/payload.ts
  3. 45
      libs/remix-ui/run-tab/src/lib/constants/index.ts
  4. 112
      libs/remix-ui/run-tab/src/lib/reducers/runTab.ts

@ -3,7 +3,7 @@ import React from 'react'
import * as ethJSUtil from 'ethereumjs-util'
import Web3 from 'web3'
import { addressToString, createNonClashingNameAsync, envChangeNotification, extractNameFromKey, shortenAddress, web3Dialog } from '@remix-ui/helper'
import { addNewInstance, addProvider, clearAllInstances, clearRecorderCount, displayNotification, displayPopUp, fetchAccountsListFailed, fetchAccountsListRequest, fetchAccountsListSuccess, fetchContractListSuccess, hidePopUp, removeExistingInstance, removeProvider, resetUdapp, setBaseFeePerGas, setConfirmSettings, setCurrentFile, setDecodedResponse, setEnvToasterContent, setExecutionEnvironment, setExternalEndpoint, setGasLimit, setGasPrice, setGasPriceStatus, setLoadType, setMatchPassphrase, setMaxFee, setMaxPriorityFee, setNetworkName, setPassphrase, setPathToScenario, setRecorderCount, setSelectedAccount, setSendUnit, setSendValue, setTxFeeContent } from './payload'
import { addNewInstance, addProvider, clearAllInstances, clearRecorderCount, displayNotification, displayPopUp, fetchAccountsListFailed, fetchAccountsListRequest, fetchAccountsListSuccess, fetchContractListSuccess, hidePopUp, removeExistingInstance, removeProvider, resetUdapp, setBaseFeePerGas, setConfirmSettings, setCurrentFile, setDecodedResponse, setExecutionEnvironment, setExternalEndpoint, setGasLimit, setGasPrice, setGasPriceStatus, setLoadType, setMatchPassphrase, setMaxFee, setMaxPriorityFee, setNetworkName, setPassphrase, setPathToScenario, setRecorderCount, setSelectedAccount, setSendUnit, setSendValue, setTxFeeContent } from './payload'
import { RunTab } from '../types/run-tab'
import { CompilerAbstract } from '@remix-project/remix-solidity'
import * as remixLib from '@remix-project/remix-lib'

@ -1,249 +1,251 @@
import { ContractList } from '../reducers/runTab'
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_FILE, SET_DECODED_RESPONSE, 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_TX_FEE_CONTENT } from '../constants'
import { DeployMode, DeployOptions } from '../types'
export const fetchAccountsListRequest = () => {
return {
type: 'FETCH_ACCOUNTS_LIST_REQUEST',
type: FETCH_ACCOUNTS_LIST_REQUEST,
payload: null
}
}
export const fetchAccountsListSuccess = (accounts: Record<string, string>) => {
return {
type: 'FETCH_ACCOUNTS_LIST_SUCCESS',
type: FETCH_ACCOUNTS_LIST_SUCCESS,
payload: accounts
}
}
export const fetchAccountsListFailed = (error: string) => {
return {
type: 'FETCH_ACCOUNTS_LIST_FAILED',
type: FETCH_ACCOUNTS_LIST_FAILED,
payload: error
}
}
export const setSendValue = (value: string) => {
return {
type: 'SET_SEND_VALUE',
type: SET_SEND_VALUE,
payload: value
}
}
export const setSelectedAccount = (account: string) => {
return {
type: 'SET_SELECTED_ACCOUNT',
type: SET_SELECTED_ACCOUNT,
payload: account
}
}
export const setSendUnit = (unit: 'ether' | 'finney' | 'gwei' | 'wei') => {
return {
type: 'SET_SEND_UNIT',
type: SET_SEND_UNIT,
payload: unit
}
}
export const setGasLimit = (gasLimit: number) => {
return {
type: 'SET_GAS_LIMIT',
type: SET_GAS_LIMIT,
payload: gasLimit
}
}
export const setExecutionEnvironment = (executionEnvironment: string) => {
return {
type: 'SET_EXECUTION_ENVIRONMENT',
type: SET_EXECUTION_ENVIRONMENT,
payload: executionEnvironment
}
}
export const setPersonalMode = (mode: boolean) => {
return {
type: 'SET_PERSONAL_MODE',
type: SET_PERSONAL_MODE,
payload: mode
}
}
export const setNetworkName = (networkName: string) => {
return {
type: 'SET_NETWORK_NAME',
type: SET_NETWORK_NAME,
payload: networkName
}
}
export const addProvider = (provider: string) => {
return {
type: 'ADD_PROVIDER',
type: ADD_PROVIDER,
payload: provider
}
}
export const removeProvider = (provider: string) => {
return {
type: 'REMOVE_PROVIDER',
type: REMOVE_PROVIDER,
payload: provider
}
}
export const displayNotification = (title: string, message: string | JSX.Element, labelOk: string, labelCancel: string, actionOk?: (...args) => void, actionCancel?: (...args) => void) => {
return {
type: 'DISPLAY_NOTIFICATION',
type: DISPLAY_NOTIFICATION,
payload: { title, message, labelOk, labelCancel, actionOk, actionCancel }
}
}
export const hideNotification = () => {
return {
type: 'HIDE_NOTIFICATION'
type: HIDE_NOTIFICATION
}
}
export const setExternalEndpoint = (endpoint: string) => {
return {
type: 'SET_EXTERNAL_WEB3_ENDPOINT',
type: SET_EXTERNAL_WEB3_ENDPOINT,
payload: endpoint
}
}
export const displayPopUp = (message: string | JSX.Element) => {
return {
type: 'DISPLAY_POPUP_MESSAGE',
type: DISPLAY_POPUP_MESSAGE,
payload: message
}
}
export const hidePopUp = () => {
return {
type: 'HIDE_POPUP_MESSAGE'
type: HIDE_POPUP_MESSAGE
}
}
export const setPassphrase = (passphrase: string) => {
return {
type: 'SET_PASSPHRASE',
type: SET_PASSPHRASE,
payload: passphrase
}
}
export const setMatchPassphrase = (passphrase: string) => {
return {
type: 'SET_MATCH_PASSPHRASE',
type: SET_MATCH_PASSPHRASE,
payload: passphrase
}
}
export const fetchContractListRequest = () => {
return {
type: 'FETCH_CONTRACT_LIST_REQUEST'
type: FETCH_CONTRACT_LIST_REQUEST
}
}
export const fetchContractListSuccess = (contracts: ContractList) => {
return {
type: 'FETCH_CONTRACT_LIST_SUCCESS',
type: FETCH_CONTRACT_LIST_SUCCESS,
payload: contracts
}
}
export const fetchContractListFailed = (error: string) => {
return {
type: 'FETCH_CONTRACT_LIST_FAILED',
type: FETCH_CONTRACT_LIST_FAILED,
payload: error
}
}
export const setLoadType = (type: 'abi' | 'sol' | 'other') => {
return {
type: 'SET_LOAD_TYPE',
type: SET_LOAD_TYPE,
payload: type
}
}
export const setCurrentFile = (file: string) => {
return {
type: 'SET_CURRENT_FILE',
type: SET_CURRENT_FILE,
payload: file
}
}
export const setIpfsCheckedState = (state: boolean) => {
return {
type: 'SET_IPFS_CHECKED_STATE',
type: SET_IPFS_CHECKED_STATE,
payload: state
}
}
export const setGasPriceStatus = (status: boolean) => {
return {
type: 'SET_GAS_PRICE_STATUS',
type: SET_GAS_PRICE_STATUS,
payload: status
}
}
export const setConfirmSettings = (confirmation: boolean) => {
return {
type: 'SET_CONFIRM_SETTINGS',
type: SET_CONFIRM_SETTINGS,
payload: confirmation
}
}
export const setMaxFee = (fee: string) => {
return {
type: 'SET_MAX_FEE',
type: SET_MAX_FEE,
payload: fee
}
}
export const setMaxPriorityFee = (fee: string) => {
return {
type: 'SET_MAX_PRIORITY_FEE',
type: SET_MAX_PRIORITY_FEE,
payload: fee
}
}
export const setBaseFeePerGas = (baseFee: string) => {
return {
type: 'SET_BASE_FEE_PER_GAS',
type: SET_BASE_FEE_PER_GAS,
payload: baseFee
}
}
export const setGasPrice = (price: string) => {
return {
type: 'SET_GAS_PRICE',
type: SET_GAS_PRICE,
payload: price
}
}
export const setTxFeeContent = (content: string) => {
return {
type: 'SET_TX_FEE_CONTENT',
type: SET_TX_FEE_CONTENT,
payload: content
}
}
export const addNewInstance = (instance: { contractData?: ContractData, address: string, name: string, abi?: any }) => {
return {
type: 'ADD_INSTANCE',
type: ADD_INSTANCE,
payload: instance
}
}
export const removeExistingInstance = (index: number) => {
return {
type: 'REMOVE_INSTANCE',
type: REMOVE_INSTANCE,
payload: index
}
}
export const clearAllInstances = () => {
return {
type: 'CLEAR_INSTANCES'
type: CLEAR_INSTANCES
}
}
export const setDecodedResponse = (instanceIndex: number, response, funcIndex?: number) => {
return {
type: 'SET_DECODED_RESPONSE',
type: SET_DECODED_RESPONSE,
payload: {
instanceIndex,
funcIndex,
@ -254,33 +256,40 @@ export const setDecodedResponse = (instanceIndex: number, response, funcIndex?:
export const setPathToScenario = (path: string) => {
return {
type: 'SET_PATH_TO_SCENARIO',
type: SET_PATH_TO_SCENARIO,
payload: path
}
}
export const setRecorderCount = (count: number) => {
return {
type: 'SET_RECORDER_COUNT',
type: SET_RECORDER_COUNT,
payload: count
}
}
export const clearRecorderCount = () => {
return {
type: 'CLEAR_RECORDER_COUNT'
type: CLEAR_RECORDER_COUNT
}
}
export const setEnvToasterContent = (content: (env: { context: string, fork: string }, from: string) => void) => {
export const resetUdapp = () => {
return {
type: 'SET_ENV_TOASTER_CONTENT',
payload: content
type: RESET_STATE
}
}
export const resetUdapp = () => {
export const addDeployOption = (deployOption: DeployOptions) => {
return {
payload: deployOption,
type: ADD_DEPLOY_OPTION
}
}
export const removeDeployOption = (title: DeployMode) => {
return {
type: 'RESET_STATE'
payload: title,
type: REMOVE_DEPLOY_OPTION
}
}

@ -0,0 +1,45 @@
export const FETCH_ACCOUNTS_LIST_REQUEST = 'FETCH_ACCOUNTS_LIST_REQUEST'
export const FETCH_ACCOUNTS_LIST_SUCCESS = 'FETCH_ACCOUNTS_LIST_SUCCESS'
export const FETCH_ACCOUNTS_LIST_FAILED = 'FETCH_ACCOUNTS_LIST_FAILED'
export const SET_SEND_VALUE = 'SET_SEND_VALUE'
export const SET_SELECTED_ACCOUNT = 'SET_SELECTED_ACCOUNT'
export const SET_SEND_UNIT = 'SET_SEND_UNIT'
export const SET_GAS_LIMIT = 'SET_GAS_LIMIT'
export const SET_EXECUTION_ENVIRONMENT = 'SET_EXECUTION_ENVIRONMENT'
export const SET_PERSONAL_MODE = 'SET_PERSONAL_MODE'
export const SET_NETWORK_NAME = 'SET_NETWORK_NAME'
export const FETCH_PROVIDER_LIST_REQUEST = 'FETCH_PROVIDER_LIST_REQUEST'
export const FETCH_PROVIDER_LIST_SUCCESS = 'FETCH_PROVIDER_LIST_SUCCESS'
export const FETCH_PROVIDER_LIST_FAILED = 'FETCH_PROVIDER_LIST_FAILED'
export const ADD_PROVIDER = 'ADD_PROVIDER'
export const REMOVE_PROVIDER = 'REMOVE_PROVIDER'
export const DISPLAY_NOTIFICATION = 'DISPLAY_NOTIFICATION'
export const HIDE_NOTIFICATION = 'HIDE_NOTIFICATION'
export const SET_EXTERNAL_WEB3_ENDPOINT = 'SET_EXTERNAL_WEB3_ENDPOINT'
export const DISPLAY_POPUP_MESSAGE = 'DISPLAY_POPUP_MESSAGE'
export const HIDE_POPUP_MESSAGE = 'HIDE_POPUP_MESSAGE'
export const SET_PASSPHRASE = 'SET_PASSPHRASE'
export const SET_MATCH_PASSPHRASE = 'SET_MATCH_PASSPHRASE'
export const FETCH_CONTRACT_LIST_REQUEST = 'FETCH_CONTRACT_LIST_REQUEST'
export const FETCH_CONTRACT_LIST_SUCCESS = 'FETCH_CONTRACT_LIST_SUCCESS'
export const FETCH_CONTRACT_LIST_FAILED = 'FETCH_CONTRACT_LIST_FAILED'
export const SET_LOAD_TYPE = 'SET_LOAD_TYPE'
export const SET_CURRENT_FILE = 'SET_CURRENT_FILE'
export const SET_IPFS_CHECKED_STATE = 'SET_IPFS_CHECKED_STATE'
export const SET_GAS_PRICE_STATUS = 'SET_GAS_PRICE_STATUS'
export const SET_CONFIRM_SETTINGS = 'SET_CONFIRM_SETTINGS'
export const SET_MAX_FEE = 'SET_MAX_FEE'
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 SET_TX_FEE_CONTENT = 'SET_TX_FEE_CONTENT'
export const ADD_INSTANCE = 'ADD_INSTANCE'
export const REMOVE_INSTANCE = 'REMOVE_INSTANCE'
export const CLEAR_INSTANCES = 'CLEAR_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'
export const CLEAR_RECORDER_COUNT = 'CLEAR_RECORDER_COUNT'
export const RESET_STATE = 'RESET_STATE'
export const ADD_DEPLOY_OPTION = 'ADD_DEPLOY_OPTION'
export const REMOVE_DEPLOY_OPTION = 'REMOVE_DEPLOY_OPTION'

@ -1,5 +1,7 @@
import { CompilerAbstract } from '@remix-project/remix-solidity-ts'
import { ContractData } from '@remix-project/core-plugin'
import { DeployMode, DeployOptions } from '../types'
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, FETCH_PROVIDER_LIST_FAILED, FETCH_PROVIDER_LIST_REQUEST, FETCH_PROVIDER_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_FILE, SET_DECODED_RESPONSE, 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_TX_FEE_CONTENT } from '../constants'
interface Action {
type: string
payload: any
@ -90,7 +92,8 @@ export interface RunTabState {
recorder: {
pathToScenario: string,
transactionCount: number
}
},
deployOptions: DeployOptions[]
}
export const runTabInitialState: RunTabState = {
@ -176,7 +179,8 @@ export const runTabInitialState: RunTabState = {
recorder: {
pathToScenario: 'scenario.json',
transactionCount: 0
}
},
deployOptions: []
}
type AddProvider = {
@ -186,7 +190,7 @@ type AddProvider = {
export const runTabReducer = (state: RunTabState = runTabInitialState, action: Action) => {
switch (action.type) {
case 'FETCH_ACCOUNTS_LIST_REQUEST': {
case FETCH_ACCOUNTS_LIST_REQUEST: {
return {
...state,
accounts: {
@ -198,7 +202,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'FETCH_ACCOUNTS_LIST_SUCCESS': {
case FETCH_ACCOUNTS_LIST_SUCCESS: {
const payload: Record<string, string> = action.payload
return {
@ -213,7 +217,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'FETCH_ACCOUNTS_LIST_FAILED': {
case FETCH_ACCOUNTS_LIST_FAILED: {
const payload: string = action.payload
return {
@ -227,7 +231,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_SEND_VALUE': {
case SET_SEND_VALUE: {
const payload: string = action.payload
return {
@ -236,7 +240,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_SELECTED_ACCOUNT': {
case SET_SELECTED_ACCOUNT: {
const payload: string = action.payload
return {
@ -248,7 +252,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_SEND_UNIT': {
case SET_SEND_UNIT: {
const payload: 'ether' | 'finney' | 'gwei' | 'wei' = action.payload
return {
@ -257,7 +261,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_GAS_LIMIT': {
case SET_GAS_LIMIT: {
const payload: number = action.payload
return {
@ -266,7 +270,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_EXECUTION_ENVIRONMENT': {
case SET_EXECUTION_ENVIRONMENT: {
const payload: string = action.payload
return {
@ -281,7 +285,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_PERSONAL_MODE': {
case SET_PERSONAL_MODE: {
const payload: boolean = action.payload
return {
@ -290,7 +294,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_NETWORK_NAME': {
case SET_NETWORK_NAME: {
const payload: string = action.payload
return {
@ -299,7 +303,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'FETCH_PROVIDER_LIST_REQUEST': {
case FETCH_PROVIDER_LIST_REQUEST: {
return {
...state,
providers: {
@ -311,7 +315,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'FETCH_PROVIDER_LIST_SUCCESS': {
case FETCH_PROVIDER_LIST_SUCCESS: {
const payload: { id?: string, dataId?: string, title?: string, value: string, fork?: string, content: string }[] = action.payload
return {
@ -326,7 +330,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'FETCH_PROVIDER_LIST_FAILED': {
case FETCH_PROVIDER_LIST_FAILED: {
const payload: string = action.payload
return {
@ -340,7 +344,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'ADD_PROVIDER': {
case ADD_PROVIDER: {
const payload: AddProvider = action.payload
const id = action.payload.name
state.providers.providerList.push({
@ -359,7 +363,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'REMOVE_PROVIDER': {
case REMOVE_PROVIDER: {
const id: string = action.payload
const providers = state.providers.providerList.filter((el) => el.id !== id)
return {
@ -371,7 +375,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'DISPLAY_NOTIFICATION': {
case DISPLAY_NOTIFICATION: {
const payload = action.payload as { title: string, message: string, actionOk: () => void, actionCancel: () => void, labelOk: string, labelCancel: string }
return {
@ -387,14 +391,14 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'HIDE_NOTIFICATION': {
case HIDE_NOTIFICATION: {
return {
...state,
notification: runTabInitialState.notification
}
}
case 'SET_EXTERNAL_WEB3_ENDPOINT': {
case SET_EXTERNAL_WEB3_ENDPOINT: {
const payload: string = action.payload
return {
@ -403,7 +407,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'DISPLAY_POPUP_MESSAGE': {
case DISPLAY_POPUP_MESSAGE: {
const payload = action.payload as string
return {
@ -412,14 +416,14 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'HIDE_POPUP_MESSAGE': {
case HIDE_POPUP_MESSAGE: {
return {
...state,
popup: ''
}
}
case 'SET_PASSPHRASE': {
case SET_PASSPHRASE: {
const passphrase: string = action.payload
return {
@ -428,7 +432,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_MATCH_PASSPHRASE': {
case SET_MATCH_PASSPHRASE: {
const passphrase: string = action.payload
return {
@ -437,7 +441,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'FETCH_CONTRACT_LIST_REQUEST': {
case FETCH_CONTRACT_LIST_REQUEST: {
return {
...state,
contracts: {
@ -449,7 +453,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'FETCH_CONTRACT_LIST_SUCCESS': {
case FETCH_CONTRACT_LIST_SUCCESS: {
const payload: ContractList = action.payload
return {
@ -464,7 +468,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'FETCH_CONTRACT_LIST_FAILED': {
case FETCH_CONTRACT_LIST_FAILED: {
const payload: string = action.payload
return {
@ -478,7 +482,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_LOAD_TYPE': {
case SET_LOAD_TYPE: {
const payload: 'abi' | 'sol' | 'other' = action.payload
return {
@ -490,7 +494,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_CURRENT_FILE': {
case SET_CURRENT_FILE: {
const payload: string = action.payload
return {
@ -503,7 +507,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_IPFS_CHECKED_STATE': {
case SET_IPFS_CHECKED_STATE: {
const payload: boolean = action.payload
return {
@ -512,7 +516,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_GAS_PRICE_STATUS': {
case SET_GAS_PRICE_STATUS: {
const payload: boolean = action.payload
return {
@ -521,7 +525,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_CONFIRM_SETTINGS': {
case SET_CONFIRM_SETTINGS: {
const payload: boolean = action.payload
return {
@ -530,7 +534,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_MAX_FEE': {
case SET_MAX_FEE: {
const payload: string = action.payload
return {
@ -539,7 +543,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_MAX_PRIORITY_FEE': {
case SET_MAX_PRIORITY_FEE: {
const payload: string = action.payload
return {
@ -548,7 +552,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_BASE_FEE_PER_GAS': {
case SET_BASE_FEE_PER_GAS: {
const payload: string = action.payload
return {
@ -557,7 +561,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_GAS_PRICE': {
case SET_GAS_PRICE: {
const payload: string = action.payload
return {
@ -566,7 +570,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_TX_FEE_CONTENT': {
case SET_TX_FEE_CONTENT: {
const payload: string = action.payload
return {
@ -575,7 +579,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'ADD_INSTANCE': {
case ADD_INSTANCE: {
const payload: { contractData: ContractData, address: string, name: string, abi?: any, decodedResponse?: Record<number, any> } = action.payload
return {
@ -587,7 +591,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'REMOVE_INSTANCE': {
case REMOVE_INSTANCE: {
const payload: number = action.payload
return {
@ -599,7 +603,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'CLEAR_INSTANCES': {
case CLEAR_INSTANCES: {
return {
...state,
instances: {
@ -609,7 +613,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_DECODED_RESPONSE': {
case SET_DECODED_RESPONSE: {
const payload: { instanceIndex: number, funcIndex: number, response: any } = action.payload
return {
@ -624,7 +628,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_PATH_TO_SCENARIO': {
case SET_PATH_TO_SCENARIO: {
const payload: string = action.payload
return {
@ -636,7 +640,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'SET_RECORDER_COUNT': {
case SET_RECORDER_COUNT: {
const payload: number = action.payload
return {
@ -648,7 +652,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'CLEAR_RECORDER_COUNT': {
case CLEAR_RECORDER_COUNT: {
return {
...state,
recorder: {
@ -658,13 +662,31 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
}
}
case 'RESET_STATE': {
case RESET_STATE: {
return {
...runTabInitialState,
ipfsChecked: state.ipfsChecked
}
}
case ADD_DEPLOY_OPTION: {
const payload: DeployOptions = action.payload
return {
...state,
deployOptions: [...state.deployOptions, payload]
}
}
case REMOVE_DEPLOY_OPTION: {
const payload: DeployMode = action.payload
return {
...state,
deployOptions: state.deployOptions.filter(option => option.title !== payload)
}
}
default:
return state
}

Loading…
Cancel
Save