@rango-dev/queue-manager-rango-preset 0.1.13-next.10 → 0.1.13-next.11
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/actions/checkStatus.d.ts.map +1 -1
- package/dist/queue-manager-rango-preset.cjs.development.js +36 -21
- 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 +36 -21
- package/dist/queue-manager-rango-preset.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/actions/checkStatus.ts +24 -8
- package/src/actions/scheduleNextStep.ts +3 -3
- package/src/.DS_Store +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkStatus.d.ts","sourceRoot":"","sources":["../src/actions/checkStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAahE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"checkStatus.d.ts","sourceRoot":"","sources":["../src/actions/checkStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAahE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAqP1E;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,eAAe,CAAC,WAAW,EAAE,eAAe,EAAE,gBAAgB,CAAC,GACvE,OAAO,CAAC,IAAI,CAAC,CAcf"}
|
|
@@ -2190,12 +2190,12 @@ function checkTransactionStatus(_x) {
|
|
|
2190
2190
|
*/
|
|
2191
2191
|
function _checkTransactionStatus() {
|
|
2192
2192
|
_checkTransactionStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
2193
|
-
var _status, _status2, _status3, _status4, _status5, _status6, _status7,
|
|
2194
|
-
var getStorage, setStorage, next, schedule, retry, context, swap, currentStep, txId, status, outputAmount, prevOutputAmount, newTransaction, nextStep;
|
|
2193
|
+
var _status, _status2, _status3, _status4, _status5, _status6, _status7, _status9, _status10, _status11;
|
|
2194
|
+
var getStorage, setStorage, next, schedule, retry, failed, context, swap, currentStep, txId, status, outputAmount, prevOutputAmount, newTransaction, nextStep, _status8;
|
|
2195
2195
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2196
2196
|
while (1) switch (_context.prev = _context.next) {
|
|
2197
2197
|
case 0:
|
|
2198
|
-
getStorage = _ref.getStorage, setStorage = _ref.setStorage, next = _ref.next, schedule = _ref.schedule, retry = _ref.retry, context = _ref.context;
|
|
2198
|
+
getStorage = _ref.getStorage, setStorage = _ref.setStorage, next = _ref.next, schedule = _ref.schedule, retry = _ref.retry, failed = _ref.failed, context = _ref.context;
|
|
2199
2199
|
swap = getStorage().swapDetails; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2200
2200
|
currentStep = getCurrentStep(swap);
|
|
2201
2201
|
txId = currentStep.executedTransactionId;
|
|
@@ -2283,26 +2283,36 @@ function _checkTransactionStatus() {
|
|
|
2283
2283
|
} else if (currentStep.status === 'failed') {
|
|
2284
2284
|
swap.extraMessage = 'Transaction failed in blockchain';
|
|
2285
2285
|
swap.extraMessageSeverity = exports.MessageSeverity.error;
|
|
2286
|
-
swap.extraMessageDetail = '';
|
|
2286
|
+
swap.extraMessageDetail = ((_status8 = status) == null ? void 0 : _status8.extraMessage) || '';
|
|
2287
|
+
swap.status = 'failed';
|
|
2288
|
+
swap.finishTime = new Date().getTime().toString();
|
|
2287
2289
|
}
|
|
2288
2290
|
// Sync data with storage
|
|
2289
2291
|
setStorage(_extends({}, getStorage(), {
|
|
2290
2292
|
swapDetails: swap
|
|
2291
2293
|
}));
|
|
2292
|
-
if (!(((
|
|
2293
|
-
_context.next =
|
|
2294
|
+
if (!(((_status9 = status) == null ? void 0 : _status9.status) === 'failed')) {
|
|
2295
|
+
_context.next = 38;
|
|
2296
|
+
break;
|
|
2297
|
+
}
|
|
2298
|
+
failed();
|
|
2299
|
+
_context.next = 46;
|
|
2300
|
+
break;
|
|
2301
|
+
case 38:
|
|
2302
|
+
if (!(((_status10 = status) == null ? void 0 : _status10.status) === 'success' || ((_status11 = status) == null ? void 0 : _status11.status) === 'running' && !!status.newTx)) {
|
|
2303
|
+
_context.next = 43;
|
|
2294
2304
|
break;
|
|
2295
2305
|
}
|
|
2296
2306
|
schedule(SwapActionTypes.SCHEDULE_NEXT_STEP);
|
|
2297
2307
|
next();
|
|
2298
|
-
_context.next =
|
|
2308
|
+
_context.next = 46;
|
|
2299
2309
|
break;
|
|
2300
|
-
case
|
|
2301
|
-
_context.next =
|
|
2310
|
+
case 43:
|
|
2311
|
+
_context.next = 45;
|
|
2302
2312
|
return delay(INTERVAL_FOR_CHECK);
|
|
2303
|
-
case
|
|
2313
|
+
case 45:
|
|
2304
2314
|
retry();
|
|
2305
|
-
case
|
|
2315
|
+
case 46:
|
|
2306
2316
|
case "end":
|
|
2307
2317
|
return _context.stop();
|
|
2308
2318
|
}
|
|
@@ -2323,7 +2333,7 @@ function checkApprovalStatus(_x2) {
|
|
|
2323
2333
|
*/
|
|
2324
2334
|
function _checkApprovalStatus() {
|
|
2325
2335
|
_checkApprovalStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
|
|
2326
|
-
var getStorage, setStorage, next, schedule, retry, failed, context, swap, currentStep, isApproved, response, updateResult;
|
|
2336
|
+
var getStorage, setStorage, next, schedule, retry, failed, context, swap, currentStep, isApproved, response, message, details, updateResult;
|
|
2327
2337
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2328
2338
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2329
2339
|
case 0:
|
|
@@ -2343,7 +2353,14 @@ function _checkApprovalStatus() {
|
|
|
2343
2353
|
return _context2.abrupt("return");
|
|
2344
2354
|
case 10:
|
|
2345
2355
|
isApproved = response.isApproved;
|
|
2346
|
-
if (!isApproved && response.txStatus === 'failed') {
|
|
2356
|
+
if (!isApproved && (response.txStatus === 'failed' || response.txStatus === 'success')) {
|
|
2357
|
+
if (response.txStatus === 'failed') {
|
|
2358
|
+
message = 'Approve transaction failed';
|
|
2359
|
+
details = 'Smart contract approval failed in blockchain.';
|
|
2360
|
+
} else {
|
|
2361
|
+
message = 'Not enough approval';
|
|
2362
|
+
if (response.requiredApprovedAmount && response.currentApprovedAmount) details = "Required approval: " + response.requiredApprovedAmount + ", current approval: " + response.currentApprovedAmount;else details = "You still don't have enough approval for this swap.";
|
|
2363
|
+
}
|
|
2347
2364
|
// approve transaction failed on
|
|
2348
2365
|
// we should fail the whole swap
|
|
2349
2366
|
updateResult = updateSwapStatus({
|
|
@@ -2352,14 +2369,13 @@ function _checkApprovalStatus() {
|
|
|
2352
2369
|
nextStatus: 'failed',
|
|
2353
2370
|
nextStepStatus: 'failed',
|
|
2354
2371
|
errorCode: 'SEND_TX_FAILED',
|
|
2355
|
-
message:
|
|
2356
|
-
details:
|
|
2372
|
+
message: message,
|
|
2373
|
+
details: details
|
|
2357
2374
|
});
|
|
2358
2375
|
context.notifier(_extends({
|
|
2359
2376
|
eventType: 'smart_contract_call_failed'
|
|
2360
2377
|
}, updateResult));
|
|
2361
2378
|
failed();
|
|
2362
|
-
// onFinish();
|
|
2363
2379
|
} else if (!isApproved) {
|
|
2364
2380
|
// it is needed to set notification after reloading the page
|
|
2365
2381
|
context.notifier({
|
|
@@ -2680,12 +2696,14 @@ function scheduleNextStep(_ref) {
|
|
|
2680
2696
|
context = _ref.context;
|
|
2681
2697
|
var swap = getStorage().swapDetails;
|
|
2682
2698
|
var currentStep = getCurrentStep(swap);
|
|
2683
|
-
|
|
2699
|
+
var isFailed = swap.steps.find(function (step) {
|
|
2700
|
+
return step.status === 'failed';
|
|
2701
|
+
});
|
|
2702
|
+
if (!!currentStep && !isFailed) {
|
|
2684
2703
|
if (isTxAlreadyCreated(swap, currentStep)) {
|
|
2685
2704
|
schedule(SwapActionTypes.EXECUTE_TRANSACTION);
|
|
2686
2705
|
return next();
|
|
2687
2706
|
}
|
|
2688
|
-
// TODO double check it after approval changes
|
|
2689
2707
|
if (currentStep != null && currentStep.executedTransactionId) {
|
|
2690
2708
|
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
2691
2709
|
return next();
|
|
@@ -2697,9 +2715,6 @@ function scheduleNextStep(_ref) {
|
|
|
2697
2715
|
schedule(SwapActionTypes.CREATE_TRANSACTION);
|
|
2698
2716
|
next();
|
|
2699
2717
|
} else {
|
|
2700
|
-
var isFailed = swap.steps.find(function (step) {
|
|
2701
|
-
return step.status === 'failed';
|
|
2702
|
-
});
|
|
2703
2718
|
swap.status = isFailed ? 'failed' : 'success';
|
|
2704
2719
|
swap.finishTime = new Date().getTime().toString();
|
|
2705
2720
|
setStorage(_extends({}, getStorage(), {
|