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

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 (40) 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/Settings/Settings.d.ts +2 -0
  7. package/dist/components/TextField/TextField.stories.d.ts +1 -1
  8. package/dist/containers/ConfirmSwap/ConfirmSwap.d.ts +8 -4
  9. package/dist/containers/ConfirmWallets/ConfirmWallets.d.ts +4 -2
  10. package/dist/containers/History/types.d.ts +1 -0
  11. package/dist/helper/index.d.ts +0 -5
  12. package/dist/types/wallet.d.ts +8 -0
  13. package/dist/ui.cjs.development.js +301 -263
  14. package/dist/ui.cjs.development.js.map +1 -1
  15. package/dist/ui.cjs.production.min.js +1 -1
  16. package/dist/ui.cjs.production.min.js.map +1 -1
  17. package/dist/ui.esm.js +301 -263
  18. package/dist/ui.esm.js.map +1 -1
  19. package/package.json +1 -1
  20. package/src/components/Alert/Alert.tsx +5 -9
  21. package/src/components/BestRoute/BestRoute.tsx +55 -21
  22. package/src/components/BlockchainSelector/BlockchainSelector.tsx +13 -11
  23. package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +21 -20
  24. package/src/components/LiquiditySourcesSelector/LiquiditySourcesSelector.tsx +3 -2
  25. package/src/components/Radio/Radio.tsx +1 -0
  26. package/src/components/SecondaryPage/SecondaryPage.tsx +5 -6
  27. package/src/components/SelectableWalletList/SelectableWalletList.tsx +1 -1
  28. package/src/components/Settings/Settings.tsx +26 -13
  29. package/src/components/SwapContainer/SwapContainer.tsx +1 -0
  30. package/src/components/Switch/Switch.tsx +1 -0
  31. package/src/components/TokenSelector/TokenSelector.tsx +3 -2
  32. package/src/containers/ConfirmSwap/ConfirmSwap.tsx +92 -54
  33. package/src/containers/ConfirmWallets/ConfirmWallets.tsx +66 -62
  34. package/src/containers/History/History.tsx +3 -2
  35. package/src/containers/History/types.tsx +10 -1
  36. package/src/containers/SwapHistory/SwapHistory.tsx +87 -95
  37. package/src/helper/index.ts +1 -22
  38. package/src/types/wallet.ts +9 -0
  39. package/dist/containers/ConfirmWallets/types.d.ts +0 -9
  40. 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',
@@ -3222,8 +3227,13 @@ var LiquiditySourceContainer = /*#__PURE__*/styled(BaseContainer, {
3222
3227
  marginTop: '$32',
3223
3228
  cursor: 'pointer'
3224
3229
  });
3230
+ var InfiniteContainer = /*#__PURE__*/styled(BaseContainer, {
3231
+ display: 'flex',
3232
+ justifyContent: 'space-between',
3233
+ marginTop: '$32'
3234
+ });
3225
3235
  var StyledAngleRight = /*#__PURE__*/styled(AngleRightIcon, {
3226
- marginLeft: '8px'
3236
+ marginLeft: '$8'
3227
3237
  });
3228
3238
  var LiquiditySourceNumber = /*#__PURE__*/styled('div', {
3229
3239
  display: 'flex',
@@ -3245,7 +3255,9 @@ function Settings(props) {
3245
3255
  maxSlippage = props.maxSlippage,
3246
3256
  minSlippage = props.minSlippage,
3247
3257
  selectedTheme = props.selectedTheme,
3248
- onThemeChange = props.onThemeChange;
3258
+ onThemeChange = props.onThemeChange,
3259
+ toggleInfiniteApprove = props.toggleInfiniteApprove,
3260
+ infiniteApprove = props.infiniteApprove;
3249
3261
  var _useState = useState(props.selectedSlippage),
3250
3262
  selectedSlippage = _useState[0],
3251
3263
  setSelectedSlippage = _useState[1];
@@ -3253,7 +3265,7 @@ function Settings(props) {
3253
3265
  setSelectedSlippage(slippage);
3254
3266
  onSlippageChange(slippage);
3255
3267
  };
3256
- var PageContent = React__default.createElement(React__default.Fragment, null, React__default.createElement(BaseContainer, null, React__default.createElement(Typography, {
3268
+ var PageContent = React__default.createElement(React__default.Fragment, null, React__default.createElement(BaseContainer, null, React__default.createElement(Title, {
3257
3269
  variant: "body1"
3258
3270
  }, "Slippage tolerance per swap"), React__default.createElement(SlippageChipsContainer, null, slippages.map(function (slippage, index) {
3259
3271
  return React__default.createElement(Chip, {
@@ -3285,7 +3297,7 @@ function Settings(props) {
3285
3297
  flexGrow: 'initial',
3286
3298
  borderColor: customSlippage ? '$success' : 'initial'
3287
3299
  }
3288
- }))), React__default.createElement(ThemesContainer, null, React__default.createElement(Typography, {
3300
+ }))), React__default.createElement(ThemesContainer, null, React__default.createElement(Title, {
3289
3301
  variant: "body2"
3290
3302
  }, "Theme"), React__default.createElement(Radio, {
3291
3303
  defaultValue: selectedTheme,
@@ -3306,21 +3318,23 @@ function Settings(props) {
3306
3318
  style: {
3307
3319
  marginTop: '$24'
3308
3320
  }
3321
+ })), React__default.createElement(InfiniteContainer, null, React__default.createElement(Typography, {
3322
+ variant: "body1"
3323
+ }, "Infinite Approval"), React__default.createElement(Switch, {
3324
+ checked: infiniteApprove,
3325
+ onChange: toggleInfiniteApprove
3309
3326
  })), React__default.createElement(LiquiditySourceContainer, {
3310
3327
  onClick: onLiquiditySourcesClick
3311
3328
  }, React__default.createElement(Typography, {
3312
3329
  variant: "body1"
3313
- }, "Liquidity Sources"), React__default.createElement(LiquiditySourceNumber, {
3314
- onClick: onLiquiditySourcesClick
3315
- }, React__default.createElement(Typography, {
3330
+ }, "Liquidity Sources"), React__default.createElement(LiquiditySourceNumber, null, React__default.createElement(Typography, {
3316
3331
  variant: "body2"
3317
3332
  }, "( " + selectedLiquiditySources.length + " / " + liquiditySources.length + " )"), React__default.createElement(StyledAngleRight, null))));
3318
3333
  return React__default.createElement(SecondaryPage, {
3319
3334
  title: "Settings",
3320
3335
  textField: false,
3321
- Content: PageContent,
3322
3336
  onBack: onBack
3323
- });
3337
+ }, PageContent);
3324
3338
  }
3325
3339
 
3326
3340
  var MainContainer$1 = /*#__PURE__*/styled('div', {
@@ -3334,7 +3348,8 @@ var MainContainer$1 = /*#__PURE__*/styled('div', {
3334
3348
  display: 'flex',
3335
3349
  flexDirection: 'column',
3336
3350
  alignItems: 'end',
3337
- padding: '$16 $24'
3351
+ padding: '$16 $24',
3352
+ boxSizing: 'border-box'
3338
3353
  });
3339
3354
  var ContentContainer$3 = /*#__PURE__*/styled('div', {
3340
3355
  width: '100%'
@@ -3653,18 +3668,16 @@ function TokenSelector(props) {
3653
3668
  textFieldPlaceholder: "Search Blockchain By Name",
3654
3669
  title: "Select " + type + " Token",
3655
3670
  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
- }
3671
+ onBack: onBack
3672
+ }, function (searchedFor) {
3673
+ return React__default.createElement(TokenList, {
3674
+ searchedText: searchedFor,
3675
+ list: list,
3676
+ selected: selected,
3677
+ selectedList: selectedList,
3678
+ multiSelect: multiSelect,
3679
+ onChange: onChange
3680
+ });
3668
3681
  });
3669
3682
  }
3670
3683
 
@@ -3835,6 +3848,9 @@ function ColorPicker(_ref) {
3835
3848
  })));
3836
3849
  }
3837
3850
 
3851
+ var MainContainer$2 = /*#__PURE__*/styled('div', {
3852
+ overflow: 'hidden'
3853
+ });
3838
3854
  var Line$2 = /*#__PURE__*/styled('div', {
3839
3855
  width: '0',
3840
3856
  marginLeft: '$12',
@@ -3877,17 +3893,31 @@ var ArrowDown = /*#__PURE__*/styled('div', {
3877
3893
  borderTop: '5px solid $foreground',
3878
3894
  marginLeft: '$8'
3879
3895
  });
3896
+ var UpdateIcon = /*#__PURE__*/styled(RetryIcon, {
3897
+ position: 'absolute',
3898
+ right: '0'
3899
+ });
3900
+ var StyledUpdateIcon = /*#__PURE__*/styled(UpdateIcon, {
3901
+ cursor: 'pointer'
3902
+ });
3903
+ var BestRouteContainer$1 = /*#__PURE__*/styled('div', {
3904
+ overflow: 'auto'
3905
+ });
3880
3906
  var Alerts = /*#__PURE__*/styled('div', {
3881
3907
  paddingBottom: '$16'
3882
3908
  });
3883
- function ConfirmSwap(_ref) {
3909
+ function ConfirmSwap(props) {
3884
3910
  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;
3911
+ var bestRoute = props.bestRoute,
3912
+ onRefresh = props.onRefresh,
3913
+ onBack = props.onBack,
3914
+ onConfirm = props.onConfirm,
3915
+ loading = props.loading,
3916
+ errors = props.errors,
3917
+ warnings = props.warnings,
3918
+ extraMessages = props.extraMessages,
3919
+ confirmButtonTitle = props.confirmButtonTitle,
3920
+ confirmButtonDisabled = props.confirmButtonDisabled;
3891
3921
  return React__default.createElement(SecondaryPage, {
3892
3922
  textField: false,
3893
3923
  title: "Swap",
@@ -3897,42 +3927,50 @@ function ConfirmSwap(_ref) {
3897
3927
  fullWidth: true,
3898
3928
  loading: loading,
3899
3929
  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
- }));
3930
+ onClick: onConfirm,
3931
+ disabled: confirmButtonDisabled
3932
+ }, confirmButtonTitle)),
3933
+ TopButton: React__default.createElement(StyledUpdateIcon, {
3934
+ size: 24,
3935
+ onClick: onRefresh
3934
3936
  })
3935
- });
3937
+ }, 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) {
3938
+ return React__default.createElement(Alert, {
3939
+ type: "error",
3940
+ key: index
3941
+ }, error);
3942
+ }), warnings == null ? void 0 : warnings.map(function (warning, index) {
3943
+ return React__default.createElement(Alert, {
3944
+ type: "warning",
3945
+ key: index
3946
+ }, warning);
3947
+ }))), React__default.createElement(BestRouteContainer$1, null, bestRoute == null ? void 0 : (_bestRoute$result = bestRoute.result) == null ? void 0 : _bestRoute$result.swaps.map(function (swap, index) {
3948
+ var _bestRoute$result2;
3949
+ return React__default.createElement(Fragment, {
3950
+ key: index
3951
+ }, index === 0 && React__default.createElement(RelativeContainer$1, null, React__default.createElement(StepDetail, {
3952
+ logo: swap.from.logo,
3953
+ symbol: swap.from.symbol,
3954
+ chainLogo: swap.from.blockchainLogo,
3955
+ blockchain: swap.from.blockchain,
3956
+ amount: swap.fromAmount
3957
+ }), React__default.createElement(Dot$2, null)), React__default.createElement(Line$2, null), React__default.createElement(SwapperContainer$1, null, React__default.createElement(SwapperLogo$1, {
3958
+ src: swap.swapperLogo,
3959
+ alt: swap.swapperId
3960
+ }), React__default.createElement("div", null, React__default.createElement(Typography, {
3961
+ ml: 4,
3962
+ variant: "caption"
3963
+ }, 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, {
3964
+ ml: 4,
3965
+ variant: "caption"
3966
+ }, 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, {
3967
+ logo: swap.to.logo,
3968
+ symbol: swap.to.symbol,
3969
+ chainLogo: swap.to.blockchainLogo,
3970
+ blockchain: swap.to.blockchain,
3971
+ amount: swap.toAmount
3972
+ }));
3973
+ }))));
3936
3974
  }
3937
3975
 
3938
3976
  var Footer$1 = /*#__PURE__*/styled('div', {
@@ -3942,63 +3980,66 @@ var Footer$1 = /*#__PURE__*/styled('div', {
3942
3980
  var AlertContainer = /*#__PURE__*/styled('div', {
3943
3981
  padding: '$16 0'
3944
3982
  });
3945
- function ConfirmWallets(_ref) {
3983
+ var ConfirmButton = /*#__PURE__*/styled(Button, {
3984
+ marginTop: '$16'
3985
+ });
3986
+ function ConfirmWallets(props) {
3946
3987
  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;
3988
+ var onBack = props.onBack,
3989
+ loading = props.loading,
3990
+ onConfirm = props.onConfirm,
3991
+ swap = props.swap,
3992
+ requiredWallets = props.requiredWallets,
3993
+ selectableWallets = props.selectableWallets,
3994
+ onChange = props.onChange,
3995
+ confirmDisabled = props.confirmDisabled,
3996
+ isExperimentalChain = props.isExperimentalChain,
3997
+ handleConnectChain = props.handleConnectChain,
3998
+ fromAmount = props.fromAmount,
3999
+ toAmount = props.toAmount;
3957
4000
  var firstStep = (_swap$result = swap.result) == null ? void 0 : _swap$result.swaps[0];
3958
4001
  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
4002
  return React__default.createElement(SecondaryPage, {
3962
4003
  textField: false,
3963
4004
  title: "Confirm Swap",
3964
4005
  onBack: onBack,
3965
- Footer: React__default.createElement(Footer$1, null, React__default.createElement(Button, {
4006
+ Footer: React__default.createElement(Footer$1, null, React__default.createElement(ConfirmButton, {
3966
4007
  fullWidth: true,
3967
4008
  loading: loading,
3968
4009
  type: "primary",
3969
4010
  variant: "contained",
3970
4011
  onClick: onConfirm,
3971
4012
  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
- });
4013
+ }, "Confirm"))
4014
+ }, React__default.createElement(React__default.Fragment, null, React__default.createElement(Typography, {
4015
+ variant: "h6",
4016
+ mb: 12
4017
+ }, "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) {
4018
+ var list = selectableWallets.filter(function (w) {
4019
+ return wallet === w.chain;
4020
+ });
4021
+ return React__default.createElement("div", {
4022
+ key: index
4023
+ }, React__default.createElement(Typography, {
4024
+ variant: "body2",
4025
+ mb: 12,
4026
+ mt: 12
4027
+ }, index + 1, ") Your ", wallet, " Wallet"), list.length === 0 && React__default.createElement(React__default.Fragment, null, React__default.createElement(AlertContainer, null, React__default.createElement(Alert, {
4028
+ type: "error"
4029
+ }, React__default.createElement(Typography, {
4030
+ variant: "body2"
4031
+ }, "You should connect a " + wallet + " supported wallet"))), (isExperimentalChain == null ? void 0 : isExperimentalChain(wallet)) && React__default.createElement(Button, {
4032
+ variant: "contained",
4033
+ type: "primary",
4034
+ align: "grow",
4035
+ onClick: function onClick() {
4036
+ return handleConnectChain == null ? void 0 : handleConnectChain(wallet);
4037
+ }
4038
+ }, "Add " + wallet + " chain to Cosmos wallets")), list.length != 0 && React__default.createElement(SelectableWalletList, {
4039
+ list: list,
4040
+ onChange: onChange
4041
+ }));
4042
+ })));
4002
4043
  }
4003
4044
 
4004
4045
  function groupingOfSwaps(list) {
@@ -4069,17 +4110,15 @@ function History(_ref) {
4069
4110
  onBack: onBack,
4070
4111
  textField: true,
4071
4112
  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
- }
4113
+ title: "History"
4114
+ }, function (searchedFor) {
4115
+ var filterSwaps = filteredHistory(list, searchedFor);
4116
+ return filterSwaps.length ? React__default.createElement(SwapsGroup, {
4117
+ list: filterSwaps,
4118
+ onSwapClick: onSwapClick
4119
+ }) : React__default.createElement(BodyError, null, React__default.createElement(ErrorMsg$1, {
4120
+ variant: "caption"
4121
+ }, "Not Found"));
4083
4122
  });
4084
4123
  }
4085
4124
 
@@ -4118,55 +4157,54 @@ function SwapHistory(props) {
4118
4157
  return React__default.createElement(SecondaryPage, {
4119
4158
  title: "History",
4120
4159
  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, {
4160
+ onBack: onBack
4161
+ }, React__default.createElement(React__default.Fragment, null, pendingSwap == null ? void 0 : pendingSwap.steps.map(function (step, index) {
4162
+ return React__default.createElement(Fragment, {
4163
+ key: index
4164
+ }, index === 0 && React__default.createElement(RelativeContainer$1, null, React__default.createElement(StepDetail, {
4165
+ logo: step.fromLogo,
4166
+ symbol: step.fromSymbol,
4167
+ chainLogo: step.fromBlockchainLogo,
4168
+ blockchain: step.fromBlockchain,
4169
+ amount: pendingSwap.inputAmount
4170
+ }), React__default.createElement(Dot$2, null)), React__default.createElement(Line$3, null), React__default.createElement(SwapperContainer$1, null, React__default.createElement(SwapperLogo$1, {
4171
+ src: step.swapperLogo,
4172
+ alt: step.swapperId
4173
+ }), React__default.createElement("div", null, React__default.createElement(Typography, {
4174
+ ml: 4,
4175
+ variant: "caption"
4176
+ }, 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, {
4177
+ ml: 4,
4178
+ variant: "caption"
4179
+ }, step.feeInUsd, " estimated gas fee")))), React__default.createElement("div", {
4180
+ style: {
4181
+ display: 'flex'
4182
+ }
4183
+ }, React__default.createElement(InternalDetailsContainer, null, React__default.createElement(Line$3, null), !!step.explorerUrl && React__default.createElement("div", null, step.explorerUrl.map(function (item, index) {
4184
+ return React__default.createElement(InternalDetail, {
4124
4185
  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, {
4186
+ }, React__default.createElement(DescriptionContainer, null, React__default.createElement(CheckCircleIcon, {
4187
+ color: "success"
4188
+ }), React__default.createElement(Description, {
4160
4189
  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
- });
4190
+ }, !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, {
4191
+ href: item.url,
4192
+ target: "_blank",
4193
+ rel: "noreferrer",
4194
+ key: index
4195
+ }, "TX-Link"));
4196
+ }), step.status === 'failed' && React__default.createElement(InternalDetail, null, React__default.createElement(DescriptionContainer, null, React__default.createElement(InfoCircleIcon, {
4197
+ color: "error"
4198
+ }), React__default.createElement(Error, {
4199
+ variant: "body2"
4200
+ }, "Step failed")))))), index + 1 === pendingSwap.steps.length && React__default.createElement(ArrowDown, null), React__default.createElement(StepDetail, {
4201
+ logo: step.toLogo,
4202
+ symbol: step.toSymbol,
4203
+ chainLogo: step.toBlockchainLogo,
4204
+ blockchain: step.toBlockchain,
4205
+ amount: step.outputAmount
4206
+ }));
4207
+ })));
4170
4208
  }
4171
4209
 
4172
4210
  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 };