@rango-dev/widget-embedded 0.1.10-next.98 → 0.1.10-next.99

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 (34) hide show
  1. package/dist/components/ChangeSlippageButton.d.ts.map +1 -1
  2. package/dist/components/RoutesOverview.d.ts +10 -0
  3. package/dist/components/RoutesOverview.d.ts.map +1 -0
  4. package/dist/components/TokenInfo.d.ts.map +1 -1
  5. package/dist/components/TokenPreview.d.ts +20 -0
  6. package/dist/components/TokenPreview.d.ts.map +1 -0
  7. package/dist/components/warnings/HighSlippageWarning.d.ts.map +1 -1
  8. package/dist/pages/ConfirmWalletsPage.d.ts.map +1 -1
  9. package/dist/pages/Home.d.ts.map +1 -1
  10. package/dist/pages/WalletsPage.d.ts.map +1 -1
  11. package/dist/store/bestRoute.d.ts.map +1 -1
  12. package/dist/utils/swap.d.ts +2 -1
  13. package/dist/utils/swap.d.ts.map +1 -1
  14. package/dist/widget-embedded.cjs.development.js +335 -92
  15. package/dist/widget-embedded.cjs.development.js.map +1 -1
  16. package/dist/widget-embedded.cjs.production.min.js +335 -92
  17. package/dist/widget-embedded.cjs.production.min.js.map +1 -1
  18. package/dist/widget-embedded.esm.js +334 -92
  19. package/dist/widget-embedded.esm.js.map +1 -1
  20. package/package.json +1 -1
  21. package/src/components/ChangeSlippageButton.tsx +4 -8
  22. package/src/components/HeaderButtons.tsx +2 -2
  23. package/src/components/RoutesOverview.tsx +60 -0
  24. package/src/components/TokenInfo.tsx +125 -77
  25. package/src/components/TokenPreview.tsx +175 -0
  26. package/src/components/warnings/HighSlippageWarning.tsx +4 -7
  27. package/src/globalStyles.ts +1 -1
  28. package/src/hooks/useTheme.ts +9 -9
  29. package/src/languages/en.json +9 -8
  30. package/src/pages/ConfirmWalletsPage.tsx +53 -6
  31. package/src/pages/Home.tsx +33 -35
  32. package/src/pages/WalletsPage.tsx +2 -5
  33. package/src/store/bestRoute.ts +4 -5
  34. package/src/utils/swap.ts +12 -1
@@ -1,4 +1,4 @@
1
- import { WalletState, Tooltip, Button, RetryIcon, HistoryIcon, SettingsIcon, styled, css, Typography, InfoCircleIcon, AngleDownIcon, TextField, VerticalSwapIcon, BestRoute, Alert, ConfirmSwap, History, LiquiditySourcesSelector, BlockchainSelector, TokenSelector, Settings, SecondaryPage, Wallet, ConfirmWallets, SwapHistory, AddWalletIcon, globalCss, createTheme, SwapContainer } from '@rango-dev/ui';
1
+ import { WalletState, Tooltip, Button, RetryIcon, HistoryIcon, SettingsIcon, styled, css, Typography, InfoCircleIcon, AngleDownIcon, Spacer, TextField, VerticalSwapIcon, BestRoute, Alert, ConfirmSwap, History, LiquiditySourcesSelector, BlockchainSelector, TokenSelector, Settings, SecondaryPage, Wallet, ChevronRightIcon, GasIcon, ConfirmWallets, SwapHistory, AddWalletIcon, globalCss, createTheme, SwapContainer } from '@rango-dev/ui';
2
2
  import React, { useRef, useEffect, useState, useLayoutEffect } from 'react';
3
3
  import { useInRouterContext as useInRouterContext$1, MemoryRouter, useLocation as useLocation$1, useNavigate as useNavigate$1 } from 'react-router';
4
4
  import { useSearchParams, useLocation, createSearchParams, useNavigate, useInRouterContext, useRoutes } from 'react-router-dom';
@@ -14,9 +14,9 @@ import { useTranslation, initReactI18next } from 'react-i18next';
14
14
  import { styled as styled$1 } from '@rango-dev/ui/src/theme';
15
15
  import { allProviders } from '@rango-dev/provider-all';
16
16
  import { useManager, Provider } from '@rango-dev/queue-manager-react';
17
+ import i18n, { t } from 'i18next';
17
18
  import copy from 'copy-to-clipboard';
18
19
  import { cancelSwap, swapQueueDef } from '@rango-dev/queue-manager-rango-preset';
19
- import i18n from 'i18next';
20
20
  import Backend from 'i18next-http-backend';
21
21
  import LanguageDetector from 'i18next-browser-languagedetector';
22
22
 
@@ -405,7 +405,7 @@ function LimitErrorMessage(bestRoute) {
405
405
  recommendation
406
406
  };
407
407
  }
408
- function getSwapButtonState(loadingMetaStatus, accounts, loading, bestRoute, hasLimitError, highValueLoss, priceImpactCanNotBeComputed, needsToWarnEthOnPath) {
408
+ function getSwapButtonState(loadingMetaStatus, accounts, loading, bestRoute, hasLimitError, highValueLoss, priceImpactCanNotBeComputed, needsToWarnEthOnPath, inputIsZero) {
409
409
  if (loadingMetaStatus !== 'success') return {
410
410
  title: 'Connect Wallet',
411
411
  disabled: true
@@ -417,6 +417,9 @@ function getSwapButtonState(loadingMetaStatus, accounts, loading, bestRoute, has
417
417
  if (loading) return {
418
418
  title: 'Finding Best Route...',
419
419
  disabled: true
420
+ };else if (inputIsZero) return {
421
+ title: 'Enter an amount',
422
+ disabled: true
420
423
  };else if (!bestRoute) return {
421
424
  title: 'Swap',
422
425
  disabled: true
@@ -626,6 +629,10 @@ function getBalanceWarnings(route, selectedWallets) {
626
629
  return warningMessage;
627
630
  });
628
631
  }
632
+ function calcOutputUsdValue(outputAmount, tokenPrice) {
633
+ const amount = !!outputAmount ? new BigNumber(outputAmount) : ZERO;
634
+ return amount.multipliedBy(tokenPrice || 0);
635
+ }
629
636
 
630
637
  function searchParamsToToken(tokens, searchParams, chain) {
631
638
  if (!chain) return null;
@@ -882,7 +889,7 @@ const useBestRouteStore = /*#__PURE__*/createSelectors( /*#__PURE__*/create()( /
882
889
  let outputUsdValue = ZERO;
883
890
  if (!!bestRoute) {
884
891
  outputAmount = !!bestRoute.result?.outputAmount ? new BigNumber(bestRoute.result?.outputAmount) : null;
885
- outputUsdValue = new BigNumber(outputAmount || ZERO).multipliedBy(getBestRouteToTokenUsdPrice(bestRoute) || state.toToken?.usdPrice || 0);
892
+ outputUsdValue = calcOutputUsdValue(bestRoute.result?.outputAmount, getBestRouteToTokenUsdPrice(bestRoute) || state.toToken?.usdPrice);
886
893
  }
887
894
  return {
888
895
  bestRoute,
@@ -1179,12 +1186,12 @@ function HeaderButtons(props) {
1179
1186
  } = props;
1180
1187
  const navigate = useNavigate();
1181
1188
  return React.createElement(ButtonsContainer, null, React.createElement(Tooltip, {
1182
- content: "Retry"
1189
+ content: "Refresh"
1183
1190
  }, React.createElement(Button, {
1184
1191
  variant: "ghost",
1185
1192
  onClick: onClickRefresh
1186
1193
  }, React.createElement(RetryIcon, {
1187
- size: 28
1194
+ size: 24
1188
1195
  }))), React.createElement(Tooltip, {
1189
1196
  content: "Transactions History"
1190
1197
  }, React.createElement(Button, {
@@ -1238,13 +1245,42 @@ const Box = /*#__PURE__*/styled('div', {
1238
1245
  });
1239
1246
  const Container = /*#__PURE__*/styled('div', {
1240
1247
  boxSizing: 'border-box',
1241
- backgroundColor: '$neutrals300',
1242
1248
  borderRadius: '$5',
1243
- padding: '$8 0',
1249
+ padding: '$8 $16 $16 $16',
1250
+ variants: {
1251
+ type: {
1252
+ filled: {
1253
+ backgroundColor: '$neutrals300'
1254
+ },
1255
+ outlined: {
1256
+ border: '1px solid $neutrals300'
1257
+ }
1258
+ }
1259
+ },
1260
+ defaultVariants: {
1261
+ type: 'filled'
1262
+ },
1263
+ '.head': {
1264
+ display: 'flex',
1265
+ justifyContent: 'space-between',
1266
+ alignItems: 'center',
1267
+ minHeight: '32px'
1268
+ },
1244
1269
  '.form': {
1245
1270
  display: 'flex',
1246
1271
  width: '100%',
1247
- padding: '$8 $16'
1272
+ padding: '$2 0',
1273
+ '.selectors': {
1274
+ width: '35%',
1275
+ '._text': {
1276
+ whiteSpace: 'nowrap',
1277
+ overflow: 'hidden',
1278
+ textOverflow: 'ellipsis'
1279
+ }
1280
+ },
1281
+ '.amount': {
1282
+ width: '30%'
1283
+ }
1248
1284
  }
1249
1285
  });
1250
1286
  const StyledImage = /*#__PURE__*/styled('img', {
@@ -1254,7 +1290,10 @@ const StyledImage = /*#__PURE__*/styled('img', {
1254
1290
  const Options = /*#__PURE__*/styled('div', {
1255
1291
  display: 'flex',
1256
1292
  justifyContent: 'flex-end',
1257
- padding: '0 $8'
1293
+ '.balance': {
1294
+ display: 'flex',
1295
+ alignItems: 'center'
1296
+ }
1258
1297
  });
1259
1298
  const ImagePlaceholder = /*#__PURE__*/styled('span', {
1260
1299
  width: '24px',
@@ -1263,10 +1302,9 @@ const ImagePlaceholder = /*#__PURE__*/styled('span', {
1263
1302
  borderRadius: '99999px'
1264
1303
  });
1265
1304
  const OutputContainer = /*#__PURE__*/styled('div', {
1305
+ windth: '100%',
1266
1306
  height: '$48',
1267
1307
  borderRadius: '$5',
1268
- flexGrow: 1,
1269
- width: '70%',
1270
1308
  backgroundColor: '$background',
1271
1309
  border: '1px solid transparent',
1272
1310
  position: 'relative',
@@ -1306,21 +1344,34 @@ function TokenInfo(props) {
1306
1344
  color: "error",
1307
1345
  size: 24
1308
1346
  }), React.createElement(AngleDownIcon, null));
1309
- return React.createElement(Box, null, React.createElement("div", null, React.createElement(Typography, {
1310
- variant: "body2"
1311
- }, t(type))), React.createElement(Container, null, props.type === 'From' && React.createElement(Options, null, React.createElement("div", {
1347
+ return React.createElement(Box, null, React.createElement(Container, {
1348
+ type: props.type === 'From' ? 'filled' : 'outlined'
1349
+ }, React.createElement("div", {
1350
+ className: "head"
1351
+ }, React.createElement(Typography, {
1352
+ variant: "body2",
1353
+ color: "neutrals800"
1354
+ }, t(type)), props.type === 'From' ? React.createElement(Options, null, React.createElement("div", {
1312
1355
  className: "balance",
1313
1356
  onClick: () => {
1314
1357
  if (tokenBalance !== '0') setInputAmount(tokenBalanceReal.split(',').join(''));
1315
1358
  }
1316
- }, React.createElement(Button, {
1317
- variant: "ghost",
1318
- size: "small"
1319
1359
  }, React.createElement(Typography, {
1320
- variant: "body2"
1321
- }, `${t('Max')}: ${tokenBalance} ${fromToken?.symbol || ''}`)))), React.createElement("div", {
1360
+ variant: "body3",
1361
+ color: "neutrals600"
1362
+ }, `${t('Balance')}: ${tokenBalance} ${fromToken?.symbol || ''}`), React.createElement(Spacer, {
1363
+ size: 4
1364
+ }), React.createElement(Button, {
1365
+ type: "primary",
1366
+ variant: "ghost",
1367
+ size: "compact"
1368
+ }, t('Max')))) : React.createElement(Typography, {
1369
+ variant: "caption",
1370
+ color: "neutrals600"
1371
+ }, `$${numberToString(props.outputUsdValue)}`)), React.createElement("div", {
1322
1372
  className: "form"
1323
1373
  }, React.createElement(Button, {
1374
+ className: "selectors",
1324
1375
  onClick: () => {
1325
1376
  navigate(`/${props.type.toLowerCase()}-chain`);
1326
1377
  },
@@ -1332,11 +1383,11 @@ function TokenInfo(props) {
1332
1383
  }) : React.createElement(ImagePlaceholder, null),
1333
1384
  suffix: ItemSuffix,
1334
1385
  align: "start",
1335
- size: "large",
1336
- style: {
1337
- marginRight: '.5rem'
1338
- }
1339
- }, loadingStatus === 'success' && chain ? chain.displayName : t('Chain')), React.createElement(Button, {
1386
+ size: "large"
1387
+ }, loadingStatus === 'success' && chain ? chain.displayName : t('Chain')), React.createElement(Spacer, {
1388
+ size: 12
1389
+ }), React.createElement(Button, {
1390
+ className: "selectors",
1340
1391
  onClick: () => {
1341
1392
  navigate(`/${props.type.toLowerCase()}-token`);
1342
1393
  },
@@ -1348,17 +1399,17 @@ function TokenInfo(props) {
1348
1399
  }) : React.createElement(ImagePlaceholder, null),
1349
1400
  suffix: ItemSuffix,
1350
1401
  size: "large",
1351
- align: "start",
1352
- style: {
1353
- marginRight: '.5rem'
1354
- }
1355
- }, loadingStatus === 'success' && token ? token.symbol : t('Token')), props.type === 'From' ? React.createElement(TextField, {
1402
+ align: "start"
1403
+ }, loadingStatus === 'success' && token ? token.symbol : t('Token')), React.createElement(Spacer, {
1404
+ size: 12
1405
+ }), React.createElement("div", {
1406
+ className: "amount"
1407
+ }, props.type === 'From' ? React.createElement(TextField, {
1356
1408
  type: "number",
1357
1409
  size: "large",
1358
1410
  autoFocus: true,
1359
1411
  placeholder: "0",
1360
1412
  style: {
1361
- width: '70%',
1362
1413
  position: 'relative',
1363
1414
  backgroundColor: '$background !important'
1364
1415
  },
@@ -1369,23 +1420,16 @@ function TokenInfo(props) {
1369
1420
  bottom: '2px'
1370
1421
  }
1371
1422
  }, React.createElement(Typography, {
1372
- variant: "caption"
1423
+ variant: "caption",
1424
+ color: "neutrals800"
1373
1425
  }, `$${numberToString(inputUsdValue)}`)),
1374
1426
  value: props.inputAmount || '',
1375
1427
  onChange: props.type === 'From' ? event => {
1376
1428
  props.onAmountChange(event.target.value);
1377
1429
  } : undefined
1378
1430
  }) : React.createElement(OutputContainer, null, React.createElement(Typography, {
1379
- variant: "body1"
1380
- }, bestRoute ? `≈ ${numberToString(props.outputAmount)}` : inputAmount ? '?' : '0'), React.createElement("span", {
1381
- style: {
1382
- position: 'absolute',
1383
- right: '4px',
1384
- bottom: '2px'
1385
- }
1386
- }, React.createElement(Typography, {
1387
- variant: "caption"
1388
- }, `$${numberToString(props.outputUsdValue)}`))))));
1431
+ variant: "h4"
1432
+ }, bestRoute ? `≈ ${numberToString(props.outputAmount)}` : inputAmount ? '?' : '0'))))));
1389
1433
  }
1390
1434
 
1391
1435
  const Container$1 = /*#__PURE__*/styled$1('div', {
@@ -1483,16 +1527,17 @@ const errorMessages = {
1483
1527
 
1484
1528
  const Container$2 = /*#__PURE__*/styled('div', {
1485
1529
  display: 'flex',
1486
- flexDirection: 'column',
1487
- justifyContent: 'center',
1488
- alignItems: 'center'
1530
+ flexDirection: 'column'
1489
1531
  });
1490
- const SwitchButtonContainer = /*#__PURE__*/styled('div', {
1491
- display: 'flex',
1492
- justifyContent: 'center',
1493
- alignItems: 'center',
1532
+ const FromContainer = /*#__PURE__*/styled('div', {
1494
1533
  position: 'relative',
1495
- top: '11px'
1534
+ paddingBottom: '$12'
1535
+ });
1536
+ const SwitchButtonContainer = /*#__PURE__*/styled('div', {
1537
+ position: 'absolute',
1538
+ bottom: '-12px',
1539
+ left: '50%',
1540
+ transform: 'translate(-50%, 10%)'
1496
1541
  });
1497
1542
  const BestRouteContainer = /*#__PURE__*/styled('div', {
1498
1543
  width: '100%',
@@ -1508,7 +1553,6 @@ function Home(props) {
1508
1553
  titleSize = 18,
1509
1554
  titleWeight = 600
1510
1555
  } = props;
1511
- const waningMessage = '';
1512
1556
  const isRouterInContext = useInRouterContext();
1513
1557
  const navigate = useNavigate();
1514
1558
  const [count, setCount] = useState(0);
@@ -1550,7 +1594,8 @@ function Home(props) {
1550
1594
  swap
1551
1595
  } = LimitErrorMessage(bestRoute);
1552
1596
  const priceImpactCanNotBeComputed = !canComputePriceImpact(bestRoute, inputAmount, inputUsdValue, outputUsdValue);
1553
- const swapButtonState = getSwapButtonState(loadingMetaStatus, accounts, fetchingBestRoute, bestRoute, hasLimitError(bestRoute), highValueLoss, priceImpactCanNotBeComputed, needsToWarnEthOnPath);
1597
+ const inputIsZero = inputAmount === '0';
1598
+ const swapButtonState = getSwapButtonState(loadingMetaStatus, accounts, fetchingBestRoute, bestRoute, hasLimitError(bestRoute), highValueLoss, priceImpactCanNotBeComputed, needsToWarnEthOnPath, inputIsZero);
1554
1599
  const totalFeeInUsd = getTotalFeeInUsd(bestRoute, tokens);
1555
1600
  const highFee = hasHighFee(totalFeeInUsd);
1556
1601
  return React.createElement(Container$2, null, React.createElement(Header, {
@@ -1558,7 +1603,7 @@ function Home(props) {
1558
1603
  titleSize: titleSize,
1559
1604
  titleWeight: titleWeight,
1560
1605
  onClickRefresh: fetchBestRoute
1561
- }), React.createElement(TokenInfo, {
1606
+ }), React.createElement(FromContainer, null, React.createElement(TokenInfo, {
1562
1607
  type: "From",
1563
1608
  chain: fromChain,
1564
1609
  token: fromToken,
@@ -1568,14 +1613,14 @@ function Home(props) {
1568
1613
  variant: "ghost",
1569
1614
  onClick: swithFromAndTo
1570
1615
  }, React.createElement(VerticalSwapIcon, {
1571
- size: 36
1616
+ size: 24
1572
1617
  }), isRouterInContext && React.createElement(SwithFromAndTo, {
1573
1618
  count: count
1574
- }))), React.createElement(TokenInfo, {
1619
+ })))), React.createElement(TokenInfo, {
1575
1620
  type: "To",
1576
1621
  chain: toChain,
1577
1622
  token: toToken,
1578
- outputAmount: outputAmount,
1623
+ outputAmount: outputAmount ? new BigNumber(outputAmount) : new BigNumber(0),
1579
1624
  outputUsdValue: outputUsdValue
1580
1625
  }), showBestRoute && React.createElement(BestRouteContainer, null, React.createElement(BestRoute, {
1581
1626
  error: bestRouteError,
@@ -1584,11 +1629,9 @@ function Home(props) {
1584
1629
  totalFee: numberToString(totalFeeInUsd, 0, 2),
1585
1630
  feeWarning: highFee,
1586
1631
  totalTime: secondsToString(totalArrivalTime(bestRoute))
1587
- })), (errorMessage || waningMessage || hasLimitError(bestRoute)) && React.createElement(Alerts, null, errorMessage && React.createElement(Alert, {
1632
+ })), (errorMessage || hasLimitError(bestRoute)) && React.createElement(Alerts, null, errorMessage && React.createElement(Alert, {
1588
1633
  type: "error"
1589
- }, React.createElement(Typography, {
1590
- variant: "body2"
1591
- }, errorMessage)), hasLimitError(bestRoute) && React.createElement(Alert, {
1634
+ }, errorMessage), hasLimitError(bestRoute) && React.createElement(Alert, {
1592
1635
  type: "error",
1593
1636
  title: `${swap?.swapperId} Limit`
1594
1637
  }, React.createElement(React.Fragment, null, React.createElement(Typography, {
@@ -1597,7 +1640,7 @@ function Home(props) {
1597
1640
  variant: "body2"
1598
1641
  }, "Yours: ", numberToString(swap?.fromAmount || null), swap?.from.symbol), React.createElement("br", null), React.createElement(Typography, {
1599
1642
  variant: "body2"
1600
- }, recommendation))), waningMessage ), React.createElement(Footer, null, React.createElement(Button, {
1643
+ }, recommendation)))), React.createElement(Footer, null, React.createElement(Button, {
1601
1644
  type: "primary",
1602
1645
  align: "grow",
1603
1646
  size: "large",
@@ -1639,14 +1682,11 @@ function AppRouter(_ref2) {
1639
1682
  return React.createElement(React.Fragment, null, React.createElement(Router, Object.assign({}, props), children), isRouterInContext && React.createElement(UpdateUrl, null));
1640
1683
  }
1641
1684
 
1642
- const StyledButton = /*#__PURE__*/styled(Button, {
1643
- marginTop: '$8'
1644
- });
1645
1685
  function ChangeSlippageButton() {
1646
1686
  const navigate = useNavigate();
1647
- return React.createElement(StyledButton, {
1687
+ return React.createElement(Button, {
1648
1688
  type: "primary",
1649
- variant: "contained",
1689
+ variant: "outlined",
1650
1690
  size: "small",
1651
1691
  onClick: () => navigate(navigationRoutes.settings)
1652
1692
  }, "Change Slippage");
@@ -1657,10 +1697,9 @@ function HighSlippageWarning(props) {
1657
1697
  selectedSlippage
1658
1698
  } = props;
1659
1699
  return React.createElement(Alert, {
1660
- type: "warning"
1661
- }, React.createElement(Typography, {
1662
- variant: "body2"
1663
- }, "Caution, your slippage is high (=", selectedSlippage, "). Your trade may be front run.", React.createElement(ChangeSlippageButton, null)));
1700
+ type: "warning",
1701
+ footer: React.createElement(ChangeSlippageButton, null)
1702
+ }, "Caution, your slippage is high (=", selectedSlippage, "). Your trade may be front run.");
1664
1703
  }
1665
1704
 
1666
1705
  function ConfirmSwapExtraMessages(props) {
@@ -2188,7 +2227,7 @@ const ListContainer = /*#__PURE__*/styled('div', {
2188
2227
  gridTemplateColumns: ' repeat(2, minmax(0, 1fr))',
2189
2228
  height: '450px',
2190
2229
  alignContent: 'baseline',
2191
- padding: '0 0.5rem'
2230
+ padding: '0.5rem'
2192
2231
  });
2193
2232
  const AlertContainer = /*#__PURE__*/styled('div', {
2194
2233
  paddingBottom: '$16'
@@ -2241,14 +2280,182 @@ function WalletsPage(_ref) {
2241
2280
  onBack: navigateBackFrom.bind(null, navigationRoutes.wallets)
2242
2281
  }, React.createElement(React.Fragment, null, walletErrorMessage && React.createElement(AlertContainer, null, React.createElement(Alert, {
2243
2282
  type: "error"
2244
- }, React.createElement(Typography, {
2245
- variant: "body2"
2246
- }, walletErrorMessage))), React.createElement(ListContainer, null, sortedWallets.map((wallet, index) => React.createElement(Wallet, Object.assign({}, wallet, {
2283
+ }, walletErrorMessage)), React.createElement(ListContainer, null, sortedWallets.map((wallet, index) => React.createElement(Wallet, Object.assign({}, wallet, {
2247
2284
  key: `${index}-${wallet.type}`,
2248
2285
  onClick: onSelectWallet
2249
2286
  }))))));
2250
2287
  }
2251
2288
 
2289
+ const Box$1 = /*#__PURE__*/styled('div', {
2290
+ display: 'flex',
2291
+ flexDirection: 'column',
2292
+ width: '100%'
2293
+ });
2294
+ const Container$3 = /*#__PURE__*/styled('div', {
2295
+ boxSizing: 'border-box',
2296
+ borderRadius: '$5',
2297
+ padding: '$8 $16 $16 $16',
2298
+ variants: {
2299
+ type: {
2300
+ filled: {
2301
+ backgroundColor: '$neutrals300'
2302
+ },
2303
+ outlined: {
2304
+ border: '1px solid $neutrals300'
2305
+ }
2306
+ }
2307
+ },
2308
+ defaultVariants: {
2309
+ type: 'filled'
2310
+ },
2311
+ '.head': {
2312
+ display: 'flex',
2313
+ justifyContent: 'space-between',
2314
+ alignItems: 'center',
2315
+ minHeight: '32px'
2316
+ },
2317
+ '.form': {
2318
+ display: 'flex',
2319
+ width: '100%',
2320
+ padding: '$2 0',
2321
+ '.selectors': {
2322
+ width: '35%',
2323
+ '._text': {
2324
+ whiteSpace: 'nowrap',
2325
+ overflow: 'hidden',
2326
+ textOverflow: 'ellipsis'
2327
+ }
2328
+ },
2329
+ '.amount': {
2330
+ width: '30%'
2331
+ }
2332
+ }
2333
+ });
2334
+ const StyledImage$1 = /*#__PURE__*/styled('img', {
2335
+ width: '$24',
2336
+ maxHeight: '$24'
2337
+ });
2338
+ const ImagePlaceholder$1 = /*#__PURE__*/styled('span', {
2339
+ width: '24px',
2340
+ height: '24px',
2341
+ backgroundColor: '$neutrals300',
2342
+ borderRadius: '99999px'
2343
+ });
2344
+ const OutputContainer$1 = /*#__PURE__*/styled('div', {
2345
+ windth: '100%',
2346
+ height: '$48',
2347
+ borderRadius: '$5',
2348
+ backgroundColor: '$background',
2349
+ border: '1px solid transparent',
2350
+ position: 'relative',
2351
+ display: 'flex',
2352
+ alignItems: 'center',
2353
+ paddingLeft: '$8',
2354
+ paddingRight: '$8'
2355
+ });
2356
+ function TokenPreview(props) {
2357
+ const {
2358
+ chain,
2359
+ token,
2360
+ loadingStatus
2361
+ } = props;
2362
+ const {
2363
+ t
2364
+ } = useTranslation();
2365
+ const ItemSuffix = React.createElement("div", {
2366
+ style: {
2367
+ display: 'flex',
2368
+ justifyContent: 'center',
2369
+ alignItems: 'center'
2370
+ }
2371
+ }, loadingStatus === 'failed' && React.createElement(InfoCircleIcon, {
2372
+ color: "error",
2373
+ size: 24
2374
+ }));
2375
+ return React.createElement(Box$1, null, React.createElement(Container$3, {
2376
+ type: 'outlined'
2377
+ }, React.createElement("div", {
2378
+ className: "head"
2379
+ }, React.createElement(Typography, {
2380
+ variant: "body2",
2381
+ color: "neutrals800"
2382
+ }, props.label), React.createElement(Typography, {
2383
+ variant: "caption",
2384
+ color: "neutrals600"
2385
+ }, `$${numberToString(props.usdValue)}`)), React.createElement("div", {
2386
+ className: "form"
2387
+ }, React.createElement(Button, {
2388
+ className: "selectors",
2389
+ variant: "outlined",
2390
+ loading: loadingStatus === 'loading',
2391
+ prefix: loadingStatus === 'success' && chain ? React.createElement(StyledImage$1, {
2392
+ src: chain.logo
2393
+ }) : React.createElement(ImagePlaceholder$1, null),
2394
+ suffix: ItemSuffix,
2395
+ align: "start",
2396
+ size: "large"
2397
+ }, loadingStatus === 'success' && chain ? chain.displayName : t('Chain')), React.createElement(Spacer, {
2398
+ size: 12
2399
+ }), React.createElement(Button, {
2400
+ className: "selectors",
2401
+ variant: "outlined",
2402
+ loading: loadingStatus === 'loading',
2403
+ prefix: loadingStatus === 'success' && token ? React.createElement(StyledImage$1, {
2404
+ src: token.image
2405
+ }) : React.createElement(ImagePlaceholder$1, null),
2406
+ suffix: ItemSuffix,
2407
+ size: "large",
2408
+ align: "start"
2409
+ }, loadingStatus === 'success' && token ? token.symbol : t('Token')), React.createElement(Spacer, {
2410
+ size: 12
2411
+ }), React.createElement("div", {
2412
+ className: "amount"
2413
+ }, React.createElement(OutputContainer$1, null, React.createElement(Typography, {
2414
+ variant: "h4"
2415
+ }, props.amount))))));
2416
+ }
2417
+
2418
+ const Container$4 = /*#__PURE__*/styled('div', {
2419
+ display: 'flex',
2420
+ alignItems: 'center',
2421
+ justifyContent: 'space-between',
2422
+ padding: '$8',
2423
+ borderRadius: '$5',
2424
+ backgroundColor: '$neutrals300',
2425
+ color: '$neutrals800',
2426
+ fontSize: '$12',
2427
+ '.routes': {
2428
+ display: 'flex',
2429
+ alignItems: 'center'
2430
+ },
2431
+ '.fee': {
2432
+ display: 'flex',
2433
+ alignItems: 'center'
2434
+ }
2435
+ });
2436
+ function RoutesOverview(props) {
2437
+ if (!props.routes) return null;
2438
+ const swaps = props.routes.result?.swaps;
2439
+ return React.createElement(Container$4, null, React.createElement("div", {
2440
+ className: "routes"
2441
+ }, swaps?.map((swap, idx) => {
2442
+ const isLast = idx + 1 == swaps.length;
2443
+ return React.createElement(React.Fragment, null, React.createElement("div", {
2444
+ className: "route"
2445
+ }, swap.from.symbol), React.createElement(ChevronRightIcon, {
2446
+ size: 12
2447
+ }), isLast ? React.createElement("div", {
2448
+ className: "route"
2449
+ }, swap.to.symbol) : null);
2450
+ })), props.totalFee ? React.createElement("div", {
2451
+ className: "fee"
2452
+ }, React.createElement(GasIcon, {
2453
+ size: 12
2454
+ }), React.createElement(Spacer, {
2455
+ size: 4
2456
+ }), "$", props.totalFee) : null);
2457
+ }
2458
+
2252
2459
  function ConfirmWalletsPage() {
2253
2460
  const navigate = useNavigate();
2254
2461
  const {
@@ -2256,7 +2463,8 @@ function ConfirmWalletsPage() {
2256
2463
  } = useNavigateBack();
2257
2464
  const bestRoute = useBestRouteStore.use.bestRoute();
2258
2465
  const {
2259
- blockchains
2466
+ blockchains,
2467
+ tokens
2260
2468
  } = useMetaStore.use.meta();
2261
2469
  const accounts = useWalletsStore.use.accounts();
2262
2470
  const selectedWallets = useWalletsStore.use.selectedWallets();
@@ -2279,20 +2487,52 @@ function ConfirmWalletsPage() {
2279
2487
  const network = wallet;
2280
2488
  getKeplrCompatibleConnectedWallets(selectableWallets).forEach(compatibleWallet => connect?.(compatibleWallet, network));
2281
2489
  };
2490
+ const totalFeeInUsd = getTotalFeeInUsd(bestRoute, tokens);
2282
2491
  return React.createElement(ConfirmWallets, {
2283
2492
  requiredWallets: getRequiredChains(bestRoute),
2284
2493
  selectableWallets: selectableWallets,
2285
2494
  onBack: navigateBackFrom.bind(null, navigationRoutes.confirmWallets),
2286
- swap: bestRoute,
2287
- fromAmount: fromAmount,
2288
- toAmount: toAmount,
2289
2495
  onConfirm: () => navigate(navigationRoutes.confirmSwap, {
2290
2496
  replace: true
2291
2497
  }),
2292
2498
  onChange: wallet => setSelectedWallet(wallet),
2293
2499
  confirmDisabled: confirmDisabled,
2294
2500
  handleConnectChain: wallet => handleConnectChain(wallet),
2295
- isExperimentalChain: wallet => getKeplrCompatibleConnectedWallets(selectableWallets).length > 0 ? isExperimentalChain(blockchains, wallet) : false
2501
+ isExperimentalChain: wallet => getKeplrCompatibleConnectedWallets(selectableWallets).length > 0 ? isExperimentalChain(blockchains, wallet) : false,
2502
+ previewInputs: React.createElement(React.Fragment, null, React.createElement(TokenPreview, {
2503
+ chain: {
2504
+ displayName: firstStep?.from.blockchain || '',
2505
+ logo: firstStep?.from.blockchainLogo || ''
2506
+ },
2507
+ token: {
2508
+ symbol: firstStep?.from.symbol || '',
2509
+ image: firstStep?.from.logo || ''
2510
+ },
2511
+ usdValue: calcOutputUsdValue(fromAmount, firstStep?.from.usdPrice),
2512
+ amount: fromAmount,
2513
+ label: t('From'),
2514
+ loadingStatus: 'success'
2515
+ }), React.createElement(Spacer, {
2516
+ size: 12,
2517
+ direction: "vertical"
2518
+ }), React.createElement(TokenPreview, {
2519
+ chain: {
2520
+ displayName: lastStep?.to.blockchain || '',
2521
+ logo: lastStep?.to.blockchainLogo || ''
2522
+ },
2523
+ token: {
2524
+ symbol: lastStep?.to.symbol || '',
2525
+ image: lastStep?.to.logo || ''
2526
+ },
2527
+ usdValue: calcOutputUsdValue(toAmount, lastStep?.to.usdPrice),
2528
+ amount: toAmount,
2529
+ label: t('To'),
2530
+ loadingStatus: 'success'
2531
+ })),
2532
+ previewRoutes: React.createElement(RoutesOverview, {
2533
+ routes: bestRoute,
2534
+ totalFee: numberToString(totalFeeInUsd, 0, 2)
2535
+ })
2296
2536
  });
2297
2537
  }
2298
2538
 
@@ -2497,7 +2737,7 @@ const globalStyles = /*#__PURE__*/globalCss({
2497
2737
  });
2498
2738
  const globalFont = fontFamily => globalCss({
2499
2739
  '@import': ["url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap')", "url('https://fonts.cdnfonts.com/css/times-new-roman')"],
2500
- [`.font_${fontFamily.replace(/ /g, '')} ._text`]: {
2740
+ body: {
2501
2741
  fontFamily
2502
2742
  }
2503
2743
  })();
@@ -2523,16 +2763,16 @@ function useTheme(_ref) {
2523
2763
  warning = '#F5A623',
2524
2764
  success = '#0070F3',
2525
2765
  fontFamily = 'Robot',
2526
- borderRadius = 5
2766
+ borderRadius = 8
2527
2767
  } = _ref;
2528
2768
  const theme = useSettingsStore.use.theme();
2529
2769
  const fetchMeta = useMetaStore.use.fetchMeta();
2530
2770
  const colors = {
2531
2771
  neutrals200: '#FAFAFA',
2532
- neutrals300: '#EAEAEA',
2533
- neutrals400: '#999999',
2534
- neutrals500: '#888888',
2535
- neutrals600: '#666666',
2772
+ neutrals300: '#f2f2f2',
2773
+ neutrals400: '#dedede',
2774
+ neutrals500: '#cccccc',
2775
+ neutrals600: '#acacac',
2536
2776
  neutrals700: '#444444',
2537
2777
  neutrals800: '#333333',
2538
2778
  neutrals900: '#111111',
@@ -2576,10 +2816,10 @@ function useTheme(_ref) {
2576
2816
  neutrals200: '#111111',
2577
2817
  neutrals300: '#333333',
2578
2818
  neutrals400: '#444444',
2579
- neutrals500: '#666666',
2580
- neutrals600: '#888888',
2581
- neutrals700: '#999999',
2582
- neutrals800: '#EAEAEA',
2819
+ neutrals500: '#acacac',
2820
+ neutrals600: '#cccccc',
2821
+ neutrals700: '#dedede',
2822
+ neutrals800: '#f2f2f2',
2583
2823
  neutrals900: '#FAFAFA',
2584
2824
  foreground: background,
2585
2825
  background: foreground
@@ -2639,8 +2879,9 @@ function useSelectLanguage() {
2639
2879
  }
2640
2880
 
2641
2881
  var swap = "SWAP";
2642
- var From = "From";
2643
- var To = "To";
2882
+ var From = "You sell";
2883
+ var To = "You receive";
2884
+ var Balance = "Balance";
2644
2885
  var Max = "Max";
2645
2886
  var Chain = "Chain";
2646
2887
  var Token = "Token";
@@ -2652,12 +2893,13 @@ var en = {
2652
2893
  "Powered By": "Powered By",
2653
2894
  From: From,
2654
2895
  To: To,
2896
+ Balance: Balance,
2655
2897
  Max: Max,
2656
2898
  Chain: Chain,
2657
2899
  Token: Token,
2658
2900
  Source: Source,
2659
2901
  Destination: Destination,
2660
- "Select Wallet": "Select Wallet"
2902
+ "Select Wallet": "Connect Your Wallet"
2661
2903
  };
2662
2904
 
2663
2905
  var swap$1 = "TAKAS";