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