Added action

pull/287/head
Vladimir Volek 6 years ago committed by Szymon Lesisz
parent a4c4c4ce55
commit 4f4eec540d

@ -384,6 +384,23 @@ export const onDataChange = (data: string): ThunkAction => (dispatch: Dispatch,
dispatch(estimateGasPrice());
};
export const setDefaultGasLimit = (): ThunkAction => (dispatch: Dispatch, getState: GetState): void => {
const state: State = getState().sendForm;
const { network } = getState().selectedAccount;
if (!network) return;
dispatch({
type: SEND.CHANGE,
state: {
...state,
calculatingGasLimit: false,
untouched: false,
touched: { ...state.touched, gasLimit: true },
gasLimit: network.defaultGasLimit.toString(),
},
});
};
/*
* Internal method
* Called from "onDataChange" action
@ -548,6 +565,7 @@ export default {
updateFeeLevels,
onGasPriceChange,
onGasLimitChange,
setDefaultGasLimit,
onNonceChange,
onDataChange,
onSend,

@ -143,11 +143,11 @@ const AdvancedForm = (props: Props) => {
gasPrice,
} = props.sendForm;
const {
setDefaultGasLimit,
onGasLimitChange,
onGasPriceChange,
onDataChange,
} = props.sendFormActions;
let gasLimitTooltipCurrency: string;
let gasLimitTooltipValue: string;
if (networkSymbol !== currency) {
@ -190,8 +190,8 @@ const AdvancedForm = (props: Props) => {
/>
</Tooltip>
</Left>
<Right>
Set default
<Right onClick={() => setDefaultGasLimit()}>
Set default
</Right>
</InputLabelWrapper>
)}

Loading…
Cancel
Save