@rango-dev/queue-manager-rango-preset 0.1.15-next.7 → 0.1.15-next.8
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/helpers.d.ts +13 -3
- package/dist/helpers.d.ts.map +1 -1
- package/dist/queue-manager-rango-preset.cjs.development.js +111 -87
- 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 +111 -87
- package/dist/queue-manager-rango-preset.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/actions/checkStatus.ts +69 -34
- package/src/helpers.ts +20 -9
|
@@ -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;AAUhE,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;AAUhE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AA0X1E;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,eAAe,CAAC,WAAW,EAAE,eAAe,EAAE,gBAAgB,CAAC,GACvE,OAAO,CAAC,IAAI,CAAC,CAiBf"}
|
package/dist/helpers.d.ts
CHANGED
|
@@ -19,9 +19,19 @@ export declare function claimQueue(): {
|
|
|
19
19
|
setClaimer: (queue_id: string) => void;
|
|
20
20
|
reset: () => void;
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* We use module-level variable to keep track of
|
|
25
|
+
* map of transactions hash to the TransactionResponse and ...
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
declare type TransactionData = {
|
|
29
|
+
response?: any;
|
|
30
|
+
receiptReceived?: boolean;
|
|
31
|
+
};
|
|
32
|
+
export declare function useTransactionsData(): {
|
|
33
|
+
getTransactionDataByHash: (hash: string) => TransactionData;
|
|
34
|
+
setTransactionDataByHash: (hash: string, data: TransactionData) => void;
|
|
25
35
|
};
|
|
26
36
|
/**
|
|
27
37
|
* Sample inputs are:
|
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,EAChB,YAAY,EACZ,WAAW,EACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EAEL,IAAI,EACJ,OAAO,EACP,WAAW,EACX,UAAU,EACX,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,SAAS,EAAsB,MAAM,yBAAyB,CAAC;AAExE,OAAO,EACL,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,yBAAyB,EAO1B,MAAM,WAAW,CAAC;AAOnB,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,OAAO,EACL,SAAS,EAMT,WAAW,EACX,wBAAwB,EACxB,eAAe,EACf,UAAU,EACV,UAAU,EACV,MAAM,EAGP,MAAM,UAAU,CAAC;AAQlB,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEhE,aAAK,eAAe,GAAG,UAAU,CAAC,WAAW,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC,C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AA2B,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAE1E;AAMD,wBAAsB,SAAS,CAC7B,WAAW,EAAE,OAAO,CAAC,yBAAyB,CAAC,GAC9C,OAAO,CAAC,yBAAyB,CAAC,CAQpC;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"}
|
|
@@ -833,20 +833,17 @@ function claimQueue() {
|
|
|
833
833
|
}
|
|
834
834
|
};
|
|
835
835
|
}
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
* We use module-level variable to keep track of
|
|
839
|
-
* map of transactions hash to the TransactionResponse
|
|
840
|
-
*
|
|
841
|
-
*/
|
|
842
|
-
var swapTransactionToResponseMap = {};
|
|
843
|
-
function useTransactionsResponse() {
|
|
836
|
+
var swapTransactionToDataMap = {};
|
|
837
|
+
function useTransactionsData() {
|
|
844
838
|
return {
|
|
845
|
-
|
|
846
|
-
return
|
|
839
|
+
getTransactionDataByHash: function getTransactionDataByHash(hash) {
|
|
840
|
+
return swapTransactionToDataMap[hash] || {};
|
|
847
841
|
},
|
|
848
|
-
|
|
849
|
-
|
|
842
|
+
setTransactionDataByHash: function setTransactionDataByHash(hash, data) {
|
|
843
|
+
var r = swapTransactionToDataMap[hash];
|
|
844
|
+
if (!r) swapTransactionToDataMap[hash] = {};
|
|
845
|
+
swapTransactionToDataMap[hash].response = data.response || swapTransactionToDataMap[hash].response;
|
|
846
|
+
swapTransactionToDataMap[hash].receiptReceived = data.receiptReceived || swapTransactionToDataMap[hash].receiptReceived || false;
|
|
850
847
|
}
|
|
851
848
|
};
|
|
852
849
|
}
|
|
@@ -1503,8 +1500,8 @@ function isRequiredWalletConnected(swap, getState) {
|
|
|
1503
1500
|
};
|
|
1504
1501
|
}
|
|
1505
1502
|
function singTransaction(actions) {
|
|
1506
|
-
var
|
|
1507
|
-
|
|
1503
|
+
var _useTransactionsData = useTransactionsData(),
|
|
1504
|
+
setTransactionDataByHash = _useTransactionsData.setTransactionDataByHash;
|
|
1508
1505
|
var getStorage = actions.getStorage,
|
|
1509
1506
|
setStorage = actions.setStorage,
|
|
1510
1507
|
failed = actions.failed,
|
|
@@ -1582,7 +1579,9 @@ function singTransaction(actions) {
|
|
|
1582
1579
|
description: isApproval ? 'Approve' : 'Swap'
|
|
1583
1580
|
} : undefined);
|
|
1584
1581
|
// response used for evm transactions to get receipt and track replaced
|
|
1585
|
-
response &&
|
|
1582
|
+
response && setTransactionDataByHash(hash, {
|
|
1583
|
+
response: response
|
|
1584
|
+
});
|
|
1586
1585
|
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
1587
1586
|
next();
|
|
1588
1587
|
onFinish();
|
|
@@ -1868,7 +1867,7 @@ function checkTransactionStatus(_x) {
|
|
|
1868
1867
|
function _checkTransactionStatus() {
|
|
1869
1868
|
_checkTransactionStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
1870
1869
|
var _status, _status2, _status3, _status4, _status5, _status6, _status7, _status9, _status10, _status11;
|
|
1871
|
-
var getStorage, setStorage, next, schedule, retry, failed, context, swap, meta, currentStep, txId, getTxReceiptFailed, status, signer,
|
|
1870
|
+
var getStorage, setStorage, next, schedule, retry, failed, context, swap, meta, currentStep, txId, getTxReceiptFailed, status, signer, _useTransactionsData, getTransactionDataByHash, setTransactionDataByHash, txType, sourceWallet, _signer, _getTransactionDataBy, txResponse, receiptReceived, _yield$signer$wait, updatedTxHash, updatedTxResponse, currentStepBlockchain, explorerUrl, _currentStep$explorer, _prettifyErrorMessage, extraMessage, extraMessageDetail, extraMessageErrorCode, updateResult, outputAmount, prevOutputAmount, newTransaction, nextStep, _status8;
|
|
1872
1871
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1873
1872
|
while (1) switch (_context.prev = _context.next) {
|
|
1874
1873
|
case 0:
|
|
@@ -1876,11 +1875,17 @@ function _checkTransactionStatus() {
|
|
|
1876
1875
|
swap = getStorage().swapDetails;
|
|
1877
1876
|
meta = context.meta; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1878
1877
|
currentStep = getCurrentStep(swap);
|
|
1878
|
+
if (currentStep != null && currentStep.executedTransactionId) {
|
|
1879
|
+
_context.next = 6;
|
|
1880
|
+
break;
|
|
1881
|
+
}
|
|
1882
|
+
return _context.abrupt("return");
|
|
1883
|
+
case 6:
|
|
1879
1884
|
txId = currentStep.executedTransactionId;
|
|
1880
1885
|
getTxReceiptFailed = false;
|
|
1881
1886
|
status = null;
|
|
1882
1887
|
signer = null;
|
|
1883
|
-
|
|
1888
|
+
_useTransactionsData = useTransactionsData(), getTransactionDataByHash = _useTransactionsData.getTransactionDataByHash, setTransactionDataByHash = _useTransactionsData.setTransactionDataByHash;
|
|
1884
1889
|
try {
|
|
1885
1890
|
txType = getCurrentStepTxType(currentStep);
|
|
1886
1891
|
sourceWallet = getRelatedWallet(swap, currentStep);
|
|
@@ -1889,15 +1894,16 @@ function _checkTransactionStatus() {
|
|
|
1889
1894
|
// wallet is not connected yet
|
|
1890
1895
|
// no need to do anything
|
|
1891
1896
|
}
|
|
1892
|
-
_context.prev =
|
|
1893
|
-
if
|
|
1894
|
-
|
|
1897
|
+
_context.prev = 12;
|
|
1898
|
+
// if wallet is connected, try to get transaction reciept
|
|
1899
|
+
_getTransactionDataBy = getTransactionDataByHash(txId), txResponse = _getTransactionDataBy.response, receiptReceived = _getTransactionDataBy.receiptReceived;
|
|
1900
|
+
if (!((_signer = signer) != null && _signer.wait && !receiptReceived)) {
|
|
1901
|
+
_context.next = 21;
|
|
1895
1902
|
break;
|
|
1896
1903
|
}
|
|
1897
|
-
|
|
1898
|
-
_context.next = 15;
|
|
1904
|
+
_context.next = 17;
|
|
1899
1905
|
return signer.wait(txId, txResponse);
|
|
1900
|
-
case
|
|
1906
|
+
case 17:
|
|
1901
1907
|
_yield$signer$wait = _context.sent;
|
|
1902
1908
|
updatedTxHash = _yield$signer$wait.hash;
|
|
1903
1909
|
updatedTxResponse = _yield$signer$wait.response;
|
|
@@ -1914,14 +1920,20 @@ function _checkTransactionStatus() {
|
|
|
1914
1920
|
}
|
|
1915
1921
|
}
|
|
1916
1922
|
txId = currentStep.executedTransactionId;
|
|
1917
|
-
if (updatedTxHash && updatedTxResponse)
|
|
1923
|
+
if (updatedTxHash && updatedTxResponse) setTransactionDataByHash(updatedTxHash, {
|
|
1924
|
+
response: updatedTxResponse
|
|
1925
|
+
});
|
|
1926
|
+
} else {
|
|
1927
|
+
setTransactionDataByHash(updatedTxHash, {
|
|
1928
|
+
receiptReceived: true
|
|
1929
|
+
});
|
|
1918
1930
|
}
|
|
1919
|
-
case 19:
|
|
1920
|
-
_context.next = 27;
|
|
1921
|
-
break;
|
|
1922
1931
|
case 21:
|
|
1923
|
-
_context.
|
|
1924
|
-
|
|
1932
|
+
_context.next = 29;
|
|
1933
|
+
break;
|
|
1934
|
+
case 23:
|
|
1935
|
+
_context.prev = 23;
|
|
1936
|
+
_context.t0 = _context["catch"](12);
|
|
1925
1937
|
_prettifyErrorMessage = prettifyErrorMessage(_context.t0), extraMessage = _prettifyErrorMessage.extraMessage, extraMessageDetail = _prettifyErrorMessage.extraMessageDetail, extraMessageErrorCode = _prettifyErrorMessage.extraMessageErrorCode;
|
|
1926
1938
|
updateResult = updateSwapStatus({
|
|
1927
1939
|
getStorage: getStorage,
|
|
@@ -1938,39 +1950,39 @@ function _checkTransactionStatus() {
|
|
|
1938
1950
|
getTxReceiptFailed = true;
|
|
1939
1951
|
// We shouldn't return here, because we need to trigger check status job in backend.
|
|
1940
1952
|
// This is not a ui requirement but the backend one.
|
|
1941
|
-
case
|
|
1942
|
-
_context.prev =
|
|
1943
|
-
_context.next =
|
|
1953
|
+
case 29:
|
|
1954
|
+
_context.prev = 29;
|
|
1955
|
+
_context.next = 32;
|
|
1944
1956
|
return httpService().checkStatus({
|
|
1945
1957
|
requestId: swap.requestId,
|
|
1946
1958
|
txId: txId,
|
|
1947
1959
|
step: currentStep.id
|
|
1948
1960
|
});
|
|
1949
|
-
case
|
|
1961
|
+
case 32:
|
|
1950
1962
|
status = _context.sent;
|
|
1951
|
-
_context.next =
|
|
1963
|
+
_context.next = 41;
|
|
1952
1964
|
break;
|
|
1953
|
-
case
|
|
1954
|
-
_context.prev =
|
|
1955
|
-
_context.t1 = _context["catch"](
|
|
1956
|
-
_context.next =
|
|
1965
|
+
case 35:
|
|
1966
|
+
_context.prev = 35;
|
|
1967
|
+
_context.t1 = _context["catch"](29);
|
|
1968
|
+
_context.next = 39;
|
|
1957
1969
|
return delay(INTERVAL_FOR_CHECK);
|
|
1958
|
-
case
|
|
1970
|
+
case 39:
|
|
1959
1971
|
retry();
|
|
1960
1972
|
return _context.abrupt("return");
|
|
1961
|
-
case
|
|
1973
|
+
case 41:
|
|
1962
1974
|
if (!getTxReceiptFailed) {
|
|
1963
|
-
_context.next =
|
|
1975
|
+
_context.next = 43;
|
|
1964
1976
|
break;
|
|
1965
1977
|
}
|
|
1966
1978
|
return _context.abrupt("return", failed());
|
|
1967
|
-
case
|
|
1979
|
+
case 43:
|
|
1968
1980
|
if (!((currentStep == null ? void 0 : currentStep.status) === 'failed')) {
|
|
1969
|
-
_context.next =
|
|
1981
|
+
_context.next = 45;
|
|
1970
1982
|
break;
|
|
1971
1983
|
}
|
|
1972
1984
|
return _context.abrupt("return");
|
|
1973
|
-
case
|
|
1985
|
+
case 45:
|
|
1974
1986
|
outputAmount = ((_status = status) == null ? void 0 : _status.outputAmount) || (currentStep.outputAmount ? currentStep.outputAmount : null);
|
|
1975
1987
|
prevOutputAmount = currentStep.outputAmount || null;
|
|
1976
1988
|
swap.extraMessage = ((_status2 = status) == null ? void 0 : _status2.extraMessage) || swap.extraMessage;
|
|
@@ -2016,31 +2028,31 @@ function _checkTransactionStatus() {
|
|
|
2016
2028
|
swapDetails: swap
|
|
2017
2029
|
}));
|
|
2018
2030
|
if (!(((_status9 = status) == null ? void 0 : _status9.status) === 'failed')) {
|
|
2019
|
-
_context.next =
|
|
2031
|
+
_context.next = 64;
|
|
2020
2032
|
break;
|
|
2021
2033
|
}
|
|
2022
2034
|
failed();
|
|
2023
|
-
_context.next =
|
|
2035
|
+
_context.next = 72;
|
|
2024
2036
|
break;
|
|
2025
|
-
case
|
|
2037
|
+
case 64:
|
|
2026
2038
|
if (!(((_status10 = status) == null ? void 0 : _status10.status) === 'success' || ((_status11 = status) == null ? void 0 : _status11.status) === 'running' && !!status.newTx)) {
|
|
2027
|
-
_context.next =
|
|
2039
|
+
_context.next = 69;
|
|
2028
2040
|
break;
|
|
2029
2041
|
}
|
|
2030
2042
|
schedule(SwapActionTypes.SCHEDULE_NEXT_STEP);
|
|
2031
2043
|
next();
|
|
2032
|
-
_context.next =
|
|
2044
|
+
_context.next = 72;
|
|
2033
2045
|
break;
|
|
2034
|
-
case 67:
|
|
2035
|
-
_context.next = 69;
|
|
2036
|
-
return delay(INTERVAL_FOR_CHECK);
|
|
2037
2046
|
case 69:
|
|
2047
|
+
_context.next = 71;
|
|
2048
|
+
return delay(INTERVAL_FOR_CHECK);
|
|
2049
|
+
case 71:
|
|
2038
2050
|
retry();
|
|
2039
|
-
case
|
|
2051
|
+
case 72:
|
|
2040
2052
|
case "end":
|
|
2041
2053
|
return _context.stop();
|
|
2042
2054
|
}
|
|
2043
|
-
}, _callee, null, [[
|
|
2055
|
+
}, _callee, null, [[12, 23], [29, 35]]);
|
|
2044
2056
|
}));
|
|
2045
2057
|
return _checkTransactionStatus.apply(this, arguments);
|
|
2046
2058
|
}
|
|
@@ -2057,14 +2069,14 @@ function checkApprovalStatus(_x2) {
|
|
|
2057
2069
|
*/
|
|
2058
2070
|
function _checkApprovalStatus() {
|
|
2059
2071
|
_checkApprovalStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
|
|
2060
|
-
var getStorage, setStorage, next, schedule, retry, failed, context, swap, meta,
|
|
2072
|
+
var getStorage, setStorage, next, schedule, retry, failed, context, swap, meta, _useTransactionsData2, getTransactionDataByHash, setTransactionDataByHash, currentStep, txId, signer, txType, sourceWallet, _signer2, _getTransactionDataBy2, txResponse, receiptReceived, _yield$signer$wait2, updatedTxHash, updatedTxResponse, currentStepBlockchain, explorerUrl, _currentStep$explorer2, _prettifyErrorMessage2, extraMessage, extraMessageDetail, extraMessageErrorCode, updateResult, isApproved, response, message, details, _updateResult;
|
|
2061
2073
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2062
2074
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2063
2075
|
case 0:
|
|
2064
2076
|
getStorage = _ref2.getStorage, setStorage = _ref2.setStorage, next = _ref2.next, schedule = _ref2.schedule, retry = _ref2.retry, failed = _ref2.failed, context = _ref2.context;
|
|
2065
2077
|
swap = getStorage().swapDetails;
|
|
2066
2078
|
meta = context.meta;
|
|
2067
|
-
|
|
2079
|
+
_useTransactionsData2 = useTransactionsData(), getTransactionDataByHash = _useTransactionsData2.getTransactionDataByHash, setTransactionDataByHash = _useTransactionsData2.setTransactionDataByHash;
|
|
2068
2080
|
currentStep = getCurrentStep(swap);
|
|
2069
2081
|
if (currentStep) {
|
|
2070
2082
|
_context2.next = 8;
|
|
@@ -2073,6 +2085,12 @@ function _checkApprovalStatus() {
|
|
|
2073
2085
|
console.log('ignore check status, current step is null');
|
|
2074
2086
|
return _context2.abrupt("return");
|
|
2075
2087
|
case 8:
|
|
2088
|
+
if (currentStep != null && currentStep.executedTransactionId) {
|
|
2089
|
+
_context2.next = 10;
|
|
2090
|
+
break;
|
|
2091
|
+
}
|
|
2092
|
+
return _context2.abrupt("return");
|
|
2093
|
+
case 10:
|
|
2076
2094
|
txId = currentStep.executedTransactionId;
|
|
2077
2095
|
signer = null;
|
|
2078
2096
|
try {
|
|
@@ -2083,15 +2101,15 @@ function _checkApprovalStatus() {
|
|
|
2083
2101
|
// wallet is not connected yet
|
|
2084
2102
|
// no need to do anything
|
|
2085
2103
|
}
|
|
2086
|
-
_context2.prev =
|
|
2087
|
-
|
|
2088
|
-
|
|
2104
|
+
_context2.prev = 13;
|
|
2105
|
+
_getTransactionDataBy2 = getTransactionDataByHash(txId), txResponse = _getTransactionDataBy2.response, receiptReceived = _getTransactionDataBy2.receiptReceived; // if wallet is connected, try to get transaction reciept
|
|
2106
|
+
if (!((_signer2 = signer) != null && _signer2.wait && !receiptReceived)) {
|
|
2107
|
+
_context2.next = 22;
|
|
2089
2108
|
break;
|
|
2090
2109
|
}
|
|
2091
|
-
|
|
2092
|
-
_context2.next = 16;
|
|
2110
|
+
_context2.next = 18;
|
|
2093
2111
|
return signer.wait(txId, txResponse);
|
|
2094
|
-
case
|
|
2112
|
+
case 18:
|
|
2095
2113
|
_yield$signer$wait2 = _context2.sent;
|
|
2096
2114
|
updatedTxHash = _yield$signer$wait2.hash;
|
|
2097
2115
|
updatedTxResponse = _yield$signer$wait2.response;
|
|
@@ -2108,14 +2126,20 @@ function _checkApprovalStatus() {
|
|
|
2108
2126
|
}
|
|
2109
2127
|
}
|
|
2110
2128
|
txId = currentStep.executedTransactionId;
|
|
2111
|
-
if (updatedTxHash && updatedTxResponse)
|
|
2129
|
+
if (updatedTxHash && updatedTxResponse) setTransactionDataByHash(updatedTxHash, {
|
|
2130
|
+
response: updatedTxResponse
|
|
2131
|
+
});
|
|
2132
|
+
} else {
|
|
2133
|
+
setTransactionDataByHash(updatedTxHash, {
|
|
2134
|
+
receiptReceived: true
|
|
2135
|
+
});
|
|
2112
2136
|
}
|
|
2113
|
-
case 20:
|
|
2114
|
-
_context2.next = 28;
|
|
2115
|
-
break;
|
|
2116
2137
|
case 22:
|
|
2117
|
-
_context2.
|
|
2118
|
-
|
|
2138
|
+
_context2.next = 30;
|
|
2139
|
+
break;
|
|
2140
|
+
case 24:
|
|
2141
|
+
_context2.prev = 24;
|
|
2142
|
+
_context2.t0 = _context2["catch"](13);
|
|
2119
2143
|
_prettifyErrorMessage2 = prettifyErrorMessage(_context2.t0), extraMessage = _prettifyErrorMessage2.extraMessage, extraMessageDetail = _prettifyErrorMessage2.extraMessageDetail, extraMessageErrorCode = _prettifyErrorMessage2.extraMessageErrorCode;
|
|
2120
2144
|
updateResult = updateSwapStatus({
|
|
2121
2145
|
getStorage: getStorage,
|
|
@@ -2130,19 +2154,19 @@ function _checkApprovalStatus() {
|
|
|
2130
2154
|
eventType: 'task_failed'
|
|
2131
2155
|
}, updateResult));
|
|
2132
2156
|
return _context2.abrupt("return", failed());
|
|
2133
|
-
case
|
|
2157
|
+
case 30:
|
|
2134
2158
|
isApproved = false;
|
|
2135
|
-
_context2.prev =
|
|
2136
|
-
_context2.next =
|
|
2137
|
-
return httpService().checkApproval(swap.requestId, currentStep.executedTransactionId
|
|
2138
|
-
case
|
|
2159
|
+
_context2.prev = 31;
|
|
2160
|
+
_context2.next = 34;
|
|
2161
|
+
return httpService().checkApproval(swap.requestId, currentStep.executedTransactionId);
|
|
2162
|
+
case 34:
|
|
2139
2163
|
response = _context2.sent;
|
|
2140
2164
|
if (!((currentStep == null ? void 0 : currentStep.status) === 'failed')) {
|
|
2141
|
-
_context2.next =
|
|
2165
|
+
_context2.next = 37;
|
|
2142
2166
|
break;
|
|
2143
2167
|
}
|
|
2144
2168
|
return _context2.abrupt("return");
|
|
2145
|
-
case
|
|
2169
|
+
case 37:
|
|
2146
2170
|
isApproved = response.isApproved;
|
|
2147
2171
|
if (!isApproved && (response.txStatus === 'failed' || response.txStatus === 'success')) {
|
|
2148
2172
|
if (response.txStatus === 'failed') {
|
|
@@ -2175,15 +2199,15 @@ function _checkApprovalStatus() {
|
|
|
2175
2199
|
step: currentStep
|
|
2176
2200
|
});
|
|
2177
2201
|
}
|
|
2178
|
-
_context2.next =
|
|
2202
|
+
_context2.next = 44;
|
|
2179
2203
|
break;
|
|
2180
|
-
case
|
|
2181
|
-
_context2.prev =
|
|
2182
|
-
_context2.t1 = _context2["catch"](
|
|
2204
|
+
case 41:
|
|
2205
|
+
_context2.prev = 41;
|
|
2206
|
+
_context2.t1 = _context2["catch"](31);
|
|
2183
2207
|
isApproved = false;
|
|
2184
|
-
case
|
|
2208
|
+
case 44:
|
|
2185
2209
|
if (!isApproved) {
|
|
2186
|
-
_context2.next =
|
|
2210
|
+
_context2.next = 60;
|
|
2187
2211
|
break;
|
|
2188
2212
|
}
|
|
2189
2213
|
currentStep.status = 'approved';
|
|
@@ -2205,18 +2229,18 @@ function _checkApprovalStatus() {
|
|
|
2205
2229
|
});
|
|
2206
2230
|
schedule(SwapActionTypes.SCHEDULE_NEXT_STEP);
|
|
2207
2231
|
next();
|
|
2208
|
-
_context2.next =
|
|
2232
|
+
_context2.next = 63;
|
|
2209
2233
|
break;
|
|
2210
|
-
case 58:
|
|
2211
|
-
_context2.next = 60;
|
|
2212
|
-
return delay(2000);
|
|
2213
2234
|
case 60:
|
|
2235
|
+
_context2.next = 62;
|
|
2236
|
+
return delay(2000);
|
|
2237
|
+
case 62:
|
|
2214
2238
|
retry();
|
|
2215
|
-
case
|
|
2239
|
+
case 63:
|
|
2216
2240
|
case "end":
|
|
2217
2241
|
return _context2.stop();
|
|
2218
2242
|
}
|
|
2219
|
-
}, _callee2, null, [[
|
|
2243
|
+
}, _callee2, null, [[13, 24], [31, 41]]);
|
|
2220
2244
|
}));
|
|
2221
2245
|
return _checkApprovalStatus.apply(this, arguments);
|
|
2222
2246
|
}
|