@depay/widgets 4.2.1 → 4.4.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/README.md +15 -1
- package/dist/cjs/index.bundle.js +6789 -2975
- package/dist/cjs/index.js +92 -82
- package/dist/es/index.bundle.js +6789 -2975
- package/dist/es/index.js +43 -33
- package/dist/umd/index.bundle.js +6789 -2975
- package/dist/umd/index.js +84 -74
- package/package.json +14 -14
package/dist/cjs/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var reactDialogStack = require('@depay/react-dialog-stack');
|
|
5
|
+
var web3Wallets = require('@depay/web3-wallets');
|
|
6
6
|
var ReactDOM = require('react-dom');
|
|
7
|
-
var
|
|
7
|
+
var reactShadowDom = require('@depay/react-shadow-dom');
|
|
8
8
|
var ethers = require('ethers');
|
|
9
|
-
var
|
|
9
|
+
var web3Constants = require('@depay/web3-constants');
|
|
10
10
|
var decimal_js = require('decimal.js');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
11
|
+
var web3Exchanges = require('@depay/web3-exchanges');
|
|
12
|
+
var web3Tokens = require('@depay/web3-tokens');
|
|
13
|
+
var localCurrency = require('@depay/local-currency');
|
|
14
|
+
var web3Client = require('@depay/web3-client');
|
|
15
|
+
var web3Payments = require('@depay/web3-payments');
|
|
16
16
|
var Slider = require('react-rangeslider');
|
|
17
|
-
var
|
|
18
|
-
var
|
|
17
|
+
var reactTokenImage = require('@depay/react-token-image');
|
|
18
|
+
var web3Blockchains = require('@depay/web3-blockchains');
|
|
19
19
|
|
|
20
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
21
|
|
|
@@ -969,7 +969,7 @@ var CloseIcon = (function () {
|
|
|
969
969
|
});
|
|
970
970
|
|
|
971
971
|
var Dialog$1 = (function (props) {
|
|
972
|
-
var _useContext = React.useContext(
|
|
972
|
+
var _useContext = React.useContext(reactDialogStack.NavigateStackContext),
|
|
973
973
|
navigate = _useContext.navigate;
|
|
974
974
|
|
|
975
975
|
var _useContext2 = React.useContext(ClosableContext),
|
|
@@ -1009,7 +1009,7 @@ var Dialog$1 = (function (props) {
|
|
|
1009
1009
|
});
|
|
1010
1010
|
|
|
1011
1011
|
var ConnectingWalletDialog = (function (props) {
|
|
1012
|
-
var _useContext = React.useContext(
|
|
1012
|
+
var _useContext = React.useContext(reactDialogStack.NavigateStackContext),
|
|
1013
1013
|
navigate = _useContext.navigate;
|
|
1014
1014
|
|
|
1015
1015
|
var wallet = props.wallet;
|
|
@@ -1086,10 +1086,10 @@ var SelectWalletDialog = (function (props) {
|
|
|
1086
1086
|
showExplanation = _useState2[0],
|
|
1087
1087
|
setShowExplanation = _useState2[1];
|
|
1088
1088
|
|
|
1089
|
-
var _useContext = React.useContext(
|
|
1089
|
+
var _useContext = React.useContext(reactDialogStack.NavigateStackContext),
|
|
1090
1090
|
navigate = _useContext.navigate;
|
|
1091
1091
|
|
|
1092
|
-
var wallet =
|
|
1092
|
+
var wallet = web3Wallets.getWallet();
|
|
1093
1093
|
React.useEffect( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
|
|
1094
1094
|
var accounts;
|
|
1095
1095
|
return regenerator.wrap(function _callee$(_context) {
|
|
@@ -1125,7 +1125,7 @@ var SelectWalletDialog = (function (props) {
|
|
|
1125
1125
|
props.connect(wallet);
|
|
1126
1126
|
};
|
|
1127
1127
|
|
|
1128
|
-
var availableWallets = [
|
|
1128
|
+
var availableWallets = [web3Wallets.wallets.WalletConnect];
|
|
1129
1129
|
|
|
1130
1130
|
if (wallet) {
|
|
1131
1131
|
availableWallets.unshift(wallet);
|
|
@@ -1233,7 +1233,7 @@ var ConnectStack = (function (props) {
|
|
|
1233
1233
|
};
|
|
1234
1234
|
|
|
1235
1235
|
React.useEffect(function () {
|
|
1236
|
-
var wallet =
|
|
1236
|
+
var wallet = web3Wallets.getWallet();
|
|
1237
1237
|
|
|
1238
1238
|
if (wallet) {
|
|
1239
1239
|
setWallet(wallet);
|
|
@@ -1273,7 +1273,7 @@ var ConnectStack = (function (props) {
|
|
|
1273
1273
|
}
|
|
1274
1274
|
}, _callee2);
|
|
1275
1275
|
})), [wallet]);
|
|
1276
|
-
return /*#__PURE__*/React__default$1["default"].createElement(
|
|
1276
|
+
return /*#__PURE__*/React__default$1["default"].createElement(reactDialogStack.ReactDialogStack, {
|
|
1277
1277
|
open: open,
|
|
1278
1278
|
close: close,
|
|
1279
1279
|
start: "SelectWallet",
|
|
@@ -1385,8 +1385,7 @@ function ReactDialogStyle (styles) {
|
|
|
1385
1385
|
let background =
|
|
1386
1386
|
typeof styles === 'object' && styles.background ? styles.background : 'rgba(0,0,0,0.4)';
|
|
1387
1387
|
|
|
1388
|
-
return
|
|
1389
|
-
`
|
|
1388
|
+
return `
|
|
1390
1389
|
.ReactDialog {
|
|
1391
1390
|
bottom: 0;
|
|
1392
1391
|
display: table;
|
|
@@ -1445,12 +1444,9 @@ function ReactDialogStyle (styles) {
|
|
|
1445
1444
|
top: -5vh;
|
|
1446
1445
|
}
|
|
1447
1446
|
`
|
|
1448
|
-
)
|
|
1449
1447
|
}
|
|
1450
1448
|
|
|
1451
|
-
const _jsxFileName = "/
|
|
1452
|
-
|
|
1453
|
-
|
|
1449
|
+
const _jsxFileName = "/home/runner/work/react-dialog/react-dialog/src/components/Dialog.jsx";
|
|
1454
1450
|
class Dialog extends React__default['default'].Component {
|
|
1455
1451
|
constructor(props) {
|
|
1456
1452
|
super(props);
|
|
@@ -1512,7 +1508,7 @@ class Dialog extends React__default['default'].Component {
|
|
|
1512
1508
|
}
|
|
1513
1509
|
}
|
|
1514
1510
|
|
|
1515
|
-
const _jsxFileName$1 = "/
|
|
1511
|
+
const _jsxFileName$1 = "/home/runner/work/react-dialog/react-dialog/src/index.jsx";
|
|
1516
1512
|
class ReactDialog extends React__default['default'].Component {
|
|
1517
1513
|
constructor(props) {
|
|
1518
1514
|
super(props);
|
|
@@ -1676,7 +1672,7 @@ var CardStyle = (function (style) {
|
|
|
1676
1672
|
});
|
|
1677
1673
|
|
|
1678
1674
|
var DialogStyle = (function (style) {
|
|
1679
|
-
return "\n\n .ReactDialogBackground {\n background: rgba(0,0,0,0.7);\n }\n\n .Dialog {\n margin: 0 auto;\n position: relative;\n width: 420px;\n box-shadow: 0 0 20px rgba(0,0,0,0.1);\n border-radius: 0.8rem;\n }\n\n @media screen and (max-width: 450px) {\n \n .Dialog, .ReactDialogAnimation {\n width: 100%;\n }\n\n }\n\n @media (orientation: portrait) and (max-width: 900px) {\n\n .Dialog {\n align-content: stretch;\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .DialogBody {\n flex: 1;\n align-items: flex-end;\n max-height: 40vh !important;\n }\n\n .FooterLink {\n bottom: 0;\n left: 0;\n position: absolute;\n padding-bottom: 1rem;\n right: 0;\n width: 100%;\n }\n\n .DialogFooter {\n padding-bottom: 50px;\n }\n\n .ReactDialogStackCell {\n vertical-align: bottom;\n }\n\n .ReactDialogAnimation {\n bottom: -100px !important;\n max-height: 66vh !important;\n top: inherit !important;\n transition: opacity 0.4s ease, bottom 0.4s ease;\n }\n\n .ReactDialog.ReactDialogOpen .ReactDialogAnimation {\n bottom: 0px !important;\n }\n\n .DialogFooter {\n border-bottom-left-radius: 0 !important;\n border-bottom-right-radius: 0 !important;\n }\n }\n\n .DialogBody {\n background: rgb(248,248,248);\n overflow-x: hidden;\n overflow-y: auto;\n }\n\n .DialogBody.HeightAuto {\n height: auto;\n }\n\n .DialogHeader {\n background: rgb(248,248,248);\n border-top-left-radius: 0.8rem;\n border-top-right-radius: 0.8rem;\n display: flex;\n flex-direction: row;\n position: relative;\n }\n\n .DialogHeaderTitle {\n flex-basis: auto;\n flex-grow: 1;\n }\n \n .DialogHeaderAction {\n height: 3rem;\n }\n\n .DialogFooter {\n background: rgb(248,248,248);\n border-bottom-left-radius: 0.8rem;\n border-bottom-right-radius: 0.8rem;\n line-height: 1.5rem;\n min-height: 2rem;\n position: relative;\n text-align: center;\n }\n\n .ReactShadowDOMInsideContainer > .ReactDialog {\n display: table;\n }\n\n ";
|
|
1675
|
+
return "\n\n .ReactDialogBackground {\n backdrop-filter: blur(5px);\n background: rgba(0,0,0,0.7);\n }\n\n .Dialog {\n margin: 0 auto;\n position: relative;\n width: 420px;\n box-shadow: 0 0 20px rgba(0,0,0,0.1);\n border-radius: 0.8rem;\n }\n\n @media screen and (max-width: 450px) {\n \n .Dialog, .ReactDialogAnimation {\n width: 100%;\n }\n\n }\n\n @media (orientation: portrait) and (max-width: 900px) {\n\n .Dialog {\n align-content: stretch;\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .DialogBody {\n flex: 1;\n align-items: flex-end;\n max-height: 40vh !important;\n }\n\n .FooterLink {\n bottom: 0;\n left: 0;\n position: absolute;\n padding-bottom: 1rem;\n right: 0;\n width: 100%;\n }\n\n .DialogFooter {\n padding-bottom: 50px;\n }\n\n .ReactDialogStackCell {\n vertical-align: bottom;\n }\n\n .ReactDialogAnimation {\n bottom: -100px !important;\n max-height: 66vh !important;\n top: inherit !important;\n transition: opacity 0.4s ease, bottom 0.4s ease;\n }\n\n .ReactDialog.ReactDialogOpen .ReactDialogAnimation {\n bottom: 0px !important;\n }\n\n .DialogFooter {\n border-bottom-left-radius: 0 !important;\n border-bottom-right-radius: 0 !important;\n }\n }\n\n .DialogBody {\n background: rgb(248,248,248);\n overflow-x: hidden;\n overflow-y: auto;\n }\n\n .DialogBody.HeightAuto {\n height: auto;\n }\n\n .DialogHeader {\n background: rgb(248,248,248);\n border-top-left-radius: 0.8rem;\n border-top-right-radius: 0.8rem;\n display: flex;\n flex-direction: row;\n position: relative;\n }\n\n .DialogHeaderTitle {\n flex-basis: auto;\n flex-grow: 1;\n }\n \n .DialogHeaderAction {\n height: 3rem;\n }\n\n .DialogFooter {\n background: rgb(248,248,248);\n border-bottom-left-radius: 0.8rem;\n border-bottom-right-radius: 0.8rem;\n line-height: 1.5rem;\n min-height: 2rem;\n position: relative;\n text-align: center;\n }\n\n .ReactShadowDOMInsideContainer > .ReactDialog {\n display: table;\n }\n\n ";
|
|
1680
1676
|
});
|
|
1681
1677
|
|
|
1682
1678
|
var FontStyle = (function (style) {
|
|
@@ -1777,7 +1773,7 @@ var mount = (function (_ref, content) {
|
|
|
1777
1773
|
}, 300);
|
|
1778
1774
|
};
|
|
1779
1775
|
|
|
1780
|
-
var _ReactShadowDOM =
|
|
1776
|
+
var _ReactShadowDOM = reactShadowDom.ReactShadowDOM({
|
|
1781
1777
|
document: document,
|
|
1782
1778
|
element: document.body,
|
|
1783
1779
|
content: content(unmountShadowDOM),
|
|
@@ -1805,7 +1801,7 @@ var Connect = function Connect(options) {
|
|
|
1805
1801
|
while (1) {
|
|
1806
1802
|
switch (_context.prev = _context.next) {
|
|
1807
1803
|
case 0:
|
|
1808
|
-
wallet =
|
|
1804
|
+
wallet = web3Wallets.getWallet();
|
|
1809
1805
|
|
|
1810
1806
|
if (!wallet) {
|
|
1811
1807
|
_context.next = 7;
|
|
@@ -2011,9 +2007,9 @@ var ChangableAmountProvider = (function (props) {
|
|
|
2011
2007
|
React.useEffect(function () {
|
|
2012
2008
|
if (amountsMissing && account && conversionRate) {
|
|
2013
2009
|
Promise.all(props.accept.map(function (configuration) {
|
|
2014
|
-
return
|
|
2010
|
+
return web3Exchanges.route({
|
|
2015
2011
|
blockchain: configuration.blockchain,
|
|
2016
|
-
tokenIn:
|
|
2012
|
+
tokenIn: web3Constants.CONSTANTS[configuration.blockchain].USD,
|
|
2017
2013
|
amountIn: 1.00 / conversionRate * amount,
|
|
2018
2014
|
tokenOut: configuration.token,
|
|
2019
2015
|
fromAddress: account,
|
|
@@ -2025,19 +2021,25 @@ var ChangableAmountProvider = (function (props) {
|
|
|
2025
2021
|
return;
|
|
2026
2022
|
}
|
|
2027
2023
|
|
|
2028
|
-
return
|
|
2024
|
+
return web3Tokens.Token.readable({
|
|
2029
2025
|
blockchain: props.accept[index].blockchain,
|
|
2030
2026
|
amount: routes[0].amountOut,
|
|
2031
2027
|
address: routes[0].tokenOut
|
|
2032
2028
|
});
|
|
2033
2029
|
})).then(function (amounts) {
|
|
2034
2030
|
setAcceptWithAmount(props.accept.map(function (configuration, index) {
|
|
2031
|
+
if (amounts[index] == undefined) {
|
|
2032
|
+
return;
|
|
2033
|
+
}
|
|
2034
|
+
|
|
2035
2035
|
return {
|
|
2036
2036
|
blockchain: configuration.blockchain,
|
|
2037
|
-
amount: round(amounts[index])
|
|
2037
|
+
amount: round(amounts[index]),
|
|
2038
2038
|
token: configuration.token,
|
|
2039
2039
|
receiver: configuration.receiver || account
|
|
2040
2040
|
};
|
|
2041
|
+
}).filter(function (configuration) {
|
|
2042
|
+
return !!configuration;
|
|
2041
2043
|
}));
|
|
2042
2044
|
})["catch"](setError);
|
|
2043
2045
|
})["catch"](setError);
|
|
@@ -2046,23 +2048,23 @@ var ChangableAmountProvider = (function (props) {
|
|
|
2046
2048
|
React.useEffect(function () {
|
|
2047
2049
|
if (amountsMissing && maxRoute) {
|
|
2048
2050
|
maxRoute.fromToken.readable(maxRoute.fromBalance).then(function (readableMaxAmount) {
|
|
2049
|
-
if (maxRoute.fromToken.address ==
|
|
2051
|
+
if (maxRoute.fromToken.address == web3Constants.CONSTANTS[maxRoute.blockchain].USD) {
|
|
2050
2052
|
var _maxAmount = parseFloat(new decimal_js.Decimal(readableMaxAmount).mul(conversionRate).toString());
|
|
2051
2053
|
|
|
2052
2054
|
setMaxAmount(_maxAmount > 10 ? Math.round(_maxAmount) : _maxAmount);
|
|
2053
2055
|
} else {
|
|
2054
|
-
|
|
2056
|
+
web3Exchanges.route({
|
|
2055
2057
|
blockchain: maxRoute.blockchain,
|
|
2056
2058
|
tokenIn: maxRoute.fromToken.address,
|
|
2057
|
-
tokenOut:
|
|
2059
|
+
tokenOut: web3Constants.CONSTANTS[maxRoute.blockchain].USD,
|
|
2058
2060
|
amountIn: parseFloat(readableMaxAmount),
|
|
2059
2061
|
fromAddress: account,
|
|
2060
2062
|
toAddress: account
|
|
2061
2063
|
}).then(function (routes) {
|
|
2062
|
-
|
|
2064
|
+
web3Tokens.Token.readable({
|
|
2063
2065
|
amount: routes[0].amountOut,
|
|
2064
2066
|
blockchain: maxRoute.blockchain,
|
|
2065
|
-
address:
|
|
2067
|
+
address: web3Constants.CONSTANTS[maxRoute.blockchain].USD
|
|
2066
2068
|
}).then(function (readableMaxAmount) {
|
|
2067
2069
|
var slippage = 1.01;
|
|
2068
2070
|
var maxAmount = parseFloat(new decimal_js.Decimal(readableMaxAmount).div(slippage).mul(conversionRate).toString());
|
|
@@ -2088,13 +2090,13 @@ var ChangableAmountProvider = (function (props) {
|
|
|
2088
2090
|
});
|
|
2089
2091
|
|
|
2090
2092
|
var ConfigurationProvider = (function (props) {
|
|
2091
|
-
var currencyCode = new
|
|
2093
|
+
var currencyCode = new localCurrency.Currency({
|
|
2092
2094
|
code: props.configuration.currency
|
|
2093
2095
|
}).code;
|
|
2094
2096
|
React.useEffect(function () {
|
|
2095
2097
|
if (props.configuration.providers != undefined) {
|
|
2096
2098
|
Object.entries(props.configuration.providers).forEach(function (entry) {
|
|
2097
|
-
|
|
2099
|
+
web3Client.setProviderEndpoints(entry[0], entry[1]);
|
|
2098
2100
|
});
|
|
2099
2101
|
}
|
|
2100
2102
|
}, [props.configuration]);
|
|
@@ -2120,7 +2122,7 @@ var ConversionRateProvider = (function (props) {
|
|
|
2120
2122
|
setConversionRate = _useState2[1];
|
|
2121
2123
|
|
|
2122
2124
|
React.useEffect(function () {
|
|
2123
|
-
|
|
2125
|
+
localCurrency.Currency.fromUSD({
|
|
2124
2126
|
amount: 1,
|
|
2125
2127
|
code: currency,
|
|
2126
2128
|
apiKey: apiKey
|
|
@@ -2318,7 +2320,7 @@ var PaymentProvider = (function (props) {
|
|
|
2318
2320
|
}, [allRoutes]);
|
|
2319
2321
|
|
|
2320
2322
|
if (allRoutes instanceof Array && allRoutes.length == 0) {
|
|
2321
|
-
return /*#__PURE__*/React__default$1["default"].createElement(
|
|
2323
|
+
return /*#__PURE__*/React__default$1["default"].createElement(reactDialogStack.ReactDialogStack, {
|
|
2322
2324
|
open: open,
|
|
2323
2325
|
close: close,
|
|
2324
2326
|
start: "NoPaymentMethodFound",
|
|
@@ -2401,7 +2403,7 @@ var PaymentRoutingProvider = (function (props) {
|
|
|
2401
2403
|
return;
|
|
2402
2404
|
}
|
|
2403
2405
|
|
|
2404
|
-
|
|
2406
|
+
web3Payments.route({
|
|
2405
2407
|
accept: props.accept.map(prepareAcceptedPayments),
|
|
2406
2408
|
whitelist: props.whitelist,
|
|
2407
2409
|
blacklist: props.blacklist,
|
|
@@ -2563,16 +2565,16 @@ var PaymentValueProvider = (function (props) {
|
|
|
2563
2565
|
return;
|
|
2564
2566
|
}
|
|
2565
2567
|
|
|
2566
|
-
Promise.all([
|
|
2568
|
+
Promise.all([web3Exchanges.route({
|
|
2567
2569
|
blockchain: payment.route.blockchain,
|
|
2568
2570
|
tokenIn: payment.route.toToken.address,
|
|
2569
|
-
tokenOut:
|
|
2571
|
+
tokenOut: web3Constants.CONSTANTS[payment.route.blockchain].USD,
|
|
2570
2572
|
amountIn: payment.route.toAmount,
|
|
2571
2573
|
fromAddress: account,
|
|
2572
2574
|
toAddress: account
|
|
2573
|
-
}), new
|
|
2575
|
+
}), new web3Tokens.Token({
|
|
2574
2576
|
blockchain: payment.route.blockchain,
|
|
2575
|
-
address:
|
|
2577
|
+
address: web3Constants.CONSTANTS[payment.route.blockchain].USD
|
|
2576
2578
|
}).decimals()]).then(function (_ref2) {
|
|
2577
2579
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
2578
2580
|
USDExchangeRoutes = _ref3[0],
|
|
@@ -2581,7 +2583,7 @@ var PaymentValueProvider = (function (props) {
|
|
|
2581
2583
|
var USDRoute = USDExchangeRoutes[0];
|
|
2582
2584
|
var USDAmount;
|
|
2583
2585
|
|
|
2584
|
-
if (payment.route.toToken.address.toLowerCase() ==
|
|
2586
|
+
if (payment.route.toToken.address.toLowerCase() == web3Constants.CONSTANTS[payment.route.blockchain].USD.toLowerCase()) {
|
|
2585
2587
|
USDAmount = payment.route.toAmount.toString();
|
|
2586
2588
|
} else if (USDRoute == undefined) {
|
|
2587
2589
|
setPaymentValue('');
|
|
@@ -2591,7 +2593,7 @@ var PaymentValueProvider = (function (props) {
|
|
|
2591
2593
|
}
|
|
2592
2594
|
|
|
2593
2595
|
var USDValue = ethers.ethers.utils.formatUnits(USDAmount, USDDecimals);
|
|
2594
|
-
|
|
2596
|
+
localCurrency.Currency.fromUSD({
|
|
2595
2597
|
amount: USDValue,
|
|
2596
2598
|
code: currency,
|
|
2597
2599
|
apiKey: apiKey
|
|
@@ -2659,7 +2661,7 @@ var format = (function (input) {
|
|
|
2659
2661
|
});
|
|
2660
2662
|
|
|
2661
2663
|
var ChangeAmountDialog = (function (props) {
|
|
2662
|
-
var _useContext = React.useContext(
|
|
2664
|
+
var _useContext = React.useContext(reactDialogStack.NavigateStackContext),
|
|
2663
2665
|
navigate = _useContext.navigate;
|
|
2664
2666
|
|
|
2665
2667
|
var _useContext2 = React.useContext(ErrorContext);
|
|
@@ -2823,7 +2825,7 @@ var ChangePaymentDialog = (function (props) {
|
|
|
2823
2825
|
var _useContext3 = React.useContext(PaymentValueContext),
|
|
2824
2826
|
paymentValue = _useContext3.paymentValue;
|
|
2825
2827
|
|
|
2826
|
-
var _useContext4 = React.useContext(
|
|
2828
|
+
var _useContext4 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
2827
2829
|
navigate = _useContext4.navigate;
|
|
2828
2830
|
|
|
2829
2831
|
var _useState = React.useState([]),
|
|
@@ -2869,7 +2871,7 @@ var ChangePaymentDialog = (function (props) {
|
|
|
2869
2871
|
}
|
|
2870
2872
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
2871
2873
|
className: "CardImage"
|
|
2872
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(
|
|
2874
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(reactTokenImage.TokenImage, {
|
|
2873
2875
|
blockchain: payment.route.blockchain,
|
|
2874
2876
|
address: payment.route.fromToken.address
|
|
2875
2877
|
})), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
@@ -2886,11 +2888,7 @@ var ChangePaymentDialog = (function (props) {
|
|
|
2886
2888
|
className: "TokenAmountCell"
|
|
2887
2889
|
}, format(payment.amount)))), /*#__PURE__*/React__default$1["default"].createElement("h3", {
|
|
2888
2890
|
className: "CardText"
|
|
2889
|
-
}, /*#__PURE__*/React__default$1["default"].createElement("small", null, format(round(parseFloat(payment.route.fromBalance.toString()) / Math.pow(10, payment.decimals), 'down'))))))
|
|
2890
|
-
className: "CardInfo"
|
|
2891
|
-
}, payment.route.approvalRequired && /*#__PURE__*/React__default$1["default"].createElement("span", {
|
|
2892
|
-
className: "Label"
|
|
2893
|
-
}, "Requires Approval")));
|
|
2891
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("small", null, format(round(parseFloat(payment.route.fromBalance.toString()) / Math.pow(10, payment.decimals), 'down')))))));
|
|
2894
2892
|
}));
|
|
2895
2893
|
}, [allPaymentRoutesWithData]);
|
|
2896
2894
|
|
|
@@ -2986,7 +2984,7 @@ var DonationOverviewDialog = (function (props) {
|
|
|
2986
2984
|
approve = _useContext3.approve,
|
|
2987
2985
|
approvalTransaction = _useContext3.approvalTransaction;
|
|
2988
2986
|
|
|
2989
|
-
var _useContext4 = React.useContext(
|
|
2987
|
+
var _useContext4 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
2990
2988
|
navigate = _useContext4.navigate;
|
|
2991
2989
|
|
|
2992
2990
|
var _useContext5 = React.useContext(ClosableContext),
|
|
@@ -3005,7 +3003,7 @@ var DonationOverviewDialog = (function (props) {
|
|
|
3005
3003
|
navigate: navigate
|
|
3006
3004
|
});
|
|
3007
3005
|
}
|
|
3008
|
-
}, "Pay ", new
|
|
3006
|
+
}, "Pay ", new localCurrency.Currency({
|
|
3009
3007
|
amount: amount.toFixed(2),
|
|
3010
3008
|
code: currencyCode
|
|
3011
3009
|
}).toString());
|
|
@@ -3084,7 +3082,7 @@ var DonationOverviewDialog = (function (props) {
|
|
|
3084
3082
|
className: "CardText"
|
|
3085
3083
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3086
3084
|
className: "TokenAmountRow"
|
|
3087
|
-
}, new
|
|
3085
|
+
}, new localCurrency.Currency({
|
|
3088
3086
|
amount: amount.toFixed(2),
|
|
3089
3087
|
code: currencyCode
|
|
3090
3088
|
}).toString())))), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
@@ -3102,7 +3100,7 @@ var DonationOverviewDialog = (function (props) {
|
|
|
3102
3100
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3103
3101
|
className: "CardImage",
|
|
3104
3102
|
title: payment.name
|
|
3105
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(
|
|
3103
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(reactTokenImage.TokenImage, {
|
|
3106
3104
|
blockchain: payment.route.blockchain,
|
|
3107
3105
|
address: payment.token
|
|
3108
3106
|
})), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
@@ -3129,7 +3127,7 @@ var DonationOverviewDialog = (function (props) {
|
|
|
3129
3127
|
});
|
|
3130
3128
|
|
|
3131
3129
|
var PaymentErrorDialog = (function () {
|
|
3132
|
-
var _useContext = React.useContext(
|
|
3130
|
+
var _useContext = React.useContext(reactDialogStack.NavigateStackContext),
|
|
3133
3131
|
navigate = _useContext.navigate;
|
|
3134
3132
|
|
|
3135
3133
|
var _useContext2 = React.useContext(PaymentContext),
|
|
@@ -3177,10 +3175,10 @@ var WrongNetworkDialog = (function (props) {
|
|
|
3177
3175
|
var _useContext = React.useContext(PaymentContext),
|
|
3178
3176
|
payment = _useContext.payment;
|
|
3179
3177
|
|
|
3180
|
-
var _useContext2 = React.useContext(
|
|
3178
|
+
var _useContext2 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
3181
3179
|
navigate = _useContext2.navigate;
|
|
3182
3180
|
|
|
3183
|
-
var blockchain =
|
|
3181
|
+
var blockchain = web3Blockchains.Blockchain.findByName(payment.route.blockchain);
|
|
3184
3182
|
return /*#__PURE__*/React__default$1["default"].createElement(Dialog$1, {
|
|
3185
3183
|
stacked: true,
|
|
3186
3184
|
header: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
@@ -3218,7 +3216,7 @@ var DonationStack = (function (props) {
|
|
|
3218
3216
|
open = _useContext.open,
|
|
3219
3217
|
close = _useContext.close;
|
|
3220
3218
|
|
|
3221
|
-
return /*#__PURE__*/React__default$1["default"].createElement(
|
|
3219
|
+
return /*#__PURE__*/React__default$1["default"].createElement(reactDialogStack.ReactDialogStack, {
|
|
3222
3220
|
open: open,
|
|
3223
3221
|
close: close,
|
|
3224
3222
|
start: "DonationOverview",
|
|
@@ -3510,7 +3508,7 @@ var PaymentOverviewDialog = (function (props) {
|
|
|
3510
3508
|
var _useContext4 = React.useContext(PaymentValueContext),
|
|
3511
3509
|
paymentValue = _useContext4.paymentValue;
|
|
3512
3510
|
|
|
3513
|
-
var _useContext5 = React.useContext(
|
|
3511
|
+
var _useContext5 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
3514
3512
|
navigate = _useContext5.navigate;
|
|
3515
3513
|
|
|
3516
3514
|
var _useContext6 = React.useContext(ClosableContext),
|
|
@@ -3529,7 +3527,7 @@ var PaymentOverviewDialog = (function (props) {
|
|
|
3529
3527
|
navigate: navigate
|
|
3530
3528
|
});
|
|
3531
3529
|
}
|
|
3532
|
-
}, "Pay ", amount ? new
|
|
3530
|
+
}, "Pay ", amount ? new localCurrency.Currency({
|
|
3533
3531
|
amount: amount.toFixed(2),
|
|
3534
3532
|
code: currencyCode
|
|
3535
3533
|
}).toString() : paymentValue.toString().length ? paymentValue.toString() : "".concat(payment.amount));
|
|
@@ -3608,7 +3606,7 @@ var PaymentOverviewDialog = (function (props) {
|
|
|
3608
3606
|
className: "CardText"
|
|
3609
3607
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3610
3608
|
className: "TokenAmountRow"
|
|
3611
|
-
}, new
|
|
3609
|
+
}, new localCurrency.Currency({
|
|
3612
3610
|
amount: amount.toFixed(2),
|
|
3613
3611
|
code: currencyCode
|
|
3614
3612
|
}).toString())))), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
@@ -3626,7 +3624,7 @@ var PaymentOverviewDialog = (function (props) {
|
|
|
3626
3624
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3627
3625
|
className: "CardImage",
|
|
3628
3626
|
title: payment.name
|
|
3629
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(
|
|
3627
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(reactTokenImage.TokenImage, {
|
|
3630
3628
|
blockchain: payment.route.blockchain,
|
|
3631
3629
|
address: payment.token
|
|
3632
3630
|
})), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
@@ -3657,7 +3655,7 @@ var PaymentStack = (function (props) {
|
|
|
3657
3655
|
open = _useContext.open,
|
|
3658
3656
|
close = _useContext.close;
|
|
3659
3657
|
|
|
3660
|
-
return /*#__PURE__*/React__default$1["default"].createElement(
|
|
3658
|
+
return /*#__PURE__*/React__default$1["default"].createElement(reactDialogStack.ReactDialogStack, {
|
|
3661
3659
|
open: open,
|
|
3662
3660
|
close: close,
|
|
3663
3661
|
start: "PaymentOverview",
|
|
@@ -3916,7 +3914,8 @@ var SaleOverviewDialog = (function (props) {
|
|
|
3916
3914
|
amount = _useContext.amount;
|
|
3917
3915
|
|
|
3918
3916
|
var _useContext2 = React.useContext(ConfigurationContext),
|
|
3919
|
-
currencyCode = _useContext2.currencyCode
|
|
3917
|
+
currencyCode = _useContext2.currencyCode,
|
|
3918
|
+
tokenImage = _useContext2.tokenImage;
|
|
3920
3919
|
|
|
3921
3920
|
var _useContext3 = React.useContext(PaymentValueContext),
|
|
3922
3921
|
paymentValue = _useContext3.paymentValue;
|
|
@@ -3929,7 +3928,7 @@ var SaleOverviewDialog = (function (props) {
|
|
|
3929
3928
|
approve = _useContext4.approve,
|
|
3930
3929
|
approvalTransaction = _useContext4.approvalTransaction;
|
|
3931
3930
|
|
|
3932
|
-
var _useContext5 = React.useContext(
|
|
3931
|
+
var _useContext5 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
3933
3932
|
navigate = _useContext5.navigate;
|
|
3934
3933
|
|
|
3935
3934
|
var _useContext6 = React.useContext(ClosableContext),
|
|
@@ -3957,7 +3956,7 @@ var SaleOverviewDialog = (function (props) {
|
|
|
3957
3956
|
navigate: navigate
|
|
3958
3957
|
});
|
|
3959
3958
|
}
|
|
3960
|
-
}, "Pay ", new
|
|
3959
|
+
}, "Pay ", new localCurrency.Currency({
|
|
3961
3960
|
amount: amount.toFixed(2),
|
|
3962
3961
|
code: currencyCode
|
|
3963
3962
|
}).toString());
|
|
@@ -4006,7 +4005,7 @@ var SaleOverviewDialog = (function (props) {
|
|
|
4006
4005
|
|
|
4007
4006
|
React.useEffect(function () {
|
|
4008
4007
|
if (paymentValue) {
|
|
4009
|
-
setSalePerTokenValue(new
|
|
4008
|
+
setSalePerTokenValue(new localCurrency.Currency({
|
|
4010
4009
|
amount: (paymentValue.amount / parseFloat(toTokenReadableAmount)).toFixed(2),
|
|
4011
4010
|
code: paymentValue.code
|
|
4012
4011
|
}).toString());
|
|
@@ -4017,6 +4016,19 @@ var SaleOverviewDialog = (function (props) {
|
|
|
4017
4016
|
return /*#__PURE__*/React__default$1["default"].createElement(SaleOverviewSkeleton, null);
|
|
4018
4017
|
}
|
|
4019
4018
|
|
|
4019
|
+
var tokenImageElement;
|
|
4020
|
+
|
|
4021
|
+
if (tokenImage) {
|
|
4022
|
+
tokenImageElement = /*#__PURE__*/React__default$1["default"].createElement("img", {
|
|
4023
|
+
src: tokenImage
|
|
4024
|
+
});
|
|
4025
|
+
} else {
|
|
4026
|
+
tokenImageElement = /*#__PURE__*/React__default$1["default"].createElement(reactTokenImage.TokenImage, {
|
|
4027
|
+
blockchain: payment.route.blockchain,
|
|
4028
|
+
address: toToken.address
|
|
4029
|
+
});
|
|
4030
|
+
}
|
|
4031
|
+
|
|
4020
4032
|
return /*#__PURE__*/React__default$1["default"].createElement(Dialog$1, {
|
|
4021
4033
|
header: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
4022
4034
|
className: "PaddingTopS PaddingLeftM PaddingRightM"
|
|
@@ -4038,10 +4050,7 @@ var SaleOverviewDialog = (function (props) {
|
|
|
4038
4050
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
4039
4051
|
className: "CardImage",
|
|
4040
4052
|
title: payment.name
|
|
4041
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(
|
|
4042
|
-
blockchain: payment.route.blockchain,
|
|
4043
|
-
address: toToken.address
|
|
4044
|
-
})), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
4053
|
+
}, tokenImageElement), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
4045
4054
|
className: "CardBody"
|
|
4046
4055
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
4047
4056
|
className: "CardBodyWrapper"
|
|
@@ -4072,7 +4081,7 @@ var SaleOverviewDialog = (function (props) {
|
|
|
4072
4081
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
4073
4082
|
className: "CardImage",
|
|
4074
4083
|
title: payment.name
|
|
4075
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(
|
|
4084
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(reactTokenImage.TokenImage, {
|
|
4076
4085
|
blockchain: payment.route.blockchain,
|
|
4077
4086
|
address: payment.token
|
|
4078
4087
|
})), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
@@ -4103,7 +4112,7 @@ var SaleStack = (function (props) {
|
|
|
4103
4112
|
open = _useContext.open,
|
|
4104
4113
|
close = _useContext.close;
|
|
4105
4114
|
|
|
4106
|
-
return /*#__PURE__*/React__default$1["default"].createElement(
|
|
4115
|
+
return /*#__PURE__*/React__default$1["default"].createElement(reactDialogStack.ReactDialogStack, {
|
|
4107
4116
|
open: open,
|
|
4108
4117
|
close: close,
|
|
4109
4118
|
start: "SaleOverview",
|
|
@@ -4167,12 +4176,12 @@ var preflight = /*#__PURE__*/function () {
|
|
|
4167
4176
|
|
|
4168
4177
|
var Sale = /*#__PURE__*/function () {
|
|
4169
4178
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
|
|
4170
|
-
var amount, sell, sent, confirmed, ensured, failed, error, critical, style, blacklist, providers, currency, connected, closed, document, accept, unmount;
|
|
4179
|
+
var amount, sell, sent, confirmed, ensured, failed, error, critical, style, blacklist, providers, currency, connected, closed, tokenImage, document, accept, unmount;
|
|
4171
4180
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
4172
4181
|
while (1) {
|
|
4173
4182
|
switch (_context2.prev = _context2.next) {
|
|
4174
4183
|
case 0:
|
|
4175
|
-
amount = _ref3.amount, sell = _ref3.sell, sent = _ref3.sent, confirmed = _ref3.confirmed, ensured = _ref3.ensured, failed = _ref3.failed, error = _ref3.error, critical = _ref3.critical, style = _ref3.style, blacklist = _ref3.blacklist, providers = _ref3.providers, currency = _ref3.currency, connected = _ref3.connected, closed = _ref3.closed, document = _ref3.document;
|
|
4184
|
+
amount = _ref3.amount, sell = _ref3.sell, sent = _ref3.sent, confirmed = _ref3.confirmed, ensured = _ref3.ensured, failed = _ref3.failed, error = _ref3.error, critical = _ref3.critical, style = _ref3.style, blacklist = _ref3.blacklist, providers = _ref3.providers, currency = _ref3.currency, connected = _ref3.connected, closed = _ref3.closed, tokenImage = _ref3.tokenImage, document = _ref3.document;
|
|
4176
4185
|
_context2.prev = 1;
|
|
4177
4186
|
_context2.next = 4;
|
|
4178
4187
|
return preflight({
|
|
@@ -4198,6 +4207,7 @@ var Sale = /*#__PURE__*/function () {
|
|
|
4198
4207
|
unmount: unmount
|
|
4199
4208
|
}, /*#__PURE__*/React__default$1["default"].createElement(ConfigurationProvider, {
|
|
4200
4209
|
configuration: {
|
|
4210
|
+
tokenImage: tokenImage,
|
|
4201
4211
|
amount: amount,
|
|
4202
4212
|
sell: sell,
|
|
4203
4213
|
currency: currency,
|
|
@@ -4256,7 +4266,7 @@ var DePayWidgets = {
|
|
|
4256
4266
|
Payment: Payment,
|
|
4257
4267
|
Sale: Sale,
|
|
4258
4268
|
Donation: Donation,
|
|
4259
|
-
provider:
|
|
4269
|
+
provider: web3Client.provider
|
|
4260
4270
|
};
|
|
4261
4271
|
|
|
4262
4272
|
module.exports = DePayWidgets;
|