@rango-dev/queue-manager-rango-preset 0.1.15-next.5 → 0.1.15-next.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/helpers.d.ts +1 -1
- package/dist/helpers.d.ts.map +1 -1
- package/dist/hooks.d.ts.map +1 -1
- package/dist/queue-manager-rango-preset.cjs.development.js +25 -28
- package/dist/queue-manager-rango-preset.cjs.development.js.map +1 -1
- package/dist/queue-manager-rango-preset.cjs.production.min.js +1 -1
- package/dist/queue-manager-rango-preset.cjs.production.min.js.map +1 -1
- package/dist/queue-manager-rango-preset.esm.js +25 -28
- package/dist/queue-manager-rango-preset.esm.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/helpers.ts +34 -28
- package/src/hooks.ts +6 -1
- package/src/types.ts +2 -0
|
@@ -960,7 +960,7 @@ function updateSwapStatus(_ref) {
|
|
|
960
960
|
var swap = getStorage().swapDetails;
|
|
961
961
|
var currentStep = getCurrentStep(swap);
|
|
962
962
|
if (!!nextStepStatus && !!currentStep) currentStep.status = nextStepStatus;
|
|
963
|
-
if (
|
|
963
|
+
if (nextStatus) swap.status = nextStatus;
|
|
964
964
|
swap.hasAlreadyProceededToSign = hasAlreadyProceededToSign;
|
|
965
965
|
if (!!nextStatus && ['failed', 'success'].includes(nextStatus)) swap.finishTime = new Date().getTime().toString();
|
|
966
966
|
if (!!message || !!details) {
|
|
@@ -1006,7 +1006,7 @@ function setStepTransactionIds(_ref2, txId, notifier, eventType, explorerUrl) {
|
|
|
1006
1006
|
var currentStep = getCurrentStep(swap);
|
|
1007
1007
|
currentStep.executedTransactionId = txId;
|
|
1008
1008
|
currentStep.executedTransactionTime = new Date().getTime().toString();
|
|
1009
|
-
if (
|
|
1009
|
+
if (explorerUrl != null && explorerUrl.url) currentStep.explorerUrl = [].concat(currentStep.explorerUrl || [], [{
|
|
1010
1010
|
url: explorerUrl.url,
|
|
1011
1011
|
description: explorerUrl.description || null
|
|
1012
1012
|
}]);
|
|
@@ -1022,7 +1022,7 @@ function setStepTransactionIds(_ref2, txId, notifier, eventType, explorerUrl) {
|
|
|
1022
1022
|
setStorage(_extends({}, getStorage(), {
|
|
1023
1023
|
swapDetails: swap
|
|
1024
1024
|
}));
|
|
1025
|
-
if (
|
|
1025
|
+
if (eventType) notifier({
|
|
1026
1026
|
eventType: eventType,
|
|
1027
1027
|
swap: swap,
|
|
1028
1028
|
step: currentStep
|
|
@@ -1393,16 +1393,18 @@ function onBlockForChangeNetwork(_event, meta) {
|
|
|
1393
1393
|
type = _getRequiredWallet2.type,
|
|
1394
1394
|
network = _getRequiredWallet2.network;
|
|
1395
1395
|
if (!!type && !!network) {
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1396
|
+
if (context.canSwitchNetworkTo(type, network)) {
|
|
1397
|
+
var _result = context.switchNetwork(type, network);
|
|
1398
|
+
if (_result) {
|
|
1399
|
+
_result.then(function () {
|
|
1400
|
+
queue.unblock();
|
|
1401
|
+
})["catch"](function (error) {
|
|
1402
|
+
// ignore switch network errors
|
|
1403
|
+
console.log({
|
|
1404
|
+
error: error
|
|
1405
|
+
});
|
|
1404
1406
|
});
|
|
1405
|
-
}
|
|
1407
|
+
}
|
|
1406
1408
|
}
|
|
1407
1409
|
}
|
|
1408
1410
|
}
|
|
@@ -1464,7 +1466,7 @@ function onDependsOnOtherQueues(_event, meta) {
|
|
|
1464
1466
|
resetClaimedBy: function resetClaimedBy() {
|
|
1465
1467
|
reset();
|
|
1466
1468
|
// TODO: Use key generator
|
|
1467
|
-
retryOn(type + "-" + network + ":" + address, context.notifier, manager);
|
|
1469
|
+
retryOn(type + "-" + network + ":" + address, context.notifier, manager, context.canSwitchNetworkTo);
|
|
1468
1470
|
}
|
|
1469
1471
|
});
|
|
1470
1472
|
}
|
|
@@ -1739,8 +1741,8 @@ function resetRunningSwapNotifsOnPageLoad(runningSwaps, notifier) {
|
|
|
1739
1741
|
* @param manager
|
|
1740
1742
|
* @returns
|
|
1741
1743
|
*/
|
|
1742
|
-
function retryOn(wallet_network, notifier, manager, options) {
|
|
1743
|
-
var _finalQueueToBeRun;
|
|
1744
|
+
function retryOn(wallet_network, notifier, manager, canSwitchNetworkTo, options) {
|
|
1745
|
+
var _finalQueueToBeRun, _finalQueueToBeRun2;
|
|
1744
1746
|
if (options === void 0) {
|
|
1745
1747
|
options = {
|
|
1746
1748
|
fallbackToOnlyWallet: true
|
|
@@ -1788,7 +1790,7 @@ function retryOn(wallet_network, notifier, manager, options) {
|
|
|
1788
1790
|
} else if (onlyWalletMatched.length > 0 && options.fallbackToOnlyWallet) {
|
|
1789
1791
|
finalQueueToBeRun = onlyWalletMatched[0];
|
|
1790
1792
|
}
|
|
1791
|
-
(_finalQueueToBeRun = finalQueueToBeRun) == null ? void 0 : _finalQueueToBeRun.checkBlock();
|
|
1793
|
+
if (!(canSwitchNetworkTo != null && canSwitchNetworkTo(wallet, network))) (_finalQueueToBeRun = finalQueueToBeRun) == null ? void 0 : _finalQueueToBeRun.unblock();else (_finalQueueToBeRun2 = finalQueueToBeRun) == null ? void 0 : _finalQueueToBeRun2.checkBlock();
|
|
1792
1794
|
}
|
|
1793
1795
|
/*
|
|
1794
1796
|
For avoiding conflict by making too many requests to wallet, we need to make sure
|
|
@@ -1810,27 +1812,22 @@ function _throwOnOK() {
|
|
|
1810
1812
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1811
1813
|
while (1) switch (_context3.prev = _context3.next) {
|
|
1812
1814
|
case 0:
|
|
1813
|
-
_context3.
|
|
1814
|
-
_context3.next = 3;
|
|
1815
|
+
_context3.next = 2;
|
|
1815
1816
|
return rawResponse;
|
|
1816
|
-
case
|
|
1817
|
+
case 2:
|
|
1817
1818
|
responseBody = _context3.sent;
|
|
1818
1819
|
if (!(!responseBody.ok || !responseBody.transaction)) {
|
|
1819
|
-
_context3.next =
|
|
1820
|
+
_context3.next = 5;
|
|
1820
1821
|
break;
|
|
1821
1822
|
}
|
|
1822
1823
|
throw PrettyError.CreateTransaction(responseBody.error || 'bad response from create tx endpoint');
|
|
1823
|
-
case
|
|
1824
|
+
case 5:
|
|
1824
1825
|
return _context3.abrupt("return", responseBody);
|
|
1825
|
-
case
|
|
1826
|
-
_context3.prev = 9;
|
|
1827
|
-
_context3.t0 = _context3["catch"](0);
|
|
1828
|
-
throw _context3.t0;
|
|
1829
|
-
case 12:
|
|
1826
|
+
case 6:
|
|
1830
1827
|
case "end":
|
|
1831
1828
|
return _context3.stop();
|
|
1832
1829
|
}
|
|
1833
|
-
}, _callee3
|
|
1830
|
+
}, _callee3);
|
|
1834
1831
|
}));
|
|
1835
1832
|
return _throwOnOK.apply(this, arguments);
|
|
1836
1833
|
}
|
|
@@ -2737,7 +2734,7 @@ function useQueueManager(params) {
|
|
|
2737
2734
|
manager: manager,
|
|
2738
2735
|
notifier: params.notifier
|
|
2739
2736
|
});
|
|
2740
|
-
retryOn(params.lastConnectedWallet, params.notifier, manager);
|
|
2737
|
+
retryOn(params.lastConnectedWallet, params.notifier, manager, params.canSwitchNetworkTo);
|
|
2741
2738
|
}
|
|
2742
2739
|
}, [params.lastConnectedWallet]);
|
|
2743
2740
|
useEffect(function () {
|