-
Notifications
You must be signed in to change notification settings - Fork 295
/
WalletTokenSendForm.js
executable file
·786 lines (740 loc) · 27.2 KB
/
WalletTokenSendForm.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
// @flow
import React, { Component } from 'react';
import type { Node } from 'react';
import { observer } from 'mobx-react';
import { Button } from 'react-polymorph/lib/components/Button';
import { Input } from 'react-polymorph/lib/components/Input';
import { NumericInput } from 'react-polymorph/lib/components/NumericInput';
import { ButtonSkin } from 'react-polymorph/lib/skins/simple/ButtonSkin';
import { InputSkin } from 'react-polymorph/lib/skins/simple/InputSkin';
import { defineMessages, intlShape } from 'react-intl';
import vjf from 'mobx-react-form/lib/validators/VJF';
import BigNumber from 'bignumber.js';
import { get } from 'lodash';
import { PopOver } from 'react-polymorph/lib/components/PopOver';
import SVGInline from 'react-svg-inline';
import classNames from 'classnames';
import ReactToolboxMobxForm from '../../utils/ReactToolboxMobxForm';
import { submitOnEnter } from '../../utils/form';
import AmountInputSkin from './skins/AmountInputSkin';
import BorderedBox from '../widgets/BorderedBox';
import LoadingSpinner from '../widgets/LoadingSpinner';
import styles from './WalletTokenSendForm.scss';
import globalMessages from '../../i18n/global-messages';
import WalletSendConfirmationDialogContainer from '../../containers/wallet/dialogs/WalletSendConfirmationDialogContainer';
import {
formattedAmountToNaturalUnits,
formattedAmountToLovelace,
formattedWalletAmount,
} from '../../utils/formatters';
import { FORM_VALIDATION_DEBOUNCE_WAIT } from '../../config/timingConfig';
import { FormattedHTMLMessageWithLink } from '../widgets/FormattedHTMLMessageWithLink';
import { NUMBER_FORMATS } from '../../../../common/types/number.types';
/* eslint-disable consistent-return */
import { messages as apiErrorMessages } from '../../api/errors';
import type { HwDeviceStatus } from '../../domains/Wallet';
import WalletTokenSendConfirmationDialog from './WalletTokenSendConfirmationDialog';
import Wallet from '../../domains/Wallet';
import closeIcon from '../../assets/images/close-cross.inline.svg';
import WalletsDropdown from '../widgets/forms/WalletsDropdown';
export const messages = defineMessages({
titleLabel: {
id: 'wallet.send.form.title.label',
defaultMessage: '!!!Title',
description: 'Label for the "Title" text input in the wallet send form.',
},
titleHint: {
id: 'wallet.send.form.title.hint',
defaultMessage: '!!!E.g: Money for Frank',
description:
'Hint inside the "Receiver" text input in the wallet send form.',
},
receiverLabel: {
id: 'wallet.send.form.receiver.label',
defaultMessage: '!!!Receiver',
description: 'Label for the "Receiver" text input in the wallet send form.',
},
receiverHint: {
id: 'wallet.send.form.receiver.placeholder',
defaultMessage: '!!!Paste an address',
description:
'Hint inside the "Receiver" text input in the wallet send form.',
},
assetLabel: {
id: 'wallet.send.form.asset.label',
defaultMessage: '!!!Asset',
description: 'Label for the "Asset" number input in the wallet send form.',
},
addNewReceiverButtonLabel: {
id: 'wallet.send.form.button.addNewReceiver',
defaultMessage: '!!!+ Add another receiver',
description:
'Label for the "+ Add another receiver" button in the wallet send form.',
},
removeReceiverButtonLabel: {
id: 'wallet.send.form.button.removeReceiver',
defaultMessage: '!!!Remove',
description: 'Label for the "Remove" button in the wallet send form.',
},
addAssetButtonLabel: {
id: 'wallet.send.form.button.addAssetButtonLabel',
defaultMessage: '!!!+ Add another asset',
description:
'Label for the "+ Add another asset" button in the wallet send form.',
},
estimatedFeeLabel: {
id: 'wallet.send.form.estimatedFee.label',
defaultMessage: '!!!Estimated fees',
description:
'Label for the "Estimated fees" number input in the wallet send form.',
},
ofLabel: {
id: 'wallet.send.form.of.label',
defaultMessage: '!!!of',
description: 'Label for the "of" max ADA value in the wallet send form.',
},
descriptionLabel: {
id: 'wallet.send.form.description.label',
defaultMessage: '!!!Description',
description:
'Label for the "description" text area in the wallet send form.',
},
descriptionHint: {
id: 'wallet.send.form.description.hint',
defaultMessage: '!!!You can add a message if you want',
description: 'Hint in the "description" text area in the wallet send form.',
},
resetButtonLabel: {
id: 'wallet.send.form.reset',
defaultMessage: '!!!Reset',
description: 'Label for the reset button on the wallet send form.',
},
sendButtonLabel: {
id: 'wallet.send.form.send',
defaultMessage: '!!!Send',
description: 'Label for the send button on the wallet send form.',
},
invalidAmount: {
id: 'wallet.send.form.errors.invalidAmount',
defaultMessage: '!!!Please enter a valid amount.',
description: 'Error message shown when invalid amount was entered.',
},
invalidTitle: {
id: 'wallet.send.form.errors.invalidTitle',
defaultMessage: '!!!Please enter a title with at least 3 characters.',
description:
'Error message shown when invalid transaction title was entered.',
},
syncingTransactionsMessage: {
id: 'wallet.send.form.syncingTransactionsMessage',
defaultMessage:
'!!!This wallet is currently being synced with the blockchain. While synchronisation is in progress transacting is not possible and transaction history is not complete.',
description:
'Syncing transactions message shown during async wallet restore in the wallet send form.',
},
calculatingFeesLabel: {
id: 'wallet.send.form.calculatingFeesLabel',
defaultMessage: '!!!Calculating fees',
description:
'Label for the "Calculating fees" message for amount input field.',
},
syncingWallet: {
id: 'wallet.send.form.syncingWallet',
defaultMessage: '!!!syncing',
description: 'Syncing wallet label on the send tokens form.',
},
});
messages.fieldIsRequired = globalMessages.fieldIsRequired;
type Props = {
currencyUnit: string,
currencyMaxIntegerDigits?: number,
currencyMaxFractionalDigits: number,
validateAmount: (amountInNaturalUnits: string) => Promise<boolean>,
calculateTransactionFee: (
address: string,
amount: number
) => Promise<BigNumber>,
currentNumberFormat: string,
walletAmount: BigNumber,
addressValidator: Function,
openDialogAction: Function,
isDialogOpen: Function,
onExternalLinkClick?: Function,
isRestoreActive: boolean,
hwDeviceStatus: HwDeviceStatus,
isHardwareWallet: boolean,
nativeTokens: Array<Wallet>,
isClearTooltipOpeningDownward?: boolean,
selectedWallet: ?Wallet,
};
type State = {
isTransactionFeeCalculated: boolean,
transactionFee: BigNumber,
feeCalculationRequestQue: number,
transactionFeeError: ?string | ?Node,
showReceiverRemoveBtn: boolean,
selectedWalletId: ?string,
showReceiverField: boolean,
tokens: Array<Wallet>,
};
@observer
export default class WalletTokenSendForm extends Component<Props, State> {
static contextTypes = {
intl: intlShape.isRequired,
};
state = {
isTransactionFeeCalculated: false,
transactionFee: new BigNumber(0),
feeCalculationRequestQue: 0,
transactionFeeError: null,
showReceiverRemoveBtn: false,
selectedWalletId: null,
showReceiverField: false,
tokens: []
};
// We need to track the fee calculation state in order to disable
// the "Submit" button as soon as either receiver or amount field changes.
// This is required as we are using debounced validation and we need to
// disable the "Submit" button as soon as the value changes and then wait for
// the validation to end in order to see if the button should be enabled or not.
_isCalculatingTransactionFee = false;
// We need to track the mounted state in order to avoid calling
// setState promise handling code after the component was already unmounted:
// Read more: https://facebook.github.io/react/blog/2015/12/16/ismounted-antipattern.html
_isMounted = false;
componentDidMount() {
this._isMounted = true;
const { selectedWallet, nativeTokens } = this.props;
if (selectedWallet) {
this.onSelectWallet(selectedWallet.id);
}
// @TODO Remove hardcoded setter of values for token currencies
if (nativeTokens && nativeTokens.length) {
const filteredTokens = [];
// eslint-disable-next-line no-return-assign
nativeTokens.forEach((token) => {
const nativeToken = {
...token,
currencyUnit: token.name,
};
filteredTokens.push(nativeToken);
});
this.setState({
tokens: filteredTokens,
});
}
}
componentWillUnmount() {
this._isMounted = false;
}
handleOnSubmit = () => {
if (this.isDisabled()) {
return false;
}
this.props.openDialogAction({
dialog: WalletTokenSendConfirmationDialog,
});
};
clearReceiverAddress = () => {
const receiverField = this.form.$('receiver');
receiverField.clear();
receiverField.focus();
};
clearAssetValue = () => {
const assetField = this.form.$('asset');
assetField.clear();
assetField.focus();
};
handleOnReset = () => {
this.form.reset();
};
handleSubmitOnEnter = submitOnEnter.bind(this, this.handleOnSubmit);
isDisabled = () =>
this._isCalculatingTransactionFee || !this.state.isTransactionFeeCalculated;
// FORM VALIDATION
form = new ReactToolboxMobxForm(
{
fields: {
receiver: {
label: this.context.intl.formatMessage(messages.receiverLabel),
placeholder: this.context.intl.formatMessage(messages.receiverHint),
value: '',
validators: [
async ({ field, form }) => {
const { value } = field;
if (value === '') {
this.resetTransactionFee();
return [
false,
this.context.intl.formatMessage(messages.fieldIsRequired),
];
}
const assetField = form.$('asset');
const isAmountValid = assetField.isValid;
const isValidAddress = await this.props.addressValidator(value);
if (isValidAddress && isAmountValid) {
const amountValue = assetField.value.toString();
this.calculateTransactionFee(value, amountValue);
} else {
this.resetTransactionFee();
}
return [
isValidAddress,
this.context.intl.formatMessage(
apiErrorMessages.invalidAddress
),
];
},
],
},
asset: {
label: this.context.intl.formatMessage(messages.assetLabel),
placeholder: `0${
this.getCurrentNumberFormat().decimalSeparator
}${'0'.repeat(this.props.currencyMaxFractionalDigits)}`,
value: null,
validators: [
async ({ field, form }) => {
if (field.value === null) {
this.resetTransactionFee();
return [
false,
this.context.intl.formatMessage(messages.fieldIsRequired),
];
}
const amountValue = field.value.toString();
const isValid = await this.props.validateAmount(
formattedAmountToNaturalUnits(amountValue)
);
const receiverField = form.$('receiver');
const receiverValue = receiverField.value;
const isReceiverValid = receiverField.isValid;
if (isValid && isReceiverValid) {
this.calculateTransactionFee(receiverValue, amountValue);
} else {
this.resetTransactionFee();
}
return [
isValid,
this.context.intl.formatMessage(messages.invalidAmount),
];
},
],
},
walletsDropdown: {
type: 'select',
},
estimatedFee: {
label: this.context.intl.formatMessage(messages.estimatedFeeLabel),
placeholder: `0${
this.getCurrentNumberFormat().decimalSeparator
}${'0'.repeat(this.props.currencyMaxFractionalDigits)}`,
value: null,
},
},
},
{
plugins: { vjf: vjf() },
options: {
validateOnBlur: false,
validateOnChange: true,
validationDebounceWait: FORM_VALIDATION_DEBOUNCE_WAIT,
},
}
);
resetTransactionFee() {
if (this._isMounted) {
this._isCalculatingTransactionFee = false;
this.setState({
isTransactionFeeCalculated: false,
transactionFee: new BigNumber(0),
transactionFeeError: null,
});
}
}
isLatestTransactionFeeRequest = (
currentFeeCalculationRequestQue: number,
prevFeeCalculationRequestQue: number
) => currentFeeCalculationRequestQue - prevFeeCalculationRequestQue === 1;
calculateTransactionFee = async (address: string, amountValue: string) => {
const amount = formattedAmountToLovelace(amountValue);
const {
feeCalculationRequestQue: prevFeeCalculationRequestQue,
} = this.state;
this.setState((prevState) => ({
isTransactionFeeCalculated: false,
transactionFee: new BigNumber(0),
transactionFeeError: null,
feeCalculationRequestQue: prevState.feeCalculationRequestQue + 1,
}));
try {
const fee = await this.props.calculateTransactionFee(address, amount);
if (
this._isMounted &&
this.isLatestTransactionFeeRequest(
this.state.feeCalculationRequestQue,
prevFeeCalculationRequestQue
)
) {
this._isCalculatingTransactionFee = false;
this.setState({
isTransactionFeeCalculated: true,
transactionFee: fee,
transactionFeeError: null,
});
}
} catch (error) {
if (
this._isMounted &&
this.isLatestTransactionFeeRequest(
this.state.feeCalculationRequestQue,
prevFeeCalculationRequestQue
)
) {
const errorHasLink = !!get(error, ['values', 'linkLabel']);
const transactionFeeError = errorHasLink ? (
<FormattedHTMLMessageWithLink
message={error}
onExternalLinkClick={this.props.onExternalLinkClick}
/>
) : (
this.context.intl.formatMessage(error)
);
this._isCalculatingTransactionFee = false;
this.setState({
isTransactionFeeCalculated: false,
transactionFee: new BigNumber(0),
transactionFeeError,
});
}
}
};
getCurrentNumberFormat() {
return NUMBER_FORMATS[this.props.currentNumberFormat];
}
showReceiverField = () => {
this.setState({
showReceiverField: true,
});
};
hideReceiverField = () => {
this.setState({
showReceiverField: false,
});
};
get hasReceiverValue() {
const receiverField = this.form.$('receiver');
return receiverField.value.length > 0;
}
get isReceiverValid() {
const receiverField = this.form.$('receiver');
return receiverField.isValid;
}
get hasAssetValue() {
const assetField = this.form.$('asset');
return !!assetField.value;
}
showRemoveButton = () => {
this.setState({
showReceiverRemoveBtn: true,
});
};
hideRemoveButton = () => {
this.setState({
showReceiverRemoveBtn: false,
});
};
renderAssetRow = () => {};
renderReceiverRow = () => {};
removeReceiverRow = () => {
this.hideReceiverField();
this.clearAssetValue();
this.clearReceiverAddress();
};
addAssetRow = () => {};
onSelectWallet = (walletId: string) => {
this.setState({ selectedWalletId: walletId });
};
getNativeTokenWalletById = (selectedWalletId: string): ?Wallet => {
const { tokens } = this.state;
return tokens.find((token) => token.id === selectedWalletId);
};
render() {
const { form } = this;
const { intl } = this.context;
const {
currencyMaxFractionalDigits,
isDialogOpen,
isRestoreActive,
onExternalLinkClick,
hwDeviceStatus,
isHardwareWallet,
isClearTooltipOpeningDownward,
} = this.props;
const {
isTransactionFeeCalculated,
transactionFee,
transactionFeeError,
showReceiverRemoveBtn,
selectedWalletId,
showReceiverField,
tokens,
} = this.state;
const assetField = form.$('asset');
const receiverField = form.$('receiver');
const estimatedField = form.$('estimatedFee');
const walletsDropdownField = form.$('walletsDropdown');
const receiverFieldProps = receiverField.bind();
const assetFieldProps = assetField.bind();
const estimatedFieldProps = estimatedField.bind();
const walletsDropdownFieldProps = walletsDropdownField.bind();
const amount = new BigNumber(assetFieldProps.value || 0);
let fees = null;
let total = null;
if (isTransactionFeeCalculated) {
fees = transactionFee.toFormat(currencyMaxFractionalDigits);
total = amount.add(transactionFee).toFormat(currencyMaxFractionalDigits);
}
const selectedNativeToken: any =
selectedWalletId && tokens && tokens.length
? this.getNativeTokenWalletById(selectedWalletId)
: null;
const removeReceiverButtonClasses = classNames([
styles.removeReceiverButton,
'flat',
showReceiverRemoveBtn ? styles.active : null,
]);
const newReceiverButtonClasses = classNames([
styles.addNewReceiverButton,
'flat',
]);
const addAssetButtonClasses = classNames([
styles.addAssetButton,
'primary',
]);
const calculatingFeesSpinnerButtonClasses = classNames([
styles.calculatingFeesSpinnerButton,
styles.spinning,
]);
return (
<div className={styles.component}>
{isRestoreActive ? (
<div className={styles.syncingTransactionsWrapper}>
<LoadingSpinner big />
<p className={styles.syncingTransactionsText}>
{intl.formatMessage(messages.syncingTransactionsMessage)}
</p>
</div>
) : (
<BorderedBox>
<div className={styles.walletTokenSendForm}>
<div className={styles.walletTokenSendFormContainer}>
<div className={styles.fieldsContainer}>
<div
onMouseEnter={this.showRemoveButton}
onMouseLeave={this.hideRemoveButton}
className={styles.receiverInput}
>
{showReceiverField && (
<Button
className={removeReceiverButtonClasses}
label={intl.formatMessage(
messages.removeReceiverButtonLabel
)}
onClick={this.removeReceiverRow}
skin={ButtonSkin}
/>
)}
<Input
className="receiver"
label={intl.formatMessage(messages.receiverLabel)}
{...receiverField.bind()}
error={receiverField.error}
onChange={(value) => {
receiverField.onChange(value || '');
if (value) {
this.showReceiverField();
this.renderAssetRow();
}
}}
skin={InputSkin}
onKeyPress={this.handleSubmitOnEnter}
/>
{this.hasReceiverValue && (
<div className={styles.clearReceiverContainer}>
<PopOver
content="Clear"
placement={
isClearTooltipOpeningDownward ? 'bottom' : 'top'
}
>
<button
onClick={() => this.clearReceiverAddress()}
className={styles.clearReceiverButton}
>
<SVGInline
svg={closeIcon}
className={styles.clearReceiverIcon}
/>
</button>
</PopOver>
</div>
)}
</div>
{this.hasReceiverValue && showReceiverField && (
<>
<div className={styles.fieldsLine} />
<div className={styles.assetInput}>
{selectedNativeToken && (
<div className={styles.amountTokenTotal}>
{intl.formatMessage(messages.ofLabel)}
{formattedWalletAmount(
selectedNativeToken.amount,
false
)}
{selectedNativeToken.ticker}
</div>
)}
<NumericInput
{...assetFieldProps}
className="asset"
label={intl.formatMessage(messages.assetLabel)}
numberFormat={this.getCurrentNumberFormat()}
numberLocaleOptions={{
minimumFractionDigits: currencyMaxFractionalDigits,
}}
onChange={(value) => {
this._isCalculatingTransactionFee = true;
assetField.onChange(value);
estimatedField.onChange(fees);
if (value) {
this.renderAssetRow();
}
}}
currency={selectedNativeToken.currencyUnit}
skin={AmountInputSkin}
onKeyPress={this.handleSubmitOnEnter}
allowSigns={false}
/>
{this.hasAssetValue && (
<div className={styles.clearAssetContainer}>
<PopOver
content="Clear"
placement={
isClearTooltipOpeningDownward ? 'bottom' : 'top'
}
>
<button
onClick={() => this.clearAssetValue()}
className={styles.clearAssetButton}
>
<SVGInline
svg={closeIcon}
className={styles.clearReceiverIcon}
/>
</button>
</PopOver>
<div className={styles.separator} />
</div>
)}
<div className={styles.walletsDropdownWrapper}>
<WalletsDropdown
className={styles.walletsDropdown}
{...walletsDropdownFieldProps}
numberOfStakePools={4}
wallets={tokens}
onChange={(id) => this.onSelectWallet(id)}
syncingLabel={intl.formatMessage(
messages.syncingWallet
)}
hasNativeTokens
value={selectedWalletId}
getStakePoolById={() => {}}
errorPosition="bottom"
/>
</div>
<Button
className={addAssetButtonClasses}
label={intl.formatMessage(
messages.addAssetButtonLabel
)}
onClick={this.addAssetRow}
skin={ButtonSkin}
/>
</div>
</>
)}
</div>
</div>
{this.isReceiverValid && showReceiverField && (
<Button
className={newReceiverButtonClasses}
label={intl.formatMessage(messages.addNewReceiverButtonLabel)}
onClick={this.renderReceiverRow}
skin={ButtonSkin}
/>
)}
<div className={styles.estimatedFeeInput}>
<NumericInput
{...estimatedFieldProps}
className={styles.estimatedFee}
label={intl.formatMessage(messages.estimatedFeeLabel)}
numberFormat={this.getCurrentNumberFormat()}
numberLocaleOptions={{
minimumFractionDigits: currencyMaxFractionalDigits,
}}
error={transactionFeeError || assetField.error}
currency={intl.formatMessage(globalMessages.unitAda)}
fees={fees}
total={total}
skin={AmountInputSkin}
/>
{this._isCalculatingTransactionFee && (
<div className={styles.calculatingFeesContainer}>
<PopOver
content={intl.formatMessage(
messages.calculatingFeesLabel
)}
>
<button className={calculatingFeesSpinnerButtonClasses} />
</PopOver>
</div>
)}
</div>
<div className={styles.buttonsContainer}>
<Button
className="flat"
label={intl.formatMessage(messages.resetButtonLabel)}
onClick={this.handleOnReset}
skin={ButtonSkin}
/>
<Button
className="primary"
label={intl.formatMessage(messages.sendButtonLabel)}
onClick={this.handleOnSubmit}
skin={ButtonSkin}
disabled={this.isDisabled()}
/>
</div>
</div>
</BorderedBox>
)}
{isDialogOpen(WalletTokenSendConfirmationDialog) ? (
<WalletSendConfirmationDialogContainer
amount={amount.toFormat(currencyMaxFractionalDigits)}
receiver={receiverFieldProps.value}
receivers={[receiverFieldProps.value, receiverFieldProps.value]}
totalAmount={total}
transactionFee={fees}
amountToNaturalUnits={formattedAmountToNaturalUnits}
currencyUnit={selectedNativeToken.currencyUnit}
onExternalLinkClick={onExternalLinkClick}
hwDeviceStatus={hwDeviceStatus}
isHardwareWallet={isHardwareWallet}
nativeTokens={tokens}
/>
) : null}
</div>
);
}
}