@rango-dev/widget-embedded 0.1.16-next.2 → 0.1.16-next.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/QueueManager.d.ts.map +1 -1
- package/dist/components/Footer.d.ts +111 -1
- package/dist/components/Footer.d.ts.map +1 -1
- package/dist/components/Layout.d.ts.map +1 -1
- package/dist/components/RoutesOverview.d.ts +111 -1
- package/dist/components/RoutesOverview.d.ts.map +1 -1
- package/dist/components/SwapDetailsPlaceholder.d.ts +111 -1
- package/dist/components/SwapDetailsPlaceholder.d.ts.map +1 -1
- package/dist/components/TokenInfo.d.ts.map +1 -1
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/SettingsPage.d.ts +2 -1
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +11 -1
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/common.d.ts +0 -1
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +2 -2
- package/dist/utils/wallets.d.ts.map +1 -1
- package/dist/widget-embedded.cjs.development.js +115 -152
- package/dist/widget-embedded.cjs.development.js.map +1 -1
- package/dist/widget-embedded.cjs.production.min.js +115 -152
- package/dist/widget-embedded.cjs.production.min.js.map +1 -1
- package/dist/widget-embedded.esm.js +117 -149
- package/dist/widget-embedded.esm.js.map +1 -1
- package/package.json +16 -13
- package/src/QueueManager.tsx +4 -1
- package/src/components/AppRoutes.tsx +1 -1
- package/src/components/BottomLogo.tsx +1 -1
- package/src/components/Layout.tsx +7 -8
- package/src/components/RoutesOverview.tsx +4 -4
- package/src/components/TokenInfo.tsx +13 -12
- package/src/components/TokenPreview.tsx +9 -9
- package/src/components/warnings/BalanceErrors.tsx +2 -2
- package/src/components/warnings/MinRequiredSlippage.tsx +2 -2
- package/src/hooks/useTheme.ts +46 -63
- package/src/index.tsx +1 -7
- package/src/pages/ConfirmSwapPage.tsx +38 -28
- package/src/pages/SettingsPage.tsx +4 -2
- package/src/pages/SwapDetailsPage.tsx +1 -1
- package/src/pages/WalletsPage.tsx +6 -2
- package/src/store/wallets.ts +13 -11
- package/src/types/config.ts +8 -1
- package/src/utils/common.ts +0 -21
- package/src/utils/wallets.ts +7 -15
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletState, InfoCircleIcon, Typography, Button, Image,
|
|
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,
|
|
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
|
|
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(
|
|
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: '$
|
|
1345
|
+
backgroundColor: '$neutral100'
|
|
1363
1346
|
},
|
|
1364
1347
|
outlined: {
|
|
1365
|
-
border: '1px solid $
|
|
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: '$
|
|
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: '$
|
|
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: "
|
|
1425
|
+
color: "neutral800"
|
|
1443
1426
|
}, props.label), React.createElement("div", null, percentageChange, props.usdValue && React.createElement(Typography, {
|
|
1444
1427
|
variant: "caption",
|
|
1445
|
-
color: "
|
|
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(
|
|
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(
|
|
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: '$
|
|
1489
|
-
color: '$
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
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(
|
|
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(
|
|
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: '$
|
|
2016
|
+
backgroundColor: '$neutral100'
|
|
2031
2017
|
},
|
|
2032
2018
|
outlined: {
|
|
2033
|
-
border: '1px solid $
|
|
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: '$
|
|
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: '$
|
|
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: "
|
|
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: "
|
|
2143
|
-
}, `${t('Balance')}: ${tokenBalance} ${fromToken?.symbol || ''}`), React.createElement(
|
|
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: "
|
|
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(
|
|
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(
|
|
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: "
|
|
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: "$
|
|
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
|
-
|
|
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(
|
|
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
|
-
<
|
|
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
|
}, {
|
|
@@ -3056,96 +3048,73 @@ function usePrevious(value) {
|
|
|
3056
3048
|
function useTheme(_ref) {
|
|
3057
3049
|
let {
|
|
3058
3050
|
colors: themeColors,
|
|
3059
|
-
fontFamily = '
|
|
3051
|
+
fontFamily = 'Roboto',
|
|
3060
3052
|
borderRadius = 8,
|
|
3061
3053
|
mode = 'auto'
|
|
3062
3054
|
} = _ref;
|
|
3063
3055
|
const theme = useSettingsStore.use.theme();
|
|
3064
3056
|
const fetchMeta = useMetaStore.use.fetchMeta();
|
|
3065
3057
|
const setTheme = useSettingsStore.use.setTheme();
|
|
3066
|
-
const
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
primary700: shadeColor(primary, -35),
|
|
3089
|
-
primary800: shadeColor(primary, -40),
|
|
3090
|
-
primary900: shadeColor(primary, -45),
|
|
3058
|
+
const light = themeColors?.light;
|
|
3059
|
+
const dark = themeColors?.dark;
|
|
3060
|
+
const neutral = light?.neutral || '#fafafa';
|
|
3061
|
+
const background = light?.background || '#fff';
|
|
3062
|
+
const foreground = light?.foreground || '#000';
|
|
3063
|
+
const darkColors = {
|
|
3064
|
+
...generateRangeColors('primary', 'dark', dark?.primary),
|
|
3065
|
+
...generateRangeColors('error', 'dark', dark?.error),
|
|
3066
|
+
...generateRangeColors('warning', 'dark', dark?.warning),
|
|
3067
|
+
...generateRangeColors('success', 'dark', dark?.success),
|
|
3068
|
+
...generateRangeColors('neutral', 'dark', dark?.neutral),
|
|
3069
|
+
surface: dark?.surface,
|
|
3070
|
+
background: dark?.background,
|
|
3071
|
+
foreground: dark?.foreground
|
|
3072
|
+
};
|
|
3073
|
+
const lightColors = {
|
|
3074
|
+
surface: light?.surface || '#fff',
|
|
3075
|
+
...generateRangeColors('primary', 'light', light?.primary || '#5FA425'),
|
|
3076
|
+
...generateRangeColors('error', 'light', light?.error || '#FF0000'),
|
|
3077
|
+
...generateRangeColors('warning', 'light', light?.warning || '#F5A623'),
|
|
3078
|
+
...generateRangeColors('success', 'light', light?.success || '#0070F3'),
|
|
3079
|
+
...generateRangeColors('neutral', 'light', neutral),
|
|
3091
3080
|
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)
|
|
3081
|
+
foreground
|
|
3108
3082
|
};
|
|
3109
|
-
const
|
|
3110
|
-
colors,
|
|
3083
|
+
const customLightTheme = createTheme({
|
|
3084
|
+
colors: lightColors,
|
|
3111
3085
|
radii: {
|
|
3112
3086
|
5: `${borderRadius}px`
|
|
3113
3087
|
},
|
|
3114
3088
|
shadows: {
|
|
3115
|
-
s:
|
|
3089
|
+
s: `0px 3px 5px 3px ${light?.neutral || '#f0f2f5'} ,0px 6px 10px 3px ${light?.neutral || '#f0f2f5'}, 0px 1px 18px 3px ${light?.neutral || '#f0f2f5'}`
|
|
3116
3090
|
}
|
|
3117
3091
|
});
|
|
3118
|
-
const
|
|
3092
|
+
const customDarkTheme = createTheme({
|
|
3119
3093
|
colors: {
|
|
3120
|
-
...
|
|
3121
|
-
|
|
3122
|
-
neutrals300: '#333333',
|
|
3123
|
-
neutrals400: '#444444',
|
|
3124
|
-
neutrals500: '#acacac',
|
|
3125
|
-
neutrals600: '#cccccc',
|
|
3126
|
-
neutrals700: '#dedede',
|
|
3127
|
-
neutrals800: '#f2f2f2',
|
|
3128
|
-
neutrals900: '#FAFAFA',
|
|
3094
|
+
...lightColors,
|
|
3095
|
+
...generateRangeColors('neutral', 'dark', '#111111'),
|
|
3129
3096
|
foreground: background,
|
|
3130
|
-
background: foreground
|
|
3097
|
+
background: foreground,
|
|
3098
|
+
surface: '#000',
|
|
3099
|
+
...JSON.parse(JSON.stringify(darkColors))
|
|
3131
3100
|
},
|
|
3132
3101
|
radii: {
|
|
3133
3102
|
5: `${borderRadius}px`
|
|
3134
3103
|
},
|
|
3135
3104
|
shadows: {
|
|
3136
|
-
s:
|
|
3105
|
+
s: `0px 3px 5px 3px ${dark?.neutral || '#222'}, 0px 6px 10px 3px ${dark?.neutral || '#222'}, 0px 1px 18px 3px ${dark?.neutral || '#222'}`
|
|
3137
3106
|
}
|
|
3138
3107
|
});
|
|
3139
|
-
const [OSTheme, setOSTheme] = useState(
|
|
3108
|
+
const [OSTheme, setOSTheme] = useState('light');
|
|
3140
3109
|
useEffect(() => {
|
|
3141
3110
|
(async () => {
|
|
3142
3111
|
await fetchMeta();
|
|
3143
3112
|
})();
|
|
3144
3113
|
const switchTheme = event => {
|
|
3145
|
-
if (event.matches) setOSTheme(
|
|
3114
|
+
if (event.matches) setOSTheme('dark');else setOSTheme('light');
|
|
3146
3115
|
};
|
|
3147
3116
|
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
3148
|
-
setOSTheme(
|
|
3117
|
+
setOSTheme('dark');
|
|
3149
3118
|
}
|
|
3150
3119
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', switchTheme);
|
|
3151
3120
|
return () => {
|
|
@@ -3164,7 +3133,7 @@ function useTheme(_ref) {
|
|
|
3164
3133
|
classList.add(`font_${fontFamily.replace(/ /g, '')}`);
|
|
3165
3134
|
}, [fontFamily]);
|
|
3166
3135
|
const getActiveTheme = () => {
|
|
3167
|
-
if (theme === 'auto') return OSTheme;else return theme === 'dark' ?
|
|
3136
|
+
if (theme === 'auto') return OSTheme === 'dark' ? customDarkTheme : customLightTheme;else return theme === 'dark' ? customDarkTheme : customLightTheme;
|
|
3168
3137
|
};
|
|
3169
3138
|
return {
|
|
3170
3139
|
activeTheme: getActiveTheme()
|
|
@@ -3281,6 +3250,7 @@ function QueueManager(props) {
|
|
|
3281
3250
|
}
|
|
3282
3251
|
return connect(wallet, network);
|
|
3283
3252
|
};
|
|
3253
|
+
const isMobileWallet = walletType => !!getWalletInfo(walletType).mobileWallet;
|
|
3284
3254
|
// TODO: this code copy & pasted from rango, should be refactored.
|
|
3285
3255
|
const allBlockchains = blockchains.filter(blockchain => blockchain.enabled).reduce((blockchainsObj, blockchain) => (blockchainsObj[blockchain.name] = blockchain, blockchainsObj), {});
|
|
3286
3256
|
const evmBasedChains = blockchains.filter(isEvmBlockchain$1);
|
|
@@ -3317,12 +3287,10 @@ function QueueManager(props) {
|
|
|
3317
3287
|
switchNetwork,
|
|
3318
3288
|
connect,
|
|
3319
3289
|
state,
|
|
3290
|
+
isMobileWallet,
|
|
3320
3291
|
notifier
|
|
3321
3292
|
};
|
|
3322
|
-
return React.createElement(Provider
|
|
3323
|
-
//@ts-ignore
|
|
3324
|
-
, {
|
|
3325
|
-
//@ts-ignore
|
|
3293
|
+
return React.createElement(Provider, {
|
|
3326
3294
|
queuesDefs: [swapQueueDef],
|
|
3327
3295
|
context: context,
|
|
3328
3296
|
onPersistedDataLoaded: manager => {
|