@rango-dev/queue-manager-rango-preset 0.1.10-next.94 → 0.1.10-next.96
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.map +1 -1
- package/dist/queue-manager-rango-preset.cjs.development.js +128 -89
- 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 +128 -89
- package/dist/queue-manager-rango-preset.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/actions/checkStatus.ts +2 -0
- package/src/actions/executeTransaction.ts +7 -3
- package/src/helpers.ts +157 -106
|
@@ -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;
|
|
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;AAqL1E;;;;;;;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;AAkBhE,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,
|
|
1
|
+
{"version":3,"file":"executeTransaction.d.ts","sourceRoot":"","sources":["../src/actions/executeTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAkBhE,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,CAoFf"}
|
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,EAAE,eAAe,EAAa,MAAM,+BAA+B,CAAC;AAC3E,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,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,QAAQ,IAAI,mBAAmB,EAC/B,WAAW,EAEX,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,WAAW,CAAC;AAOnB,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,OAAO,EACL,SAAS,EAQT,WAAW,EACX,wBAA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,CACpC,MAAM,EAAE,oBAAoB,EAC5B,IAAI,EAAE,mBAAmB,GACxB,IAAI,CAqDN;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,WAAW,GAC1C,OAAO,CAaT;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,eAAe,CAAC,WAAW,EAAE,eAAe,EAAE,gBAAgB,CAAC,GACvE,IAAI,CAstBN;AAED,wBAAgB,kCAAkC,CAAC,MAAM,EAAE;IACzD,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,iBAAiB,EAAE,CAAC;CAChC,GAAG,IAAI,CAoDP;AAED,wBAAgB,4BAA4B,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAgCpE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CACrB,cAAc,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE,OAAO,EACjB,OAAO;;CAAiC,GACvC,IAAI,CAsDN;AAMD,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAM1E;AAMD,wBAAsB,SAAS,CAC7B,WAAW,EAAE,OAAO,CAAC,yBAAyB,CAAC,GAC9C,OAAO,CAAC,yBAAyB,CAAC,CAYpC"}
|
|
@@ -712,6 +712,14 @@ function claimQueue() {
|
|
|
712
712
|
}
|
|
713
713
|
};
|
|
714
714
|
}
|
|
715
|
+
/**
|
|
716
|
+
*
|
|
717
|
+
* Returns "wallet and network" separately, even if the wallet is dashed inside.
|
|
718
|
+
*
|
|
719
|
+
*/
|
|
720
|
+
function splitWalletNetwork(input) {
|
|
721
|
+
return input == null ? void 0 : input.split(/-(?=[^-]*$)/);
|
|
722
|
+
}
|
|
715
723
|
/**
|
|
716
724
|
*
|
|
717
725
|
* Returns `steps`, if it's a `running` swap.
|
|
@@ -1502,7 +1510,10 @@ function singTransaction(actions) {
|
|
|
1502
1510
|
});
|
|
1503
1511
|
var notification = getSwapNotitfication('confirm_transfer', _updateResult3);
|
|
1504
1512
|
notifier(notification);
|
|
1505
|
-
if (notification.eventType
|
|
1513
|
+
if (notification.eventType === 'transaction_expired') {
|
|
1514
|
+
failed();
|
|
1515
|
+
onFinish();
|
|
1516
|
+
} else {
|
|
1506
1517
|
walletSigners.getSigner(rangoSdk.TransactionType.TRANSFER).signAndSendTx(transferTransaction, walletAddress, null).then(function (txId) {
|
|
1507
1518
|
setStepTransactionIds(actions, txId, 'transfer_confirmed', notifier);
|
|
1508
1519
|
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
@@ -1542,7 +1553,10 @@ function singTransaction(actions) {
|
|
|
1542
1553
|
});
|
|
1543
1554
|
var _notification = getSwapNotitfication('calling_smart_contract', _updateResult4);
|
|
1544
1555
|
notifier(_notification);
|
|
1545
|
-
if (_notification.eventType
|
|
1556
|
+
if (_notification.eventType === 'transaction_expired') {
|
|
1557
|
+
failed();
|
|
1558
|
+
onFinish();
|
|
1559
|
+
} else {
|
|
1546
1560
|
walletSigners.getSigner(rangoSdk.TransactionType.EVM).signAndSendTx(evmTransaction, walletAddress, null).then(function (id) {
|
|
1547
1561
|
setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
|
|
1548
1562
|
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
@@ -1586,7 +1600,10 @@ function singTransaction(actions) {
|
|
|
1586
1600
|
});
|
|
1587
1601
|
var _notification2 = getSwapNotitfication('calling_smart_contract', _updateResult5);
|
|
1588
1602
|
notifier(_notification2);
|
|
1589
|
-
if (_notification2.eventType
|
|
1603
|
+
if (_notification2.eventType === 'transaction_expired') {
|
|
1604
|
+
failed();
|
|
1605
|
+
onFinish();
|
|
1606
|
+
} else {
|
|
1590
1607
|
// If keplr wallet is executing contracts on terra, throw error. keplr doesn't support transfer or execute contracts. only IBC messages are supported
|
|
1591
1608
|
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) &&
|
|
1592
1609
|
// here we must allow ibc on terrastatus
|
|
@@ -1652,7 +1669,10 @@ function singTransaction(actions) {
|
|
|
1652
1669
|
});
|
|
1653
1670
|
var _notification3 = getSwapNotitfication('calling_smart_contract', _updateResult7);
|
|
1654
1671
|
notifier(_notification3);
|
|
1655
|
-
if (_notification3.eventType
|
|
1672
|
+
if (_notification3.eventType === 'transaction_expired') {
|
|
1673
|
+
failed();
|
|
1674
|
+
onFinish();
|
|
1675
|
+
} else {
|
|
1656
1676
|
var tx = solanaTransaction;
|
|
1657
1677
|
walletSigners.getSigner(rangoSdk.TransactionType.SOLANA).signAndSendTx(tx, walletAddress, null).then(function (txId) {
|
|
1658
1678
|
setStepTransactionIds(actions, txId, 'smart_contract_called', notifier);
|
|
@@ -1685,93 +1705,105 @@ function singTransaction(actions) {
|
|
|
1685
1705
|
var _updateResult8 = updateSwapStatus({
|
|
1686
1706
|
getStorage: getStorage,
|
|
1687
1707
|
setStorage: setStorage,
|
|
1688
|
-
nextStepStatus: 'running',
|
|
1708
|
+
nextStepStatus: hasAlreadyProceededToSign ? 'failed' : 'running',
|
|
1709
|
+
nextStatus: hasAlreadyProceededToSign ? 'failed' : 'running',
|
|
1689
1710
|
message: executeMessage,
|
|
1690
|
-
details: executeDetails
|
|
1711
|
+
details: executeDetails,
|
|
1712
|
+
hasAlreadyProceededToSign: hasAlreadyProceededToSign
|
|
1691
1713
|
});
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
walletSigners.getSigner(rangoSdk.TransactionType.TRON).signAndSendTx(tronTransaction, walletAddress, null).then(function (id) {
|
|
1696
|
-
setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
|
|
1697
|
-
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
1698
|
-
next();
|
|
1699
|
-
onFinish();
|
|
1700
|
-
}, function (error) {
|
|
1701
|
-
var _error$root13, _error$root14, _error$root15;
|
|
1702
|
-
if (swap.status === 'failed') return;
|
|
1703
|
-
var _prettifyErrorMessage9 = prettifyErrorMessage(error),
|
|
1704
|
-
extraMessage = _prettifyErrorMessage9.extraMessage,
|
|
1705
|
-
extraMessageDetail = _prettifyErrorMessage9.extraMessageDetail,
|
|
1706
|
-
extraMessageErrorCode = _prettifyErrorMessage9.extraMessageErrorCode;
|
|
1707
|
-
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) {
|
|
1708
|
-
logRPCError(error.root, swap, currentStep, sourceWallet == null ? void 0 : sourceWallet.walletType);
|
|
1709
|
-
}
|
|
1710
|
-
var updateResult = updateSwapStatus({
|
|
1711
|
-
getStorage: getStorage,
|
|
1712
|
-
setStorage: setStorage,
|
|
1713
|
-
nextStatus: 'failed',
|
|
1714
|
-
nextStepStatus: 'failed',
|
|
1715
|
-
message: extraMessage,
|
|
1716
|
-
details: extraMessageDetail,
|
|
1717
|
-
errorCode: extraMessageErrorCode
|
|
1718
|
-
});
|
|
1719
|
-
notifier(_extends({
|
|
1720
|
-
eventType: 'smart_contract_call_failed'
|
|
1721
|
-
}, updateResult));
|
|
1714
|
+
var _notification4 = getSwapNotitfication('calling_smart_contract', _updateResult8);
|
|
1715
|
+
notifier(_notification4);
|
|
1716
|
+
if (_notification4.eventType === 'transaction_expired') {
|
|
1722
1717
|
failed();
|
|
1723
1718
|
onFinish();
|
|
1724
|
-
}
|
|
1719
|
+
} else {
|
|
1720
|
+
walletSigners.getSigner(rangoSdk.TransactionType.TRON).signAndSendTx(tronTransaction, walletAddress, null).then(function (id) {
|
|
1721
|
+
setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
|
|
1722
|
+
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
1723
|
+
next();
|
|
1724
|
+
onFinish();
|
|
1725
|
+
}, function (error) {
|
|
1726
|
+
var _error$root13, _error$root14, _error$root15;
|
|
1727
|
+
if (swap.status === 'failed') return;
|
|
1728
|
+
var _prettifyErrorMessage9 = prettifyErrorMessage(error),
|
|
1729
|
+
extraMessage = _prettifyErrorMessage9.extraMessage,
|
|
1730
|
+
extraMessageDetail = _prettifyErrorMessage9.extraMessageDetail,
|
|
1731
|
+
extraMessageErrorCode = _prettifyErrorMessage9.extraMessageErrorCode;
|
|
1732
|
+
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) {
|
|
1733
|
+
logRPCError(error.root, swap, currentStep, sourceWallet == null ? void 0 : sourceWallet.walletType);
|
|
1734
|
+
}
|
|
1735
|
+
var updateResult = updateSwapStatus({
|
|
1736
|
+
getStorage: getStorage,
|
|
1737
|
+
setStorage: setStorage,
|
|
1738
|
+
nextStatus: 'failed',
|
|
1739
|
+
nextStepStatus: 'failed',
|
|
1740
|
+
message: extraMessage,
|
|
1741
|
+
details: extraMessageDetail,
|
|
1742
|
+
errorCode: extraMessageErrorCode
|
|
1743
|
+
});
|
|
1744
|
+
notifier(_extends({
|
|
1745
|
+
eventType: 'smart_contract_call_failed'
|
|
1746
|
+
}, updateResult));
|
|
1747
|
+
failed();
|
|
1748
|
+
onFinish();
|
|
1749
|
+
});
|
|
1750
|
+
}
|
|
1725
1751
|
} else if (!!starknetTransaction) {
|
|
1726
1752
|
var _updateResult9 = updateSwapStatus({
|
|
1727
1753
|
getStorage: getStorage,
|
|
1728
1754
|
setStorage: setStorage,
|
|
1729
|
-
nextStepStatus: 'running',
|
|
1755
|
+
nextStepStatus: hasAlreadyProceededToSign ? 'failed' : 'running',
|
|
1756
|
+
nextStatus: hasAlreadyProceededToSign ? 'failed' : 'running',
|
|
1730
1757
|
message: executeMessage,
|
|
1731
|
-
details: executeDetails
|
|
1758
|
+
details: executeDetails,
|
|
1759
|
+
hasAlreadyProceededToSign: hasAlreadyProceededToSign
|
|
1732
1760
|
});
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
walletSigners.getSigner(rangoSdk.TransactionType.STARKNET).signAndSendTx(starknetTransaction, walletAddress, null).then(function (id) {
|
|
1737
|
-
setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
|
|
1738
|
-
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
1739
|
-
next();
|
|
1740
|
-
onFinish();
|
|
1741
|
-
}, function (error) {
|
|
1742
|
-
var _error$root16, _error$root17, _error$root18;
|
|
1743
|
-
if (swap.status === 'failed') return;
|
|
1744
|
-
var _prettifyErrorMessage10 = prettifyErrorMessage(error),
|
|
1745
|
-
extraMessage = _prettifyErrorMessage10.extraMessage,
|
|
1746
|
-
extraMessageDetail = _prettifyErrorMessage10.extraMessageDetail,
|
|
1747
|
-
extraMessageErrorCode = _prettifyErrorMessage10.extraMessageErrorCode;
|
|
1748
|
-
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) {
|
|
1749
|
-
logRPCError(error.root, swap, currentStep, sourceWallet == null ? void 0 : sourceWallet.walletType);
|
|
1750
|
-
}
|
|
1751
|
-
var updateResult = updateSwapStatus({
|
|
1752
|
-
getStorage: getStorage,
|
|
1753
|
-
setStorage: setStorage,
|
|
1754
|
-
nextStatus: 'failed',
|
|
1755
|
-
nextStepStatus: 'failed',
|
|
1756
|
-
message: extraMessage,
|
|
1757
|
-
details: extraMessageDetail,
|
|
1758
|
-
errorCode: extraMessageErrorCode
|
|
1759
|
-
});
|
|
1760
|
-
notifier(_extends({
|
|
1761
|
-
eventType: 'smart_contract_call_failed'
|
|
1762
|
-
}, updateResult));
|
|
1761
|
+
var _notification5 = getSwapNotitfication('calling_smart_contract', _updateResult9);
|
|
1762
|
+
notifier(_notification5);
|
|
1763
|
+
if (_notification5.eventType === 'transaction_expired') {
|
|
1763
1764
|
failed();
|
|
1764
1765
|
onFinish();
|
|
1765
|
-
}
|
|
1766
|
+
} else {
|
|
1767
|
+
walletSigners.getSigner(rangoSdk.TransactionType.STARKNET).signAndSendTx(starknetTransaction, walletAddress, null).then(function (id) {
|
|
1768
|
+
setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
|
|
1769
|
+
schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
|
|
1770
|
+
next();
|
|
1771
|
+
onFinish();
|
|
1772
|
+
}, function (error) {
|
|
1773
|
+
var _error$root16, _error$root17, _error$root18;
|
|
1774
|
+
if (swap.status === 'failed') return;
|
|
1775
|
+
var _prettifyErrorMessage10 = prettifyErrorMessage(error),
|
|
1776
|
+
extraMessage = _prettifyErrorMessage10.extraMessage,
|
|
1777
|
+
extraMessageDetail = _prettifyErrorMessage10.extraMessageDetail,
|
|
1778
|
+
extraMessageErrorCode = _prettifyErrorMessage10.extraMessageErrorCode;
|
|
1779
|
+
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) {
|
|
1780
|
+
logRPCError(error.root, swap, currentStep, sourceWallet == null ? void 0 : sourceWallet.walletType);
|
|
1781
|
+
}
|
|
1782
|
+
var updateResult = updateSwapStatus({
|
|
1783
|
+
getStorage: getStorage,
|
|
1784
|
+
setStorage: setStorage,
|
|
1785
|
+
nextStatus: 'failed',
|
|
1786
|
+
nextStepStatus: 'failed',
|
|
1787
|
+
message: extraMessage,
|
|
1788
|
+
details: extraMessageDetail,
|
|
1789
|
+
errorCode: extraMessageErrorCode
|
|
1790
|
+
});
|
|
1791
|
+
notifier(_extends({
|
|
1792
|
+
eventType: 'smart_contract_call_failed'
|
|
1793
|
+
}, updateResult));
|
|
1794
|
+
failed();
|
|
1795
|
+
onFinish();
|
|
1796
|
+
});
|
|
1797
|
+
}
|
|
1766
1798
|
}
|
|
1767
1799
|
}
|
|
1768
1800
|
function checkWaitingForConnectWalletChange(params) {
|
|
1769
1801
|
var wallet_network = params.wallet_network,
|
|
1770
1802
|
evmChains = params.evmChains,
|
|
1771
1803
|
manager = params.manager;
|
|
1772
|
-
var
|
|
1773
|
-
wallet =
|
|
1774
|
-
network =
|
|
1804
|
+
var _splitWalletNetwork = splitWalletNetwork(wallet_network),
|
|
1805
|
+
wallet = _splitWalletNetwork[0],
|
|
1806
|
+
network = _splitWalletNetwork[1];
|
|
1775
1807
|
// We only need change network for EVM chains.
|
|
1776
1808
|
if (!evmChains.some(function (chain) {
|
|
1777
1809
|
return chain.name == network;
|
|
@@ -1789,7 +1821,7 @@ function checkWaitingForConnectWalletChange(params) {
|
|
|
1789
1821
|
var task = q.list.state.tasks[taskId];
|
|
1790
1822
|
return task.status === queueManagerCore.Status.BLOCKED && [BlockReason.WAIT_FOR_CONNECT_WALLET].includes((_task$blockedFor = task.blockedFor) == null ? void 0 : _task$blockedFor.reason);
|
|
1791
1823
|
});
|
|
1792
|
-
if (currentStepRequiredWallet === wallet && hasWaitingForConnect) {
|
|
1824
|
+
if (currentStepRequiredWallet === wallet && hasWaitingForConnect && getCurrentBlockchainOfOrNull(swap, currentStep) != network) {
|
|
1793
1825
|
var queueInstance = q.list;
|
|
1794
1826
|
var _getRequiredWallet5 = getRequiredWallet(swap),
|
|
1795
1827
|
type = _getRequiredWallet5.type;
|
|
@@ -1853,9 +1885,9 @@ function retryOn(wallet_network, manager, options) {
|
|
|
1853
1885
|
fallbackToOnlyWallet: true
|
|
1854
1886
|
};
|
|
1855
1887
|
}
|
|
1856
|
-
var
|
|
1857
|
-
wallet =
|
|
1858
|
-
network =
|
|
1888
|
+
var _splitWalletNetwork2 = splitWalletNetwork(wallet_network),
|
|
1889
|
+
wallet = _splitWalletNetwork2[0],
|
|
1890
|
+
network = _splitWalletNetwork2[1];
|
|
1859
1891
|
if (!wallet || !network) {
|
|
1860
1892
|
return;
|
|
1861
1893
|
}
|
|
@@ -2009,6 +2041,7 @@ function _checkTransactionStatus() {
|
|
|
2009
2041
|
currentStep.starknetTransaction = null;
|
|
2010
2042
|
currentStep.tronApprovalTransaction = null;
|
|
2011
2043
|
currentStep.tronTransaction = null;
|
|
2044
|
+
currentStep.fromBlockchain = newTransaction.blockChain;
|
|
2012
2045
|
if (isEvmTransaction(newTransaction)) {
|
|
2013
2046
|
if (newTransaction.isApprovalTx) currentStep.evmApprovalTransaction = newTransaction;else currentStep.evmTransaction = newTransaction;
|
|
2014
2047
|
} else if (isCosmosTransaction(newTransaction)) {
|
|
@@ -2275,7 +2308,7 @@ function executeTransaction(_x) {
|
|
|
2275
2308
|
function _executeTransaction() {
|
|
2276
2309
|
_executeTransaction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(actions) {
|
|
2277
2310
|
var _context$_queue;
|
|
2278
|
-
var getStorage, context, meta, wallets, providers, isClaimed, requestBlock, swap, currentStep, isWrongAddress, _getRequiredWallet, type, address, description, blockedFor, needsToBlockQueue, _blockedFor, networkMatched, fromBlockchain, details, _blockedFor2;
|
|
2311
|
+
var getStorage, context, meta, wallets, providers, isClaimed, requestBlock, swap, currentStep, isWrongAddress, _wallets$blockchains, _getRequiredWallet, type, address, isWalletInCompatible, description, blockedFor, needsToBlockQueue, _blockedFor, networkMatched, fromBlockchain, details, _blockedFor2;
|
|
2279
2312
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2280
2313
|
while (1) switch (_context.prev = _context.next) {
|
|
2281
2314
|
case 0:
|
|
@@ -2294,25 +2327,31 @@ function _executeTransaction() {
|
|
|
2294
2327
|
/* Make sure wallet is connected and also the connected wallet is matched with tx by checking address. */
|
|
2295
2328
|
isWrongAddress = !isRequiredWalletConnected(swap, context.state);
|
|
2296
2329
|
if (!isWrongAddress) {
|
|
2297
|
-
_context.next =
|
|
2330
|
+
_context.next = 15;
|
|
2298
2331
|
break;
|
|
2299
2332
|
}
|
|
2300
2333
|
_getRequiredWallet = getRequiredWallet(swap), type = _getRequiredWallet.type, address = _getRequiredWallet.address;
|
|
2301
|
-
|
|
2334
|
+
isWalletInCompatible = wallets == null ? void 0 : (_wallets$blockchains = wallets.blockchains) == null ? void 0 : _wallets$blockchains.find(function (w) {
|
|
2335
|
+
var _w$accounts;
|
|
2336
|
+
return !((_w$accounts = w.accounts) != null && _w$accounts.find(function (account) {
|
|
2337
|
+
return account.walletType === type;
|
|
2338
|
+
}));
|
|
2339
|
+
});
|
|
2340
|
+
description = !wallets || isWalletInCompatible ? ERROR_MESSAGE_WAIT_FOR_WALLET_DESCRIPTION(type) : ERROR_MESSAGE_WAIT_FOR_WALLET_DESCRIPTION_WRONG_WALLET(type, address);
|
|
2302
2341
|
blockedFor = {
|
|
2303
2342
|
reason: BlockReason.WAIT_FOR_CONNECT_WALLET,
|
|
2304
2343
|
description: description
|
|
2305
2344
|
};
|
|
2306
2345
|
requestBlock(blockedFor);
|
|
2307
2346
|
return _context.abrupt("return");
|
|
2308
|
-
case
|
|
2347
|
+
case 15:
|
|
2309
2348
|
/*
|
|
2310
2349
|
For avoiding conflict by making too many requests to wallet, we need to make sure
|
|
2311
2350
|
We only run one request at a time (In parallel mode).
|
|
2312
2351
|
*/
|
|
2313
2352
|
needsToBlockQueue = isNeedBlockQueueForParallel(currentStep);
|
|
2314
2353
|
if (!(needsToBlockQueue && !isClaimed && context.claimedBy)) {
|
|
2315
|
-
_context.next =
|
|
2354
|
+
_context.next = 20;
|
|
2316
2355
|
break;
|
|
2317
2356
|
}
|
|
2318
2357
|
_blockedFor = {
|
|
@@ -2322,13 +2361,13 @@ function _executeTransaction() {
|
|
|
2322
2361
|
};
|
|
2323
2362
|
requestBlock(_blockedFor);
|
|
2324
2363
|
return _context.abrupt("return");
|
|
2325
|
-
case
|
|
2326
|
-
_context.next =
|
|
2364
|
+
case 20:
|
|
2365
|
+
_context.next = 22;
|
|
2327
2366
|
return isNetworkMatchedForTransaction(swap, currentStep, wallets, meta, providers);
|
|
2328
|
-
case
|
|
2367
|
+
case 22:
|
|
2329
2368
|
networkMatched = _context.sent;
|
|
2330
2369
|
if (networkMatched) {
|
|
2331
|
-
_context.next =
|
|
2370
|
+
_context.next = 31;
|
|
2332
2371
|
break;
|
|
2333
2372
|
}
|
|
2334
2373
|
fromBlockchain = getCurrentBlockchainOf(swap, currentStep);
|
|
@@ -2339,17 +2378,17 @@ function _executeTransaction() {
|
|
|
2339
2378
|
};
|
|
2340
2379
|
requestBlock(_blockedFor2);
|
|
2341
2380
|
return _context.abrupt("return");
|
|
2342
|
-
case
|
|
2381
|
+
case 31:
|
|
2343
2382
|
// Update network to mark it as network changed successfully.
|
|
2344
2383
|
updateNetworkStatus(actions, {
|
|
2345
2384
|
message: '',
|
|
2346
2385
|
details: 'Wallet network changed successfully',
|
|
2347
2386
|
status: PendingSwapNetworkStatus.NetworkChanged
|
|
2348
2387
|
});
|
|
2349
|
-
case
|
|
2388
|
+
case 32:
|
|
2350
2389
|
// All the conditions are met. We can safely send the tx to wallet for sign.
|
|
2351
2390
|
singTransaction(actions);
|
|
2352
|
-
case
|
|
2391
|
+
case 33:
|
|
2353
2392
|
case "end":
|
|
2354
2393
|
return _context.stop();
|
|
2355
2394
|
}
|