@depay/widgets 6.28.1 → 6.28.2

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.
@@ -62159,6 +62159,10 @@ var ChangableAmountProvider = (function (props) {
62159
62159
  }));
62160
62160
  } else {
62161
62161
  Promise.all(props.accept.map(function (configuration) {
62162
+ if (CONSTANTS$2[configuration.blockchain].USD.toLowerCase() == configuration.token.toLowerCase()) {
62163
+ return 1.00 / conversionRate;
62164
+ }
62165
+
62162
62166
  return route$8({
62163
62167
  blockchain: configuration.blockchain,
62164
62168
  tokenIn: CONSTANTS$2[configuration.blockchain].USD,
@@ -62167,17 +62171,19 @@ var ChangableAmountProvider = (function (props) {
62167
62171
  fromAddress: account,
62168
62172
  toAddress: account
62169
62173
  });
62170
- })).then(function (routes) {
62171
- Promise.all(routes.map(function (routes, index) {
62172
- if (routes[0] == undefined) {
62174
+ })).then(function (results) {
62175
+ Promise.all(results.map(function (result, index) {
62176
+ if (typeof result == 'number') {
62177
+ return result;
62178
+ } else if (result[0] == undefined) {
62173
62179
  return;
62180
+ } else {
62181
+ return Token.readable({
62182
+ blockchain: props.accept[index].blockchain,
62183
+ amount: result[0].amountOut,
62184
+ address: result[0].tokenOut
62185
+ });
62174
62186
  }
62175
-
62176
- return Token.readable({
62177
- blockchain: props.accept[index].blockchain,
62178
- amount: routes[0].amountOut,
62179
- address: routes[0].tokenOut
62180
- });
62181
62187
  })).then(resolve)["catch"](setError);
62182
62188
  })["catch"](setError);
62183
62189
  }
@@ -85810,8 +85816,6 @@ var PaymentRoutingProvider = (function (props) {
85810
85816
  recover = _useContext3.recover;
85811
85817
 
85812
85818
  var onRoutesUpdate = function onRoutesUpdate(routes) {
85813
- console.log('routes', routes);
85814
-
85815
85819
  if (routes.length == 0) {
85816
85820
  setAllRoutes([]);
85817
85821
 
package/dist/esm/index.js CHANGED
@@ -2107,6 +2107,10 @@ var ChangableAmountProvider = (function (props) {
2107
2107
  }));
2108
2108
  } else {
2109
2109
  Promise.all(props.accept.map(function (configuration) {
2110
+ if (CONSTANTS[configuration.blockchain].USD.toLowerCase() == configuration.token.toLowerCase()) {
2111
+ return 1.00 / conversionRate;
2112
+ }
2113
+
2110
2114
  return route({
2111
2115
  blockchain: configuration.blockchain,
2112
2116
  tokenIn: CONSTANTS[configuration.blockchain].USD,
@@ -2115,17 +2119,19 @@ var ChangableAmountProvider = (function (props) {
2115
2119
  fromAddress: account,
2116
2120
  toAddress: account
2117
2121
  });
2118
- })).then(function (routes) {
2119
- Promise.all(routes.map(function (routes, index) {
2120
- if (routes[0] == undefined) {
2122
+ })).then(function (results) {
2123
+ Promise.all(results.map(function (result, index) {
2124
+ if (typeof result == 'number') {
2125
+ return result;
2126
+ } else if (result[0] == undefined) {
2121
2127
  return;
2128
+ } else {
2129
+ return Token.readable({
2130
+ blockchain: props.accept[index].blockchain,
2131
+ amount: result[0].amountOut,
2132
+ address: result[0].tokenOut
2133
+ });
2122
2134
  }
2123
-
2124
- return Token.readable({
2125
- blockchain: props.accept[index].blockchain,
2126
- amount: routes[0].amountOut,
2127
- address: routes[0].tokenOut
2128
- });
2129
2135
  })).then(resolve)["catch"](setError);
2130
2136
  })["catch"](setError);
2131
2137
  }
@@ -2674,8 +2680,6 @@ var PaymentRoutingProvider = (function (props) {
2674
2680
  recover = _useContext3.recover;
2675
2681
 
2676
2682
  var onRoutesUpdate = function onRoutesUpdate(routes) {
2677
- console.log('routes', routes);
2678
-
2679
2683
  if (routes.length == 0) {
2680
2684
  setAllRoutes([]);
2681
2685
 
@@ -62165,6 +62165,10 @@
62165
62165
  }));
62166
62166
  } else {
62167
62167
  Promise.all(props.accept.map(function (configuration) {
62168
+ if (CONSTANTS$2[configuration.blockchain].USD.toLowerCase() == configuration.token.toLowerCase()) {
62169
+ return 1.00 / conversionRate;
62170
+ }
62171
+
62168
62172
  return route$8({
62169
62173
  blockchain: configuration.blockchain,
62170
62174
  tokenIn: CONSTANTS$2[configuration.blockchain].USD,
@@ -62173,17 +62177,19 @@
62173
62177
  fromAddress: account,
62174
62178
  toAddress: account
62175
62179
  });
62176
- })).then(function (routes) {
62177
- Promise.all(routes.map(function (routes, index) {
62178
- if (routes[0] == undefined) {
62180
+ })).then(function (results) {
62181
+ Promise.all(results.map(function (result, index) {
62182
+ if (typeof result == 'number') {
62183
+ return result;
62184
+ } else if (result[0] == undefined) {
62179
62185
  return;
62186
+ } else {
62187
+ return Token.readable({
62188
+ blockchain: props.accept[index].blockchain,
62189
+ amount: result[0].amountOut,
62190
+ address: result[0].tokenOut
62191
+ });
62180
62192
  }
62181
-
62182
- return Token.readable({
62183
- blockchain: props.accept[index].blockchain,
62184
- amount: routes[0].amountOut,
62185
- address: routes[0].tokenOut
62186
- });
62187
62193
  })).then(resolve)["catch"](setError);
62188
62194
  })["catch"](setError);
62189
62195
  }
@@ -85816,8 +85822,6 @@
85816
85822
  recover = _useContext3.recover;
85817
85823
 
85818
85824
  var onRoutesUpdate = function onRoutesUpdate(routes) {
85819
- console.log('routes', routes);
85820
-
85821
85825
  if (routes.length == 0) {
85822
85826
  setAllRoutes([]);
85823
85827
 
package/dist/umd/index.js CHANGED
@@ -2102,6 +2102,10 @@
2102
2102
  }));
2103
2103
  } else {
2104
2104
  Promise.all(props.accept.map(function (configuration) {
2105
+ if (web3Constants.CONSTANTS[configuration.blockchain].USD.toLowerCase() == configuration.token.toLowerCase()) {
2106
+ return 1.00 / conversionRate;
2107
+ }
2108
+
2105
2109
  return web3Exchanges.route({
2106
2110
  blockchain: configuration.blockchain,
2107
2111
  tokenIn: web3Constants.CONSTANTS[configuration.blockchain].USD,
@@ -2110,17 +2114,19 @@
2110
2114
  fromAddress: account,
2111
2115
  toAddress: account
2112
2116
  });
2113
- })).then(function (routes) {
2114
- Promise.all(routes.map(function (routes, index) {
2115
- if (routes[0] == undefined) {
2117
+ })).then(function (results) {
2118
+ Promise.all(results.map(function (result, index) {
2119
+ if (typeof result == 'number') {
2120
+ return result;
2121
+ } else if (result[0] == undefined) {
2116
2122
  return;
2123
+ } else {
2124
+ return web3Tokens.Token.readable({
2125
+ blockchain: props.accept[index].blockchain,
2126
+ amount: result[0].amountOut,
2127
+ address: result[0].tokenOut
2128
+ });
2117
2129
  }
2118
-
2119
- return web3Tokens.Token.readable({
2120
- blockchain: props.accept[index].blockchain,
2121
- amount: routes[0].amountOut,
2122
- address: routes[0].tokenOut
2123
- });
2124
2130
  })).then(resolve)["catch"](setError);
2125
2131
  })["catch"](setError);
2126
2132
  }
@@ -2669,8 +2675,6 @@
2669
2675
  recover = _useContext3.recover;
2670
2676
 
2671
2677
  var onRoutesUpdate = function onRoutesUpdate(routes) {
2672
- console.log('routes', routes);
2673
-
2674
2678
  if (routes.length == 0) {
2675
2679
  setAllRoutes([]);
2676
2680
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@depay/widgets",
3
3
  "moduleName": "DePayWidgets",
4
- "version": "6.28.1",
4
+ "version": "6.28.2",
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",