@depay/widgets 8.0.7 → 9.0.0
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 +40 -18
- package/dist/esm/index.bundle.js +16 -24
- package/dist/esm/index.js +948 -741
- package/dist/umd/index.bundle.js +16 -24
- package/dist/umd/index.js +948 -741
- package/package.json +10 -9
package/dist/umd/index.js
CHANGED
|
@@ -207,14 +207,9 @@
|
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
209
|
function maybeInvokeDelegate(delegate, context) {
|
|
210
|
-
var
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
214
|
-
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
215
|
-
}
|
|
216
|
-
return ContinueSentinel;
|
|
217
|
-
}
|
|
210
|
+
var methodName = context.method,
|
|
211
|
+
method = delegate.iterator[methodName];
|
|
212
|
+
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
|
|
218
213
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
219
214
|
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
220
215
|
var info = record.arg;
|
|
@@ -243,9 +238,7 @@
|
|
|
243
238
|
if (!isNaN(iterable.length)) {
|
|
244
239
|
var i = -1,
|
|
245
240
|
next = function next() {
|
|
246
|
-
for (; ++i < iterable.length;)
|
|
247
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
248
|
-
}
|
|
241
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
249
242
|
return next.value = undefined, next.done = !0, next;
|
|
250
243
|
};
|
|
251
244
|
return next.next = next;
|
|
@@ -291,9 +284,7 @@
|
|
|
291
284
|
}), exports.keys = function (val) {
|
|
292
285
|
var object = Object(val),
|
|
293
286
|
keys = [];
|
|
294
|
-
for (var key in object)
|
|
295
|
-
keys.push(key);
|
|
296
|
-
}
|
|
287
|
+
for (var key in object) keys.push(key);
|
|
297
288
|
return keys.reverse(), function next() {
|
|
298
289
|
for (; keys.length;) {
|
|
299
290
|
var key = keys.pop();
|
|
@@ -304,9 +295,7 @@
|
|
|
304
295
|
}, exports.values = values, Context.prototype = {
|
|
305
296
|
constructor: Context,
|
|
306
297
|
reset: function reset(skipTempReset) {
|
|
307
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this)
|
|
308
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
309
|
-
}
|
|
298
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
310
299
|
},
|
|
311
300
|
stop: function stop() {
|
|
312
301
|
this.done = !0;
|
|
@@ -408,35 +397,36 @@
|
|
|
408
397
|
}
|
|
409
398
|
|
|
410
399
|
function _iterableToArrayLimit(arr, i) {
|
|
411
|
-
var _i =
|
|
412
|
-
if (
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
if (i && _arr.length === i) break;
|
|
421
|
-
}
|
|
422
|
-
} catch (err) {
|
|
423
|
-
_d = true;
|
|
424
|
-
_e = err;
|
|
425
|
-
} finally {
|
|
400
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
401
|
+
if (null != _i) {
|
|
402
|
+
var _s,
|
|
403
|
+
_e,
|
|
404
|
+
_x,
|
|
405
|
+
_r,
|
|
406
|
+
_arr = [],
|
|
407
|
+
_n = !0,
|
|
408
|
+
_d = !1;
|
|
426
409
|
try {
|
|
427
|
-
if (
|
|
410
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
411
|
+
if (Object(_i) !== _i) return;
|
|
412
|
+
_n = !1;
|
|
413
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
414
|
+
} catch (err) {
|
|
415
|
+
_d = !0, _e = err;
|
|
428
416
|
} finally {
|
|
429
|
-
|
|
417
|
+
try {
|
|
418
|
+
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
|
|
419
|
+
} finally {
|
|
420
|
+
if (_d) throw _e;
|
|
421
|
+
}
|
|
430
422
|
}
|
|
423
|
+
return _arr;
|
|
431
424
|
}
|
|
432
|
-
return _arr;
|
|
433
425
|
}
|
|
434
426
|
|
|
435
427
|
function _arrayLikeToArray(arr, len) {
|
|
436
428
|
if (len == null || len > arr.length) len = arr.length;
|
|
437
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
438
|
-
arr2[i] = arr[i];
|
|
439
|
-
}
|
|
429
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
440
430
|
return arr2;
|
|
441
431
|
}
|
|
442
432
|
|
|
@@ -660,25 +650,23 @@
|
|
|
660
650
|
_asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
|
|
661
651
|
var account;
|
|
662
652
|
return regenerator.wrap(function _callee$(_context) {
|
|
663
|
-
while (1) {
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
return _context.stop();
|
|
681
|
-
}
|
|
653
|
+
while (1) switch (_context.prev = _context.next) {
|
|
654
|
+
case 0:
|
|
655
|
+
if (!wallet) {
|
|
656
|
+
_context.next = 5;
|
|
657
|
+
break;
|
|
658
|
+
}
|
|
659
|
+
_context.next = 3;
|
|
660
|
+
return wallet.account();
|
|
661
|
+
case 3:
|
|
662
|
+
account = _context.sent;
|
|
663
|
+
if (account == undefined) {
|
|
664
|
+
navigate('ConnectingWallet');
|
|
665
|
+
props.connect(wallet);
|
|
666
|
+
}
|
|
667
|
+
case 5:
|
|
668
|
+
case "end":
|
|
669
|
+
return _context.stop();
|
|
682
670
|
}
|
|
683
671
|
}, _callee);
|
|
684
672
|
}))();
|
|
@@ -760,24 +748,22 @@
|
|
|
760
748
|
wallet.connect().then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
|
|
761
749
|
var account;
|
|
762
750
|
return regenerator.wrap(function _callee$(_context) {
|
|
763
|
-
while (1) {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
if (
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
return _context.stop();
|
|
780
|
-
}
|
|
751
|
+
while (1) switch (_context.prev = _context.next) {
|
|
752
|
+
case 0:
|
|
753
|
+
_context.next = 2;
|
|
754
|
+
return wallet.account();
|
|
755
|
+
case 2:
|
|
756
|
+
account = _context.sent;
|
|
757
|
+
if (account) {
|
|
758
|
+
if (props.autoClose) close();
|
|
759
|
+
if (props.resolve) props.resolve({
|
|
760
|
+
wallet: wallet,
|
|
761
|
+
account: account
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
case 4:
|
|
765
|
+
case "end":
|
|
766
|
+
return _context.stop();
|
|
781
767
|
}
|
|
782
768
|
}, _callee);
|
|
783
769
|
})))["catch"](function (error) {
|
|
@@ -804,27 +790,25 @@
|
|
|
804
790
|
_asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2() {
|
|
805
791
|
var account;
|
|
806
792
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
807
|
-
while (1) {
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
if (
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
return _context2.stop();
|
|
827
|
-
}
|
|
793
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
794
|
+
case 0:
|
|
795
|
+
if (!wallet) {
|
|
796
|
+
_context2.next = 5;
|
|
797
|
+
break;
|
|
798
|
+
}
|
|
799
|
+
_context2.next = 3;
|
|
800
|
+
return wallet.account();
|
|
801
|
+
case 3:
|
|
802
|
+
account = _context2.sent;
|
|
803
|
+
if (account) {
|
|
804
|
+
if (props.resolve) props.resolve({
|
|
805
|
+
wallet: wallet,
|
|
806
|
+
account: account
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
case 5:
|
|
810
|
+
case "end":
|
|
811
|
+
return _context2.stop();
|
|
828
812
|
}
|
|
829
813
|
}, _callee2);
|
|
830
814
|
}))();
|
|
@@ -863,13 +847,29 @@
|
|
|
863
847
|
}
|
|
864
848
|
}
|
|
865
849
|
|
|
850
|
+
function _toPrimitive(input, hint) {
|
|
851
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
852
|
+
var prim = input[Symbol.toPrimitive];
|
|
853
|
+
if (prim !== undefined) {
|
|
854
|
+
var res = prim.call(input, hint || "default");
|
|
855
|
+
if (_typeof(res) !== "object") return res;
|
|
856
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
857
|
+
}
|
|
858
|
+
return (hint === "string" ? String : Number)(input);
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
function _toPropertyKey(arg) {
|
|
862
|
+
var key = _toPrimitive(arg, "string");
|
|
863
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
864
|
+
}
|
|
865
|
+
|
|
866
866
|
function _defineProperties(target, props) {
|
|
867
867
|
for (var i = 0; i < props.length; i++) {
|
|
868
868
|
var descriptor = props[i];
|
|
869
869
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
870
870
|
descriptor.configurable = true;
|
|
871
871
|
if ("value" in descriptor) descriptor.writable = true;
|
|
872
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
872
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
873
873
|
}
|
|
874
874
|
}
|
|
875
875
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
@@ -1395,55 +1395,53 @@
|
|
|
1395
1395
|
var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(resolve, reject) {
|
|
1396
1396
|
var wallet, account;
|
|
1397
1397
|
return regenerator.wrap(function _callee$(_context) {
|
|
1398
|
-
while (1) {
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
return
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
return _context.stop();
|
|
1446
|
-
}
|
|
1398
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1399
|
+
case 0:
|
|
1400
|
+
wallet = web3Wallets.getWallets()[0];
|
|
1401
|
+
if (!wallet) {
|
|
1402
|
+
_context.next = 7;
|
|
1403
|
+
break;
|
|
1404
|
+
}
|
|
1405
|
+
_context.next = 4;
|
|
1406
|
+
return wallet.account();
|
|
1407
|
+
case 4:
|
|
1408
|
+
account = _context.sent;
|
|
1409
|
+
if (!account) {
|
|
1410
|
+
_context.next = 7;
|
|
1411
|
+
break;
|
|
1412
|
+
}
|
|
1413
|
+
return _context.abrupt("return", resolve({
|
|
1414
|
+
wallet: wallet,
|
|
1415
|
+
account: account
|
|
1416
|
+
}));
|
|
1417
|
+
case 7:
|
|
1418
|
+
mount({
|
|
1419
|
+
style: style,
|
|
1420
|
+
document: ensureDocument(document)
|
|
1421
|
+
}, function (unmount) {
|
|
1422
|
+
var rejectBeforeUnmount = function rejectBeforeUnmount() {
|
|
1423
|
+
reject('USER_CLOSED_DIALOG');
|
|
1424
|
+
unmount();
|
|
1425
|
+
};
|
|
1426
|
+
return function (container) {
|
|
1427
|
+
return /*#__PURE__*/React__default["default"].createElement(ErrorProvider, {
|
|
1428
|
+
errorCallback: error,
|
|
1429
|
+
container: container,
|
|
1430
|
+
unmount: unmount
|
|
1431
|
+
}, /*#__PURE__*/React__default["default"].createElement(UpdatableProvider, null, /*#__PURE__*/React__default["default"].createElement(ClosableProvider, {
|
|
1432
|
+
unmount: rejectBeforeUnmount
|
|
1433
|
+
}, /*#__PURE__*/React__default["default"].createElement(ConnectStack, {
|
|
1434
|
+
document: document,
|
|
1435
|
+
container: container,
|
|
1436
|
+
resolve: resolve,
|
|
1437
|
+
reject: reject,
|
|
1438
|
+
autoClose: true
|
|
1439
|
+
}), /*#__PURE__*/React__default["default"].createElement(PoweredBy, null))));
|
|
1440
|
+
};
|
|
1441
|
+
});
|
|
1442
|
+
case 8:
|
|
1443
|
+
case "end":
|
|
1444
|
+
return _context.stop();
|
|
1447
1445
|
}
|
|
1448
1446
|
}, _callee);
|
|
1449
1447
|
}));
|
|
@@ -18804,7 +18802,7 @@
|
|
|
18804
18802
|
} else {
|
|
18805
18803
|
Promise.all(props.accept.map(function (configuration) {
|
|
18806
18804
|
if (fixedAmount) {
|
|
18807
|
-
if (web3Constants.CONSTANTS[configuration.blockchain].USD
|
|
18805
|
+
if (web3Constants.CONSTANTS[configuration.blockchain].USD == configuration.token) {
|
|
18808
18806
|
return 1.00 / fixedCurrencyConversionRate * fixedAmount;
|
|
18809
18807
|
} else {
|
|
18810
18808
|
return web3Exchanges.route({
|
|
@@ -18817,7 +18815,7 @@
|
|
|
18817
18815
|
});
|
|
18818
18816
|
}
|
|
18819
18817
|
} else {
|
|
18820
|
-
if (web3Constants.CONSTANTS[configuration.blockchain].USD
|
|
18818
|
+
if (web3Constants.CONSTANTS[configuration.blockchain].USD == configuration.token) {
|
|
18821
18819
|
return 1.00 / conversionRate * amount;
|
|
18822
18820
|
} else {
|
|
18823
18821
|
return web3Exchanges.route({
|
|
@@ -19088,8 +19086,11 @@
|
|
|
19088
19086
|
wallet = _useContext8.wallet;
|
|
19089
19087
|
var _useContext9 = React.useContext(PaymentTrackingContext),
|
|
19090
19088
|
release = _useContext9.release,
|
|
19091
|
-
|
|
19092
|
-
|
|
19089
|
+
synchronousTracking = _useContext9.synchronousTracking,
|
|
19090
|
+
asynchronousTracking = _useContext9.asynchronousTracking,
|
|
19091
|
+
trackingInitialized = _useContext9.trackingInitialized,
|
|
19092
|
+
initializePaymentTracking = _useContext9.initializeTracking,
|
|
19093
|
+
preTrack = _useContext9.preTrack;
|
|
19093
19094
|
var _useContext10 = React.useContext(TransactionTrackingContext),
|
|
19094
19095
|
foundTransaction = _useContext10.foundTransaction,
|
|
19095
19096
|
initializeTransactionTracking = _useContext10.initializeTracking;
|
|
@@ -19110,7 +19111,7 @@
|
|
|
19110
19111
|
paymentState = _useState8[0],
|
|
19111
19112
|
setPaymentState = _useState8[1];
|
|
19112
19113
|
var paymentSucceeded = function paymentSucceeded(transaction) {
|
|
19113
|
-
if (
|
|
19114
|
+
if (synchronousTracking == false && (asynchronousTracking == false || trackingInitialized == true)) {
|
|
19114
19115
|
setClosable(true);
|
|
19115
19116
|
}
|
|
19116
19117
|
setPaymentState('success');
|
|
@@ -19119,43 +19120,47 @@
|
|
|
19119
19120
|
}
|
|
19120
19121
|
};
|
|
19121
19122
|
var paymentFailed = function paymentFailed(transaction, error) {
|
|
19123
|
+
if (asynchronousTracking == false || trackingInitialized == true) {
|
|
19124
|
+
setClosable(true);
|
|
19125
|
+
}
|
|
19126
|
+
set(['PaymentFailed']);
|
|
19127
|
+
setPaymentState('failed');
|
|
19122
19128
|
if (failed) {
|
|
19123
19129
|
failed(transaction, error);
|
|
19124
19130
|
}
|
|
19125
|
-
setClosable(true);
|
|
19126
|
-
set(['PaymentFailed']);
|
|
19127
19131
|
};
|
|
19128
19132
|
var pay = /*#__PURE__*/function () {
|
|
19129
19133
|
var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
|
|
19130
19134
|
var stop, currentBlock;
|
|
19131
19135
|
return regenerator.wrap(function _callee$(_context) {
|
|
19132
|
-
while (1) {
|
|
19133
|
-
|
|
19134
|
-
|
|
19135
|
-
|
|
19136
|
-
|
|
19137
|
-
|
|
19138
|
-
|
|
19139
|
-
|
|
19140
|
-
|
|
19141
|
-
|
|
19142
|
-
|
|
19143
|
-
|
|
19144
|
-
|
|
19145
|
-
|
|
19146
|
-
|
|
19147
|
-
|
|
19148
|
-
|
|
19149
|
-
|
|
19150
|
-
|
|
19151
|
-
|
|
19152
|
-
|
|
19153
|
-
|
|
19154
|
-
|
|
19155
|
-
|
|
19156
|
-
|
|
19157
|
-
|
|
19158
|
-
|
|
19136
|
+
while (1) switch (_context.prev = _context.next) {
|
|
19137
|
+
case 0:
|
|
19138
|
+
if (!before) {
|
|
19139
|
+
_context.next = 6;
|
|
19140
|
+
break;
|
|
19141
|
+
}
|
|
19142
|
+
_context.next = 3;
|
|
19143
|
+
return before(payment.route.transaction);
|
|
19144
|
+
case 3:
|
|
19145
|
+
stop = _context.sent;
|
|
19146
|
+
if (!(stop === false)) {
|
|
19147
|
+
_context.next = 6;
|
|
19148
|
+
break;
|
|
19149
|
+
}
|
|
19150
|
+
return _context.abrupt("return");
|
|
19151
|
+
case 6:
|
|
19152
|
+
setClosable(false);
|
|
19153
|
+
setPaymentState('paying');
|
|
19154
|
+
setUpdatable(false);
|
|
19155
|
+
_context.next = 11;
|
|
19156
|
+
return web3Client.request({
|
|
19157
|
+
blockchain: payment.route.transaction.blockchain,
|
|
19158
|
+
method: 'latestBlockNumber'
|
|
19159
|
+
});
|
|
19160
|
+
case 11:
|
|
19161
|
+
currentBlock = _context.sent;
|
|
19162
|
+
_context.next = 14;
|
|
19163
|
+
return preTrack(currentBlock, payment.route).then(function () {
|
|
19159
19164
|
wallet.sendTransaction(Object.assign({}, payment.route.transaction, {
|
|
19160
19165
|
sent: function sent(transaction) {
|
|
19161
19166
|
initializeTransactionTracking(transaction, currentBlock);
|
|
@@ -19173,14 +19178,20 @@
|
|
|
19173
19178
|
setPaymentState('initialized');
|
|
19174
19179
|
setClosable(true);
|
|
19175
19180
|
setUpdatable(true);
|
|
19176
|
-
if ((error === null || error === void 0 ? void 0 : error.code) == 'WRONG_NETWORK') {
|
|
19181
|
+
if ((error === null || error === void 0 ? void 0 : error.code) == 'WRONG_NETWORK' || (error === null || error === void 0 ? void 0 : error.code) == 'NOT_SUPPORTED') {
|
|
19177
19182
|
navigate('WrongNetwork');
|
|
19178
19183
|
}
|
|
19179
19184
|
});
|
|
19180
|
-
|
|
19181
|
-
|
|
19182
|
-
|
|
19183
|
-
|
|
19185
|
+
})["catch"](function (e) {
|
|
19186
|
+
console.log(e);
|
|
19187
|
+
setPaymentState('initialized');
|
|
19188
|
+
setClosable(true);
|
|
19189
|
+
setUpdatable(true);
|
|
19190
|
+
navigate('PreTrackingFailed');
|
|
19191
|
+
});
|
|
19192
|
+
case 14:
|
|
19193
|
+
case "end":
|
|
19194
|
+
return _context.stop();
|
|
19184
19195
|
}
|
|
19185
19196
|
}, _callee);
|
|
19186
19197
|
}));
|
|
@@ -19211,6 +19222,11 @@
|
|
|
19211
19222
|
setPaymentState('success');
|
|
19212
19223
|
}
|
|
19213
19224
|
}, [release]);
|
|
19225
|
+
React.useEffect(function () {
|
|
19226
|
+
if (asynchronousTracking && trackingInitialized && (paymentState == 'success' || paymentState == 'failed')) {
|
|
19227
|
+
setClosable(true);
|
|
19228
|
+
}
|
|
19229
|
+
}, [trackingInitialized, paymentState]);
|
|
19214
19230
|
React.useEffect(function () {
|
|
19215
19231
|
if (recover) {
|
|
19216
19232
|
setClosable(false);
|
|
@@ -19246,7 +19262,7 @@
|
|
|
19246
19262
|
React.useEffect(function () {
|
|
19247
19263
|
if (foundTransaction && foundTransaction.id && foundTransaction.status) {
|
|
19248
19264
|
var newTransaction;
|
|
19249
|
-
if (foundTransaction.id
|
|
19265
|
+
if (foundTransaction.id != transaction.id) {
|
|
19250
19266
|
newTransaction = Object.assign({}, transaction, {
|
|
19251
19267
|
id: foundTransaction.id,
|
|
19252
19268
|
url: web3Blockchains.Blockchain.findByName(transaction.blockchain).explorerUrlFor({
|
|
@@ -19316,6 +19332,7 @@
|
|
|
19316
19332
|
});
|
|
19317
19333
|
|
|
19318
19334
|
function _defineProperty(obj, key, value) {
|
|
19335
|
+
key = _toPropertyKey(key);
|
|
19319
19336
|
if (key in obj) {
|
|
19320
19337
|
Object.defineProperty(obj, key, {
|
|
19321
19338
|
value: value,
|
|
@@ -19351,14 +19368,13 @@
|
|
|
19351
19368
|
account = _ref.account,
|
|
19352
19369
|
whitelist = _ref.whitelist,
|
|
19353
19370
|
blacklist = _ref.blacklist,
|
|
19354
|
-
event = _ref.event,
|
|
19355
19371
|
fee = _ref.fee;
|
|
19356
19372
|
return web3Payments.route({
|
|
19357
19373
|
accept: accept.map(prepareAcceptedPayments),
|
|
19358
19374
|
from: mergeFromAccounts(accept, account),
|
|
19359
19375
|
whitelist: whitelist,
|
|
19360
19376
|
blacklist: blacklist,
|
|
19361
|
-
event:
|
|
19377
|
+
event: 'ifRoutedAndNative',
|
|
19362
19378
|
fee: fee
|
|
19363
19379
|
});
|
|
19364
19380
|
});
|
|
@@ -19395,55 +19411,51 @@
|
|
|
19395
19411
|
var onRoutesUpdate = /*#__PURE__*/function () {
|
|
19396
19412
|
var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(routes) {
|
|
19397
19413
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
19398
|
-
while (1) {
|
|
19399
|
-
|
|
19400
|
-
|
|
19401
|
-
|
|
19402
|
-
|
|
19403
|
-
|
|
19404
|
-
|
|
19405
|
-
|
|
19406
|
-
|
|
19407
|
-
|
|
19408
|
-
var
|
|
19409
|
-
|
|
19410
|
-
|
|
19411
|
-
|
|
19412
|
-
|
|
19413
|
-
|
|
19414
|
-
|
|
19415
|
-
|
|
19416
|
-
|
|
19417
|
-
|
|
19418
|
-
|
|
19419
|
-
|
|
19420
|
-
|
|
19421
|
-
|
|
19422
|
-
if (selectedRoute.fromAmount != newSelectRoute.fromAmount) {
|
|
19423
|
-
setUpdatedRouteWithNewPrice(newSelectRoute);
|
|
19424
|
-
}
|
|
19425
|
-
}
|
|
19426
|
-
}
|
|
19427
|
-
setAllRoutes(roundedRoutes);
|
|
19428
|
-
if (props.setMaxRoute) {
|
|
19429
|
-
props.setMaxRoute(findMaxRoute(roundedRoutes));
|
|
19414
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
19415
|
+
case 0:
|
|
19416
|
+
if (routes.length == 0) {
|
|
19417
|
+
setAllRoutes([]);
|
|
19418
|
+
if (props.setMaxRoute) {
|
|
19419
|
+
props.setMaxRoute(null);
|
|
19420
|
+
}
|
|
19421
|
+
} else {
|
|
19422
|
+
roundAmounts(routes).then( /*#__PURE__*/function () {
|
|
19423
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(roundedRoutes) {
|
|
19424
|
+
var selectRoute, newSelectRoute;
|
|
19425
|
+
return regenerator.wrap(function _callee$(_context) {
|
|
19426
|
+
while (1) switch (_context.prev = _context.next) {
|
|
19427
|
+
case 0:
|
|
19428
|
+
if (typeof selectedRoute == 'undefined') {
|
|
19429
|
+
selectRoute = roundedRoutes[0];
|
|
19430
|
+
setSelectedRoute(selectRoute);
|
|
19431
|
+
} else {
|
|
19432
|
+
newSelectRoute = roundedRoutes[roundedRoutes.findIndex(function (route) {
|
|
19433
|
+
return route.fromToken.address == selectedRoute.fromToken.address && route.blockchain == selectedRoute.blockchain;
|
|
19434
|
+
})];
|
|
19435
|
+
if (newSelectRoute) {
|
|
19436
|
+
if (selectedRoute.fromAmount != newSelectRoute.fromAmount) {
|
|
19437
|
+
setUpdatedRouteWithNewPrice(newSelectRoute);
|
|
19430
19438
|
}
|
|
19431
|
-
|
|
19432
|
-
case "end":
|
|
19433
|
-
return _context.stop();
|
|
19439
|
+
}
|
|
19434
19440
|
}
|
|
19435
|
-
|
|
19436
|
-
|
|
19437
|
-
|
|
19438
|
-
|
|
19439
|
-
|
|
19440
|
-
|
|
19441
|
-
|
|
19442
|
-
|
|
19443
|
-
|
|
19444
|
-
|
|
19445
|
-
|
|
19446
|
-
|
|
19441
|
+
setAllRoutes(roundedRoutes);
|
|
19442
|
+
if (props.setMaxRoute) {
|
|
19443
|
+
props.setMaxRoute(findMaxRoute(roundedRoutes));
|
|
19444
|
+
}
|
|
19445
|
+
case 3:
|
|
19446
|
+
case "end":
|
|
19447
|
+
return _context.stop();
|
|
19448
|
+
}
|
|
19449
|
+
}, _callee);
|
|
19450
|
+
}));
|
|
19451
|
+
return function (_x2) {
|
|
19452
|
+
return _ref2.apply(this, arguments);
|
|
19453
|
+
};
|
|
19454
|
+
}());
|
|
19455
|
+
}
|
|
19456
|
+
case 1:
|
|
19457
|
+
case "end":
|
|
19458
|
+
return _context2.stop();
|
|
19447
19459
|
}
|
|
19448
19460
|
}, _callee2);
|
|
19449
19461
|
}));
|
|
@@ -19479,29 +19491,27 @@
|
|
|
19479
19491
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3(route, amountBN) {
|
|
19480
19492
|
var readableAmount, roundedAmountBN;
|
|
19481
19493
|
return regenerator.wrap(function _callee3$(_context3) {
|
|
19482
|
-
while (1) {
|
|
19483
|
-
|
|
19484
|
-
|
|
19485
|
-
|
|
19486
|
-
|
|
19487
|
-
|
|
19488
|
-
|
|
19489
|
-
|
|
19490
|
-
|
|
19491
|
-
|
|
19492
|
-
|
|
19493
|
-
|
|
19494
|
-
|
|
19495
|
-
|
|
19496
|
-
|
|
19497
|
-
|
|
19498
|
-
|
|
19499
|
-
|
|
19500
|
-
|
|
19501
|
-
|
|
19502
|
-
|
|
19503
|
-
return _context3.stop();
|
|
19504
|
-
}
|
|
19494
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
19495
|
+
case 0:
|
|
19496
|
+
if (!route.directTransfer) {
|
|
19497
|
+
_context3.next = 2;
|
|
19498
|
+
break;
|
|
19499
|
+
}
|
|
19500
|
+
return _context3.abrupt("return", route);
|
|
19501
|
+
case 2:
|
|
19502
|
+
_context3.next = 4;
|
|
19503
|
+
return route.fromToken.readable(amountBN || route.transaction.params.amounts[0]);
|
|
19504
|
+
case 4:
|
|
19505
|
+
readableAmount = _context3.sent;
|
|
19506
|
+
_context3.next = 7;
|
|
19507
|
+
return route.fromToken.BigNumber(round(readableAmount));
|
|
19508
|
+
case 7:
|
|
19509
|
+
roundedAmountBN = _context3.sent;
|
|
19510
|
+
updateRouteAmount(route, roundedAmountBN);
|
|
19511
|
+
return _context3.abrupt("return", route);
|
|
19512
|
+
case 10:
|
|
19513
|
+
case "end":
|
|
19514
|
+
return _context3.stop();
|
|
19505
19515
|
}
|
|
19506
19516
|
}, _callee3);
|
|
19507
19517
|
}));
|
|
@@ -19512,16 +19522,14 @@
|
|
|
19512
19522
|
var roundAmounts = /*#__PURE__*/function () {
|
|
19513
19523
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee4(routes) {
|
|
19514
19524
|
return regenerator.wrap(function _callee4$(_context4) {
|
|
19515
|
-
while (1) {
|
|
19516
|
-
|
|
19517
|
-
|
|
19518
|
-
return
|
|
19519
|
-
|
|
19520
|
-
|
|
19521
|
-
|
|
19522
|
-
|
|
19523
|
-
return _context4.stop();
|
|
19524
|
-
}
|
|
19525
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
19526
|
+
case 0:
|
|
19527
|
+
return _context4.abrupt("return", Promise.all(routes.map(function (route) {
|
|
19528
|
+
return roundAmount(route);
|
|
19529
|
+
})));
|
|
19530
|
+
case 1:
|
|
19531
|
+
case "end":
|
|
19532
|
+
return _context4.stop();
|
|
19525
19533
|
}
|
|
19526
19534
|
}, _callee4);
|
|
19527
19535
|
}));
|
|
@@ -19532,15 +19540,13 @@
|
|
|
19532
19540
|
var updateRouteWithNewPrice = /*#__PURE__*/function () {
|
|
19533
19541
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee5() {
|
|
19534
19542
|
return regenerator.wrap(function _callee5$(_context5) {
|
|
19535
|
-
while (1) {
|
|
19536
|
-
|
|
19537
|
-
|
|
19538
|
-
|
|
19539
|
-
|
|
19540
|
-
|
|
19541
|
-
|
|
19542
|
-
return _context5.stop();
|
|
19543
|
-
}
|
|
19543
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
19544
|
+
case 0:
|
|
19545
|
+
setSelectedRoute(_objectSpread({}, updatedRouteWithNewPrice));
|
|
19546
|
+
setUpdatedRouteWithNewPrice(null);
|
|
19547
|
+
case 2:
|
|
19548
|
+
case "end":
|
|
19549
|
+
return _context5.stop();
|
|
19544
19550
|
}
|
|
19545
19551
|
}, _callee5);
|
|
19546
19552
|
}));
|
|
@@ -19620,6 +19626,7 @@
|
|
|
19620
19626
|
if (updatable == false || (payment === null || payment === void 0 ? void 0 : payment.route) == undefined) {
|
|
19621
19627
|
return;
|
|
19622
19628
|
}
|
|
19629
|
+
setPaymentValueLoss(null);
|
|
19623
19630
|
Promise.all([web3Exchanges.route({
|
|
19624
19631
|
blockchain: payment.route.blockchain,
|
|
19625
19632
|
tokenIn: payment.route.fromToken.address,
|
|
@@ -19655,7 +19662,7 @@
|
|
|
19655
19662
|
}
|
|
19656
19663
|
}
|
|
19657
19664
|
var fromTokenUSDAmount;
|
|
19658
|
-
if (payment.route.fromToken.address
|
|
19665
|
+
if (payment.route.fromToken.address == web3Constants.CONSTANTS[payment.route.blockchain].USD) {
|
|
19659
19666
|
fromTokenUSDAmount = payment.route.fromAmount.toString();
|
|
19660
19667
|
} else if (fromTokenUSDRoute == undefined) {
|
|
19661
19668
|
setPaymentValue('');
|
|
@@ -20070,6 +20077,16 @@
|
|
|
20070
20077
|
}));
|
|
20071
20078
|
});
|
|
20072
20079
|
|
|
20080
|
+
var blockTimes = {
|
|
20081
|
+
// in seconds
|
|
20082
|
+
ethereum: 13,
|
|
20083
|
+
bsc: 4,
|
|
20084
|
+
polygon: 3
|
|
20085
|
+
};
|
|
20086
|
+
var etaForConfirmations = (function (blockchain, confirmationsRequired, confirmationsPassed) {
|
|
20087
|
+
return (confirmationsRequired - confirmationsPassed) * blockTimes[blockchain];
|
|
20088
|
+
});
|
|
20089
|
+
|
|
20073
20090
|
var LoadingText = (function (props) {
|
|
20074
20091
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20075
20092
|
className: "LoadingText"
|
|
@@ -20087,9 +20104,13 @@
|
|
|
20087
20104
|
_useContext.amount;
|
|
20088
20105
|
_useContext.amountsMissing;
|
|
20089
20106
|
var _useContext2 = React.useContext(PaymentTrackingContext),
|
|
20090
|
-
|
|
20107
|
+
synchronousTracking = _useContext2.synchronousTracking,
|
|
20108
|
+
asynchronousTracking = _useContext2.asynchronousTracking,
|
|
20109
|
+
trackingInitialized = _useContext2.trackingInitialized,
|
|
20091
20110
|
release = _useContext2.release,
|
|
20092
|
-
forwardTo = _useContext2.forwardTo
|
|
20111
|
+
forwardTo = _useContext2.forwardTo,
|
|
20112
|
+
confirmationsRequired = _useContext2.confirmationsRequired,
|
|
20113
|
+
confirmationsPassed = _useContext2.confirmationsPassed;
|
|
20093
20114
|
var _useContext3 = React.useContext(PaymentContext),
|
|
20094
20115
|
payment = _useContext3.payment,
|
|
20095
20116
|
paymentState = _useContext3.paymentState,
|
|
@@ -20108,11 +20129,54 @@
|
|
|
20108
20129
|
_useContext6.navigate;
|
|
20109
20130
|
var _useContext7 = React.useContext(ClosableContext),
|
|
20110
20131
|
close = _useContext7.close;
|
|
20132
|
+
var _useState = React.useState(),
|
|
20133
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20134
|
+
secondsLeft = _useState2[0],
|
|
20135
|
+
setSecondsLeft = _useState2[1];
|
|
20136
|
+
var _useState3 = React.useState(0),
|
|
20137
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
20138
|
+
secondsLeftCountdown = _useState4[0],
|
|
20139
|
+
setSecondsLeftCountdown = _useState4[1];
|
|
20140
|
+
React.useEffect(function () {
|
|
20141
|
+
if (confirmationsRequired) {
|
|
20142
|
+
var interval = setInterval(function () {
|
|
20143
|
+
setSecondsLeftCountdown(secondsLeftCountdown + 1);
|
|
20144
|
+
}, 1000);
|
|
20145
|
+
return function () {
|
|
20146
|
+
clearInterval(interval);
|
|
20147
|
+
};
|
|
20148
|
+
}
|
|
20149
|
+
}, [confirmationsRequired, secondsLeftCountdown]);
|
|
20150
|
+
React.useEffect(function () {
|
|
20151
|
+
if (confirmationsPassed) {
|
|
20152
|
+
setSecondsLeft(etaForConfirmations(payment.blockchain, confirmationsRequired, confirmationsPassed) - secondsLeftCountdown);
|
|
20153
|
+
}
|
|
20154
|
+
}, [confirmationsPassed, secondsLeftCountdown]);
|
|
20155
|
+
React.useEffect(function () {
|
|
20156
|
+
if (confirmationsPassed) {
|
|
20157
|
+
setSecondsLeftCountdown(0);
|
|
20158
|
+
}
|
|
20159
|
+
}, [confirmationsPassed]);
|
|
20111
20160
|
var trackingInfo = function trackingInfo() {
|
|
20112
|
-
if (
|
|
20161
|
+
if (synchronousTracking == false && asynchronousTracking == false || asynchronousTracking && trackingInitialized) {
|
|
20113
20162
|
return null;
|
|
20114
|
-
}
|
|
20115
|
-
|
|
20163
|
+
} else if (asynchronousTracking && trackingInitialized == false) {
|
|
20164
|
+
return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20165
|
+
className: "Card transparent small disabled"
|
|
20166
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20167
|
+
className: "CardImage"
|
|
20168
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20169
|
+
className: "TextCenter"
|
|
20170
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20171
|
+
className: "Loading Icon"
|
|
20172
|
+
}))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20173
|
+
className: "CardBody"
|
|
20174
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20175
|
+
className: "CardBodyWrapper"
|
|
20176
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20177
|
+
className: "Opacity05"
|
|
20178
|
+
}, "Initializing tracking")))));
|
|
20179
|
+
} else if (release) {
|
|
20116
20180
|
return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20117
20181
|
className: "Card transparent small disabled"
|
|
20118
20182
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -20143,7 +20207,9 @@
|
|
|
20143
20207
|
className: "CardBodyWrapper"
|
|
20144
20208
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20145
20209
|
className: "Opacity05"
|
|
20146
|
-
}, "Validating payment"
|
|
20210
|
+
}, "Validating payment", confirmationsRequired && secondsLeft > 0 && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
20211
|
+
title: "".concat(confirmationsPassed, "/").concat(confirmationsRequired, " required confirmations")
|
|
20212
|
+
}, " ", secondsLeft, "s"))))));
|
|
20147
20213
|
}
|
|
20148
20214
|
};
|
|
20149
20215
|
var additionalPaymentInformation = function additionalPaymentInformation() {
|
|
@@ -20170,7 +20236,7 @@
|
|
|
20170
20236
|
className: "PaddingBottomS"
|
|
20171
20237
|
}, /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("a", {
|
|
20172
20238
|
className: "Card transparent small",
|
|
20173
|
-
title: "
|
|
20239
|
+
title: "Transaction has been confirmed by the network",
|
|
20174
20240
|
href: transaction === null || transaction === void 0 ? void 0 : transaction.url,
|
|
20175
20241
|
target: "_blank",
|
|
20176
20242
|
rel: "noopener noreferrer"
|
|
@@ -20186,7 +20252,7 @@
|
|
|
20186
20252
|
className: "CardBodyWrapper"
|
|
20187
20253
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20188
20254
|
className: "Opacity05"
|
|
20189
|
-
}, "
|
|
20255
|
+
}, "Transaction confirmed"))))), trackingInfo());
|
|
20190
20256
|
}
|
|
20191
20257
|
};
|
|
20192
20258
|
var approvalButton = function approvalButton() {
|
|
@@ -20194,7 +20260,7 @@
|
|
|
20194
20260
|
return null;
|
|
20195
20261
|
} else if (paymentState == 'initialized') {
|
|
20196
20262
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20197
|
-
className: "
|
|
20263
|
+
className: "PaddingBottomXS"
|
|
20198
20264
|
}, /*#__PURE__*/React__default["default"].createElement("button", {
|
|
20199
20265
|
className: "ButtonPrimary",
|
|
20200
20266
|
onClick: approve,
|
|
@@ -20252,7 +20318,7 @@
|
|
|
20252
20318
|
rel: "noopener noreferrer"
|
|
20253
20319
|
}, /*#__PURE__*/React__default["default"].createElement(LoadingText, null, "Paying"));
|
|
20254
20320
|
} else if (paymentState == 'success') {
|
|
20255
|
-
if (
|
|
20321
|
+
if (synchronousTracking == true) {
|
|
20256
20322
|
if (release) {
|
|
20257
20323
|
if (forwardTo) {
|
|
20258
20324
|
return /*#__PURE__*/React__default["default"].createElement("a", {
|
|
@@ -20272,6 +20338,11 @@
|
|
|
20272
20338
|
onClick: function onClick() {}
|
|
20273
20339
|
}, "Continue");
|
|
20274
20340
|
}
|
|
20341
|
+
} else if (asynchronousTracking == true && trackingInitialized == false) {
|
|
20342
|
+
return /*#__PURE__*/React__default["default"].createElement("button", {
|
|
20343
|
+
className: "ButtonPrimary disabled",
|
|
20344
|
+
onClick: function onClick() {}
|
|
20345
|
+
}, "Close");
|
|
20275
20346
|
} else {
|
|
20276
20347
|
return /*#__PURE__*/React__default["default"].createElement("button", {
|
|
20277
20348
|
className: "ButtonPrimary",
|
|
@@ -20395,7 +20466,7 @@
|
|
|
20395
20466
|
className: "Text PaddingTopS PaddingBottomS PaddingLeftS PaddingRightS"
|
|
20396
20467
|
}, /*#__PURE__*/React__default["default"].createElement("strong", {
|
|
20397
20468
|
className: "FontSizeM"
|
|
20398
|
-
}, "Unfortunately executing your payment failed
|
|
20469
|
+
}, "Unfortunately executing your payment failed, but you can try again."), transaction && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20399
20470
|
className: "PaddingTopS"
|
|
20400
20471
|
}, /*#__PURE__*/React__default["default"].createElement("a", {
|
|
20401
20472
|
className: "Link",
|
|
@@ -20511,37 +20582,59 @@
|
|
|
20511
20582
|
integration = _useContext2.integration,
|
|
20512
20583
|
link = _useContext2.link,
|
|
20513
20584
|
type = _useContext2.type;
|
|
20585
|
+
var _useContext3 = React.useContext(WalletContext),
|
|
20586
|
+
account = _useContext3.account;
|
|
20587
|
+
_useContext3.wallet;
|
|
20514
20588
|
var _useState = React.useState(),
|
|
20515
20589
|
_useState2 = _slicedToArray(_useState, 2),
|
|
20516
20590
|
transaction = _useState2[0],
|
|
20517
20591
|
setTransaction = _useState2[1];
|
|
20518
20592
|
var _useState3 = React.useState(),
|
|
20519
20593
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
20520
|
-
|
|
20521
|
-
|
|
20594
|
+
confirmationsRequired = _useState4[0],
|
|
20595
|
+
setConfirmationsRequired = _useState4[1];
|
|
20522
20596
|
var _useState5 = React.useState(),
|
|
20523
20597
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
20524
|
-
|
|
20525
|
-
|
|
20526
|
-
var _useState7 = React.useState(
|
|
20527
|
-
_useState8 = _slicedToArray(_useState7,
|
|
20528
|
-
|
|
20529
|
-
|
|
20530
|
-
|
|
20531
|
-
|
|
20532
|
-
|
|
20598
|
+
confirmationsPassed = _useState6[0],
|
|
20599
|
+
setConfirmationsPassed = _useState6[1];
|
|
20600
|
+
var _useState7 = React.useState(),
|
|
20601
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
20602
|
+
afterBlock = _useState8[0],
|
|
20603
|
+
setAfterBlock = _useState8[1];
|
|
20604
|
+
var _useState9 = React.useState(),
|
|
20605
|
+
_useState10 = _slicedToArray(_useState9, 2);
|
|
20606
|
+
_useState10[0];
|
|
20607
|
+
_useState10[1];
|
|
20608
|
+
var _useState11 = React.useState(),
|
|
20533
20609
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
20534
|
-
|
|
20535
|
-
|
|
20536
|
-
var _useState13 = React.useState(),
|
|
20610
|
+
paymentRoute = _useState12[0],
|
|
20611
|
+
setPaymentRoute = _useState12[1];
|
|
20612
|
+
var _useState13 = React.useState(false),
|
|
20537
20613
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
20538
|
-
|
|
20539
|
-
|
|
20540
|
-
var
|
|
20541
|
-
|
|
20542
|
-
|
|
20543
|
-
|
|
20544
|
-
|
|
20614
|
+
trackingInitialized = _useState14[0],
|
|
20615
|
+
setTrackingInitialized = _useState14[1];
|
|
20616
|
+
var _useState15 = React.useState(!!(track && (track.endpoint || typeof track.method == 'function') && track.async != true)),
|
|
20617
|
+
_useState16 = _slicedToArray(_useState15, 1),
|
|
20618
|
+
synchronousTracking = _useState16[0];
|
|
20619
|
+
var _useState17 = React.useState(!!(track && track.async == true)),
|
|
20620
|
+
_useState18 = _slicedToArray(_useState17, 1),
|
|
20621
|
+
asynchronousTracking = _useState18[0];
|
|
20622
|
+
var _useState19 = React.useState(!!(track && track.poll && (track.poll.endpoint || typeof track.poll.method == 'function') && track.async != true)),
|
|
20623
|
+
_useState20 = _slicedToArray(_useState19, 1),
|
|
20624
|
+
polling = _useState20[0];
|
|
20625
|
+
var _useState21 = React.useState(false),
|
|
20626
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
20627
|
+
release = _useState22[0],
|
|
20628
|
+
setRelease = _useState22[1];
|
|
20629
|
+
var _useState23 = React.useState(),
|
|
20630
|
+
_useState24 = _slicedToArray(_useState23, 2),
|
|
20631
|
+
forwardTo = _useState24[0],
|
|
20632
|
+
setForwardTo = _useState24[1];
|
|
20633
|
+
var _useContext4 = React.useContext(ClosableContext),
|
|
20634
|
+
setClosable = _useContext4.setClosable;
|
|
20635
|
+
var _useContext5 = React.useContext(NavigateContext),
|
|
20636
|
+
navigate = _useContext5.navigate;
|
|
20637
|
+
_useContext5.set;
|
|
20545
20638
|
var openSocket = function openSocket(transaction) {
|
|
20546
20639
|
var socket = new WebSocket('wss://integrate.depay.com/cable');
|
|
20547
20640
|
socket.onopen = function (event) {
|
|
@@ -20549,14 +20642,18 @@
|
|
|
20549
20642
|
command: 'subscribe',
|
|
20550
20643
|
identifier: JSON.stringify({
|
|
20551
20644
|
blockchain: transaction.blockchain,
|
|
20552
|
-
sender: transaction.from
|
|
20553
|
-
nonce: transaction.nonce,
|
|
20645
|
+
sender: transaction.from,
|
|
20646
|
+
nonce: transaction.nonce.toString(),
|
|
20554
20647
|
channel: 'PaymentChannel'
|
|
20555
20648
|
})
|
|
20556
20649
|
};
|
|
20557
20650
|
socket.send(JSON.stringify(msg));
|
|
20558
20651
|
};
|
|
20559
|
-
socket.onclose = function (event) {
|
|
20652
|
+
socket.onclose = function (event) {
|
|
20653
|
+
if (!event || event.code != 1000) {
|
|
20654
|
+
openSocket(transaction);
|
|
20655
|
+
}
|
|
20656
|
+
};
|
|
20560
20657
|
socket.onmessage = function (event) {
|
|
20561
20658
|
var item = JSON.parse(event.data);
|
|
20562
20659
|
if (item.type === "ping" || !item.message) {
|
|
@@ -20569,12 +20666,15 @@
|
|
|
20569
20666
|
setRelease(true);
|
|
20570
20667
|
setClosable(!item.message.forward_to);
|
|
20571
20668
|
setForwardTo(item.message.forward_to);
|
|
20572
|
-
socket.close();
|
|
20669
|
+
socket.close(1000);
|
|
20573
20670
|
if (!!item.message.forward_to) {
|
|
20574
20671
|
setTimeout(function () {
|
|
20575
20672
|
props.document.location.href = item.message.forward_to;
|
|
20576
20673
|
}, 200);
|
|
20577
20674
|
}
|
|
20675
|
+
} else if (item.message.confirmations) {
|
|
20676
|
+
setConfirmationsRequired(item.message.confirmations.required);
|
|
20677
|
+
setConfirmationsPassed(item.message.confirmations.passed);
|
|
20578
20678
|
}
|
|
20579
20679
|
};
|
|
20580
20680
|
socket.onerror = function (error) {
|
|
@@ -20619,10 +20719,10 @@
|
|
|
20619
20719
|
var _paymentRoute$feeAmou;
|
|
20620
20720
|
callTracking({
|
|
20621
20721
|
blockchain: transaction.blockchain,
|
|
20622
|
-
transaction: transaction.id
|
|
20623
|
-
sender: transaction.from
|
|
20624
|
-
nonce: transaction.nonce,
|
|
20625
|
-
after_block: afterBlock,
|
|
20722
|
+
transaction: transaction.id,
|
|
20723
|
+
sender: transaction.from,
|
|
20724
|
+
nonce: transaction.nonce.toString(),
|
|
20725
|
+
after_block: afterBlock.toString(),
|
|
20626
20726
|
from_token: paymentRoute.fromToken.address,
|
|
20627
20727
|
from_amount: paymentRoute.fromAmount.toString(),
|
|
20628
20728
|
from_decimals: paymentRoute.fromDecimals,
|
|
@@ -20631,6 +20731,7 @@
|
|
|
20631
20731
|
to_decimals: paymentRoute.toDecimals,
|
|
20632
20732
|
fee_amount: paymentRoute === null || paymentRoute === void 0 ? void 0 : (_paymentRoute$feeAmou = paymentRoute.feeAmount) === null || _paymentRoute$feeAmou === void 0 ? void 0 : _paymentRoute$feeAmou.toString()
|
|
20633
20733
|
}).then(function (response) {
|
|
20734
|
+
setTrackingInitialized(true);
|
|
20634
20735
|
console.log('PAYMENT TRACKING INITIALIZED');
|
|
20635
20736
|
})["catch"](function (error) {
|
|
20636
20737
|
console.log('PAYMENT TRACKING FAILED', error);
|
|
@@ -20643,10 +20744,10 @@
|
|
|
20643
20744
|
}
|
|
20644
20745
|
var payment = {
|
|
20645
20746
|
blockchain: transaction.blockchain,
|
|
20646
|
-
transaction: transaction.id
|
|
20647
|
-
sender: transaction.from
|
|
20648
|
-
nonce: transaction.nonce,
|
|
20649
|
-
after_block: afterBlock,
|
|
20747
|
+
transaction: transaction.id,
|
|
20748
|
+
sender: transaction.from,
|
|
20749
|
+
nonce: transaction.nonce.toString(),
|
|
20750
|
+
after_block: afterBlock.toString(),
|
|
20650
20751
|
to_token: paymentRoute.toToken.address
|
|
20651
20752
|
};
|
|
20652
20753
|
var handlePollingResponse = function handlePollingResponse(data) {
|
|
@@ -20687,7 +20788,7 @@
|
|
|
20687
20788
|
if (!polling) {
|
|
20688
20789
|
return;
|
|
20689
20790
|
}
|
|
20690
|
-
if (!
|
|
20791
|
+
if (!synchronousTracking) {
|
|
20691
20792
|
return;
|
|
20692
20793
|
}
|
|
20693
20794
|
var pollingInterval = setInterval(function () {
|
|
@@ -20706,16 +20807,16 @@
|
|
|
20706
20807
|
body: JSON.stringify({
|
|
20707
20808
|
blockchain: transaction.blockchain,
|
|
20708
20809
|
transaction: transaction.id,
|
|
20709
|
-
sender: transaction.from
|
|
20710
|
-
nonce: transaction.nonce,
|
|
20810
|
+
sender: transaction.from,
|
|
20811
|
+
nonce: transaction.nonce.toString(),
|
|
20711
20812
|
receiver: paymentRoute.toAddress,
|
|
20712
20813
|
token: paymentRoute.toToken.address,
|
|
20713
20814
|
amount: paymentRoute.fee ? ethers.ethers.utils.formatUnits(paymentRoute.transaction.params.amounts[1], paymentRoute.toDecimals) : ethers.ethers.utils.formatUnits(paymentRoute.toAmount, paymentRoute.toDecimals),
|
|
20714
20815
|
confirmations: 1,
|
|
20715
|
-
after_block: afterBlock,
|
|
20816
|
+
after_block: afterBlock.toString(),
|
|
20716
20817
|
uuid: transaction.id,
|
|
20717
20818
|
payload: {
|
|
20718
|
-
sender_id: transaction.from
|
|
20819
|
+
sender_id: transaction.from,
|
|
20719
20820
|
sender_token_id: paymentRoute.fromToken.address,
|
|
20720
20821
|
sender_amount: ethers.ethers.utils.formatUnits(paymentRoute.fromAmount, paymentRoute.fromDecimals),
|
|
20721
20822
|
integration: integration,
|
|
@@ -20739,10 +20840,10 @@
|
|
|
20739
20840
|
};
|
|
20740
20841
|
var initializeTracking = function initializeTracking(transaction, afterBlock, paymentRoute) {
|
|
20741
20842
|
storePayment(transaction, afterBlock, paymentRoute);
|
|
20742
|
-
if (
|
|
20843
|
+
if (synchronousTracking || track && track.async == true) {
|
|
20743
20844
|
startTracking(transaction, afterBlock, paymentRoute);
|
|
20744
20845
|
}
|
|
20745
|
-
if (
|
|
20846
|
+
if (synchronousTracking == false) {
|
|
20746
20847
|
return;
|
|
20747
20848
|
}
|
|
20748
20849
|
setTransaction(transaction);
|
|
@@ -20750,13 +20851,95 @@
|
|
|
20750
20851
|
setPaymentRoute(paymentRoute);
|
|
20751
20852
|
openSocket(transaction);
|
|
20752
20853
|
};
|
|
20854
|
+
var preTrack = function preTrack(afterBlock, paymentRoute) {
|
|
20855
|
+
if (!synchronousTracking && !asynchronousTracking) {
|
|
20856
|
+
return Promise.resolve();
|
|
20857
|
+
}
|
|
20858
|
+
return new Promise( /*#__PURE__*/function () {
|
|
20859
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(resolve, reject) {
|
|
20860
|
+
var _paymentRoute$feeAmou2;
|
|
20861
|
+
var payment;
|
|
20862
|
+
return regenerator.wrap(function _callee$(_context) {
|
|
20863
|
+
while (1) switch (_context.prev = _context.next) {
|
|
20864
|
+
case 0:
|
|
20865
|
+
_context.t0 = paymentRoute.blockchain;
|
|
20866
|
+
_context.t1 = account;
|
|
20867
|
+
_context.next = 4;
|
|
20868
|
+
return web3Client.request({
|
|
20869
|
+
blockchain: paymentRoute.blockchain,
|
|
20870
|
+
address: account,
|
|
20871
|
+
method: 'transactionCount'
|
|
20872
|
+
});
|
|
20873
|
+
case 4:
|
|
20874
|
+
_context.t2 = _context.sent.toString();
|
|
20875
|
+
_context.t3 = afterBlock.toString();
|
|
20876
|
+
_context.t4 = paymentRoute.fromToken.address;
|
|
20877
|
+
_context.t5 = paymentRoute.fromAmount.toString();
|
|
20878
|
+
_context.t6 = paymentRoute.fromDecimals;
|
|
20879
|
+
_context.t7 = paymentRoute.toToken.address;
|
|
20880
|
+
_context.t8 = paymentRoute.toAmount.toString();
|
|
20881
|
+
_context.t9 = paymentRoute.toDecimals;
|
|
20882
|
+
_context.t10 = paymentRoute === null || paymentRoute === void 0 ? void 0 : (_paymentRoute$feeAmou2 = paymentRoute.feeAmount) === null || _paymentRoute$feeAmou2 === void 0 ? void 0 : _paymentRoute$feeAmou2.toString();
|
|
20883
|
+
payment = {
|
|
20884
|
+
blockchain: _context.t0,
|
|
20885
|
+
sender: _context.t1,
|
|
20886
|
+
nonce: _context.t2,
|
|
20887
|
+
after_block: _context.t3,
|
|
20888
|
+
from_token: _context.t4,
|
|
20889
|
+
from_amount: _context.t5,
|
|
20890
|
+
from_decimals: _context.t6,
|
|
20891
|
+
to_token: _context.t7,
|
|
20892
|
+
to_amount: _context.t8,
|
|
20893
|
+
to_decimals: _context.t9,
|
|
20894
|
+
fee_amount: _context.t10
|
|
20895
|
+
};
|
|
20896
|
+
if (!track.endpoint) {
|
|
20897
|
+
_context.next = 18;
|
|
20898
|
+
break;
|
|
20899
|
+
}
|
|
20900
|
+
return _context.abrupt("return", fetch(track.endpoint, {
|
|
20901
|
+
method: 'POST',
|
|
20902
|
+
headers: {
|
|
20903
|
+
'Content-Type': 'application/json'
|
|
20904
|
+
},
|
|
20905
|
+
body: JSON.stringify(payment)
|
|
20906
|
+
}).then(function (response) {
|
|
20907
|
+
if (response.status == 200 || response.status == 201) {
|
|
20908
|
+
console.log('PAYMENT PRETRACKING INITIALIZED');
|
|
20909
|
+
return resolve();
|
|
20910
|
+
} else {
|
|
20911
|
+
return reject('PRETRACKING REQUEST FAILED');
|
|
20912
|
+
}
|
|
20913
|
+
}));
|
|
20914
|
+
case 18:
|
|
20915
|
+
if (track.method) {
|
|
20916
|
+
track.method(payment).then(resolve)["catch"](reject);
|
|
20917
|
+
} else {
|
|
20918
|
+
reject('No tracking defined!');
|
|
20919
|
+
}
|
|
20920
|
+
case 19:
|
|
20921
|
+
case "end":
|
|
20922
|
+
return _context.stop();
|
|
20923
|
+
}
|
|
20924
|
+
}, _callee);
|
|
20925
|
+
}));
|
|
20926
|
+
return function (_x, _x2) {
|
|
20927
|
+
return _ref.apply(this, arguments);
|
|
20928
|
+
};
|
|
20929
|
+
}());
|
|
20930
|
+
};
|
|
20753
20931
|
return /*#__PURE__*/React__default["default"].createElement(PaymentTrackingContext.Provider, {
|
|
20754
20932
|
value: {
|
|
20755
|
-
|
|
20933
|
+
synchronousTracking: synchronousTracking,
|
|
20934
|
+
asynchronousTracking: asynchronousTracking,
|
|
20756
20935
|
initializeTracking: initializeTracking,
|
|
20936
|
+
preTrack: preTrack,
|
|
20937
|
+
trackingInitialized: trackingInitialized,
|
|
20757
20938
|
continueTryTracking: continueTryTracking,
|
|
20758
20939
|
release: release,
|
|
20759
|
-
forwardTo: forwardTo
|
|
20940
|
+
forwardTo: forwardTo,
|
|
20941
|
+
confirmationsRequired: confirmationsRequired,
|
|
20942
|
+
confirmationsPassed: confirmationsPassed
|
|
20760
20943
|
}
|
|
20761
20944
|
}, props.children);
|
|
20762
20945
|
});
|
|
@@ -20781,7 +20964,7 @@
|
|
|
20781
20964
|
React.useEffect(function () {
|
|
20782
20965
|
if (polling) {
|
|
20783
20966
|
var poll = function poll() {
|
|
20784
|
-
fetch("https://public.depay.com/transactions/".concat(givenTransaction.blockchain, "/").concat(givenTransaction.from
|
|
20967
|
+
fetch("https://public.depay.com/transactions/".concat(givenTransaction.blockchain, "/").concat(givenTransaction.from, "/").concat(givenTransaction.nonce)).then(function (response) {
|
|
20785
20968
|
if (response.status == 200) {
|
|
20786
20969
|
response.json().then(function (data) {
|
|
20787
20970
|
if (data.status != 'pending') {
|
|
@@ -20814,10 +20997,10 @@
|
|
|
20814
20997
|
},
|
|
20815
20998
|
body: JSON.stringify({
|
|
20816
20999
|
id: transaction.id,
|
|
20817
|
-
after_block: afterBlock,
|
|
21000
|
+
after_block: afterBlock.toString(),
|
|
20818
21001
|
blockchain: transaction.blockchain,
|
|
20819
|
-
sender: transaction.from
|
|
20820
|
-
nonce: transaction.nonce
|
|
21002
|
+
sender: transaction.from,
|
|
21003
|
+
nonce: transaction.nonce.toString()
|
|
20821
21004
|
})
|
|
20822
21005
|
}).then(function (response) {
|
|
20823
21006
|
if (response.status == 200 || response.status == 201) {
|
|
@@ -20842,14 +21025,18 @@
|
|
|
20842
21025
|
command: 'subscribe',
|
|
20843
21026
|
identifier: JSON.stringify({
|
|
20844
21027
|
blockchain: transaction.blockchain,
|
|
20845
|
-
sender: transaction.from
|
|
20846
|
-
nonce: transaction.nonce,
|
|
21028
|
+
sender: transaction.from,
|
|
21029
|
+
nonce: transaction.nonce.toString(),
|
|
20847
21030
|
channel: 'TransactionChannel'
|
|
20848
21031
|
})
|
|
20849
21032
|
};
|
|
20850
21033
|
socket.send(JSON.stringify(msg));
|
|
20851
21034
|
};
|
|
20852
|
-
socket.onclose = function (event) {
|
|
21035
|
+
socket.onclose = function (event) {
|
|
21036
|
+
if (!event || event.code != 1000) {
|
|
21037
|
+
openSocket(transaction);
|
|
21038
|
+
}
|
|
21039
|
+
};
|
|
20853
21040
|
socket.onmessage = function (event) {
|
|
20854
21041
|
var item = JSON.parse(event.data);
|
|
20855
21042
|
if (item.type === "ping") {
|
|
@@ -20857,6 +21044,7 @@
|
|
|
20857
21044
|
}
|
|
20858
21045
|
if (item.message && item.message.status && item.message.status != 'pending') {
|
|
20859
21046
|
setFoundTransaction(item.message);
|
|
21047
|
+
socket.close(1000);
|
|
20860
21048
|
}
|
|
20861
21049
|
};
|
|
20862
21050
|
socket.onerror = function (error) {
|
|
@@ -20937,34 +21125,32 @@
|
|
|
20937
21125
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_ref) {
|
|
20938
21126
|
var accept;
|
|
20939
21127
|
return regenerator.wrap(function _callee$(_context) {
|
|
20940
|
-
while (1) {
|
|
20941
|
-
|
|
20942
|
-
|
|
20943
|
-
|
|
20944
|
-
|
|
20945
|
-
|
|
20946
|
-
|
|
21128
|
+
while (1) switch (_context.prev = _context.next) {
|
|
21129
|
+
case 0:
|
|
21130
|
+
accept = _ref.accept;
|
|
21131
|
+
if (!(!(accept instanceof Array) || accept.length == 0)) {
|
|
21132
|
+
_context.next = 3;
|
|
21133
|
+
break;
|
|
21134
|
+
}
|
|
21135
|
+
throw 'You need to set the tokens you accept as donation!';
|
|
21136
|
+
case 3:
|
|
21137
|
+
accept.forEach(function (configuration) {
|
|
21138
|
+
if (typeof configuration.blockchain === 'undefined') {
|
|
21139
|
+
throw 'You need to set the blockchain you want to receive the donation on!';
|
|
20947
21140
|
}
|
|
20948
|
-
|
|
20949
|
-
|
|
20950
|
-
|
|
20951
|
-
|
|
20952
|
-
|
|
20953
|
-
|
|
20954
|
-
|
|
20955
|
-
|
|
20956
|
-
|
|
20957
|
-
|
|
20958
|
-
|
|
20959
|
-
|
|
20960
|
-
|
|
20961
|
-
throw 'You need to set the receiver address that you want to receive the donation!';
|
|
20962
|
-
}
|
|
20963
|
-
});
|
|
20964
|
-
case 4:
|
|
20965
|
-
case "end":
|
|
20966
|
-
return _context.stop();
|
|
20967
|
-
}
|
|
21141
|
+
if (!['ethereum', 'bsc', 'polygon'].includes(configuration.blockchain)) {
|
|
21142
|
+
throw 'You need to set a supported blockchain!';
|
|
21143
|
+
}
|
|
21144
|
+
if (typeof configuration.token === 'undefined') {
|
|
21145
|
+
throw 'You need to set the token you want to receive as donation!';
|
|
21146
|
+
}
|
|
21147
|
+
if (typeof configuration.receiver === 'undefined') {
|
|
21148
|
+
throw 'You need to set the receiver address that you want to receive the donation!';
|
|
21149
|
+
}
|
|
21150
|
+
});
|
|
21151
|
+
case 4:
|
|
21152
|
+
case "end":
|
|
21153
|
+
return _context.stop();
|
|
20968
21154
|
}
|
|
20969
21155
|
}, _callee);
|
|
20970
21156
|
}));
|
|
@@ -20976,82 +21162,80 @@
|
|
|
20976
21162
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
|
|
20977
21163
|
var amount, accept, event, sent, succeeded, validated, failed, error, critical, style, whitelist, blacklist, providers, currency, connected, closed, track, fee, closable, integration, link, container, title, document, unmount;
|
|
20978
21164
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
20979
|
-
while (1) {
|
|
20980
|
-
|
|
20981
|
-
|
|
20982
|
-
|
|
20983
|
-
|
|
20984
|
-
|
|
20985
|
-
|
|
20986
|
-
|
|
20987
|
-
|
|
20988
|
-
|
|
20989
|
-
|
|
20990
|
-
|
|
20991
|
-
|
|
20992
|
-
|
|
20993
|
-
|
|
20994
|
-
|
|
20995
|
-
|
|
20996
|
-
return
|
|
20997
|
-
|
|
20998
|
-
|
|
20999
|
-
|
|
21000
|
-
|
|
21001
|
-
|
|
21002
|
-
|
|
21003
|
-
|
|
21004
|
-
|
|
21005
|
-
|
|
21006
|
-
|
|
21007
|
-
|
|
21008
|
-
|
|
21009
|
-
|
|
21010
|
-
|
|
21011
|
-
|
|
21012
|
-
|
|
21013
|
-
|
|
21014
|
-
|
|
21015
|
-
|
|
21016
|
-
|
|
21017
|
-
|
|
21018
|
-
|
|
21019
|
-
|
|
21020
|
-
|
|
21021
|
-
|
|
21022
|
-
|
|
21023
|
-
|
|
21024
|
-
|
|
21025
|
-
|
|
21026
|
-
|
|
21027
|
-
|
|
21028
|
-
|
|
21029
|
-
|
|
21030
|
-
|
|
21031
|
-
|
|
21032
|
-
|
|
21033
|
-
|
|
21034
|
-
|
|
21035
|
-
|
|
21036
|
-
|
|
21037
|
-
|
|
21038
|
-
|
|
21039
|
-
|
|
21040
|
-
|
|
21041
|
-
|
|
21042
|
-
|
|
21043
|
-
|
|
21044
|
-
|
|
21045
|
-
|
|
21046
|
-
|
|
21047
|
-
|
|
21048
|
-
|
|
21049
|
-
|
|
21050
|
-
|
|
21051
|
-
|
|
21052
|
-
|
|
21053
|
-
return _context2.stop();
|
|
21054
|
-
}
|
|
21165
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
21166
|
+
case 0:
|
|
21167
|
+
amount = _ref3.amount, accept = _ref3.accept, event = _ref3.event, sent = _ref3.sent, succeeded = _ref3.succeeded, validated = _ref3.validated, failed = _ref3.failed, error = _ref3.error, critical = _ref3.critical, style = _ref3.style, whitelist = _ref3.whitelist, blacklist = _ref3.blacklist, providers = _ref3.providers, currency = _ref3.currency, connected = _ref3.connected, closed = _ref3.closed, track = _ref3.track, fee = _ref3.fee, closable = _ref3.closable, integration = _ref3.integration, link = _ref3.link, container = _ref3.container, title = _ref3.title, document = _ref3.document;
|
|
21168
|
+
requireReactVersion();
|
|
21169
|
+
_context2.prev = 2;
|
|
21170
|
+
_context2.next = 5;
|
|
21171
|
+
return preflight$2({
|
|
21172
|
+
accept: accept
|
|
21173
|
+
});
|
|
21174
|
+
case 5:
|
|
21175
|
+
unmount = mount({
|
|
21176
|
+
style: style,
|
|
21177
|
+
container: container,
|
|
21178
|
+
document: ensureDocument(document),
|
|
21179
|
+
closed: closed
|
|
21180
|
+
}, function (unmount) {
|
|
21181
|
+
return function (container) {
|
|
21182
|
+
return /*#__PURE__*/React__default["default"].createElement(ErrorProvider, {
|
|
21183
|
+
errorCallback: error,
|
|
21184
|
+
container: container,
|
|
21185
|
+
unmount: unmount
|
|
21186
|
+
}, /*#__PURE__*/React__default["default"].createElement(ConfigurationProvider, {
|
|
21187
|
+
configuration: {
|
|
21188
|
+
type: 'donation',
|
|
21189
|
+
amount: amount,
|
|
21190
|
+
accept: accept,
|
|
21191
|
+
currency: currency,
|
|
21192
|
+
event: event,
|
|
21193
|
+
track: track,
|
|
21194
|
+
fee: fee,
|
|
21195
|
+
sent: sent,
|
|
21196
|
+
succeeded: succeeded,
|
|
21197
|
+
validated: validated,
|
|
21198
|
+
failed: failed,
|
|
21199
|
+
blacklist: blacklist,
|
|
21200
|
+
whitelist: whitelist,
|
|
21201
|
+
providers: providers,
|
|
21202
|
+
integration: integration,
|
|
21203
|
+
link: link,
|
|
21204
|
+
title: title
|
|
21205
|
+
}
|
|
21206
|
+
}, /*#__PURE__*/React__default["default"].createElement(UpdatableProvider, null, /*#__PURE__*/React__default["default"].createElement(ClosableProvider, {
|
|
21207
|
+
unmount: unmount,
|
|
21208
|
+
closable: closable
|
|
21209
|
+
}, /*#__PURE__*/React__default["default"].createElement(WalletProvider, {
|
|
21210
|
+
container: container,
|
|
21211
|
+
connected: connected,
|
|
21212
|
+
unmount: unmount
|
|
21213
|
+
}, /*#__PURE__*/React__default["default"].createElement(NavigateProvider, null, /*#__PURE__*/React__default["default"].createElement(ConversionRateProvider, null, /*#__PURE__*/React__default["default"].createElement(ChangableAmountProvider, {
|
|
21214
|
+
accept: accept
|
|
21215
|
+
}, /*#__PURE__*/React__default["default"].createElement(TransactionTrackingProvider, null, /*#__PURE__*/React__default["default"].createElement(PaymentTrackingProvider, {
|
|
21216
|
+
document: ensureDocument(document)
|
|
21217
|
+
}, /*#__PURE__*/React__default["default"].createElement(DonationRoutingProvider, {
|
|
21218
|
+
container: container,
|
|
21219
|
+
document: document
|
|
21220
|
+
}, /*#__PURE__*/React__default["default"].createElement(DonationStack, {
|
|
21221
|
+
document: document,
|
|
21222
|
+
container: container
|
|
21223
|
+
}), /*#__PURE__*/React__default["default"].createElement(PoweredBy, null))))))))))));
|
|
21224
|
+
};
|
|
21225
|
+
});
|
|
21226
|
+
return _context2.abrupt("return", {
|
|
21227
|
+
unmount: unmount
|
|
21228
|
+
});
|
|
21229
|
+
case 9:
|
|
21230
|
+
_context2.prev = 9;
|
|
21231
|
+
_context2.t0 = _context2["catch"](2);
|
|
21232
|
+
console.log('critical error', _context2.t0);
|
|
21233
|
+
if (critical != undefined) {
|
|
21234
|
+
critical(_context2.t0);
|
|
21235
|
+
}
|
|
21236
|
+
case 13:
|
|
21237
|
+
case "end":
|
|
21238
|
+
return _context2.stop();
|
|
21055
21239
|
}
|
|
21056
21240
|
}, _callee2, null, [[2, 9]]);
|
|
21057
21241
|
}));
|
|
@@ -21172,46 +21356,44 @@
|
|
|
21172
21356
|
return new Promise( /*#__PURE__*/function () {
|
|
21173
21357
|
var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_resolve, reject) {
|
|
21174
21358
|
return regenerator.wrap(function _callee$(_context) {
|
|
21175
|
-
while (1) {
|
|
21176
|
-
|
|
21177
|
-
|
|
21178
|
-
|
|
21179
|
-
|
|
21180
|
-
|
|
21181
|
-
|
|
21182
|
-
|
|
21183
|
-
|
|
21184
|
-
|
|
21185
|
-
|
|
21186
|
-
|
|
21187
|
-
return
|
|
21188
|
-
|
|
21189
|
-
|
|
21190
|
-
|
|
21191
|
-
|
|
21192
|
-
|
|
21193
|
-
|
|
21194
|
-
|
|
21195
|
-
|
|
21196
|
-
|
|
21197
|
-
|
|
21198
|
-
|
|
21199
|
-
|
|
21200
|
-
|
|
21201
|
-
|
|
21202
|
-
|
|
21203
|
-
|
|
21204
|
-
|
|
21205
|
-
|
|
21206
|
-
|
|
21207
|
-
|
|
21208
|
-
|
|
21209
|
-
|
|
21210
|
-
|
|
21211
|
-
|
|
21212
|
-
|
|
21213
|
-
return _context.stop();
|
|
21214
|
-
}
|
|
21359
|
+
while (1) switch (_context.prev = _context.next) {
|
|
21360
|
+
case 0:
|
|
21361
|
+
Connect().then(function () {
|
|
21362
|
+
mount({
|
|
21363
|
+
style: style,
|
|
21364
|
+
document: ensureDocument(document)
|
|
21365
|
+
}, function (unmount) {
|
|
21366
|
+
var userClosedDialog = function userClosedDialog() {
|
|
21367
|
+
reject('USER_CLOSED_DIALOG');
|
|
21368
|
+
unmount();
|
|
21369
|
+
};
|
|
21370
|
+
return function (container) {
|
|
21371
|
+
return /*#__PURE__*/React__default["default"].createElement(ErrorProvider, {
|
|
21372
|
+
errorCallback: error,
|
|
21373
|
+
container: container,
|
|
21374
|
+
unmount: unmount
|
|
21375
|
+
}, /*#__PURE__*/React__default["default"].createElement(ConfigurationProvider, {
|
|
21376
|
+
configuration: {
|
|
21377
|
+
message: message,
|
|
21378
|
+
endpoint: endpoint || '/login',
|
|
21379
|
+
recover: recover
|
|
21380
|
+
}
|
|
21381
|
+
}, /*#__PURE__*/React__default["default"].createElement(UpdatableProvider, null, /*#__PURE__*/React__default["default"].createElement(ClosableProvider, {
|
|
21382
|
+
unmount: userClosedDialog
|
|
21383
|
+
}, /*#__PURE__*/React__default["default"].createElement(LoginStack, {
|
|
21384
|
+
document: document,
|
|
21385
|
+
container: container,
|
|
21386
|
+
resolve: function resolve(account) {
|
|
21387
|
+
unmount();
|
|
21388
|
+
_resolve(account);
|
|
21389
|
+
}
|
|
21390
|
+
}), /*#__PURE__*/React__default["default"].createElement(PoweredBy, null)))));
|
|
21391
|
+
};
|
|
21392
|
+
});
|
|
21393
|
+
})["catch"](reject);
|
|
21394
|
+
case 1:
|
|
21395
|
+
case "end":
|
|
21396
|
+
return _context.stop();
|
|
21215
21397
|
}
|
|
21216
21398
|
}, _callee);
|
|
21217
21399
|
}));
|
|
@@ -21386,11 +21568,49 @@
|
|
|
21386
21568
|
});
|
|
21387
21569
|
});
|
|
21388
21570
|
|
|
21571
|
+
var PreTrackingFailedDialog = (function () {
|
|
21572
|
+
var _useContext = React.useContext(PaymentContext);
|
|
21573
|
+
_useContext.transaction;
|
|
21574
|
+
var _useContext2 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
21575
|
+
navigate = _useContext2.navigate;
|
|
21576
|
+
var tryAgain = function tryAgain() {
|
|
21577
|
+
navigate('back');
|
|
21578
|
+
};
|
|
21579
|
+
return /*#__PURE__*/React__default["default"].createElement(Dialog$1, {
|
|
21580
|
+
stacked: false,
|
|
21581
|
+
header: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
21582
|
+
className: "PaddingTopS PaddingLeftM PaddingRightM"
|
|
21583
|
+
}),
|
|
21584
|
+
body: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
21585
|
+
className: "TextCenter"
|
|
21586
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
21587
|
+
className: "GraphicWrapper"
|
|
21588
|
+
}, /*#__PURE__*/React__default["default"].createElement("img", {
|
|
21589
|
+
className: "Graphic",
|
|
21590
|
+
src: ErrorGraphic
|
|
21591
|
+
})), /*#__PURE__*/React__default["default"].createElement("h1", {
|
|
21592
|
+
className: "LineHeightL Text FontSizeL PaddingTopS FontWeightBold"
|
|
21593
|
+
}, "Tracking payment failed"), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
21594
|
+
className: "Text PaddingTopS PaddingBottomS PaddingLeftS PaddingRightS"
|
|
21595
|
+
}, /*#__PURE__*/React__default["default"].createElement("strong", {
|
|
21596
|
+
className: "FontSizeM"
|
|
21597
|
+
}, "Please ensure you are connected to the internet, then click \"Try again\"."), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
21598
|
+
className: "PaddingTopS"
|
|
21599
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", null, "If this keeps happening, please report it.")))),
|
|
21600
|
+
footer: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
21601
|
+
className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
|
|
21602
|
+
}, /*#__PURE__*/React__default["default"].createElement("button", {
|
|
21603
|
+
className: "ButtonPrimary",
|
|
21604
|
+
onClick: tryAgain
|
|
21605
|
+
}, "Try again"))
|
|
21606
|
+
});
|
|
21607
|
+
});
|
|
21608
|
+
|
|
21389
21609
|
var TrackingFailedDialog = (function () {
|
|
21390
21610
|
var _useContext = React.useContext(PaymentTrackingContext),
|
|
21391
21611
|
continueTryTracking = _useContext.continueTryTracking;
|
|
21392
|
-
var _useContext2 = React.useContext(PaymentContext)
|
|
21393
|
-
|
|
21612
|
+
var _useContext2 = React.useContext(PaymentContext);
|
|
21613
|
+
_useContext2.transaction;
|
|
21394
21614
|
var _useContext3 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
21395
21615
|
navigate = _useContext3.navigate;
|
|
21396
21616
|
var tryAgain = function tryAgain() {
|
|
@@ -21417,10 +21637,7 @@
|
|
|
21417
21637
|
className: "FontSizeM"
|
|
21418
21638
|
}, "Please ensure you are connected to the internet, then click \"Try again\"."), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
21419
21639
|
className: "PaddingTopS"
|
|
21420
|
-
}, /*#__PURE__*/React__default["default"].createElement("span", null, "If this keeps happening,
|
|
21421
|
-
className: "Link",
|
|
21422
|
-
href: "mailto:support@depay.com?subject=Payment%20tracking%20failed&body=Tracking%20my%20payment%20failed%0A%0ATransaction:%20".concat(transaction.url)
|
|
21423
|
-
}, "please report it"), "."))),
|
|
21640
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", null, "If this keeps happening, please report it.")))),
|
|
21424
21641
|
footer: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
21425
21642
|
className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
|
|
21426
21643
|
}, /*#__PURE__*/React__default["default"].createElement("button", {
|
|
@@ -21449,7 +21666,8 @@
|
|
|
21449
21666
|
ChangePayment: /*#__PURE__*/React__default["default"].createElement(ChangePaymentDialog, null),
|
|
21450
21667
|
PaymentFailed: /*#__PURE__*/React__default["default"].createElement(PaymentFailedDialog, null),
|
|
21451
21668
|
WrongNetwork: /*#__PURE__*/React__default["default"].createElement(WrongNetworkDialog, null),
|
|
21452
|
-
TrackingFailed: /*#__PURE__*/React__default["default"].createElement(TrackingFailedDialog, null)
|
|
21669
|
+
TrackingFailed: /*#__PURE__*/React__default["default"].createElement(TrackingFailedDialog, null),
|
|
21670
|
+
PreTrackingFailed: /*#__PURE__*/React__default["default"].createElement(PreTrackingFailedDialog, null)
|
|
21453
21671
|
}
|
|
21454
21672
|
});
|
|
21455
21673
|
});
|
|
@@ -21458,37 +21676,35 @@
|
|
|
21458
21676
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_ref) {
|
|
21459
21677
|
var accept, recover;
|
|
21460
21678
|
return regenerator.wrap(function _callee$(_context) {
|
|
21461
|
-
while (1) {
|
|
21462
|
-
|
|
21463
|
-
|
|
21464
|
-
|
|
21465
|
-
|
|
21466
|
-
|
|
21467
|
-
|
|
21679
|
+
while (1) switch (_context.prev = _context.next) {
|
|
21680
|
+
case 0:
|
|
21681
|
+
accept = _ref.accept, recover = _ref.recover;
|
|
21682
|
+
if (!recover) {
|
|
21683
|
+
_context.next = 3;
|
|
21684
|
+
break;
|
|
21685
|
+
}
|
|
21686
|
+
return _context.abrupt("return");
|
|
21687
|
+
case 3:
|
|
21688
|
+
accept.forEach(function (configuration) {
|
|
21689
|
+
if (typeof configuration.blockchain === 'undefined') {
|
|
21690
|
+
throw 'You need to set the blockchain your want to receive the payment on!';
|
|
21468
21691
|
}
|
|
21469
|
-
|
|
21470
|
-
|
|
21471
|
-
|
|
21472
|
-
|
|
21473
|
-
|
|
21474
|
-
|
|
21475
|
-
|
|
21476
|
-
|
|
21477
|
-
|
|
21478
|
-
|
|
21479
|
-
|
|
21480
|
-
|
|
21481
|
-
|
|
21482
|
-
|
|
21483
|
-
|
|
21484
|
-
|
|
21485
|
-
throw 'You need to set the receiver address that you want to receive the payment!';
|
|
21486
|
-
}
|
|
21487
|
-
});
|
|
21488
|
-
case 4:
|
|
21489
|
-
case "end":
|
|
21490
|
-
return _context.stop();
|
|
21491
|
-
}
|
|
21692
|
+
if (!['ethereum', 'bsc', 'polygon'].includes(configuration.blockchain)) {
|
|
21693
|
+
throw 'You need to set a supported blockchain!';
|
|
21694
|
+
}
|
|
21695
|
+
if (typeof configuration.token === 'undefined' && typeof configuration.fromToken === 'undefined' && typeof configuration.fromAmount === 'undefined' && typeof configuration.toToken === 'undefined') {
|
|
21696
|
+
throw 'You need to set the token you want to receive as payment!';
|
|
21697
|
+
}
|
|
21698
|
+
if (typeof configuration.token === 'undefined' && typeof configuration.fromToken !== 'undefined' && typeof configuration.fromAmount === 'undefined' && typeof configuration.toToken === 'undefined') {
|
|
21699
|
+
throw 'You need to set the fromToken, fromAmount and toToken!';
|
|
21700
|
+
}
|
|
21701
|
+
if (typeof configuration.receiver === 'undefined') {
|
|
21702
|
+
throw 'You need to set the receiver address that you want to receive the payment!';
|
|
21703
|
+
}
|
|
21704
|
+
});
|
|
21705
|
+
case 4:
|
|
21706
|
+
case "end":
|
|
21707
|
+
return _context.stop();
|
|
21492
21708
|
}
|
|
21493
21709
|
}, _callee);
|
|
21494
21710
|
}));
|
|
@@ -21498,93 +21714,91 @@
|
|
|
21498
21714
|
}();
|
|
21499
21715
|
var Payment = /*#__PURE__*/function () {
|
|
21500
21716
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
|
|
21501
|
-
var accept, amount,
|
|
21717
|
+
var accept, amount, sent, succeeded, validated, failed, error, critical, style, whitelist, blacklist, providers, currency, connected, closed, track, fee, recover, closable, integration, link, container, before, document, unmount;
|
|
21502
21718
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
21503
|
-
while (1) {
|
|
21504
|
-
|
|
21505
|
-
|
|
21506
|
-
|
|
21507
|
-
|
|
21508
|
-
|
|
21509
|
-
|
|
21510
|
-
|
|
21511
|
-
|
|
21512
|
-
|
|
21513
|
-
|
|
21514
|
-
|
|
21515
|
-
|
|
21516
|
-
|
|
21517
|
-
|
|
21518
|
-
|
|
21519
|
-
|
|
21520
|
-
|
|
21521
|
-
return
|
|
21522
|
-
|
|
21523
|
-
|
|
21524
|
-
|
|
21525
|
-
|
|
21526
|
-
|
|
21527
|
-
|
|
21528
|
-
|
|
21529
|
-
|
|
21530
|
-
amount: amount,
|
|
21531
|
-
accept: accept,
|
|
21532
|
-
currency: currency,
|
|
21533
|
-
event: event,
|
|
21534
|
-
sent: sent,
|
|
21535
|
-
succeeded: succeeded,
|
|
21536
|
-
validated: validated,
|
|
21537
|
-
failed: failed,
|
|
21538
|
-
whitelist: whitelist,
|
|
21539
|
-
blacklist: blacklist,
|
|
21540
|
-
providers: providers,
|
|
21541
|
-
track: track,
|
|
21542
|
-
fee: fee,
|
|
21543
|
-
recover: recover,
|
|
21544
|
-
integration: integration,
|
|
21545
|
-
link: link
|
|
21546
|
-
}
|
|
21547
|
-
}, /*#__PURE__*/React__default["default"].createElement(UpdatableProvider, null, /*#__PURE__*/React__default["default"].createElement(ClosableProvider, {
|
|
21548
|
-
unmount: unmount,
|
|
21549
|
-
closable: closable
|
|
21550
|
-
}, /*#__PURE__*/React__default["default"].createElement(WalletProvider, {
|
|
21551
|
-
document: document,
|
|
21552
|
-
container: container,
|
|
21553
|
-
connected: connected,
|
|
21554
|
-
unmount: unmount
|
|
21555
|
-
}, /*#__PURE__*/React__default["default"].createElement(NavigateProvider, null, /*#__PURE__*/React__default["default"].createElement(ConversionRateProvider, null, /*#__PURE__*/React__default["default"].createElement(ChangableAmountProvider, {
|
|
21556
|
-
accept: accept
|
|
21557
|
-
}, /*#__PURE__*/React__default["default"].createElement(PaymentAmountRoutingProvider, {
|
|
21719
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
21720
|
+
case 0:
|
|
21721
|
+
accept = _ref3.accept, amount = _ref3.amount, sent = _ref3.sent, succeeded = _ref3.succeeded, validated = _ref3.validated, failed = _ref3.failed, error = _ref3.error, critical = _ref3.critical, style = _ref3.style, whitelist = _ref3.whitelist, blacklist = _ref3.blacklist, providers = _ref3.providers, currency = _ref3.currency, connected = _ref3.connected, closed = _ref3.closed, track = _ref3.track, fee = _ref3.fee, recover = _ref3.recover, closable = _ref3.closable, integration = _ref3.integration, link = _ref3.link, container = _ref3.container, before = _ref3.before, document = _ref3.document;
|
|
21722
|
+
requireReactVersion();
|
|
21723
|
+
_context2.prev = 2;
|
|
21724
|
+
_context2.next = 5;
|
|
21725
|
+
return preflight$1({
|
|
21726
|
+
accept: accept,
|
|
21727
|
+
recover: recover
|
|
21728
|
+
});
|
|
21729
|
+
case 5:
|
|
21730
|
+
unmount = mount({
|
|
21731
|
+
style: style,
|
|
21732
|
+
container: container,
|
|
21733
|
+
document: ensureDocument(document),
|
|
21734
|
+
closed: closed
|
|
21735
|
+
}, function (unmount) {
|
|
21736
|
+
return function (container) {
|
|
21737
|
+
return /*#__PURE__*/React__default["default"].createElement(ErrorProvider, {
|
|
21738
|
+
errorCallback: error,
|
|
21739
|
+
container: container,
|
|
21740
|
+
unmount: unmount
|
|
21741
|
+
}, /*#__PURE__*/React__default["default"].createElement(ConfigurationProvider, {
|
|
21742
|
+
configuration: {
|
|
21743
|
+
type: 'payment',
|
|
21744
|
+
before: before,
|
|
21745
|
+
amount: amount,
|
|
21558
21746
|
accept: accept,
|
|
21747
|
+
currency: currency,
|
|
21748
|
+
event: event,
|
|
21749
|
+
sent: sent,
|
|
21750
|
+
succeeded: succeeded,
|
|
21751
|
+
validated: validated,
|
|
21752
|
+
failed: failed,
|
|
21559
21753
|
whitelist: whitelist,
|
|
21560
21754
|
blacklist: blacklist,
|
|
21561
|
-
|
|
21562
|
-
|
|
21563
|
-
|
|
21564
|
-
|
|
21565
|
-
|
|
21566
|
-
|
|
21567
|
-
|
|
21568
|
-
|
|
21569
|
-
|
|
21570
|
-
|
|
21571
|
-
|
|
21572
|
-
|
|
21573
|
-
|
|
21574
|
-
|
|
21575
|
-
|
|
21576
|
-
|
|
21577
|
-
|
|
21578
|
-
|
|
21579
|
-
|
|
21580
|
-
|
|
21581
|
-
|
|
21582
|
-
|
|
21583
|
-
|
|
21584
|
-
|
|
21585
|
-
|
|
21586
|
-
|
|
21587
|
-
|
|
21755
|
+
providers: providers,
|
|
21756
|
+
track: track,
|
|
21757
|
+
fee: fee,
|
|
21758
|
+
recover: recover,
|
|
21759
|
+
integration: integration,
|
|
21760
|
+
link: link
|
|
21761
|
+
}
|
|
21762
|
+
}, /*#__PURE__*/React__default["default"].createElement(UpdatableProvider, null, /*#__PURE__*/React__default["default"].createElement(ClosableProvider, {
|
|
21763
|
+
unmount: unmount,
|
|
21764
|
+
closable: closable
|
|
21765
|
+
}, /*#__PURE__*/React__default["default"].createElement(WalletProvider, {
|
|
21766
|
+
document: document,
|
|
21767
|
+
container: container,
|
|
21768
|
+
connected: connected,
|
|
21769
|
+
unmount: unmount
|
|
21770
|
+
}, /*#__PURE__*/React__default["default"].createElement(NavigateProvider, null, /*#__PURE__*/React__default["default"].createElement(ConversionRateProvider, null, /*#__PURE__*/React__default["default"].createElement(ChangableAmountProvider, {
|
|
21771
|
+
accept: accept
|
|
21772
|
+
}, /*#__PURE__*/React__default["default"].createElement(PaymentAmountRoutingProvider, {
|
|
21773
|
+
accept: accept,
|
|
21774
|
+
whitelist: whitelist,
|
|
21775
|
+
blacklist: blacklist,
|
|
21776
|
+
event: event,
|
|
21777
|
+
fee: fee
|
|
21778
|
+
}, /*#__PURE__*/React__default["default"].createElement(TransactionTrackingProvider, null, /*#__PURE__*/React__default["default"].createElement(PaymentTrackingProvider, {
|
|
21779
|
+
document: ensureDocument(document)
|
|
21780
|
+
}, /*#__PURE__*/React__default["default"].createElement(PaymentProvider, {
|
|
21781
|
+
container: container,
|
|
21782
|
+
document: document
|
|
21783
|
+
}, /*#__PURE__*/React__default["default"].createElement(PaymentValueProvider, null, /*#__PURE__*/React__default["default"].createElement(PaymentStack, {
|
|
21784
|
+
document: document,
|
|
21785
|
+
container: container
|
|
21786
|
+
}), /*#__PURE__*/React__default["default"].createElement(PoweredBy, null))))))))))))));
|
|
21787
|
+
};
|
|
21788
|
+
});
|
|
21789
|
+
return _context2.abrupt("return", {
|
|
21790
|
+
unmount: unmount
|
|
21791
|
+
});
|
|
21792
|
+
case 9:
|
|
21793
|
+
_context2.prev = 9;
|
|
21794
|
+
_context2.t0 = _context2["catch"](2);
|
|
21795
|
+
console.log('critical error', _context2.t0);
|
|
21796
|
+
if (critical != undefined) {
|
|
21797
|
+
critical(_context2.t0);
|
|
21798
|
+
}
|
|
21799
|
+
case 13:
|
|
21800
|
+
case "end":
|
|
21801
|
+
return _context2.stop();
|
|
21588
21802
|
}
|
|
21589
21803
|
}, _callee2, null, [[2, 9]]);
|
|
21590
21804
|
}));
|
|
@@ -21596,15 +21810,14 @@
|
|
|
21596
21810
|
var account = _ref5.account,
|
|
21597
21811
|
accept = _ref5.accept,
|
|
21598
21812
|
whitelist = _ref5.whitelist,
|
|
21599
|
-
blacklist = _ref5.blacklist
|
|
21600
|
-
|
|
21601
|
-
fee = _ref5.fee;
|
|
21813
|
+
blacklist = _ref5.blacklist;
|
|
21814
|
+
_ref5.event;
|
|
21815
|
+
var fee = _ref5.fee;
|
|
21602
21816
|
routePayments({
|
|
21603
21817
|
account: account,
|
|
21604
21818
|
accept: accept,
|
|
21605
21819
|
whitelist: whitelist,
|
|
21606
21820
|
blacklist: blacklist,
|
|
21607
|
-
event: event,
|
|
21608
21821
|
fee: fee
|
|
21609
21822
|
});
|
|
21610
21823
|
};
|
|
@@ -21870,31 +22083,29 @@
|
|
|
21870
22083
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_ref) {
|
|
21871
22084
|
var sell;
|
|
21872
22085
|
return regenerator.wrap(function _callee$(_context) {
|
|
21873
|
-
while (1) {
|
|
21874
|
-
|
|
21875
|
-
|
|
21876
|
-
|
|
21877
|
-
|
|
21878
|
-
|
|
21879
|
-
|
|
21880
|
-
|
|
21881
|
-
|
|
21882
|
-
|
|
21883
|
-
|
|
21884
|
-
|
|
21885
|
-
|
|
21886
|
-
|
|
21887
|
-
|
|
21888
|
-
|
|
21889
|
-
|
|
21890
|
-
|
|
21891
|
-
|
|
21892
|
-
|
|
21893
|
-
|
|
21894
|
-
|
|
21895
|
-
|
|
21896
|
-
return _context.stop();
|
|
21897
|
-
}
|
|
22086
|
+
while (1) switch (_context.prev = _context.next) {
|
|
22087
|
+
case 0:
|
|
22088
|
+
sell = _ref.sell;
|
|
22089
|
+
if (!(_typeof(sell) != 'object')) {
|
|
22090
|
+
_context.next = 3;
|
|
22091
|
+
break;
|
|
22092
|
+
}
|
|
22093
|
+
throw 'You need to configure at least 1 "blockchain": "token"';
|
|
22094
|
+
case 3:
|
|
22095
|
+
if (!(Object.keys(sell).length == 0)) {
|
|
22096
|
+
_context.next = 5;
|
|
22097
|
+
break;
|
|
22098
|
+
}
|
|
22099
|
+
throw 'You need to configure at least 1 "blockchain": "token"';
|
|
22100
|
+
case 5:
|
|
22101
|
+
if (!(Object.values(sell).length == 0)) {
|
|
22102
|
+
_context.next = 7;
|
|
22103
|
+
break;
|
|
22104
|
+
}
|
|
22105
|
+
throw 'You need to configure at least 1 "blockchain": "token"';
|
|
22106
|
+
case 7:
|
|
22107
|
+
case "end":
|
|
22108
|
+
return _context.stop();
|
|
21898
22109
|
}
|
|
21899
22110
|
}, _callee);
|
|
21900
22111
|
}));
|
|
@@ -21906,81 +22117,79 @@
|
|
|
21906
22117
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
|
|
21907
22118
|
var amount, sell, sent, succeeded, failed, error, critical, style, blacklist, providers, currency, connected, closed, tokenImage, closable, integration, document, accept, unmount;
|
|
21908
22119
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
21909
|
-
while (1) {
|
|
21910
|
-
|
|
21911
|
-
|
|
21912
|
-
|
|
21913
|
-
|
|
21914
|
-
|
|
21915
|
-
|
|
21916
|
-
|
|
21917
|
-
|
|
21918
|
-
|
|
21919
|
-
|
|
21920
|
-
|
|
21921
|
-
|
|
21922
|
-
|
|
21923
|
-
|
|
21924
|
-
|
|
21925
|
-
|
|
21926
|
-
|
|
21927
|
-
|
|
21928
|
-
|
|
21929
|
-
|
|
21930
|
-
|
|
21931
|
-
return
|
|
21932
|
-
|
|
21933
|
-
|
|
21934
|
-
|
|
21935
|
-
|
|
21936
|
-
|
|
21937
|
-
|
|
21938
|
-
|
|
21939
|
-
|
|
21940
|
-
|
|
21941
|
-
|
|
21942
|
-
|
|
21943
|
-
|
|
21944
|
-
|
|
21945
|
-
|
|
21946
|
-
|
|
21947
|
-
|
|
21948
|
-
|
|
21949
|
-
|
|
21950
|
-
|
|
21951
|
-
|
|
21952
|
-
|
|
21953
|
-
|
|
21954
|
-
|
|
21955
|
-
|
|
21956
|
-
|
|
21957
|
-
|
|
21958
|
-
|
|
21959
|
-
|
|
21960
|
-
|
|
21961
|
-
|
|
21962
|
-
|
|
21963
|
-
|
|
21964
|
-
|
|
21965
|
-
|
|
21966
|
-
|
|
21967
|
-
|
|
21968
|
-
|
|
21969
|
-
|
|
21970
|
-
|
|
21971
|
-
|
|
21972
|
-
|
|
21973
|
-
|
|
21974
|
-
|
|
21975
|
-
|
|
21976
|
-
|
|
21977
|
-
|
|
21978
|
-
|
|
21979
|
-
|
|
21980
|
-
|
|
21981
|
-
|
|
21982
|
-
return _context2.stop();
|
|
21983
|
-
}
|
|
22120
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
22121
|
+
case 0:
|
|
22122
|
+
amount = _ref3.amount, sell = _ref3.sell, sent = _ref3.sent, succeeded = _ref3.succeeded, 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, closable = _ref3.closable, integration = _ref3.integration, document = _ref3.document;
|
|
22123
|
+
requireReactVersion();
|
|
22124
|
+
_context2.prev = 2;
|
|
22125
|
+
_context2.next = 5;
|
|
22126
|
+
return preflight({
|
|
22127
|
+
sell: sell
|
|
22128
|
+
});
|
|
22129
|
+
case 5:
|
|
22130
|
+
accept = Object.keys(sell).map(function (key) {
|
|
22131
|
+
return {
|
|
22132
|
+
blockchain: key,
|
|
22133
|
+
token: sell[key]
|
|
22134
|
+
};
|
|
22135
|
+
});
|
|
22136
|
+
unmount = mount({
|
|
22137
|
+
style: style,
|
|
22138
|
+
document: ensureDocument(document),
|
|
22139
|
+
closed: closed
|
|
22140
|
+
}, function (unmount) {
|
|
22141
|
+
return function (container) {
|
|
22142
|
+
return /*#__PURE__*/React__default["default"].createElement(ErrorProvider, {
|
|
22143
|
+
errorCallback: error,
|
|
22144
|
+
container: container,
|
|
22145
|
+
unmount: unmount
|
|
22146
|
+
}, /*#__PURE__*/React__default["default"].createElement(ConfigurationProvider, {
|
|
22147
|
+
configuration: {
|
|
22148
|
+
type: 'sale',
|
|
22149
|
+
tokenImage: tokenImage,
|
|
22150
|
+
amount: amount,
|
|
22151
|
+
sell: sell,
|
|
22152
|
+
currency: currency,
|
|
22153
|
+
sent: sent,
|
|
22154
|
+
succeeded: succeeded,
|
|
22155
|
+
failed: failed,
|
|
22156
|
+
blacklist: blacklist,
|
|
22157
|
+
providers: providers,
|
|
22158
|
+
integration: integration
|
|
22159
|
+
}
|
|
22160
|
+
}, /*#__PURE__*/React__default["default"].createElement(UpdatableProvider, null, /*#__PURE__*/React__default["default"].createElement(ClosableProvider, {
|
|
22161
|
+
unmount: unmount,
|
|
22162
|
+
closable: closable
|
|
22163
|
+
}, /*#__PURE__*/React__default["default"].createElement(WalletProvider, {
|
|
22164
|
+
container: container,
|
|
22165
|
+
connected: connected,
|
|
22166
|
+
unmount: unmount
|
|
22167
|
+
}, /*#__PURE__*/React__default["default"].createElement(NavigateProvider, null, /*#__PURE__*/React__default["default"].createElement(ConversionRateProvider, null, /*#__PURE__*/React__default["default"].createElement(ChangableAmountProvider, {
|
|
22168
|
+
accept: accept
|
|
22169
|
+
}, /*#__PURE__*/React__default["default"].createElement(TransactionTrackingProvider, null, /*#__PURE__*/React__default["default"].createElement(PaymentTrackingProvider, {
|
|
22170
|
+
document: ensureDocument(document)
|
|
22171
|
+
}, /*#__PURE__*/React__default["default"].createElement(SaleRoutingProvider, {
|
|
22172
|
+
container: container,
|
|
22173
|
+
document: document
|
|
22174
|
+
}, /*#__PURE__*/React__default["default"].createElement(SaleStack, {
|
|
22175
|
+
document: document,
|
|
22176
|
+
container: container
|
|
22177
|
+
}), /*#__PURE__*/React__default["default"].createElement(PoweredBy, null))))))))))));
|
|
22178
|
+
};
|
|
22179
|
+
});
|
|
22180
|
+
return _context2.abrupt("return", {
|
|
22181
|
+
unmount: unmount
|
|
22182
|
+
});
|
|
22183
|
+
case 10:
|
|
22184
|
+
_context2.prev = 10;
|
|
22185
|
+
_context2.t0 = _context2["catch"](2);
|
|
22186
|
+
console.log('critical error', _context2.t0);
|
|
22187
|
+
if (critical != undefined) {
|
|
22188
|
+
critical(_context2.t0);
|
|
22189
|
+
}
|
|
22190
|
+
case 14:
|
|
22191
|
+
case "end":
|
|
22192
|
+
return _context2.stop();
|
|
21984
22193
|
}
|
|
21985
22194
|
}, _callee2, null, [[2, 10]]);
|
|
21986
22195
|
}));
|
|
@@ -22299,7 +22508,7 @@
|
|
|
22299
22508
|
};
|
|
22300
22509
|
var select = function select(token) {
|
|
22301
22510
|
if (blockchain.tokens.find(function (majorToken) {
|
|
22302
|
-
return majorToken.address
|
|
22511
|
+
return majorToken.address == (token.address || token.external_id);
|
|
22303
22512
|
})) {
|
|
22304
22513
|
setOpen(false);
|
|
22305
22514
|
props.resolve({
|
|
@@ -22457,41 +22666,39 @@
|
|
|
22457
22666
|
return new Promise( /*#__PURE__*/function () {
|
|
22458
22667
|
var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(resolve, reject) {
|
|
22459
22668
|
return regenerator.wrap(function _callee$(_context) {
|
|
22460
|
-
while (1) {
|
|
22461
|
-
|
|
22462
|
-
|
|
22463
|
-
|
|
22464
|
-
|
|
22465
|
-
|
|
22466
|
-
|
|
22467
|
-
|
|
22468
|
-
|
|
22469
|
-
|
|
22470
|
-
|
|
22471
|
-
return
|
|
22472
|
-
|
|
22473
|
-
|
|
22474
|
-
|
|
22475
|
-
|
|
22476
|
-
|
|
22477
|
-
|
|
22478
|
-
|
|
22479
|
-
|
|
22480
|
-
|
|
22481
|
-
|
|
22482
|
-
|
|
22483
|
-
|
|
22484
|
-
|
|
22485
|
-
|
|
22486
|
-
|
|
22487
|
-
|
|
22488
|
-
|
|
22489
|
-
|
|
22490
|
-
|
|
22491
|
-
|
|
22492
|
-
|
|
22493
|
-
return _context.stop();
|
|
22494
|
-
}
|
|
22669
|
+
while (1) switch (_context.prev = _context.next) {
|
|
22670
|
+
case 0:
|
|
22671
|
+
mount({
|
|
22672
|
+
style: style,
|
|
22673
|
+
document: ensureDocument(document)
|
|
22674
|
+
}, function (unmount) {
|
|
22675
|
+
var userClosedDialog = function userClosedDialog() {
|
|
22676
|
+
reject('USER_CLOSED_DIALOG');
|
|
22677
|
+
unmount();
|
|
22678
|
+
};
|
|
22679
|
+
return function (container) {
|
|
22680
|
+
return /*#__PURE__*/React__default["default"].createElement(ErrorProvider, {
|
|
22681
|
+
error: startupError,
|
|
22682
|
+
errorCallback: error,
|
|
22683
|
+
container: container,
|
|
22684
|
+
unmount: unmount
|
|
22685
|
+
}, /*#__PURE__*/React__default["default"].createElement(ConfigurationProvider, {
|
|
22686
|
+
configuration: {
|
|
22687
|
+
what: what
|
|
22688
|
+
}
|
|
22689
|
+
}, /*#__PURE__*/React__default["default"].createElement(UpdatableProvider, null, /*#__PURE__*/React__default["default"].createElement(ClosableProvider, {
|
|
22690
|
+
unmount: userClosedDialog
|
|
22691
|
+
}, /*#__PURE__*/React__default["default"].createElement(SelectionProvider, null, /*#__PURE__*/React__default["default"].createElement(SelectStack, {
|
|
22692
|
+
document: document,
|
|
22693
|
+
container: container,
|
|
22694
|
+
unmount: unmount,
|
|
22695
|
+
resolve: resolve
|
|
22696
|
+
})), /*#__PURE__*/React__default["default"].createElement(PoweredBy, null)))));
|
|
22697
|
+
};
|
|
22698
|
+
});
|
|
22699
|
+
case 1:
|
|
22700
|
+
case "end":
|
|
22701
|
+
return _context.stop();
|
|
22495
22702
|
}
|
|
22496
22703
|
}, _callee);
|
|
22497
22704
|
}));
|