@depay/widgets 7.16.3 → 7.16.4

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.
package/dist/esm/index.js CHANGED
@@ -19847,73 +19847,68 @@ var PaymentRoutingProvider = (function (props) {
19847
19847
  } else {
19848
19848
  roundAmounts(routes).then( /*#__PURE__*/function () {
19849
19849
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee4(roundedRoutes) {
19850
- var selectRoute, newSelectRoute, amountInWithSlippage, _amountInWithSlippage;
19850
+ var selectRoute, amountInWithSlippage, newSelectRoute, _amountInWithSlippage;
19851
19851
 
19852
19852
  return regenerator.wrap(function _callee4$(_context4) {
19853
19853
  while (1) {
19854
19854
  switch (_context4.prev = _context4.next) {
19855
19855
  case 0:
19856
19856
  if (!(typeof selectedRoute == 'undefined')) {
19857
- _context4.next = 4;
19857
+ _context4.next = 11;
19858
19858
  break;
19859
19859
  }
19860
19860
 
19861
19861
  selectRoute = roundedRoutes[0];
19862
- _context4.next = 13;
19863
- break;
19862
+ _context4.next = 4;
19863
+ return calculateAmountInWithSlippage(selectRoute);
19864
19864
 
19865
19865
  case 4:
19866
- newSelectRoute = roundedRoutes[allRoutes.findIndex(function (route) {
19867
- return route.fromToken == selectedRoute.fromToken && route.blockchain == selectedRoute.blockchain;
19868
- })];
19866
+ amountInWithSlippage = _context4.sent;
19869
19867
 
19870
- if (!(newSelectRoute && selectedRoute.fromAmount !== newSelectRoute.fromAmount)) {
19871
- _context4.next = 13;
19868
+ if (!amountInWithSlippage) {
19869
+ _context4.next = 8;
19872
19870
  break;
19873
19871
  }
19874
19872
 
19875
19873
  _context4.next = 8;
19876
- return calculateAmountInWithSlippage(newSelectRoute);
19874
+ return roundAmount(selectRoute, amountInWithSlippage);
19877
19875
 
19878
19876
  case 8:
19879
- amountInWithSlippage = _context4.sent;
19880
-
19881
- if (!amountInWithSlippage) {
19882
- _context4.next = 12;
19883
- break;
19884
- }
19885
-
19886
- _context4.next = 12;
19887
- return roundAmount(newSelectRoute, amountInWithSlippage);
19877
+ setSelectedRoute(selectRoute);
19878
+ _context4.next = 20;
19879
+ break;
19888
19880
 
19889
- case 12:
19890
- setUpdatedRouteWithNewPrice(newSelectRoute);
19881
+ case 11:
19882
+ newSelectRoute = roundedRoutes[roundedRoutes.findIndex(function (route) {
19883
+ return route.fromToken.address == selectedRoute.fromToken.address && route.blockchain == selectedRoute.blockchain;
19884
+ })];
19891
19885
 
19892
- case 13:
19893
- if (!selectRoute) {
19894
- _context4.next = 21;
19886
+ if (!newSelectRoute) {
19887
+ _context4.next = 20;
19895
19888
  break;
19896
19889
  }
19897
19890
 
19898
- _context4.next = 16;
19899
- return calculateAmountInWithSlippage(selectRoute);
19891
+ _context4.next = 15;
19892
+ return calculateAmountInWithSlippage(newSelectRoute);
19900
19893
 
19901
- case 16:
19894
+ case 15:
19902
19895
  _amountInWithSlippage = _context4.sent;
19903
19896
 
19904
19897
  if (!_amountInWithSlippage) {
19905
- _context4.next = 20;
19898
+ _context4.next = 19;
19906
19899
  break;
19907
19900
  }
19908
19901
 
19909
- _context4.next = 20;
19910
- return roundAmount(selectRoute, _amountInWithSlippage);
19902
+ _context4.next = 19;
19903
+ return roundAmount(newSelectRoute, _amountInWithSlippage);
19911
19904
 
19912
- case 20:
19913
- setSelectedRoute(selectRoute);
19905
+ case 19:
19906
+ if (_amountInWithSlippage == undefined || selectedRoute.fromAmount != _amountInWithSlippage.toString()) {
19907
+ setUpdatedRouteWithNewPrice(newSelectRoute);
19908
+ }
19914
19909
 
19915
- case 21:
19916
- _context4.next = 23;
19910
+ case 20:
19911
+ _context4.next = 22;
19917
19912
  return Promise.all(roundedRoutes.map( /*#__PURE__*/function () {
19918
19913
  var _ref5 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3(route, index) {
19919
19914
  var amountInWithSlippage;
@@ -19951,12 +19946,12 @@ var PaymentRoutingProvider = (function (props) {
19951
19946
  };
19952
19947
  }())).then(setAllRoutes);
19953
19948
 
19954
- case 23:
19949
+ case 22:
19955
19950
  if (props.setMaxRoute) {
19956
19951
  props.setMaxRoute(findMaxRoute(roundedRoutes));
19957
19952
  }
19958
19953
 
19959
- case 24:
19954
+ case 23:
19960
19955
  case "end":
19961
19956
  return _context4.stop();
19962
19957
  }