@rango-dev/ui 0.1.10-next.78 → 0.1.10-next.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/components/Alert/Alert.d.ts +2 -2
  2. package/dist/components/Alert/Alert.stories.d.ts +2 -1
  3. package/dist/components/BestRoute/BestRoute.d.ts +4 -1
  4. package/dist/components/SecondaryPage/SecondaryPage.d.ts +3 -5
  5. package/dist/components/SelectableWalletList/SelectableWalletList.d.ts +1 -1
  6. package/dist/components/TextField/TextField.stories.d.ts +1 -1
  7. package/dist/containers/ConfirmSwap/ConfirmSwap.d.ts +8 -4
  8. package/dist/containers/ConfirmWallets/ConfirmWallets.d.ts +4 -2
  9. package/dist/containers/History/types.d.ts +1 -0
  10. package/dist/helper/index.d.ts +0 -5
  11. package/dist/types/wallet.d.ts +8 -0
  12. package/dist/ui.cjs.development.js +288 -262
  13. package/dist/ui.cjs.development.js.map +1 -1
  14. package/dist/ui.cjs.production.min.js +1 -1
  15. package/dist/ui.cjs.production.min.js.map +1 -1
  16. package/dist/ui.esm.js +288 -262
  17. package/dist/ui.esm.js.map +1 -1
  18. package/package.json +1 -1
  19. package/src/components/Alert/Alert.tsx +5 -9
  20. package/src/components/BestRoute/BestRoute.tsx +55 -21
  21. package/src/components/BlockchainSelector/BlockchainSelector.tsx +13 -11
  22. package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +21 -20
  23. package/src/components/LiquiditySourcesSelector/LiquiditySourcesSelector.tsx +3 -2
  24. package/src/components/Radio/Radio.tsx +1 -0
  25. package/src/components/SecondaryPage/SecondaryPage.tsx +5 -6
  26. package/src/components/SelectableWalletList/SelectableWalletList.tsx +1 -1
  27. package/src/components/Settings/Settings.tsx +12 -13
  28. package/src/components/SwapContainer/SwapContainer.tsx +1 -0
  29. package/src/components/Switch/Switch.tsx +1 -0
  30. package/src/components/TokenSelector/TokenSelector.tsx +3 -2
  31. package/src/containers/ConfirmSwap/ConfirmSwap.tsx +92 -54
  32. package/src/containers/ConfirmWallets/ConfirmWallets.tsx +66 -62
  33. package/src/containers/History/History.tsx +3 -2
  34. package/src/containers/History/types.tsx +10 -1
  35. package/src/containers/SwapHistory/SwapHistory.tsx +87 -95
  36. package/src/helper/index.ts +1 -22
  37. package/src/types/wallet.ts +9 -0
  38. package/dist/containers/ConfirmWallets/types.d.ts +0 -9
  39. package/src/containers/ConfirmWallets/types.ts +0 -10
@@ -1547,39 +1547,6 @@ function StepDetail(_ref) {
1547
1547
  }, "on ", blockchain)));
1548
1548
  }
1549
1549
 
1550
- var secondsToString = function secondsToString(s) {
1551
- var minutes = parseInt((s / 60).toString()).toString();
1552
- return "" + minutes;
1553
- };
1554
- var totalArrivalTime = function totalArrivalTime(data) {
1555
- var _data$result, _data$result$swaps;
1556
- return (data == null ? void 0 : (_data$result = data.result) == null ? void 0 : (_data$result$swaps = _data$result.swaps) == null ? void 0 : _data$result$swaps.reduce(function (a, b) {
1557
- return a + b.estimatedTimeInSeconds;
1558
- }, 0)) || 0;
1559
- };
1560
- var rawFees = function rawFees(data) {
1561
- var _data$result2, _data$result2$swaps;
1562
- return ((data == null ? void 0 : (_data$result2 = data.result) == null ? void 0 : (_data$result2$swaps = _data$result2.swaps) == null ? void 0 : _data$result2$swaps.flatMap(function (s) {
1563
- return s.fee.map(function (f) {
1564
- return {
1565
- swapperId: s.swapperId,
1566
- fee: f
1567
- };
1568
- });
1569
- })) || []).reduce(function (partialSum, a) {
1570
- return partialSum + parseFloat(a.fee.amount);
1571
- }, 0).toFixed(3);
1572
- };
1573
- var decimalNumber = function decimalNumber(number, toFixed) {
1574
- if (number === void 0) {
1575
- number = '0';
1576
- }
1577
- return parseFloat(number).toFixed(toFixed);
1578
- };
1579
- var containsText = function containsText(text, searchText) {
1580
- return text.toLowerCase().includes(searchText.toLowerCase());
1581
- };
1582
-
1583
1550
  var waveSquares = /*#__PURE__*/keyframes({
1584
1551
  '0%': {
1585
1552
  backgroundPosition: '-468px 0'
@@ -1772,6 +1739,17 @@ var ArrowRight = /*#__PURE__*/styled('div', {
1772
1739
  borderBottom: '5px solid transparent',
1773
1740
  borderLeft: '5px solid $foreground'
1774
1741
  });
1742
+ var pulse = /*#__PURE__*/keyframes({
1743
+ '0%': {
1744
+ opacity: 1
1745
+ },
1746
+ '50%': {
1747
+ opacity: 0.3
1748
+ },
1749
+ '100%': {
1750
+ opacity: 1
1751
+ }
1752
+ });
1775
1753
  var GasContainer = /*#__PURE__*/styled('div', {
1776
1754
  backgroundColor: '$neutrals300',
1777
1755
  borderRadius: '5px',
@@ -1786,6 +1764,27 @@ var GasContainer = /*#__PURE__*/styled('div', {
1786
1764
  margin: '$8'
1787
1765
  }
1788
1766
  });
1767
+ var FeeContainer = /*#__PURE__*/styled('div', {
1768
+ display: 'flex',
1769
+ flexDirection: 'column',
1770
+ alignItems: 'center',
1771
+ variants: {
1772
+ warning: {
1773
+ "true": {
1774
+ animation: pulse + " 2s ease-in-out infinite"
1775
+ }
1776
+ }
1777
+ }
1778
+ });
1779
+ var TotalFee = /*#__PURE__*/styled(Typography, {
1780
+ variants: {
1781
+ warning: {
1782
+ "true": {
1783
+ color: '$warning300'
1784
+ }
1785
+ }
1786
+ }
1787
+ });
1789
1788
  var SkeletonContainer$1 = /*#__PURE__*/styled('div', {
1790
1789
  padding: '$4',
1791
1790
  '@md': {
@@ -1797,33 +1796,34 @@ var SwapperContainer = /*#__PURE__*/styled('div', {
1797
1796
  justifyContent: 'center',
1798
1797
  alignItems: 'center'
1799
1798
  });
1800
- function BestRoute(_ref) {
1799
+ function BestRoute(props) {
1801
1800
  var _data$result;
1802
- var data = _ref.data,
1803
- loading = _ref.loading,
1804
- error = _ref.error;
1805
- var fee,
1806
- time = '';
1807
- if (!!data) {
1808
- fee = rawFees(data);
1809
- time = secondsToString(totalArrivalTime(data));
1810
- }
1801
+ var data = props.data,
1802
+ loading = props.loading,
1803
+ error = props.error,
1804
+ totalFee = props.totalFee,
1805
+ feeWarning = props.feeWarning,
1806
+ totalTime = props.totalTime;
1811
1807
  return React__default.createElement(Container, null, loading ? React__default.createElement(SkeletonContainer$1, null, React__default.createElement(Skeleton, {
1812
1808
  width: 48,
1813
1809
  height: 94
1814
- })) : React__default.createElement(GasContainer, null, React__default.createElement(GasIcon, {
1815
- size: 20
1816
- }), React__default.createElement(Typography, {
1810
+ })) : React__default.createElement(GasContainer, null, React__default.createElement(FeeContainer, {
1811
+ warning: feeWarning
1812
+ }, React__default.createElement(GasIcon, {
1813
+ size: 20,
1814
+ color: feeWarning ? 'warning' : undefined
1815
+ }), React__default.createElement(TotalFee, {
1817
1816
  mt: 4,
1818
1817
  align: "center",
1819
- variant: "caption"
1820
- }, error && '-', !!data && "$" + fee), React__default.createElement(HR, null), React__default.createElement(TimeIcon, {
1818
+ variant: "caption",
1819
+ warning: feeWarning
1820
+ }, error && '-', !!data && "$" + totalFee)), React__default.createElement(HR, null), React__default.createElement(TimeIcon, {
1821
1821
  size: 20
1822
1822
  }), React__default.createElement(Typography, {
1823
1823
  mt: 4,
1824
1824
  align: "center",
1825
1825
  variant: "caption"
1826
- }, error && '-', !!data && "~" + time + "m")), React__default.createElement(BestRouteContainer, null, loading && React__default.createElement(Spinner, {
1826
+ }, error && '-', !!data && "~" + totalTime + "m")), React__default.createElement(BestRouteContainer, null, loading && React__default.createElement(Spinner, {
1827
1827
  color: "primary"
1828
1828
  }), error && React__default.createElement(ErrorMsg, {
1829
1829
  variant: "caption"
@@ -2414,9 +2414,7 @@ function SecondaryPage(props) {
2414
2414
  },
2415
2415
  value: searchedFor,
2416
2416
  autoFocus: true
2417
- })), React__default.createElement(ContentContainer, null, props.textField && React__default.createElement(props.Content, {
2418
- searchedFor: searchedFor
2419
- }), !props.textField && props.Content), Footer);
2417
+ })), React__default.createElement(ContentContainer, null, props.textField && (props.children == null ? void 0 : props.children(searchedFor)), !props.textField && props.children), Footer);
2420
2418
  }
2421
2419
 
2422
2420
  var MainContainer = /*#__PURE__*/styled('div', {
@@ -2445,10 +2443,7 @@ var MainContainer = /*#__PURE__*/styled('div', {
2445
2443
  }
2446
2444
  }
2447
2445
  });
2448
- var ContentContainer$1 = /*#__PURE__*/styled('div', {
2449
- display: 'flex',
2450
- flexDirection: 'column'
2451
- });
2446
+ var ContentContainer$1 = /*#__PURE__*/styled('div', {});
2452
2447
  var TitleContainer = /*#__PURE__*/styled('div', {
2453
2448
  marginBottom: '$8'
2454
2449
  });
@@ -2460,7 +2455,7 @@ var StyledTypography = /*#__PURE__*/styled(Typography, {
2460
2455
  });
2461
2456
  function Alert(props) {
2462
2457
  var type = props.type,
2463
- description = props.description,
2458
+ children = props.children,
2464
2459
  title = props.title;
2465
2460
  var showIcon = ['error', 'success', 'warning'].includes(type);
2466
2461
  return React__default.createElement(MainContainer, {
@@ -2476,11 +2471,13 @@ function Alert(props) {
2476
2471
  size: 28
2477
2472
  })), React__default.createElement(ContentContainer$1, null, title && React__default.createElement(TitleContainer, null, React__default.createElement(StyledTypography, {
2478
2473
  variant: "h6"
2479
- }, title)), React__default.createElement(StyledTypography, {
2480
- variant: "body2"
2481
- }, description)));
2474
+ }, title)), children));
2482
2475
  }
2483
2476
 
2477
+ var containsText = function containsText(text, searchText) {
2478
+ return text.toLowerCase().indexOf(searchText.toLowerCase()) > -1;
2479
+ };
2480
+
2484
2481
  var ListContainer$1 = /*#__PURE__*/styled('div', {
2485
2482
  height: '450px',
2486
2483
  display: 'flex',
@@ -2508,28 +2505,29 @@ function BlockchainSelector(props) {
2508
2505
  hasHeader: hasHeader,
2509
2506
  textFieldPlaceholder: "Search Blockchain By Name",
2510
2507
  title: "Select " + type + " Network",
2511
- onBack: onBack,
2512
- Content: function Content(_ref) {
2513
- var searchedFor = _ref.searchedFor;
2514
- var filteredBlockchains = filterBlockchains(list, searchedFor);
2515
- return React__default.createElement(ListContainer$1, {
2516
- style: listContainerStyle
2517
- }, loadingStatus === 'loading' && React__default.createElement("div", null, React__default.createElement(Spinner, {
2518
- size: 24
2519
- })), loadingStatus === 'failed' && React__default.createElement(Alert, {
2520
- type: "error",
2521
- description: "Error connecting server, please reload the app and try again"
2522
- }), loadingStatus === 'success' && React__default.createElement(React__default.Fragment, null, filteredBlockchains.length > 0 ? React__default.createElement(BlockchainsList, {
2523
- list: filteredBlockchains,
2524
- selected: selected,
2525
- multiSelect: multiSelect,
2526
- selectedList: selectedList,
2527
- onChange: onChange
2528
- }) : React__default.createElement(Alert, {
2529
- type: "secondary",
2530
- description: searchedFor + " not found"
2531
- })));
2532
- }
2508
+ onBack: onBack
2509
+ }, function (searchedFor) {
2510
+ var filteredBlockchains = filterBlockchains(list, searchedFor);
2511
+ return React__default.createElement(ListContainer$1, {
2512
+ style: listContainerStyle,
2513
+ key: "1"
2514
+ }, loadingStatus === 'loading' && React__default.createElement("div", null, React__default.createElement(Spinner, {
2515
+ size: 24
2516
+ })), loadingStatus === 'failed' && React__default.createElement(Alert, {
2517
+ type: "error"
2518
+ }, React__default.createElement(Typography, {
2519
+ variant: "body2"
2520
+ }, "Error connecting server, please reload the app and try again")), loadingStatus === 'success' && React__default.createElement(React__default.Fragment, null, filteredBlockchains.length > 0 ? React__default.createElement(BlockchainsList, {
2521
+ list: filteredBlockchains,
2522
+ selected: selected,
2523
+ multiSelect: multiSelect,
2524
+ selectedList: selectedList,
2525
+ onChange: onChange
2526
+ }) : React__default.createElement(Alert, {
2527
+ type: "secondary"
2528
+ }, React__default.createElement(Typography, {
2529
+ variant: "body2"
2530
+ }, searchedFor + " not found"))));
2533
2531
  });
2534
2532
  }
2535
2533
 
@@ -2851,6 +2849,7 @@ var StyledSwitchRoot = /*#__PURE__*/styled(RadixSwitch.Root, {
2851
2849
  borderColor: '$neutrals400',
2852
2850
  borderRadius: '99999px',
2853
2851
  position: 'relative',
2852
+ padding: '0',
2854
2853
  cursor: 'pointer',
2855
2854
  '&[data-state="checked"]': {
2856
2855
  backgroundColor: '$primary100'
@@ -2894,6 +2893,7 @@ var groupLiquiditySources = function groupLiquiditySources(liquiditySources) {
2894
2893
  };
2895
2894
  var LiquiditySourceType = /*#__PURE__*/styled(Typography, {
2896
2895
  position: 'sticky',
2896
+ display: 'block',
2897
2897
  top: '0',
2898
2898
  marginTop: '$8',
2899
2899
  marginBottom: '$8',
@@ -2924,15 +2924,18 @@ function LiquiditySourceList(props) {
2924
2924
  return item.title != clickedItem.title;
2925
2925
  });
2926
2926
  });
2927
- setTimeout(function () {
2928
- onChange(clickedItem);
2929
- }, 200);
2927
+ onChange(clickedItem);
2930
2928
  };
2931
2929
  var isSelected = function isSelected(liquiditySource) {
2932
2930
  return !!selected.find(function (item) {
2933
2931
  return liquiditySource.title === item.title;
2934
2932
  });
2935
2933
  };
2934
+ React.useEffect(function () {
2935
+ setSelected(list.filter(function (item) {
2936
+ return item.selected;
2937
+ }));
2938
+ }, [list]);
2936
2939
  return React__default.createElement("div", {
2937
2940
  style: _extends({
2938
2941
  height: '450px'
@@ -3015,15 +3018,13 @@ function LiquiditySourcesSelector(props) {
3015
3018
  return item.selected;
3016
3019
  }) ? 'Clear all' : 'Select all'),
3017
3020
  hasHeader: hasHeader,
3018
- onBack: onBack,
3019
- Content: function Content(_ref) {
3020
- var searchedFor = _ref.searchedFor;
3021
- return React__default.createElement(LiquiditySourceList, {
3022
- listContainerStyle: listContainerStyle,
3023
- list: filterLiquiditySources(list, searchedFor),
3024
- onChange: onChange
3025
- });
3026
- }
3021
+ onBack: onBack
3022
+ }, function (searchedFor) {
3023
+ return React__default.createElement(LiquiditySourceList, {
3024
+ listContainerStyle: listContainerStyle,
3025
+ list: filterLiquiditySources(list, searchedFor),
3026
+ onChange: onChange
3027
+ });
3027
3028
  });
3028
3029
  }
3029
3030
 
@@ -3154,6 +3155,7 @@ var ItemContainer = /*#__PURE__*/styled('div', {
3154
3155
  marginRight: '$8'
3155
3156
  });
3156
3157
  var StyledItem = /*#__PURE__*/styled(RadioGroup.Item, {
3158
+ padding: '0',
3157
3159
  backgroundColor: '$neutrals300',
3158
3160
  width: '20px',
3159
3161
  height: '20px',
@@ -3217,10 +3219,13 @@ var BaseContainer = /*#__PURE__*/styled('div', {
3217
3219
  backgroundColor: '$neutrals200',
3218
3220
  padding: '$16'
3219
3221
  });
3222
+ var Title = /*#__PURE__*/styled(Typography, {
3223
+ marginBottom: '$16'
3224
+ });
3220
3225
  var SlippageChipsContainer = /*#__PURE__*/styled('div', {
3221
- display: 'flex',
3222
- flexWrap: 'wrap',
3223
- marginTop: '$16'
3226
+ display: 'grid',
3227
+ rowGap: '$16',
3228
+ gridTemplateColumns: 'repeat(auto-fill, 64px)'
3224
3229
  });
3225
3230
  var LiquiditySourceContainer = /*#__PURE__*/styled(BaseContainer, {
3226
3231
  display: 'flex',
@@ -3229,7 +3234,7 @@ var LiquiditySourceContainer = /*#__PURE__*/styled(BaseContainer, {
3229
3234
  cursor: 'pointer'
3230
3235
  });
3231
3236
  var StyledAngleRight = /*#__PURE__*/styled(AngleRightIcon, {
3232
- marginLeft: '8px'
3237
+ marginLeft: '$8'
3233
3238
  });
3234
3239
  var LiquiditySourceNumber = /*#__PURE__*/styled('div', {
3235
3240
  display: 'flex',
@@ -3259,7 +3264,7 @@ function Settings(props) {
3259
3264
  setSelectedSlippage(slippage);
3260
3265
  onSlippageChange(slippage);
3261
3266
  };
3262
- var PageContent = React__default.createElement(React__default.Fragment, null, React__default.createElement(BaseContainer, null, React__default.createElement(Typography, {
3267
+ var PageContent = React__default.createElement(React__default.Fragment, null, React__default.createElement(BaseContainer, null, React__default.createElement(Title, {
3263
3268
  variant: "body1"
3264
3269
  }, "Slippage tolerance per swap"), React__default.createElement(SlippageChipsContainer, null, slippages.map(function (slippage, index) {
3265
3270
  return React__default.createElement(Chip, {
@@ -3291,7 +3296,7 @@ function Settings(props) {
3291
3296
  flexGrow: 'initial',
3292
3297
  borderColor: customSlippage ? '$success' : 'initial'
3293
3298
  }
3294
- }))), React__default.createElement(ThemesContainer, null, React__default.createElement(Typography, {
3299
+ }))), React__default.createElement(ThemesContainer, null, React__default.createElement(Title, {
3295
3300
  variant: "body2"
3296
3301
  }, "Theme"), React__default.createElement(Radio, {
3297
3302
  defaultValue: selectedTheme,
@@ -3316,17 +3321,14 @@ function Settings(props) {
3316
3321
  onClick: onLiquiditySourcesClick
3317
3322
  }, React__default.createElement(Typography, {
3318
3323
  variant: "body1"
3319
- }, "Liquidity Sources"), React__default.createElement(LiquiditySourceNumber, {
3320
- onClick: onLiquiditySourcesClick
3321
- }, React__default.createElement(Typography, {
3324
+ }, "Liquidity Sources"), React__default.createElement(LiquiditySourceNumber, null, React__default.createElement(Typography, {
3322
3325
  variant: "body2"
3323
3326
  }, "( " + selectedLiquiditySources.length + " / " + liquiditySources.length + " )"), React__default.createElement(StyledAngleRight, null))));
3324
3327
  return React__default.createElement(SecondaryPage, {
3325
3328
  title: "Settings",
3326
3329
  textField: false,
3327
- Content: PageContent,
3328
3330
  onBack: onBack
3329
- });
3331
+ }, PageContent);
3330
3332
  }
3331
3333
 
3332
3334
  var MainContainer$1 = /*#__PURE__*/styled('div', {
@@ -3340,7 +3342,8 @@ var MainContainer$1 = /*#__PURE__*/styled('div', {
3340
3342
  display: 'flex',
3341
3343
  flexDirection: 'column',
3342
3344
  alignItems: 'end',
3343
- padding: '$16 $24'
3345
+ padding: '$16 $24',
3346
+ boxSizing: 'border-box'
3344
3347
  });
3345
3348
  var ContentContainer$3 = /*#__PURE__*/styled('div', {
3346
3349
  width: '100%'
@@ -3659,18 +3662,16 @@ function TokenSelector(props) {
3659
3662
  textFieldPlaceholder: "Search Blockchain By Name",
3660
3663
  title: "Select " + type + " Token",
3661
3664
  hasHeader: hasHeader,
3662
- onBack: onBack,
3663
- Content: function Content(_ref) {
3664
- var searchedFor = _ref.searchedFor;
3665
- return React__default.createElement(TokenList, {
3666
- searchedText: searchedFor,
3667
- list: list,
3668
- selected: selected,
3669
- selectedList: selectedList,
3670
- multiSelect: multiSelect,
3671
- onChange: onChange
3672
- });
3673
- }
3665
+ onBack: onBack
3666
+ }, function (searchedFor) {
3667
+ return React__default.createElement(TokenList, {
3668
+ searchedText: searchedFor,
3669
+ list: list,
3670
+ selected: selected,
3671
+ selectedList: selectedList,
3672
+ multiSelect: multiSelect,
3673
+ onChange: onChange
3674
+ });
3674
3675
  });
3675
3676
  }
3676
3677
 
@@ -3841,6 +3842,9 @@ function ColorPicker(_ref) {
3841
3842
  })));
3842
3843
  }
3843
3844
 
3845
+ var MainContainer$2 = /*#__PURE__*/styled('div', {
3846
+ overflow: 'hidden'
3847
+ });
3844
3848
  var Line$2 = /*#__PURE__*/styled('div', {
3845
3849
  width: '0',
3846
3850
  marginLeft: '$12',
@@ -3883,17 +3887,31 @@ var ArrowDown = /*#__PURE__*/styled('div', {
3883
3887
  borderTop: '5px solid $foreground',
3884
3888
  marginLeft: '$8'
3885
3889
  });
3890
+ var UpdateIcon = /*#__PURE__*/styled(RetryIcon, {
3891
+ position: 'absolute',
3892
+ right: '0'
3893
+ });
3894
+ var StyledUpdateIcon = /*#__PURE__*/styled(UpdateIcon, {
3895
+ cursor: 'pointer'
3896
+ });
3897
+ var BestRouteContainer$1 = /*#__PURE__*/styled('div', {
3898
+ overflow: 'auto'
3899
+ });
3886
3900
  var Alerts = /*#__PURE__*/styled('div', {
3887
3901
  paddingBottom: '$16'
3888
3902
  });
3889
- function ConfirmSwap(_ref) {
3903
+ function ConfirmSwap(props) {
3890
3904
  var _bestRoute$result;
3891
- var bestRoute = _ref.bestRoute,
3892
- onBack = _ref.onBack,
3893
- onConfirm = _ref.onConfirm,
3894
- loading = _ref.loading,
3895
- error = _ref.error,
3896
- warning = _ref.warning;
3905
+ var bestRoute = props.bestRoute,
3906
+ onRefresh = props.onRefresh,
3907
+ onBack = props.onBack,
3908
+ onConfirm = props.onConfirm,
3909
+ loading = props.loading,
3910
+ errors = props.errors,
3911
+ warnings = props.warnings,
3912
+ extraMessages = props.extraMessages,
3913
+ confirmButtonTitle = props.confirmButtonTitle,
3914
+ confirmButtonDisabled = props.confirmButtonDisabled;
3897
3915
  return React__default.createElement(SecondaryPage, {
3898
3916
  textField: false,
3899
3917
  title: "Swap",
@@ -3903,42 +3921,50 @@ function ConfirmSwap(_ref) {
3903
3921
  fullWidth: true,
3904
3922
  loading: loading,
3905
3923
  variant: "contained",
3906
- onClick: onConfirm
3907
- }, "Swap")),
3908
- Content: bestRoute == null ? void 0 : (_bestRoute$result = bestRoute.result) == null ? void 0 : _bestRoute$result.swaps.map(function (swap, index) {
3909
- var _bestRoute$result2;
3910
- return React__default.createElement(React.Fragment, {
3911
- key: index
3912
- }, React__default.createElement(Alerts, null, error && React__default.createElement(Alert, {
3913
- description: error,
3914
- type: "error"
3915
- }), warning && React__default.createElement(Alert, {
3916
- description: warning,
3917
- type: "warning"
3918
- })), index === 0 && React__default.createElement(RelativeContainer$1, null, React__default.createElement(StepDetail, {
3919
- logo: swap.from.logo,
3920
- symbol: swap.from.symbol,
3921
- chainLogo: swap.from.blockchainLogo,
3922
- blockchain: swap.from.blockchain,
3923
- amount: swap.fromAmount
3924
- }), React__default.createElement(Dot$2, null)), React__default.createElement(Line$2, null), React__default.createElement(SwapperContainer$1, null, React__default.createElement(SwapperLogo$1, {
3925
- src: swap.swapperLogo,
3926
- alt: swap.swapperId
3927
- }), React__default.createElement("div", null, React__default.createElement(Typography, {
3928
- ml: 4,
3929
- variant: "caption"
3930
- }, swap.swapperType, " from ", swap.from.symbol, " to ", swap.to.symbol, ' ', "via ", swap.swapperId, ' '), React__default.createElement(Fee, null, React__default.createElement(GasIcon, null), React__default.createElement(Typography, {
3931
- ml: 4,
3932
- variant: "caption"
3933
- }, parseFloat(swap.fee[0].amount).toFixed(6), " estimated gas fee")))), React__default.createElement(Line$2, null), index + 1 === ((_bestRoute$result2 = bestRoute.result) == null ? void 0 : _bestRoute$result2.swaps.length) && React__default.createElement(ArrowDown, null), React__default.createElement(StepDetail, {
3934
- logo: swap.to.logo,
3935
- symbol: swap.to.symbol,
3936
- chainLogo: swap.to.blockchainLogo,
3937
- blockchain: swap.to.blockchain,
3938
- amount: swap.toAmount
3939
- }));
3924
+ onClick: onConfirm,
3925
+ disabled: confirmButtonDisabled
3926
+ }, confirmButtonTitle)),
3927
+ TopButton: React__default.createElement(StyledUpdateIcon, {
3928
+ size: 24,
3929
+ onClick: onRefresh
3940
3930
  })
3941
- });
3931
+ }, React__default.createElement(MainContainer$2, null, React__default.createElement("div", null, extraMessages || null, React__default.createElement(Alerts, null, errors == null ? void 0 : errors.map(function (error, index) {
3932
+ return React__default.createElement(Alert, {
3933
+ type: "error",
3934
+ key: index
3935
+ }, error);
3936
+ }), warnings == null ? void 0 : warnings.map(function (warning, index) {
3937
+ return React__default.createElement(Alert, {
3938
+ type: "warning",
3939
+ key: index
3940
+ }, warning);
3941
+ }))), React__default.createElement(BestRouteContainer$1, null, bestRoute == null ? void 0 : (_bestRoute$result = bestRoute.result) == null ? void 0 : _bestRoute$result.swaps.map(function (swap, index) {
3942
+ var _bestRoute$result2;
3943
+ return React__default.createElement(React.Fragment, {
3944
+ key: index
3945
+ }, index === 0 && React__default.createElement(RelativeContainer$1, null, React__default.createElement(StepDetail, {
3946
+ logo: swap.from.logo,
3947
+ symbol: swap.from.symbol,
3948
+ chainLogo: swap.from.blockchainLogo,
3949
+ blockchain: swap.from.blockchain,
3950
+ amount: swap.fromAmount
3951
+ }), React__default.createElement(Dot$2, null)), React__default.createElement(Line$2, null), React__default.createElement(SwapperContainer$1, null, React__default.createElement(SwapperLogo$1, {
3952
+ src: swap.swapperLogo,
3953
+ alt: swap.swapperId
3954
+ }), React__default.createElement("div", null, React__default.createElement(Typography, {
3955
+ ml: 4,
3956
+ variant: "caption"
3957
+ }, swap.swapperType, " from ", swap.from.symbol, " to", ' ', swap.to.symbol, " via ", swap.swapperId, ' '), React__default.createElement(Fee, null, React__default.createElement(GasIcon, null), React__default.createElement(Typography, {
3958
+ ml: 4,
3959
+ variant: "caption"
3960
+ }, parseFloat(swap.fee[0].amount).toFixed(6), " estimated gas fee")))), React__default.createElement(Line$2, null), index + 1 === ((_bestRoute$result2 = bestRoute.result) == null ? void 0 : _bestRoute$result2.swaps.length) && React__default.createElement(ArrowDown, null), React__default.createElement(StepDetail, {
3961
+ logo: swap.to.logo,
3962
+ symbol: swap.to.symbol,
3963
+ chainLogo: swap.to.blockchainLogo,
3964
+ blockchain: swap.to.blockchain,
3965
+ amount: swap.toAmount
3966
+ }));
3967
+ }))));
3942
3968
  }
3943
3969
 
3944
3970
  var Footer$1 = /*#__PURE__*/styled('div', {
@@ -3948,63 +3974,66 @@ var Footer$1 = /*#__PURE__*/styled('div', {
3948
3974
  var AlertContainer = /*#__PURE__*/styled('div', {
3949
3975
  padding: '$16 0'
3950
3976
  });
3951
- function ConfirmWallets(_ref) {
3977
+ var ConfirmButton = /*#__PURE__*/styled(Button, {
3978
+ marginTop: '$16'
3979
+ });
3980
+ function ConfirmWallets(props) {
3952
3981
  var _swap$result, _swap$result2, _swap$result3;
3953
- var onBack = _ref.onBack,
3954
- loading = _ref.loading,
3955
- onConfirm = _ref.onConfirm,
3956
- swap = _ref.swap,
3957
- requiredWallets = _ref.requiredWallets,
3958
- selectableWallets = _ref.selectableWallets,
3959
- onChange = _ref.onChange,
3960
- confirmDisabled = _ref.confirmDisabled,
3961
- isExperimentalChain = _ref.isExperimentalChain,
3962
- handleConnectChain = _ref.handleConnectChain;
3982
+ var onBack = props.onBack,
3983
+ loading = props.loading,
3984
+ onConfirm = props.onConfirm,
3985
+ swap = props.swap,
3986
+ requiredWallets = props.requiredWallets,
3987
+ selectableWallets = props.selectableWallets,
3988
+ onChange = props.onChange,
3989
+ confirmDisabled = props.confirmDisabled,
3990
+ isExperimentalChain = props.isExperimentalChain,
3991
+ handleConnectChain = props.handleConnectChain,
3992
+ fromAmount = props.fromAmount,
3993
+ toAmount = props.toAmount;
3963
3994
  var firstStep = (_swap$result = swap.result) == null ? void 0 : _swap$result.swaps[0];
3964
3995
  var lastStep = (_swap$result2 = swap.result) == null ? void 0 : _swap$result2.swaps[((_swap$result3 = swap.result) == null ? void 0 : _swap$result3.swaps.length) - 1];
3965
- var fromAmount = decimalNumber(firstStep == null ? void 0 : firstStep.fromAmount, 3);
3966
- var toAmount = decimalNumber(lastStep == null ? void 0 : lastStep.toAmount, 3);
3967
3996
  return React__default.createElement(SecondaryPage, {
3968
3997
  textField: false,
3969
3998
  title: "Confirm Swap",
3970
3999
  onBack: onBack,
3971
- Footer: React__default.createElement(Footer$1, null, React__default.createElement(Button, {
4000
+ Footer: React__default.createElement(Footer$1, null, React__default.createElement(ConfirmButton, {
3972
4001
  fullWidth: true,
3973
4002
  loading: loading,
3974
4003
  type: "primary",
3975
4004
  variant: "contained",
3976
4005
  onClick: onConfirm,
3977
4006
  disabled: confirmDisabled
3978
- }, "Confirm")),
3979
- Content: React__default.createElement(React__default.Fragment, null, React__default.createElement(Typography, {
3980
- variant: "h6",
3981
- mb: 12
3982
- }, "Confirm swap ", fromAmount, " ", lastStep == null ? void 0 : lastStep.from.symbol, " (", firstStep == null ? void 0 : firstStep.from.blockchain, ") to ", toAmount, " ", lastStep == null ? void 0 : lastStep.to.symbol, ' ', "(on ", lastStep == null ? void 0 : lastStep.to.blockchain, ")"), requiredWallets.map(function (wallet, index) {
3983
- var list = selectableWallets.filter(function (w) {
3984
- return wallet === w.chain;
3985
- });
3986
- return React__default.createElement("div", {
3987
- key: index
3988
- }, React__default.createElement(Typography, {
3989
- variant: "body2",
3990
- mb: 12,
3991
- mt: 12
3992
- }, index + 1, ") Your ", wallet, " Wallet"), list.length === 0 && React__default.createElement(React__default.Fragment, null, React__default.createElement(AlertContainer, null, React__default.createElement(Alert, {
3993
- type: "error",
3994
- description: "You should connect a " + wallet + " supported wallet"
3995
- })), (isExperimentalChain == null ? void 0 : isExperimentalChain(wallet)) && React__default.createElement(Button, {
3996
- variant: "contained",
3997
- type: "primary",
3998
- align: "grow",
3999
- onClick: function onClick() {
4000
- return handleConnectChain == null ? void 0 : handleConnectChain(wallet);
4001
- }
4002
- }, "Add " + wallet + " chain to Cosmos wallets")), list.length != 0 && React__default.createElement(SelectableWalletList, {
4003
- list: list,
4004
- onChange: onChange
4005
- }));
4006
- }))
4007
- });
4007
+ }, "Confirm"))
4008
+ }, React__default.createElement(React__default.Fragment, null, React__default.createElement(Typography, {
4009
+ variant: "h6",
4010
+ mb: 12
4011
+ }, "Confirm swap ", fromAmount, " ", firstStep == null ? void 0 : firstStep.from.symbol, " (", firstStep == null ? void 0 : firstStep.from.blockchain, ") to ", toAmount, " ", lastStep == null ? void 0 : lastStep.to.symbol, " (on", lastStep == null ? void 0 : lastStep.to.blockchain, ")"), requiredWallets.map(function (wallet, index) {
4012
+ var list = selectableWallets.filter(function (w) {
4013
+ return wallet === w.chain;
4014
+ });
4015
+ return React__default.createElement("div", {
4016
+ key: index
4017
+ }, React__default.createElement(Typography, {
4018
+ variant: "body2",
4019
+ mb: 12,
4020
+ mt: 12
4021
+ }, index + 1, ") Your ", wallet, " Wallet"), list.length === 0 && React__default.createElement(React__default.Fragment, null, React__default.createElement(AlertContainer, null, React__default.createElement(Alert, {
4022
+ type: "error"
4023
+ }, React__default.createElement(Typography, {
4024
+ variant: "body2"
4025
+ }, "You should connect a " + wallet + " supported wallet"))), (isExperimentalChain == null ? void 0 : isExperimentalChain(wallet)) && React__default.createElement(Button, {
4026
+ variant: "contained",
4027
+ type: "primary",
4028
+ align: "grow",
4029
+ onClick: function onClick() {
4030
+ return handleConnectChain == null ? void 0 : handleConnectChain(wallet);
4031
+ }
4032
+ }, "Add " + wallet + " chain to Cosmos wallets")), list.length != 0 && React__default.createElement(SelectableWalletList, {
4033
+ list: list,
4034
+ onChange: onChange
4035
+ }));
4036
+ })));
4008
4037
  }
4009
4038
 
4010
4039
  function groupingOfSwaps(list) {
@@ -4075,17 +4104,15 @@ function History(_ref) {
4075
4104
  onBack: onBack,
4076
4105
  textField: true,
4077
4106
  textFieldPlaceholder: "Search By Blockchain Or Token",
4078
- title: "History",
4079
- Content: function Content(_ref2) {
4080
- var searchedFor = _ref2.searchedFor;
4081
- var filterSwaps = filteredHistory(list, searchedFor);
4082
- return filterSwaps.length ? React__default.createElement(SwapsGroup, {
4083
- list: filterSwaps,
4084
- onSwapClick: onSwapClick
4085
- }) : React__default.createElement(BodyError, null, React__default.createElement(ErrorMsg$1, {
4086
- variant: "caption"
4087
- }, "Not Found"));
4088
- }
4107
+ title: "History"
4108
+ }, function (searchedFor) {
4109
+ var filterSwaps = filteredHistory(list, searchedFor);
4110
+ return filterSwaps.length ? React__default.createElement(SwapsGroup, {
4111
+ list: filterSwaps,
4112
+ onSwapClick: onSwapClick
4113
+ }) : React__default.createElement(BodyError, null, React__default.createElement(ErrorMsg$1, {
4114
+ variant: "caption"
4115
+ }, "Not Found"));
4089
4116
  });
4090
4117
  }
4091
4118
 
@@ -4124,55 +4151,54 @@ function SwapHistory(props) {
4124
4151
  return React__default.createElement(SecondaryPage, {
4125
4152
  title: "History",
4126
4153
  textField: false,
4127
- onBack: onBack,
4128
- Content: React__default.createElement(React__default.Fragment, null, pendingSwap == null ? void 0 : pendingSwap.steps.map(function (step, index) {
4129
- return React__default.createElement(React.Fragment, {
4154
+ onBack: onBack
4155
+ }, React__default.createElement(React__default.Fragment, null, pendingSwap == null ? void 0 : pendingSwap.steps.map(function (step, index) {
4156
+ return React__default.createElement(React.Fragment, {
4157
+ key: index
4158
+ }, index === 0 && React__default.createElement(RelativeContainer$1, null, React__default.createElement(StepDetail, {
4159
+ logo: step.fromLogo,
4160
+ symbol: step.fromSymbol,
4161
+ chainLogo: step.fromBlockchainLogo,
4162
+ blockchain: step.fromBlockchain,
4163
+ amount: pendingSwap.inputAmount
4164
+ }), React__default.createElement(Dot$2, null)), React__default.createElement(Line$3, null), React__default.createElement(SwapperContainer$1, null, React__default.createElement(SwapperLogo$1, {
4165
+ src: step.swapperLogo,
4166
+ alt: step.swapperId
4167
+ }), React__default.createElement("div", null, React__default.createElement(Typography, {
4168
+ ml: 4,
4169
+ variant: "caption"
4170
+ }, step.swapperType, " from ", step.fromSymbol, " to ", step.toSymbol, "via ", step.swapperId), React__default.createElement(Fee, null, React__default.createElement(GasIcon, null), React__default.createElement(Typography, {
4171
+ ml: 4,
4172
+ variant: "caption"
4173
+ }, step.feeInUsd, " estimated gas fee")))), React__default.createElement("div", {
4174
+ style: {
4175
+ display: 'flex'
4176
+ }
4177
+ }, React__default.createElement(InternalDetailsContainer, null, React__default.createElement(Line$3, null), !!step.explorerUrl && React__default.createElement("div", null, step.explorerUrl.map(function (item, index) {
4178
+ return React__default.createElement(InternalDetail, {
4130
4179
  key: index
4131
- }, index === 0 && React__default.createElement(RelativeContainer$1, null, React__default.createElement(StepDetail, {
4132
- logo: step.fromLogo,
4133
- symbol: step.fromSymbol,
4134
- chainLogo: step.fromBlockchainLogo,
4135
- blockchain: step.fromBlockchain,
4136
- amount: pendingSwap.inputAmount
4137
- }), React__default.createElement(Dot$2, null)), React__default.createElement(Line$3, null), React__default.createElement(SwapperContainer$1, null, React__default.createElement(SwapperLogo$1, {
4138
- src: step.swapperLogo,
4139
- alt: step.swapperId
4140
- }), React__default.createElement("div", null, React__default.createElement(Typography, {
4141
- ml: 4,
4142
- variant: "caption"
4143
- }, step.swapperType, " from ", step.fromSymbol, " to ", step.toSymbol, "via ", step.swapperId), React__default.createElement(Fee, null, React__default.createElement(GasIcon, null), React__default.createElement(Typography, {
4144
- ml: 4,
4145
- variant: "caption"
4146
- }, "fee")))), React__default.createElement("div", {
4147
- style: {
4148
- display: 'flex'
4149
- }
4150
- }, React__default.createElement(InternalDetailsContainer, null, React__default.createElement(Line$3, null), !!step.explorerUrl && React__default.createElement("div", null, step.explorerUrl.map(function (item, index) {
4151
- return React__default.createElement(InternalDetail, {
4152
- key: index
4153
- }, React__default.createElement(DescriptionContainer, null, React__default.createElement(CheckCircleIcon, {
4154
- color: "success"
4155
- }), React__default.createElement(Description, {
4156
- variant: "body2"
4157
- }, !item.description ? React__default.createElement("b", null, "View transaction") : React__default.createElement("b", null, item.description.substring(0, 1).toUpperCase(), item.description.substring(1)))), React__default.createElement(StyledAnchor, {
4158
- href: item.url,
4159
- target: "_blank",
4160
- rel: "noreferrer",
4161
- key: index
4162
- }, "TX-Link"));
4163
- }), step.status === 'failed' && React__default.createElement(InternalDetail, null, React__default.createElement(DescriptionContainer, null, React__default.createElement(InfoCircleIcon, {
4164
- color: "error"
4165
- }), React__default.createElement(Error, {
4180
+ }, React__default.createElement(DescriptionContainer, null, React__default.createElement(CheckCircleIcon, {
4181
+ color: "success"
4182
+ }), React__default.createElement(Description, {
4166
4183
  variant: "body2"
4167
- }, "Step failed")))))), index + 1 === pendingSwap.steps.length && React__default.createElement(ArrowDown, null), React__default.createElement(StepDetail, {
4168
- logo: step.toLogo,
4169
- symbol: step.toSymbol,
4170
- chainLogo: step.toBlockchainLogo,
4171
- blockchain: step.toBlockchain,
4172
- amount: step.outputAmount
4173
- }));
4174
- }))
4175
- });
4184
+ }, !item.description ? React__default.createElement("b", null, "View transaction") : React__default.createElement("b", null, item.description.substring(0, 1).toUpperCase(), item.description.substring(1)))), React__default.createElement(StyledAnchor, {
4185
+ href: item.url,
4186
+ target: "_blank",
4187
+ rel: "noreferrer",
4188
+ key: index
4189
+ }, "TX-Link"));
4190
+ }), step.status === 'failed' && React__default.createElement(InternalDetail, null, React__default.createElement(DescriptionContainer, null, React__default.createElement(InfoCircleIcon, {
4191
+ color: "error"
4192
+ }), React__default.createElement(Error, {
4193
+ variant: "body2"
4194
+ }, "Step failed")))))), index + 1 === pendingSwap.steps.length && React__default.createElement(ArrowDown, null), React__default.createElement(StepDetail, {
4195
+ logo: step.toLogo,
4196
+ symbol: step.toSymbol,
4197
+ chainLogo: step.toBlockchainLogo,
4198
+ blockchain: step.toBlockchain,
4199
+ amount: step.outputAmount
4200
+ }));
4201
+ })));
4176
4202
  }
4177
4203
 
4178
4204
  exports.AddCircleIcon = AddCircleIcon;