@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/umd/index.js CHANGED
@@ -19842,73 +19842,68 @@
19842
19842
  } else {
19843
19843
  roundAmounts(routes).then( /*#__PURE__*/function () {
19844
19844
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee4(roundedRoutes) {
19845
- var selectRoute, newSelectRoute, amountInWithSlippage, _amountInWithSlippage;
19845
+ var selectRoute, amountInWithSlippage, newSelectRoute, _amountInWithSlippage;
19846
19846
 
19847
19847
  return regenerator.wrap(function _callee4$(_context4) {
19848
19848
  while (1) {
19849
19849
  switch (_context4.prev = _context4.next) {
19850
19850
  case 0:
19851
19851
  if (!(typeof selectedRoute == 'undefined')) {
19852
- _context4.next = 4;
19852
+ _context4.next = 11;
19853
19853
  break;
19854
19854
  }
19855
19855
 
19856
19856
  selectRoute = roundedRoutes[0];
19857
- _context4.next = 13;
19858
- break;
19857
+ _context4.next = 4;
19858
+ return calculateAmountInWithSlippage(selectRoute);
19859
19859
 
19860
19860
  case 4:
19861
- newSelectRoute = roundedRoutes[allRoutes.findIndex(function (route) {
19862
- return route.fromToken == selectedRoute.fromToken && route.blockchain == selectedRoute.blockchain;
19863
- })];
19861
+ amountInWithSlippage = _context4.sent;
19864
19862
 
19865
- if (!(newSelectRoute && selectedRoute.fromAmount !== newSelectRoute.fromAmount)) {
19866
- _context4.next = 13;
19863
+ if (!amountInWithSlippage) {
19864
+ _context4.next = 8;
19867
19865
  break;
19868
19866
  }
19869
19867
 
19870
19868
  _context4.next = 8;
19871
- return calculateAmountInWithSlippage(newSelectRoute);
19869
+ return roundAmount(selectRoute, amountInWithSlippage);
19872
19870
 
19873
19871
  case 8:
19874
- amountInWithSlippage = _context4.sent;
19875
-
19876
- if (!amountInWithSlippage) {
19877
- _context4.next = 12;
19878
- break;
19879
- }
19880
-
19881
- _context4.next = 12;
19882
- return roundAmount(newSelectRoute, amountInWithSlippage);
19872
+ setSelectedRoute(selectRoute);
19873
+ _context4.next = 20;
19874
+ break;
19883
19875
 
19884
- case 12:
19885
- setUpdatedRouteWithNewPrice(newSelectRoute);
19876
+ case 11:
19877
+ newSelectRoute = roundedRoutes[roundedRoutes.findIndex(function (route) {
19878
+ return route.fromToken.address == selectedRoute.fromToken.address && route.blockchain == selectedRoute.blockchain;
19879
+ })];
19886
19880
 
19887
- case 13:
19888
- if (!selectRoute) {
19889
- _context4.next = 21;
19881
+ if (!newSelectRoute) {
19882
+ _context4.next = 20;
19890
19883
  break;
19891
19884
  }
19892
19885
 
19893
- _context4.next = 16;
19894
- return calculateAmountInWithSlippage(selectRoute);
19886
+ _context4.next = 15;
19887
+ return calculateAmountInWithSlippage(newSelectRoute);
19895
19888
 
19896
- case 16:
19889
+ case 15:
19897
19890
  _amountInWithSlippage = _context4.sent;
19898
19891
 
19899
19892
  if (!_amountInWithSlippage) {
19900
- _context4.next = 20;
19893
+ _context4.next = 19;
19901
19894
  break;
19902
19895
  }
19903
19896
 
19904
- _context4.next = 20;
19905
- return roundAmount(selectRoute, _amountInWithSlippage);
19897
+ _context4.next = 19;
19898
+ return roundAmount(newSelectRoute, _amountInWithSlippage);
19906
19899
 
19907
- case 20:
19908
- setSelectedRoute(selectRoute);
19900
+ case 19:
19901
+ if (_amountInWithSlippage == undefined || selectedRoute.fromAmount != _amountInWithSlippage.toString()) {
19902
+ setUpdatedRouteWithNewPrice(newSelectRoute);
19903
+ }
19909
19904
 
19910
- case 21:
19911
- _context4.next = 23;
19905
+ case 20:
19906
+ _context4.next = 22;
19912
19907
  return Promise.all(roundedRoutes.map( /*#__PURE__*/function () {
19913
19908
  var _ref5 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3(route, index) {
19914
19909
  var amountInWithSlippage;
@@ -19946,12 +19941,12 @@
19946
19941
  };
19947
19942
  }())).then(setAllRoutes);
19948
19943
 
19949
- case 23:
19944
+ case 22:
19950
19945
  if (props.setMaxRoute) {
19951
19946
  props.setMaxRoute(findMaxRoute(roundedRoutes));
19952
19947
  }
19953
19948
 
19954
- case 24:
19949
+ case 23:
19955
19950
  case "end":
19956
19951
  return _context4.stop();
19957
19952
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@depay/widgets",
3
3
  "moduleName": "DePayWidgets",
4
- "version": "7.16.3",
4
+ "version": "7.16.4",
5
5
  "description": "Web3 Payments with any token. DePay simplifies and improves Web3 Payments with the power of DeFi. Accept any token with on-the-fly conversion.",
6
6
  "main": "./dist/umd/index.js",
7
7
  "module": "./dist/esm/index.js",