|
|
|
@ -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 |
|
|
|
|
} |
|
|
|
|