@depay/widgets 7.5.0 → 7.5.1

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
@@ -20110,9 +20110,9 @@
20110
20110
 
20111
20111
  Promise.all([web3Exchanges.route({
20112
20112
  blockchain: payment.route.blockchain,
20113
- tokenIn: payment.route.toToken.address,
20113
+ tokenIn: payment.route.fromToken.address,
20114
20114
  tokenOut: web3Constants.CONSTANTS[payment.route.blockchain].USD,
20115
- amountIn: payment.route.toAmount,
20115
+ amountIn: payment.route.fromAmount,
20116
20116
  fromAddress: account,
20117
20117
  toAddress: account
20118
20118
  }), !payment.route.directTransfer ? web3Exchanges.route({
@@ -20127,11 +20127,11 @@
20127
20127
  address: web3Constants.CONSTANTS[payment.route.blockchain].USD
20128
20128
  }).decimals()]).then(function (_ref2) {
20129
20129
  var _ref3 = _slicedToArray(_ref2, 3),
20130
- toTokenUSDExchangeRoutes = _ref3[0],
20130
+ fromTokenUSDExchangeRoutes = _ref3[0],
20131
20131
  reverseRoutes = _ref3[1],
20132
20132
  USDDecimals = _ref3[2];
20133
20133
 
20134
- var toTokenUSDRoute = toTokenUSDExchangeRoutes[0];
20134
+ var fromTokenUSDRoute = fromTokenUSDExchangeRoutes[0];
20135
20135
  var reverseRoute = reverseRoutes[0];
20136
20136
 
20137
20137
  if (reverseRoute) {
@@ -20146,20 +20146,20 @@
20146
20146
  }
20147
20147
  }
20148
20148
 
20149
- var toTokenUSDAmount;
20149
+ var fromTokenUSDAmount;
20150
20150
 
20151
- if (payment.route.toToken.address.toLowerCase() == web3Constants.CONSTANTS[payment.route.blockchain].USD.toLowerCase()) {
20152
- toTokenUSDAmount = payment.route.toAmount.toString();
20153
- } else if (toTokenUSDRoute == undefined) {
20151
+ if (payment.route.fromToken.address.toLowerCase() == web3Constants.CONSTANTS[payment.route.blockchain].USD.toLowerCase()) {
20152
+ fromTokenUSDAmount = payment.route.fromAmount.toString();
20153
+ } else if (fromTokenUSDRoute == undefined) {
20154
20154
  setPaymentValue('');
20155
20155
  return;
20156
20156
  } else {
20157
- toTokenUSDAmount = toTokenUSDRoute.amountOut.toString();
20157
+ fromTokenUSDAmount = fromTokenUSDRoute.amountOut.toString();
20158
20158
  }
20159
20159
 
20160
- var toTokenUSDValue = ethers.ethers.utils.formatUnits(toTokenUSDAmount, USDDecimals);
20160
+ var fromTokenUSDValue = ethers.ethers.utils.formatUnits(fromTokenUSDAmount, USDDecimals);
20161
20161
  localCurrency.Currency.fromUSD({
20162
- amount: toTokenUSDValue,
20162
+ amount: fromTokenUSDValue,
20163
20163
  code: currency
20164
20164
  }).then(setPaymentValue);
20165
20165
  })["catch"](setError);
@@ -20762,12 +20762,12 @@
20762
20762
 
20763
20763
  if (amount && configuredAmount && configuredAmount.currency && configuredAmount.fix) {
20764
20764
  displayedAmount = paymentValue.toString();
20765
- } else if (amount && (configuredAmount == undefined || configuredAmount.token != true)) {
20765
+ } else if (amount && (configuredAmount == undefined || (configuredAmount === null || configuredAmount === void 0 ? void 0 : configuredAmount.token) != true)) {
20766
20766
  displayedAmount = new localCurrency.Currency({
20767
20767
  amount: amount.toFixed(2),
20768
20768
  code: currencyCode
20769
20769
  }).toString();
20770
- } else if (paymentValue && paymentValue.toString().length) {
20770
+ } else if (paymentValue && paymentValue.toString().length && (configuredAmount === null || configuredAmount === void 0 ? void 0 : configuredAmount.token) != true) {
20771
20771
  displayedAmount = paymentValue.toString();
20772
20772
  } else {
20773
20773
  displayedAmount = "".concat(payment.symbol, " ").concat(payment.amount);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@depay/widgets",
3
3
  "moduleName": "DePayWidgets",
4
- "version": "7.5.0",
4
+ "version": "7.5.1",
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",