@rango-dev/queue-manager-rango-preset 0.1.10-next.87 → 0.1.10-next.90

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.
@@ -1,4 +1,5 @@
1
1
  export declare const RANGO_DAPP_API_KEY: string | undefined;
2
+ export declare const RANGO_DAPP_API_BASE_URL: string | undefined;
2
3
  export declare const ERROR_MESSAGE_DEPENDS_ON_OTHER_QUEUES = "Waiting for other running tasks to be finished";
3
4
  export declare const ERROR_MESSAGE_WAIT_FOR_WALLET = "Waiting for connecting wallet";
4
5
  export declare const ERROR_MESSAGE_WAIT_FOR_WALLET_DESCRIPTION_WRONG_WALLET: (type: string | null, address: string | null) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,oBAAgC,CAAC;AAEhE,eAAO,MAAM,qCAAqC,mDACA,CAAC;AACnD,eAAO,MAAM,6BAA6B,kCAAkC,CAAC;AAC7E,eAAO,MAAM,sDAAsD,SAC3D,MAAM,GAAG,IAAI,WACV,MAAM,GAAG,IAAI,KACrB,MAGC,CAAC;AACL,eAAO,MAAM,yCAAyC,SAC9C,MAAM,GAAG,IAAI,KAClB,MAGqD,CAAC;AACzD,eAAO,MAAM,qCAAqC,YACvC,MAAM,GAAG,IAAI,KACrB,MAAqD,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,oBAAgC,CAAC;AAChE,eAAO,MAAM,uBAAuB,oBAAqC,CAAC;AAE1E,eAAO,MAAM,qCAAqC,mDACA,CAAC;AACnD,eAAO,MAAM,6BAA6B,kCAAkC,CAAC;AAC7E,eAAO,MAAM,sDAAsD,SAC3D,MAAM,GAAG,IAAI,WACV,MAAM,GAAG,IAAI,KACrB,MAGC,CAAC;AACL,eAAO,MAAM,yCAAyC,SAC9C,MAAM,GAAG,IAAI,KAClB,MAGqD,CAAC;AACzD,eAAO,MAAM,qCAAqC,YACvC,MAAM,GAAG,IAAI,KACrB,MAAqD,CAAC"}
package/dist/helpers.d.ts CHANGED
@@ -4,7 +4,7 @@ import { Meta, Network, WalletState, WalletType } from '@rango-dev/wallets-share
4
4
  import { Providers } from '@rango-dev/wallets-core';
5
5
  import { TronTransaction, StarknetTransaction, CosmosTransaction, EvmTransaction, SolanaTransaction, Transfer as TransferTransaction, Transaction, EvmBlockchainMeta } from 'rango-sdk';
6
6
  import { Manager } from '@rango-dev/queue-manager-core';
7
- import { EventType, PendingSwap, PendingSwapNetworkStatus, PendingSwapStep, StepStatus, SwapStatus, Wallet, WalletTypeAndAddress } from './shared';
7
+ import { EventType, PendingSwap, PendingSwapNetworkStatus, PendingSwapStep, StepStatus, SwapStatus, Wallet, WalletTypeAndAddress, SwapProgressNotification } from './shared';
8
8
  declare type WhenTaskBlocked = Parameters<NonNullable<SwapQueueDef['whenTaskBlocked']>>;
9
9
  declare type WhenTaskBlockedEvent = WhenTaskBlocked[0];
10
10
  declare type WhenTaskBlockedMeta = WhenTaskBlocked[1];
@@ -19,7 +19,7 @@ export declare const getCurrentStep: (swap: PendingSwap) => PendingSwapStep | nu
19
19
  * When we are doing a swap, there are some common fields that will be updated together.
20
20
  * This function helps us to update a swap status and also it will update some more fields like `extraMessageSeverity` based on the input.
21
21
  */
22
- export declare function updateSwapStatus({ getStorage, setStorage, nextStatus, nextStepStatus, message, details, errorCode, }: {
22
+ export declare function updateSwapStatus({ getStorage, setStorage, nextStatus, nextStepStatus, message, details, errorCode, hasAlreadyProceededToSign, }: {
23
23
  getStorage: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>['getStorage'];
24
24
  setStorage: ExecuterActions<SwapStorage, SwapActionTypes, SwapQueueContext>['setStorage'];
25
25
  nextStatus?: SwapStatus;
@@ -27,11 +27,16 @@ export declare function updateSwapStatus({ getStorage, setStorage, nextStatus, n
27
27
  message?: string;
28
28
  details?: string | null | undefined;
29
29
  errorCode?: string | null;
30
+ hasAlreadyProceededToSign?: boolean;
30
31
  }): {
31
32
  swap: PendingSwap;
32
33
  step: PendingSwapStep | null;
33
34
  };
34
35
  export declare function setStepTransactionIds({ getStorage, setStorage }: ExecuterActions<SwapStorage, SwapActionTypes>, txId: string | null, eventType: EventType, notifier: SwapQueueContext['notifier']): void;
36
+ export declare function getSwapNotitfication(eventType: EventType, updateResult: {
37
+ swap: PendingSwap;
38
+ step: PendingSwapStep | null;
39
+ }): SwapProgressNotification;
35
40
  /**
36
41
  * If a swap needs a wallet to be connected,
37
42
  * By calling this function some related fields will be updated to show a correct message and state for notfiying the user.
@@ -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,EAClB,MAAM,WAAW,CAAC;AAOnB,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,OAAO,EACL,SAAS,EAQT,WAAW,EACX,wBAAwB,EACxB,eAAe,EAEf,UAAU,EACV,UAAU,EACV,MAAM,EACN,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAKlB,aAAK,eAAe,GAAG,UAAU,CAAC,WAAW,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAChF,aAAK,oBA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,OAAO,CAAC,CAmF3C;AAED,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["src/migration.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,iBAAS,QAAQ,IAAI,OAAO,CAE3B;AAYD;;;;;GAKG;AACH,iBAAe,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,CAoF3C;AAED,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC"}
@@ -453,6 +453,7 @@ function _assertThisInitialized(self) {
453
453
  }
454
454
 
455
455
  var RANGO_DAPP_API_KEY = process.env.REACT_APP_API_KEY;
456
+ var RANGO_DAPP_API_BASE_URL = process.env.REACT_APP_API_BASE_URL;
456
457
  var ERROR_MESSAGE_WAIT_FOR_WALLET = 'Waiting for connecting wallet';
457
458
  var ERROR_MESSAGE_WAIT_FOR_WALLET_DESCRIPTION_WRONG_WALLET = function ERROR_MESSAGE_WAIT_FOR_WALLET_DESCRIPTION_WRONG_WALLET(type, address) {
458
459
  return "Please change your " + (type || 'wallet') + " account to " + (address || 'proper address');
@@ -687,7 +688,7 @@ function logRPCError(error, swap, currentStep, walletType) {
687
688
  }
688
689
  }
689
690
 
690
- var httpService = /*#__PURE__*/new rangoSdk.RangoClient(RANGO_DAPP_API_KEY || '');
691
+ var httpService = /*#__PURE__*/new rangoSdk.RangoClient(RANGO_DAPP_API_KEY || '', RANGO_DAPP_API_BASE_URL);
691
692
 
692
693
  var swapClaimedBy = null;
693
694
  /**
@@ -734,11 +735,13 @@ function updateSwapStatus(_ref) {
734
735
  message = _ref.message,
735
736
  details = _ref.details,
736
737
  _ref$errorCode = _ref.errorCode,
737
- errorCode = _ref$errorCode === void 0 ? null : _ref$errorCode;
738
+ errorCode = _ref$errorCode === void 0 ? null : _ref$errorCode,
739
+ hasAlreadyProceededToSign = _ref.hasAlreadyProceededToSign;
738
740
  var swap = getStorage().swapDetails;
739
741
  var currentStep = getCurrentStep(swap);
740
742
  if (!!nextStepStatus && !!currentStep) currentStep.status = nextStepStatus;
741
743
  if (!!nextStatus) swap.status = nextStatus;
744
+ swap.hasAlreadyProceededToSign = hasAlreadyProceededToSign;
742
745
  if (!!nextStatus && ['failed', 'success'].includes(nextStatus)) swap.finishTime = new Date().getTime().toString();
743
746
  if (!!message) swap.extraMessage = message;
744
747
  if (!!details) swap.extraMessageDetail = details;
@@ -751,7 +754,7 @@ function updateSwapStatus(_ref) {
751
754
  httpService.reportFailure({
752
755
  requestId: swap.requestId,
753
756
  step: (currentStep == null ? void 0 : currentStep.id) || 1,
754
- eventType: mapAppErrorCodesToAPIErrorCode(errorCode),
757
+ eventType: mapAppErrorCodesToAPIErrorCode(hasAlreadyProceededToSign ? APIErrorCode.TX_FAIL : errorCode),
755
758
  reason: errorReason || '',
756
759
  data: walletType ? {
757
760
  wallet: walletType
@@ -771,6 +774,7 @@ function setStepTransactionIds(_ref2, txId, eventType, notifier) {
771
774
  var getStorage = _ref2.getStorage,
772
775
  setStorage = _ref2.setStorage;
773
776
  var swap = getStorage().swapDetails;
777
+ swap.hasAlreadyProceededToSign = null;
774
778
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
775
779
  var currentStep = getCurrentStep(swap);
776
780
  currentStep.executedTransactionId = txId || currentStep.executedTransactionId;
@@ -783,6 +787,15 @@ function setStepTransactionIds(_ref2, txId, eventType, notifier) {
783
787
  step: currentStep
784
788
  });
785
789
  }
790
+ function getSwapNotitfication(eventType, updateResult) {
791
+ if (updateResult.swap.hasAlreadyProceededToSign) {
792
+ return _extends({
793
+ eventType: 'transaction_expired'
794
+ }, updateResult);
795
+ } else return _extends({
796
+ eventType: eventType
797
+ }, updateResult);
798
+ }
786
799
  /**
787
800
  * If a swap needs a wallet to be connected,
788
801
  * By calling this function some related fields will be updated to show a correct message and state for notfiying the user.
@@ -1474,187 +1487,200 @@ function singTransaction(actions) {
1474
1487
  });
1475
1488
  return;
1476
1489
  }
1477
- var executeMessage = 'executing transaction';
1490
+ var hasAlreadyProceededToSign = typeof swap.hasAlreadyProceededToSign === 'boolean';
1491
+ var executeMessage = hasAlreadyProceededToSign ? 'Transaction is expired. Please try again' : 'executing transaction';
1478
1492
  var executeDetails = "" + (sourceWallet.walletType === walletsShared.WalletType.WALLET_CONNECT ? 'Check your mobile phone' : '');
1479
1493
  if (!!transferTransaction) {
1480
1494
  var _updateResult3 = updateSwapStatus({
1481
1495
  getStorage: getStorage,
1482
1496
  setStorage: setStorage,
1483
- nextStepStatus: 'running',
1497
+ nextStepStatus: hasAlreadyProceededToSign ? 'failed' : 'running',
1498
+ nextStatus: hasAlreadyProceededToSign ? 'failed' : 'running',
1484
1499
  message: executeMessage,
1485
- details: executeDetails
1500
+ details: executeDetails,
1501
+ hasAlreadyProceededToSign: hasAlreadyProceededToSign
1486
1502
  });
1487
- notifier(_extends({
1488
- eventType: 'confirm_transfer'
1489
- }, _updateResult3));
1490
- walletSigners.getSigner(rangoSdk.TransactionType.TRANSFER).signAndSendTx(transferTransaction, walletAddress, null).then(function (txId) {
1491
- setStepTransactionIds(actions, txId, 'transfer_confirmed', notifier);
1492
- schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
1493
- next();
1494
- onFinish();
1495
- }, function (error) {
1496
- if (swap.status === 'failed') return;
1497
- var _prettifyErrorMessage4 = prettifyErrorMessage(error),
1498
- extraMessage = _prettifyErrorMessage4.extraMessage,
1499
- extraMessageDetail = _prettifyErrorMessage4.extraMessageDetail,
1500
- extraMessageErrorCode = _prettifyErrorMessage4.extraMessageErrorCode;
1501
- var updateResult = updateSwapStatus({
1502
- getStorage: getStorage,
1503
- setStorage: setStorage,
1504
- nextStatus: 'failed',
1505
- nextStepStatus: 'failed',
1506
- message: extraMessage,
1507
- details: extraMessageDetail,
1508
- errorCode: extraMessageErrorCode
1503
+ var notification = getSwapNotitfication('confirm_transfer', _updateResult3);
1504
+ notifier(notification);
1505
+ if (notification.eventType !== 'transaction_expired') {
1506
+ walletSigners.getSigner(rangoSdk.TransactionType.TRANSFER).signAndSendTx(transferTransaction, walletAddress, null).then(function (txId) {
1507
+ setStepTransactionIds(actions, txId, 'transfer_confirmed', notifier);
1508
+ schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
1509
+ next();
1510
+ onFinish();
1511
+ }, function (error) {
1512
+ if (swap.status === 'failed') return;
1513
+ var _prettifyErrorMessage4 = prettifyErrorMessage(error),
1514
+ extraMessage = _prettifyErrorMessage4.extraMessage,
1515
+ extraMessageDetail = _prettifyErrorMessage4.extraMessageDetail,
1516
+ extraMessageErrorCode = _prettifyErrorMessage4.extraMessageErrorCode;
1517
+ var updateResult = updateSwapStatus({
1518
+ getStorage: getStorage,
1519
+ setStorage: setStorage,
1520
+ nextStatus: 'failed',
1521
+ nextStepStatus: 'failed',
1522
+ message: extraMessage,
1523
+ details: extraMessageDetail,
1524
+ errorCode: extraMessageErrorCode
1525
+ });
1526
+ notifier(_extends({
1527
+ eventType: 'transfer_rejected'
1528
+ }, updateResult));
1529
+ failed();
1530
+ onFinish();
1509
1531
  });
1510
- notifier(_extends({
1511
- eventType: 'transfer_rejected'
1512
- }, updateResult));
1513
- failed();
1514
- onFinish();
1515
- });
1532
+ }
1516
1533
  } else if (!!evmTransaction) {
1517
1534
  var _updateResult4 = updateSwapStatus({
1518
1535
  getStorage: getStorage,
1519
1536
  setStorage: setStorage,
1520
- nextStepStatus: 'running',
1537
+ nextStepStatus: hasAlreadyProceededToSign ? 'failed' : 'running',
1538
+ nextStatus: hasAlreadyProceededToSign ? 'failed' : 'running',
1521
1539
  message: executeMessage,
1522
- details: executeDetails
1540
+ details: executeDetails,
1541
+ hasAlreadyProceededToSign: hasAlreadyProceededToSign
1523
1542
  });
1524
- notifier(_extends({
1525
- eventType: 'calling_smart_contract'
1526
- }, _updateResult4));
1527
- walletSigners.getSigner(rangoSdk.TransactionType.EVM).signAndSendTx(evmTransaction, walletAddress, null).then(function (id) {
1528
- setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
1529
- schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
1530
- next();
1531
- onFinish();
1532
- }, function (error) {
1533
- var _error$root10, _error$root11, _error$root12;
1534
- if (swap.status === 'failed') return;
1535
- var _prettifyErrorMessage5 = prettifyErrorMessage(error),
1536
- extraMessage = _prettifyErrorMessage5.extraMessage,
1537
- extraMessageDetail = _prettifyErrorMessage5.extraMessageDetail,
1538
- extraMessageErrorCode = _prettifyErrorMessage5.extraMessageErrorCode;
1539
- 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) {
1540
- logRPCError(error.root, swap, currentStep, sourceWallet == null ? void 0 : sourceWallet.walletType);
1541
- }
1542
- var updateResult = updateSwapStatus({
1543
- getStorage: getStorage,
1544
- setStorage: setStorage,
1545
- nextStatus: 'failed',
1546
- nextStepStatus: 'failed',
1547
- message: extraMessage,
1548
- details: extraMessageDetail,
1549
- errorCode: extraMessageErrorCode
1543
+ var _notification = getSwapNotitfication('calling_smart_contract', _updateResult4);
1544
+ notifier(_notification);
1545
+ if (_notification.eventType !== 'transaction_expired') {
1546
+ walletSigners.getSigner(rangoSdk.TransactionType.EVM).signAndSendTx(evmTransaction, walletAddress, null).then(function (id) {
1547
+ setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
1548
+ schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
1549
+ next();
1550
+ onFinish();
1551
+ }, function (error) {
1552
+ var _error$root10, _error$root11, _error$root12;
1553
+ if (swap.status === 'failed') return;
1554
+ var _prettifyErrorMessage5 = prettifyErrorMessage(error),
1555
+ extraMessage = _prettifyErrorMessage5.extraMessage,
1556
+ extraMessageDetail = _prettifyErrorMessage5.extraMessageDetail,
1557
+ extraMessageErrorCode = _prettifyErrorMessage5.extraMessageErrorCode;
1558
+ 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) {
1559
+ logRPCError(error.root, swap, currentStep, sourceWallet == null ? void 0 : sourceWallet.walletType);
1560
+ }
1561
+ var updateResult = updateSwapStatus({
1562
+ getStorage: getStorage,
1563
+ setStorage: setStorage,
1564
+ nextStatus: 'failed',
1565
+ nextStepStatus: 'failed',
1566
+ message: extraMessage,
1567
+ details: extraMessageDetail,
1568
+ errorCode: extraMessageErrorCode
1569
+ });
1570
+ notifier(_extends({
1571
+ eventType: 'smart_contract_call_failed'
1572
+ }, updateResult));
1573
+ failed();
1574
+ onFinish();
1550
1575
  });
1551
- notifier(_extends({
1552
- eventType: 'smart_contract_call_failed'
1553
- }, updateResult));
1554
- failed();
1555
- onFinish();
1556
- });
1576
+ }
1557
1577
  } else if (!!cosmosTransaction) {
1558
1578
  var _updateResult5 = updateSwapStatus({
1559
1579
  getStorage: getStorage,
1560
1580
  setStorage: setStorage,
1561
- nextStepStatus: 'running',
1581
+ nextStepStatus: hasAlreadyProceededToSign ? 'failed' : 'running',
1582
+ nextStatus: hasAlreadyProceededToSign ? 'failed' : 'running',
1562
1583
  message: executeMessage,
1563
- details: executeDetails
1584
+ details: executeDetails,
1585
+ hasAlreadyProceededToSign: hasAlreadyProceededToSign
1564
1586
  });
1565
- notifier(_extends({
1566
- eventType: 'calling_smart_contract'
1567
- }, _updateResult5));
1568
- // If keplr wallet is executing contracts on terra, throw error. keplr doesn't support transfer or execute contracts. only IBC messages are supported
1569
- 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) &&
1570
- // here we must allow ibc on terrastatus
1571
- sourceWallet.walletType === walletsShared.WalletType.KEPLR) {
1572
- 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'),
1573
- extraMessage = _prettifyErrorMessage6.extraMessage,
1574
- extraMessageDetail = _prettifyErrorMessage6.extraMessageDetail,
1575
- extraMessageErrorCode = _prettifyErrorMessage6.extraMessageErrorCode;
1576
- var _updateResult6 = updateSwapStatus({
1577
- getStorage: getStorage,
1578
- setStorage: setStorage,
1579
- nextStatus: 'failed',
1580
- nextStepStatus: 'failed',
1581
- message: extraMessage,
1582
- details: extraMessageDetail,
1583
- errorCode: extraMessageErrorCode
1587
+ var _notification2 = getSwapNotitfication('calling_smart_contract', _updateResult5);
1588
+ notifier(_notification2);
1589
+ if (_notification2.eventType !== 'transaction_expired') {
1590
+ // If keplr wallet is executing contracts on terra, throw error. keplr doesn't support transfer or execute contracts. only IBC messages are supported
1591
+ 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
+ // here we must allow ibc on terrastatus
1593
+ sourceWallet.walletType === walletsShared.WalletType.KEPLR) {
1594
+ 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'),
1595
+ extraMessage = _prettifyErrorMessage6.extraMessage,
1596
+ extraMessageDetail = _prettifyErrorMessage6.extraMessageDetail,
1597
+ extraMessageErrorCode = _prettifyErrorMessage6.extraMessageErrorCode;
1598
+ var _updateResult6 = updateSwapStatus({
1599
+ getStorage: getStorage,
1600
+ setStorage: setStorage,
1601
+ nextStatus: 'failed',
1602
+ nextStepStatus: 'failed',
1603
+ message: extraMessage,
1604
+ details: extraMessageDetail,
1605
+ errorCode: extraMessageErrorCode
1606
+ });
1607
+ notifier(_extends({
1608
+ eventType: 'smart_contract_call_failed'
1609
+ }, _updateResult6));
1610
+ failed();
1611
+ onFinish();
1612
+ return;
1613
+ }
1614
+ walletSigners.getSigner(rangoSdk.TransactionType.COSMOS).signAndSendTx(cosmosTransaction, walletAddress, null).then(
1615
+ // todo
1616
+ function (id) {
1617
+ setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
1618
+ schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
1619
+ next();
1620
+ onFinish();
1621
+ }, function (error) {
1622
+ if (swap.status === 'failed') return;
1623
+ var _prettifyErrorMessage7 = prettifyErrorMessage(error),
1624
+ extraMessage = _prettifyErrorMessage7.extraMessage,
1625
+ extraMessageDetail = _prettifyErrorMessage7.extraMessageDetail,
1626
+ extraMessageErrorCode = _prettifyErrorMessage7.extraMessageErrorCode;
1627
+ var updateResult = updateSwapStatus({
1628
+ getStorage: getStorage,
1629
+ setStorage: setStorage,
1630
+ nextStatus: 'failed',
1631
+ nextStepStatus: 'failed',
1632
+ message: extraMessage,
1633
+ details: extraMessageDetail,
1634
+ errorCode: extraMessageErrorCode
1635
+ });
1636
+ notifier(_extends({
1637
+ eventType: 'smart_contract_call_failed'
1638
+ }, updateResult));
1639
+ failed();
1640
+ onFinish();
1584
1641
  });
1585
- notifier(_extends({
1586
- eventType: 'smart_contract_call_failed'
1587
- }, _updateResult6));
1588
- failed();
1589
- onFinish();
1590
- return;
1591
1642
  }
1592
- walletSigners.getSigner(rangoSdk.TransactionType.COSMOS).signAndSendTx(cosmosTransaction, walletAddress, null).then(
1593
- // todo
1594
- function (id) {
1595
- setStepTransactionIds(actions, id, 'smart_contract_called', notifier);
1596
- schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
1597
- next();
1598
- onFinish();
1599
- }, function (error) {
1600
- if (swap.status === 'failed') return;
1601
- var _prettifyErrorMessage7 = prettifyErrorMessage(error),
1602
- extraMessage = _prettifyErrorMessage7.extraMessage,
1603
- extraMessageDetail = _prettifyErrorMessage7.extraMessageDetail,
1604
- extraMessageErrorCode = _prettifyErrorMessage7.extraMessageErrorCode;
1605
- var updateResult = updateSwapStatus({
1606
- getStorage: getStorage,
1607
- setStorage: setStorage,
1608
- nextStatus: 'failed',
1609
- nextStepStatus: 'failed',
1610
- message: extraMessage,
1611
- details: extraMessageDetail,
1612
- errorCode: extraMessageErrorCode
1613
- });
1614
- notifier(_extends({
1615
- eventType: 'smart_contract_call_failed'
1616
- }, updateResult));
1617
- failed();
1618
- onFinish();
1619
- });
1620
1643
  } else if (!!solanaTransaction) {
1621
1644
  var _updateResult7 = updateSwapStatus({
1622
1645
  getStorage: getStorage,
1623
1646
  setStorage: setStorage,
1624
- nextStepStatus: 'running',
1647
+ nextStepStatus: hasAlreadyProceededToSign ? 'failed' : 'running',
1648
+ nextStatus: hasAlreadyProceededToSign ? 'failed' : 'running',
1625
1649
  message: executeMessage,
1626
- details: executeDetails
1650
+ details: executeDetails,
1651
+ hasAlreadyProceededToSign: hasAlreadyProceededToSign
1627
1652
  });
1628
- notifier(_extends({
1629
- eventType: 'calling_smart_contract'
1630
- }, _updateResult7));
1631
- var tx = solanaTransaction;
1632
- walletSigners.getSigner(rangoSdk.TransactionType.SOLANA).signAndSendTx(tx, walletAddress, null).then(function (txId) {
1633
- setStepTransactionIds(actions, txId, 'smart_contract_called', notifier);
1634
- schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
1635
- next();
1636
- onFinish();
1637
- }, function (error) {
1638
- if (swap.status === 'failed') return;
1639
- var _prettifyErrorMessage8 = prettifyErrorMessage(error),
1640
- extraMessage = _prettifyErrorMessage8.extraMessage,
1641
- extraMessageDetail = _prettifyErrorMessage8.extraMessageDetail,
1642
- extraMessageErrorCode = _prettifyErrorMessage8.extraMessageErrorCode;
1643
- var updateResult = updateSwapStatus({
1644
- getStorage: getStorage,
1645
- setStorage: setStorage,
1646
- nextStatus: 'failed',
1647
- nextStepStatus: 'failed',
1648
- message: extraMessage,
1649
- details: extraMessageDetail,
1650
- errorCode: extraMessageErrorCode
1653
+ var _notification3 = getSwapNotitfication('calling_smart_contract', _updateResult7);
1654
+ notifier(_notification3);
1655
+ if (_notification3.eventType !== 'transaction_expired') {
1656
+ var tx = solanaTransaction;
1657
+ walletSigners.getSigner(rangoSdk.TransactionType.SOLANA).signAndSendTx(tx, walletAddress, null).then(function (txId) {
1658
+ setStepTransactionIds(actions, txId, 'smart_contract_called', notifier);
1659
+ schedule(SwapActionTypes.CHECK_TRANSACTION_STATUS);
1660
+ next();
1661
+ onFinish();
1662
+ }, function (error) {
1663
+ if (swap.status === 'failed') return;
1664
+ var _prettifyErrorMessage8 = prettifyErrorMessage(error),
1665
+ extraMessage = _prettifyErrorMessage8.extraMessage,
1666
+ extraMessageDetail = _prettifyErrorMessage8.extraMessageDetail,
1667
+ extraMessageErrorCode = _prettifyErrorMessage8.extraMessageErrorCode;
1668
+ var updateResult = updateSwapStatus({
1669
+ getStorage: getStorage,
1670
+ setStorage: setStorage,
1671
+ nextStatus: 'failed',
1672
+ nextStepStatus: 'failed',
1673
+ message: extraMessage,
1674
+ details: extraMessageDetail,
1675
+ errorCode: extraMessageErrorCode
1676
+ });
1677
+ notifier(_extends({
1678
+ eventType: 'smart_contract_call_failed'
1679
+ }, updateResult));
1680
+ failed();
1681
+ onFinish();
1651
1682
  });
1652
- notifier(_extends({
1653
- eventType: 'smart_contract_call_failed'
1654
- }, updateResult));
1655
- failed();
1656
- onFinish();
1657
- });
1683
+ }
1658
1684
  } else if (!!tronTransaction) {
1659
1685
  var _updateResult8 = updateSwapStatus({
1660
1686
  getStorage: getStorage,
@@ -2362,28 +2388,59 @@ var MIGRATED_KEY = 'migratedToQueueManager';
2362
2388
  function migrated() {
2363
2389
  return !!window.localStorage.getItem(MIGRATED_KEY);
2364
2390
  }
2391
+ function hasQueueManagerOnIDB() {
2392
+ return _hasQueueManagerOnIDB.apply(this, arguments);
2393
+ }
2365
2394
  /**
2366
2395
  *
2367
2396
  * By calling this function, we first check if the data already migrated or not,
2368
2397
  * If not, starting to migrating to IndexedDb with proper format that queue manager is understand.
2369
2398
  *
2370
2399
  */
2400
+ function _hasQueueManagerOnIDB() {
2401
+ _hasQueueManagerOnIDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2402
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2403
+ while (1) switch (_context.prev = _context.next) {
2404
+ case 0:
2405
+ _context.prev = 0;
2406
+ _context.next = 3;
2407
+ return window.indexedDB.databases();
2408
+ case 3:
2409
+ return _context.abrupt("return", _context.sent.map(function (db) {
2410
+ return db.name;
2411
+ }).includes(queueManagerCore.DB_NAME));
2412
+ case 6:
2413
+ _context.prev = 6;
2414
+ _context.t0 = _context["catch"](0);
2415
+ return _context.abrupt("return", false);
2416
+ case 9:
2417
+ case "end":
2418
+ return _context.stop();
2419
+ }
2420
+ }, _callee, null, [[0, 6]]);
2421
+ }));
2422
+ return _hasQueueManagerOnIDB.apply(this, arguments);
2423
+ }
2371
2424
  function migration() {
2372
2425
  return _migration.apply(this, arguments);
2373
2426
  }
2374
2427
  function _migration() {
2375
- _migration = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2376
- var swapsFromStorage, swaps, convertedSwaps, persistor, promises;
2377
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2378
- while (1) switch (_context.prev = _context.next) {
2428
+ _migration = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
2429
+ var swapsFromStorage, hasIndexDB, swaps, convertedSwaps, persistor, promises;
2430
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2431
+ while (1) switch (_context2.prev = _context2.next) {
2379
2432
  case 0:
2380
- swapsFromStorage = window.localStorage.getItem('pendingSwaps'); // For new users or already migrated.
2381
- if (!(!swapsFromStorage || migrated())) {
2382
- _context.next = 3;
2433
+ swapsFromStorage = window.localStorage.getItem('pendingSwaps');
2434
+ _context2.next = 3;
2435
+ return hasQueueManagerOnIDB();
2436
+ case 3:
2437
+ hasIndexDB = _context2.sent;
2438
+ if (!(!swapsFromStorage || migrated() || hasIndexDB)) {
2439
+ _context2.next = 6;
2383
2440
  break;
2384
2441
  }
2385
- return _context.abrupt("return", true);
2386
- case 3:
2442
+ return _context2.abrupt("return", true);
2443
+ case 6:
2387
2444
  // For old users, but they didn't do any swaps yet.
2388
2445
  swaps = JSON.parse(swapsFromStorage);
2389
2446
  convertedSwaps = [];
@@ -2446,17 +2503,17 @@ function _migration() {
2446
2503
  promises = convertedSwaps.map(function (queue) {
2447
2504
  return persistor.insertQueue(queue);
2448
2505
  });
2449
- _context.next = 10;
2506
+ _context2.next = 13;
2450
2507
  return Promise.all(promises);
2451
- case 10:
2508
+ case 13:
2452
2509
  // Mark as the data has been successfully migrated.
2453
2510
  window.localStorage.setItem(MIGRATED_KEY, '1');
2454
- return _context.abrupt("return", true);
2455
- case 12:
2511
+ return _context2.abrupt("return", true);
2512
+ case 15:
2456
2513
  case "end":
2457
- return _context.stop();
2514
+ return _context2.stop();
2458
2515
  }
2459
- }, _callee);
2516
+ }, _callee2);
2460
2517
  }));
2461
2518
  return _migration.apply(this, arguments);
2462
2519
  }