@rango-dev/widget-embedded 0.1.10-next.84 → 0.1.10-next.87

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.
Files changed (43) hide show
  1. package/dist/App.d.ts.map +1 -1
  2. package/dist/QueueManager.d.ts +4 -0
  3. package/dist/QueueManager.d.ts.map +1 -0
  4. package/dist/components/AppRoutes.d.ts.map +1 -1
  5. package/dist/components/HeaderButtons.d.ts.map +1 -1
  6. package/dist/components/UpdateUrl.d.ts.map +1 -1
  7. package/dist/constants/navigationRoutes.d.ts +1 -1
  8. package/dist/hooks/useCopyToClipboard.d.ts +2 -0
  9. package/dist/hooks/useCopyToClipboard.d.ts.map +1 -0
  10. package/dist/hooks/useNavigateBack.d.ts.map +1 -1
  11. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  12. package/dist/pages/ConfirmWalletsPage.d.ts.map +1 -1
  13. package/dist/pages/HistoryPage.d.ts +0 -2
  14. package/dist/pages/HistoryPage.d.ts.map +1 -1
  15. package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
  16. package/dist/store/confirmSwap.d.ts +2 -1
  17. package/dist/store/confirmSwap.d.ts.map +1 -1
  18. package/dist/store/ui.d.ts.map +1 -1
  19. package/dist/utils/queue.d.ts +4 -0
  20. package/dist/utils/queue.d.ts.map +1 -0
  21. package/dist/widget-embedded.cjs.development.js +154 -1132
  22. package/dist/widget-embedded.cjs.development.js.map +1 -1
  23. package/dist/widget-embedded.cjs.production.min.js +154 -1132
  24. package/dist/widget-embedded.cjs.production.min.js.map +1 -1
  25. package/dist/widget-embedded.esm.js +155 -1133
  26. package/dist/widget-embedded.esm.js.map +1 -1
  27. package/package.json +10 -5
  28. package/src/App.tsx +35 -12
  29. package/src/QueueManager.tsx +93 -0
  30. package/src/components/AppRoutes.tsx +5 -2
  31. package/src/components/HeaderButtons.tsx +17 -4
  32. package/src/components/UpdateUrl.tsx +15 -11
  33. package/src/constants/navigationRoutes.ts +2 -2
  34. package/src/hooks/useCopyToClipboard.ts +23 -0
  35. package/src/hooks/useNavigateBack.ts +7 -4
  36. package/src/pages/ConfirmSwapPage.tsx +17 -4
  37. package/src/pages/ConfirmWalletsPage.tsx +3 -1
  38. package/src/pages/HistoryPage.tsx +15 -822
  39. package/src/pages/Home.tsx +1 -1
  40. package/src/pages/SwapDetailsPage.tsx +21 -3
  41. package/src/store/confirmSwap.ts +24 -9
  42. package/src/store/ui.ts +8 -2
  43. package/src/utils/queue.ts +24 -0
@@ -19,6 +19,8 @@ var walletsCore = require('@rango-dev/wallets-core');
19
19
  var theme = require('@rango-dev/ui/src/theme');
20
20
  var providerAll = require('@rango-dev/provider-all');
21
21
  var shallow = require('zustand/shallow');
22
+ var queueManagerReact = require('@rango-dev/queue-manager-react');
23
+ var copy = _interopDefault(require('copy-to-clipboard'));
22
24
 
23
25
  const navigationRoutes = {
24
26
  home: '/',
@@ -28,11 +30,11 @@ const navigationRoutes = {
28
30
  toToken: '/to-token',
29
31
  settings: '/settings',
30
32
  liquiditySources: '/settings/liquidity-sources',
31
- history: '/history',
33
+ swaps: '/swaps',
32
34
  wallets: '/wallets',
33
35
  confirmSwap: '/confirm-swap',
34
36
  confirmWallets: '/confirm-wallets',
35
- swapDetails: '/history/swap-details'
37
+ swapDetails: '/swaps/:requestId'
36
38
  };
37
39
 
38
40
  const ZERO = /*#__PURE__*/new BigNumber__default(0);
@@ -810,6 +812,17 @@ var SearchParams;
810
812
  SearchParams["FROM_AMOUNT"] = "fromAmount";
811
813
  })(SearchParams || (SearchParams = {}));
812
814
 
815
+ const useUiStore = /*#__PURE__*/createSelectors( /*#__PURE__*/zustand.create()(set => ({
816
+ connectWalletsButtonDisabled: false,
817
+ selectedSwapRequestId: null,
818
+ toggleConnectWalletsButton: () => set(state => ({
819
+ connectWalletsButtonDisabled: !state.connectWalletsButtonDisabled
820
+ })),
821
+ setSelectedSwap: requestId => set({
822
+ selectedSwapRequestId: requestId
823
+ })
824
+ })));
825
+
813
826
  function searchParamsToToken(tokens, searchParams) {
814
827
  return tokens.find(token => {
815
828
  const symbolAndAddress = searchParams?.split('--');
@@ -823,13 +836,6 @@ function UpdateUrl() {
823
836
  const location = reactRouterDom.useLocation();
824
837
  const firstRenderSearchParams = React.useRef(location.search);
825
838
  const searchParamsRef = React.useRef({});
826
- React.useEffect(() => {
827
- const params = {};
828
- reactRouterDom.createSearchParams(firstRenderSearchParams.current).forEach((value, key) => {
829
- params[key] = value;
830
- });
831
- searchParamsRef.current = params;
832
- }, []);
833
839
  const fromChain = useBestRouteStore.use.fromChain();
834
840
  const toChain = useBestRouteStore.use.toChain();
835
841
  const fromToken = useBestRouteStore.use.fromToken();
@@ -845,6 +851,16 @@ function UpdateUrl() {
845
851
  blockchains,
846
852
  tokens
847
853
  } = useMetaStore.use.meta();
854
+ const setSelectedSwap = useUiStore.use.setSelectedSwap();
855
+ React.useEffect(() => {
856
+ const params = {};
857
+ reactRouterDom.createSearchParams(firstRenderSearchParams.current).forEach((value, key) => {
858
+ params[key] = value;
859
+ });
860
+ searchParamsRef.current = params;
861
+ const requestId = location.pathname.split(navigationRoutes.swaps + '/')[1] || null;
862
+ if (requestId) setSelectedSwap(requestId);
863
+ }, []);
848
864
  React.useEffect(() => {
849
865
  let fromChainString = '',
850
866
  fromTokenString = '',
@@ -956,14 +972,14 @@ function HeaderButtons(props) {
956
972
  content: "Retry"
957
973
  }, React__default.createElement(ui.Button, {
958
974
  variant: "ghost",
959
- onClick: onClickRefresh.bind(null)
975
+ onClick: onClickRefresh
960
976
  }, React__default.createElement(ui.RetryIcon, {
961
977
  size: 28
962
978
  }))), React__default.createElement(ui.Tooltip, {
963
979
  content: "Transactions History"
964
980
  }, React__default.createElement(ui.Button, {
965
981
  variant: "ghost",
966
- onClick: () => navigate(navigationRoutes.history)
982
+ onClick: () => navigate(navigationRoutes.swaps)
967
983
  }, React__default.createElement(ui.HistoryIcon, {
968
984
  size: 24
969
985
  }))), React__default.createElement(ui.Tooltip, {
@@ -1429,7 +1445,9 @@ function Home() {
1429
1445
  disabled: swapButtonState.disabled,
1430
1446
  onClick: () => {
1431
1447
  if (swapButtonState.title === 'Connect Wallet') navigate(navigationRoutes.wallets);else {
1432
- navigate(navigationRoutes.confirmWallets);
1448
+ navigate(navigationRoutes.confirmWallets, {
1449
+ replace: true
1450
+ });
1433
1451
  }
1434
1452
  }
1435
1453
  }, swapButtonState.title), React__default.createElement(BottomLogo, null)));
@@ -1457,13 +1475,6 @@ function AppRouter(_ref) {
1457
1475
  return React__default.createElement(React__default.Fragment, null, React__default.createElement(Router, null, children), isRouterInContext && React__default.createElement(UpdateUrl, null));
1458
1476
  }
1459
1477
 
1460
- const useUiStore = /*#__PURE__*/createSelectors( /*#__PURE__*/zustand.create()(set => ({
1461
- connectWalletsButtonDisabled: false,
1462
- toggleConnectWalletsButton: () => set(state => ({
1463
- connectWalletsButtonDisabled: !state.connectWalletsButtonDisabled
1464
- }))
1465
- })));
1466
-
1467
1478
  const StyledButton = /*#__PURE__*/ui.styled(ui.Button, {
1468
1479
  marginTop: '$8'
1469
1480
  });
@@ -1503,13 +1514,13 @@ function useNavigateBack() {
1503
1514
  const navigate = reactRouterDom.useNavigate();
1504
1515
  const navigateBackFrom = currentRoute => {
1505
1516
  if (!isRouterInContext || window.history.state && window.history.state.idx > 0) navigate(-1);else {
1506
- if ([navigationRoutes.fromChain, navigationRoutes.fromToken, navigationRoutes.toChain, navigationRoutes.toToken, navigationRoutes.settings, navigationRoutes.wallets, navigationRoutes.history].includes(currentRoute)) navigate(navigationRoutes.home, {
1517
+ if ([navigationRoutes.fromChain, navigationRoutes.fromToken, navigationRoutes.toChain, navigationRoutes.toToken, navigationRoutes.settings, navigationRoutes.wallets, navigationRoutes.swaps, navigationRoutes.confirmWallets].includes(currentRoute)) navigate(navigationRoutes.home, {
1507
1518
  replace: true
1508
- });else if (currentRoute === navigationRoutes.liquiditySources) {
1509
- navigate(navigationRoutes.settings, {
1510
- replace: true
1511
- });
1512
- } else if (currentRoute === navigationRoutes.swapDetails) navigate(navigationRoutes.history, {
1519
+ });else if (currentRoute === navigationRoutes.liquiditySources) navigate(navigationRoutes.settings, {
1520
+ replace: true
1521
+ });else if (currentRoute === navigationRoutes.swapDetails) navigate(navigationRoutes.swaps, {
1522
+ replace: true
1523
+ });else if (currentRoute === navigationRoutes.confirmSwap) navigate(navigationRoutes.confirmWallets, {
1513
1524
  replace: true
1514
1525
  });
1515
1526
  }
@@ -1540,7 +1551,7 @@ var ConfirmSwapWarningTypes;
1540
1551
  ConfirmSwapWarningTypes[ConfirmSwapWarningTypes["ROUTE_AND_OUTPUT_AMOUNT_UPDATED"] = 3] = "ROUTE_AND_OUTPUT_AMOUNT_UPDATED";
1541
1552
  ConfirmSwapWarningTypes[ConfirmSwapWarningTypes["INSUFFICIENT_BALANCE"] = 4] = "INSUFFICIENT_BALANCE";
1542
1553
  })(ConfirmSwapWarningTypes || (ConfirmSwapWarningTypes = {}));
1543
- const confirmSwap = () => {
1554
+ const confirmSwap = async () => {
1544
1555
  const {
1545
1556
  fromToken,
1546
1557
  toToken,
@@ -1573,11 +1584,13 @@ const confirmSwap = () => {
1573
1584
  };
1574
1585
  const newSwap = calculatePendingSwap(inputAmount.toString(), initialRoute, getWalletsForNewSwap(selectedWallets), swapSettings, false, meta);
1575
1586
  console.log('new swap:', newSwap);
1576
- return useConfirmSwapStore.setState({
1587
+ // queueManager?.create('swap', { swapDetails: newSwap });
1588
+ useConfirmSwapStore.setState({
1577
1589
  errors: [],
1578
1590
  warnings: [],
1579
1591
  proceedAnyway: false
1580
1592
  });
1593
+ return newSwap;
1581
1594
  }
1582
1595
  let abortController = new AbortController();
1583
1596
  useConfirmSwapStore.setState({
@@ -1597,17 +1610,20 @@ const confirmSwap = () => {
1597
1610
  if (selectedWalletsChanged) return false;else return true;
1598
1611
  }
1599
1612
  });
1600
- httpService.getBestRoute(requestBody, {
1613
+ const newSwap = await httpService.getBestRoute(requestBody, {
1601
1614
  signal: abortController.signal
1602
1615
  }).then(confiremedRoute => {
1603
1616
  useConfirmSwapStore.setState({
1604
1617
  loading: false
1605
1618
  });
1606
- if (!confiremedRoute.result || !new BigNumber__default(confiremedRoute.requestAmount).isEqualTo(new BigNumber__default(inputAmount || '-1'))) return useConfirmSwapStore.setState(prevState => ({
1607
- errors: prevState.errors.concat({
1608
- type: ConfirmSwapErrorTypes.NO_ROUTE
1609
- })
1610
- }));
1619
+ if (!confiremedRoute.result || !new BigNumber__default(confiremedRoute.requestAmount).isEqualTo(new BigNumber__default(inputAmount || '-1'))) {
1620
+ useConfirmSwapStore.setState(prevState => ({
1621
+ errors: prevState.errors.concat({
1622
+ type: ConfirmSwapErrorTypes.NO_ROUTE
1623
+ })
1624
+ }));
1625
+ return undefined;
1626
+ }
1611
1627
  const confirmSwap = {
1612
1628
  loading: false,
1613
1629
  errors: [],
@@ -1654,13 +1670,19 @@ const confirmSwap = () => {
1654
1670
  slippage: userSlippage.toString(),
1655
1671
  disabledSwappersGroups: disabledLiquiditySources
1656
1672
  };
1657
- const newSwap = calculatePendingSwap(inputAmount.toString(), initialRoute, getWalletsForNewSwap(selectedWallets), swapSettings, false, meta);
1673
+ const newSwap = calculatePendingSwap(inputAmount.toString(), confiremedRoute, getWalletsForNewSwap(selectedWallets), swapSettings, false, meta);
1658
1674
  console.log('new swap:', newSwap);
1659
- } else if (!proceedAnyway) confirmSwap.proceedAnyway = true;
1675
+ return newSwap;
1676
+ } else if (!proceedAnyway) {
1677
+ confirmSwap.proceedAnyway = true;
1678
+ useConfirmSwapStore.setState(confirmSwap);
1679
+ }
1680
+ return undefined;
1681
+ }).then(result => {
1660
1682
  abortController = null;
1661
- useConfirmSwapStore.setState(confirmSwap);
1662
1683
  unsubscribeFromBestRouteStore();
1663
1684
  unsubscribeFromWalletsStore();
1685
+ return result;
1664
1686
  }).catch(error => {
1665
1687
  abortController = null;
1666
1688
  if (error.code === 'ERR_CANCELED') {
@@ -1682,6 +1704,7 @@ const confirmSwap = () => {
1682
1704
  })
1683
1705
  }));
1684
1706
  });
1707
+ return newSwap || undefined;
1685
1708
  };
1686
1709
 
1687
1710
  function MinRequiredSlippage(_ref) {
@@ -1758,19 +1781,35 @@ function ConfirmSwapWarnings(warnings) {
1758
1781
  }
1759
1782
 
1760
1783
  function ConfirmSwapPage() {
1784
+ const setSelectedSwap = useUiStore.use.setSelectedSwap();
1761
1785
  const {
1762
1786
  navigateBackFrom
1763
1787
  } = useNavigateBack();
1788
+ const {
1789
+ manager
1790
+ } = queueManagerReact.useManager();
1791
+ const navigate = reactRouterDom.useNavigate();
1764
1792
  const bestRoute = useBestRouteStore.use.bestRoute();
1765
1793
  const loading = useConfirmSwapStore.use.loading();
1766
1794
  const warnings = useConfirmSwapStore.use.warnings();
1767
1795
  const errors = useConfirmSwapStore.use.errors();
1768
- console.log('loading:', loading, 'warnings:', warnings, 'errors:', errors);
1769
1796
  const slippage = useSettingsStore.use.slippage();
1770
1797
  const customSlippage = useSettingsStore.use.customSlippage();
1771
1798
  const selectedSlippage = customSlippage || slippage;
1772
1799
  return React__default.createElement(ui.ConfirmSwap, {
1773
- onConfirm: confirmSwap.bind(null),
1800
+ onConfirm: () => {
1801
+ confirmSwap().then(swap => {
1802
+ if (swap) {
1803
+ manager?.create('swap', {
1804
+ swapDetails: swap
1805
+ });
1806
+ setSelectedSwap(swap.requestId);
1807
+ navigate(navigationRoutes.swaps + `/${swap.requestId}`, {
1808
+ replace: true
1809
+ });
1810
+ }
1811
+ });
1812
+ },
1774
1813
  onBack: navigateBackFrom.bind(null, navigationRoutes.confirmSwap),
1775
1814
  bestRoute: bestRoute,
1776
1815
  loading: loading,
@@ -1784,640 +1823,47 @@ function ConfirmSwapPage() {
1784
1823
  });
1785
1824
  }
1786
1825
 
1787
- const pendingSwap = [{
1788
- creationTime: '1673164511955',
1789
- finishTime: '1673164550137',
1790
- requestId: '51e211d9-d61c-45d2-a4d4-1f9f7f90ee85',
1791
- inputAmount: '1',
1792
- wallets: {
1793
- OSMOSIS: {
1794
- walletType: 'keplr',
1795
- address: 'osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl'
1796
- }
1797
- },
1798
- status: 'running',
1799
- isPaused: false,
1800
- extraMessage: null,
1801
- extraMessageSeverity: 'info',
1802
- extraMessageDetail: '',
1803
- extraMessageErrorCode: null,
1804
- networkStatusExtraMessage: null,
1805
- networkStatusExtraMessageDetail: null,
1806
- lastNotificationTime: null,
1807
- settings: {
1808
- slippage: '1.0',
1809
- disabledSwappersIds: [],
1810
- disabledSwappersGroups: []
1811
- },
1812
- simulationResult: {
1813
- outputAmount: '1.540670',
1814
- swaps: [{
1815
- swapperId: 'Osmosis',
1816
- swapperType: 'DEX',
1817
- swapperLogo: '',
1818
- // @ts-ignore
1819
- result: null,
1820
- from: {
1821
- symbol: 'JUNO',
1822
- logo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
1823
- address: 'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
1824
- blockchain: 'OSMOSIS',
1825
- blockchainLogo: '',
1826
- decimals: 6,
1827
- usdPrice: 1.1091996179668873
1828
- },
1829
- to: {
1830
- symbol: 'OSMO',
1831
- logo: 'https://api.rango.exchange/i/mJQPS2',
1832
- address: null,
1833
- blockchain: 'OSMOSIS',
1834
- decimals: 6,
1835
- blockchainLogo: '',
1836
- usdPrice: 0.7192435454440882
1837
- },
1838
- fromAmount: '1.000000',
1839
- fromAmountPrecision: null,
1840
- fromAmountMinValue: null,
1841
- fromAmountMaxValue: null,
1842
- toAmount: '1.540670',
1843
- fee: [{
1844
- name: '',
1845
- asset: {
1846
- blockchain: 'OSMOSIS',
1847
- symbol: 'OSMO',
1848
- address: null
1849
- },
1850
- expenseType: 'FROM_SOURCE_WALLET',
1851
- amount: '0'
1852
- }],
1853
- estimatedTimeInSeconds: 45,
1854
- swapChainType: 'INTRA_CHAIN',
1855
- routes: [{
1856
- nodes: [{
1857
- nodes: [{
1858
- marketName: 'pool#498',
1859
- marketId: null,
1860
- percent: 1
1861
- }],
1862
- from: 'JUNO',
1863
- fromLogo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
1864
- fromAddress: 'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
1865
- fromBlockchain: 'OSMOSIS',
1866
- to: 'ATOM',
1867
- toLogo: 'https://api.rango.exchange/tokens/COSMOS/ATOM.png',
1868
- toAddress: 'ibc/27394fb092d2eccd56123c74f36e4c1f926001ceada9ca97ea622b25f41e5eb2',
1869
- toBlockchain: 'OSMOSIS'
1870
- }, {
1871
- nodes: [{
1872
- marketName: 'pool#8',
1873
- marketId: null,
1874
- percent: 1
1875
- }],
1876
- from: 'ATOM',
1877
- fromLogo: 'https://api.rango.exchange/tokens/COSMOS/ATOM.png',
1878
- fromAddress: 'ibc/27394fb092d2eccd56123c74f36e4c1f926001ceada9ca97ea622b25f41e5eb2',
1879
- fromBlockchain: 'OSMOSIS',
1880
- to: 'IRIS',
1881
- toLogo: 'https://api.rango.exchange/tokens/COSMOS/IRIS.png',
1882
- toAddress: 'ibc/7c4d60aa95e5a7558b0a364860979ca34b7ff8aaf255b87af9e879374470cec0',
1883
- toBlockchain: 'OSMOSIS'
1884
- }, {
1885
- nodes: [{
1886
- marketName: 'pool#7',
1887
- marketId: null,
1888
- percent: 1
1889
- }],
1890
- from: 'IRIS',
1891
- fromLogo: 'https://api.rango.exchange/tokens/COSMOS/IRIS.png',
1892
- fromAddress: 'ibc/7c4d60aa95e5a7558b0a364860979ca34b7ff8aaf255b87af9e879374470cec0',
1893
- fromBlockchain: 'OSMOSIS',
1894
- to: 'OSMO',
1895
- toLogo: 'https://api.rango.exchange/tokens/COSMOS/OSMO.png',
1896
- toAddress: null,
1897
- toBlockchain: 'OSMOSIS'
1898
- }]
1899
- }],
1900
- recommendedSlippage: null,
1901
- timeStat: {
1902
- min: 6,
1903
- avg: 40,
1904
- max: 241
1905
- },
1906
- includesDestinationTx: false
1907
- }]
1908
- },
1909
- validateBalanceOrFee: true,
1910
- steps: [{
1911
- id: 1,
1912
- fromBlockchain: 'OSMOSIS',
1913
- fromSymbol: 'JUNO',
1914
- fromSymbolAddress: 'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
1915
- fromDecimals: 6,
1916
- fromAmountPrecision: null,
1917
- fromAmountMinValue: null,
1918
- swapperLogo: '',
1919
- swapperType: '',
1920
- fromAmountMaxValue: null,
1921
- toBlockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
1922
- fromBlockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
1923
- toBlockchain: 'OSMOSIS',
1924
- fromLogo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
1925
- toSymbol: 'OSMO',
1926
- toSymbolAddress: null,
1927
- toDecimals: 6,
1928
- toLogo: 'https://api.rango.exchange/i/mJQPS2',
1929
- startTransactionTime: 1673164519916,
1930
- swapperId: 'Osmosis',
1931
- expectedOutputAmountHumanReadable: '1.540670',
1932
- outputAmount: '1.540658',
1933
- status: 'running',
1934
- networkStatus: null,
1935
- executedTransactionId: '0f8f17eecc863c2d6be65ef52cfe3128ff3cd7baeddf133160bea8ccdfbf876b',
1936
- explorerUrl: [{
1937
- url: 'https://www.mintscan.io/osmosis/txs/0f8f17eecc863c2d6be65ef52cfe3128ff3cd7baeddf133160bea8ccdfbf876b',
1938
- description: null
1939
- }],
1940
- cosmosTransaction: {
1941
- type: rangoSdk.TransactionType.COSMOS,
1942
- fromWalletAddress: 'osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl',
1943
- blockChain: 'OSMOSIS',
1944
- data: {
1945
- chainId: 'osmosis-1',
1946
- account_number: 102721,
1947
- sequence: '308',
1948
- msgs: [{
1949
- __type: 'OsmosisSwapMessage',
1950
- type: 'osmosis/gamm/swap-exact-amount-in',
1951
- value: {
1952
- sender: 'osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl',
1953
- routes: [{
1954
- pool_id: '498',
1955
- token_out_denom: 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2'
1956
- }, {
1957
- pool_id: '8',
1958
- token_out_denom: 'ibc/7C4D60AA95E5A7558B0A364860979CA34B7FF8AAF255B87AF9E879374470CEC0'
1959
- }, {
1960
- pool_id: '7',
1961
- token_out_denom: 'uosmo'
1962
- }],
1963
- token_in: {
1964
- denom: 'ibc/46B44899322F3CD854D2D46DEEF881958467CDD4B3B10086DA49296BBED94BED',
1965
- amount: '1000000'
1966
- },
1967
- token_out_min_amount: '1525264'
1968
- }
1969
- }],
1970
- protoMsgs: [{
1971
- type_url: '/osmosis.gamm.v1beta1.MsgSwapExactAmountIn',
1972
- value: [10, 43, 111, 115, 109, 111, 49, 117, 110, 102, 50, 114, 99, 121, 116, 106, 120, 102, 112, 122, 56, 120, 56, 97, 114, 54, 51, 104, 52, 113, 101, 102, 116, 97, 100, 112, 116, 103, 53, 116, 48, 110, 113, 99, 108, 18, 73, 8, -14, 3, 18, 68, 105, 98, 99, 47, 50, 55, 51, 57, 52, 70, 66, 48, 57, 50, 68, 50, 69, 67, 67, 68, 53, 54, 49, 50, 51, 67, 55, 52, 70, 51, 54, 69, 52, 67, 49, 70, 57, 50, 54, 48, 48, 49, 67, 69, 65, 68, 65, 57, 67, 65, 57, 55, 69, 65, 54, 50, 50, 66, 50, 53, 70, 52, 49, 69, 53, 69, 66, 50, 18, 72, 8, 8, 18, 68, 105, 98, 99, 47, 55, 67, 52, 68, 54, 48, 65, 65, 57, 53, 69, 53, 65, 55, 53, 53, 56, 66, 48, 65, 51, 54, 52, 56, 54, 48, 57, 55, 57, 67, 65, 51, 52, 66, 55, 70, 70, 56, 65, 65, 70, 50, 53, 53, 66, 56, 55, 65, 70, 57, 69, 56, 55, 57, 51, 55, 52, 52, 55, 48, 67, 69, 67, 48, 18, 9, 8, 7, 18, 5, 117, 111, 115, 109, 111, 26, 79, 10, 68, 105, 98, 99, 47, 52, 54, 66, 52, 52, 56, 57, 57, 51, 50, 50, 70, 51, 67, 68, 56, 53, 52, 68, 50, 68, 52, 54, 68, 69, 69, 70, 56, 56, 49, 57, 53, 56, 52, 54, 55, 67, 68, 68, 52, 66, 51, 66, 49, 48, 48, 56, 54, 68, 65, 52, 57, 50, 57, 54, 66, 66, 69, 68, 57, 52, 66, 69, 68, 18, 7, 49, 48, 48, 48, 48, 48, 48, 34, 7, 49, 53, 50, 53, 50, 54, 52]
1973
- }],
1974
- memo: '',
1975
- source: null,
1976
- fee: {
1977
- gas: '900000',
1978
- amount: [{
1979
- denom: 'uosmo',
1980
- amount: '0'
1981
- }]
1982
- },
1983
- signType: 'AMINO',
1984
- rpcUrl: ''
1985
- },
1986
- rawTransfer: null
1987
- },
1988
- solanaTransaction: null,
1989
- evmTransaction: null,
1990
- evmApprovalTransaction: null,
1991
- transferTransaction: null,
1992
- diagnosisUrl: null,
1993
- internalSteps: null
1994
- }]
1995
- }, {
1996
- creationTime: '1673164511955',
1997
- finishTime: '1673164550137',
1998
- requestId: '51e211d9-d61c-45d2-a4d4-1f9f7f90ee85',
1999
- inputAmount: '1',
2000
- wallets: {
2001
- OSMOSIS: {
2002
- walletType: 'keplr',
2003
- address: 'osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl'
2004
- }
2005
- },
2006
- status: 'failed',
2007
- isPaused: false,
2008
- extraMessage: null,
2009
- extraMessageSeverity: 'info',
2010
- extraMessageDetail: '',
2011
- extraMessageErrorCode: null,
2012
- networkStatusExtraMessage: null,
2013
- networkStatusExtraMessageDetail: null,
2014
- lastNotificationTime: null,
2015
- settings: {
2016
- slippage: '1.0',
2017
- disabledSwappersIds: [],
2018
- disabledSwappersGroups: []
2019
- },
2020
- simulationResult: {
2021
- outputAmount: '1.540670',
2022
- swaps: [{
2023
- swapperId: 'Osmosis',
2024
- swapperLogo: '',
2025
- // @ts-ignore
2026
- result: null,
2027
- swapperType: 'DEX',
2028
- from: {
2029
- symbol: 'JUNO',
2030
- logo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
2031
- address: 'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
2032
- blockchain: 'OSMOSIS',
2033
- blockchainLogo: '',
2034
- decimals: 6,
2035
- usdPrice: 1.1091996179668873
2036
- },
2037
- to: {
2038
- symbol: 'OSMO',
2039
- logo: 'https://api.rango.exchange/i/mJQPS2',
2040
- address: null,
2041
- blockchain: 'OSMOSIS',
2042
- decimals: 6,
2043
- blockchainLogo: '',
2044
- usdPrice: 0.7192435454440882
2045
- },
2046
- fromAmount: '1.000000',
2047
- fromAmountPrecision: null,
2048
- fromAmountMinValue: null,
2049
- fromAmountMaxValue: null,
2050
- toAmount: '1.540670',
2051
- fee: [{
2052
- name: '',
2053
- asset: {
2054
- blockchain: 'OSMOSIS',
2055
- symbol: 'OSMO',
2056
- address: null
2057
- },
2058
- expenseType: 'FROM_SOURCE_WALLET',
2059
- amount: '0'
2060
- }],
2061
- estimatedTimeInSeconds: 45,
2062
- swapChainType: 'INTRA_CHAIN',
2063
- routes: [{
2064
- nodes: [{
2065
- nodes: [{
2066
- marketName: 'pool#498',
2067
- marketId: null,
2068
- percent: 1
2069
- }],
2070
- from: 'JUNO',
2071
- fromLogo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
2072
- fromAddress: 'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
2073
- fromBlockchain: 'OSMOSIS',
2074
- to: 'ATOM',
2075
- toLogo: 'https://api.rango.exchange/tokens/COSMOS/ATOM.png',
2076
- toAddress: 'ibc/27394fb092d2eccd56123c74f36e4c1f926001ceada9ca97ea622b25f41e5eb2',
2077
- toBlockchain: 'OSMOSIS'
2078
- }, {
2079
- nodes: [{
2080
- marketName: 'pool#8',
2081
- marketId: null,
2082
- percent: 1
2083
- }],
2084
- from: 'ATOM',
2085
- fromLogo: 'https://api.rango.exchange/tokens/COSMOS/ATOM.png',
2086
- fromAddress: 'ibc/27394fb092d2eccd56123c74f36e4c1f926001ceada9ca97ea622b25f41e5eb2',
2087
- fromBlockchain: 'OSMOSIS',
2088
- to: 'IRIS',
2089
- toLogo: 'https://api.rango.exchange/tokens/COSMOS/IRIS.png',
2090
- toAddress: 'ibc/7c4d60aa95e5a7558b0a364860979ca34b7ff8aaf255b87af9e879374470cec0',
2091
- toBlockchain: 'OSMOSIS'
2092
- }, {
2093
- nodes: [{
2094
- marketName: 'pool#7',
2095
- marketId: null,
2096
- percent: 1
2097
- }],
2098
- from: 'IRIS',
2099
- fromLogo: 'https://api.rango.exchange/tokens/COSMOS/IRIS.png',
2100
- fromAddress: 'ibc/7c4d60aa95e5a7558b0a364860979ca34b7ff8aaf255b87af9e879374470cec0',
2101
- fromBlockchain: 'OSMOSIS',
2102
- to: 'OSMO',
2103
- toLogo: 'https://api.rango.exchange/tokens/COSMOS/OSMO.png',
2104
- toAddress: null,
2105
- toBlockchain: 'OSMOSIS'
2106
- }]
2107
- }],
2108
- recommendedSlippage: null,
2109
- timeStat: {
2110
- min: 6,
2111
- avg: 40,
2112
- max: 241
2113
- },
2114
- includesDestinationTx: false
2115
- }]
2116
- },
2117
- validateBalanceOrFee: true,
2118
- steps: [{
2119
- id: 1,
2120
- fromBlockchain: 'OSMOSIS',
2121
- fromSymbol: 'JUNO',
2122
- fromSymbolAddress: 'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
2123
- fromDecimals: 6,
2124
- fromAmountPrecision: null,
2125
- fromAmountMinValue: null,
2126
- fromAmountMaxValue: null,
2127
- toBlockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
2128
- fromBlockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
2129
- toBlockchain: 'OSMOSIS',
2130
- swapperLogo: '',
2131
- swapperType: '',
2132
- fromLogo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
2133
- toSymbol: 'OSMO',
2134
- toSymbolAddress: null,
2135
- toDecimals: 6,
2136
- toLogo: 'https://api.rango.exchange/i/mJQPS2',
2137
- startTransactionTime: 1673164519916,
2138
- swapperId: 'Osmosis',
2139
- expectedOutputAmountHumanReadable: '1.540670',
2140
- outputAmount: '1.540658',
2141
- status: 'failed',
2142
- networkStatus: null,
2143
- executedTransactionId: '0f8f17eecc863c2d6be65ef52cfe3128ff3cd7baeddf133160bea8ccdfbf876b',
2144
- explorerUrl: [{
2145
- url: 'https://www.mintscan.io/osmosis/txs/0f8f17eecc863c2d6be65ef52cfe3128ff3cd7baeddf133160bea8ccdfbf876b',
2146
- description: null
2147
- }],
2148
- cosmosTransaction: {
2149
- type: rangoSdk.TransactionType.COSMOS,
2150
- fromWalletAddress: 'osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl',
2151
- blockChain: 'OSMOSIS',
2152
- data: {
2153
- chainId: 'osmosis-1',
2154
- account_number: 102721,
2155
- sequence: '308',
2156
- msgs: [{
2157
- __type: 'OsmosisSwapMessage',
2158
- type: 'osmosis/gamm/swap-exact-amount-in',
2159
- value: {
2160
- sender: 'osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl',
2161
- routes: [{
2162
- pool_id: '498',
2163
- token_out_denom: 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2'
2164
- }, {
2165
- pool_id: '8',
2166
- token_out_denom: 'ibc/7C4D60AA95E5A7558B0A364860979CA34B7FF8AAF255B87AF9E879374470CEC0'
2167
- }, {
2168
- pool_id: '7',
2169
- token_out_denom: 'uosmo'
2170
- }],
2171
- token_in: {
2172
- denom: 'ibc/46B44899322F3CD854D2D46DEEF881958467CDD4B3B10086DA49296BBED94BED',
2173
- amount: '1000000'
2174
- },
2175
- token_out_min_amount: '1525264'
2176
- }
2177
- }],
2178
- protoMsgs: [{
2179
- type_url: '/osmosis.gamm.v1beta1.MsgSwapExactAmountIn',
2180
- value: [10, 43, 111, 115, 109, 111, 49, 117, 110, 102, 50, 114, 99, 121, 116, 106, 120, 102, 112, 122, 56, 120, 56, 97, 114, 54, 51, 104, 52, 113, 101, 102, 116, 97, 100, 112, 116, 103, 53, 116, 48, 110, 113, 99, 108, 18, 73, 8, -14, 3, 18, 68, 105, 98, 99, 47, 50, 55, 51, 57, 52, 70, 66, 48, 57, 50, 68, 50, 69, 67, 67, 68, 53, 54, 49, 50, 51, 67, 55, 52, 70, 51, 54, 69, 52, 67, 49, 70, 57, 50, 54, 48, 48, 49, 67, 69, 65, 68, 65, 57, 67, 65, 57, 55, 69, 65, 54, 50, 50, 66, 50, 53, 70, 52, 49, 69, 53, 69, 66, 50, 18, 72, 8, 8, 18, 68, 105, 98, 99, 47, 55, 67, 52, 68, 54, 48, 65, 65, 57, 53, 69, 53, 65, 55, 53, 53, 56, 66, 48, 65, 51, 54, 52, 56, 54, 48, 57, 55, 57, 67, 65, 51, 52, 66, 55, 70, 70, 56, 65, 65, 70, 50, 53, 53, 66, 56, 55, 65, 70, 57, 69, 56, 55, 57, 51, 55, 52, 52, 55, 48, 67, 69, 67, 48, 18, 9, 8, 7, 18, 5, 117, 111, 115, 109, 111, 26, 79, 10, 68, 105, 98, 99, 47, 52, 54, 66, 52, 52, 56, 57, 57, 51, 50, 50, 70, 51, 67, 68, 56, 53, 52, 68, 50, 68, 52, 54, 68, 69, 69, 70, 56, 56, 49, 57, 53, 56, 52, 54, 55, 67, 68, 68, 52, 66, 51, 66, 49, 48, 48, 56, 54, 68, 65, 52, 57, 50, 57, 54, 66, 66, 69, 68, 57, 52, 66, 69, 68, 18, 7, 49, 48, 48, 48, 48, 48, 48, 34, 7, 49, 53, 50, 53, 50, 54, 52]
2181
- }],
2182
- memo: '',
2183
- source: null,
2184
- fee: {
2185
- gas: '900000',
2186
- amount: [{
2187
- denom: 'uosmo',
2188
- amount: '0'
2189
- }]
2190
- },
2191
- signType: 'AMINO',
2192
- rpcUrl: ''
2193
- },
2194
- rawTransfer: null
2195
- },
2196
- solanaTransaction: null,
2197
- evmTransaction: null,
2198
- evmApprovalTransaction: null,
2199
- transferTransaction: null,
2200
- diagnosisUrl: null,
2201
- internalSteps: null
2202
- }]
2203
- }, {
2204
- creationTime: '1673164511955',
2205
- finishTime: '1673164550137',
2206
- requestId: '51e211d9-d61c-45d2-a4d4-1f9f7f90ee85',
2207
- inputAmount: '1',
2208
- wallets: {
2209
- OSMOSIS: {
2210
- walletType: 'keplr',
2211
- address: 'osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl'
1826
+ const getPendingSwaps = manager => {
1827
+ const result = [];
1828
+ manager?.getAll().forEach((q, id) => {
1829
+ const storage = q.list.getStorage();
1830
+ if (storage?.swapDetails) {
1831
+ result.push({
1832
+ id,
1833
+ swap: storage?.swapDetails
1834
+ });
2212
1835
  }
2213
- },
2214
- status: 'success',
2215
- isPaused: false,
2216
- extraMessage: null,
2217
- extraMessageSeverity: 'info',
2218
- extraMessageDetail: '',
2219
- extraMessageErrorCode: null,
2220
- networkStatusExtraMessage: null,
2221
- networkStatusExtraMessageDetail: null,
2222
- lastNotificationTime: null,
2223
- settings: {
2224
- slippage: '1.0',
2225
- disabledSwappersIds: [],
2226
- disabledSwappersGroups: []
2227
- },
2228
- simulationResult: {
2229
- outputAmount: '1.540670',
2230
- swaps: [{
2231
- // @ts-ignore
2232
- result: [],
2233
- swapperId: 'Osmosis',
2234
- swapperType: 'DEX',
2235
- swapperLogo: '',
2236
- from: {
2237
- symbol: 'JUNO',
2238
- logo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
2239
- address: 'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
2240
- blockchain: 'OSMOSIS',
2241
- blockchainLogo: '',
2242
- decimals: 6,
2243
- usdPrice: 1.1091996179668873
2244
- },
2245
- to: {
2246
- symbol: 'OSMO',
2247
- logo: 'https://api.rango.exchange/i/mJQPS2',
2248
- address: null,
2249
- blockchain: 'OSMOSIS',
2250
- decimals: 6,
2251
- blockchainLogo: '',
2252
- usdPrice: 0.7192435454440882
2253
- },
2254
- fromAmount: '1.000000',
2255
- fromAmountPrecision: null,
2256
- fromAmountMinValue: null,
2257
- fromAmountMaxValue: null,
2258
- toAmount: '1.540670',
2259
- fee: [{
2260
- name: '',
2261
- asset: {
2262
- blockchain: 'OSMOSIS',
2263
- symbol: 'OSMO',
2264
- address: null
2265
- },
2266
- expenseType: 'FROM_SOURCE_WALLET',
2267
- amount: '0'
2268
- }],
2269
- estimatedTimeInSeconds: 45,
2270
- swapChainType: 'INTRA_CHAIN',
2271
- routes: [{
2272
- nodes: [{
2273
- nodes: [{
2274
- marketName: 'pool#498',
2275
- marketId: null,
2276
- percent: 1
2277
- }],
2278
- from: 'JUNO',
2279
- fromLogo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
2280
- fromAddress: 'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
2281
- fromBlockchain: 'OSMOSIS',
2282
- to: 'ATOM',
2283
- toLogo: 'https://api.rango.exchange/tokens/COSMOS/ATOM.png',
2284
- toAddress: 'ibc/27394fb092d2eccd56123c74f36e4c1f926001ceada9ca97ea622b25f41e5eb2',
2285
- toBlockchain: 'OSMOSIS'
2286
- }, {
2287
- nodes: [{
2288
- marketName: 'pool#8',
2289
- marketId: null,
2290
- percent: 1
2291
- }],
2292
- from: 'ATOM',
2293
- fromLogo: 'https://api.rango.exchange/tokens/COSMOS/ATOM.png',
2294
- fromAddress: 'ibc/27394fb092d2eccd56123c74f36e4c1f926001ceada9ca97ea622b25f41e5eb2',
2295
- fromBlockchain: 'OSMOSIS',
2296
- to: 'IRIS',
2297
- toLogo: 'https://api.rango.exchange/tokens/COSMOS/IRIS.png',
2298
- toAddress: 'ibc/7c4d60aa95e5a7558b0a364860979ca34b7ff8aaf255b87af9e879374470cec0',
2299
- toBlockchain: 'OSMOSIS'
2300
- }, {
2301
- nodes: [{
2302
- marketName: 'pool#7',
2303
- marketId: null,
2304
- percent: 1
2305
- }],
2306
- from: 'IRIS',
2307
- fromLogo: 'https://api.rango.exchange/tokens/COSMOS/IRIS.png',
2308
- fromAddress: 'ibc/7c4d60aa95e5a7558b0a364860979ca34b7ff8aaf255b87af9e879374470cec0',
2309
- fromBlockchain: 'OSMOSIS',
2310
- to: 'OSMO',
2311
- toLogo: 'https://api.rango.exchange/tokens/COSMOS/OSMO.png',
2312
- toAddress: null,
2313
- toBlockchain: 'OSMOSIS'
2314
- }]
2315
- }],
2316
- recommendedSlippage: null,
2317
- timeStat: {
2318
- min: 6,
2319
- avg: 40,
2320
- max: 241
2321
- },
2322
- includesDestinationTx: false
2323
- }]
2324
- },
2325
- validateBalanceOrFee: true,
2326
- steps: [{
2327
- id: 1,
2328
- fromBlockchain: 'OSMOSIS',
2329
- fromSymbol: 'JUNO',
2330
- fromSymbolAddress: 'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
2331
- fromDecimals: 6,
2332
- fromAmountPrecision: null,
2333
- fromAmountMinValue: null,
2334
- swapperLogo: '',
2335
- swapperType: '',
2336
- fromAmountMaxValue: null,
2337
- toBlockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
2338
- fromBlockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
2339
- toBlockchain: 'OSMOSIS',
2340
- fromLogo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
2341
- toSymbol: 'OSMO',
2342
- toSymbolAddress: null,
2343
- toDecimals: 6,
2344
- toLogo: 'https://api.rango.exchange/i/mJQPS2',
2345
- startTransactionTime: 1673164519916,
2346
- swapperId: 'Osmosis',
2347
- expectedOutputAmountHumanReadable: '1.540670',
2348
- outputAmount: '1.540658',
2349
- status: 'success',
2350
- networkStatus: null,
2351
- executedTransactionId: '0f8f17eecc863c2d6be65ef52cfe3128ff3cd7baeddf133160bea8ccdfbf876b',
2352
- explorerUrl: [{
2353
- url: 'https://www.mintscan.io/osmosis/txs/0f8f17eecc863c2d6be65ef52cfe3128ff3cd7baeddf133160bea8ccdfbf876b',
2354
- description: null
2355
- }],
2356
- cosmosTransaction: {
2357
- type: rangoSdk.TransactionType.COSMOS,
2358
- fromWalletAddress: 'osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl',
2359
- blockChain: 'OSMOSIS',
2360
- data: {
2361
- chainId: 'osmosis-1',
2362
- account_number: 102721,
2363
- sequence: '308',
2364
- msgs: [{
2365
- __type: 'OsmosisSwapMessage',
2366
- type: 'osmosis/gamm/swap-exact-amount-in',
2367
- value: {
2368
- sender: 'osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl',
2369
- routes: [{
2370
- pool_id: '498',
2371
- token_out_denom: 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2'
2372
- }, {
2373
- pool_id: '8',
2374
- token_out_denom: 'ibc/7C4D60AA95E5A7558B0A364860979CA34B7FF8AAF255B87AF9E879374470CEC0'
2375
- }, {
2376
- pool_id: '7',
2377
- token_out_denom: 'uosmo'
2378
- }],
2379
- token_in: {
2380
- denom: 'ibc/46B44899322F3CD854D2D46DEEF881958467CDD4B3B10086DA49296BBED94BED',
2381
- amount: '1000000'
2382
- },
2383
- token_out_min_amount: '1525264'
2384
- }
2385
- }],
2386
- protoMsgs: [{
2387
- type_url: '/osmosis.gamm.v1beta1.MsgSwapExactAmountIn',
2388
- value: [10, 43, 111, 115, 109, 111, 49, 117, 110, 102, 50, 114, 99, 121, 116, 106, 120, 102, 112, 122, 56, 120, 56, 97, 114, 54, 51, 104, 52, 113, 101, 102, 116, 97, 100, 112, 116, 103, 53, 116, 48, 110, 113, 99, 108, 18, 73, 8, -14, 3, 18, 68, 105, 98, 99, 47, 50, 55, 51, 57, 52, 70, 66, 48, 57, 50, 68, 50, 69, 67, 67, 68, 53, 54, 49, 50, 51, 67, 55, 52, 70, 51, 54, 69, 52, 67, 49, 70, 57, 50, 54, 48, 48, 49, 67, 69, 65, 68, 65, 57, 67, 65, 57, 55, 69, 65, 54, 50, 50, 66, 50, 53, 70, 52, 49, 69, 53, 69, 66, 50, 18, 72, 8, 8, 18, 68, 105, 98, 99, 47, 55, 67, 52, 68, 54, 48, 65, 65, 57, 53, 69, 53, 65, 55, 53, 53, 56, 66, 48, 65, 51, 54, 52, 56, 54, 48, 57, 55, 57, 67, 65, 51, 52, 66, 55, 70, 70, 56, 65, 65, 70, 50, 53, 53, 66, 56, 55, 65, 70, 57, 69, 56, 55, 57, 51, 55, 52, 52, 55, 48, 67, 69, 67, 48, 18, 9, 8, 7, 18, 5, 117, 111, 115, 109, 111, 26, 79, 10, 68, 105, 98, 99, 47, 52, 54, 66, 52, 52, 56, 57, 57, 51, 50, 50, 70, 51, 67, 68, 56, 53, 52, 68, 50, 68, 52, 54, 68, 69, 69, 70, 56, 56, 49, 57, 53, 56, 52, 54, 55, 67, 68, 68, 52, 66, 51, 66, 49, 48, 48, 56, 54, 68, 65, 52, 57, 50, 57, 54, 66, 66, 69, 68, 57, 52, 66, 69, 68, 18, 7, 49, 48, 48, 48, 48, 48, 48, 34, 7, 49, 53, 50, 53, 50, 54, 52]
2389
- }],
2390
- memo: '',
2391
- source: null,
2392
- fee: {
2393
- gas: '900000',
2394
- amount: [{
2395
- denom: 'uosmo',
2396
- amount: '0'
2397
- }]
2398
- },
2399
- signType: 'AMINO',
2400
- rpcUrl: ''
2401
- },
2402
- rawTransfer: null
2403
- },
2404
- solanaTransaction: null,
2405
- evmTransaction: null,
2406
- evmApprovalTransaction: null,
2407
- transferTransaction: null,
2408
- diagnosisUrl: null,
2409
- internalSteps: null
2410
- }]
2411
- }];
1836
+ });
1837
+ return result.sort((a, b) => Number(b.swap.creationTime) - Number(a.swap.creationTime));
1838
+ };
1839
+
2412
1840
  function HistoryPage() {
1841
+ const setSelectedSwap = useUiStore.use.setSelectedSwap();
2413
1842
  const navigate = reactRouterDom.useNavigate();
2414
1843
  const {
2415
1844
  navigateBackFrom
2416
1845
  } = useNavigateBack();
2417
- return React__default.createElement(ui.History, {
2418
- list: pendingSwap,
2419
- onSwapClick: navigate.bind(null, navigationRoutes.swapDetails),
2420
- onBack: navigateBackFrom.bind(null, navigationRoutes.history)
1846
+ const {
1847
+ manager
1848
+ } = queueManagerReact.useManager();
1849
+ const pendingSwaps = getPendingSwaps(manager).map(_ref => {
1850
+ let {
1851
+ swap
1852
+ } = _ref;
1853
+ return swap;
1854
+ });
1855
+ return React__default.createElement(ui.History
1856
+ //todo: move PendingSwap type to rango-types
1857
+ //@ts-ignore
1858
+ , {
1859
+ //todo: move PendingSwap type to rango-types
1860
+ //@ts-ignore
1861
+ list: pendingSwaps,
1862
+ onSwapClick: requestId => {
1863
+ setSelectedSwap(requestId);
1864
+ navigate(navigationRoutes.swaps + `/${requestId}`);
1865
+ },
1866
+ onBack: navigateBackFrom.bind(null, navigationRoutes.swaps)
2421
1867
  });
2422
1868
  }
2423
1869
 
@@ -2675,7 +2121,9 @@ function ConfirmWalletsPage() {
2675
2121
  swap: bestRoute,
2676
2122
  fromAmount: fromAmount,
2677
2123
  toAmount: toAmount,
2678
- onConfirm: navigate.bind(null, navigationRoutes.confirmSwap),
2124
+ onConfirm: () => navigate(navigationRoutes.confirmSwap, {
2125
+ replace: true
2126
+ }),
2679
2127
  onChange: wallet => setSelectedWallet(wallet),
2680
2128
  confirmDisabled: confirmDisabled,
2681
2129
  handleConnectChain: wallet => handleConnectChain(wallet),
@@ -2683,475 +2131,49 @@ function ConfirmWalletsPage() {
2683
2131
  });
2684
2132
  }
2685
2133
 
2686
- //TODO: remove mock data after queue manager integration
2687
- const pendingSwap$1 = {
2688
- creationTime: '1675837879344',
2689
- finishTime: '1675842500799',
2690
- requestId: 'c40b81cd-fdac-4dad-bfef-1c7b2cff715f',
2691
- inputAmount: '2',
2692
- wallets: {
2693
- POLYGON: {
2694
- walletType: 'metamask',
2695
- address: '0x2702d89c1c8658b49c45dd460deebcc45faec03c'
2696
- },
2697
- SOLANA: {
2698
- walletType: 'phantom',
2699
- address: '9QoVnPEHj5HNL4cVicXUF8CVmyhBxTDqUUigVn3UPWwk'
2134
+ function useCopyToClipboard(resetInterval) {
2135
+ const [isCopied, setCopied] = React__default.useState(false);
2136
+ const handleCopy = React__default.useCallback(text => {
2137
+ copy(text.toString());
2138
+ setCopied(true);
2139
+ }, []);
2140
+ React__default.useEffect(() => {
2141
+ let timeout;
2142
+ if (isCopied && resetInterval) {
2143
+ timeout = setTimeout(() => setCopied(false), resetInterval);
2700
2144
  }
2701
- },
2702
- status: 'success',
2703
- isPaused: false,
2704
- extraMessage: null,
2705
- extraMessageSeverity: 'info',
2706
- extraMessageDetail: '',
2707
- extraMessageErrorCode: null,
2708
- networkStatusExtraMessage: '',
2709
- networkStatusExtraMessageDetail: '',
2710
- lastNotificationTime: null,
2711
- settings: {
2712
- slippage: '13.0',
2713
- disabledSwappersIds: ['PancakeSwapBsc', 'ThorChain', 'Horizon Bridge', 'OneInchOptimism', 'OneInchGnosis', 'OneInchBsc', 'OneInchArbitrum', 'OpenOceanFantom', 'SushiHarmony', 'SushiArbitrum', 'OkcSwap', 'CherrySwap', 'Osmosis', 'SolanaWrapper', 'Jupiter', 'stargate', 'AnySwap', 'Satellite', 'Diffusion', 'JunoSwap', 'PangolinSwap', 'MMFinance', 'CronaSwap', 'VVSFinance', 'MDexHeco', 'ParaSwap Polygon', 'ParaSwap Bsc', 'ParaSwap Avalanche', 'AuroraSwap', 'Across', 'Arbitrum Bridge', 'TrisolarisSwap', 'Polygon Bridge', 'SpookySwap', 'Rainbow Bridge', 'Lido', 'Symbiosis', 'Avalanche Bridge', 'VoltageSwap', 'Stargate Aggregator', 'Across Aggregator', 'THORChain Aggregator', 'CBridge Aggregator', 'AnySwap Aggregator', 'Hyphen Aggregator', 'Optimism Bridge', 'OolongSwap', 'QuickSwap', 'StellaSwap', 'Hyphen', 'ViperSwap', 'cBridge v2.0', 'FinKujira', 'Hop', 'BeamSwap', 'SolarbeamSwap', 'Sifchain', 'Wormhole', 'EthUniSwapV2', 'OneInchPolygon'],
2714
- disabledSwappersGroups: []
2715
- },
2716
- simulationResult: {
2717
- outputAmount: '0.084249153',
2718
- swaps: [{
2719
- swapperId: 'QuickSwap',
2720
- swapperLogo: 'https://api.rango.exchange/swappers/quick-swap.png',
2721
- swapperType: 'DEX',
2722
- from: {
2723
- symbol: 'USDC',
2724
- logo: 'https://api.rango.exchange/i/ns0AMf',
2725
- blockchainLogo: 'https://api.rango.exchange/blockchains/polygon.svg',
2726
- address: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
2727
- blockchain: 'POLYGON',
2728
- decimals: 6,
2729
- usdPrice: 0.999792
2730
- },
2731
- to: {
2732
- symbol: 'SOL',
2733
- logo: 'https://api.rango.exchange/i/YhJ1nK',
2734
- blockchainLogo: 'https://api.rango.exchange/blockchains/polygon.svg',
2735
- address: '0xd93f7e271cb87c23aaa73edc008a79646d1f9912',
2736
- blockchain: 'POLYGON',
2737
- decimals: 9,
2738
- usdPrice: 23.700913462284028
2739
- },
2740
- fromAmount: '2.000000',
2741
- fromAmountPrecision: null,
2742
- fromAmountMinValue: null,
2743
- fromAmountMaxValue: null,
2744
- fromAmountRestrictionType: null,
2745
- toAmount: '0.084249153',
2746
- fee: [{
2747
- asset: {
2748
- blockchain: 'POLYGON',
2749
- symbol: 'USDC',
2750
- address: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174'
2751
- },
2752
- expenseType: 'DECREASE_FROM_OUTPUT',
2753
- amount: '0.006000000000000000124900090270330110797658562660217285156250000000',
2754
- name: 'Swapper Fee'
2755
- }, {
2756
- asset: {
2757
- blockchain: 'POLYGON',
2758
- symbol: 'MATIC',
2759
- address: null
2760
- },
2761
- expenseType: 'FROM_SOURCE_WALLET',
2762
- amount: '0.032758180196833611',
2763
- name: 'Network Fee'
2764
- }],
2765
- estimatedTimeInSeconds: 60,
2766
- swapChainType: 'INTER_CHAIN',
2767
- routes: [{
2768
- nodes: [{
2769
- nodes: [{
2770
- marketName: 'QuickSwap',
2771
- marketId: 'QuickSwap',
2772
- percent: 1
2773
- }],
2774
- from: 'USDC',
2775
- fromLogo: '',
2776
- fromAddress: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
2777
- fromBlockchain: 'POLYGON',
2778
- to: 'SOL',
2779
- toLogo: '',
2780
- toAddress: '0xd93f7e271cb87c23aaa73edc008a79646d1f9912',
2781
- toBlockchain: 'POLYGON'
2782
- }]
2783
- }],
2784
- recommendedSlippage: null,
2785
- warnings: [],
2786
- timeStat: {
2787
- min: 7,
2788
- avg: 59,
2789
- max: 736
2790
- },
2791
- includesDestinationTx: false,
2792
- internalSwaps: null,
2793
- maxRequiredSign: 1,
2794
- fromAsset: {
2795
- blockchain: 'POLYGON',
2796
- symbol: 'USDC',
2797
- address: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174'
2798
- },
2799
- toAsset: {
2800
- blockchain: 'POLYGON',
2801
- symbol: 'SOL',
2802
- address: '0xd93f7e271cb87c23aaa73edc008a79646d1f9912'
2803
- }
2804
- }, {
2805
- swapperId: 'Wormhole',
2806
- swapperLogo: 'https://api.rango.exchange/swappers/wormhole.png',
2807
- swapperType: 'BRIDGE',
2808
- from: {
2809
- symbol: 'SOL',
2810
- logo: 'https://api.rango.exchange/i/YhJ1nK',
2811
- blockchainLogo: 'https://api.rango.exchange/blockchains/polygon.svg',
2812
- address: '0xd93f7e271cb87c23aaa73edc008a79646d1f9912',
2813
- blockchain: 'POLYGON',
2814
- decimals: 9,
2815
- usdPrice: 23.700913462284028
2816
- },
2817
- to: {
2818
- symbol: 'SOL',
2819
- logo: 'https://api.rango.exchange/i/eLHYrb',
2820
- blockchainLogo: 'https://api.rango.exchange/blockchains/solana.svg',
2821
- address: null,
2822
- blockchain: 'SOLANA',
2823
- decimals: 9,
2824
- usdPrice: 23.97093428787272
2825
- },
2826
- fromAmount: '0.084249153',
2827
- fromAmountPrecision: null,
2828
- fromAmountMinValue: null,
2829
- fromAmountMaxValue: null,
2830
- fromAmountRestrictionType: null,
2831
- toAmount: '0.084249153',
2832
- fee: [{
2833
- asset: {
2834
- blockchain: 'POLYGON',
2835
- symbol: 'MATIC',
2836
- address: null
2837
- },
2838
- expenseType: 'FROM_SOURCE_WALLET',
2839
- amount: '0.042205949048288939',
2840
- name: 'Network Fee'
2841
- }, {
2842
- asset: {
2843
- blockchain: 'SOLANA',
2844
- symbol: 'SOL',
2845
- address: null
2846
- },
2847
- expenseType: 'FROM_DESTINATION_WALLET',
2848
- amount: '0.000070000',
2849
- name: 'Swapper Fee'
2850
- }],
2851
- estimatedTimeInSeconds: 150,
2852
- swapChainType: 'INTRA_CHAIN',
2853
- routes: null,
2854
- recommendedSlippage: null,
2855
- warnings: [],
2856
- timeStat: {
2857
- min: 42,
2858
- avg: 146,
2859
- max: 5582
2860
- },
2861
- includesDestinationTx: true,
2862
- internalSwaps: null,
2863
- maxRequiredSign: 6,
2864
- fromAsset: {
2865
- blockchain: 'POLYGON',
2866
- symbol: 'SOL',
2867
- address: '0xd93f7e271cb87c23aaa73edc008a79646d1f9912'
2868
- },
2869
- toAsset: {
2870
- blockchain: 'SOLANA',
2871
- symbol: 'SOL',
2872
- address: null
2873
- }
2874
- }],
2875
- resultType: 'OK'
2876
- },
2877
- validateBalanceOrFee: true,
2878
- steps: [{
2879
- id: 1,
2880
- fromBlockchain: 'POLYGON',
2881
- fromSymbol: 'USDC',
2882
- fromSymbolAddress: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
2883
- fromDecimals: 6,
2884
- fromAmountPrecision: null,
2885
- fromAmountMinValue: null,
2886
- fromAmountMaxValue: null,
2887
- toBlockchain: 'POLYGON',
2888
- fromLogo: 'https://api.rango.exchange/i/ns0AMf',
2889
- fromBlockchainLogo: 'https://api.rango.exchange/blockchains/polygon.svg',
2890
- toBlockchainLogo: 'https://api.rango.exchange/blockchains/solana.svg',
2891
- toSymbol: 'SOL',
2892
- toSymbolAddress: '0xd93f7e271cb87c23aaa73edc008a79646d1f9912',
2893
- toDecimals: 9,
2894
- toLogo: 'https://api.rango.exchange/i/YhJ1nK',
2895
- startTransactionTime: 1675837904769,
2896
- swapperId: 'QuickSwap',
2897
- swapperLogo: 'https://api.rango.exchange/swappers/quick-swap.png',
2898
- expectedOutputAmountHumanReadable: '0.084249153',
2899
- outputAmount: '0.084206923',
2900
- status: 'success',
2901
- networkStatus: 'networkChanged',
2902
- executedTransactionId: '0xb2a6b1b497b660bd58d8583d05425ea1b89fa19efc18c9b3baa501abf5f8cee9',
2903
- externalTransactionId: null,
2904
- explorerUrl: [{
2905
- url: 'https://polygonscan.com/tx/0xb2a6b1b497b660bd58d8583d05425ea1b89fa19efc18c9b3baa501abf5f8cee9',
2906
- description: 'swap'
2907
- }],
2908
- trackingCode: null,
2909
- cosmosTransaction: null,
2910
- solanaTransaction: null,
2911
- evmTransaction: {
2912
- type: 'EVM',
2913
- blockChain: 'POLYGON',
2914
- isApprovalTx: false,
2915
- from: '0x2702d89c1c8658b49c45dd460deebcc45faec03c',
2916
- to: '0x38F7Aa5370439E879370E24AdD063a11Bd74610D',
2917
- spender: null,
2918
- data: '0xa60fdfb60000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000d93f7e271cb87c23aaa73edc008a79646d1f991200000000000000000000000000000000000000000000000000000000001e84800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a5e0829caced8ffdd4de3c43696c57f7d7a678ff0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000010438ed173900000000000000000000000000000000000000000000000000000000001e848000000000000000000000000000000000000000000000000000000000045e6b7b00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000038f7aa5370439e879370e24add063a11bd74610d0000000000000000000000000000000000000000000000000000000063e348d800000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000d93f7e271cb87c23aaa73edc008a79646d1f991200000000000000000000000000000000000000000000000000000000',
2919
- value: null,
2920
- gasLimit: '0x62f20',
2921
- gasPrice: '247516799843',
2922
- nonce: null
2923
- },
2924
- evmApprovalTransaction: null,
2925
- transferTransaction: null,
2926
- diagnosisUrl: null,
2927
- internalSteps: null
2928
- }, {
2929
- id: 2,
2930
- fromBlockchain: 'POLYGON',
2931
- fromSymbol: 'SOL',
2932
- fromSymbolAddress: '0xd93f7e271cb87c23aaa73edc008a79646d1f9912',
2933
- fromDecimals: 9,
2934
- fromAmountPrecision: null,
2935
- fromAmountMinValue: null,
2936
- fromAmountMaxValue: null,
2937
- toBlockchain: 'SOLANA',
2938
- fromLogo: 'https://api.rango.exchange/i/YhJ1nK',
2939
- fromBlockchainLogo: 'https://api.rango.exchange/blockchains/polygon.svg',
2940
- toBlockchainLogo: 'https://api.rango.exchange/blockchains/solana.svg',
2941
- toSymbol: 'SOL',
2942
- toSymbolAddress: null,
2943
- toDecimals: 9,
2944
- toLogo: 'https://api.rango.exchange/i/eLHYrb',
2945
- startTransactionTime: 1675842459076,
2946
- swapperId: 'Wormhole',
2947
- swapperLogo: 'https://api.rango.exchange/swappers/wormhole.png',
2948
- expectedOutputAmountHumanReadable: '0.084249153',
2949
- outputAmount: '0.08420692',
2950
- status: 'failed',
2951
- networkStatus: 'networkChanged',
2952
- executedTransactionId: '5MGhqrNRwRKkHGU11S37mgF7LscXWhAvwBeAWEdxcmV9AD6bNqig6iCCzC4mKBH41JBexKb6kj4axLfcH4XZQsT9',
2953
- externalTransactionId: null,
2954
- explorerUrl: [{
2955
- url: 'https://solscan.io/tx/2wvqHEy5hCDfpwZM5sZhBpFxXZL7p6PRqpDdCZGpGF85deGQU9oiBC9Jgoszdo8x9hjkySktGPYzubcXP8pxW3H4',
2956
- description: 'Associate Token'
2957
- }, {
2958
- url: 'https://polygonscan.com/tx/0xcdd0c684fc203d41a0eaacfba2201ab0a48845bb6d0f0805fb4a70a0f971a599',
2959
- description: 'Transfer'
2960
- }, {
2961
- url: 'https://solscan.io/tx/5rc5EHfMrChB749RsJew1ze35yQMddafkQqy5JFqcdKPJ6j2NiggGT7UDmFDAXzP2AwHGyFj2XjaYr7RQjjc1KmH',
2962
- description: 'Verify vaa 1'
2963
- }, {
2964
- url: 'https://solscan.io/tx/5xNgHvdzu63fmF7uojrHuqcHC3NgErpdGiSg38X7KZ7EEjTyPWt8W1QUtuyUFcNcSjGkFGrGzfnkRUbe4Hj6oY2v',
2965
- description: 'Verify vaa 2'
2966
- }, {
2967
- url: 'https://solscan.io/tx/3FnXLYwwpc93o2TyjKNDfiBcRDZ9W1qJVdmCjTRw3kz4Jrwjr5zQzLSbsbbBzqFNMSxBFcUDaiQ7pP4DL5coUGq',
2968
- description: 'Post vaa'
2969
- }, {
2970
- url: 'https://solscan.io/tx/5MGhqrNRwRKkHGU11S37mgF7LscXWhAvwBeAWEdxcmV9AD6bNqig6iCCzC4mKBH41JBexKb6kj4axLfcH4XZQsT9',
2971
- description: 'Redeem'
2972
- }],
2973
- trackingCode: null,
2974
- cosmosTransaction: null,
2975
- solanaTransaction: {
2976
- type: 'SOLANA',
2977
- blockChain: 'SOLANA',
2978
- from: '9QoVnPEHj5HNL4cVicXUF8CVmyhBxTDqUUigVn3UPWwk',
2979
- identifier: 'redeem',
2980
- instructions: [{
2981
- keys: [{
2982
- pubkey: '9QoVnPEHj5HNL4cVicXUF8CVmyhBxTDqUUigVn3UPWwk',
2983
- isSigner: true,
2984
- isWritable: true
2985
- }, {
2986
- pubkey: 'DapiQYH3BGonhN8cngWcXQ6SrqSm3cwysoznoHr6Sbsx',
2987
- isSigner: false,
2988
- isWritable: false
2989
- }, {
2990
- pubkey: 'Wf8aqunuZ9y1tprCihMateij299Pa57XL15a6EQz9qt',
2991
- isSigner: false,
2992
- isWritable: false
2993
- }, {
2994
- pubkey: 'FTWSFuqyc6B5BbarBzuHdBofA2ks12eyRNmUfKmDiUN1',
2995
- isSigner: false,
2996
- isWritable: true
2997
- }, {
2998
- pubkey: 'J6fNPeeJc1E2zDRUtvD9aaC9kBsEq7JaFr1oa97DAJhj',
2999
- isSigner: false,
3000
- isWritable: false
3001
- }, {
3002
- pubkey: '8nUPRxuXUJPbWiCbqCPrVLkmXqR8LdifLrRW3VjCQDhZ',
3003
- isSigner: false,
3004
- isWritable: true
3005
- }, {
3006
- pubkey: '8nUPRxuXUJPbWiCbqCPrVLkmXqR8LdifLrRW3VjCQDhZ',
3007
- isSigner: false,
3008
- isWritable: true
3009
- }, {
3010
- pubkey: '2nQNF8F9LLWMqdjymiLK2u8HoHMvYa4orCXsp3w65fQ2',
3011
- isSigner: false,
3012
- isWritable: true
3013
- }, {
3014
- pubkey: 'So11111111111111111111111111111111111111112',
3015
- isSigner: false,
3016
- isWritable: false
3017
- }, {
3018
- pubkey: 'GugU1tP7doLeTw9hQP51xRJyS8Da1fWxuiy2rVrnMD2m',
3019
- isSigner: false,
3020
- isWritable: false
3021
- }, {
3022
- pubkey: 'SysvarRent111111111111111111111111111111111',
3023
- isSigner: false,
3024
- isWritable: false
3025
- }, {
3026
- pubkey: '11111111111111111111111111111111',
3027
- isSigner: false,
3028
- isWritable: false
3029
- }, {
3030
- pubkey: 'worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth',
3031
- isSigner: false,
3032
- isWritable: false
3033
- }, {
3034
- pubkey: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
3035
- isSigner: false,
3036
- isWritable: false
3037
- }],
3038
- programId: 'wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb',
3039
- data: [2]
3040
- }, {
3041
- keys: [{
3042
- pubkey: '9QoVnPEHj5HNL4cVicXUF8CVmyhBxTDqUUigVn3UPWwk',
3043
- isSigner: true,
3044
- isWritable: true
3045
- }, {
3046
- pubkey: '72pK2FqwMYPr9ajAhzLNQq8e5S2Rf33MGpVXxdXwCT6V',
3047
- isSigner: true,
3048
- isWritable: true
3049
- }],
3050
- programId: '11111111111111111111111111111111',
3051
- data: [0, 0, 0, 0, -16, 29, 31, 0, 0, 0, 0, 0, -91, 0, 0, 0, 0, 0, 0, 0, 6, -35, -10, -31, -41, 101, -95, -109, -39, -53, -31, 70, -50, -21, 121, -84, 28, -76, -123, -19, 95, 91, 55, -111, 58, -116, -11, -123, 126, -1, 0, -87]
3052
- }, {
3053
- keys: [{
3054
- pubkey: '72pK2FqwMYPr9ajAhzLNQq8e5S2Rf33MGpVXxdXwCT6V',
3055
- isSigner: false,
3056
- isWritable: true
3057
- }, {
3058
- pubkey: 'So11111111111111111111111111111111111111112',
3059
- isSigner: false,
3060
- isWritable: false
3061
- }, {
3062
- pubkey: '9QoVnPEHj5HNL4cVicXUF8CVmyhBxTDqUUigVn3UPWwk',
3063
- isSigner: false,
3064
- isWritable: false
3065
- }, {
3066
- pubkey: 'SysvarRent111111111111111111111111111111111',
3067
- isSigner: false,
3068
- isWritable: false
3069
- }],
3070
- programId: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
3071
- data: [1]
3072
- }, {
3073
- keys: [{
3074
- pubkey: '8nUPRxuXUJPbWiCbqCPrVLkmXqR8LdifLrRW3VjCQDhZ',
3075
- isSigner: false,
3076
- isWritable: true
3077
- }, {
3078
- pubkey: '72pK2FqwMYPr9ajAhzLNQq8e5S2Rf33MGpVXxdXwCT6V',
3079
- isSigner: false,
3080
- isWritable: true
3081
- }, {
3082
- pubkey: '9QoVnPEHj5HNL4cVicXUF8CVmyhBxTDqUUigVn3UPWwk',
3083
- isSigner: true,
3084
- isWritable: false
3085
- }],
3086
- programId: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
3087
- data: [3, 72, -27, 4, 5, 0, 0, 0, 0]
3088
- }, {
3089
- keys: [{
3090
- pubkey: '72pK2FqwMYPr9ajAhzLNQq8e5S2Rf33MGpVXxdXwCT6V',
3091
- isSigner: false,
3092
- isWritable: true
3093
- }, {
3094
- pubkey: '9QoVnPEHj5HNL4cVicXUF8CVmyhBxTDqUUigVn3UPWwk',
3095
- isSigner: false,
3096
- isWritable: true
3097
- }, {
3098
- pubkey: '9QoVnPEHj5HNL4cVicXUF8CVmyhBxTDqUUigVn3UPWwk',
3099
- isSigner: true,
3100
- isWritable: false
3101
- }],
3102
- programId: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
3103
- data: [9]
3104
- }],
3105
- recentBlockhash: '2wBCvR3jVNj6wzL8vHSuqTRtxBYiwhtoY6Gkp6WaBxSG',
3106
- signatures: [{
3107
- publicKey: '72pK2FqwMYPr9ajAhzLNQq8e5S2Rf33MGpVXxdXwCT6V',
3108
- signature: [-116, 17, -5, 86, -122, 120, -7, -53, -29, -15, -70, -100, 16, 48, 113, -42, 8, 126, 75, -13, 63, -31, -17, 1, 74, 85, 77, 90, 98, -15, 104, 63, 4, -74, 45, -3, -3, -117, -24, -56, 20, -89, -40, 33, 125, -120, -44, -75, 17, 69, 20, -48, 106, 48, 16, -19, 83, 123, -77, 93, -20, -27, -77, 7]
3109
- }],
3110
- serializedMessage: null
3111
- },
3112
- evmTransaction: null,
3113
- evmApprovalTransaction: null,
3114
- transferTransaction: null,
3115
- diagnosisUrl: null,
3116
- internalSteps: [{
3117
- name: 'associate token address',
3118
- state: 'SUCCESSED',
3119
- current: false
3120
- }, {
3121
- name: 'transfer',
3122
- state: 'SUCCESSED',
3123
- current: false
3124
- }, {
3125
- name: 'signed vaa',
3126
- state: 'SUCCESSED',
3127
- current: false
3128
- }, {
3129
- name: 'verify vaa#1',
3130
- state: 'SUCCESSED',
3131
- current: false
3132
- }, {
3133
- name: 'verify vaa#2',
3134
- state: 'SUCCESSED',
3135
- current: false
3136
- }, {
3137
- name: 'post vaa',
3138
- state: 'SUCCESSED',
3139
- current: false
3140
- }, {
3141
- name: 'redeem',
3142
- state: 'SUCCESSED',
3143
- current: true
3144
- }]
3145
- }]
3146
- };
2145
+ return () => {
2146
+ clearTimeout(timeout);
2147
+ };
2148
+ }, [isCopied, resetInterval]);
2149
+ return [isCopied, handleCopy];
2150
+ }
3147
2151
 
3148
2152
  function SwapDetailsPage() {
2153
+ const selectedSwapRequestId = useUiStore.use.selectedSwapRequestId();
3149
2154
  const {
3150
2155
  navigateBackFrom
3151
2156
  } = useNavigateBack();
2157
+ const {
2158
+ manager
2159
+ } = queueManagerReact.useManager();
2160
+ const [isCopied, handleCopy] = useCopyToClipboard(2000);
2161
+ const pendingSwaps = getPendingSwaps(manager);
2162
+ const selectedSwap = pendingSwaps.find(_ref => {
2163
+ let {
2164
+ swap
2165
+ } = _ref;
2166
+ return swap.requestId === selectedSwapRequestId;
2167
+ })?.swap;
3152
2168
  return React__default.createElement(ui.SwapHistory, {
3153
2169
  onBack: navigateBackFrom.bind(null, navigationRoutes.swapDetails),
3154
- pendingSwap: pendingSwap$1
2170
+ //todo: move PendingSwap type to rango-types
2171
+ //@ts-ignore
2172
+ pendingSwap: selectedSwap,
2173
+ onCopy: handleCopy,
2174
+ isCopied: isCopied,
2175
+ //todo: implement swap cancellation (move queueManager logic to queueManager/rango-preset)
2176
+ onCancel: requestId => console.log(requestId)
3155
2177
  });
3156
2178
  }
3157
2179
 
@@ -3185,8 +2207,11 @@ const AppRoutes = () => reactRouterDom.useRoutes([{
3185
2207
  path: navigationRoutes.liquiditySources,
3186
2208
  element: React__default.createElement(LiquiditySourcePage, null)
3187
2209
  }, {
3188
- path: navigationRoutes.history,
2210
+ path: navigationRoutes.swaps,
3189
2211
  element: React__default.createElement(HistoryPage, null)
2212
+ }, {
2213
+ path: navigationRoutes.swapDetails,
2214
+ element: React__default.createElement(SwapDetailsPage, null)
3190
2215
  }, {
3191
2216
  path: navigationRoutes.wallets,
3192
2217
  element: React__default.createElement(WalletsPage, null)
@@ -3196,9 +2221,6 @@ const AppRoutes = () => reactRouterDom.useRoutes([{
3196
2221
  }, {
3197
2222
  path: navigationRoutes.confirmWallets,
3198
2223
  element: React__default.createElement(ConfirmWalletsPage, null)
3199
- }, {
3200
- path: navigationRoutes.swapDetails,
3201
- element: React__default.createElement(SwapDetailsPage, null)
3202
2224
  }]);
3203
2225
 
3204
2226
  const Header$1 = /*#__PURE__*/ui.styled('div', {