From 40be251e7b59bbede4351f33e653b8064fb53184 Mon Sep 17 00:00:00 2001 From: Daniel Kmak Date: Thu, 5 Apr 2018 18:56:00 +0200 Subject: [PATCH] [FEATURE] Gas estimation for scheduling --- common/components/GasLimitField.tsx | 12 +++++-- .../components/AdvancedGas.tsx | 1 + .../Fields/ScheduleGasLimitField.tsx | 18 ++++++++--- common/sagas/transaction/network/gas.ts | 21 ++++++++++-- spec/sagas/transaction/network/gas.spec.ts | 32 ++++++++++++++----- 5 files changed, 67 insertions(+), 17 deletions(-) diff --git a/common/components/GasLimitField.tsx b/common/components/GasLimitField.tsx index 92fbc722..34c6857b 100644 --- a/common/components/GasLimitField.tsx +++ b/common/components/GasLimitField.tsx @@ -9,9 +9,14 @@ import { Input } from 'components/ui'; interface Props { customLabel?: string; disabled?: boolean; + hideGasCalculationSpinner?: boolean; } -export const GasLimitField: React.SFC = ({ customLabel, disabled }) => ( +export const GasLimitField: React.SFC = ({ + customLabel, + disabled, + hideGasCalculationSpinner +}) => ( (
@@ -19,7 +24,10 @@ export const GasLimitField: React.SFC = ({ customLabel, disabled }) => (
{customLabel ? customLabel : translate('TRANS_GAS')}
- +
{
)} diff --git a/common/containers/Tabs/ScheduleTransaction/components/Fields/ScheduleGasLimitField.tsx b/common/containers/Tabs/ScheduleTransaction/components/Fields/ScheduleGasLimitField.tsx index 435e69a6..769c39b6 100644 --- a/common/containers/Tabs/ScheduleTransaction/components/Fields/ScheduleGasLimitField.tsx +++ b/common/containers/Tabs/ScheduleTransaction/components/Fields/ScheduleGasLimitField.tsx @@ -3,12 +3,17 @@ import React from 'react'; import { AppState } from 'reducers'; import { setScheduleGasLimitField, TSetScheduleGasLimitField } from 'actions/transaction'; import { translateRaw } from 'translations'; -import { Input } from 'components/ui'; -import { getScheduleGasLimit, isValidScheduleGasLimit } from 'selectors/transaction'; +import { Input, InlineSpinner } from 'components/ui'; +import { + getScheduleGasLimit, + isValidScheduleGasLimit, + getGasEstimationPending +} from 'selectors/transaction'; import { Wei } from 'libs/units'; import { EAC_SCHEDULING_CONFIG } from 'libs/scheduling'; interface OwnProps { + gasEstimationPending: boolean; scheduleGasLimit: any; validScheduleGasLimit: boolean; } @@ -21,12 +26,16 @@ type Props = OwnProps & DispatchProps; class ScheduleGasLimitFieldClass extends React.Component { public render() { - const { scheduleGasLimit, validScheduleGasLimit } = this.props; + const { gasEstimationPending, scheduleGasLimit, validScheduleGasLimit } = this.props; return (