@rango-dev/widget-embedded 0.1.16-next.2 → 0.1.16-next.21

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 (50) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/QueueManager.d.ts.map +1 -1
  3. package/dist/components/Footer.d.ts +111 -1
  4. package/dist/components/Footer.d.ts.map +1 -1
  5. package/dist/components/Layout.d.ts.map +1 -1
  6. package/dist/components/RoutesOverview.d.ts +111 -1
  7. package/dist/components/RoutesOverview.d.ts.map +1 -1
  8. package/dist/components/SwapDetailsPlaceholder.d.ts +111 -1
  9. package/dist/components/SwapDetailsPlaceholder.d.ts.map +1 -1
  10. package/dist/components/TokenInfo.d.ts.map +1 -1
  11. package/dist/hooks/useTheme.d.ts.map +1 -1
  12. package/dist/index.d.ts +1 -2
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  15. package/dist/pages/SettingsPage.d.ts +2 -1
  16. package/dist/pages/SettingsPage.d.ts.map +1 -1
  17. package/dist/pages/WalletsPage.d.ts.map +1 -1
  18. package/dist/store/wallets.d.ts.map +1 -1
  19. package/dist/types/config.d.ts +11 -1
  20. package/dist/types/config.d.ts.map +1 -1
  21. package/dist/utils/common.d.ts +0 -1
  22. package/dist/utils/common.d.ts.map +1 -1
  23. package/dist/utils/wallets.d.ts +2 -2
  24. package/dist/utils/wallets.d.ts.map +1 -1
  25. package/dist/widget-embedded.cjs.development.js +127 -159
  26. package/dist/widget-embedded.cjs.development.js.map +1 -1
  27. package/dist/widget-embedded.cjs.production.min.js +127 -159
  28. package/dist/widget-embedded.cjs.production.min.js.map +1 -1
  29. package/dist/widget-embedded.esm.js +129 -156
  30. package/dist/widget-embedded.esm.js.map +1 -1
  31. package/package.json +16 -13
  32. package/src/QueueManager.tsx +4 -1
  33. package/src/components/AppRoutes.tsx +1 -1
  34. package/src/components/BottomLogo.tsx +1 -1
  35. package/src/components/Layout.tsx +23 -17
  36. package/src/components/RoutesOverview.tsx +4 -4
  37. package/src/components/TokenInfo.tsx +13 -12
  38. package/src/components/TokenPreview.tsx +9 -9
  39. package/src/components/warnings/BalanceErrors.tsx +2 -2
  40. package/src/components/warnings/MinRequiredSlippage.tsx +2 -2
  41. package/src/hooks/useTheme.ts +46 -63
  42. package/src/index.tsx +1 -7
  43. package/src/pages/ConfirmSwapPage.tsx +38 -28
  44. package/src/pages/SettingsPage.tsx +4 -2
  45. package/src/pages/SwapDetailsPage.tsx +1 -1
  46. package/src/pages/WalletsPage.tsx +6 -2
  47. package/src/store/wallets.ts +13 -11
  48. package/src/types/config.ts +8 -1
  49. package/src/utils/common.ts +0 -21
  50. package/src/utils/wallets.ts +7 -15
@@ -1,4 +1,4 @@
1
- import { WalletState, InfoCircleIcon, Typography, Button, Image, Spacer, styled, ChevronRightIcon, GasIcon, Alert, ConfirmSwap, LoadingFailedAlert, History, AngleDownIcon, TextField, Tooltip, RetryIcon, HistoryIcon, SettingsIcon, Header as Header$1, VerticalSwapIcon, BestRoute, LiquiditySourcesSelector, BlockchainSelector, TokenSelector, Settings, SecondaryPage, Spinner, Wallet, useCopyToClipboard, SwapHistory, AddWalletIcon, globalCss, createTheme, SwapContainer } from '@rango-dev/ui';
1
+ import { WalletState, InfoCircleIcon, Typography, Button, Image, Divider, styled, ChevronRightIcon, GasIcon, Alert, ConfirmSwap, LoadingFailedAlert, History, AngleDownIcon, TextField, Tooltip, RetryIcon, HistoryIcon, SettingsIcon, Header as Header$1, VerticalSwapIcon, BestRoute, LiquiditySourcesSelector, BlockchainSelector, TokenSelector, Settings, SecondaryPage, Spinner, Wallet, useCopyToClipboard, SwapHistory, AddWalletIcon, globalCss, generateRangeColors, createTheme, SwapContainer } from '@rango-dev/ui';
2
2
  import React, { useRef, useEffect, Fragment, useState, useLayoutEffect, useMemo } from 'react';
3
3
  import { useInRouterContext, MemoryRouter } from 'react-router';
4
4
  import { PendingSwapNetworkStatus, useQueueManager, calculatePendingSwap, getCurrentStep, getCurrentBlockchainOfOrNull, getRelatedWalletOrNull, cancelSwap, makeQueueDefinition, checkWaitingForNetworkChange } from '@rango-dev/queue-manager-rango-preset';
@@ -8,8 +8,7 @@ import { create } from 'zustand';
8
8
  import BigNumber, { BigNumber as BigNumber$1 } from 'bignumber.js';
9
9
  import { persist, subscribeWithSelector } from 'zustand/middleware';
10
10
  import { RangoClient, isEvmBlockchain as isEvmBlockchain$1 } from 'rango-sdk';
11
- import { Network, isEvmAddress, KEPLR_COMPATIBLE_WALLETS, detectInstallLink, WalletType, getCosmosExperimentalChainInfo, detectMobileScreens, convertEvmBlockchainMetaToEvmChainInfo } from '@rango-dev/wallets-shared';
12
- export { WalletType } from '@rango-dev/wallets-shared';
11
+ import { Network, isEvmAddress, KEPLR_COMPATIBLE_WALLETS, detectInstallLink, WalletTypes, getCosmosExperimentalChainInfo, detectMobileScreens, convertEvmBlockchainMetaToEvmChainInfo } from '@rango-dev/wallets-shared';
13
12
  import { readAccountAddress, useWallets, Provider as Provider$1, Events } from '@rango-dev/wallets-core';
14
13
  import { shallow } from 'zustand/shallow';
15
14
  import { allProviders } from '@rango-dev/provider-all';
@@ -29,24 +28,6 @@ function removeDuplicateFrom(array) {
29
28
  function areEqual(array1, array2) {
30
29
  return array1.length === array2.length && array1.every((v, i) => v === array2[i]);
31
30
  }
32
- function shadeColor(color, percent) {
33
- var R = parseInt(color.substring(1, 3), 16);
34
- var G = parseInt(color.substring(3, 5), 16);
35
- var B = parseInt(color.substring(5, 7), 16);
36
- R = R * (100 + percent) / 100;
37
- G = G * (100 + percent) / 100;
38
- B = B * (100 + percent) / 100;
39
- R = R < 255 ? R : 255;
40
- G = G < 255 ? G : 255;
41
- B = B < 255 ? B : 255;
42
- R = Math.round(R);
43
- G = Math.round(G);
44
- B = Math.round(B);
45
- var RR = R.toString(16).length == 1 ? '0' + R.toString(16) : R.toString(16);
46
- var GG = G.toString(16).length == 1 ? '0' + G.toString(16) : G.toString(16);
47
- var BB = B.toString(16).length == 1 ? '0' + B.toString(16) : B.toString(16);
48
- return '#' + RR + GG + BB;
49
- }
50
31
  function debounce(fn, time) {
51
32
  let timeoutId;
52
33
  return wrapper;
@@ -310,8 +291,8 @@ function getStateWallet(state) {
310
291
  return WalletState.DISCONNECTED;
311
292
  }
312
293
  }
294
+ const excludedWallets = [WalletTypes.LEAP];
313
295
  function getlistWallet(getState, getWalletInfo, list) {
314
- const excludedWallets = [WalletType.UNKNOWN, WalletType.TERRA_STATION, WalletType.LEAP];
315
296
  return list.filter(wallet => !excludedWallets.includes(wallet)).map(type => {
316
297
  const {
317
298
  name,
@@ -412,7 +393,7 @@ function getBalanceFromWallet(connectedWallets, chain, symbol, address) {
412
393
  return selectedChainWallets.map(wallet => wallet.balances?.find(balance => address !== null && balance.address === address || address === null && balance.address === address && balance.symbol === symbol) || null).filter(balance => balance !== null).sort((a, b) => parseFloat(b?.amount || '0') - parseFloat(a?.amount || '1')).find(() => true) || null;
413
394
  }
414
395
  function isAccountAndWalletMatched(account, connectedWallet) {
415
- return account.address === connectedWallet.address && account.chain === connectedWallet.chain && account.walletType === connectedWallet.walletType;
396
+ return account.address === connectedWallet.address && account.chain === connectedWallet.chain;
416
397
  }
417
398
  function makeBalanceFor(wallet, retrivedBalance, tokens) {
418
399
  const {
@@ -493,7 +474,9 @@ const isExperimentalChain = (blockchains, wallet) => {
493
474
  return cosmosExperimentalChainInfo && !!cosmosExperimentalChainInfo[wallet];
494
475
  };
495
476
  const getKeplrCompatibleConnectedWallets = selectableWallets => {
496
- const connectedWalletTypes = new Set(selectableWallets.map(a => a.walletType.toString()));
477
+ const connectedWalletTypes = new Set(selectableWallets.map(wallet => {
478
+ return wallet.walletType;
479
+ }));
497
480
  return KEPLR_COMPATIBLE_WALLETS.filter(compatibleWallet => connectedWalletTypes.has(compatibleWallet));
498
481
  };
499
482
  function getTokensWithBalance(tokens, connectedWallets) {
@@ -823,7 +806,7 @@ const useWalletsStore = /*#__PURE__*/createSelectors( /*#__PURE__*/create()( /*#
823
806
  connectWallet: accounts => {
824
807
  const getOneOfWalletsDetails = get().getOneOfWalletsDetails;
825
808
  set(state => ({
826
- connectedWallets: state.connectedWallets.concat(accounts.map(account => ({
809
+ connectedWallets: state.connectedWallets.filter(wallet => wallet.walletType !== accounts[0].walletType).concat(accounts.map(account => ({
827
810
  balances: [],
828
811
  address: account.address,
829
812
  chain: account.chain,
@@ -1359,10 +1342,10 @@ const Container = /*#__PURE__*/styled('div', {
1359
1342
  variants: {
1360
1343
  type: {
1361
1344
  filled: {
1362
- backgroundColor: '$neutrals300'
1345
+ backgroundColor: '$neutral100'
1363
1346
  },
1364
1347
  outlined: {
1365
- border: '1px solid $neutrals300'
1348
+ border: '1px solid $neutral100'
1366
1349
  }
1367
1350
  }
1368
1351
  },
@@ -1398,14 +1381,14 @@ const Container = /*#__PURE__*/styled('div', {
1398
1381
  const ImagePlaceholder = /*#__PURE__*/styled('span', {
1399
1382
  width: '24px',
1400
1383
  height: '24px',
1401
- backgroundColor: '$neutrals300',
1384
+ backgroundColor: '$neutral100',
1402
1385
  borderRadius: '99999px'
1403
1386
  });
1404
1387
  const OutputContainer = /*#__PURE__*/styled('div', {
1405
1388
  windth: '100%',
1406
1389
  height: '$48',
1407
1390
  borderRadius: '$5',
1408
- backgroundColor: '$background',
1391
+ backgroundColor: '$surface',
1409
1392
  border: '1px solid transparent',
1410
1393
  position: 'relative',
1411
1394
  display: 'flex',
@@ -1439,10 +1422,10 @@ function TokenPreview(props) {
1439
1422
  className: "head"
1440
1423
  }, React.createElement(Typography, {
1441
1424
  variant: "body2",
1442
- color: "neutrals800"
1425
+ color: "neutral800"
1443
1426
  }, props.label), React.createElement("div", null, percentageChange, props.usdValue && React.createElement(Typography, {
1444
1427
  variant: "caption",
1445
- color: "neutrals600",
1428
+ color: "neutral600",
1446
1429
  className: "usd-value"
1447
1430
  }, `$${numberToString(props.usdValue)}`))), React.createElement("div", {
1448
1431
  className: "form"
@@ -1457,8 +1440,9 @@ function TokenPreview(props) {
1457
1440
  suffix: ItemSuffix,
1458
1441
  align: "start",
1459
1442
  size: "large"
1460
- }, loadingStatus === 'success' && chain ? chain.displayName : t('Chain')), React.createElement(Spacer, {
1461
- size: 12
1443
+ }, loadingStatus === 'success' && chain ? chain.displayName : t('Chain')), React.createElement(Divider, {
1444
+ size: 12,
1445
+ direction: "horizontal"
1462
1446
  }), React.createElement(Button, {
1463
1447
  className: "selectors",
1464
1448
  variant: "outlined",
@@ -1470,8 +1454,9 @@ function TokenPreview(props) {
1470
1454
  suffix: ItemSuffix,
1471
1455
  size: "large",
1472
1456
  align: "start"
1473
- }, loadingStatus === 'success' && token ? token.symbol : t('Token')), React.createElement(Spacer, {
1474
- size: 12
1457
+ }, loadingStatus === 'success' && token ? token.symbol : t('Token')), React.createElement(Divider, {
1458
+ size: 12,
1459
+ direction: "horizontal"
1475
1460
  }), React.createElement("div", {
1476
1461
  className: "amount"
1477
1462
  }, React.createElement(OutputContainer, null, React.createElement(Typography, {
@@ -1485,8 +1470,8 @@ const Container$1 = /*#__PURE__*/styled('div', {
1485
1470
  justifyContent: 'space-between',
1486
1471
  padding: '$8',
1487
1472
  borderRadius: '$5',
1488
- backgroundColor: '$neutrals300',
1489
- color: '$neutrals800',
1473
+ backgroundColor: '$neutral100',
1474
+ color: '$neutral800',
1490
1475
  fontSize: '$12',
1491
1476
  '.routes': {
1492
1477
  display: 'flex',
@@ -1517,8 +1502,9 @@ function RoutesOverview(props) {
1517
1502
  className: "fee"
1518
1503
  }, React.createElement(GasIcon, {
1519
1504
  size: 12
1520
- }), React.createElement(Spacer, {
1521
- size: 4
1505
+ }), React.createElement(Divider, {
1506
+ size: 4,
1507
+ direction: "horizontal"
1522
1508
  }), "$", props.totalFee) : null);
1523
1509
  }
1524
1510
 
@@ -1689,9 +1675,8 @@ function MinRequiredSlippage(_ref) {
1689
1675
  } = _ref;
1690
1676
  return React.createElement(StyledMessage, {
1691
1677
  variant: "body2"
1692
- }, "We recommend you to increase slippage to at least \u00A0", minRequiredSlippage, "\u00A0 for this route.", React.createElement(Spacer, {
1693
- size: 8,
1694
- direction: "vertical"
1678
+ }, "We recommend you to increase slippage to at least \u00A0", minRequiredSlippage, "\u00A0 for this route.", React.createElement(Divider, {
1679
+ size: 8
1695
1680
  }), React.createElement(ChangeSlippageButton, null));
1696
1681
  }
1697
1682
 
@@ -1728,9 +1713,8 @@ function BalanceErrors(_ref) {
1728
1713
  className: "title",
1729
1714
  variant: "title",
1730
1715
  color: 'error'
1731
- }, "Insufficent Balance:"), React.createElement(Spacer, {
1732
- size: 8,
1733
- direction: "vertical"
1716
+ }, "Insufficent Balance:"), React.createElement(Divider, {
1717
+ size: 8
1734
1718
  }), React.createElement(List, {
1735
1719
  showListStyle: showListStyle
1736
1720
  }, messages.map((warning, index) => React.createElement(ListItem, {
@@ -1838,6 +1822,7 @@ function ConfirmSwapPage() {
1838
1822
  const inputUsdValue = useBestRouteStore.use.inputUsdValue();
1839
1823
  const outputUsdValue = useBestRouteStore.use.outputUsdValue();
1840
1824
  const setInputAmount = useBestRouteStore.use.setInputAmount();
1825
+ const [dbErrorMessage, setDbErrorMessage] = useState('');
1841
1826
  const bestRouteloadingStatus = getBestRouteStatus(fetchingBestRoute, !!fetchingBestRouteError);
1842
1827
  const {
1843
1828
  manager
@@ -1872,21 +1857,25 @@ function ConfirmSwapPage() {
1872
1857
  requiredWallets: getRequiredChains(bestRoute),
1873
1858
  selectableWallets: selectableWallets,
1874
1859
  onBack: navigateBackFrom.bind(null, navigationRoutes.confirmSwap),
1875
- onConfirm: () => {
1876
- confirmSwap?.().then(swap => {
1860
+ onConfirm: async () => {
1861
+ confirmSwap?.().then(async swap => {
1877
1862
  if (swap) {
1878
- manager?.create('swap', {
1879
- swapDetails: swap
1880
- }, {
1881
- id: swap.requestId
1882
- });
1883
- setSelectedSwap(swap.requestId);
1884
- navigate('/' + navigationRoutes.swaps + `/${swap.requestId}`, {
1885
- replace: true
1886
- });
1887
- setTimeout(() => {
1888
- setInputAmount('');
1889
- }, 0);
1863
+ try {
1864
+ await manager?.create('swap', {
1865
+ swapDetails: swap
1866
+ }, {
1867
+ id: swap.requestId
1868
+ });
1869
+ setSelectedSwap(swap.requestId);
1870
+ navigate('/' + navigationRoutes.swaps + `/${swap.requestId}`, {
1871
+ replace: true
1872
+ });
1873
+ setTimeout(() => {
1874
+ setInputAmount('');
1875
+ }, 0);
1876
+ } catch (e) {
1877
+ setDbErrorMessage('Error: ' + e?.message);
1878
+ }
1890
1879
  }
1891
1880
  });
1892
1881
  },
@@ -1907,9 +1896,8 @@ function ConfirmSwapPage() {
1907
1896
  amount: fromAmount,
1908
1897
  label: t('From'),
1909
1898
  loadingStatus: loadingMetaStatus !== 'success' ? loadingMetaStatus : bestRouteloadingStatus
1910
- }), React.createElement(Spacer, {
1911
- size: 12,
1912
- direction: "vertical"
1899
+ }), React.createElement(Divider, {
1900
+ size: 12
1913
1901
  }), React.createElement(TokenPreview, {
1914
1902
  chain: {
1915
1903
  displayName: lastStep?.to.blockchain || '',
@@ -1933,11 +1921,9 @@ function ConfirmSwapPage() {
1933
1921
  totalFee: numberToString(totalFeeInUsd, 0, 2)
1934
1922
  }),
1935
1923
  loading: fetchingConfirmedRoute,
1936
- errors: ConfirmSwapErrors(errors),
1924
+ errors: dbErrorMessage ? [dbErrorMessage, ...ConfirmSwapErrors(errors)] : ConfirmSwapErrors(errors),
1937
1925
  warnings: ConfirmSwapWarnings(warnings),
1938
- extraMessages: React.createElement(React.Fragment, null, loadingMetaStatus === 'failed' && React.createElement(LoadingFailedAlert, null), loadingMetaStatus === 'failed' && showHighSlippageWarning && React.createElement(Spacer, {
1939
- direction: "vertical"
1940
- }), showHighSlippageWarning && React.createElement(ConfirmSwapExtraMessages, {
1926
+ extraMessages: React.createElement(React.Fragment, null, loadingMetaStatus === 'failed' && React.createElement(LoadingFailedAlert, null), loadingMetaStatus === 'failed' && showHighSlippageWarning && React.createElement(Divider, null), showHighSlippageWarning && React.createElement(ConfirmSwapExtraMessages, {
1941
1927
  selectedSlippage: selectedSlippage
1942
1928
  })),
1943
1929
  confirmButtonTitle: warnings.length > 0 || errors.length > 0 ? 'Proceed anyway!' : 'Confirm swap!'
@@ -2027,10 +2013,11 @@ const Container$2 = /*#__PURE__*/styled('div', {
2027
2013
  variants: {
2028
2014
  type: {
2029
2015
  filled: {
2030
- backgroundColor: '$neutrals300'
2016
+ backgroundColor: '$neutral100'
2031
2017
  },
2032
2018
  outlined: {
2033
- border: '1px solid $neutrals300'
2019
+ border: '1px solid $neutral100',
2020
+ backgroundColor: '$surface'
2034
2021
  }
2035
2022
  }
2036
2023
  },
@@ -2078,14 +2065,14 @@ const Options = /*#__PURE__*/styled('div', {
2078
2065
  const ImagePlaceholder$1 = /*#__PURE__*/styled('span', {
2079
2066
  width: '24px',
2080
2067
  height: '24px',
2081
- backgroundColor: '$neutrals300',
2068
+ backgroundColor: '$neutral100',
2082
2069
  borderRadius: '99999px'
2083
2070
  });
2084
2071
  const OutputContainer$1 = /*#__PURE__*/styled('div', {
2085
2072
  windth: '100%',
2086
2073
  height: '$48',
2087
2074
  borderRadius: '$5',
2088
- backgroundColor: '$background',
2075
+ backgroundColor: '$surface',
2089
2076
  border: '1px solid transparent',
2090
2077
  position: 'relative',
2091
2078
  display: 'flex',
@@ -2131,7 +2118,7 @@ function TokenInfo(props) {
2131
2118
  className: "head"
2132
2119
  }, React.createElement(Typography, {
2133
2120
  variant: "body2",
2134
- color: "neutrals800"
2121
+ color: "neutral800"
2135
2122
  }, t(type)), props.type === 'From' ? React.createElement(Options, null, React.createElement("div", {
2136
2123
  className: "balance",
2137
2124
  onClick: () => {
@@ -2139,8 +2126,8 @@ function TokenInfo(props) {
2139
2126
  }
2140
2127
  }, React.createElement(Typography, {
2141
2128
  variant: "body3",
2142
- color: "neutrals600"
2143
- }, `${t('Balance')}: ${tokenBalance} ${fromToken?.symbol || ''}`), React.createElement(Spacer, {
2129
+ color: "neutral600"
2130
+ }, `${t('Balance')}: ${tokenBalance} ${fromToken?.symbol || ''}`), React.createElement(Divider, {
2144
2131
  size: 4
2145
2132
  }), React.createElement(Button, {
2146
2133
  type: "primary",
@@ -2153,7 +2140,7 @@ function TokenInfo(props) {
2153
2140
  outputUsdValue: props.outputUsdValue
2154
2141
  }), React.createElement("div", null, React.createElement(Typography, {
2155
2142
  variant: "caption",
2156
- color: "neutrals600"
2143
+ color: "neutral600"
2157
2144
  }, `$${numberToString(props.outputUsdValue)}`)))), React.createElement("div", {
2158
2145
  className: "form"
2159
2146
  }, React.createElement(Button, {
@@ -2171,8 +2158,9 @@ function TokenInfo(props) {
2171
2158
  suffix: ItemSuffix,
2172
2159
  align: "start",
2173
2160
  size: "large"
2174
- }, loadingStatus === 'success' && chain ? chain.displayName : t('Chain')), React.createElement(Spacer, {
2175
- size: 12
2161
+ }, loadingStatus === 'success' && chain ? chain.displayName : t('Chain')), React.createElement(Divider, {
2162
+ size: 12,
2163
+ direction: "horizontal"
2176
2164
  }), React.createElement(Button, {
2177
2165
  className: "selectors",
2178
2166
  onClick: () => {
@@ -2188,8 +2176,9 @@ function TokenInfo(props) {
2188
2176
  suffix: ItemSuffix,
2189
2177
  size: "large",
2190
2178
  align: "start"
2191
- }, loadingStatus === 'success' && token ? token.symbol : t('Token')), React.createElement(Spacer, {
2192
- size: 12
2179
+ }, loadingStatus === 'success' && token ? token.symbol : t('Token')), React.createElement(Divider, {
2180
+ size: 12,
2181
+ direction: "horizontal"
2193
2182
  }), React.createElement("div", {
2194
2183
  className: "amount"
2195
2184
  }, props.type === 'From' ? React.createElement(TextField, {
@@ -2209,7 +2198,7 @@ function TokenInfo(props) {
2209
2198
  }
2210
2199
  }, React.createElement(Typography, {
2211
2200
  variant: "caption",
2212
- color: "neutrals800"
2201
+ color: "neutral800"
2213
2202
  }, `$${numberToString(inputUsdValue)}`)),
2214
2203
  value: props.inputAmount || '',
2215
2204
  min: 0,
@@ -2245,7 +2234,7 @@ function BottomLogo() {
2245
2234
  } = useTranslation();
2246
2235
  return React.createElement(Container$3, null, React.createElement(Typography, {
2247
2236
  variant: "caption",
2248
- color: "$neutrals600"
2237
+ color: "$neutral600"
2249
2238
  }, t('Powered By')), React.createElement(StyledAnchor, {
2250
2239
  href: "https://rango.exchange",
2251
2240
  target: "_blank"
@@ -2563,7 +2552,8 @@ function SelectTokenPage(props) {
2563
2552
 
2564
2553
  function SettingsPage(_ref) {
2565
2554
  let {
2566
- supportedSwappers
2555
+ supportedSwappers,
2556
+ singleTheme
2567
2557
  } = _ref;
2568
2558
  const slippage = useSettingsStore.use.slippage();
2569
2559
  const setSlippage = useSettingsStore.use.setSlippage();
@@ -2605,7 +2595,8 @@ function SettingsPage(_ref) {
2605
2595
  onBack: navigateBackFrom.bind(null, navigationRoutes.settings),
2606
2596
  liquiditySources: supportedUniqueSwappersGroups,
2607
2597
  selectedLiquiditySources: supportedUniqueSwappersGroups.filter(s => s.selected),
2608
- customSlippage: customSlippage || NaN,
2598
+ singleTheme: singleTheme,
2599
+ customSlippage: customSlippage,
2609
2600
  onCustomSlippageChange: setCustomSlippage,
2610
2601
  minSlippage: MIN_SLIPPGAE,
2611
2602
  maxSlippage: MAX_SLIPPAGE,
@@ -2649,7 +2640,7 @@ function WalletsPage(_ref) {
2649
2640
  getWalletInfo,
2650
2641
  connect
2651
2642
  } = useWallets();
2652
- const wallets = getlistWallet(state, getWalletInfo, supportedWallets || Object.values(WalletType));
2643
+ const wallets = getlistWallet(state, getWalletInfo, supportedWallets || Object.values(WalletTypes));
2653
2644
  const walletsRef = useRef();
2654
2645
  let sortedWallets = detectMobileScreens() ? wallets.filter(wallet => wallet.showOnMobile) : wallets;
2655
2646
  sortedWallets = sortWalletsBasedOnState(sortedWallets);
@@ -2838,7 +2829,7 @@ function SwapDetailsPage() {
2838
2829
  label={t('From')}
2839
2830
  loadingStatus={'success'}
2840
2831
  />
2841
- <Spacer size={12} direction="vertical" />
2832
+ <Divider size={12} />
2842
2833
  <TokenPreview
2843
2834
  chain={{
2844
2835
  displayName: lastStep?.toBlockchain || '',
@@ -2916,6 +2907,7 @@ function AppRoutes(props) {
2916
2907
  }, {
2917
2908
  path: navigationRoutes.settings,
2918
2909
  element: React.createElement(SettingsPage, {
2910
+ singleTheme: config?.theme?.singleTheme,
2919
2911
  supportedSwappers: config?.liquiditySources
2920
2912
  })
2921
2913
  }, {
@@ -2949,6 +2941,10 @@ const Header = /*#__PURE__*/styled('div', {
2949
2941
  display: 'flex'
2950
2942
  }
2951
2943
  });
2944
+ const WalletImages = /*#__PURE__*/styled('div', {
2945
+ display: 'flex',
2946
+ paddingLeft: '12px'
2947
+ });
2952
2948
  const WalletImageContainer = /*#__PURE__*/styled('div', {
2953
2949
  marginLeft: -15,
2954
2950
  marginRight: '$6',
@@ -3019,13 +3015,14 @@ function Layout(_ref) {
3019
3015
  disabled: loadingMetaStatus === 'failed',
3020
3016
  onClick: () => {
3021
3017
  if (!connectWalletsButtonDisabled) navigate(navigationRoutes.wallets);
3022
- }
3023
- }, connectedWalletsImages?.length ? connectedWalletsImages.map((walletImage, index) => React.createElement(WalletImageContainer, {
3024
- key: index
3025
- }, React.createElement(Image, {
3026
- src: walletImage,
3027
- size: 24
3028
- }))) : React.createElement(React.Fragment, null), React.createElement("div", {
3018
+ },
3019
+ prefix: connectedWalletsImages?.length ? React.createElement(WalletImages, null, connectedWalletsImages.map((walletImage, index) => React.createElement(WalletImageContainer, {
3020
+ key: index
3021
+ }, React.createElement(Image, {
3022
+ src: walletImage,
3023
+ size: 24
3024
+ })))) : null
3025
+ }, React.createElement("div", {
3029
3026
  className: "balance"
3030
3027
  }, React.createElement(Typography, {
3031
3028
  variant: "body2"
@@ -3056,96 +3053,73 @@ function usePrevious(value) {
3056
3053
  function useTheme(_ref) {
3057
3054
  let {
3058
3055
  colors: themeColors,
3059
- fontFamily = 'Robot',
3056
+ fontFamily = 'Roboto',
3060
3057
  borderRadius = 8,
3061
3058
  mode = 'auto'
3062
3059
  } = _ref;
3063
3060
  const theme = useSettingsStore.use.theme();
3064
3061
  const fetchMeta = useMetaStore.use.fetchMeta();
3065
3062
  const setTheme = useSettingsStore.use.setTheme();
3066
- const primary = themeColors?.primary || '#5FA425',
3067
- background = themeColors?.background || '#fff',
3068
- foreground = themeColors?.foreground || '#000',
3069
- error = themeColors?.error || '#FF0000',
3070
- warning = themeColors?.warning || '#F5A623',
3071
- success = themeColors?.success || '#0070F3';
3072
- const colors = {
3073
- neutrals200: '#FAFAFA',
3074
- neutrals300: '#f2f2f2',
3075
- neutrals400: '#dedede',
3076
- neutrals500: '#cccccc',
3077
- neutrals600: '#acacac',
3078
- neutrals700: '#444444',
3079
- neutrals800: '#333333',
3080
- neutrals900: '#111111',
3081
- primary,
3082
- primary100: shadeColor(primary, 15),
3083
- primary200: shadeColor(primary, -10),
3084
- primary300: shadeColor(primary, -15),
3085
- primary400: shadeColor(primary, -20),
3086
- primary500: shadeColor(primary, -25),
3087
- primary600: shadeColor(primary, -30),
3088
- primary700: shadeColor(primary, -35),
3089
- primary800: shadeColor(primary, -40),
3090
- primary900: shadeColor(primary, -45),
3063
+ const light = themeColors?.light;
3064
+ const dark = themeColors?.dark;
3065
+ const neutral = light?.neutral || '#fafafa';
3066
+ const background = light?.background || '#fff';
3067
+ const foreground = light?.foreground || '#000';
3068
+ const darkColors = {
3069
+ ...generateRangeColors('primary', 'dark', dark?.primary),
3070
+ ...generateRangeColors('error', 'dark', dark?.error),
3071
+ ...generateRangeColors('warning', 'dark', dark?.warning),
3072
+ ...generateRangeColors('success', 'dark', dark?.success),
3073
+ ...generateRangeColors('neutral', 'dark', dark?.neutral),
3074
+ surface: dark?.surface,
3075
+ background: dark?.background,
3076
+ foreground: dark?.foreground
3077
+ };
3078
+ const lightColors = {
3079
+ surface: light?.surface || '#fff',
3080
+ ...generateRangeColors('primary', 'light', light?.primary || '#5FA425'),
3081
+ ...generateRangeColors('error', 'light', light?.error || '#FF0000'),
3082
+ ...generateRangeColors('warning', 'light', light?.warning || '#F5A623'),
3083
+ ...generateRangeColors('success', 'light', light?.success || '#0070F3'),
3084
+ ...generateRangeColors('neutral', 'light', neutral),
3091
3085
  background,
3092
- foreground,
3093
- error,
3094
- error100: shadeColor(error, 50),
3095
- error300: shadeColor(error, -10),
3096
- error500: shadeColor(error, -20),
3097
- error700: shadeColor(error, -30),
3098
- warning,
3099
- warning100: shadeColor(warning, 50),
3100
- warning300: shadeColor(warning, -10),
3101
- warning500: shadeColor(warning, -20),
3102
- warning700: shadeColor(warning, -30),
3103
- success,
3104
- success100: shadeColor(success, 50),
3105
- success300: shadeColor(success, -10),
3106
- success500: shadeColor(success, -20),
3107
- success700: shadeColor(success, -30)
3086
+ foreground
3108
3087
  };
3109
- const customeLightTheme = createTheme({
3110
- colors,
3088
+ const customLightTheme = createTheme({
3089
+ colors: lightColors,
3111
3090
  radii: {
3112
3091
  5: `${borderRadius}px`
3113
3092
  },
3114
3093
  shadows: {
3115
- s: '0px 3px 5px 3px #f0f2f5, 0px 6px 10px 3px #f0f2f5, 0px 1px 18px 3px #f0f2f5'
3094
+ s: `0px 3px 5px 3px ${light?.neutral || '#f0f2f5'} ,0px 6px 10px 3px ${light?.neutral || '#f0f2f5'}, 0px 1px 18px 3px ${light?.neutral || '#f0f2f5'}`
3116
3095
  }
3117
3096
  });
3118
- const customeDarkTheme = createTheme({
3097
+ const customDarkTheme = createTheme({
3119
3098
  colors: {
3120
- ...colors,
3121
- neutrals200: '#111111',
3122
- neutrals300: '#333333',
3123
- neutrals400: '#444444',
3124
- neutrals500: '#acacac',
3125
- neutrals600: '#cccccc',
3126
- neutrals700: '#dedede',
3127
- neutrals800: '#f2f2f2',
3128
- neutrals900: '#FAFAFA',
3099
+ ...lightColors,
3100
+ ...generateRangeColors('neutral', 'dark', '#111111'),
3129
3101
  foreground: background,
3130
- background: foreground
3102
+ background: foreground,
3103
+ surface: '#000',
3104
+ ...JSON.parse(JSON.stringify(darkColors))
3131
3105
  },
3132
3106
  radii: {
3133
3107
  5: `${borderRadius}px`
3134
3108
  },
3135
3109
  shadows: {
3136
- s: '0px 3px 5px 3px #222, 0px 6px 10px 3px #222, 0px 1px 18px 3px #222'
3110
+ s: `0px 3px 5px 3px ${dark?.neutral || '#222'}, 0px 6px 10px 3px ${dark?.neutral || '#222'}, 0px 1px 18px 3px ${dark?.neutral || '#222'}`
3137
3111
  }
3138
3112
  });
3139
- const [OSTheme, setOSTheme] = useState(customeLightTheme);
3113
+ const [OSTheme, setOSTheme] = useState('light');
3140
3114
  useEffect(() => {
3141
3115
  (async () => {
3142
3116
  await fetchMeta();
3143
3117
  })();
3144
3118
  const switchTheme = event => {
3145
- if (event.matches) setOSTheme(customeDarkTheme);else setOSTheme(customeLightTheme);
3119
+ if (event.matches) setOSTheme('dark');else setOSTheme('light');
3146
3120
  };
3147
3121
  if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
3148
- setOSTheme(customeDarkTheme);
3122
+ setOSTheme('dark');
3149
3123
  }
3150
3124
  window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', switchTheme);
3151
3125
  return () => {
@@ -3164,7 +3138,7 @@ function useTheme(_ref) {
3164
3138
  classList.add(`font_${fontFamily.replace(/ /g, '')}`);
3165
3139
  }, [fontFamily]);
3166
3140
  const getActiveTheme = () => {
3167
- if (theme === 'auto') return OSTheme;else return theme === 'dark' ? customeDarkTheme : customeLightTheme;
3141
+ if (theme === 'auto') return OSTheme === 'dark' ? customDarkTheme : customLightTheme;else return theme === 'dark' ? customDarkTheme : customLightTheme;
3168
3142
  };
3169
3143
  return {
3170
3144
  activeTheme: getActiveTheme()
@@ -3281,6 +3255,7 @@ function QueueManager(props) {
3281
3255
  }
3282
3256
  return connect(wallet, network);
3283
3257
  };
3258
+ const isMobileWallet = walletType => !!getWalletInfo(walletType).mobileWallet;
3284
3259
  // TODO: this code copy & pasted from rango, should be refactored.
3285
3260
  const allBlockchains = blockchains.filter(blockchain => blockchain.enabled).reduce((blockchainsObj, blockchain) => (blockchainsObj[blockchain.name] = blockchain, blockchainsObj), {});
3286
3261
  const evmBasedChains = blockchains.filter(isEvmBlockchain$1);
@@ -3317,12 +3292,10 @@ function QueueManager(props) {
3317
3292
  switchNetwork,
3318
3293
  connect,
3319
3294
  state,
3295
+ isMobileWallet,
3320
3296
  notifier
3321
3297
  };
3322
- return React.createElement(Provider
3323
- //@ts-ignore
3324
- , {
3325
- //@ts-ignore
3298
+ return React.createElement(Provider, {
3326
3299
  queuesDefs: [swapQueueDef],
3327
3300
  context: context,
3328
3301
  onPersistedDataLoaded: manager => {