@rango-dev/queue-manager-rango-preset 0.1.12 → 0.1.13-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/checkStatus.d.ts.map +1 -1
- package/dist/actions/executeTransaction.d.ts.map +1 -1
- package/dist/helpers.d.ts +10 -0
- package/dist/helpers.d.ts.map +1 -1
- package/dist/queue-manager-rango-preset.cjs.development.js +70 -49
- 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 +70 -49
- package/dist/queue-manager-rango-preset.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/actions/checkStatus.ts +6 -7
- package/src/actions/executeTransaction.ts +31 -17
- package/src/helpers.ts +2 -6
|
@@ -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;AAqO1E;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,eAAe,CAAC,WAAW,EAAE,eAAe,EAAE,gBAAgB,CAAC,GACvE,OAAO,CAAC,IAAI,CAAC,CAcf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeTransaction.d.ts","sourceRoot":"","sources":["../src/actions/executeTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"executeTransaction.d.ts","sourceRoot":"","sources":["../src/actions/executeTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAoBhE,OAAO,EAEL,eAAe,EACf,gBAAgB,EAChB,WAAW,EACZ,MAAM,UAAU,CAAC;AAElB;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,eAAe,CAAC,WAAW,EAAE,eAAe,EAAE,gBAAgB,CAAC,GACvE,OAAO,CAAC,IAAI,CAAC,CAgGf"}
|
package/dist/helpers.d.ts
CHANGED
|
@@ -9,6 +9,16 @@ import { APIErrorCode, SignerErrorCode } from 'rango-types/lib';
|
|
|
9
9
|
declare type WhenTaskBlocked = Parameters<NonNullable<SwapQueueDef['whenTaskBlocked']>>;
|
|
10
10
|
declare type WhenTaskBlockedEvent = WhenTaskBlocked[0];
|
|
11
11
|
declare type WhenTaskBlockedMeta = WhenTaskBlocked[1];
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* We simply use module-level variable to keep track of which queue has claimed the execution of parallel runnings.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
export declare function claimQueue(): {
|
|
18
|
+
claimedBy: () => string | undefined;
|
|
19
|
+
setClaimer: (queue_id: string) => void;
|
|
20
|
+
reset: () => void;
|
|
21
|
+
};
|
|
12
22
|
/**
|
|
13
23
|
* Sample inputs are:
|
|
14
24
|
* - "metamask-ETH"
|
package/dist/helpers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,SAAS,EAGV,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,eAAe,EACf,gBAAgB,E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C,GAAG,IAAI,CA6DP;AAED,wBAAgB,4BAA4B,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAgCpE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,EAAE,CAW/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,gCAAgC,CAC9C,YAAY,EAAE,WAAW,EAAE,EAC3B,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,QAkBvC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CACrB,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,EACtC,OAAO,CAAC,EAAE,OAAO,EACjB,OAAO;;CAAiC,GACvC,IAAI,CAsDN;AAMD,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAE1E;AAMD,wBAAsB,SAAS,CAC7B,WAAW,EAAE,OAAO,CAAC,yBAAyB,CAAC,GAC9C,OAAO,CAAC,yBAAyB,CAAC,CAYpC;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,SAAS,EACf,OAAO,CAAC,EAAE,OAAO,GAChB;IACD,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,eAAe,GAAG,IAAI,CAAC;CAC9B,CAkBA"}
|
|
@@ -475,6 +475,7 @@ function _assertThisInitialized(self) {
|
|
|
475
475
|
return self;
|
|
476
476
|
}
|
|
477
477
|
|
|
478
|
+
var ERROR_MESSAGE_DEPENDS_ON_OTHER_QUEUES = 'Waiting for other swaps to complete';
|
|
478
479
|
var ERROR_MESSAGE_WAIT_FOR_WALLET = 'Waiting for connecting wallet';
|
|
479
480
|
var ERROR_MESSAGE_WAIT_FOR_WALLET_DESCRIPTION_WRONG_WALLET = function ERROR_MESSAGE_WAIT_FOR_WALLET_DESCRIPTION_WRONG_WALLET(type, address) {
|
|
480
481
|
return "Please change your " + (type || 'wallet') + " account to " + (address || 'proper address');
|
|
@@ -2118,7 +2119,7 @@ function retryOn(wallet_network, notifier, manager, options) {
|
|
|
2118
2119
|
We only run one request at a time (In parallel mode).
|
|
2119
2120
|
*/
|
|
2120
2121
|
function isNeedBlockQueueForParallel(step) {
|
|
2121
|
-
return !!step.evmTransaction || !!step.evmApprovalTransaction
|
|
2122
|
+
return !!step.evmTransaction || !!step.evmApprovalTransaction;
|
|
2122
2123
|
}
|
|
2123
2124
|
/*
|
|
2124
2125
|
Create transaction endpoint doesn't return error code on http status code,
|
|
@@ -2219,6 +2220,12 @@ function _checkTransactionStatus() {
|
|
|
2219
2220
|
retry();
|
|
2220
2221
|
return _context.abrupt("return");
|
|
2221
2222
|
case 17:
|
|
2223
|
+
if (!((currentStep == null ? void 0 : currentStep.status) === 'failed')) {
|
|
2224
|
+
_context.next = 19;
|
|
2225
|
+
break;
|
|
2226
|
+
}
|
|
2227
|
+
return _context.abrupt("return");
|
|
2228
|
+
case 19:
|
|
2222
2229
|
outputAmount = ((_status = status) == null ? void 0 : _status.outputAmount) || (!!currentStep.outputAmount ? currentStep.outputAmount : null);
|
|
2223
2230
|
prevOutputAmount = currentStep.outputAmount || null;
|
|
2224
2231
|
swap.extraMessage = ((_status2 = status) == null ? void 0 : _status2.extraMessage) || swap.extraMessage;
|
|
@@ -2283,19 +2290,19 @@ function _checkTransactionStatus() {
|
|
|
2283
2290
|
swapDetails: swap
|
|
2284
2291
|
}));
|
|
2285
2292
|
if (!(((_status8 = status) == null ? void 0 : _status8.status) === 'failed' || ((_status9 = status) == null ? void 0 : _status9.status) === 'success' || ((_status10 = status) == null ? void 0 : _status10.status) === 'running' && !!status.newTx)) {
|
|
2286
|
-
_context.next =
|
|
2293
|
+
_context.next = 39;
|
|
2287
2294
|
break;
|
|
2288
2295
|
}
|
|
2289
2296
|
schedule(SwapActionTypes.SCHEDULE_NEXT_STEP);
|
|
2290
2297
|
next();
|
|
2291
|
-
_context.next =
|
|
2298
|
+
_context.next = 42;
|
|
2292
2299
|
break;
|
|
2293
|
-
case 37:
|
|
2294
|
-
_context.next = 39;
|
|
2295
|
-
return delay(INTERVAL_FOR_CHECK);
|
|
2296
2300
|
case 39:
|
|
2301
|
+
_context.next = 41;
|
|
2302
|
+
return delay(INTERVAL_FOR_CHECK);
|
|
2303
|
+
case 41:
|
|
2297
2304
|
retry();
|
|
2298
|
-
case
|
|
2305
|
+
case 42:
|
|
2299
2306
|
case "end":
|
|
2300
2307
|
return _context.stop();
|
|
2301
2308
|
}
|
|
@@ -2321,14 +2328,7 @@ function _checkApprovalStatus() {
|
|
|
2321
2328
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2322
2329
|
case 0:
|
|
2323
2330
|
getStorage = _ref2.getStorage, setStorage = _ref2.setStorage, next = _ref2.next, schedule = _ref2.schedule, retry = _ref2.retry, failed = _ref2.failed, context = _ref2.context;
|
|
2324
|
-
swap = getStorage().swapDetails; //
|
|
2325
|
-
// const onFinish = () => {
|
|
2326
|
-
// // TODO resetClaimedBy is undefined here
|
|
2327
|
-
// if (context.resetClaimedBy) {
|
|
2328
|
-
// context.resetClaimedBy();
|
|
2329
|
-
// }
|
|
2330
|
-
// };
|
|
2331
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2331
|
+
swap = getStorage().swapDetails; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2332
2332
|
currentStep = getCurrentStep(swap);
|
|
2333
2333
|
isApproved = false;
|
|
2334
2334
|
_context2.prev = 4;
|
|
@@ -2336,6 +2336,12 @@ function _checkApprovalStatus() {
|
|
|
2336
2336
|
return httpService().checkApproval(swap.requestId, currentStep.executedTransactionId || '');
|
|
2337
2337
|
case 7:
|
|
2338
2338
|
response = _context2.sent;
|
|
2339
|
+
if (!((currentStep == null ? void 0 : currentStep.status) === 'failed')) {
|
|
2340
|
+
_context2.next = 10;
|
|
2341
|
+
break;
|
|
2342
|
+
}
|
|
2343
|
+
return _context2.abrupt("return");
|
|
2344
|
+
case 10:
|
|
2339
2345
|
isApproved = response.isApproved;
|
|
2340
2346
|
if (!isApproved && response.txStatus === 'failed') {
|
|
2341
2347
|
// approve transaction failed on
|
|
@@ -2362,15 +2368,15 @@ function _checkApprovalStatus() {
|
|
|
2362
2368
|
step: currentStep
|
|
2363
2369
|
});
|
|
2364
2370
|
}
|
|
2365
|
-
_context2.next =
|
|
2371
|
+
_context2.next = 17;
|
|
2366
2372
|
break;
|
|
2367
|
-
case
|
|
2368
|
-
_context2.prev =
|
|
2373
|
+
case 14:
|
|
2374
|
+
_context2.prev = 14;
|
|
2369
2375
|
_context2.t0 = _context2["catch"](4);
|
|
2370
2376
|
isApproved = false;
|
|
2371
|
-
case
|
|
2377
|
+
case 17:
|
|
2372
2378
|
if (!isApproved) {
|
|
2373
|
-
_context2.next =
|
|
2379
|
+
_context2.next = 33;
|
|
2374
2380
|
break;
|
|
2375
2381
|
}
|
|
2376
2382
|
currentStep.status = 'approved';
|
|
@@ -2392,18 +2398,18 @@ function _checkApprovalStatus() {
|
|
|
2392
2398
|
});
|
|
2393
2399
|
schedule(SwapActionTypes.SCHEDULE_NEXT_STEP);
|
|
2394
2400
|
next();
|
|
2395
|
-
_context2.next =
|
|
2401
|
+
_context2.next = 36;
|
|
2396
2402
|
break;
|
|
2397
|
-
case 31:
|
|
2398
|
-
_context2.next = 33;
|
|
2399
|
-
return delay(2000);
|
|
2400
2403
|
case 33:
|
|
2404
|
+
_context2.next = 35;
|
|
2405
|
+
return delay(2000);
|
|
2406
|
+
case 35:
|
|
2401
2407
|
retry();
|
|
2402
|
-
case
|
|
2408
|
+
case 36:
|
|
2403
2409
|
case "end":
|
|
2404
2410
|
return _context2.stop();
|
|
2405
2411
|
}
|
|
2406
|
-
}, _callee2, null, [[4,
|
|
2412
|
+
}, _callee2, null, [[4, 14]]);
|
|
2407
2413
|
}));
|
|
2408
2414
|
return _checkApprovalStatus.apply(this, arguments);
|
|
2409
2415
|
}
|
|
@@ -2552,12 +2558,13 @@ function executeTransaction(_x) {
|
|
|
2552
2558
|
function _executeTransaction() {
|
|
2553
2559
|
_executeTransaction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(actions) {
|
|
2554
2560
|
var _context$_queue;
|
|
2555
|
-
var getStorage, context, meta, wallets, providers, isClaimed, requestBlock, swap, currentStep, isWrongAddress, _wallets$blockchains, _getRequiredWallet, type, address, isWalletInCompatible, description, blockedFor,
|
|
2561
|
+
var getStorage, context, meta, wallets, providers, _claimQueue, claimedBy, isClaimed, requestBlock, swap, currentStep, isWrongAddress, _wallets$blockchains, _getRequiredWallet, type, address, isWalletInCompatible, description, blockedFor, networkMatched, claimerId, isClaimedByAnyQueue, details, _blockedFor, fromBlockchain, _details, _blockedFor2, needsToBlockQueue, _blockedFor3;
|
|
2556
2562
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2557
2563
|
while (1) switch (_context.prev = _context.next) {
|
|
2558
2564
|
case 0:
|
|
2559
2565
|
getStorage = actions.getStorage, context = actions.context;
|
|
2560
2566
|
meta = context.meta, wallets = context.wallets, providers = context.providers;
|
|
2567
|
+
_claimQueue = claimQueue(), claimedBy = _claimQueue.claimedBy;
|
|
2561
2568
|
isClaimed = context.claimedBy === ((_context$_queue = context._queue) == null ? void 0 : _context$_queue.id);
|
|
2562
2569
|
requestBlock = function requestBlock(blockedFor) {
|
|
2563
2570
|
actions.block(blockedFor);
|
|
@@ -2571,7 +2578,7 @@ function _executeTransaction() {
|
|
|
2571
2578
|
/* Make sure wallet is connected and also the connected wallet is matched with tx by checking address. */
|
|
2572
2579
|
isWrongAddress = !isRequiredWalletConnected(swap, context.state).ok;
|
|
2573
2580
|
if (!isWrongAddress) {
|
|
2574
|
-
_context.next =
|
|
2581
|
+
_context.next = 16;
|
|
2575
2582
|
break;
|
|
2576
2583
|
}
|
|
2577
2584
|
_getRequiredWallet = getRequiredWallet(swap), type = _getRequiredWallet.type, address = _getRequiredWallet.address;
|
|
@@ -2588,51 +2595,65 @@ function _executeTransaction() {
|
|
|
2588
2595
|
};
|
|
2589
2596
|
requestBlock(blockedFor);
|
|
2590
2597
|
return _context.abrupt("return");
|
|
2591
|
-
case
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2598
|
+
case 16:
|
|
2599
|
+
_context.next = 18;
|
|
2600
|
+
return isNetworkMatchedForTransaction(swap, currentStep, wallets, meta, providers);
|
|
2601
|
+
case 18:
|
|
2602
|
+
networkMatched = _context.sent;
|
|
2603
|
+
claimerId = claimedBy();
|
|
2604
|
+
isClaimedByAnyQueue = !!claimerId && !isClaimed;
|
|
2605
|
+
if (!(isClaimedByAnyQueue && !networkMatched)) {
|
|
2606
|
+
_context.next = 28;
|
|
2599
2607
|
break;
|
|
2600
2608
|
}
|
|
2609
|
+
details = ERROR_MESSAGE_DEPENDS_ON_OTHER_QUEUES;
|
|
2601
2610
|
_blockedFor = {
|
|
2602
2611
|
reason: BlockReason.DEPENDS_ON_OTHER_QUEUES,
|
|
2603
|
-
|
|
2604
|
-
details: {}
|
|
2612
|
+
details: details
|
|
2605
2613
|
};
|
|
2606
2614
|
requestBlock(_blockedFor);
|
|
2607
2615
|
return _context.abrupt("return");
|
|
2608
|
-
case
|
|
2609
|
-
_context.next = 22;
|
|
2610
|
-
return isNetworkMatchedForTransaction(swap, currentStep, wallets, meta, providers);
|
|
2611
|
-
case 22:
|
|
2612
|
-
networkMatched = _context.sent;
|
|
2616
|
+
case 28:
|
|
2613
2617
|
if (networkMatched) {
|
|
2614
|
-
_context.next =
|
|
2618
|
+
_context.next = 36;
|
|
2615
2619
|
break;
|
|
2616
2620
|
}
|
|
2617
2621
|
fromBlockchain = getCurrentBlockchainOf(swap, currentStep);
|
|
2618
|
-
|
|
2622
|
+
_details = ERROR_MESSAGE_WAIT_FOR_CHANGE_NETWORK(fromBlockchain);
|
|
2619
2623
|
_blockedFor2 = {
|
|
2620
2624
|
reason: BlockReason.WAIT_FOR_NETWORK_CHANGE,
|
|
2621
|
-
details:
|
|
2625
|
+
details: _details
|
|
2622
2626
|
};
|
|
2623
2627
|
requestBlock(_blockedFor2);
|
|
2624
2628
|
return _context.abrupt("return");
|
|
2625
|
-
case
|
|
2629
|
+
case 36:
|
|
2626
2630
|
// Update network to mark it as network changed successfully.
|
|
2627
2631
|
updateNetworkStatus(actions, {
|
|
2628
2632
|
message: '',
|
|
2629
2633
|
details: 'Wallet network changed successfully',
|
|
2630
2634
|
status: exports.PendingSwapNetworkStatus.NetworkChanged
|
|
2631
2635
|
});
|
|
2632
|
-
case
|
|
2636
|
+
case 37:
|
|
2637
|
+
/*
|
|
2638
|
+
For avoiding conflict by making too many requests to wallet, we need to make sure
|
|
2639
|
+
We only run one request at a time (In parallel mode).
|
|
2640
|
+
*/
|
|
2641
|
+
needsToBlockQueue = isNeedBlockQueueForParallel(currentStep);
|
|
2642
|
+
if (!(needsToBlockQueue && !isClaimed)) {
|
|
2643
|
+
_context.next = 42;
|
|
2644
|
+
break;
|
|
2645
|
+
}
|
|
2646
|
+
_blockedFor3 = {
|
|
2647
|
+
reason: BlockReason.DEPENDS_ON_OTHER_QUEUES,
|
|
2648
|
+
description: ERROR_MESSAGE_DEPENDS_ON_OTHER_QUEUES,
|
|
2649
|
+
details: {}
|
|
2650
|
+
};
|
|
2651
|
+
requestBlock(_blockedFor3);
|
|
2652
|
+
return _context.abrupt("return");
|
|
2653
|
+
case 42:
|
|
2633
2654
|
// All the conditions are met. We can safely send the tx to wallet for sign.
|
|
2634
2655
|
singTransaction(actions);
|
|
2635
|
-
case
|
|
2656
|
+
case 43:
|
|
2636
2657
|
case "end":
|
|
2637
2658
|
return _context.stop();
|
|
2638
2659
|
}
|