@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
@@ -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',
@@ -3228,8 +3233,13 @@ var LiquiditySourceContainer = /*#__PURE__*/styled(BaseContainer, {
3228
3233
  marginTop: '$32',
3229
3234
  cursor: 'pointer'
3230
3235
  });
3236
+ var InfiniteContainer = /*#__PURE__*/styled(BaseContainer, {
3237
+ display: 'flex',
3238
+ justifyContent: 'space-between',
3239
+ marginTop: '$32'
3240
+ });
3231
3241
  var StyledAngleRight = /*#__PURE__*/styled(AngleRightIcon, {
3232
- marginLeft: '8px'
3242
+ marginLeft: '$8'
3233
3243
  });
3234
3244
  var LiquiditySourceNumber = /*#__PURE__*/styled('div', {
3235
3245
  display: 'flex',
@@ -3251,7 +3261,9 @@ function Settings(props) {
3251
3261
  maxSlippage = props.maxSlippage,
3252
3262
  minSlippage = props.minSlippage,
3253
3263
  selectedTheme = props.selectedTheme,
3254
- onThemeChange = props.onThemeChange;
3264
+ onThemeChange = props.onThemeChange,
3265
+ toggleInfiniteApprove = props.toggleInfiniteApprove,
3266
+ infiniteApprove = props.infiniteApprove;
3255
3267
  var _useState = React.useState(props.selectedSlippage),
3256
3268
  selectedSlippage = _useState[0],
3257
3269
  setSelectedSlippage = _useState[1];
@@ -3259,7 +3271,7 @@ function Settings(props) {
3259
3271
  setSelectedSlippage(slippage);
3260
3272
  onSlippageChange(slippage);
3261
3273
  };
3262
- var PageContent = React__default.createElement(React__default.Fragment, null, React__default.createElement(BaseContainer, null, React__default.createElement(Typography, {
3274
+ var PageContent = React__default.createElement(React__default.Fragment, null, React__default.createElement(BaseContainer, null, React__default.createElement(Title, {
3263
3275
  variant: "body1"
3264
3276
  }, "Slippage tolerance per swap"), React__default.createElement(SlippageChipsContainer, null, slippages.map(function (slippage, index) {
3265
3277
  return React__default.createElement(Chip, {
@@ -3291,7 +3303,7 @@ function Settings(props) {
3291
3303
  flexGrow: 'initial',
3292
3304
  borderColor: customSlippage ? '$success' : 'initial'
3293
3305
  }
3294
- }))), React__default.createElement(ThemesContainer, null, React__default.createElement(Typography, {
3306
+ }))), React__default.createElement(ThemesContainer, null, React__default.createElement(Title, {
3295
3307
  variant: "body2"
3296
3308
  }, "Theme"), React__default.createElement(Radio, {
3297
3309
  defaultValue: selectedTheme,
@@ -3312,21 +3324,23 @@ function Settings(props) {
3312
3324
  style: {
3313
3325
  marginTop: '$24'
3314
3326
  }
3327
+ })), React__default.createElement(InfiniteContainer, null, React__default.createElement(Typography, {
3328
+ variant: "body1"
3329
+ }, "Infinite Approval"), React__default.createElement(Switch, {
3330
+ checked: infiniteApprove,
3331
+ onChange: toggleInfiniteApprove
3315
3332
  })), React__default.createElement(LiquiditySourceContainer, {
3316
3333
  onClick: onLiquiditySourcesClick
3317
3334
  }, React__default.createElement(Typography, {
3318
3335
  variant: "body1"
3319
- }, "Liquidity Sources"), React__default.createElement(LiquiditySourceNumber, {
3320
- onClick: onLiquiditySourcesClick
3321
- }, React__default.createElement(Typography, {
3336
+ }, "Liquidity Sources"), React__default.createElement(LiquiditySourceNumber, null, React__default.createElement(Typography, {
3322
3337
  variant: "body2"
3323
3338
  }, "( " + selectedLiquiditySources.length + " / " + liquiditySources.length + " )"), React__default.createElement(StyledAngleRight, null))));
3324
3339
  return React__default.createElement(SecondaryPage, {
3325
3340
  title: "Settings",
3326
3341
  textField: false,
3327
- Content: PageContent,
3328
3342
  onBack: onBack
3329
- });
3343
+ }, PageContent);
3330
3344
  }
3331
3345
 
3332
3346
  var MainContainer$1 = /*#__PURE__*/styled('div', {
@@ -3340,7 +3354,8 @@ var MainContainer$1 = /*#__PURE__*/styled('div', {
3340
3354
  display: 'flex',
3341
3355
  flexDirection: 'column',
3342
3356
  alignItems: 'end',
3343
- padding: '$16 $24'
3357
+ padding: '$16 $24',
3358
+ boxSizing: 'border-box'
3344
3359
  });
3345
3360
  var ContentContainer$3 = /*#__PURE__*/styled('div', {
3346
3361
  width: '100%'
@@ -3659,18 +3674,16 @@ function TokenSelector(props) {
3659
3674
  textFieldPlaceholder: "Search Blockchain By Name",
3660
3675
  title: "Select " + type + " Token",
3661
3676
  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
- }
3677
+ onBack: onBack
3678
+ }, function (searchedFor) {
3679
+ return React__default.createElement(TokenList, {
3680
+ searchedText: searchedFor,
3681
+ list: list,
3682
+ selected: selected,
3683
+ selectedList: selectedList,
3684
+ multiSelect: multiSelect,
3685
+ onChange: onChange
3686
+ });
3674
3687
  });
3675
3688
  }
3676
3689
 
@@ -3841,6 +3854,9 @@ function ColorPicker(_ref) {
3841
3854
  })));
3842
3855
  }
3843
3856
 
3857
+ var MainContainer$2 = /*#__PURE__*/styled('div', {
3858
+ overflow: 'hidden'
3859
+ });
3844
3860
  var Line$2 = /*#__PURE__*/styled('div', {
3845
3861
  width: '0',
3846
3862
  marginLeft: '$12',
@@ -3883,17 +3899,31 @@ var ArrowDown = /*#__PURE__*/styled('div', {
3883
3899
  borderTop: '5px solid $foreground',
3884
3900
  marginLeft: '$8'
3885
3901
  });
3902
+ var UpdateIcon = /*#__PURE__*/styled(RetryIcon, {
3903
+ position: 'absolute',
3904
+ right: '0'
3905
+ });
3906
+ var StyledUpdateIcon = /*#__PURE__*/styled(UpdateIcon, {
3907
+ cursor: 'pointer'
3908
+ });
3909
+ var BestRouteContainer$1 = /*#__PURE__*/styled('div', {
3910
+ overflow: 'auto'
3911
+ });
3886
3912
  var Alerts = /*#__PURE__*/styled('div', {
3887
3913
  paddingBottom: '$16'
3888
3914
  });
3889
- function ConfirmSwap(_ref) {
3915
+ function ConfirmSwap(props) {
3890
3916
  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;
3917
+ var bestRoute = props.bestRoute,
3918
+ onRefresh = props.onRefresh,
3919
+ onBack = props.onBack,
3920
+ onConfirm = props.onConfirm,
3921
+ loading = props.loading,
3922
+ errors = props.errors,
3923
+ warnings = props.warnings,
3924
+ extraMessages = props.extraMessages,
3925
+ confirmButtonTitle = props.confirmButtonTitle,
3926
+ confirmButtonDisabled = props.confirmButtonDisabled;
3897
3927
  return React__default.createElement(SecondaryPage, {
3898
3928
  textField: false,
3899
3929
  title: "Swap",
@@ -3903,42 +3933,50 @@ function ConfirmSwap(_ref) {
3903
3933
  fullWidth: true,
3904
3934
  loading: loading,
3905
3935
  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
- }));
3936
+ onClick: onConfirm,
3937
+ disabled: confirmButtonDisabled
3938
+ }, confirmButtonTitle)),
3939
+ TopButton: React__default.createElement(StyledUpdateIcon, {
3940
+ size: 24,
3941
+ onClick: onRefresh
3940
3942
  })
3941
- });
3943
+ }, 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) {
3944
+ return React__default.createElement(Alert, {
3945
+ type: "error",
3946
+ key: index
3947
+ }, error);
3948
+ }), warnings == null ? void 0 : warnings.map(function (warning, index) {
3949
+ return React__default.createElement(Alert, {
3950
+ type: "warning",
3951
+ key: index
3952
+ }, warning);
3953
+ }))), React__default.createElement(BestRouteContainer$1, null, bestRoute == null ? void 0 : (_bestRoute$result = bestRoute.result) == null ? void 0 : _bestRoute$result.swaps.map(function (swap, index) {
3954
+ var _bestRoute$result2;
3955
+ return React__default.createElement(React.Fragment, {
3956
+ key: index
3957
+ }, index === 0 && React__default.createElement(RelativeContainer$1, null, React__default.createElement(StepDetail, {
3958
+ logo: swap.from.logo,
3959
+ symbol: swap.from.symbol,
3960
+ chainLogo: swap.from.blockchainLogo,
3961
+ blockchain: swap.from.blockchain,
3962
+ amount: swap.fromAmount
3963
+ }), React__default.createElement(Dot$2, null)), React__default.createElement(Line$2, null), React__default.createElement(SwapperContainer$1, null, React__default.createElement(SwapperLogo$1, {
3964
+ src: swap.swapperLogo,
3965
+ alt: swap.swapperId
3966
+ }), React__default.createElement("div", null, React__default.createElement(Typography, {
3967
+ ml: 4,
3968
+ variant: "caption"
3969
+ }, 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, {
3970
+ ml: 4,
3971
+ variant: "caption"
3972
+ }, 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, {
3973
+ logo: swap.to.logo,
3974
+ symbol: swap.to.symbol,
3975
+ chainLogo: swap.to.blockchainLogo,
3976
+ blockchain: swap.to.blockchain,
3977
+ amount: swap.toAmount
3978
+ }));
3979
+ }))));
3942
3980
  }
3943
3981
 
3944
3982
  var Footer$1 = /*#__PURE__*/styled('div', {
@@ -3948,63 +3986,66 @@ var Footer$1 = /*#__PURE__*/styled('div', {
3948
3986
  var AlertContainer = /*#__PURE__*/styled('div', {
3949
3987
  padding: '$16 0'
3950
3988
  });
3951
- function ConfirmWallets(_ref) {
3989
+ var ConfirmButton = /*#__PURE__*/styled(Button, {
3990
+ marginTop: '$16'
3991
+ });
3992
+ function ConfirmWallets(props) {
3952
3993
  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;
3994
+ var onBack = props.onBack,
3995
+ loading = props.loading,
3996
+ onConfirm = props.onConfirm,
3997
+ swap = props.swap,
3998
+ requiredWallets = props.requiredWallets,
3999
+ selectableWallets = props.selectableWallets,
4000
+ onChange = props.onChange,
4001
+ confirmDisabled = props.confirmDisabled,
4002
+ isExperimentalChain = props.isExperimentalChain,
4003
+ handleConnectChain = props.handleConnectChain,
4004
+ fromAmount = props.fromAmount,
4005
+ toAmount = props.toAmount;
3963
4006
  var firstStep = (_swap$result = swap.result) == null ? void 0 : _swap$result.swaps[0];
3964
4007
  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
4008
  return React__default.createElement(SecondaryPage, {
3968
4009
  textField: false,
3969
4010
  title: "Confirm Swap",
3970
4011
  onBack: onBack,
3971
- Footer: React__default.createElement(Footer$1, null, React__default.createElement(Button, {
4012
+ Footer: React__default.createElement(Footer$1, null, React__default.createElement(ConfirmButton, {
3972
4013
  fullWidth: true,
3973
4014
  loading: loading,
3974
4015
  type: "primary",
3975
4016
  variant: "contained",
3976
4017
  onClick: onConfirm,
3977
4018
  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
- });
4019
+ }, "Confirm"))
4020
+ }, React__default.createElement(React__default.Fragment, null, React__default.createElement(Typography, {
4021
+ variant: "h6",
4022
+ mb: 12
4023
+ }, "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) {
4024
+ var list = selectableWallets.filter(function (w) {
4025
+ return wallet === w.chain;
4026
+ });
4027
+ return React__default.createElement("div", {
4028
+ key: index
4029
+ }, React__default.createElement(Typography, {
4030
+ variant: "body2",
4031
+ mb: 12,
4032
+ mt: 12
4033
+ }, index + 1, ") Your ", wallet, " Wallet"), list.length === 0 && React__default.createElement(React__default.Fragment, null, React__default.createElement(AlertContainer, null, React__default.createElement(Alert, {
4034
+ type: "error"
4035
+ }, React__default.createElement(Typography, {
4036
+ variant: "body2"
4037
+ }, "You should connect a " + wallet + " supported wallet"))), (isExperimentalChain == null ? void 0 : isExperimentalChain(wallet)) && React__default.createElement(Button, {
4038
+ variant: "contained",
4039
+ type: "primary",
4040
+ align: "grow",
4041
+ onClick: function onClick() {
4042
+ return handleConnectChain == null ? void 0 : handleConnectChain(wallet);
4043
+ }
4044
+ }, "Add " + wallet + " chain to Cosmos wallets")), list.length != 0 && React__default.createElement(SelectableWalletList, {
4045
+ list: list,
4046
+ onChange: onChange
4047
+ }));
4048
+ })));
4008
4049
  }
4009
4050
 
4010
4051
  function groupingOfSwaps(list) {
@@ -4075,17 +4116,15 @@ function History(_ref) {
4075
4116
  onBack: onBack,
4076
4117
  textField: true,
4077
4118
  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
- }
4119
+ title: "History"
4120
+ }, function (searchedFor) {
4121
+ var filterSwaps = filteredHistory(list, searchedFor);
4122
+ return filterSwaps.length ? React__default.createElement(SwapsGroup, {
4123
+ list: filterSwaps,
4124
+ onSwapClick: onSwapClick
4125
+ }) : React__default.createElement(BodyError, null, React__default.createElement(ErrorMsg$1, {
4126
+ variant: "caption"
4127
+ }, "Not Found"));
4089
4128
  });
4090
4129
  }
4091
4130
 
@@ -4124,55 +4163,54 @@ function SwapHistory(props) {
4124
4163
  return React__default.createElement(SecondaryPage, {
4125
4164
  title: "History",
4126
4165
  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, {
4166
+ onBack: onBack
4167
+ }, React__default.createElement(React__default.Fragment, null, pendingSwap == null ? void 0 : pendingSwap.steps.map(function (step, index) {
4168
+ return React__default.createElement(React.Fragment, {
4169
+ key: index
4170
+ }, index === 0 && React__default.createElement(RelativeContainer$1, null, React__default.createElement(StepDetail, {
4171
+ logo: step.fromLogo,
4172
+ symbol: step.fromSymbol,
4173
+ chainLogo: step.fromBlockchainLogo,
4174
+ blockchain: step.fromBlockchain,
4175
+ amount: pendingSwap.inputAmount
4176
+ }), React__default.createElement(Dot$2, null)), React__default.createElement(Line$3, null), React__default.createElement(SwapperContainer$1, null, React__default.createElement(SwapperLogo$1, {
4177
+ src: step.swapperLogo,
4178
+ alt: step.swapperId
4179
+ }), React__default.createElement("div", null, React__default.createElement(Typography, {
4180
+ ml: 4,
4181
+ variant: "caption"
4182
+ }, 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, {
4183
+ ml: 4,
4184
+ variant: "caption"
4185
+ }, step.feeInUsd, " estimated gas fee")))), React__default.createElement("div", {
4186
+ style: {
4187
+ display: 'flex'
4188
+ }
4189
+ }, React__default.createElement(InternalDetailsContainer, null, React__default.createElement(Line$3, null), !!step.explorerUrl && React__default.createElement("div", null, step.explorerUrl.map(function (item, index) {
4190
+ return React__default.createElement(InternalDetail, {
4130
4191
  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, {
4192
+ }, React__default.createElement(DescriptionContainer, null, React__default.createElement(CheckCircleIcon, {
4193
+ color: "success"
4194
+ }), React__default.createElement(Description, {
4166
4195
  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
- });
4196
+ }, !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, {
4197
+ href: item.url,
4198
+ target: "_blank",
4199
+ rel: "noreferrer",
4200
+ key: index
4201
+ }, "TX-Link"));
4202
+ }), step.status === 'failed' && React__default.createElement(InternalDetail, null, React__default.createElement(DescriptionContainer, null, React__default.createElement(InfoCircleIcon, {
4203
+ color: "error"
4204
+ }), React__default.createElement(Error, {
4205
+ variant: "body2"
4206
+ }, "Step failed")))))), index + 1 === pendingSwap.steps.length && React__default.createElement(ArrowDown, null), React__default.createElement(StepDetail, {
4207
+ logo: step.toLogo,
4208
+ symbol: step.toSymbol,
4209
+ chainLogo: step.toBlockchainLogo,
4210
+ blockchain: step.toBlockchain,
4211
+ amount: step.outputAmount
4212
+ }));
4213
+ })));
4176
4214
  }
4177
4215
 
4178
4216
  exports.AddCircleIcon = AddCircleIcon;