mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-12 03:54:13 +00:00
e3505fd958
* Empty component, routes setup. * Shared components for all Contracts inputs. Dont do anything yet. * Check in reducer work so far. Still WIP. * Header styling * Check in input work so far, splitting to new branch. * Strip down contracts inputs. Split out into form and explorer * Contract selector * Constantized config actions to use in contract saga. * Interact explorer UI, no functionality * Convert to constants, hook up errors * Deploy and style cleanup. * Remove unnecessary class. * Fix flow errors with css modules * Attempt at fixing all newly introduced flow errors in the contracts branch. * Removed unused validator. * Remove action constants, fix flow specificity in reducers * Fix unit tests * Move network contracts out of redux / sagas, and read directly from state with a selector in mapStateToProps. * Fix initialState -> INITIAL_STATE rename * foreach push -> concat
40 lines
829 B
JavaScript
40 lines
829 B
JavaScript
import type {
|
|
AccessContractAction,
|
|
SetInteractiveContractAction
|
|
} from 'actions/contracts';
|
|
|
|
export type State = {
|
|
selectedAddress: ?string,
|
|
selectedABIJson: ?string,
|
|
selectedABIFunctions: ?Array
|
|
};
|
|
|
|
export const initialState: State = {
|
|
// Interact
|
|
selectedAddress: null,
|
|
selectedABIJson: null,
|
|
selectedABIFunctions: null
|
|
};
|
|
|
|
type Action = AccessContractAction | SetInteractiveContractAction;
|
|
|
|
export function contracts(state: State = initialState, action: Action) {
|
|
switch (action.type) {
|
|
case 'ACCESS_CONTRACT':
|
|
return {
|
|
...state,
|
|
selectedAddress: action.address,
|
|
selectedABIJson: action.abiJson
|
|
};
|
|
|
|
case 'SET_INTERACTIVE_CONTRACT':
|
|
return {
|
|
...state,
|
|
selectedABIFunctions: action.functions
|
|
};
|
|
|
|
default:
|
|
return state;
|
|
}
|
|
}
|