FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
uniswap_interface_sc/apps/web/src/utils/formatNumbers.ts at main · stringcode86/uniswap_interface_sc · GitHub
stringcode86
uniswap_interface_sc
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
uniswap_interface_sc
/
apps
/
web
/
src
/
utils
/
formatNumbers.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
972 lines (846 loc) · 31.6 KB
Breadcrumbs
uniswap_interface_sc
/
apps
/
web
/
src
/
utils
/
formatNumbers.ts
Copy path
File metadata and controls
972 lines (846 loc) · 31.6 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
import
{
formatEther
as
ethersFormatEther
}
from
'@ethersproject/units'
import
{
Currency
,
CurrencyAmount
,
Percent
,
Price
,
Token
}
from
'@uniswap/sdk-core'
import
{
getCurrencySymbolDisplayType
}
from
'constants/localCurrencies'
import
{
useActiveLocalCurrency
}
from
'hooks/useActiveLocalCurrency'
import
{
useActiveLocale
}
from
'hooks/useActiveLocale'
import
usePrevious
from
'hooks/usePrevious'
import
{
useCallback
,
useMemo
}
from
'react'
import
{
Bound
}
from
'state/mint/v3/actions'
import
{
DEFAULT_LOCAL_CURRENCY
,
FiatCurrency
}
from
'uniswap/src/features/fiatCurrency/constants'
import
{
useLocalizationContext
}
from
'uniswap/src/features/language/LocalizationContext'
import
{
DEFAULT_LOCALE
,
Locale
}
from
'uniswap/src/features/language/constants'
type
Nullish
<
T
>
=
T
|
null
|
undefined
type
NumberFormatOptions
=
Intl
.
NumberFormatOptions
// Number formatting follows the standards laid out in this spec:
// https://www.notion.so/uniswaplabs/Number-standards-fbb9f533f10e4e22820722c2f66d23c0
const
FIVE_DECIMALS_MAX_TWO_DECIMALS_MIN
:
NumberFormatOptions
=
{
notation
:
'standard'
,
maximumFractionDigits
:
5
,
minimumFractionDigits
:
2
,
}
const
FIVE_DECIMALS_MAX_TWO_DECIMALS_MIN_NO_COMMAS
:
NumberFormatOptions
=
{
notation
:
'standard'
,
maximumFractionDigits
:
5
,
minimumFractionDigits
:
2
,
useGrouping
:
false
,
}
const
NO_DECIMALS
:
NumberFormatOptions
=
{
notation
:
'standard'
,
maximumFractionDigits
:
0
,
minimumFractionDigits
:
0
,
}
const
NO_DECIMALS_CURRENCY
:
NumberFormatOptions
=
{
notation
:
'standard'
,
maximumFractionDigits
:
0
,
minimumFractionDigits
:
0
,
currency
:
'USD'
,
style
:
'currency'
,
}
const
THREE_DECIMALS_NO_TRAILING_ZEROS
:
NumberFormatOptions
=
{
notation
:
'standard'
,
maximumFractionDigits
:
3
,
minimumFractionDigits
:
0
,
}
const
THREE_DECIMALS
:
NumberFormatOptions
=
{
notation
:
'standard'
,
maximumFractionDigits
:
3
,
minimumFractionDigits
:
3
,
}
const
THREE_DECIMALS_CURRENCY
:
NumberFormatOptions
=
{
notation
:
'standard'
,
maximumFractionDigits
:
3
,
minimumFractionDigits
:
3
,
currency
:
'USD'
,
style
:
'currency'
,
}
const
THREE_DECIMALS_NO_TRAILING_ZEROS_CURRENCY
:
NumberFormatOptions
=
{
...
THREE_DECIMALS_NO_TRAILING_ZEROS
,
currency
:
'USD'
,
style
:
'currency'
,
}
const
TWO_DECIMALS_NO_TRAILING_ZEROS
:
NumberFormatOptions
=
{
notation
:
'standard'
,
maximumFractionDigits
:
2
,
}
const
TWO_DECIMALS_NO_TRAILING_ZEROS_CURRENCY
:
NumberFormatOptions
=
{
...
TWO_DECIMALS_NO_TRAILING_ZEROS
,
currency
:
'USD'
,
style
:
'currency'
,
}
const
TWO_DECIMALS
:
NumberFormatOptions
=
{
notation
:
'standard'
,
maximumFractionDigits
:
2
,
minimumFractionDigits
:
2
,
}
const
TWO_DECIMALS_CURRENCY
:
NumberFormatOptions
=
{
notation
:
'standard'
,
maximumFractionDigits
:
2
,
minimumFractionDigits
:
2
,
currency
:
'USD'
,
style
:
'currency'
,
}
const
EIGHT_DECIMALS_CURRENCY
:
NumberFormatOptions
=
{
notation
:
'standard'
,
maximumFractionDigits
:
8
,
minimumFractionDigits
:
2
,
currency
:
'USD'
,
style
:
'currency'
,
}
const
SHORTHAND_TWO_DECIMALS
:
NumberFormatOptions
=
{
notation
:
'compact'
,
minimumFractionDigits
:
2
,
maximumFractionDigits
:
2
,
}
const
SHORTHAND_TWO_DECIMALS_NO_TRAILING_ZEROS
:
NumberFormatOptions
=
{
notation
:
'compact'
,
maximumFractionDigits
:
2
,
}
const
SHORTHAND_TWO_DECIMALS_NO_TRAILING_ZEROS_CURRENCY
:
NumberFormatOptions
=
{
...
SHORTHAND_TWO_DECIMALS_NO_TRAILING_ZEROS
,
currency
:
'USD'
,
style
:
'currency'
,
}
const
SHORTHAND_ONE_DECIMAL
:
NumberFormatOptions
=
{
notation
:
'compact'
,
minimumFractionDigits
:
1
,
maximumFractionDigits
:
1
,
}
const
SHORTHAND_CURRENCY_TWO_DECIMALS
:
NumberFormatOptions
=
{
notation
:
'compact'
,
minimumFractionDigits
:
2
,
maximumFractionDigits
:
2
,
currency
:
'USD'
,
style
:
'currency'
,
}
const
SHORTHAND_CURRENCY_ONE_DECIMAL
:
NumberFormatOptions
=
{
notation
:
'compact'
,
minimumFractionDigits
:
1
,
maximumFractionDigits
:
1
,
currency
:
'USD'
,
style
:
'currency'
,
}
const
SIX_SIG_FIGS_TWO_DECIMALS
:
NumberFormatOptions
=
{
notation
:
'standard'
,
maximumSignificantDigits
:
6
,
minimumSignificantDigits
:
3
,
maximumFractionDigits
:
2
,
minimumFractionDigits
:
2
,
}
const
SIX_SIG_FIGS_NO_COMMAS
:
NumberFormatOptions
=
{
notation
:
'standard'
,
maximumSignificantDigits
:
6
,
useGrouping
:
false
,
}
const
SIX_SIG_FIGS_TWO_DECIMALS_NO_COMMAS
:
NumberFormatOptions
=
{
notation
:
'standard'
,
maximumSignificantDigits
:
6
,
minimumSignificantDigits
:
3
,
maximumFractionDigits
:
2
,
minimumFractionDigits
:
2
,
useGrouping
:
false
,
}
const
ONE_SIG_FIG_CURRENCY
:
NumberFormatOptions
=
{
notation
:
'standard'
,
minimumSignificantDigits
:
1
,
maximumSignificantDigits
:
1
,
currency
:
'USD'
,
style
:
'currency'
,
}
const
THREE_SIG_FIGS_CURRENCY
:
NumberFormatOptions
=
{
notation
:
'standard'
,
minimumSignificantDigits
:
3
,
maximumSignificantDigits
:
3
,
currency
:
'USD'
,
style
:
'currency'
,
}
const
SEVEN_SIG_FIGS__SCI_NOTATION_CURRENCY
:
NumberFormatOptions
=
{
notation
:
'scientific'
,
minimumSignificantDigits
:
7
,
maximumSignificantDigits
:
7
,
currency
:
'USD'
,
style
:
'currency'
,
}
// each rule must contain either an `upperBound` or an `exact` value.
// upperBound => number will use that formatter as long as it is < upperBound
// exact => number will use that formatter if it is === exact
// if hardcoded input is supplied it will override the input value or use the hardcoded output
type
HardCodedInputFormat
=
|
{
input
:
number
prefix
?:
string
hardcodedOutput
?:
undefined
}
|
{
input
?:
undefined
prefix
?:
undefined
hardcodedOutput
:
string
}
type
FormatterBaseRule
=
{
formatterOptions
:
NumberFormatOptions
}
type
FormatterExactRule
=
{
upperBound
?:
undefined
;
exact
:
number
}
&
FormatterBaseRule
type
FormatterUpperBoundRule
=
{
upperBound
:
number
;
exact
?:
undefined
}
&
FormatterBaseRule
type
FormatterRule
=
(
FormatterExactRule
|
FormatterUpperBoundRule
)
&
{
hardCodedInput
?:
HardCodedInputFormat
}
// these formatter objects dictate which formatter rule to use based on the interval that
// the number falls into. for example, based on the rule set below, if your number
// falls between 1 and 1e6, you'd use TWO_DECIMALS as the formatter.
const
tokenNonTxFormatter
:
FormatterRule
[
]
=
[
{
exact
:
0
,
formatterOptions
:
NO_DECIMALS
}
,
{
upperBound
:
0.001
,
hardCodedInput
:
{
input
:
0.001
,
prefix
:
'<'
}
,
formatterOptions
:
THREE_DECIMALS
}
,
{
upperBound
:
1
,
formatterOptions
:
THREE_DECIMALS
}
,
{
upperBound
:
1e6
,
formatterOptions
:
TWO_DECIMALS
}
,
{
upperBound
:
1e15
,
formatterOptions
:
SHORTHAND_TWO_DECIMALS
}
,
{
upperBound
:
Infinity
,
hardCodedInput
:
{
input
:
999_000_000_000_000
,
prefix
:
'>'
}
,
formatterOptions
:
SHORTHAND_TWO_DECIMALS_NO_TRAILING_ZEROS
,
}
,
]
const
tokenQuantityStatsFormatter
:
FormatterRule
[
]
=
[
// if token stat value is 0, we probably don't have the data for it, so show '-' as a placeholder
{
exact
:
0
,
hardCodedInput
:
{
hardcodedOutput
:
'-'
}
,
formatterOptions
:
NO_DECIMALS
}
,
{
upperBound
:
0.01
,
hardCodedInput
:
{
input
:
0.01
,
prefix
:
'<'
}
,
formatterOptions
:
TWO_DECIMALS
}
,
{
upperBound
:
1000
,
formatterOptions
:
TWO_DECIMALS
}
,
{
upperBound
:
Infinity
,
formatterOptions
:
SHORTHAND_ONE_DECIMAL
}
,
]
const
tokenTxFormatter
:
FormatterRule
[
]
=
[
{
exact
:
0
,
formatterOptions
:
NO_DECIMALS
}
,
{
upperBound
:
0.00001
,
hardCodedInput
:
{
input
:
0.00001
,
prefix
:
'<'
}
,
formatterOptions
:
FIVE_DECIMALS_MAX_TWO_DECIMALS_MIN
,
}
,
{
upperBound
:
1
,
formatterOptions
:
FIVE_DECIMALS_MAX_TWO_DECIMALS_MIN
}
,
{
upperBound
:
10000
,
formatterOptions
:
SIX_SIG_FIGS_TWO_DECIMALS
}
,
{
upperBound
:
Infinity
,
formatterOptions
:
TWO_DECIMALS
}
,
]
const
swapTradeAmountFormatter
:
FormatterRule
[
]
=
[
{
exact
:
0
,
formatterOptions
:
NO_DECIMALS
}
,
{
upperBound
:
0.1
,
formatterOptions
:
SIX_SIG_FIGS_NO_COMMAS
}
,
{
upperBound
:
1
,
formatterOptions
:
FIVE_DECIMALS_MAX_TWO_DECIMALS_MIN_NO_COMMAS
}
,
{
upperBound
:
Infinity
,
formatterOptions
:
SIX_SIG_FIGS_TWO_DECIMALS_NO_COMMAS
}
,
]
const
swapDetailsAmountFormatter
:
FormatterRule
[
]
=
[
{
upperBound
:
Infinity
,
formatterOptions
:
SIX_SIG_FIGS_NO_COMMAS
}
]
const
swapPriceFormatter
:
FormatterRule
[
]
=
[
{
exact
:
0
,
formatterOptions
:
NO_DECIMALS
}
,
{
upperBound
:
0.00001
,
hardCodedInput
:
{
input
:
0.00001
,
prefix
:
'<'
}
,
formatterOptions
:
FIVE_DECIMALS_MAX_TWO_DECIMALS_MIN
,
}
,
...
swapTradeAmountFormatter
,
]
const
fiatTokenDetailsFormatter
:
FormatterRule
[
]
=
[
{
exact
:
0
,
formatterOptions
:
TWO_DECIMALS_CURRENCY
}
,
{
upperBound
:
0.00000001
,
hardCodedInput
:
{
input
:
0.00000001
,
prefix
:
'<'
}
,
formatterOptions
:
ONE_SIG_FIG_CURRENCY
,
}
,
{
upperBound
:
0.1
,
formatterOptions
:
THREE_SIG_FIGS_CURRENCY
}
,
{
upperBound
:
1.05
,
formatterOptions
:
THREE_DECIMALS_CURRENCY
}
,
{
upperBound
:
1e6
,
formatterOptions
:
TWO_DECIMALS_CURRENCY
}
,
{
upperBound
:
Infinity
,
formatterOptions
:
SHORTHAND_CURRENCY_TWO_DECIMALS
}
,
]
const
chartVolumePriceScale
:
FormatterRule
[
]
=
[
{
upperBound
:
0.001
,
hardCodedInput
:
{
input
:
0.001
,
prefix
:
'<'
}
,
formatterOptions
:
ONE_SIG_FIG_CURRENCY
,
}
,
{
upperBound
:
2
,
formatterOptions
:
TWO_DECIMALS_CURRENCY
}
,
{
upperBound
:
1000
,
formatterOptions
:
NO_DECIMALS_CURRENCY
}
,
{
upperBound
:
Infinity
,
formatterOptions
:
SHORTHAND_CURRENCY_ONE_DECIMAL
}
,
]
const
chartFiatValueFormatter
:
FormatterRule
[
]
=
[
// if token stat value is 0, we probably don't have the data for it, so show '-' as a placeholder
{
exact
:
0
,
hardCodedInput
:
{
hardcodedOutput
:
'-'
}
,
formatterOptions
:
ONE_SIG_FIG_CURRENCY
}
,
{
upperBound
:
1.05
,
formatterOptions
:
EIGHT_DECIMALS_CURRENCY
}
,
{
upperBound
:
1e6
,
formatterOptions
:
TWO_DECIMALS_CURRENCY
}
,
{
upperBound
:
Infinity
,
formatterOptions
:
SHORTHAND_CURRENCY_TWO_DECIMALS
}
,
]
const
fiatTokenPricesFormatter
:
FormatterRule
[
]
=
[
{
exact
:
0
,
formatterOptions
:
TWO_DECIMALS_CURRENCY
}
,
{
upperBound
:
0.00000001
,
hardCodedInput
:
{
input
:
0.00000001
,
prefix
:
'<'
}
,
formatterOptions
:
ONE_SIG_FIG_CURRENCY
,
}
,
{
upperBound
:
1
,
formatterOptions
:
THREE_SIG_FIGS_CURRENCY
}
,
{
upperBound
:
1e6
,
formatterOptions
:
TWO_DECIMALS_CURRENCY
}
,
{
upperBound
:
1e16
,
formatterOptions
:
SHORTHAND_CURRENCY_TWO_DECIMALS
}
,
{
upperBound
:
Infinity
,
formatterOptions
:
SEVEN_SIG_FIGS__SCI_NOTATION_CURRENCY
}
,
]
const
fiatTokenStatsFormatter
:
FormatterRule
[
]
=
[
// if token stat value is 0, we probably don't have the data for it, so show '-' as a placeholder
{
exact
:
0
,
hardCodedInput
:
{
hardcodedOutput
:
'-'
}
,
formatterOptions
:
ONE_SIG_FIG_CURRENCY
}
,
{
upperBound
:
0.01
,
hardCodedInput
:
{
input
:
0.01
,
prefix
:
'<'
}
,
formatterOptions
:
TWO_DECIMALS_CURRENCY
}
,
{
upperBound
:
1000
,
formatterOptions
:
TWO_DECIMALS_CURRENCY
}
,
{
upperBound
:
Infinity
,
formatterOptions
:
SHORTHAND_CURRENCY_ONE_DECIMAL
}
,
]
const
fiatGasPriceFormatter
:
FormatterRule
[
]
=
[
{
exact
:
0
,
formatterOptions
:
NO_DECIMALS_CURRENCY
}
,
{
upperBound
:
0.01
,
hardCodedInput
:
{
input
:
0.01
,
prefix
:
'<'
}
,
formatterOptions
:
TWO_DECIMALS_CURRENCY
}
,
{
upperBound
:
1e6
,
formatterOptions
:
TWO_DECIMALS_CURRENCY
}
,
{
upperBound
:
Infinity
,
formatterOptions
:
SHORTHAND_CURRENCY_TWO_DECIMALS
}
,
]
const
fiatTokenQuantityFormatter
:
FormatterRule
[
]
=
[
{
exact
:
0
,
formatterOptions
:
TWO_DECIMALS_CURRENCY
}
,
...
fiatGasPriceFormatter
,
]
const
portfolioBalanceFormatter
:
FormatterRule
[
]
=
[
{
exact
:
0
,
formatterOptions
:
TWO_DECIMALS_CURRENCY
}
,
{
upperBound
:
Infinity
,
formatterOptions
:
TWO_DECIMALS_CURRENCY
}
,
]
const
ntfTokenFloorPriceFormatterTrailingZeros
:
FormatterRule
[
]
=
[
{
exact
:
0
,
formatterOptions
:
NO_DECIMALS
}
,
{
upperBound
:
0.001
,
hardCodedInput
:
{
input
:
0.001
,
prefix
:
'<'
}
,
formatterOptions
:
THREE_DECIMALS
}
,
{
upperBound
:
1
,
formatterOptions
:
THREE_DECIMALS
}
,
{
upperBound
:
1000
,
formatterOptions
:
TWO_DECIMALS
}
,
{
upperBound
:
1e15
,
formatterOptions
:
SHORTHAND_TWO_DECIMALS
}
,
{
upperBound
:
Infinity
,
hardCodedInput
:
{
input
:
999_000_000_000_000
,
prefix
:
'>'
}
,
formatterOptions
:
SHORTHAND_TWO_DECIMALS_NO_TRAILING_ZEROS
,
}
,
]
const
ntfTokenFloorPriceFormatter
:
FormatterRule
[
]
=
[
{
exact
:
0
,
formatterOptions
:
NO_DECIMALS
}
,
{
upperBound
:
0.001
,
hardCodedInput
:
{
input
:
0.001
,
prefix
:
'<'
}
,
formatterOptions
:
THREE_DECIMALS
}
,
{
upperBound
:
1
,
formatterOptions
:
THREE_DECIMALS_NO_TRAILING_ZEROS
}
,
{
upperBound
:
1000
,
formatterOptions
:
TWO_DECIMALS_NO_TRAILING_ZEROS
}
,
{
upperBound
:
1e15
,
formatterOptions
:
SHORTHAND_TWO_DECIMALS_NO_TRAILING_ZEROS
}
,
{
upperBound
:
Infinity
,
hardCodedInput
:
{
input
:
999_000_000_000_000
,
prefix
:
'>'
}
,
formatterOptions
:
SHORTHAND_TWO_DECIMALS_NO_TRAILING_ZEROS
,
}
,
]
const
ntfCollectionStatsFormatter
:
FormatterRule
[
]
=
[
{
upperBound
:
1000
,
formatterOptions
:
NO_DECIMALS
}
,
{
upperBound
:
Infinity
,
formatterOptions
:
SHORTHAND_ONE_DECIMAL
}
,
]
const
nftTokenFormatter
:
FormatterRule
[
]
=
[
{
exact
:
0
,
hardCodedInput
:
{
hardcodedOutput
:
'-'
}
,
formatterOptions
:
FIVE_DECIMALS_MAX_TWO_DECIMALS_MIN
}
,
{
upperBound
:
0.0001
,
hardCodedInput
:
{
input
:
0.0001
,
prefix
:
'<'
}
,
formatterOptions
:
FIVE_DECIMALS_MAX_TWO_DECIMALS_MIN
,
}
,
{
upperBound
:
1.0
,
formatterOptions
:
THREE_DECIMALS
}
,
{
upperBound
:
1000
,
formatterOptions
:
TWO_DECIMALS_NO_TRAILING_ZEROS
}
,
{
upperBound
:
1e15
,
formatterOptions
:
SHORTHAND_TWO_DECIMALS_NO_TRAILING_ZEROS
}
,
{
upperBound
:
Infinity
,
hardCodedInput
:
{
input
:
999_000_000_000_000
,
prefix
:
'>'
}
,
formatterOptions
:
SHORTHAND_TWO_DECIMALS_NO_TRAILING_ZEROS
,
}
,
]
const
fiatNftTokenFormatter
:
FormatterRule
[
]
=
[
{
exact
:
0
,
hardCodedInput
:
{
hardcodedOutput
:
'-'
}
,
formatterOptions
:
NO_DECIMALS
}
,
{
upperBound
:
0.0001
,
hardCodedInput
:
{
input
:
0.0001
,
prefix
:
'<'
}
,
formatterOptions
:
ONE_SIG_FIG_CURRENCY
,
}
,
{
upperBound
:
1.0
,
formatterOptions
:
THREE_DECIMALS_NO_TRAILING_ZEROS_CURRENCY
}
,
{
upperBound
:
1000
,
formatterOptions
:
TWO_DECIMALS_NO_TRAILING_ZEROS_CURRENCY
}
,
{
upperBound
:
1e15
,
formatterOptions
:
SHORTHAND_TWO_DECIMALS_NO_TRAILING_ZEROS_CURRENCY
}
,
{
upperBound
:
Infinity
,
hardCodedInput
:
{
input
:
999_000_000_000_000
,
prefix
:
'>'
}
,
formatterOptions
:
SHORTHAND_TWO_DECIMALS_NO_TRAILING_ZEROS_CURRENCY
,
}
,
]
const
wholeNumberFormatter
:
FormatterRule
[
]
=
[
{
upperBound
:
Infinity
,
formatterOptions
:
NO_DECIMALS
}
]
export
enum
NumberType
{
// used for token quantities in non-transaction contexts (e.g. portfolio balances)
TokenNonTx
=
'token-non-tx'
,
// used for token quantity stats where shorthand is okay (e.g. pool stats balances)
TokenQuantityStats
=
'token-quantity-stats'
,
// used for token quantities in transaction contexts (e.g. swap, send)
TokenTx
=
'token-tx'
,
// this formatter is used for displaying swap price conversions
// below the input/output amounts
SwapPrice
=
'swap-price'
,
// this formatter is only used for displaying the swap trade output amount
// in the text input boxes. Output amounts on review screen should use the above TokenTx formatter
SwapTradeAmount
=
'swap-trade-amount'
,
SwapDetailsAmount
=
'swap-details-amount'
,
// fiat values for price, volume, tvl, etc in a chart header or scale
ChartFiatValue
=
'chart-fiat-value'
,
// fiat values for volume bar chart scales (y axis ticks)
ChartVolumePriceScale
=
'chart-volume-price-scale'
,
// fiat prices in any component that belongs in the Token Details flow (except for token stats)
FiatTokenDetails
=
'fiat-token-details'
,
// fiat prices everywhere except Token Details flow
FiatTokenPrice
=
'fiat-token-price'
,
// fiat values for market cap, TVL, volume in the Token Details screen
FiatTokenStats
=
'fiat-token-stats'
,
// fiat price of token balances
FiatTokenQuantity
=
'fiat-token-quantity'
,
// fiat gas prices
FiatGasPrice
=
'fiat-gas-price'
,
// portfolio balance
PortfolioBalance
=
'portfolio-balance'
,
// nft floor price denominated in a token (e.g, ETH)
NFTTokenFloorPrice
=
'nft-token-floor-price'
,
// nft collection stats like number of items, holder, and sales
NFTCollectionStats
=
'nft-collection-stats'
,
// nft floor price with trailing zeros
NFTTokenFloorPriceTrailingZeros
=
'nft-token-floor-price-trailing-zeros'
,
// nft token price in currency
NFTToken
=
'nft-token'
,
// nft token price in local fiat currency
FiatNFTToken
=
'fiat-nft-token'
,
// whole number formatting
WholeNumber
=
'whole-number'
,
}
type
FormatterType
=
NumberType
|
FormatterRule
[
]
const
TYPE_TO_FORMATTER_RULES
=
{
[
NumberType
.
TokenNonTx
]
:
tokenNonTxFormatter
,
[
NumberType
.
TokenQuantityStats
]
:
tokenQuantityStatsFormatter
,
[
NumberType
.
TokenTx
]
:
tokenTxFormatter
,
[
NumberType
.
SwapPrice
]
:
swapPriceFormatter
,
[
NumberType
.
SwapTradeAmount
]
:
swapTradeAmountFormatter
,
[
NumberType
.
SwapDetailsAmount
]
:
swapDetailsAmountFormatter
,
[
NumberType
.
FiatTokenQuantity
]
:
fiatTokenQuantityFormatter
,
[
NumberType
.
FiatTokenDetails
]
:
fiatTokenDetailsFormatter
,
[
NumberType
.
ChartFiatValue
]
:
chartFiatValueFormatter
,
[
NumberType
.
ChartVolumePriceScale
]
:
chartVolumePriceScale
,
[
NumberType
.
FiatTokenPrice
]
:
fiatTokenPricesFormatter
,
[
NumberType
.
FiatTokenStats
]
:
fiatTokenStatsFormatter
,
[
NumberType
.
FiatGasPrice
]
:
fiatGasPriceFormatter
,
[
NumberType
.
PortfolioBalance
]
:
portfolioBalanceFormatter
,
[
NumberType
.
NFTTokenFloorPrice
]
:
ntfTokenFloorPriceFormatter
,
[
NumberType
.
NFTTokenFloorPriceTrailingZeros
]
:
ntfTokenFloorPriceFormatterTrailingZeros
,
[
NumberType
.
NFTCollectionStats
]
:
ntfCollectionStatsFormatter
,
[
NumberType
.
NFTToken
]
:
nftTokenFormatter
,
[
NumberType
.
FiatNFTToken
]
:
fiatNftTokenFormatter
,
[
NumberType
.
WholeNumber
]
:
wholeNumberFormatter
,
}
function
getFormatterRule
(
input
:
number
,
type
:
FormatterType
,
conversionRate
?:
number
)
:
FormatterRule
{
const
rules
=
Array
.
isArray
(
type
)
?
type
:
TYPE_TO_FORMATTER_RULES
[
type
]
for
(
const
rule
of
rules
)
{
const
shouldConvertInput
=
rule
.
formatterOptions
.
currency
&&
conversionRate
const
convertedInput
=
shouldConvertInput
?
input
*
conversionRate
:
input
if
(
(
rule
.
exact
!==
undefined
&&
convertedInput
===
rule
.
exact
)
||
(
rule
.
upperBound
!==
undefined
&&
convertedInput
<
rule
.
upperBound
)
)
{
return
rule
}
}
throw
new
Error
(
`formatter for type
${
type
}
not configured correctly for value
${
input
}
`
)
}
interface
FormatNumberOptions
{
input
:
Nullish
<
number
>
type
?:
FormatterType
placeholder
?:
string
locale
?:
Locale
localCurrency
?:
FiatCurrency
conversionRate
?:
number
}
function
formatNumber
(
{
input
,
type
=
NumberType
.
TokenNonTx
,
placeholder
=
'-'
,
locale
=
DEFAULT_LOCALE
,
localCurrency
=
DEFAULT_LOCAL_CURRENCY
,
conversionRate
,
}
:
FormatNumberOptions
)
:
string
{
if
(
input
===
null
||
input
===
undefined
)
{
return
placeholder
}
const
{
hardCodedInput
,
formatterOptions
}
=
getFormatterRule
(
input
,
type
,
conversionRate
)
if
(
formatterOptions
.
currency
)
{
input
=
conversionRate
?
input
*
conversionRate
:
input
formatterOptions
.
currency
=
localCurrency
formatterOptions
.
currencyDisplay
=
getCurrencySymbolDisplayType
(
localCurrency
)
}
if
(
!
hardCodedInput
)
{
return
new
Intl
.
NumberFormat
(
locale
,
formatterOptions
)
.
format
(
input
)
}
if
(
hardCodedInput
.
hardcodedOutput
)
{
return
hardCodedInput
.
hardcodedOutput
}
const
{
input
:
hardCodedInputValue
,
prefix
}
=
hardCodedInput
if
(
hardCodedInputValue
===
undefined
)
{
return
placeholder
}
return
(
prefix
??
''
)
+
new
Intl
.
NumberFormat
(
locale
,
formatterOptions
)
.
format
(
hardCodedInputValue
)
}
interface
FormatCurrencyAmountOptions
{
amount
:
Nullish
<
CurrencyAmount
<
Currency
>
>
type
?:
FormatterType
placeholder
?:
string
locale
?:
Locale
localCurrency
?:
FiatCurrency
conversionRate
?:
number
}
export
function
formatCurrencyAmount
(
{
amount
,
type
=
NumberType
.
TokenNonTx
,
placeholder
,
locale
=
DEFAULT_LOCALE
,
localCurrency
=
DEFAULT_LOCAL_CURRENCY
,
conversionRate
,
}
:
FormatCurrencyAmountOptions
)
:
string
{
return
formatNumber
(
{
input
:
amount
?
parseFloat
(
amount
.
toSignificant
(
)
)
:
undefined
,
type
,
placeholder
,
locale
,
localCurrency
,
conversionRate
,
}
)
}
function
formatPercent
(
percent
:
Percent
|
undefined
,
locale
:
Locale
=
DEFAULT_LOCALE
)
{
if
(
!
percent
)
{
return
'-'
}
return
`
${
Number
(
percent
.
toFixed
(
3
)
)
.
toLocaleString
(
locale
,
{
maximumFractionDigits
:
3
,
useGrouping
:
false
,
}
)
}
%`
}
// Used to format floats representing percent change with fixed decimal places
function
formatDelta
(
delta
:
Nullish
<
number
>
,
locale
:
Locale
=
DEFAULT_LOCALE
)
{
if
(
delta
===
null
||
delta
===
undefined
||
delta
===
Infinity
||
isNaN
(
delta
)
)
{
return
'-'
}
return
`
${
Number
(
Math
.
abs
(
delta
)
.
toFixed
(
2
)
)
.
toLocaleString
(
locale
,
{
minimumFractionDigits
:
2
,
maximumFractionDigits
:
2
,
useGrouping
:
false
,
}
)
}
%`
}
interface
FormatPriceOptions
{
price
:
Nullish
<
Price
<
Currency
,
Currency
>
>
type
?:
FormatterType
locale
?:
Locale
localCurrency
?:
FiatCurrency
conversionRate
?:
number
}
function
formatPrice
(
{
price
,
type
=
NumberType
.
FiatTokenPrice
,
locale
=
DEFAULT_LOCALE
,
localCurrency
=
DEFAULT_LOCAL_CURRENCY
,
conversionRate
,
}
:
FormatPriceOptions
)
:
string
{
if
(
price
===
null
||
price
===
undefined
)
{
return
'-'
}
return
formatNumber
(
{
input
:
parseFloat
(
price
.
toSignificant
(
)
)
,
type
,
locale
,
localCurrency
,
conversionRate
,
}
)
}
interface
FormatTickPriceOptions
{
price
?:
Price
<
Token
,
Token
>
atLimit
:
{
[
bound
in
Bound
]
?:
boolean
|
undefined
}
direction
:
Bound
placeholder
?:
string
numberType
?:
NumberType
locale
?:
Locale
localCurrency
?:
FiatCurrency
conversionRate
?:
number
}
function
formatTickPrice
(
{
price
,
atLimit
,
direction
,
placeholder
,
numberType
,
locale
,
localCurrency
,
conversionRate
,
}
:
FormatTickPriceOptions
)
{
if
(
atLimit
[
direction
]
)
{
return
direction
===
Bound
.
LOWER
?
'0'
:
'∞'
}
if
(
!
price
&&
placeholder
!==
undefined
)
{
return
placeholder
}
return
formatPrice
(
{
price
,
type
:
numberType
??
NumberType
.
TokenNonTx
,
locale
,
localCurrency
,
conversionRate
}
)
}
interface
FormatNumberOrStringOptions
{
input
:
Nullish
<
number
|
string
>
type
:
FormatterType
locale
?:
Locale
localCurrency
?:
FiatCurrency
conversionRate
?:
number
}
function
formatNumberOrString
(
{
input
,
type
,
locale
,
localCurrency
,
conversionRate
,
}
:
FormatNumberOrStringOptions
)
:
string
{
if
(
input
===
null
||
input
===
undefined
)
{
return
'-'
}
if
(
typeof
input
===
'string'
)
{
return
formatNumber
(
{
input
:
parseFloat
(
input
)
,
type
,
locale
,
localCurrency
,
conversionRate
}
)
}
return
formatNumber
(
{
input
,
type
,
locale
,
localCurrency
,
conversionRate
}
)
}
interface
FormatEtherOptions
{
input
:
Nullish
<
number
|
string
>
type
:
FormatterType
locale
?:
Locale
localCurrency
?:
FiatCurrency
}
function
formatEther
(
{
input
,
type
,
locale
,
localCurrency
}
:
FormatEtherOptions
)
{
if
(
input
===
null
||
input
===
undefined
)
{
return
'-'
}
return
formatNumber
(
{
input
:
parseFloat
(
ethersFormatEther
(
input
.
toString
(
)
)
)
,
type
,
locale
,
localCurrency
}
)
}
interface
FormatFiatPriceOptions
{
price
:
Nullish
<
number
|
string
>
type
?:
FormatterType
locale
?:
Locale
localCurrency
?:
FiatCurrency
conversionRate
?:
number
}
function
formatFiatPrice
(
{
price
,
type
=
NumberType
.
FiatTokenPrice
,
locale
,
localCurrency
,
conversionRate
,
}
:
FormatFiatPriceOptions
)
:
string
{
return
formatNumberOrString
(
{
input
:
price
,
type
,
locale
,
localCurrency
,
conversionRate
}
)
}
const
MAX_AMOUNT_STR_LENGTH
=
9
function
formatReviewSwapCurrencyAmount
(
amount
:
CurrencyAmount
<
Currency
>
,
locale
:
Locale
=
DEFAULT_LOCALE
)
:
string
{
let
formattedAmount
=
formatCurrencyAmount
(
{
amount
,
type
:
NumberType
.
TokenTx
,
locale
}
)
if
(
formattedAmount
.
length
>
MAX_AMOUNT_STR_LENGTH
)
{
formattedAmount
=
formatCurrencyAmount
(
{
amount
,
type
:
NumberType
.
SwapTradeAmount
,
locale
}
)
}
return
formattedAmount
}
// TODO: https://linear.app/uniswap/issue/WEB-3495/import-useasyncdata-from-mobile
type
FiatCurrencyComponents
=
{
groupingSeparator
:
string
decimalSeparator
:
string
symbol
:
string
fullSymbol
:
string
// Some currencies have whitespace in between number and currency
symbolAtFront
:
boolean
// All currencies are at front or back except CVE, which we won't ever support
}
/**
* Helper function to return components of a currency value for a specific locale
* E.g. comma, period, or space for separating thousands
*/
export
function
getFiatCurrencyComponents
(
locale
=
DEFAULT_LOCALE
,
localCurrency
=
DEFAULT_LOCAL_CURRENCY
,
)
:
FiatCurrencyComponents
{
const
format
=
new
Intl
.
NumberFormat
(
locale
,
{
...
TWO_DECIMALS_CURRENCY
,
currency
:
localCurrency
,
currencyDisplay
:
getCurrencySymbolDisplayType
(
localCurrency
)
,
}
)
// See MDN for official docs https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/formatToParts
// Returns something like [{"type":"currency","value":"$"},{"type":"integer","value":"1"}]
const
parts
=
format
.
formatToParts
(
1000000.0
)
// This number should provide both types of separators
let
groupingSeparator
=
','
let
decimalSeparator
=
'.'
let
symbol
=
''
let
fullSymbol
=
''
let
symbolAtFront
=
true
parts
.
forEach
(
(
part
,
index
)
=>
{
if
(
part
.
type
===
'group'
)
{
groupingSeparator
=
part
.
value
}
else
if
(
part
.
type
===
'decimal'
)
{
decimalSeparator
=
part
.
value
}
else
if
(
part
.
type
===
'currency'
)
{
symbol
=
part
.
value
fullSymbol
=
symbol
symbolAtFront
=
index
===
0
const
nextPart
=
symbolAtFront
?
parts
[
index
+
1
]
:
parts
[
index
-
1
]
// Check for additional characters between symbol and number, like whitespace
if
(
nextPart
?.
type
===
'literal'
)
{
fullSymbol
=
symbolAtFront
?
symbol
+
nextPart
.
value
:
nextPart
.
value
+
symbol
}
}
}
)
return
{
groupingSeparator
,
decimalSeparator
,
symbol
,
fullSymbol
,
symbolAtFront
,
}
}
export
function
useFormatterLocales
(
)
:
{
formatterLocale
:
Locale
formatterLocalCurrency
:
FiatCurrency
}
{
const
activeLocale
=
useActiveLocale
(
)
const
activeLocalCurrency
=
useActiveLocalCurrency
(
)
return
{
formatterLocale
:
activeLocale
,
formatterLocalCurrency
:
activeLocalCurrency
,
}
}
function
handleFallbackCurrency
(
selectedCurrency
:
FiatCurrency
,
previousSelectedCurrency
:
FiatCurrency
|
undefined
,
previousConversionRate
:
number
|
undefined
,
shouldFallbackToUSD
:
boolean
,
shouldFallbackToPrevious
:
boolean
,
)
{
if
(
shouldFallbackToUSD
)
{
return
DEFAULT_LOCAL_CURRENCY
}
if
(
shouldFallbackToPrevious
)
{
return
previousConversionRate
?
previousSelectedCurrency
:
DEFAULT_LOCAL_CURRENCY
}
return
selectedCurrency
}
// Constructs an object that injects the correct locale and local currency into each of the above formatter functions.
export
function
useFormatter
(
)
{
const
{
formatterLocale
,
formatterLocalCurrency
}
=
useFormatterLocales
(
)
const
{
convertFiatAmount
,
conversionRate
:
localCurrencyConversionRate
}
=
useLocalizationContext
(
)
const
previousSelectedCurrency
=
usePrevious
(
formatterLocalCurrency
)
const
previousConversionRate
=
usePrevious
(
localCurrencyConversionRate
)
const
shouldFallbackToPrevious
=
!
localCurrencyConversionRate
const
shouldFallbackToUSD
=
!
localCurrencyConversionRate
const
currencyToFormatWith
=
handleFallbackCurrency
(
formatterLocalCurrency
,
previousSelectedCurrency
,
previousConversionRate
,
shouldFallbackToUSD
,
shouldFallbackToPrevious
,
)
const
localCurrencyConversionRateToFormatWith
=
shouldFallbackToPrevious
?
previousConversionRate
:
localCurrencyConversionRate
type
LocalesType
=
'locale'
|
'localCurrency'
|
'conversionRate'
const
formatNumberWithLocales
=
useCallback
(
(
options
:
Omit
<
FormatNumberOptions
,
LocalesType
>
)
=>
formatNumber
(
{
...
options
,
locale
:
formatterLocale
,
localCurrency
:
currencyToFormatWith
,
conversionRate
:
localCurrencyConversionRateToFormatWith
,
}
)
,
[
currencyToFormatWith
,
formatterLocale
,
localCurrencyConversionRateToFormatWith
]
,
)
const
formatCurrencyAmountWithLocales
=
useCallback
(
(
options
:
Omit
<
FormatCurrencyAmountOptions
,
LocalesType
>
)
=>
formatCurrencyAmount
(
{
...
options
,
locale
:
formatterLocale
,
localCurrency
:
currencyToFormatWith
,
conversionRate
:
localCurrencyConversionRateToFormatWith
,
}
)
,
[
currencyToFormatWith
,
formatterLocale
,
localCurrencyConversionRateToFormatWith
]
,
)
const
formatPriceWithLocales
=
useCallback
(
(
options
:
Omit
<
FormatPriceOptions
,
LocalesType
>
)
=>
formatPrice
(
{
...
options
,
locale
:
formatterLocale
,
localCurrency
:
currencyToFormatWith
,
conversionRate
:
localCurrencyConversionRateToFormatWith
,
}
)
,
[
currencyToFormatWith
,
formatterLocale
,
localCurrencyConversionRateToFormatWith
]
,
)
const
formatReviewSwapCurrencyAmountWithLocales
=
useCallback
(
(
amount
:
CurrencyAmount
<
Currency
>
)
=>
formatReviewSwapCurrencyAmount
(
amount
,
formatterLocale
)
,
[
formatterLocale
]
,
)
const
formatTickPriceWithLocales
=
useCallback
(
(
options
:
Omit
<
FormatTickPriceOptions
,
LocalesType
>
)
=>
formatTickPrice
(
{
...
options
,
locale
:
formatterLocale
,
localCurrency
:
currencyToFormatWith
,
conversionRate
:
localCurrencyConversionRateToFormatWith
,
}
)
,
[
currencyToFormatWith
,
formatterLocale
,
localCurrencyConversionRateToFormatWith
]
,
)
const
formatNumberOrStringWithLocales
=
useCallback
(
(
options
:
Omit
<
FormatNumberOrStringOptions
,
LocalesType
>
)
=>
formatNumberOrString
(
{
...
options
,
locale
:
formatterLocale
,
localCurrency
:
currencyToFormatWith
,
conversionRate
:
localCurrencyConversionRateToFormatWith
,
}
)
,
[
currencyToFormatWith
,
formatterLocale
,
localCurrencyConversionRateToFormatWith
]
,
)
const
formatFiatPriceWithLocales
=
useCallback
(
(
options
:
Omit
<
FormatFiatPriceOptions
,
LocalesType
>
)
=>
formatFiatPrice
(
{
...
options
,
locale
:
formatterLocale
,
localCurrency
:
currencyToFormatWith
,
conversionRate
:
localCurrencyConversionRateToFormatWith
,
}
)
,
[
currencyToFormatWith
,
formatterLocale
,
localCurrencyConversionRateToFormatWith
]
,
)
const
formatDeltaWithLocales
=
useCallback
(
(
percent
:
Nullish
<
number
>
)
=>
formatDelta
(
percent
,
formatterLocale
)
,
[
formatterLocale
]
,
)
const
formatPercentWithLocales
=
useCallback
(
(
percent
:
Percent
|
undefined
)
=>
formatPercent
(
percent
,
formatterLocale
)
,
[
formatterLocale
]
,
)
const
formatEtherwithLocales
=
useCallback
(
(
options
:
Omit
<
FormatEtherOptions
,
LocalesType
>
)
=>
formatEther
(
{
...
options
,
locale
:
formatterLocale
,
localCurrency
:
currencyToFormatWith
,
}
)
,
[
currencyToFormatWith
,
formatterLocale
]
,
)
const
formatConvertedFiatNumberOrString
=
useCallback
(
(
options
:
Omit
<
FormatNumberOrStringOptions
,
LocalesType
>
)
=>
formatNumberOrString
(
{
...
options
,
locale
:
formatterLocale
,
localCurrency
:
currencyToFormatWith
,
conversionRate
:
undefined
,
}
)
,
[
currencyToFormatWith
,
formatterLocale
]
,
)
return
useMemo
(
(
)
=>
(
{
convertToFiatAmount
:
convertFiatAmount
,
formatConvertedFiatNumberOrString
,
formatCurrencyAmount
:
formatCurrencyAmountWithLocales
,
formatEther
:
formatEtherwithLocales
,
formatFiatPrice
:
formatFiatPriceWithLocales
,
formatNumber
:
formatNumberWithLocales
,
formatNumberOrString
:
formatNumberOrStringWithLocales
,
formatDelta
:
formatDeltaWithLocales
,
formatPercent
:
formatPercentWithLocales
,
formatPrice
:
formatPriceWithLocales
,
formatReviewSwapCurrencyAmount
:
formatReviewSwapCurrencyAmountWithLocales
,
formatTickPrice
:
formatTickPriceWithLocales
,
}
)
,
[
convertFiatAmount
,
formatConvertedFiatNumberOrString
,
formatCurrencyAmountWithLocales
,
formatDeltaWithLocales
,
formatEtherwithLocales
,
formatFiatPriceWithLocales
,
formatNumberOrStringWithLocales
,
formatNumberWithLocales
,
formatPercentWithLocales
,
formatPriceWithLocales
,
formatReviewSwapCurrencyAmountWithLocales
,
formatTickPriceWithLocales
,
]
,
)
}
Back
|
FazBrowse Home
|
New Git URL