@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.bundle.js +1 -1
- package/dist/esm/index.js +31 -36
- package/dist/umd/index.bundle.js +1 -1
- package/dist/umd/index.js +31 -36
- package/package.json +1 -1
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,
|
|
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 =
|
|
19852
|
+
_context4.next = 11;
|
|
19853
19853
|
break;
|
|
19854
19854
|
}
|
|
19855
19855
|
|
|
19856
19856
|
selectRoute = roundedRoutes[0];
|
|
19857
|
-
_context4.next =
|
|
19858
|
-
|
|
19857
|
+
_context4.next = 4;
|
|
19858
|
+
return calculateAmountInWithSlippage(selectRoute);
|
|
19859
19859
|
|
|
19860
19860
|
case 4:
|
|
19861
|
-
|
|
19862
|
-
return route.fromToken == selectedRoute.fromToken && route.blockchain == selectedRoute.blockchain;
|
|
19863
|
-
})];
|
|
19861
|
+
amountInWithSlippage = _context4.sent;
|
|
19864
19862
|
|
|
19865
|
-
if (!
|
|
19866
|
-
_context4.next =
|
|
19863
|
+
if (!amountInWithSlippage) {
|
|
19864
|
+
_context4.next = 8;
|
|
19867
19865
|
break;
|
|
19868
19866
|
}
|
|
19869
19867
|
|
|
19870
19868
|
_context4.next = 8;
|
|
19871
|
-
return
|
|
19869
|
+
return roundAmount(selectRoute, amountInWithSlippage);
|
|
19872
19870
|
|
|
19873
19871
|
case 8:
|
|
19874
|
-
|
|
19875
|
-
|
|
19876
|
-
|
|
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
|
|
19885
|
-
|
|
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
|
-
|
|
19888
|
-
|
|
19889
|
-
_context4.next = 21;
|
|
19881
|
+
if (!newSelectRoute) {
|
|
19882
|
+
_context4.next = 20;
|
|
19890
19883
|
break;
|
|
19891
19884
|
}
|
|
19892
19885
|
|
|
19893
|
-
_context4.next =
|
|
19894
|
-
return calculateAmountInWithSlippage(
|
|
19886
|
+
_context4.next = 15;
|
|
19887
|
+
return calculateAmountInWithSlippage(newSelectRoute);
|
|
19895
19888
|
|
|
19896
|
-
case
|
|
19889
|
+
case 15:
|
|
19897
19890
|
_amountInWithSlippage = _context4.sent;
|
|
19898
19891
|
|
|
19899
19892
|
if (!_amountInWithSlippage) {
|
|
19900
|
-
_context4.next =
|
|
19893
|
+
_context4.next = 19;
|
|
19901
19894
|
break;
|
|
19902
19895
|
}
|
|
19903
19896
|
|
|
19904
|
-
_context4.next =
|
|
19905
|
-
return roundAmount(
|
|
19897
|
+
_context4.next = 19;
|
|
19898
|
+
return roundAmount(newSelectRoute, _amountInWithSlippage);
|
|
19906
19899
|
|
|
19907
|
-
case
|
|
19908
|
-
|
|
19900
|
+
case 19:
|
|
19901
|
+
if (_amountInWithSlippage == undefined || selectedRoute.fromAmount != _amountInWithSlippage.toString()) {
|
|
19902
|
+
setUpdatedRouteWithNewPrice(newSelectRoute);
|
|
19903
|
+
}
|
|
19909
19904
|
|
|
19910
|
-
case
|
|
19911
|
-
_context4.next =
|
|
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
|
|
19944
|
+
case 22:
|
|
19950
19945
|
if (props.setMaxRoute) {
|
|
19951
19946
|
props.setMaxRoute(findMaxRoute(roundedRoutes));
|
|
19952
19947
|
}
|
|
19953
19948
|
|
|
19954
|
-
case
|
|
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.
|
|
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",
|