@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
package/dist/ui.esm.js CHANGED
@@ -1540,39 +1540,6 @@ function StepDetail(_ref) {
1540
1540
  }, "on ", blockchain)));
1541
1541
  }
1542
1542
 
1543
- var secondsToString = function secondsToString(s) {
1544
- var minutes = parseInt((s / 60).toString()).toString();
1545
- return "" + minutes;
1546
- };
1547
- var totalArrivalTime = function totalArrivalTime(data) {
1548
- var _data$result, _data$result$swaps;
1549
- 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) {
1550
- return a + b.estimatedTimeInSeconds;
1551
- }, 0)) || 0;
1552
- };
1553
- var rawFees = function rawFees(data) {
1554
- var _data$result2, _data$result2$swaps;
1555
- 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) {
1556
- return s.fee.map(function (f) {
1557
- return {
1558
- swapperId: s.swapperId,
1559
- fee: f
1560
- };
1561
- });
1562
- })) || []).reduce(function (partialSum, a) {
1563
- return partialSum + parseFloat(a.fee.amount);
1564
- }, 0).toFixed(3);
1565
- };
1566
- var decimalNumber = function decimalNumber(number, toFixed) {
1567
- if (number === void 0) {
1568
- number = '0';
1569
- }
1570
- return parseFloat(number).toFixed(toFixed);
1571
- };
1572
- var containsText = function containsText(text, searchText) {
1573
- return text.toLowerCase().includes(searchText.toLowerCase());
1574
- };
1575
-
1576
1543
  var waveSquares = /*#__PURE__*/keyframes({
1577
1544
  '0%': {
1578
1545
  backgroundPosition: '-468px 0'
@@ -1765,6 +1732,17 @@ var ArrowRight = /*#__PURE__*/styled('div', {
1765
1732
  borderBottom: '5px solid transparent',
1766
1733
  borderLeft: '5px solid $foreground'
1767
1734
  });
1735
+ var pulse = /*#__PURE__*/keyframes({
1736
+ '0%': {
1737
+ opacity: 1
1738
+ },
1739
+ '50%': {
1740
+ opacity: 0.3
1741
+ },
1742
+ '100%': {
1743
+ opacity: 1
1744
+ }
1745
+ });
1768
1746
  var GasContainer = /*#__PURE__*/styled('div', {
1769
1747
  backgroundColor: '$neutrals300',
1770
1748
  borderRadius: '5px',
@@ -1779,6 +1757,27 @@ var GasContainer = /*#__PURE__*/styled('div', {
1779
1757
  margin: '$8'
1780
1758
  }
1781
1759
  });
1760
+ var FeeContainer = /*#__PURE__*/styled('div', {
1761
+ display: 'flex',
1762
+ flexDirection: 'column',
1763
+ alignItems: 'center',
1764
+ variants: {
1765
+ warning: {
1766
+ "true": {
1767
+ animation: pulse + " 2s ease-in-out infinite"
1768
+ }
1769
+ }
1770
+ }
1771
+ });
1772
+ var TotalFee = /*#__PURE__*/styled(Typography, {
1773
+ variants: {
1774
+ warning: {
1775
+ "true": {
1776
+ color: '$warning300'
1777
+ }
1778
+ }
1779
+ }
1780
+ });
1782
1781
  var SkeletonContainer$1 = /*#__PURE__*/styled('div', {
1783
1782
  padding: '$4',
1784
1783
  '@md': {
@@ -1790,33 +1789,34 @@ var SwapperContainer = /*#__PURE__*/styled('div', {
1790
1789
  justifyContent: 'center',
1791
1790
  alignItems: 'center'
1792
1791
  });
1793
- function BestRoute(_ref) {
1792
+ function BestRoute(props) {
1794
1793
  var _data$result;
1795
- var data = _ref.data,
1796
- loading = _ref.loading,
1797
- error = _ref.error;
1798
- var fee,
1799
- time = '';
1800
- if (!!data) {
1801
- fee = rawFees(data);
1802
- time = secondsToString(totalArrivalTime(data));
1803
- }
1794
+ var data = props.data,
1795
+ loading = props.loading,
1796
+ error = props.error,
1797
+ totalFee = props.totalFee,
1798
+ feeWarning = props.feeWarning,
1799
+ totalTime = props.totalTime;
1804
1800
  return React__default.createElement(Container, null, loading ? React__default.createElement(SkeletonContainer$1, null, React__default.createElement(Skeleton, {
1805
1801
  width: 48,
1806
1802
  height: 94
1807
- })) : React__default.createElement(GasContainer, null, React__default.createElement(GasIcon, {
1808
- size: 20
1809
- }), React__default.createElement(Typography, {
1803
+ })) : React__default.createElement(GasContainer, null, React__default.createElement(FeeContainer, {
1804
+ warning: feeWarning
1805
+ }, React__default.createElement(GasIcon, {
1806
+ size: 20,
1807
+ color: feeWarning ? 'warning' : undefined
1808
+ }), React__default.createElement(TotalFee, {
1810
1809
  mt: 4,
1811
1810
  align: "center",
1812
- variant: "caption"
1813
- }, error && '-', !!data && "$" + fee), React__default.createElement(HR, null), React__default.createElement(TimeIcon, {
1811
+ variant: "caption",
1812
+ warning: feeWarning
1813
+ }, error && '-', !!data && "$" + totalFee)), React__default.createElement(HR, null), React__default.createElement(TimeIcon, {
1814
1814
  size: 20
1815
1815
  }), React__default.createElement(Typography, {
1816
1816
  mt: 4,
1817
1817
  align: "center",
1818
1818
  variant: "caption"
1819
- }, error && '-', !!data && "~" + time + "m")), React__default.createElement(BestRouteContainer, null, loading && React__default.createElement(Spinner, {
1819
+ }, error && '-', !!data && "~" + totalTime + "m")), React__default.createElement(BestRouteContainer, null, loading && React__default.createElement(Spinner, {
1820
1820
  color: "primary"
1821
1821
  }), error && React__default.createElement(ErrorMsg, {
1822
1822
  variant: "caption"
@@ -2407,9 +2407,7 @@ function SecondaryPage(props) {
2407
2407
  },
2408
2408
  value: searchedFor,
2409
2409
  autoFocus: true
2410
- })), React__default.createElement(ContentContainer, null, props.textField && React__default.createElement(props.Content, {
2411
- searchedFor: searchedFor
2412
- }), !props.textField && props.Content), Footer);
2410
+ })), React__default.createElement(ContentContainer, null, props.textField && (props.children == null ? void 0 : props.children(searchedFor)), !props.textField && props.children), Footer);
2413
2411
  }
2414
2412
 
2415
2413
  var MainContainer = /*#__PURE__*/styled('div', {
@@ -2438,10 +2436,7 @@ var MainContainer = /*#__PURE__*/styled('div', {
2438
2436
  }
2439
2437
  }
2440
2438
  });
2441
- var ContentContainer$1 = /*#__PURE__*/styled('div', {
2442
- display: 'flex',
2443
- flexDirection: 'column'
2444
- });
2439
+ var ContentContainer$1 = /*#__PURE__*/styled('div', {});
2445
2440
  var TitleContainer = /*#__PURE__*/styled('div', {
2446
2441
  marginBottom: '$8'
2447
2442
  });
@@ -2453,7 +2448,7 @@ var StyledTypography = /*#__PURE__*/styled(Typography, {
2453
2448
  });
2454
2449
  function Alert(props) {
2455
2450
  var type = props.type,
2456
- description = props.description,
2451
+ children = props.children,
2457
2452
  title = props.title;
2458
2453
  var showIcon = ['error', 'success', 'warning'].includes(type);
2459
2454
  return React__default.createElement(MainContainer, {
@@ -2469,11 +2464,13 @@ function Alert(props) {
2469
2464
  size: 28
2470
2465
  })), React__default.createElement(ContentContainer$1, null, title && React__default.createElement(TitleContainer, null, React__default.createElement(StyledTypography, {
2471
2466
  variant: "h6"
2472
- }, title)), React__default.createElement(StyledTypography, {
2473
- variant: "body2"
2474
- }, description)));
2467
+ }, title)), children));
2475
2468
  }
2476
2469
 
2470
+ var containsText = function containsText(text, searchText) {
2471
+ return text.toLowerCase().indexOf(searchText.toLowerCase()) > -1;
2472
+ };
2473
+
2477
2474
  var ListContainer$1 = /*#__PURE__*/styled('div', {
2478
2475
  height: '450px',
2479
2476
  display: 'flex',
@@ -2501,28 +2498,29 @@ function BlockchainSelector(props) {
2501
2498
  hasHeader: hasHeader,
2502
2499
  textFieldPlaceholder: "Search Blockchain By Name",
2503
2500
  title: "Select " + type + " Network",
2504
- onBack: onBack,
2505
- Content: function Content(_ref) {
2506
- var searchedFor = _ref.searchedFor;
2507
- var filteredBlockchains = filterBlockchains(list, searchedFor);
2508
- return React__default.createElement(ListContainer$1, {
2509
- style: listContainerStyle
2510
- }, loadingStatus === 'loading' && React__default.createElement("div", null, React__default.createElement(Spinner, {
2511
- size: 24
2512
- })), loadingStatus === 'failed' && React__default.createElement(Alert, {
2513
- type: "error",
2514
- description: "Error connecting server, please reload the app and try again"
2515
- }), loadingStatus === 'success' && React__default.createElement(React__default.Fragment, null, filteredBlockchains.length > 0 ? React__default.createElement(BlockchainsList, {
2516
- list: filteredBlockchains,
2517
- selected: selected,
2518
- multiSelect: multiSelect,
2519
- selectedList: selectedList,
2520
- onChange: onChange
2521
- }) : React__default.createElement(Alert, {
2522
- type: "secondary",
2523
- description: searchedFor + " not found"
2524
- })));
2525
- }
2501
+ onBack: onBack
2502
+ }, function (searchedFor) {
2503
+ var filteredBlockchains = filterBlockchains(list, searchedFor);
2504
+ return React__default.createElement(ListContainer$1, {
2505
+ style: listContainerStyle,
2506
+ key: "1"
2507
+ }, loadingStatus === 'loading' && React__default.createElement("div", null, React__default.createElement(Spinner, {
2508
+ size: 24
2509
+ })), loadingStatus === 'failed' && React__default.createElement(Alert, {
2510
+ type: "error"
2511
+ }, React__default.createElement(Typography, {
2512
+ variant: "body2"
2513
+ }, "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, {
2514
+ list: filteredBlockchains,
2515
+ selected: selected,
2516
+ multiSelect: multiSelect,
2517
+ selectedList: selectedList,
2518
+ onChange: onChange
2519
+ }) : React__default.createElement(Alert, {
2520
+ type: "secondary"
2521
+ }, React__default.createElement(Typography, {
2522
+ variant: "body2"
2523
+ }, searchedFor + " not found"))));
2526
2524
  });
2527
2525
  }
2528
2526
 
@@ -2845,6 +2843,7 @@ var StyledSwitchRoot = /*#__PURE__*/styled(Root$1, {
2845
2843
  borderColor: '$neutrals400',
2846
2844
  borderRadius: '99999px',
2847
2845
  position: 'relative',
2846
+ padding: '0',
2848
2847
  cursor: 'pointer',
2849
2848
  '&[data-state="checked"]': {
2850
2849
  backgroundColor: '$primary100'
@@ -2888,6 +2887,7 @@ var groupLiquiditySources = function groupLiquiditySources(liquiditySources) {
2888
2887
  };
2889
2888
  var LiquiditySourceType = /*#__PURE__*/styled(Typography, {
2890
2889
  position: 'sticky',
2890
+ display: 'block',
2891
2891
  top: '0',
2892
2892
  marginTop: '$8',
2893
2893
  marginBottom: '$8',
@@ -2918,15 +2918,18 @@ function LiquiditySourceList(props) {
2918
2918
  return item.title != clickedItem.title;
2919
2919
  });
2920
2920
  });
2921
- setTimeout(function () {
2922
- onChange(clickedItem);
2923
- }, 200);
2921
+ onChange(clickedItem);
2924
2922
  };
2925
2923
  var isSelected = function isSelected(liquiditySource) {
2926
2924
  return !!selected.find(function (item) {
2927
2925
  return liquiditySource.title === item.title;
2928
2926
  });
2929
2927
  };
2928
+ useEffect(function () {
2929
+ setSelected(list.filter(function (item) {
2930
+ return item.selected;
2931
+ }));
2932
+ }, [list]);
2930
2933
  return React__default.createElement("div", {
2931
2934
  style: _extends({
2932
2935
  height: '450px'
@@ -3009,15 +3012,13 @@ function LiquiditySourcesSelector(props) {
3009
3012
  return item.selected;
3010
3013
  }) ? 'Clear all' : 'Select all'),
3011
3014
  hasHeader: hasHeader,
3012
- onBack: onBack,
3013
- Content: function Content(_ref) {
3014
- var searchedFor = _ref.searchedFor;
3015
- return React__default.createElement(LiquiditySourceList, {
3016
- listContainerStyle: listContainerStyle,
3017
- list: filterLiquiditySources(list, searchedFor),
3018
- onChange: onChange
3019
- });
3020
- }
3015
+ onBack: onBack
3016
+ }, function (searchedFor) {
3017
+ return React__default.createElement(LiquiditySourceList, {
3018
+ listContainerStyle: listContainerStyle,
3019
+ list: filterLiquiditySources(list, searchedFor),
3020
+ onChange: onChange
3021
+ });
3021
3022
  });
3022
3023
  }
3023
3024
 
@@ -3148,6 +3149,7 @@ var ItemContainer = /*#__PURE__*/styled('div', {
3148
3149
  marginRight: '$8'
3149
3150
  });
3150
3151
  var StyledItem = /*#__PURE__*/styled(Item, {
3152
+ padding: '0',
3151
3153
  backgroundColor: '$neutrals300',
3152
3154
  width: '20px',
3153
3155
  height: '20px',
@@ -3211,10 +3213,13 @@ var BaseContainer = /*#__PURE__*/styled('div', {
3211
3213
  backgroundColor: '$neutrals200',
3212
3214
  padding: '$16'
3213
3215
  });
3216
+ var Title = /*#__PURE__*/styled(Typography, {
3217
+ marginBottom: '$16'
3218
+ });
3214
3219
  var SlippageChipsContainer = /*#__PURE__*/styled('div', {
3215
- display: 'flex',
3216
- flexWrap: 'wrap',
3217
- marginTop: '$16'
3220
+ display: 'grid',
3221
+ rowGap: '$16',
3222
+ gridTemplateColumns: 'repeat(auto-fill, 64px)'
3218
3223
  });
3219
3224
  var LiquiditySourceContainer = /*#__PURE__*/styled(BaseContainer, {
3220
3225
  display: 'flex',
@@ -3223,7 +3228,7 @@ var LiquiditySourceContainer = /*#__PURE__*/styled(BaseContainer, {
3223
3228
  cursor: 'pointer'
3224
3229
  });
3225
3230
  var StyledAngleRight = /*#__PURE__*/styled(AngleRightIcon, {
3226
- marginLeft: '8px'
3231
+ marginLeft: '$8'
3227
3232
  });
3228
3233
  var LiquiditySourceNumber = /*#__PURE__*/styled('div', {
3229
3234
  display: 'flex',
@@ -3253,7 +3258,7 @@ function Settings(props) {
3253
3258
  setSelectedSlippage(slippage);
3254
3259
  onSlippageChange(slippage);
3255
3260
  };
3256
- var PageContent = React__default.createElement(React__default.Fragment, null, React__default.createElement(BaseContainer, null, React__default.createElement(Typography, {
3261
+ var PageContent = React__default.createElement(React__default.Fragment, null, React__default.createElement(BaseContainer, null, React__default.createElement(Title, {
3257
3262
  variant: "body1"
3258
3263
  }, "Slippage tolerance per swap"), React__default.createElement(SlippageChipsContainer, null, slippages.map(function (slippage, index) {
3259
3264
  return React__default.createElement(Chip, {
@@ -3285,7 +3290,7 @@ function Settings(props) {
3285
3290
  flexGrow: 'initial',
3286
3291
  borderColor: customSlippage ? '$success' : 'initial'
3287
3292
  }
3288
- }))), React__default.createElement(ThemesContainer, null, React__default.createElement(Typography, {
3293
+ }))), React__default.createElement(ThemesContainer, null, React__default.createElement(Title, {
3289
3294
  variant: "body2"
3290
3295
  }, "Theme"), React__default.createElement(Radio, {
3291
3296
  defaultValue: selectedTheme,
@@ -3310,17 +3315,14 @@ function Settings(props) {
3310
3315
  onClick: onLiquiditySourcesClick
3311
3316
  }, React__default.createElement(Typography, {
3312
3317
  variant: "body1"
3313
- }, "Liquidity Sources"), React__default.createElement(LiquiditySourceNumber, {
3314
- onClick: onLiquiditySourcesClick
3315
- }, React__default.createElement(Typography, {
3318
+ }, "Liquidity Sources"), React__default.createElement(LiquiditySourceNumber, null, React__default.createElement(Typography, {
3316
3319
  variant: "body2"
3317
3320
  }, "( " + selectedLiquiditySources.length + " / " + liquiditySources.length + " )"), React__default.createElement(StyledAngleRight, null))));
3318
3321
  return React__default.createElement(SecondaryPage, {
3319
3322
  title: "Settings",
3320
3323
  textField: false,
3321
- Content: PageContent,
3322
3324
  onBack: onBack
3323
- });
3325
+ }, PageContent);
3324
3326
  }
3325
3327
 
3326
3328
  var MainContainer$1 = /*#__PURE__*/styled('div', {
@@ -3334,7 +3336,8 @@ var MainContainer$1 = /*#__PURE__*/styled('div', {
3334
3336
  display: 'flex',
3335
3337
  flexDirection: 'column',
3336
3338
  alignItems: 'end',
3337
- padding: '$16 $24'
3339
+ padding: '$16 $24',
3340
+ boxSizing: 'border-box'
3338
3341
  });
3339
3342
  var ContentContainer$3 = /*#__PURE__*/styled('div', {
3340
3343
  width: '100%'
@@ -3653,18 +3656,16 @@ function TokenSelector(props) {
3653
3656
  textFieldPlaceholder: "Search Blockchain By Name",
3654
3657
  title: "Select " + type + " Token",
3655
3658
  hasHeader: hasHeader,
3656
- onBack: onBack,
3657
- Content: function Content(_ref) {
3658
- var searchedFor = _ref.searchedFor;
3659
- return React__default.createElement(TokenList, {
3660
- searchedText: searchedFor,
3661
- list: list,
3662
- selected: selected,
3663
- selectedList: selectedList,
3664
- multiSelect: multiSelect,
3665
- onChange: onChange
3666
- });
3667
- }
3659
+ onBack: onBack
3660
+ }, function (searchedFor) {
3661
+ return React__default.createElement(TokenList, {
3662
+ searchedText: searchedFor,
3663
+ list: list,
3664
+ selected: selected,
3665
+ selectedList: selectedList,
3666
+ multiSelect: multiSelect,
3667
+ onChange: onChange
3668
+ });
3668
3669
  });
3669
3670
  }
3670
3671
 
@@ -3835,6 +3836,9 @@ function ColorPicker(_ref) {
3835
3836
  })));
3836
3837
  }
3837
3838
 
3839
+ var MainContainer$2 = /*#__PURE__*/styled('div', {
3840
+ overflow: 'hidden'
3841
+ });
3838
3842
  var Line$2 = /*#__PURE__*/styled('div', {
3839
3843
  width: '0',
3840
3844
  marginLeft: '$12',
@@ -3877,17 +3881,31 @@ var ArrowDown = /*#__PURE__*/styled('div', {
3877
3881
  borderTop: '5px solid $foreground',
3878
3882
  marginLeft: '$8'
3879
3883
  });
3884
+ var UpdateIcon = /*#__PURE__*/styled(RetryIcon, {
3885
+ position: 'absolute',
3886
+ right: '0'
3887
+ });
3888
+ var StyledUpdateIcon = /*#__PURE__*/styled(UpdateIcon, {
3889
+ cursor: 'pointer'
3890
+ });
3891
+ var BestRouteContainer$1 = /*#__PURE__*/styled('div', {
3892
+ overflow: 'auto'
3893
+ });
3880
3894
  var Alerts = /*#__PURE__*/styled('div', {
3881
3895
  paddingBottom: '$16'
3882
3896
  });
3883
- function ConfirmSwap(_ref) {
3897
+ function ConfirmSwap(props) {
3884
3898
  var _bestRoute$result;
3885
- var bestRoute = _ref.bestRoute,
3886
- onBack = _ref.onBack,
3887
- onConfirm = _ref.onConfirm,
3888
- loading = _ref.loading,
3889
- error = _ref.error,
3890
- warning = _ref.warning;
3899
+ var bestRoute = props.bestRoute,
3900
+ onRefresh = props.onRefresh,
3901
+ onBack = props.onBack,
3902
+ onConfirm = props.onConfirm,
3903
+ loading = props.loading,
3904
+ errors = props.errors,
3905
+ warnings = props.warnings,
3906
+ extraMessages = props.extraMessages,
3907
+ confirmButtonTitle = props.confirmButtonTitle,
3908
+ confirmButtonDisabled = props.confirmButtonDisabled;
3891
3909
  return React__default.createElement(SecondaryPage, {
3892
3910
  textField: false,
3893
3911
  title: "Swap",
@@ -3897,42 +3915,50 @@ function ConfirmSwap(_ref) {
3897
3915
  fullWidth: true,
3898
3916
  loading: loading,
3899
3917
  variant: "contained",
3900
- onClick: onConfirm
3901
- }, "Swap")),
3902
- Content: bestRoute == null ? void 0 : (_bestRoute$result = bestRoute.result) == null ? void 0 : _bestRoute$result.swaps.map(function (swap, index) {
3903
- var _bestRoute$result2;
3904
- return React__default.createElement(Fragment, {
3905
- key: index
3906
- }, React__default.createElement(Alerts, null, error && React__default.createElement(Alert, {
3907
- description: error,
3908
- type: "error"
3909
- }), warning && React__default.createElement(Alert, {
3910
- description: warning,
3911
- type: "warning"
3912
- })), index === 0 && React__default.createElement(RelativeContainer$1, null, React__default.createElement(StepDetail, {
3913
- logo: swap.from.logo,
3914
- symbol: swap.from.symbol,
3915
- chainLogo: swap.from.blockchainLogo,
3916
- blockchain: swap.from.blockchain,
3917
- amount: swap.fromAmount
3918
- }), React__default.createElement(Dot$2, null)), React__default.createElement(Line$2, null), React__default.createElement(SwapperContainer$1, null, React__default.createElement(SwapperLogo$1, {
3919
- src: swap.swapperLogo,
3920
- alt: swap.swapperId
3921
- }), React__default.createElement("div", null, React__default.createElement(Typography, {
3922
- ml: 4,
3923
- variant: "caption"
3924
- }, 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, {
3925
- ml: 4,
3926
- variant: "caption"
3927
- }, 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, {
3928
- logo: swap.to.logo,
3929
- symbol: swap.to.symbol,
3930
- chainLogo: swap.to.blockchainLogo,
3931
- blockchain: swap.to.blockchain,
3932
- amount: swap.toAmount
3933
- }));
3918
+ onClick: onConfirm,
3919
+ disabled: confirmButtonDisabled
3920
+ }, confirmButtonTitle)),
3921
+ TopButton: React__default.createElement(StyledUpdateIcon, {
3922
+ size: 24,
3923
+ onClick: onRefresh
3934
3924
  })
3935
- });
3925
+ }, 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) {
3926
+ return React__default.createElement(Alert, {
3927
+ type: "error",
3928
+ key: index
3929
+ }, error);
3930
+ }), warnings == null ? void 0 : warnings.map(function (warning, index) {
3931
+ return React__default.createElement(Alert, {
3932
+ type: "warning",
3933
+ key: index
3934
+ }, warning);
3935
+ }))), React__default.createElement(BestRouteContainer$1, null, bestRoute == null ? void 0 : (_bestRoute$result = bestRoute.result) == null ? void 0 : _bestRoute$result.swaps.map(function (swap, index) {
3936
+ var _bestRoute$result2;
3937
+ return React__default.createElement(Fragment, {
3938
+ key: index
3939
+ }, index === 0 && React__default.createElement(RelativeContainer$1, null, React__default.createElement(StepDetail, {
3940
+ logo: swap.from.logo,
3941
+ symbol: swap.from.symbol,
3942
+ chainLogo: swap.from.blockchainLogo,
3943
+ blockchain: swap.from.blockchain,
3944
+ amount: swap.fromAmount
3945
+ }), React__default.createElement(Dot$2, null)), React__default.createElement(Line$2, null), React__default.createElement(SwapperContainer$1, null, React__default.createElement(SwapperLogo$1, {
3946
+ src: swap.swapperLogo,
3947
+ alt: swap.swapperId
3948
+ }), React__default.createElement("div", null, React__default.createElement(Typography, {
3949
+ ml: 4,
3950
+ variant: "caption"
3951
+ }, 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, {
3952
+ ml: 4,
3953
+ variant: "caption"
3954
+ }, 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, {
3955
+ logo: swap.to.logo,
3956
+ symbol: swap.to.symbol,
3957
+ chainLogo: swap.to.blockchainLogo,
3958
+ blockchain: swap.to.blockchain,
3959
+ amount: swap.toAmount
3960
+ }));
3961
+ }))));
3936
3962
  }
3937
3963
 
3938
3964
  var Footer$1 = /*#__PURE__*/styled('div', {
@@ -3942,63 +3968,66 @@ var Footer$1 = /*#__PURE__*/styled('div', {
3942
3968
  var AlertContainer = /*#__PURE__*/styled('div', {
3943
3969
  padding: '$16 0'
3944
3970
  });
3945
- function ConfirmWallets(_ref) {
3971
+ var ConfirmButton = /*#__PURE__*/styled(Button, {
3972
+ marginTop: '$16'
3973
+ });
3974
+ function ConfirmWallets(props) {
3946
3975
  var _swap$result, _swap$result2, _swap$result3;
3947
- var onBack = _ref.onBack,
3948
- loading = _ref.loading,
3949
- onConfirm = _ref.onConfirm,
3950
- swap = _ref.swap,
3951
- requiredWallets = _ref.requiredWallets,
3952
- selectableWallets = _ref.selectableWallets,
3953
- onChange = _ref.onChange,
3954
- confirmDisabled = _ref.confirmDisabled,
3955
- isExperimentalChain = _ref.isExperimentalChain,
3956
- handleConnectChain = _ref.handleConnectChain;
3976
+ var onBack = props.onBack,
3977
+ loading = props.loading,
3978
+ onConfirm = props.onConfirm,
3979
+ swap = props.swap,
3980
+ requiredWallets = props.requiredWallets,
3981
+ selectableWallets = props.selectableWallets,
3982
+ onChange = props.onChange,
3983
+ confirmDisabled = props.confirmDisabled,
3984
+ isExperimentalChain = props.isExperimentalChain,
3985
+ handleConnectChain = props.handleConnectChain,
3986
+ fromAmount = props.fromAmount,
3987
+ toAmount = props.toAmount;
3957
3988
  var firstStep = (_swap$result = swap.result) == null ? void 0 : _swap$result.swaps[0];
3958
3989
  var lastStep = (_swap$result2 = swap.result) == null ? void 0 : _swap$result2.swaps[((_swap$result3 = swap.result) == null ? void 0 : _swap$result3.swaps.length) - 1];
3959
- var fromAmount = decimalNumber(firstStep == null ? void 0 : firstStep.fromAmount, 3);
3960
- var toAmount = decimalNumber(lastStep == null ? void 0 : lastStep.toAmount, 3);
3961
3990
  return React__default.createElement(SecondaryPage, {
3962
3991
  textField: false,
3963
3992
  title: "Confirm Swap",
3964
3993
  onBack: onBack,
3965
- Footer: React__default.createElement(Footer$1, null, React__default.createElement(Button, {
3994
+ Footer: React__default.createElement(Footer$1, null, React__default.createElement(ConfirmButton, {
3966
3995
  fullWidth: true,
3967
3996
  loading: loading,
3968
3997
  type: "primary",
3969
3998
  variant: "contained",
3970
3999
  onClick: onConfirm,
3971
4000
  disabled: confirmDisabled
3972
- }, "Confirm")),
3973
- Content: React__default.createElement(React__default.Fragment, null, React__default.createElement(Typography, {
3974
- variant: "h6",
3975
- mb: 12
3976
- }, "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) {
3977
- var list = selectableWallets.filter(function (w) {
3978
- return wallet === w.chain;
3979
- });
3980
- return React__default.createElement("div", {
3981
- key: index
3982
- }, React__default.createElement(Typography, {
3983
- variant: "body2",
3984
- mb: 12,
3985
- mt: 12
3986
- }, index + 1, ") Your ", wallet, " Wallet"), list.length === 0 && React__default.createElement(React__default.Fragment, null, React__default.createElement(AlertContainer, null, React__default.createElement(Alert, {
3987
- type: "error",
3988
- description: "You should connect a " + wallet + " supported wallet"
3989
- })), (isExperimentalChain == null ? void 0 : isExperimentalChain(wallet)) && React__default.createElement(Button, {
3990
- variant: "contained",
3991
- type: "primary",
3992
- align: "grow",
3993
- onClick: function onClick() {
3994
- return handleConnectChain == null ? void 0 : handleConnectChain(wallet);
3995
- }
3996
- }, "Add " + wallet + " chain to Cosmos wallets")), list.length != 0 && React__default.createElement(SelectableWalletList, {
3997
- list: list,
3998
- onChange: onChange
3999
- }));
4000
- }))
4001
- });
4001
+ }, "Confirm"))
4002
+ }, React__default.createElement(React__default.Fragment, null, React__default.createElement(Typography, {
4003
+ variant: "h6",
4004
+ mb: 12
4005
+ }, "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) {
4006
+ var list = selectableWallets.filter(function (w) {
4007
+ return wallet === w.chain;
4008
+ });
4009
+ return React__default.createElement("div", {
4010
+ key: index
4011
+ }, React__default.createElement(Typography, {
4012
+ variant: "body2",
4013
+ mb: 12,
4014
+ mt: 12
4015
+ }, index + 1, ") Your ", wallet, " Wallet"), list.length === 0 && React__default.createElement(React__default.Fragment, null, React__default.createElement(AlertContainer, null, React__default.createElement(Alert, {
4016
+ type: "error"
4017
+ }, React__default.createElement(Typography, {
4018
+ variant: "body2"
4019
+ }, "You should connect a " + wallet + " supported wallet"))), (isExperimentalChain == null ? void 0 : isExperimentalChain(wallet)) && React__default.createElement(Button, {
4020
+ variant: "contained",
4021
+ type: "primary",
4022
+ align: "grow",
4023
+ onClick: function onClick() {
4024
+ return handleConnectChain == null ? void 0 : handleConnectChain(wallet);
4025
+ }
4026
+ }, "Add " + wallet + " chain to Cosmos wallets")), list.length != 0 && React__default.createElement(SelectableWalletList, {
4027
+ list: list,
4028
+ onChange: onChange
4029
+ }));
4030
+ })));
4002
4031
  }
4003
4032
 
4004
4033
  function groupingOfSwaps(list) {
@@ -4069,17 +4098,15 @@ function History(_ref) {
4069
4098
  onBack: onBack,
4070
4099
  textField: true,
4071
4100
  textFieldPlaceholder: "Search By Blockchain Or Token",
4072
- title: "History",
4073
- Content: function Content(_ref2) {
4074
- var searchedFor = _ref2.searchedFor;
4075
- var filterSwaps = filteredHistory(list, searchedFor);
4076
- return filterSwaps.length ? React__default.createElement(SwapsGroup, {
4077
- list: filterSwaps,
4078
- onSwapClick: onSwapClick
4079
- }) : React__default.createElement(BodyError, null, React__default.createElement(ErrorMsg$1, {
4080
- variant: "caption"
4081
- }, "Not Found"));
4082
- }
4101
+ title: "History"
4102
+ }, function (searchedFor) {
4103
+ var filterSwaps = filteredHistory(list, searchedFor);
4104
+ return filterSwaps.length ? React__default.createElement(SwapsGroup, {
4105
+ list: filterSwaps,
4106
+ onSwapClick: onSwapClick
4107
+ }) : React__default.createElement(BodyError, null, React__default.createElement(ErrorMsg$1, {
4108
+ variant: "caption"
4109
+ }, "Not Found"));
4083
4110
  });
4084
4111
  }
4085
4112
 
@@ -4118,55 +4145,54 @@ function SwapHistory(props) {
4118
4145
  return React__default.createElement(SecondaryPage, {
4119
4146
  title: "History",
4120
4147
  textField: false,
4121
- onBack: onBack,
4122
- Content: React__default.createElement(React__default.Fragment, null, pendingSwap == null ? void 0 : pendingSwap.steps.map(function (step, index) {
4123
- return React__default.createElement(Fragment, {
4148
+ onBack: onBack
4149
+ }, React__default.createElement(React__default.Fragment, null, pendingSwap == null ? void 0 : pendingSwap.steps.map(function (step, index) {
4150
+ return React__default.createElement(Fragment, {
4151
+ key: index
4152
+ }, index === 0 && React__default.createElement(RelativeContainer$1, null, React__default.createElement(StepDetail, {
4153
+ logo: step.fromLogo,
4154
+ symbol: step.fromSymbol,
4155
+ chainLogo: step.fromBlockchainLogo,
4156
+ blockchain: step.fromBlockchain,
4157
+ amount: pendingSwap.inputAmount
4158
+ }), React__default.createElement(Dot$2, null)), React__default.createElement(Line$3, null), React__default.createElement(SwapperContainer$1, null, React__default.createElement(SwapperLogo$1, {
4159
+ src: step.swapperLogo,
4160
+ alt: step.swapperId
4161
+ }), React__default.createElement("div", null, React__default.createElement(Typography, {
4162
+ ml: 4,
4163
+ variant: "caption"
4164
+ }, 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, {
4165
+ ml: 4,
4166
+ variant: "caption"
4167
+ }, step.feeInUsd, " estimated gas fee")))), React__default.createElement("div", {
4168
+ style: {
4169
+ display: 'flex'
4170
+ }
4171
+ }, React__default.createElement(InternalDetailsContainer, null, React__default.createElement(Line$3, null), !!step.explorerUrl && React__default.createElement("div", null, step.explorerUrl.map(function (item, index) {
4172
+ return React__default.createElement(InternalDetail, {
4124
4173
  key: index
4125
- }, index === 0 && React__default.createElement(RelativeContainer$1, null, React__default.createElement(StepDetail, {
4126
- logo: step.fromLogo,
4127
- symbol: step.fromSymbol,
4128
- chainLogo: step.fromBlockchainLogo,
4129
- blockchain: step.fromBlockchain,
4130
- amount: pendingSwap.inputAmount
4131
- }), React__default.createElement(Dot$2, null)), React__default.createElement(Line$3, null), React__default.createElement(SwapperContainer$1, null, React__default.createElement(SwapperLogo$1, {
4132
- src: step.swapperLogo,
4133
- alt: step.swapperId
4134
- }), React__default.createElement("div", null, React__default.createElement(Typography, {
4135
- ml: 4,
4136
- variant: "caption"
4137
- }, 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, {
4138
- ml: 4,
4139
- variant: "caption"
4140
- }, "fee")))), React__default.createElement("div", {
4141
- style: {
4142
- display: 'flex'
4143
- }
4144
- }, React__default.createElement(InternalDetailsContainer, null, React__default.createElement(Line$3, null), !!step.explorerUrl && React__default.createElement("div", null, step.explorerUrl.map(function (item, index) {
4145
- return React__default.createElement(InternalDetail, {
4146
- key: index
4147
- }, React__default.createElement(DescriptionContainer, null, React__default.createElement(CheckCircleIcon, {
4148
- color: "success"
4149
- }), React__default.createElement(Description, {
4150
- variant: "body2"
4151
- }, !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, {
4152
- href: item.url,
4153
- target: "_blank",
4154
- rel: "noreferrer",
4155
- key: index
4156
- }, "TX-Link"));
4157
- }), step.status === 'failed' && React__default.createElement(InternalDetail, null, React__default.createElement(DescriptionContainer, null, React__default.createElement(InfoCircleIcon, {
4158
- color: "error"
4159
- }), React__default.createElement(Error, {
4174
+ }, React__default.createElement(DescriptionContainer, null, React__default.createElement(CheckCircleIcon, {
4175
+ color: "success"
4176
+ }), React__default.createElement(Description, {
4160
4177
  variant: "body2"
4161
- }, "Step failed")))))), index + 1 === pendingSwap.steps.length && React__default.createElement(ArrowDown, null), React__default.createElement(StepDetail, {
4162
- logo: step.toLogo,
4163
- symbol: step.toSymbol,
4164
- chainLogo: step.toBlockchainLogo,
4165
- blockchain: step.toBlockchain,
4166
- amount: step.outputAmount
4167
- }));
4168
- }))
4169
- });
4178
+ }, !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, {
4179
+ href: item.url,
4180
+ target: "_blank",
4181
+ rel: "noreferrer",
4182
+ key: index
4183
+ }, "TX-Link"));
4184
+ }), step.status === 'failed' && React__default.createElement(InternalDetail, null, React__default.createElement(DescriptionContainer, null, React__default.createElement(InfoCircleIcon, {
4185
+ color: "error"
4186
+ }), React__default.createElement(Error, {
4187
+ variant: "body2"
4188
+ }, "Step failed")))))), index + 1 === pendingSwap.steps.length && React__default.createElement(ArrowDown, null), React__default.createElement(StepDetail, {
4189
+ logo: step.toLogo,
4190
+ symbol: step.toSymbol,
4191
+ chainLogo: step.toBlockchainLogo,
4192
+ blockchain: step.toBlockchain,
4193
+ amount: step.outputAmount
4194
+ }));
4195
+ })));
4170
4196
  }
4171
4197
 
4172
4198
  export { AddCircleIcon, AddIcon, AddWalletIcon, Alert, AngleDownIcon, AngleLeftIcon, AngleRightIcon, AngleUpIcon, BagIcon, BanIcon, BestRoute, BlockchainSelector, Button, CheckCircleIcon, CheckIcon, CheckSquareIcon, CheckWalletIcon, Checkbox, Chip, CloseIcon, ColorPicker, ConfirmSwap, ConfirmWallets, ConnectWalletsModal, DeleteCircleIcon, DeleteWalletIcon, DownloadIcon, FilledCircle, GasIcon, History, HistoryIcon, HorizontalSwapIcon, InfoCircleIcon, LiquiditySourcesSelector, MinusCircleIcon, Modal, Radio, RetryIcon, RetryLeftIcon, RetryRightIcon, SearchIcon, SearchMinusIcon, SecondaryPage, SelectableWalletList, Settings, SettingsIcon, SignatureIcon, Spacer, Spinner, StepDetail, SwapContainer, SwapDetail, SwapHistory, SwapWalletIcon, Switch, TextField, TimeIcon, TokenList, TokenSelector, Tooltip, TrashIcon, TryAgainIcon, Typography, VerticalSwapIcon, Wallet, WalletIcon, WalletState, WarningIcon, createTheme, css, darkTheme, globalCss, keyframes, lightTheme, styled };