@rango-dev/queue-manager-rango-preset 0.1.10-next.77 → 0.1.10-next.80
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/createTransaction.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/helpers.d.ts +2 -2
- package/dist/helpers.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/queue-manager-rango-preset.cjs.development.js +350 -294
- 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 +345 -286
- package/dist/queue-manager-rango-preset.esm.js.map +1 -1
- package/dist/services/httpService.d.ts +3 -0
- package/dist/services/httpService.d.ts.map +1 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/shared-errors.d.ts +1 -0
- package/dist/shared-errors.d.ts.map +1 -1
- package/dist/shared.d.ts +11 -16
- package/dist/shared.d.ts.map +1 -1
- package/dist/types.d.ts +3 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -2
- package/src/actions/checkStatus.ts +14 -12
- package/src/actions/createTransaction.ts +21 -3
- package/src/constants.ts +1 -3
- package/src/helpers.ts +530 -192
- package/src/index.ts +3 -0
- package/src/services/httpService.ts +4 -0
- package/src/services/index.ts +1 -0
- package/src/shared-errors.ts +28 -1
- package/src/shared-sentry.ts +1 -1
- package/src/shared.ts +62 -35
- package/src/types.ts +2 -3
- package/dist/shared-api.d.ts +0 -10
- package/dist/shared-api.d.ts.map +0 -1
- package/src/shared-api.ts +0 -175
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
|
-
|
|
7
|
-
var BigNumber = require('bignumber.js');
|
|
8
|
-
var BigNumber__default = _interopDefault(BigNumber);
|
|
9
5
|
var walletsShared = require('@rango-dev/wallets-shared');
|
|
10
6
|
var walletsCore = require('@rango-dev/wallets-core');
|
|
7
|
+
var rangoSdk = require('rango-sdk');
|
|
11
8
|
var queueManagerCore = require('@rango-dev/queue-manager-core');
|
|
9
|
+
var rangoTypes = require('rango-types');
|
|
12
10
|
var Sentry = require('@sentry/browser');
|
|
13
11
|
|
|
14
12
|
var SwapActionTypes;
|
|
@@ -451,9 +449,7 @@ function _assertThisInitialized(self) {
|
|
|
451
449
|
return self;
|
|
452
450
|
}
|
|
453
451
|
|
|
454
|
-
var
|
|
455
|
-
var BASE_URL = process.env.REACT_APP_BASE_URL;
|
|
456
|
-
var RANGO_COOKIE_HEADER = 'X-Rango-Id';
|
|
452
|
+
var RANGO_DAPP_API_KEY = process.env.REACT_API_KEY;
|
|
457
453
|
var ERROR_MESSAGE_WAIT_FOR_WALLET = 'Waiting for connecting wallet';
|
|
458
454
|
var ERROR_MESSAGE_WAIT_FOR_WALLET_DESCRIPTION_WRONG_WALLET = function ERROR_MESSAGE_WAIT_FOR_WALLET_DESCRIPTION_WRONG_WALLET(type, address) {
|
|
459
455
|
return "Please change your " + (type || 'wallet') + " account to " + (address || 'proper address');
|
|
@@ -493,9 +489,6 @@ var TransactionName;
|
|
|
493
489
|
TransactionName["Approval"] = "approve transaction";
|
|
494
490
|
})(TransactionName || (TransactionName = {}));
|
|
495
491
|
var ERROR_ASSERTION_FAILED = 'Assertion failed (Unexpected behaviour)';
|
|
496
|
-
var ERROR_COMMUNICATING_WITH_API = function ERROR_COMMUNICATING_WITH_API(apiMethodName) {
|
|
497
|
-
return "Unexpected response from API (" + apiMethodName + ")";
|
|
498
|
-
};
|
|
499
492
|
var ERROR_CREATE_TRANSACTION = 'Create transaction failed in Rango Server';
|
|
500
493
|
var ERROR_INPUT_WALLET_NOT_FOUND = 'Input wallet not found';
|
|
501
494
|
var PrettyError = /*#__PURE__*/function (_Error) {
|
|
@@ -536,6 +529,24 @@ var PrettyError = /*#__PURE__*/function (_Error) {
|
|
|
536
529
|
};
|
|
537
530
|
return PrettyError;
|
|
538
531
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
532
|
+
function isAPIErrorCode(value) {
|
|
533
|
+
return Object.values(APIErrorCode).includes(value);
|
|
534
|
+
}
|
|
535
|
+
function mapAppErrorCodesToAPIErrorCode(errorCode) {
|
|
536
|
+
var defaultErrorCode = APIErrorCode.CLIENT_UNEXPECTED_BEHAVIOUR;
|
|
537
|
+
try {
|
|
538
|
+
if (!errorCode) return defaultErrorCode;
|
|
539
|
+
if (isAPIErrorCode(errorCode)) return errorCode;
|
|
540
|
+
if (rangoTypes.isSignerErrorCode(errorCode)) {
|
|
541
|
+
var _t;
|
|
542
|
+
var t = (_t = {}, _t[rangoTypes.SignerErrorCode.REJECTED_BY_USER] = APIErrorCode.USER_REJECT, _t[rangoTypes.SignerErrorCode.SIGN_TX_ERROR] = APIErrorCode.CALL_WALLET_FAILED, _t[rangoTypes.SignerErrorCode.SEND_TX_ERROR] = APIErrorCode.SEND_TX_FAILED, _t[rangoTypes.SignerErrorCode.NOT_IMPLEMENTED] = defaultErrorCode, _t[rangoTypes.SignerErrorCode.OPERATION_UNSUPPORTED] = defaultErrorCode, _t[rangoTypes.SignerErrorCode.UNEXPECTED_BEHAVIOUR] = defaultErrorCode, _t);
|
|
543
|
+
return t[errorCode];
|
|
544
|
+
}
|
|
545
|
+
return defaultErrorCode;
|
|
546
|
+
} catch (err) {
|
|
547
|
+
return defaultErrorCode;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
539
550
|
|
|
540
551
|
var PendingSwapNetworkStatus;
|
|
541
552
|
(function (PendingSwapNetworkStatus) {
|
|
@@ -582,13 +593,19 @@ var getEvmApproveUrl = function getEvmApproveUrl(tx, network, evmBasedBlockchain
|
|
|
582
593
|
if (evmBlochain.info.transactionUrl) return evmBlochain.info.transactionUrl.replace('{txHash}', tx.toLowerCase());
|
|
583
594
|
throw Error("Explorer url for " + network + " is not implemented");
|
|
584
595
|
};
|
|
596
|
+
var getStarknetApproveUrl = function getStarknetApproveUrl(tx) {
|
|
597
|
+
return 'https://starkscan.co/tx/{txHash}'.replace('{txHash}', tx.toLowerCase());
|
|
598
|
+
};
|
|
599
|
+
var getTronApproveUrl = function getTronApproveUrl(tx) {
|
|
600
|
+
return 'https://tronscan.org/#/transaction/{txHash}'.replace('{txHash}', tx.toLowerCase());
|
|
601
|
+
};
|
|
585
602
|
var prettifyErrorMessage = function prettifyErrorMessage(obj) {
|
|
586
603
|
if (!obj) return {
|
|
587
604
|
extraMessage: '',
|
|
588
605
|
extraMessageErrorCode: null
|
|
589
606
|
};
|
|
590
607
|
if (obj instanceof PrettyError) return obj.getErrorDetail();
|
|
591
|
-
if (obj instanceof
|
|
608
|
+
if (obj instanceof rangoTypes.SignerError) {
|
|
592
609
|
var t = obj.getErrorDetail();
|
|
593
610
|
return {
|
|
594
611
|
extraMessage: t.message,
|
|
@@ -609,21 +626,38 @@ var prettifyErrorMessage = function prettifyErrorMessage(obj) {
|
|
|
609
626
|
extraMessageErrorCode: null
|
|
610
627
|
};
|
|
611
628
|
};
|
|
612
|
-
function getCookieId() {
|
|
613
|
-
var key = 'X-Rango-Id';
|
|
614
|
-
var cookieId = window.localStorage.getItem(key);
|
|
615
|
-
if (cookieId) {
|
|
616
|
-
return cookieId;
|
|
617
|
-
}
|
|
618
|
-
var value = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
|
619
|
-
window.localStorage.setItem(key, value);
|
|
620
|
-
return value;
|
|
621
|
-
}
|
|
622
629
|
function getNextStep(swap, currentStep) {
|
|
623
630
|
return swap.steps.find(function (step) {
|
|
624
631
|
return step.status !== 'failed' && step.status !== 'success' && step.id !== currentStep.id;
|
|
625
632
|
}) || null;
|
|
626
633
|
}
|
|
634
|
+
// TODO: we have samething in `helpers`, for fixing circular dependency, we copied and should be removed eventually.
|
|
635
|
+
var getCurrentAddressOf = function getCurrentAddressOf(swap, step) {
|
|
636
|
+
var _step$evmTransaction2, _step$evmApprovalTran2, _step$cosmosTransacti2, _step$solanaTransacti2, _step$transferTransac2, _step$transferTransac3;
|
|
637
|
+
var result = swap.wallets[((_step$evmTransaction2 = step.evmTransaction) == null ? void 0 : _step$evmTransaction2.blockChain) || ''] || swap.wallets[((_step$evmApprovalTran2 = step.evmApprovalTransaction) == null ? void 0 : _step$evmApprovalTran2.blockChain) || ''] || swap.wallets[((_step$cosmosTransacti2 = step.cosmosTransaction) == null ? void 0 : _step$cosmosTransacti2.blockChain) || ''] || swap.wallets[((_step$solanaTransacti2 = step.solanaTransaction) == null ? void 0 : _step$solanaTransacti2.blockChain) || ''] || ((_step$transferTransac2 = step.transferTransaction) != null && _step$transferTransac2.fromWalletAddress ? {
|
|
638
|
+
address: (_step$transferTransac3 = step.transferTransaction) == null ? void 0 : _step$transferTransac3.fromWalletAddress
|
|
639
|
+
} : null) || null;
|
|
640
|
+
if (result == null) throw PrettyError.WalletMissing();
|
|
641
|
+
return result.address;
|
|
642
|
+
};
|
|
643
|
+
// TODO: we have samething in `helpers`, for fixing circular dependency, we copied and should be removed eventually.
|
|
644
|
+
function getRelatedWallet(swap, currentStep) {
|
|
645
|
+
var walletAddress = getCurrentAddressOf(swap, currentStep);
|
|
646
|
+
var walletKV = Object.keys(swap.wallets).map(function (k) {
|
|
647
|
+
return {
|
|
648
|
+
k: k,
|
|
649
|
+
v: swap.wallets[k]
|
|
650
|
+
};
|
|
651
|
+
}).find(function (_ref) {
|
|
652
|
+
var v = _ref.v;
|
|
653
|
+
return v.address === walletAddress;
|
|
654
|
+
}) || null;
|
|
655
|
+
var blockchain = (walletKV == null ? void 0 : walletKV.k) || null;
|
|
656
|
+
var wallet = (walletKV == null ? void 0 : walletKV.v) || null;
|
|
657
|
+
var walletType = wallet == null ? void 0 : wallet.walletType;
|
|
658
|
+
if (walletType === walletsShared.WalletType.UNKNOWN || wallet === null) throw PrettyError.AssertionFailed("Wallet for source " + blockchain + " not passed: walletType: " + walletType);
|
|
659
|
+
return wallet;
|
|
660
|
+
}
|
|
627
661
|
function getRelatedWalletOrNull(swap, currentStep) {
|
|
628
662
|
try {
|
|
629
663
|
return getRelatedWallet(swap, currentStep);
|
|
@@ -650,200 +684,7 @@ function logRPCError(error, swap, currentStep, walletType) {
|
|
|
650
684
|
}
|
|
651
685
|
}
|
|
652
686
|
|
|
653
|
-
|
|
654
|
-
return _checkSwapStatus.apply(this, arguments);
|
|
655
|
-
}
|
|
656
|
-
function _checkSwapStatus() {
|
|
657
|
-
_checkSwapStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(requestId, txId, step) {
|
|
658
|
-
var _headers;
|
|
659
|
-
var url, body, response, apiError, res;
|
|
660
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
661
|
-
while (1) switch (_context.prev = _context.next) {
|
|
662
|
-
case 0:
|
|
663
|
-
url = BASE_URL + "/tx/check-status?" + RANGO_DAPP_ID_QUERY;
|
|
664
|
-
body = {
|
|
665
|
-
step: step,
|
|
666
|
-
txId: txId,
|
|
667
|
-
requestId: requestId
|
|
668
|
-
};
|
|
669
|
-
_context.next = 4;
|
|
670
|
-
return fetch(url, {
|
|
671
|
-
method: 'POST',
|
|
672
|
-
headers: (_headers = {}, _headers[RANGO_COOKIE_HEADER] = getCookieId(), _headers['content-type'] = 'application/json;charset=UTF-8', _headers),
|
|
673
|
-
body: JSON.stringify(body)
|
|
674
|
-
});
|
|
675
|
-
case 4:
|
|
676
|
-
response = _context.sent;
|
|
677
|
-
if (!(!!response.status && (response.status < 200 || response.status >= 400) || !response.ok)) {
|
|
678
|
-
_context.next = 8;
|
|
679
|
-
break;
|
|
680
|
-
}
|
|
681
|
-
apiError = ERROR_COMMUNICATING_WITH_API(ApiMethodName.CheckingTransactionStatus);
|
|
682
|
-
throw PrettyError.BadStatusCode(apiError, response.status);
|
|
683
|
-
case 8:
|
|
684
|
-
_context.next = 10;
|
|
685
|
-
return response.json();
|
|
686
|
-
case 10:
|
|
687
|
-
res = _context.sent;
|
|
688
|
-
return _context.abrupt("return", _extends({}, res, {
|
|
689
|
-
outputAmount: res.outputAmount ? new BigNumber.BigNumber(res.outputAmount) : null
|
|
690
|
-
}));
|
|
691
|
-
case 12:
|
|
692
|
-
case "end":
|
|
693
|
-
return _context.stop();
|
|
694
|
-
}
|
|
695
|
-
}, _callee);
|
|
696
|
-
}));
|
|
697
|
-
return _checkSwapStatus.apply(this, arguments);
|
|
698
|
-
}
|
|
699
|
-
function createTransaction(_x4) {
|
|
700
|
-
return _createTransaction.apply(this, arguments);
|
|
701
|
-
}
|
|
702
|
-
function _createTransaction() {
|
|
703
|
-
_createTransaction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
|
|
704
|
-
var url, _headers2, response, result;
|
|
705
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
706
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
707
|
-
case 0:
|
|
708
|
-
url = BASE_URL + "/tx/create?" + RANGO_DAPP_ID_QUERY;
|
|
709
|
-
_context2.prev = 1;
|
|
710
|
-
_context2.next = 4;
|
|
711
|
-
return fetch(url, {
|
|
712
|
-
method: 'POST',
|
|
713
|
-
headers: (_headers2 = {
|
|
714
|
-
'content-type': 'application/json;charset=UTF-8'
|
|
715
|
-
}, _headers2[RANGO_COOKIE_HEADER] = getCookieId(), _headers2),
|
|
716
|
-
body: JSON.stringify(request)
|
|
717
|
-
});
|
|
718
|
-
case 4:
|
|
719
|
-
response = _context2.sent;
|
|
720
|
-
if (!(!!response.status && (response.status < 200 || response.status >= 400) || !response.ok)) {
|
|
721
|
-
_context2.next = 7;
|
|
722
|
-
break;
|
|
723
|
-
}
|
|
724
|
-
throw PrettyError.CreateTransaction("Error creating the transaction, status code: " + response.status);
|
|
725
|
-
case 7:
|
|
726
|
-
_context2.next = 9;
|
|
727
|
-
return response.json();
|
|
728
|
-
case 9:
|
|
729
|
-
result = _context2.sent;
|
|
730
|
-
if (!(!result.ok || !result.transaction)) {
|
|
731
|
-
_context2.next = 12;
|
|
732
|
-
break;
|
|
733
|
-
}
|
|
734
|
-
throw PrettyError.CreateTransaction(result.error || 'bad response from create tx endpoint');
|
|
735
|
-
case 12:
|
|
736
|
-
return _context2.abrupt("return", result);
|
|
737
|
-
case 15:
|
|
738
|
-
_context2.prev = 15;
|
|
739
|
-
_context2.t0 = _context2["catch"](1);
|
|
740
|
-
if (!(_context2.t0 instanceof Error)) {
|
|
741
|
-
_context2.next = 19;
|
|
742
|
-
break;
|
|
743
|
-
}
|
|
744
|
-
throw PrettyError.CreateTransaction(_context2.t0.message);
|
|
745
|
-
case 19:
|
|
746
|
-
throw _context2.t0;
|
|
747
|
-
case 20:
|
|
748
|
-
case "end":
|
|
749
|
-
return _context2.stop();
|
|
750
|
-
}
|
|
751
|
-
}, _callee2, null, [[1, 15]]);
|
|
752
|
-
}));
|
|
753
|
-
return _createTransaction.apply(this, arguments);
|
|
754
|
-
}
|
|
755
|
-
function checkApproved(_x5) {
|
|
756
|
-
return _checkApproved.apply(this, arguments);
|
|
757
|
-
}
|
|
758
|
-
function _checkApproved() {
|
|
759
|
-
_checkApproved = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(requestId) {
|
|
760
|
-
var _headers3;
|
|
761
|
-
var url, response, apiError;
|
|
762
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
763
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
764
|
-
case 0:
|
|
765
|
-
url = BASE_URL + "/tx/" + requestId + "/check-approval?" + RANGO_DAPP_ID_QUERY;
|
|
766
|
-
_context3.next = 3;
|
|
767
|
-
return fetch(url, {
|
|
768
|
-
method: 'GET',
|
|
769
|
-
headers: (_headers3 = {
|
|
770
|
-
'content-type': 'application/json;charset=UTF-8'
|
|
771
|
-
}, _headers3[RANGO_COOKIE_HEADER] = getCookieId(), _headers3)
|
|
772
|
-
});
|
|
773
|
-
case 3:
|
|
774
|
-
response = _context3.sent;
|
|
775
|
-
if (!(!!response.status && (response.status < 200 || response.status >= 400) || !response.ok)) {
|
|
776
|
-
_context3.next = 7;
|
|
777
|
-
break;
|
|
778
|
-
}
|
|
779
|
-
apiError = ERROR_COMMUNICATING_WITH_API(ApiMethodName.CheckApproval);
|
|
780
|
-
throw PrettyError.BadStatusCode(apiError, response.status);
|
|
781
|
-
case 7:
|
|
782
|
-
_context3.next = 9;
|
|
783
|
-
return response.json();
|
|
784
|
-
case 9:
|
|
785
|
-
return _context3.abrupt("return", _context3.sent);
|
|
786
|
-
case 10:
|
|
787
|
-
case "end":
|
|
788
|
-
return _context3.stop();
|
|
789
|
-
}
|
|
790
|
-
}, _callee3);
|
|
791
|
-
}));
|
|
792
|
-
return _checkApproved.apply(this, arguments);
|
|
793
|
-
}
|
|
794
|
-
function isAPIErrorCode(value) {
|
|
795
|
-
return Object.values(APIErrorCode).includes(value);
|
|
796
|
-
}
|
|
797
|
-
function mapAppErrorCodesToAPIErrorCode(errorCode) {
|
|
798
|
-
var defaultErrorCode = APIErrorCode.CLIENT_UNEXPECTED_BEHAVIOUR;
|
|
799
|
-
try {
|
|
800
|
-
if (!errorCode) return defaultErrorCode;
|
|
801
|
-
if (isAPIErrorCode(errorCode)) return errorCode;
|
|
802
|
-
if (walletsShared.isWalletErrorCode(errorCode)) {
|
|
803
|
-
var _t;
|
|
804
|
-
var t = (_t = {}, _t[walletsShared.WalletErrorCode.REJECTED_BY_USER] = APIErrorCode.USER_REJECT, _t[walletsShared.WalletErrorCode.SIGN_TX_ERROR] = APIErrorCode.CALL_WALLET_FAILED, _t[walletsShared.WalletErrorCode.SEND_TX_ERROR] = APIErrorCode.SEND_TX_FAILED, _t[walletsShared.WalletErrorCode.NOT_IMPLEMENTED] = defaultErrorCode, _t[walletsShared.WalletErrorCode.OPERATION_UNSUPPORTED] = defaultErrorCode, _t[walletsShared.WalletErrorCode.UNEXPECTED_BEHAVIOUR] = defaultErrorCode, _t);
|
|
805
|
-
return t[errorCode];
|
|
806
|
-
}
|
|
807
|
-
return defaultErrorCode;
|
|
808
|
-
} catch (err) {
|
|
809
|
-
return defaultErrorCode;
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
function reportFailed(_x6, _x7, _x8, _x9, _x10) {
|
|
813
|
-
return _reportFailed.apply(this, arguments);
|
|
814
|
-
}
|
|
815
|
-
function _reportFailed() {
|
|
816
|
-
_reportFailed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(requestId, step, eventType, reason, walletType) {
|
|
817
|
-
var _headers4;
|
|
818
|
-
var url;
|
|
819
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
820
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
821
|
-
case 0:
|
|
822
|
-
url = BASE_URL + "/tx/report-tx?" + RANGO_DAPP_ID_QUERY;
|
|
823
|
-
_context4.next = 3;
|
|
824
|
-
return fetch(url, {
|
|
825
|
-
method: 'POST',
|
|
826
|
-
headers: (_headers4 = {
|
|
827
|
-
'content-type': 'application/json;charset=UTF-8'
|
|
828
|
-
}, _headers4[RANGO_COOKIE_HEADER] = getCookieId(), _headers4),
|
|
829
|
-
body: JSON.stringify({
|
|
830
|
-
requestId: requestId,
|
|
831
|
-
step: step,
|
|
832
|
-
eventType: eventType,
|
|
833
|
-
reason: reason,
|
|
834
|
-
tags: {
|
|
835
|
-
wallet: walletType
|
|
836
|
-
}
|
|
837
|
-
})
|
|
838
|
-
});
|
|
839
|
-
case 3:
|
|
840
|
-
case "end":
|
|
841
|
-
return _context4.stop();
|
|
842
|
-
}
|
|
843
|
-
}, _callee4);
|
|
844
|
-
}));
|
|
845
|
-
return _reportFailed.apply(this, arguments);
|
|
846
|
-
}
|
|
687
|
+
var httpService = /*#__PURE__*/new rangoSdk.RangoClient(RANGO_DAPP_API_KEY || '');
|
|
847
688
|
|
|
848
689
|
var swapClaimedBy = null;
|
|
849
690
|
/**
|
|
@@ -902,8 +743,17 @@ function updateSwapStatus(_ref) {
|
|
|
902
743
|
var _getRelatedWalletOrNu;
|
|
903
744
|
//if user cancel the swap, we should pass relevant reason to the server.
|
|
904
745
|
var errorReason = details && details.includes('Warning') ? 'Swap canceled by user.' : details;
|
|
746
|
+
var walletType = (_getRelatedWalletOrNu = getRelatedWalletOrNull(swap, currentStep)) == null ? void 0 : _getRelatedWalletOrNu.walletType;
|
|
905
747
|
swap.extraMessageSeverity = MessageSeverity.error;
|
|
906
|
-
|
|
748
|
+
httpService.reportFailure({
|
|
749
|
+
requestId: swap.requestId,
|
|
750
|
+
step: (currentStep == null ? void 0 : currentStep.id) || 1,
|
|
751
|
+
eventType: mapAppErrorCodesToAPIErrorCode(errorCode),
|
|
752
|
+
reason: errorReason || '',
|
|
753
|
+
data: walletType ? {
|
|
754
|
+
wallet: walletType
|
|
755
|
+
} : undefined
|
|
756
|
+
}).then()["catch"]();
|
|
907
757
|
} else if (!!nextStepStatus && ['running'].includes(nextStepStatus)) swap.extraMessageSeverity = MessageSeverity.info;else if (!!nextStepStatus && ['success', 'approved'].includes(nextStepStatus)) swap.extraMessageSeverity = MessageSeverity.success;else if (nextStepStatus && ['waitingForApproval'].includes(nextStepStatus)) swap.extraMessageSeverity = MessageSeverity.warning;
|
|
908
758
|
if (nextStepStatus === 'running' && currentStep) currentStep.startTransactionTime = new Date().getTime();
|
|
909
759
|
setStorage(_extends({}, getStorage(), {
|
|
@@ -1011,22 +861,22 @@ function delay(ms) {
|
|
|
1011
861
|
});
|
|
1012
862
|
}
|
|
1013
863
|
var isEvmTransaction = function isEvmTransaction(tx) {
|
|
1014
|
-
return tx.type ===
|
|
864
|
+
return tx.type === rangoSdk.TransactionType.EVM;
|
|
1015
865
|
};
|
|
1016
866
|
var isCosmosTransaction = function isCosmosTransaction(tx) {
|
|
1017
|
-
return tx.type ===
|
|
867
|
+
return tx.type === rangoSdk.TransactionType.COSMOS;
|
|
1018
868
|
};
|
|
1019
869
|
var isSolanaTransaction = function isSolanaTransaction(tx) {
|
|
1020
|
-
return tx.type ===
|
|
870
|
+
return tx.type === rangoSdk.TransactionType.SOLANA;
|
|
1021
871
|
};
|
|
1022
872
|
var isTrasnferTransaction = function isTrasnferTransaction(tx) {
|
|
1023
|
-
return tx.type ===
|
|
873
|
+
return tx.type === rangoSdk.TransactionType.TRANSFER;
|
|
1024
874
|
};
|
|
1025
875
|
var isStarknetTransaction = function isStarknetTransaction(tx) {
|
|
1026
|
-
return tx.type ===
|
|
876
|
+
return tx.type === rangoSdk.TransactionType.STARKNET;
|
|
1027
877
|
};
|
|
1028
878
|
var isTronTransaction = function isTronTransaction(tx) {
|
|
1029
|
-
return tx.type ===
|
|
879
|
+
return tx.type === rangoSdk.TransactionType.TRON;
|
|
1030
880
|
};
|
|
1031
881
|
/**
|
|
1032
882
|
*
|
|
@@ -1163,7 +1013,7 @@ function _isNetworkMatchedForTransaction() {
|
|
|
1163
1013
|
_context2.next = 24;
|
|
1164
1014
|
break;
|
|
1165
1015
|
}
|
|
1166
|
-
if (![walletsShared.WalletType.META_MASK, walletsShared.WalletType.BINANCE_CHAIN, walletsShared.WalletType.XDEFI, walletsShared.WalletType.WALLET_CONNECT, walletsShared.WalletType.TRUST_WALLET, walletsShared.WalletType.COIN98, walletsShared.WalletType.EXODUS, walletsShared.WalletType.OKX, walletsShared.WalletType.COINBASE, walletsShared.WalletType.TOKEN_POCKET, walletsShared.WalletType.MATH, walletsShared.WalletType.SAFEPAL, walletsShared.WalletType.COSMOSTATION, walletsShared.WalletType.CLOVER, walletsShared.WalletType.BRAVE].includes(sourceWallet.walletType)) {
|
|
1016
|
+
if (![walletsShared.WalletType.META_MASK, walletsShared.WalletType.BINANCE_CHAIN, walletsShared.WalletType.XDEFI, walletsShared.WalletType.WALLET_CONNECT, walletsShared.WalletType.TRUST_WALLET, walletsShared.WalletType.COIN98, walletsShared.WalletType.EXODUS, walletsShared.WalletType.OKX, walletsShared.WalletType.COINBASE, walletsShared.WalletType.TOKEN_POCKET, walletsShared.WalletType.MATH, walletsShared.WalletType.SAFEPAL, walletsShared.WalletType.COSMOSTATION, walletsShared.WalletType.CLOVER, walletsShared.WalletType.BRAVE, walletsShared.WalletType.FRONTIER, walletsShared.WalletType.KUCOIN].includes(sourceWallet.walletType)) {
|
|
1167
1017
|
_context2.next = 23;
|
|
1168
1018
|
break;
|
|
1169
1019
|
}
|
|
@@ -1215,17 +1065,17 @@ function _isNetworkMatchedForTransaction() {
|
|
|
1215
1065
|
}));
|
|
1216
1066
|
return _isNetworkMatchedForTransaction.apply(this, arguments);
|
|
1217
1067
|
}
|
|
1218
|
-
var getCurrentAddressOf = function getCurrentAddressOf(swap, step) {
|
|
1219
|
-
var _step$evmTransaction, _step$evmApprovalTran, _step$cosmosTransacti, _step$solanaTransacti, _step$transferTransac, _step$transferTransac2;
|
|
1220
|
-
var result = swap.wallets[((_step$evmTransaction = step.evmTransaction) == null ? void 0 : _step$evmTransaction.blockChain) || ''] || swap.wallets[((_step$evmApprovalTran = step.evmApprovalTransaction) == null ? void 0 : _step$evmApprovalTran.blockChain) || ''] || swap.wallets[((_step$cosmosTransacti = step.cosmosTransaction) == null ? void 0 : _step$cosmosTransacti.blockChain) || ''] || swap.wallets[((_step$solanaTransacti = step.solanaTransaction) == null ? void 0 : _step$solanaTransacti.blockChain) || ''] || ((_step$transferTransac = step.transferTransaction) != null && _step$transferTransac.fromWalletAddress ? {
|
|
1068
|
+
var getCurrentAddressOf$1 = function getCurrentAddressOf(swap, step) {
|
|
1069
|
+
var _step$evmTransaction, _step$evmApprovalTran, _step$tronTransaction, _step$tronApprovalTra, _step$starknetTransac, _step$starknetApprova, _step$cosmosTransacti, _step$solanaTransacti, _step$transferTransac, _step$transferTransac2;
|
|
1070
|
+
var result = swap.wallets[((_step$evmTransaction = step.evmTransaction) == null ? void 0 : _step$evmTransaction.blockChain) || ''] || swap.wallets[((_step$evmApprovalTran = step.evmApprovalTransaction) == null ? void 0 : _step$evmApprovalTran.blockChain) || ''] || swap.wallets[((_step$tronTransaction = step.tronTransaction) == null ? void 0 : _step$tronTransaction.blockChain) || ''] || swap.wallets[((_step$tronApprovalTra = step.tronApprovalTransaction) == null ? void 0 : _step$tronApprovalTra.blockChain) || ''] || swap.wallets[((_step$starknetTransac = step.starknetTransaction) == null ? void 0 : _step$starknetTransac.blockChain) || ''] || swap.wallets[((_step$starknetApprova = step.starknetApprovalTransaction) == null ? void 0 : _step$starknetApprova.blockChain) || ''] || swap.wallets[((_step$cosmosTransacti = step.cosmosTransaction) == null ? void 0 : _step$cosmosTransacti.blockChain) || ''] || swap.wallets[((_step$solanaTransacti = step.solanaTransaction) == null ? void 0 : _step$solanaTransacti.blockChain) || ''] || ((_step$transferTransac = step.transferTransaction) != null && _step$transferTransac.fromWalletAddress ? {
|
|
1221
1071
|
address: (_step$transferTransac2 = step.transferTransaction) == null ? void 0 : _step$transferTransac2.fromWalletAddress
|
|
1222
1072
|
} : null) || null;
|
|
1223
1073
|
if (result == null) throw PrettyError.WalletMissing();
|
|
1224
1074
|
return result.address;
|
|
1225
1075
|
};
|
|
1226
1076
|
// Todo: Is it same with `getRequiredWallet`?
|
|
1227
|
-
function getRelatedWallet(swap, currentStep) {
|
|
1228
|
-
var walletAddress = getCurrentAddressOf(swap, currentStep);
|
|
1077
|
+
function getRelatedWallet$1(swap, currentStep) {
|
|
1078
|
+
var walletAddress = getCurrentAddressOf$1(swap, currentStep);
|
|
1229
1079
|
var walletKV = Object.keys(swap.wallets).map(function (k) {
|
|
1230
1080
|
return {
|
|
1231
1081
|
k: k,
|
|
@@ -1238,12 +1088,12 @@ function getRelatedWallet(swap, currentStep) {
|
|
|
1238
1088
|
var blockchain = (walletKV == null ? void 0 : walletKV.k) || null;
|
|
1239
1089
|
var wallet = (walletKV == null ? void 0 : walletKV.v) || null;
|
|
1240
1090
|
var walletType = wallet == null ? void 0 : wallet.walletType;
|
|
1241
|
-
if (walletType === walletsShared.WalletType.UNKNOWN || wallet === null) throw PrettyError.AssertionFailed("Wallet for source " + blockchain + " not passed
|
|
1091
|
+
if (walletType === walletsShared.WalletType.UNKNOWN || wallet === null) throw PrettyError.AssertionFailed("Wallet for source " + blockchain + " not passed: walletType: " + walletType);
|
|
1242
1092
|
return wallet;
|
|
1243
1093
|
}
|
|
1244
1094
|
var isTxAlreadyCreated = function isTxAlreadyCreated(swap, step) {
|
|
1245
|
-
var _step$evmTransaction2, _step$evmApprovalTran2, _step$cosmosTransacti2, _step$solanaTransacti2, _step$transferTransac3;
|
|
1246
|
-
var result = swap.wallets[((_step$evmTransaction2 = step.evmTransaction) == null ? void 0 : _step$evmTransaction2.blockChain) || ''] || swap.wallets[((_step$evmApprovalTran2 = step.evmApprovalTransaction) == null ? void 0 : _step$evmApprovalTran2.blockChain) || ''] || swap.wallets[((_step$cosmosTransacti2 = step.cosmosTransaction) == null ? void 0 : _step$cosmosTransacti2.blockChain) || ''] || swap.wallets[((_step$solanaTransacti2 = step.solanaTransaction) == null ? void 0 : _step$solanaTransacti2.blockChain) || ''] || ((_step$transferTransac3 = step.transferTransaction) == null ? void 0 : _step$transferTransac3.fromWalletAddress) || null;
|
|
1095
|
+
var _step$evmTransaction2, _step$evmApprovalTran2, _step$tronTransaction2, _step$tronApprovalTra2, _step$starknetTransac2, _step$starknetApprova2, _step$cosmosTransacti2, _step$solanaTransacti2, _step$transferTransac3;
|
|
1096
|
+
var result = swap.wallets[((_step$evmTransaction2 = step.evmTransaction) == null ? void 0 : _step$evmTransaction2.blockChain) || ''] || swap.wallets[((_step$evmApprovalTran2 = step.evmApprovalTransaction) == null ? void 0 : _step$evmApprovalTran2.blockChain) || ''] || swap.wallets[((_step$tronTransaction2 = step.tronTransaction) == null ? void 0 : _step$tronTransaction2.blockChain) || ''] || swap.wallets[((_step$tronApprovalTra2 = step.tronApprovalTransaction) == null ? void 0 : _step$tronApprovalTra2.blockChain) || ''] || swap.wallets[((_step$starknetTransac2 = step.starknetTransaction) == null ? void 0 : _step$starknetTransac2.blockChain) || ''] || swap.wallets[((_step$starknetApprova2 = step.starknetApprovalTransaction) == null ? void 0 : _step$starknetApprova2.blockChain) || ''] || swap.wallets[((_step$cosmosTransacti2 = step.cosmosTransaction) == null ? void 0 : _step$cosmosTransacti2.blockChain) || ''] || swap.wallets[((_step$solanaTransacti2 = step.solanaTransaction) == null ? void 0 : _step$solanaTransacti2.blockChain) || ''] || ((_step$transferTransac3 = step.transferTransaction) == null ? void 0 : _step$transferTransac3.fromWalletAddress) || null;
|
|
1247
1097
|
return result !== null;
|
|
1248
1098
|
};
|
|
1249
1099
|
function resetNetworkStatus(actions) {
|
|
@@ -1440,8 +1290,13 @@ function singTransaction(actions) {
|
|
|
1440
1290
|
evmApprovalTransaction = currentStep.evmApprovalTransaction,
|
|
1441
1291
|
cosmosTransaction = currentStep.cosmosTransaction,
|
|
1442
1292
|
solanaTransaction = currentStep.solanaTransaction,
|
|
1443
|
-
transferTransaction = currentStep.transferTransaction
|
|
1444
|
-
|
|
1293
|
+
transferTransaction = currentStep.transferTransaction,
|
|
1294
|
+
tronTransaction = currentStep.tronTransaction,
|
|
1295
|
+
tronApprovalTransaction = currentStep.tronApprovalTransaction,
|
|
1296
|
+
starknetTransaction = currentStep.starknetTransaction,
|
|
1297
|
+
starknetApprovalTransaction = currentStep.starknetApprovalTransaction;
|
|
1298
|
+
var sourceWallet = getRelatedWallet$1(swap, currentStep);
|
|
1299
|
+
var walletAddress = getCurrentAddressOf$1(swap, currentStep);
|
|
1445
1300
|
var walletSigners = getSigners(sourceWallet.walletType);
|
|
1446
1301
|
var onFinish = function onFinish() {
|
|
1447
1302
|
if (actions.context.resetClaimedBy) {
|
|
@@ -1464,7 +1319,7 @@ function singTransaction(actions) {
|
|
|
1464
1319
|
eventType: 'confirm_contract'
|
|
1465
1320
|
}, updateResult));
|
|
1466
1321
|
// Execute transaction
|
|
1467
|
-
walletSigners.
|
|
1322
|
+
walletSigners.getSigner(rangoSdk.TransactionType.EVM).signAndSendTx(evmApprovalTransaction, walletAddress, null).then(function (hash) {
|
|
1468
1323
|
console.debug('transaction of approval minted successfully', hash);
|
|
1469
1324
|
var approveUrl = getEvmApproveUrl(hash, getCurrentBlockchainOf(swap, currentStep), meta.evmBasedChains);
|
|
1470
1325
|
currentStep.explorerUrl = [].concat(currentStep.explorerUrl || [], [{
|
|
@@ -1505,11 +1360,121 @@ function singTransaction(actions) {
|
|
|
1505
1360
|
onFinish();
|
|
1506
1361
|
});
|
|
1507
1362
|
return;
|
|
1363
|
+
} else if (!!tronApprovalTransaction) {
|
|
1364
|
+
// Update swap status
|
|
1365
|
+
var _message = "waiting for approval of " + (currentStep == null ? void 0 : currentStep.fromSymbol) + " coin " + (sourceWallet.walletType === walletsShared.WalletType.WALLET_CONNECT ? 'on your mobile phone' : '');
|
|
1366
|
+
var _updateResult = updateSwapStatus({
|
|
1367
|
+
getStorage: getStorage,
|
|
1368
|
+
setStorage: setStorage,
|
|
1369
|
+
nextStepStatus: 'waitingForApproval',
|
|
1370
|
+
message: _message,
|
|
1371
|
+
details: 'Waiting for approve transaction to be mined and confirmed successfully'
|
|
1372
|
+
});
|
|
1373
|
+
notifier(_extends({
|
|
1374
|
+
eventType: 'confirm_contract'
|
|
1375
|
+
}, _updateResult));
|
|
1376
|
+
// Execute transaction
|
|
1377
|
+
walletSigners.getSigner(rangoSdk.TransactionType.TRON).signAndSendTx(tronApprovalTransaction, walletAddress, null).then(function (hash) {
|
|
1378
|
+
console.debug('transaction of approval minted successfully', hash);
|
|
1379
|
+
var approveUrl = getTronApproveUrl(hash);
|
|
1380
|
+
currentStep.explorerUrl = [].concat(currentStep.explorerUrl || [], [{
|
|
1381
|
+
url: approveUrl,
|
|
1382
|
+
description: "approve"
|
|
1383
|
+
}]);
|
|
1384
|
+
// `currentStep` has been mutated, let's update storage.
|
|
1385
|
+
setStorage(_extends({}, getStorage(), {
|
|
1386
|
+
swapDetails: swap
|
|
1387
|
+
}));
|
|
1388
|
+
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
1389
|
+
next();
|
|
1390
|
+
onFinish();
|
|
1391
|
+
}, function (error) {
|
|
1392
|
+
var _error$root4, _error$root5, _error$root6;
|
|
1393
|
+
if (swap.status === 'failed') return;
|
|
1394
|
+
console.debug('error in approving', error);
|
|
1395
|
+
var _prettifyErrorMessage2 = prettifyErrorMessage(error),
|
|
1396
|
+
extraMessage = _prettifyErrorMessage2.extraMessage,
|
|
1397
|
+
extraMessageDetail = _prettifyErrorMessage2.extraMessageDetail,
|
|
1398
|
+
extraMessageErrorCode = _prettifyErrorMessage2.extraMessageErrorCode;
|
|
1399
|
+
if (error && error != null && error.root && error != null && (_error$root4 = error.root) != null && _error$root4.message && error != null && (_error$root5 = error.root) != null && _error$root5.code && error != null && (_error$root6 = error.root) != null && _error$root6.reason) {
|
|
1400
|
+
logRPCError(error.root, swap, currentStep, sourceWallet == null ? void 0 : sourceWallet.walletType);
|
|
1401
|
+
}
|
|
1402
|
+
var updateResult = updateSwapStatus({
|
|
1403
|
+
getStorage: getStorage,
|
|
1404
|
+
setStorage: setStorage,
|
|
1405
|
+
nextStatus: 'failed',
|
|
1406
|
+
nextStepStatus: 'failed',
|
|
1407
|
+
message: extraMessage,
|
|
1408
|
+
details: extraMessageDetail,
|
|
1409
|
+
errorCode: extraMessageErrorCode
|
|
1410
|
+
});
|
|
1411
|
+
notifier(_extends({
|
|
1412
|
+
eventType: 'contract_rejected'
|
|
1413
|
+
}, updateResult));
|
|
1414
|
+
failed();
|
|
1415
|
+
onFinish();
|
|
1416
|
+
});
|
|
1417
|
+
return;
|
|
1418
|
+
} else if (!!starknetApprovalTransaction) {
|
|
1419
|
+
// Update swap status
|
|
1420
|
+
var _message2 = "waiting for approval of " + (currentStep == null ? void 0 : currentStep.fromSymbol) + " coin " + (sourceWallet.walletType === walletsShared.WalletType.WALLET_CONNECT ? 'on your mobile phone' : '');
|
|
1421
|
+
var _updateResult2 = updateSwapStatus({
|
|
1422
|
+
getStorage: getStorage,
|
|
1423
|
+
setStorage: setStorage,
|
|
1424
|
+
nextStepStatus: 'waitingForApproval',
|
|
1425
|
+
message: _message2,
|
|
1426
|
+
details: 'Waiting for approve transaction to be mined and confirmed successfully'
|
|
1427
|
+
});
|
|
1428
|
+
notifier(_extends({
|
|
1429
|
+
eventType: 'confirm_contract'
|
|
1430
|
+
}, _updateResult2));
|
|
1431
|
+
// Execute transaction
|
|
1432
|
+
walletSigners.getSigner(rangoSdk.TransactionType.STARKNET).signAndSendTx(starknetApprovalTransaction, walletAddress, null).then(function (hash) {
|
|
1433
|
+
console.debug('transaction of approval minted successfully', hash);
|
|
1434
|
+
var approveUrl = getStarknetApproveUrl(hash);
|
|
1435
|
+
currentStep.explorerUrl = [].concat(currentStep.explorerUrl || [], [{
|
|
1436
|
+
url: approveUrl,
|
|
1437
|
+
description: "approve"
|
|
1438
|
+
}]);
|
|
1439
|
+
// `currentStep` has been mutated, let's update storage.
|
|
1440
|
+
setStorage(_extends({}, getStorage(), {
|
|
1441
|
+
swapDetails: swap
|
|
1442
|
+
}));
|
|
1443
|
+
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
1444
|
+
next();
|
|
1445
|
+
onFinish();
|
|
1446
|
+
}, function (error) {
|
|
1447
|
+
var _error$root7, _error$root8, _error$root9;
|
|
1448
|
+
if (swap.status === 'failed') return;
|
|
1449
|
+
console.debug('error in approving', error);
|
|
1450
|
+
var _prettifyErrorMessage3 = prettifyErrorMessage(error),
|
|
1451
|
+
extraMessage = _prettifyErrorMessage3.extraMessage,
|
|
1452
|
+
extraMessageDetail = _prettifyErrorMessage3.extraMessageDetail,
|
|
1453
|
+
extraMessageErrorCode = _prettifyErrorMessage3.extraMessageErrorCode;
|
|
1454
|
+
if (error && error != null && error.root && error != null && (_error$root7 = error.root) != null && _error$root7.message && error != null && (_error$root8 = error.root) != null && _error$root8.code && error != null && (_error$root9 = error.root) != null && _error$root9.reason) {
|
|
1455
|
+
logRPCError(error.root, swap, currentStep, sourceWallet == null ? void 0 : sourceWallet.walletType);
|
|
1456
|
+
}
|
|
1457
|
+
var updateResult = updateSwapStatus({
|
|
1458
|
+
getStorage: getStorage,
|
|
1459
|
+
setStorage: setStorage,
|
|
1460
|
+
nextStatus: 'failed',
|
|
1461
|
+
nextStepStatus: 'failed',
|
|
1462
|
+
message: extraMessage,
|
|
1463
|
+
details: extraMessageDetail,
|
|
1464
|
+
errorCode: extraMessageErrorCode
|
|
1465
|
+
});
|
|
1466
|
+
notifier(_extends({
|
|
1467
|
+
eventType: 'contract_rejected'
|
|
1468
|
+
}, updateResult));
|
|
1469
|
+
failed();
|
|
1470
|
+
onFinish();
|
|
1471
|
+
});
|
|
1472
|
+
return;
|
|
1508
1473
|
}
|
|
1509
1474
|
var executeMessage = 'executing transaction';
|
|
1510
1475
|
var executeDetails = "" + (sourceWallet.walletType === walletsShared.WalletType.WALLET_CONNECT ? 'Check your mobile phone' : '');
|
|
1511
1476
|
if (!!transferTransaction) {
|
|
1512
|
-
var
|
|
1477
|
+
var _updateResult3 = updateSwapStatus({
|
|
1513
1478
|
getStorage: getStorage,
|
|
1514
1479
|
setStorage: setStorage,
|
|
1515
1480
|
nextStepStatus: 'running',
|
|
@@ -1518,18 +1483,18 @@ function singTransaction(actions) {
|
|
|
1518
1483
|
});
|
|
1519
1484
|
notifier(_extends({
|
|
1520
1485
|
eventType: 'confirm_transfer'
|
|
1521
|
-
},
|
|
1522
|
-
walletSigners.
|
|
1486
|
+
}, _updateResult3));
|
|
1487
|
+
walletSigners.getSigner(rangoSdk.TransactionType.TRANSFER).signAndSendTx(transferTransaction, walletAddress, null).then(function (txId) {
|
|
1523
1488
|
setStepTransactionIds(actions, txId, 'transfer_confirmed', notifier);
|
|
1524
1489
|
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
1525
1490
|
next();
|
|
1526
1491
|
onFinish();
|
|
1527
1492
|
}, function (error) {
|
|
1528
1493
|
if (swap.status === 'failed') return;
|
|
1529
|
-
var
|
|
1530
|
-
extraMessage =
|
|
1531
|
-
extraMessageDetail =
|
|
1532
|
-
extraMessageErrorCode =
|
|
1494
|
+
var _prettifyErrorMessage4 = prettifyErrorMessage(error),
|
|
1495
|
+
extraMessage = _prettifyErrorMessage4.extraMessage,
|
|
1496
|
+
extraMessageDetail = _prettifyErrorMessage4.extraMessageDetail,
|
|
1497
|
+
extraMessageErrorCode = _prettifyErrorMessage4.extraMessageErrorCode;
|
|
1533
1498
|
var updateResult = updateSwapStatus({
|
|
1534
1499
|
getStorage: getStorage,
|
|
1535
1500
|
setStorage: setStorage,
|
|
@@ -1546,7 +1511,7 @@ function singTransaction(actions) {
|
|
|
1546
1511
|
onFinish();
|
|
1547
1512
|
});
|
|
1548
1513
|
} else if (!!evmTransaction) {
|
|
1549
|
-
var
|
|
1514
|
+
var _updateResult4 = updateSwapStatus({
|
|
1550
1515
|
getStorage: getStorage,
|
|
1551
1516
|
setStorage: setStorage,
|
|
1552
1517
|
nextStepStatus: 'running',
|
|
@@ -1555,20 +1520,20 @@ function singTransaction(actions) {
|
|
|
1555
1520
|
});
|
|
1556
1521
|
notifier(_extends({
|
|
1557
1522
|
eventType: 'calling_smart_contract'
|
|
1558
|
-
},
|
|
1559
|
-
walletSigners.
|
|
1523
|
+
}, _updateResult4));
|
|
1524
|
+
walletSigners.getSigner(rangoSdk.TransactionType.EVM).signAndSendTx(evmTransaction, walletAddress, null).then(function (id) {
|
|
1560
1525
|
setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
|
|
1561
1526
|
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
1562
1527
|
next();
|
|
1563
1528
|
onFinish();
|
|
1564
1529
|
}, function (error) {
|
|
1565
|
-
var _error$
|
|
1530
|
+
var _error$root10, _error$root11, _error$root12;
|
|
1566
1531
|
if (swap.status === 'failed') return;
|
|
1567
|
-
var
|
|
1568
|
-
extraMessage =
|
|
1569
|
-
extraMessageDetail =
|
|
1570
|
-
extraMessageErrorCode =
|
|
1571
|
-
if (error && error != null && error.root && error != null && (_error$
|
|
1532
|
+
var _prettifyErrorMessage5 = prettifyErrorMessage(error),
|
|
1533
|
+
extraMessage = _prettifyErrorMessage5.extraMessage,
|
|
1534
|
+
extraMessageDetail = _prettifyErrorMessage5.extraMessageDetail,
|
|
1535
|
+
extraMessageErrorCode = _prettifyErrorMessage5.extraMessageErrorCode;
|
|
1536
|
+
if (error && error != null && error.root && error != null && (_error$root10 = error.root) != null && _error$root10.message && error != null && (_error$root11 = error.root) != null && _error$root11.code && error != null && (_error$root12 = error.root) != null && _error$root12.reason) {
|
|
1572
1537
|
logRPCError(error.root, swap, currentStep, sourceWallet == null ? void 0 : sourceWallet.walletType);
|
|
1573
1538
|
}
|
|
1574
1539
|
var updateResult = updateSwapStatus({
|
|
@@ -1587,7 +1552,7 @@ function singTransaction(actions) {
|
|
|
1587
1552
|
onFinish();
|
|
1588
1553
|
});
|
|
1589
1554
|
} else if (!!cosmosTransaction) {
|
|
1590
|
-
var
|
|
1555
|
+
var _updateResult5 = updateSwapStatus({
|
|
1591
1556
|
getStorage: getStorage,
|
|
1592
1557
|
setStorage: setStorage,
|
|
1593
1558
|
nextStepStatus: 'running',
|
|
@@ -1596,16 +1561,16 @@ function singTransaction(actions) {
|
|
|
1596
1561
|
});
|
|
1597
1562
|
notifier(_extends({
|
|
1598
1563
|
eventType: 'calling_smart_contract'
|
|
1599
|
-
},
|
|
1564
|
+
}, _updateResult5));
|
|
1600
1565
|
// If keplr wallet is executing contracts on terra, throw error. keplr doesn't support transfer or execute contracts. only IBC messages are supported
|
|
1601
1566
|
if (((currentStep == null ? void 0 : currentStep.swapperId.toString()) === 'TerraSwap' || (currentStep == null ? void 0 : currentStep.swapperId.toString()) === 'ThorChain' && (currentStep == null ? void 0 : currentStep.fromBlockchain) === walletsShared.Network.TERRA || (currentStep == null ? void 0 : currentStep.swapperId.toString()) === 'Terra Bridge' && currentStep.fromBlockchain === walletsShared.Network.TERRA) &&
|
|
1602
1567
|
// here we must allow ibc on terrastatus
|
|
1603
1568
|
sourceWallet.walletType === walletsShared.WalletType.KEPLR) {
|
|
1604
|
-
var
|
|
1605
|
-
extraMessage =
|
|
1606
|
-
extraMessageDetail =
|
|
1607
|
-
extraMessageErrorCode =
|
|
1608
|
-
var
|
|
1569
|
+
var _prettifyErrorMessage6 = prettifyErrorMessage('Keplr only supports IBC Transactions on Terra. ' + 'Using Terra Bridge, TerraSwap and THORChain is not possible with Keplr. Please use TerraStation or Leap wallet'),
|
|
1570
|
+
extraMessage = _prettifyErrorMessage6.extraMessage,
|
|
1571
|
+
extraMessageDetail = _prettifyErrorMessage6.extraMessageDetail,
|
|
1572
|
+
extraMessageErrorCode = _prettifyErrorMessage6.extraMessageErrorCode;
|
|
1573
|
+
var _updateResult6 = updateSwapStatus({
|
|
1609
1574
|
getStorage: getStorage,
|
|
1610
1575
|
setStorage: setStorage,
|
|
1611
1576
|
nextStatus: 'failed',
|
|
@@ -1616,12 +1581,12 @@ function singTransaction(actions) {
|
|
|
1616
1581
|
});
|
|
1617
1582
|
notifier(_extends({
|
|
1618
1583
|
eventType: 'smart_contract_call_failed'
|
|
1619
|
-
},
|
|
1584
|
+
}, _updateResult6));
|
|
1620
1585
|
failed();
|
|
1621
1586
|
onFinish();
|
|
1622
1587
|
return;
|
|
1623
1588
|
}
|
|
1624
|
-
walletSigners.
|
|
1589
|
+
walletSigners.getSigner(rangoSdk.TransactionType.COSMOS).signAndSendTx(cosmosTransaction, walletAddress, null).then(
|
|
1625
1590
|
// todo
|
|
1626
1591
|
function (id) {
|
|
1627
1592
|
setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
|
|
@@ -1630,10 +1595,10 @@ function singTransaction(actions) {
|
|
|
1630
1595
|
onFinish();
|
|
1631
1596
|
}, function (error) {
|
|
1632
1597
|
if (swap.status === 'failed') return;
|
|
1633
|
-
var
|
|
1634
|
-
extraMessage =
|
|
1635
|
-
extraMessageDetail =
|
|
1636
|
-
extraMessageErrorCode =
|
|
1598
|
+
var _prettifyErrorMessage7 = prettifyErrorMessage(error),
|
|
1599
|
+
extraMessage = _prettifyErrorMessage7.extraMessage,
|
|
1600
|
+
extraMessageDetail = _prettifyErrorMessage7.extraMessageDetail,
|
|
1601
|
+
extraMessageErrorCode = _prettifyErrorMessage7.extraMessageErrorCode;
|
|
1637
1602
|
var updateResult = updateSwapStatus({
|
|
1638
1603
|
getStorage: getStorage,
|
|
1639
1604
|
setStorage: setStorage,
|
|
@@ -1650,7 +1615,7 @@ function singTransaction(actions) {
|
|
|
1650
1615
|
onFinish();
|
|
1651
1616
|
});
|
|
1652
1617
|
} else if (!!solanaTransaction) {
|
|
1653
|
-
var
|
|
1618
|
+
var _updateResult7 = updateSwapStatus({
|
|
1654
1619
|
getStorage: getStorage,
|
|
1655
1620
|
setStorage: setStorage,
|
|
1656
1621
|
nextStepStatus: 'running',
|
|
@@ -1659,19 +1624,101 @@ function singTransaction(actions) {
|
|
|
1659
1624
|
});
|
|
1660
1625
|
notifier(_extends({
|
|
1661
1626
|
eventType: 'calling_smart_contract'
|
|
1662
|
-
},
|
|
1627
|
+
}, _updateResult7));
|
|
1663
1628
|
var tx = solanaTransaction;
|
|
1664
|
-
walletSigners.
|
|
1629
|
+
walletSigners.getSigner(rangoSdk.TransactionType.SOLANA).signAndSendTx(tx, walletAddress, null).then(function (txId) {
|
|
1665
1630
|
setStepTransactionIds(actions, txId, 'smart_contract_called', notifier);
|
|
1666
1631
|
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
1667
1632
|
next();
|
|
1668
1633
|
onFinish();
|
|
1669
1634
|
}, function (error) {
|
|
1670
1635
|
if (swap.status === 'failed') return;
|
|
1671
|
-
var
|
|
1672
|
-
extraMessage =
|
|
1673
|
-
extraMessageDetail =
|
|
1674
|
-
extraMessageErrorCode =
|
|
1636
|
+
var _prettifyErrorMessage8 = prettifyErrorMessage(error),
|
|
1637
|
+
extraMessage = _prettifyErrorMessage8.extraMessage,
|
|
1638
|
+
extraMessageDetail = _prettifyErrorMessage8.extraMessageDetail,
|
|
1639
|
+
extraMessageErrorCode = _prettifyErrorMessage8.extraMessageErrorCode;
|
|
1640
|
+
var updateResult = updateSwapStatus({
|
|
1641
|
+
getStorage: getStorage,
|
|
1642
|
+
setStorage: setStorage,
|
|
1643
|
+
nextStatus: 'failed',
|
|
1644
|
+
nextStepStatus: 'failed',
|
|
1645
|
+
message: extraMessage,
|
|
1646
|
+
details: extraMessageDetail,
|
|
1647
|
+
errorCode: extraMessageErrorCode
|
|
1648
|
+
});
|
|
1649
|
+
notifier(_extends({
|
|
1650
|
+
eventType: 'smart_contract_call_failed'
|
|
1651
|
+
}, updateResult));
|
|
1652
|
+
failed();
|
|
1653
|
+
onFinish();
|
|
1654
|
+
});
|
|
1655
|
+
} else if (!!tronTransaction) {
|
|
1656
|
+
var _updateResult8 = updateSwapStatus({
|
|
1657
|
+
getStorage: getStorage,
|
|
1658
|
+
setStorage: setStorage,
|
|
1659
|
+
nextStepStatus: 'running',
|
|
1660
|
+
message: executeMessage,
|
|
1661
|
+
details: executeDetails
|
|
1662
|
+
});
|
|
1663
|
+
notifier(_extends({
|
|
1664
|
+
eventType: 'calling_smart_contract'
|
|
1665
|
+
}, _updateResult8));
|
|
1666
|
+
walletSigners.getSigner(rangoSdk.TransactionType.TRON).signAndSendTx(tronTransaction, walletAddress, null).then(function (id) {
|
|
1667
|
+
setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
|
|
1668
|
+
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
1669
|
+
next();
|
|
1670
|
+
onFinish();
|
|
1671
|
+
}, function (error) {
|
|
1672
|
+
var _error$root13, _error$root14, _error$root15;
|
|
1673
|
+
if (swap.status === 'failed') return;
|
|
1674
|
+
var _prettifyErrorMessage9 = prettifyErrorMessage(error),
|
|
1675
|
+
extraMessage = _prettifyErrorMessage9.extraMessage,
|
|
1676
|
+
extraMessageDetail = _prettifyErrorMessage9.extraMessageDetail,
|
|
1677
|
+
extraMessageErrorCode = _prettifyErrorMessage9.extraMessageErrorCode;
|
|
1678
|
+
if (error && error != null && error.root && error != null && (_error$root13 = error.root) != null && _error$root13.message && error != null && (_error$root14 = error.root) != null && _error$root14.code && error != null && (_error$root15 = error.root) != null && _error$root15.reason) {
|
|
1679
|
+
logRPCError(error.root, swap, currentStep, sourceWallet == null ? void 0 : sourceWallet.walletType);
|
|
1680
|
+
}
|
|
1681
|
+
var updateResult = updateSwapStatus({
|
|
1682
|
+
getStorage: getStorage,
|
|
1683
|
+
setStorage: setStorage,
|
|
1684
|
+
nextStatus: 'failed',
|
|
1685
|
+
nextStepStatus: 'failed',
|
|
1686
|
+
message: extraMessage,
|
|
1687
|
+
details: extraMessageDetail,
|
|
1688
|
+
errorCode: extraMessageErrorCode
|
|
1689
|
+
});
|
|
1690
|
+
notifier(_extends({
|
|
1691
|
+
eventType: 'smart_contract_call_failed'
|
|
1692
|
+
}, updateResult));
|
|
1693
|
+
failed();
|
|
1694
|
+
onFinish();
|
|
1695
|
+
});
|
|
1696
|
+
} else if (!!starknetTransaction) {
|
|
1697
|
+
var _updateResult9 = updateSwapStatus({
|
|
1698
|
+
getStorage: getStorage,
|
|
1699
|
+
setStorage: setStorage,
|
|
1700
|
+
nextStepStatus: 'running',
|
|
1701
|
+
message: executeMessage,
|
|
1702
|
+
details: executeDetails
|
|
1703
|
+
});
|
|
1704
|
+
notifier(_extends({
|
|
1705
|
+
eventType: 'calling_smart_contract'
|
|
1706
|
+
}, _updateResult9));
|
|
1707
|
+
walletSigners.getSigner(rangoSdk.TransactionType.STARKNET).signAndSendTx(starknetTransaction, walletAddress, null).then(function (id) {
|
|
1708
|
+
setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
|
|
1709
|
+
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
1710
|
+
next();
|
|
1711
|
+
onFinish();
|
|
1712
|
+
}, function (error) {
|
|
1713
|
+
var _error$root16, _error$root17, _error$root18;
|
|
1714
|
+
if (swap.status === 'failed') return;
|
|
1715
|
+
var _prettifyErrorMessage10 = prettifyErrorMessage(error),
|
|
1716
|
+
extraMessage = _prettifyErrorMessage10.extraMessage,
|
|
1717
|
+
extraMessageDetail = _prettifyErrorMessage10.extraMessageDetail,
|
|
1718
|
+
extraMessageErrorCode = _prettifyErrorMessage10.extraMessageErrorCode;
|
|
1719
|
+
if (error && error != null && error.root && error != null && (_error$root16 = error.root) != null && _error$root16.message && error != null && (_error$root17 = error.root) != null && _error$root17.code && error != null && (_error$root18 = error.root) != null && _error$root18.reason) {
|
|
1720
|
+
logRPCError(error.root, swap, currentStep, sourceWallet == null ? void 0 : sourceWallet.walletType);
|
|
1721
|
+
}
|
|
1675
1722
|
var updateResult = updateSwapStatus({
|
|
1676
1723
|
getStorage: getStorage,
|
|
1677
1724
|
setStorage: setStorage,
|
|
@@ -1785,7 +1832,11 @@ function _checkTransactionStatus() {
|
|
|
1785
1832
|
status = null;
|
|
1786
1833
|
_context.prev = 5;
|
|
1787
1834
|
_context.next = 8;
|
|
1788
|
-
return
|
|
1835
|
+
return httpService.checkStatus({
|
|
1836
|
+
requestId: swap.requestId,
|
|
1837
|
+
txId: txId,
|
|
1838
|
+
step: currentStep.id
|
|
1839
|
+
});
|
|
1789
1840
|
case 8:
|
|
1790
1841
|
status = _context.sent;
|
|
1791
1842
|
_context.next = 17;
|
|
@@ -1799,14 +1850,14 @@ function _checkTransactionStatus() {
|
|
|
1799
1850
|
retry();
|
|
1800
1851
|
return _context.abrupt("return");
|
|
1801
1852
|
case 17:
|
|
1802
|
-
outputAmount = ((_status = status) == null ? void 0 : _status.outputAmount) || (!!currentStep.outputAmount ?
|
|
1853
|
+
outputAmount = ((_status = status) == null ? void 0 : _status.outputAmount) || (!!currentStep.outputAmount ? currentStep.outputAmount : null);
|
|
1803
1854
|
prevOutputAmount = currentStep.outputAmount;
|
|
1804
1855
|
swap.extraMessage = ((_status2 = status) == null ? void 0 : _status2.extraMessage) || swap.extraMessage;
|
|
1805
1856
|
swap.extraMessageSeverity = MessageSeverity.info;
|
|
1806
1857
|
swap.extraMessageDetail = '';
|
|
1807
1858
|
currentStep.status = ((_status3 = status) == null ? void 0 : _status3.status) || currentStep.status;
|
|
1808
1859
|
currentStep.diagnosisUrl = ((_status4 = status) == null ? void 0 : _status4.diagnosisUrl) || currentStep.diagnosisUrl || null;
|
|
1809
|
-
currentStep.outputAmount =
|
|
1860
|
+
currentStep.outputAmount = outputAmount || currentStep.outputAmount;
|
|
1810
1861
|
currentStep.explorerUrl = ((_status5 = status) == null ? void 0 : _status5.explorerUrl) || currentStep.explorerUrl;
|
|
1811
1862
|
currentStep.internalSteps = ((_status6 = status) == null ? void 0 : _status6.steps) || null;
|
|
1812
1863
|
newTransaction = (_status7 = status) == null ? void 0 : _status7.newTx;
|
|
@@ -1894,19 +1945,20 @@ function _checkApprovalStatus() {
|
|
|
1894
1945
|
isApproved = false;
|
|
1895
1946
|
_context2.prev = 4;
|
|
1896
1947
|
_context2.next = 7;
|
|
1897
|
-
return
|
|
1948
|
+
return httpService.checkApproval(swap.requestId);
|
|
1898
1949
|
case 7:
|
|
1899
1950
|
response = _context2.sent;
|
|
1900
1951
|
isApproved = response.isApproved;
|
|
1901
|
-
_context2.next =
|
|
1952
|
+
_context2.next = 15;
|
|
1902
1953
|
break;
|
|
1903
1954
|
case 11:
|
|
1904
1955
|
_context2.prev = 11;
|
|
1905
1956
|
_context2.t0 = _context2["catch"](4);
|
|
1906
1957
|
console.error('Failed to check getApprovedAmount', _context2.t0);
|
|
1907
|
-
|
|
1958
|
+
isApproved = false;
|
|
1959
|
+
case 15:
|
|
1908
1960
|
if (!isApproved) {
|
|
1909
|
-
_context2.next =
|
|
1961
|
+
_context2.next = 28;
|
|
1910
1962
|
break;
|
|
1911
1963
|
}
|
|
1912
1964
|
currentStep.status = 'approved';
|
|
@@ -1925,14 +1977,14 @@ function _checkApprovalStatus() {
|
|
|
1925
1977
|
});
|
|
1926
1978
|
schedule(SwapActionTypes.SCHEDULE_NEXT_STEP);
|
|
1927
1979
|
next();
|
|
1928
|
-
_context2.next =
|
|
1980
|
+
_context2.next = 31;
|
|
1929
1981
|
break;
|
|
1930
|
-
case
|
|
1931
|
-
_context2.next =
|
|
1982
|
+
case 28:
|
|
1983
|
+
_context2.next = 30;
|
|
1932
1984
|
return delay(2000);
|
|
1933
|
-
case 29:
|
|
1934
|
-
retry();
|
|
1935
1985
|
case 30:
|
|
1986
|
+
retry();
|
|
1987
|
+
case 31:
|
|
1936
1988
|
case "end":
|
|
1937
1989
|
return _context2.stop();
|
|
1938
1990
|
}
|
|
@@ -1985,20 +2037,20 @@ function _checkStatus() {
|
|
|
1985
2037
|
* It can be failed if server goes through an error, If not, we will schedule the `EXECTUTE_TRANSACTION`.
|
|
1986
2038
|
*
|
|
1987
2039
|
*/
|
|
1988
|
-
function createTransaction
|
|
1989
|
-
return _createTransaction
|
|
2040
|
+
function createTransaction(_x) {
|
|
2041
|
+
return _createTransaction.apply(this, arguments);
|
|
1990
2042
|
}
|
|
1991
|
-
function _createTransaction
|
|
1992
|
-
_createTransaction
|
|
1993
|
-
var setStorage, getStorage, next, schedule, context, swap, currentStep, evmTransaction, cosmosTransaction, transferTransaction, evmApprovalTransaction, solanaTransaction, request, _yield$
|
|
2043
|
+
function _createTransaction() {
|
|
2044
|
+
_createTransaction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(actions) {
|
|
2045
|
+
var setStorage, getStorage, next, schedule, context, swap, currentStep, evmTransaction, cosmosTransaction, transferTransaction, evmApprovalTransaction, solanaTransaction, tronTransaction, tronApprovalTransaction, starknetTransaction, starknetApprovalTransaction, request, _yield$httpService$cr, transaction, _prettifyErrorMessage, extraMessage, extraMessageDetail, updateResult;
|
|
1994
2046
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1995
2047
|
while (1) switch (_context.prev = _context.next) {
|
|
1996
2048
|
case 0:
|
|
1997
2049
|
setStorage = actions.setStorage, getStorage = actions.getStorage, next = actions.next, schedule = actions.schedule, context = actions.context;
|
|
1998
2050
|
swap = getStorage().swapDetails; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1999
2051
|
currentStep = getCurrentStep(swap);
|
|
2000
|
-
evmTransaction = currentStep.evmTransaction, cosmosTransaction = currentStep.cosmosTransaction, transferTransaction = currentStep.transferTransaction, evmApprovalTransaction = currentStep.evmApprovalTransaction, solanaTransaction = currentStep.solanaTransaction;
|
|
2001
|
-
if (!(!evmTransaction && !
|
|
2052
|
+
evmTransaction = currentStep.evmTransaction, cosmosTransaction = currentStep.cosmosTransaction, transferTransaction = currentStep.transferTransaction, evmApprovalTransaction = currentStep.evmApprovalTransaction, solanaTransaction = currentStep.solanaTransaction, tronTransaction = currentStep.tronTransaction, tronApprovalTransaction = currentStep.tronApprovalTransaction, starknetTransaction = currentStep.starknetTransaction, starknetApprovalTransaction = currentStep.starknetApprovalTransaction;
|
|
2053
|
+
if (!(!evmTransaction && !evmApprovalTransaction && !tronTransaction && !tronApprovalTransaction && !starknetTransaction && !starknetApprovalTransaction && !cosmosTransaction && !transferTransaction && !solanaTransaction)) {
|
|
2002
2054
|
_context.next = 25;
|
|
2003
2055
|
break;
|
|
2004
2056
|
}
|
|
@@ -2016,10 +2068,10 @@ function _createTransaction$1() {
|
|
|
2016
2068
|
};
|
|
2017
2069
|
_context.prev = 6;
|
|
2018
2070
|
_context.next = 9;
|
|
2019
|
-
return createTransaction(request);
|
|
2071
|
+
return httpService.createTransaction(request);
|
|
2020
2072
|
case 9:
|
|
2021
|
-
_yield$
|
|
2022
|
-
transaction = _yield$
|
|
2073
|
+
_yield$httpService$cr = _context.sent;
|
|
2074
|
+
transaction = _yield$httpService$cr.transaction;
|
|
2023
2075
|
if (transaction) {
|
|
2024
2076
|
if (isEvmTransaction(transaction)) {
|
|
2025
2077
|
if (transaction.isApprovalTx) currentStep.evmApprovalTransaction = transaction;else currentStep.evmTransaction = transaction;
|
|
@@ -2029,6 +2081,10 @@ function _createTransaction$1() {
|
|
|
2029
2081
|
currentStep.solanaTransaction = transaction;
|
|
2030
2082
|
} else if (isTrasnferTransaction(transaction)) {
|
|
2031
2083
|
currentStep.transferTransaction = transaction;
|
|
2084
|
+
} else if (isStarknetTransaction(transaction)) {
|
|
2085
|
+
if (transaction.isApprovalTx) currentStep.starknetApprovalTransaction = transaction;else currentStep.starknetTransaction = transaction;
|
|
2086
|
+
} else if (isTronTransaction(transaction)) {
|
|
2087
|
+
if (transaction.isApprovalTx) currentStep.tronApprovalTransaction = transaction;else currentStep.tronTransaction = transaction;
|
|
2032
2088
|
}
|
|
2033
2089
|
}
|
|
2034
2090
|
setStorage(_extends({}, getStorage(), {
|
|
@@ -2063,7 +2119,7 @@ function _createTransaction$1() {
|
|
|
2063
2119
|
}
|
|
2064
2120
|
}, _callee, null, [[6, 17]]);
|
|
2065
2121
|
}));
|
|
2066
|
-
return _createTransaction
|
|
2122
|
+
return _createTransaction.apply(this, arguments);
|
|
2067
2123
|
}
|
|
2068
2124
|
|
|
2069
2125
|
/**
|
|
@@ -2232,7 +2288,7 @@ var _actions;
|
|
|
2232
2288
|
*/
|
|
2233
2289
|
var swapQueueDef = {
|
|
2234
2290
|
name: 'swap',
|
|
2235
|
-
actions: (_actions = {}, _actions[SwapActionTypes.START] = start, _actions[SwapActionTypes.SCHEDULE_NEXT_STEP] = scheduleNextStep, _actions[SwapActionTypes.CREATE_TRANSACTION] = createTransaction
|
|
2291
|
+
actions: (_actions = {}, _actions[SwapActionTypes.START] = start, _actions[SwapActionTypes.SCHEDULE_NEXT_STEP] = scheduleNextStep, _actions[SwapActionTypes.CREATE_TRANSACTION] = createTransaction, _actions[SwapActionTypes.EXECUTE_TRANSACTION] = executeTransaction, _actions[SwapActionTypes.CHECK_TRANSACTION_STATUS] = checkStatus, _actions),
|
|
2236
2292
|
run: [SwapActionTypes.START],
|
|
2237
2293
|
whenTaskBlocked: function whenTaskBlocked(event, meta) {
|
|
2238
2294
|
if (event.reason.reason === BlockReason.WAIT_FOR_CONNECT_WALLET) {
|