@rango-dev/widget-embedded 0.1.11-next.0 → 0.1.11-next.11

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 (77) hide show
  1. package/dist/App.d.ts +3 -3
  2. package/dist/App.d.ts.map +1 -1
  3. package/dist/QueueManager.d.ts.map +1 -1
  4. package/dist/components/AppRouter.d.ts +1 -7
  5. package/dist/components/AppRouter.d.ts.map +1 -1
  6. package/dist/components/AppRoutes.d.ts +2 -2
  7. package/dist/components/AppRoutes.d.ts.map +1 -1
  8. package/dist/components/Layout.d.ts +3 -3
  9. package/dist/components/Layout.d.ts.map +1 -1
  10. package/dist/components/TokenInfo.d.ts.map +1 -1
  11. package/dist/components/TokenPreview.d.ts.map +1 -1
  12. package/dist/hooks/useConfirmSwap.d.ts.map +1 -1
  13. package/dist/hooks/useTheme.d.ts +2 -5
  14. package/dist/hooks/useTheme.d.ts.map +1 -1
  15. package/dist/lib.d.ts +2 -2
  16. package/dist/lib.d.ts.map +1 -1
  17. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  18. package/dist/pages/Home.d.ts +1 -7
  19. package/dist/pages/Home.d.ts.map +1 -1
  20. package/dist/pages/LiquiditySourcesPage.d.ts +1 -2
  21. package/dist/pages/LiquiditySourcesPage.d.ts.map +1 -1
  22. package/dist/pages/SelectChainPage.d.ts +1 -2
  23. package/dist/pages/SelectChainPage.d.ts.map +1 -1
  24. package/dist/pages/SelectTokenPage.d.ts +2 -2
  25. package/dist/pages/SelectTokenPage.d.ts.map +1 -1
  26. package/dist/pages/SettingsPage.d.ts +1 -2
  27. package/dist/pages/SettingsPage.d.ts.map +1 -1
  28. package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
  29. package/dist/pages/WalletsPage.d.ts +1 -1
  30. package/dist/pages/WalletsPage.d.ts.map +1 -1
  31. package/dist/services/httpService.d.ts +2 -1
  32. package/dist/services/httpService.d.ts.map +1 -1
  33. package/dist/store/bestRoute.d.ts.map +1 -1
  34. package/dist/store/meta.d.ts.map +1 -1
  35. package/dist/store/settings.d.ts +2 -0
  36. package/dist/store/settings.d.ts.map +1 -1
  37. package/dist/types/config.d.ts +27 -29
  38. package/dist/types/config.d.ts.map +1 -1
  39. package/dist/utils/configs.d.ts +7 -0
  40. package/dist/utils/configs.d.ts.map +1 -0
  41. package/dist/utils/swap.d.ts +3 -7
  42. package/dist/utils/swap.d.ts.map +1 -1
  43. package/dist/widget-embedded.cjs.development.js +144 -195
  44. package/dist/widget-embedded.cjs.development.js.map +1 -1
  45. package/dist/widget-embedded.cjs.production.min.js +144 -195
  46. package/dist/widget-embedded.cjs.production.min.js.map +1 -1
  47. package/dist/widget-embedded.esm.js +144 -195
  48. package/dist/widget-embedded.esm.js.map +1 -1
  49. package/package.json +6 -4
  50. package/readme.md +1 -1
  51. package/src/App.tsx +36 -14
  52. package/src/QueueManager.tsx +9 -3
  53. package/src/components/AppRouter.tsx +7 -16
  54. package/src/components/AppRoutes.tsx +13 -32
  55. package/src/components/HeaderButtons.tsx +1 -1
  56. package/src/components/Layout.tsx +37 -27
  57. package/src/components/TokenInfo.tsx +9 -13
  58. package/src/components/TokenPreview.tsx +3 -7
  59. package/src/hooks/useConfirmSwap.ts +6 -5
  60. package/src/hooks/useTheme.ts +21 -9
  61. package/src/lib.tsx +30 -36
  62. package/src/pages/ConfirmSwapPage.tsx +2 -0
  63. package/src/pages/Home.tsx +3 -10
  64. package/src/pages/LiquiditySourcesPage.tsx +3 -6
  65. package/src/pages/SelectChainPage.tsx +6 -6
  66. package/src/pages/SelectTokenPage.tsx +16 -18
  67. package/src/pages/SettingsPage.tsx +8 -18
  68. package/src/pages/SwapDetailsPage.tsx +2 -4
  69. package/src/pages/WalletsPage.tsx +2 -2
  70. package/src/services/httpService.ts +12 -3
  71. package/src/store/bestRoute.ts +5 -4
  72. package/src/store/meta.ts +6 -4
  73. package/src/store/settings.ts +7 -0
  74. package/src/store/wallets.ts +2 -2
  75. package/src/types/config.ts +28 -29
  76. package/src/utils/configs.ts +24 -0
  77. package/src/utils/swap.ts +17 -99
@@ -1,7 +1,7 @@
1
- import { WalletState, Typography, InfoCircleIcon, AngleDownIcon, Spacer, Button, TextField, styled, Tooltip, RetryIcon, HistoryIcon, SettingsIcon, Header as Header$1, VerticalSwapIcon, BestRoute, Alert, ChevronRightIcon, GasIcon, ConfirmSwap, History, LiquiditySourcesSelector, BlockchainSelector, TokenSelector, Settings, SecondaryPage, Spinner, LoadingFailedAlert, Wallet, SwapHistory, AddWalletIcon, globalCss, createTheme, SwapContainer } from '@rango-dev/ui';
2
- import React, { useRef, useEffect, useState, useLayoutEffect } from 'react';
1
+ import { WalletState, Typography, InfoCircleIcon, AngleDownIcon, Spacer, Button, Image, TextField, styled, Tooltip, RetryIcon, HistoryIcon, SettingsIcon, Header as Header$1, VerticalSwapIcon, BestRoute, Alert, ChevronRightIcon, GasIcon, ConfirmSwap, History, LiquiditySourcesSelector, BlockchainSelector, TokenSelector, Settings, SecondaryPage, Spinner, LoadingFailedAlert, Wallet, SwapHistory, AddWalletIcon, globalCss, createTheme, SwapContainer } from '@rango-dev/ui';
2
+ import React, { useRef, useEffect, useState, useLayoutEffect, useMemo } from 'react';
3
3
  import { useInRouterContext as useInRouterContext$1, MemoryRouter, useLocation as useLocation$1, useNavigate as useNavigate$1 } from 'react-router';
4
- import { PendingSwapNetworkStatus, useQueueManager, getCurrentStep, getCurrentBlockchainOfOrNull, getRelatedWalletOrNull, cancelSwap, swapQueueDef, checkWaitingForNetworkChange } from '@rango-dev/queue-manager-rango-preset';
4
+ import { PendingSwapNetworkStatus, useQueueManager, calculatePendingSwap, getCurrentStep, getCurrentBlockchainOfOrNull, getRelatedWalletOrNull, cancelSwap, makeQueueDefinition, checkWaitingForNetworkChange } from '@rango-dev/queue-manager-rango-preset';
5
5
  import { isCosmosBlockchain, isEvmBlockchain } from 'rango-types';
6
6
  import { useSearchParams, useLocation, createSearchParams, useNavigate, useInRouterContext, useRoutes } from 'react-router-dom';
7
7
  import { create } from 'zustand';
@@ -421,7 +421,7 @@ function LimitErrorMessage(bestRoute) {
421
421
  recommendation
422
422
  };
423
423
  }
424
- function getSwapButtonState(loadingMetaStatus, accounts, loading, bestRoute, hasLimitError, highValueLoss, priceImpactCanNotBeComputed, needsToWarnEthOnPath, inputIsZero) {
424
+ function getSwapButtonState(loadingMetaStatus, accounts, loading, bestRoute, hasLimitError, highValueLoss, priceImpactCanNotBeComputed, needsToWarnEthOnPath, inputAmount) {
425
425
  if (loadingMetaStatus !== 'success') return {
426
426
  title: 'Connect Wallet',
427
427
  disabled: true
@@ -433,7 +433,7 @@ function getSwapButtonState(loadingMetaStatus, accounts, loading, bestRoute, has
433
433
  if (loading) return {
434
434
  title: 'Finding Best Route...',
435
435
  disabled: true
436
- };else if (inputIsZero) return {
436
+ };else if (!inputAmount || inputAmount === '0') return {
437
437
  title: 'Enter an amount',
438
438
  disabled: true
439
439
  };else if (!bestRoute || !bestRoute.result) return {
@@ -461,80 +461,6 @@ function getSwapButtonState(loadingMetaStatus, accounts, loading, bestRoute, has
461
461
  function canComputePriceImpact(bestRoute, inputAmount, inputUsdValue, outputUsdValue) {
462
462
  return !((inputUsdValue.lte(ZERO) || outputUsdValue.lte(ZERO)) && !!bestRoute?.result && !!inputAmount && inputAmount !== '0' && parseFloat(inputAmount || '0') !== 0 && !!bestRoute.result);
463
463
  }
464
- function calculatePendingSwap(inputAmount, bestRoute, wallets, settings, validateBalanceOrFee, meta) {
465
- const simulationResult = bestRoute.result;
466
- if (!simulationResult) throw Error('Simulation result should not be null');
467
- return {
468
- creationTime: new Date().getTime().toString(),
469
- finishTime: null,
470
- requestId: bestRoute.requestId || '',
471
- inputAmount: inputAmount,
472
- //@ts-ignore
473
- wallets,
474
- status: 'running',
475
- isPaused: false,
476
- extraMessage: null,
477
- extraMessageSeverity: null,
478
- extraMessageDetail: null,
479
- extraMessageErrorCode: null,
480
- networkStatusExtraMessage: null,
481
- networkStatusExtraMessageDetail: null,
482
- lastNotificationTime: null,
483
- //@ts-ignore
484
- settings: settings,
485
- simulationResult: simulationResult,
486
- validateBalanceOrFee,
487
- //@ts-ignore
488
- steps: bestRoute.result?.swaps?.map((swap, index) => {
489
- const swapper = meta.swappers.find(swapper => swapper.id === swap.swapperId);
490
- const swapperType = swapper?.types[0];
491
- const fromBlockchain = meta.blockchains.find(blockchain => blockchain.name === swap.from.blockchain);
492
- const toBlockchain = meta.blockchains.find(blockchain => blockchain.name === swap.to.blockchain);
493
- return {
494
- id: index + 1,
495
- fromBlockchain: swap.from.blockchain,
496
- fromSymbol: swap.from.symbol,
497
- fromSymbolAddress: swap.from.address,
498
- fromDecimals: swap.from.decimals,
499
- fromAmountPrecision: swap.fromAmountPrecision,
500
- fromAmountMinValue: swap.fromAmountMinValue,
501
- fromAmountMaxValue: swap.fromAmountMaxValue,
502
- toBlockchain: swap.to.blockchain,
503
- fromLogo: swap.from.logo,
504
- toSymbol: swap.to.symbol,
505
- toSymbolAddress: swap.to.address,
506
- toDecimals: swap.to.decimals,
507
- toLogo: swap.to.logo,
508
- startTransactionTime: new Date().getTime(),
509
- swapperId: swap.swapperId,
510
- feeInUsd: numberToString(getUsdFeeOfStep(swap, meta.tokens), null, 2),
511
- expectedOutputAmountHumanReadable: swap.toAmount,
512
- outputAmount: '',
513
- status: 'created',
514
- networkStatus: null,
515
- executedTransactionId: null,
516
- externalTransactionId: null,
517
- explorerUrl: null,
518
- trackingCode: null,
519
- cosmosTransaction: null,
520
- solanaTransaction: null,
521
- starknetTransaction: null,
522
- starknetApprovalTransaction: null,
523
- tronTransaction: null,
524
- tronApprovalTransaction: null,
525
- evmTransaction: null,
526
- evmApprovalTransaction: null,
527
- transferTransaction: null,
528
- diagnosisUrl: null,
529
- internalSteps: null,
530
- fromBlockchainLogo: fromBlockchain?.logo || '',
531
- toBlockchainLogo: toBlockchain?.logo || '',
532
- swapperLogo: swapper?.logo || '',
533
- swapperType: swapperType || ''
534
- };
535
- }) || []
536
- };
537
- }
538
464
  function requiredWallets(route) {
539
465
  const wallets = [];
540
466
  route?.result?.swaps.forEach(swap => {
@@ -576,7 +502,7 @@ function hasProperSlippage(userSlippage, minRequiredSlippage) {
576
502
  if (!minRequiredSlippage) return true;
577
503
  return parseFloat(userSlippage) >= parseFloat(minRequiredSlippage);
578
504
  }
579
- function createBestRouteRequestBody(fromToken, toToken, inputAmount, wallets, selectedWallets, disabledLiquiditySources, slippage, checkPrerequisites) {
505
+ function createBestRouteRequestBody(fromToken, toToken, inputAmount, wallets, selectedWallets, disabledLiquiditySources, slippage, affiliateRef, initialRoute) {
580
506
  const selectedWalletsMap = selectedWallets.reduce((selectedWalletsMap, selectedWallet) => (selectedWalletsMap[selectedWallet.chain] = selectedWallet.address, selectedWalletsMap), {});
581
507
  const connectedWallets = [];
582
508
  wallets.forEach(wallet => {
@@ -586,9 +512,11 @@ function createBestRouteRequestBody(fromToken, toToken, inputAmount, wallets, se
586
512
  addresses: [wallet.address]
587
513
  });
588
514
  });
589
- const filteredBlockchains = selectedWallets.map(wallet => wallet.chain);
515
+ const checkPrerequisites = !!initialRoute;
516
+ const filteredBlockchains = removeDuplicateFrom((initialRoute?.result?.swaps || []).reduce((blockchains, swap) => (blockchains.push(swap.from.blockchain, swap.to.blockchain), blockchains), []));
590
517
  const requestBody = {
591
518
  amount: inputAmount.toString(),
519
+ affiliateRef,
592
520
  checkPrerequisites,
593
521
  from: {
594
522
  address: fromToken.address,
@@ -775,7 +703,20 @@ const createSelectors = _store => {
775
703
  return store;
776
704
  };
777
705
 
778
- const httpService = /*#__PURE__*/new RangoClient(process.env.REACT_APP_API_KEY);
706
+ const RANGO_PUBLIC_API_KEY = 'c6381a79-2817-4602-83bf-6a641a409e32';
707
+ let configs = {
708
+ API_KEY: RANGO_PUBLIC_API_KEY
709
+ };
710
+ function getConfig(name) {
711
+ return configs[name];
712
+ }
713
+
714
+ let rango = undefined;
715
+ const httpService = () => {
716
+ if (rango) return rango;
717
+ rango = new RangoClient(getConfig('API_KEY'));
718
+ return rango;
719
+ };
779
720
 
780
721
  const SLIPPAGES = [0.5, 1, 3, 5, 8, 13, 20];
781
722
  const DEFAULT_SLIPPAGE = 1;
@@ -793,7 +734,7 @@ const useMetaStore = /*#__PURE__*/createSelectors( /*#__PURE__*/create()(set =>
793
734
  loadingStatus: 'loading',
794
735
  fetchMeta: async () => {
795
736
  try {
796
- const response = await httpService.getAllMetadata();
737
+ const response = await httpService().getAllMetadata();
797
738
  const chainThatHasTokenInMetaResponse = removeDuplicateFrom(response.tokens.map(t => t.blockchain));
798
739
  const enabledChains = response.blockchains.filter(chain => chain.enabled && chainThatHasTokenInMetaResponse.includes(chain.name));
799
740
  response.blockchains = enabledChains.sort((a, b) => a.sort - b.sort);
@@ -813,6 +754,7 @@ const useSettingsStore = /*#__PURE__*/createSelectors( /*#__PURE__*/create()( /*
813
754
  slippage: DEFAULT_SLIPPAGE,
814
755
  customSlippage: null,
815
756
  infiniteApprove: false,
757
+ affiliateRef: null,
816
758
  disabledLiquiditySources: [],
817
759
  theme: 'auto',
818
760
  setSlippage: slippage => set(() => ({
@@ -821,6 +763,9 @@ const useSettingsStore = /*#__PURE__*/createSelectors( /*#__PURE__*/create()( /*
821
763
  setCustomSlippage: customSlippage => set(() => ({
822
764
  customSlippage: customSlippage
823
765
  })),
766
+ setAffiliateRef: affiliateRef => set(() => ({
767
+ affiliateRef
768
+ })),
824
769
  toggleAllLiquiditySources: () => set(state => {
825
770
  const {
826
771
  swappers
@@ -871,7 +816,7 @@ const useWalletsStore = /*#__PURE__*/createSelectors( /*#__PURE__*/create()( /*#
871
816
  }));
872
817
  accounts.forEach(async account => {
873
818
  try {
874
- const response = await httpService.getWalletsDetails([{
819
+ const response = await httpService().getWalletsDetails([{
875
820
  address: account.address,
876
821
  blockchain: account.chain
877
822
  }]);
@@ -915,7 +860,7 @@ const useWalletsStore = /*#__PURE__*/createSelectors( /*#__PURE__*/create()( /*#
915
860
  }
916
861
  });
917
862
  return {
918
- selectedWallets: selectedWallets
863
+ selectedWallets: state.selectedWallets.concat(selectedWallets)
919
864
  };
920
865
  }),
921
866
  setSelectedWallet: wallet => set(state => ({
@@ -1099,20 +1044,21 @@ const bestRoute = (bestRouteStore, settingsStore) => {
1099
1044
  const {
1100
1045
  slippage,
1101
1046
  customSlippage,
1102
- disabledLiquiditySources
1047
+ disabledLiquiditySources,
1048
+ affiliateRef
1103
1049
  } = settingsStore.getState();
1104
1050
  if (!fromToken || !toToken || !inputAmount || inputAmount === '0') return;
1105
1051
  abortController?.abort();
1106
1052
  abortController = new AbortController();
1107
1053
  const userSlippage = !!customSlippage ? customSlippage : slippage;
1108
- const requestBody = createBestRouteRequestBody(fromToken, toToken, inputAmount, [], [], disabledLiquiditySources, userSlippage, false);
1054
+ const requestBody = createBestRouteRequestBody(fromToken, toToken, inputAmount, [], [], disabledLiquiditySources, userSlippage, affiliateRef);
1109
1055
  if (!bestRouteStore.getState().loading) bestRouteStore.setState({
1110
1056
  loading: true,
1111
1057
  bestRoute: null,
1112
1058
  outputAmount: null,
1113
1059
  outputUsdValue: new BigNumber(0)
1114
1060
  });
1115
- httpService.getBestRoute(requestBody, {
1061
+ httpService().getBestRoute(requestBody, {
1116
1062
  signal: abortController.signal
1117
1063
  }).then(res => {
1118
1064
  const {
@@ -1139,7 +1085,9 @@ const bestRoute = (bestRouteStore, settingsStore) => {
1139
1085
  inputAmount,
1140
1086
  inputUsdValue
1141
1087
  } = useBestRouteStore.getState();
1142
- if (!inputAmount || inputAmount === '0' || inputUsdValue.eq(0)) return;
1088
+ if (!inputAmount || inputAmount === '0' || inputUsdValue.eq(0)) return bestRouteStore.setState({
1089
+ loading: false
1090
+ });
1143
1091
  if (tokensAreEqual(fromToken, toToken)) return bestRouteStore.setState({
1144
1092
  loading: false,
1145
1093
  bestRoute: null,
@@ -1411,10 +1359,6 @@ const Container = /*#__PURE__*/styled('div', {
1411
1359
  }
1412
1360
  }
1413
1361
  });
1414
- const StyledImage = /*#__PURE__*/styled('img', {
1415
- width: '$24',
1416
- maxHeight: '$24'
1417
- });
1418
1362
  const Options = /*#__PURE__*/styled('div', {
1419
1363
  display: 'flex',
1420
1364
  justifyContent: 'flex-end',
@@ -1456,6 +1400,7 @@ function TokenInfo(props) {
1456
1400
  const bestRoute = useBestRouteStore.use.bestRoute();
1457
1401
  const inputAmount = useBestRouteStore.use.inputAmount();
1458
1402
  const balances = useWalletsStore.use.balances();
1403
+ const fetchingBestRoute = useBestRouteStore.use.loading();
1459
1404
  const navigate = useNavigate();
1460
1405
  const {
1461
1406
  t
@@ -1511,8 +1456,9 @@ function TokenInfo(props) {
1511
1456
  variant: "outlined",
1512
1457
  disabled: loadingStatus === 'failed',
1513
1458
  loading: loadingStatus === 'loading',
1514
- prefix: loadingStatus === 'success' && chain ? React.createElement(StyledImage, {
1515
- src: chain.logo
1459
+ prefix: loadingStatus === 'success' && chain ? React.createElement(Image, {
1460
+ src: chain.logo,
1461
+ size: 24
1516
1462
  }) : React.createElement(ImagePlaceholder, null),
1517
1463
  suffix: ItemSuffix,
1518
1464
  align: "start",
@@ -1527,8 +1473,9 @@ function TokenInfo(props) {
1527
1473
  variant: "outlined",
1528
1474
  disabled: loadingStatus === 'failed' || type === 'From' && !fromChain || type === 'To' && !toChain,
1529
1475
  loading: loadingStatus === 'loading',
1530
- prefix: loadingStatus === 'success' && token ? React.createElement(StyledImage, {
1531
- src: token.image
1476
+ prefix: loadingStatus === 'success' && token ? React.createElement(Image, {
1477
+ src: token.image,
1478
+ size: 24
1532
1479
  }) : React.createElement(ImagePlaceholder, null),
1533
1480
  suffix: ItemSuffix,
1534
1481
  size: "large",
@@ -1562,7 +1509,7 @@ function TokenInfo(props) {
1562
1509
  } : undefined
1563
1510
  }) : React.createElement(OutputContainer, null, React.createElement(Typography, {
1564
1511
  variant: "h4"
1565
- }, bestRoute ? `≈ ${numberToString(props.outputAmount)}` : inputAmount ? '?' : '0'))))));
1512
+ }, fetchingBestRoute && '?', !!bestRoute?.result && `≈ ${numberToString(props.outputAmount)}`, (!inputAmount || inputAmount === '0') && '0'))))));
1566
1513
  }
1567
1514
 
1568
1515
  const Container$1 = /*#__PURE__*/styled$1('div', {
@@ -1673,7 +1620,8 @@ function HeaderButtons(props) {
1673
1620
  onClick: onClickRefresh,
1674
1621
  disabled: !onClickRefresh
1675
1622
  }, React.createElement(RetryIcon, {
1676
- size: 24
1623
+ size: 24,
1624
+ disabled: !onClickRefresh
1677
1625
  }))), React.createElement(Tooltip, {
1678
1626
  content: "Transactions History"
1679
1627
  }, React.createElement(Button, {
@@ -1713,10 +1661,7 @@ const Alerts = /*#__PURE__*/styled('div', {
1713
1661
  width: '100%',
1714
1662
  paddingTop: '$16'
1715
1663
  });
1716
- function Home(props) {
1717
- const {
1718
- title = 'SWAP'
1719
- } = props;
1664
+ function Home() {
1720
1665
  const isRouterInContext = useInRouterContext();
1721
1666
  const navigate = useNavigate();
1722
1667
  const [count, setCount] = useState(0);
@@ -1748,8 +1693,7 @@ function Home(props) {
1748
1693
  swap
1749
1694
  } = LimitErrorMessage(bestRoute);
1750
1695
  const priceImpactCanNotBeComputed = !canComputePriceImpact(bestRoute, inputAmount, inputUsdValue, outputUsdValue);
1751
- const inputIsZero = inputAmount === '0';
1752
- const swapButtonState = getSwapButtonState(loadingMetaStatus, accounts, fetchingBestRoute, bestRoute, hasLimitError(bestRoute), highValueLoss, priceImpactCanNotBeComputed, needsToWarnEthOnPath, inputIsZero);
1696
+ const swapButtonState = getSwapButtonState(loadingMetaStatus, accounts, fetchingBestRoute, bestRoute, hasLimitError(bestRoute), highValueLoss, priceImpactCanNotBeComputed, needsToWarnEthOnPath, inputAmount);
1753
1697
  const totalFeeInUsd = getTotalFeeInUsd(bestRoute, tokens);
1754
1698
  const highFee = hasHighFee(totalFeeInUsd);
1755
1699
  useEffect(() => {
@@ -1757,7 +1701,7 @@ function Home(props) {
1757
1701
  return setCurrentPage.bind(null, '');
1758
1702
  }, []);
1759
1703
  return React.createElement(Container$2, null, React.createElement(Header$1, {
1760
- title: title,
1704
+ title: "SWAP",
1761
1705
  suffix: React.createElement(HeaderButtons, {
1762
1706
  onClickRefresh: !!bestRoute ? fetchBestRoute : undefined
1763
1707
  })
@@ -1818,8 +1762,7 @@ function Home(props) {
1818
1762
 
1819
1763
  const Route = _ref => {
1820
1764
  let {
1821
- children,
1822
- ...props
1765
+ children
1823
1766
  } = _ref;
1824
1767
  const location = useLocation$1();
1825
1768
  const navigate = useNavigate$1();
@@ -1830,7 +1773,7 @@ const Route = _ref => {
1830
1773
  });
1831
1774
  ref.current = false;
1832
1775
  }, []);
1833
- if (location.pathname === navigationRoutes.confirmSwap && ref.current) return React.createElement(Home, Object.assign({}, props));
1776
+ if (location.pathname === navigationRoutes.confirmSwap && ref.current) return React.createElement(Home, null);
1834
1777
  return React.createElement(React.Fragment, null, " ", children);
1835
1778
  };
1836
1779
  function AppRouter(_ref2) {
@@ -1924,10 +1867,6 @@ const Container$3 = /*#__PURE__*/styled('div', {
1924
1867
  }
1925
1868
  }
1926
1869
  });
1927
- const StyledImage$1 = /*#__PURE__*/styled('img', {
1928
- width: '$24',
1929
- maxHeight: '$24'
1930
- });
1931
1870
  const ImagePlaceholder$1 = /*#__PURE__*/styled('span', {
1932
1871
  width: '24px',
1933
1872
  height: '24px',
@@ -1983,8 +1922,9 @@ function TokenPreview(props) {
1983
1922
  className: "selectors",
1984
1923
  variant: "outlined",
1985
1924
  loading: loadingStatus === 'loading',
1986
- prefix: loadingStatus === 'success' && chain ? React.createElement(StyledImage$1, {
1987
- src: chain.logo
1925
+ prefix: loadingStatus === 'success' && chain ? React.createElement(Image, {
1926
+ src: chain.logo,
1927
+ size: 24
1988
1928
  }) : React.createElement(ImagePlaceholder$1, null),
1989
1929
  suffix: ItemSuffix,
1990
1930
  align: "start",
@@ -1995,8 +1935,9 @@ function TokenPreview(props) {
1995
1935
  className: "selectors",
1996
1936
  variant: "outlined",
1997
1937
  loading: loadingStatus === 'loading',
1998
- prefix: loadingStatus === 'success' && token ? React.createElement(StyledImage$1, {
1999
- src: token.image
1938
+ prefix: loadingStatus === 'success' && token ? React.createElement(Image, {
1939
+ src: token.image,
1940
+ size: 24
2000
1941
  }) : React.createElement(ImagePlaceholder$1, null),
2001
1942
  suffix: ItemSuffix,
2002
1943
  size: "large",
@@ -2074,6 +2015,7 @@ function useConfirmSwap() {
2074
2015
  const initialRoute = useBestRouteStore.use.bestRoute();
2075
2016
  const setBestRoute = useBestRouteStore.use.setBestRoute();
2076
2017
  const inputUsdValue = useBestRouteStore.use.inputUsdValue();
2018
+ const affiliateRef = useSettingsStore.use.affiliateRef();
2077
2019
  const accounts = useWalletsStore.use.accounts();
2078
2020
  const selectedWallets = useWalletsStore.use.selectedWallets();
2079
2021
  const meta = useMetaStore.use.meta();
@@ -2107,16 +2049,15 @@ function useConfirmSwap() {
2107
2049
  proceedAnywayRef.current = false;
2108
2050
  if (confiremedRouteRef.current) {
2109
2051
  const newSwap = calculatePendingSwap(inputAmount.toString(), confiremedRouteRef.current, getWalletsForNewSwap(selectedWallets), swapSettings, false, meta);
2110
- //@ts-ignore
2111
2052
  return newSwap;
2112
2053
  }
2113
2054
  return;
2114
2055
  }
2115
2056
  abortControllerRef.current = new AbortController();
2116
2057
  setLoading(true);
2117
- const requestBody = createBestRouteRequestBody(fromToken, toToken, inputAmount, accounts, selectedWallets, disabledLiquiditySources, userSlippage, true);
2058
+ const requestBody = createBestRouteRequestBody(fromToken, toToken, inputAmount, accounts, selectedWallets, disabledLiquiditySources, userSlippage, affiliateRef, initialRoute);
2118
2059
  try {
2119
- const confiremedRoute = await httpService.getBestRoute(requestBody, {
2060
+ const confiremedRoute = await httpService().getBestRoute(requestBody, {
2120
2061
  signal: abortControllerRef.current?.signal
2121
2062
  });
2122
2063
  abortControllerRef.current = null;
@@ -2170,7 +2111,6 @@ function useConfirmSwap() {
2170
2111
  disabledSwappersGroups: disabledLiquiditySources
2171
2112
  };
2172
2113
  const newSwap = calculatePendingSwap(inputAmount.toString(), confiremedRoute, getWalletsForNewSwap(selectedWallets), swapSettings, false, meta);
2173
- //@ts-ignore
2174
2114
  return newSwap;
2175
2115
  } else if (!proceedAnywayRef.current) {
2176
2116
  proceedAnywayRef.current = true;
@@ -2358,6 +2298,7 @@ function ConfirmSwapPage() {
2358
2298
  const customSlippage = useSettingsStore.use.customSlippage();
2359
2299
  const inputUsdValue = useBestRouteStore.use.inputUsdValue();
2360
2300
  const outputUsdValue = useBestRouteStore.use.outputUsdValue();
2301
+ const setInputAmount = useBestRouteStore.use.setInputAmount();
2361
2302
  const bestRouteloadingStatus = getBestRouteStatus(fetchingBestRoute, !!fetchingBestRouteError);
2362
2303
  const {
2363
2304
  manager
@@ -2404,6 +2345,7 @@ function ConfirmSwapPage() {
2404
2345
  navigate(navigationRoutes.swaps + `/${swap.requestId}`, {
2405
2346
  replace: true
2406
2347
  });
2348
+ setInputAmount('');
2407
2349
  }
2408
2350
  });
2409
2351
  },
@@ -2555,7 +2497,7 @@ function LiquiditySourcePage(_ref) {
2555
2497
  });
2556
2498
  return React.createElement(LiquiditySourcesSelector, {
2557
2499
  toggleAll: toggleAllLiquiditySources,
2558
- list: supportedSwappers !== 'all' ? uniqueSwappersGroups.filter(item => supportedSwappers.filter(s => s.title === item.title && s.type === item.type).length > 0) : uniqueSwappersGroups,
2500
+ list: supportedSwappers ? uniqueSwappersGroups.filter(item => supportedSwappers.filter(s => s === item.title).length > 0) : uniqueSwappersGroups,
2559
2501
  onChange: liquiditySource => toggleLiquiditySource(liquiditySource.title),
2560
2502
  onBack: navigateBackFrom.bind(null, navigationRoutes.liquiditySources),
2561
2503
  loadingStatus: loadingMetaStatus
@@ -2567,7 +2509,7 @@ function SelectChainPage(props) {
2567
2509
  type,
2568
2510
  supportedChains
2569
2511
  } = props;
2570
- const blockchains = supportedChains === 'all' ? useMetaStore.use.meta().blockchains : supportedChains;
2512
+ const blockchains = supportedChains ? useMetaStore.use.meta().blockchains.filter(chain => supportedChains.includes(chain.name)) : useMetaStore.use.meta().blockchains;
2571
2513
  const loadingStatus = useMetaStore.use.loadingStatus();
2572
2514
  const fromChain = useBestRouteStore.use.fromChain();
2573
2515
  const toChain = useBestRouteStore.use.toChain();
@@ -2599,8 +2541,8 @@ function SelectTokenPage(props) {
2599
2541
  } = props;
2600
2542
  const sourceTokens = useBestRouteStore.use.sourceTokens();
2601
2543
  const destinationTokens = useBestRouteStore.use.destinationTokens();
2602
- const supportedSourceTokens = supportedTokens === 'all' ? sourceTokens : sourceTokens.filter(token => supportedTokens.some(supportedToken => tokensAreEqual(supportedToken, token)));
2603
- const supportedDestinationTokens = supportedTokens === 'all' ? destinationTokens : destinationTokens.filter(token => supportedTokens.some(supportedToken => tokensAreEqual(supportedToken, token)));
2544
+ const supportedSourceTokens = supportedTokens ? sourceTokens.filter(token => supportedTokens.some(supportedToken => tokensAreEqual(supportedToken, token))) : sourceTokens;
2545
+ const supportedDestinationTokens = supportedTokens ? destinationTokens.filter(token => supportedTokens.some(supportedToken => tokensAreEqual(supportedToken, token))) : destinationTokens;
2604
2546
  const fromToken = useBestRouteStore.use.fromToken();
2605
2547
  const toToken = useBestRouteStore.use.toToken();
2606
2548
  const setFromToken = useBestRouteStore.use.setFromToken();
@@ -2653,8 +2595,8 @@ function SettingsPage(_ref) {
2653
2595
  }
2654
2596
  }
2655
2597
  });
2656
- supportedSwappers !== 'all' && uniqueSwappersGroups.filter(item => supportedSwappers.filter(s => s.title === item.title && s.type === item.type).length > 0);
2657
- const supportedUniqueSwappersGroups = supportedSwappers !== 'all' ? uniqueSwappersGroups.filter(item => supportedSwappers.filter(s => s.title === item.title && s.type === item.type).length > 0) : uniqueSwappersGroups;
2598
+ supportedSwappers && uniqueSwappersGroups.filter(item => supportedSwappers.filter(s => s === item.title).length > 0);
2599
+ const supportedUniqueSwappersGroups = supportedSwappers ? uniqueSwappersGroups.filter(item => supportedSwappers.filter(s => s === item.title).length > 0) : uniqueSwappersGroups;
2658
2600
  return React.createElement(Settings, {
2659
2601
  slippages: SLIPPAGES,
2660
2602
  selectedSlippage: slippage,
@@ -2707,7 +2649,7 @@ function WalletsPage(_ref) {
2707
2649
  getWalletInfo,
2708
2650
  connect
2709
2651
  } = useWallets();
2710
- const wallets = getlistWallet(state, getWalletInfo, supportedWallets === 'all' ? Object.values(WalletType) : supportedWallets);
2652
+ const wallets = getlistWallet(state, getWalletInfo, supportedWallets || Object.values(WalletType));
2711
2653
  const walletsRef = useRef();
2712
2654
  let sortedWallets = detectMobileScreens() ? wallets.filter(wallet => wallet.showOnMobile) : wallets;
2713
2655
  sortedWallets = sortWalletsBasedOnState(sortedWallets);
@@ -2916,7 +2858,7 @@ function SwapDetailsPage() {
2916
2858
  }), React.createElement(TokenPreview, {
2917
2859
  chain: {
2918
2860
  displayName: lastStep?.toBlockchain || '',
2919
- // @ts-ignore
2861
+ //@ts-ignore
2920
2862
  logo: lastStep?.toBlockchainLogo || ''
2921
2863
  },
2922
2864
  token: {
@@ -2928,7 +2870,6 @@ function SwapDetailsPage() {
2928
2870
  loadingStatus: 'success'
2929
2871
  })),
2930
2872
  //todo: move PendingSwap type to rango-types
2931
- //@ts-ignore
2932
2873
  pendingSwap: swap,
2933
2874
  onCopy: handleCopy,
2934
2875
  isCopied: isCopied,
@@ -2958,48 +2899,44 @@ function SwapDetailsPage() {
2958
2899
  const getAbsolutePath = path => path.replace('/', '');
2959
2900
  function AppRoutes(props) {
2960
2901
  const {
2961
- configs
2902
+ config
2962
2903
  } = props;
2963
2904
  return useRoutes([{
2964
2905
  path: getAbsolutePath(navigationRoutes.home),
2965
- element: React.createElement(Home, {
2966
- title: configs?.title,
2967
- titleSize: configs?.titleSize,
2968
- titleWeight: configs?.titleWeight
2969
- })
2906
+ element: React.createElement(Home, null)
2970
2907
  }, {
2971
2908
  path: getAbsolutePath(navigationRoutes.fromChain),
2972
2909
  element: React.createElement(SelectChainPage, {
2973
2910
  type: "from",
2974
- supportedChains: configs?.fromChains || 'all'
2911
+ supportedChains: config?.from?.blockchains
2975
2912
  })
2976
2913
  }, {
2977
2914
  path: getAbsolutePath(navigationRoutes.toChain),
2978
2915
  element: React.createElement(SelectChainPage, {
2979
2916
  type: "to",
2980
- supportedChains: configs?.toChains || 'all'
2917
+ supportedChains: config?.to?.blockchains
2981
2918
  })
2982
2919
  }, {
2983
2920
  path: getAbsolutePath(navigationRoutes.fromToken),
2984
2921
  element: React.createElement(SelectTokenPage, {
2985
2922
  type: "from",
2986
- supportedTokens: configs?.fromTokens || 'all'
2923
+ supportedTokens: config?.from?.tokens
2987
2924
  })
2988
2925
  }, {
2989
2926
  path: getAbsolutePath(navigationRoutes.toToken),
2990
2927
  element: React.createElement(SelectTokenPage, {
2991
2928
  type: "to",
2992
- supportedTokens: configs?.toTokens || 'all'
2929
+ supportedTokens: config?.to?.tokens
2993
2930
  })
2994
2931
  }, {
2995
2932
  path: getAbsolutePath(navigationRoutes.settings),
2996
2933
  element: React.createElement(SettingsPage, {
2997
- supportedSwappers: configs?.liquiditySources || 'all'
2934
+ supportedSwappers: config?.liquiditySources
2998
2935
  })
2999
2936
  }, {
3000
2937
  path: getAbsolutePath(navigationRoutes.liquiditySources),
3001
2938
  element: React.createElement(LiquiditySourcePage, {
3002
- supportedSwappers: configs?.liquiditySources || 'all'
2939
+ supportedSwappers: config?.liquiditySources
3003
2940
  })
3004
2941
  }, {
3005
2942
  path: getAbsolutePath(navigationRoutes.swaps),
@@ -3010,8 +2947,8 @@ function AppRoutes(props) {
3010
2947
  }, {
3011
2948
  path: getAbsolutePath(navigationRoutes.wallets),
3012
2949
  element: React.createElement(WalletsPage, {
3013
- supportedWallets: configs?.wallets || 'all',
3014
- multiWallets: typeof configs?.multiWallets === 'undefined' ? true : configs.multiWallets
2950
+ supportedWallets: config?.wallets,
2951
+ multiWallets: typeof config?.multiWallets === 'undefined' ? true : config.multiWallets
3015
2952
  })
3016
2953
  }, {
3017
2954
  path: getAbsolutePath(navigationRoutes.confirmSwap),
@@ -3027,16 +2964,14 @@ const Header = /*#__PURE__*/styled('div', {
3027
2964
  display: 'flex'
3028
2965
  }
3029
2966
  });
3030
- const WalletImage = /*#__PURE__*/styled('img', {
3031
- width: '$24',
3032
- height: '$24',
2967
+ const WalletImageContainer = /*#__PURE__*/styled('div', {
3033
2968
  marginLeft: -15,
3034
2969
  marginRight: '$6',
3035
2970
  borderRadius: '99999px'
3036
2971
  });
3037
2972
  function Layout(_ref) {
3038
2973
  let {
3039
- configs
2974
+ config
3040
2975
  } = _ref;
3041
2976
  const navigate = useNavigate();
3042
2977
  const {
@@ -3048,11 +2983,16 @@ function Layout(_ref) {
3048
2983
  getWalletInfo
3049
2984
  } = useWallets();
3050
2985
  const connectedWalletsImages = removeDuplicateFrom(getSelectableWallets(accounts, selectedWallets, getWalletInfo).map(w => w.image));
2986
+ const {
2987
+ blockchains,
2988
+ tokens
2989
+ } = useMetaStore.use.meta();
3051
2990
  const setFromChain = useBestRouteStore.use.setFromChain();
3052
2991
  const setFromToken = useBestRouteStore.use.setFromToken();
3053
2992
  const setToChain = useBestRouteStore.use.setToChain();
3054
2993
  const setToToken = useBestRouteStore.use.setToToken();
3055
2994
  const setInputAmount = useBestRouteStore.use.setInputAmount();
2995
+ const setAffiliateRef = useSettingsStore.use.setAffiliateRef();
3056
2996
  const totalBalance = calculateWalletUsdValue(balances);
3057
2997
  const connectWalletsButtonDisabled = useUiStore.use.connectWalletsButtonDisabled();
3058
2998
  const loadingMetaStatus = useMetaStore.use.loadingStatus();
@@ -3061,22 +3001,23 @@ function Layout(_ref) {
3061
3001
  t
3062
3002
  } = useTranslation();
3063
3003
  useEffect(() => {
3064
- setToChain(configs?.toChain || null);
3065
- setToToken(configs?.toToken || null);
3066
- }, [configs?.toChain, configs?.toToken]);
3004
+ const chain = blockchains.find(chain => chain.name === config?.to?.blockchain);
3005
+ const token = tokens.find(t => tokensAreEqual(t, config?.to?.token || null));
3006
+ setToChain(chain || null);
3007
+ setToToken(token || null);
3008
+ }, [config?.to?.token, config?.to?.blockchain]);
3067
3009
  useEffect(() => {
3068
- setInputAmount(configs?.fromAmount?.toString() || '');
3069
- }, [configs?.fromAmount]);
3010
+ setInputAmount(config?.amount?.toString() || '');
3011
+ }, [config?.amount]);
3070
3012
  useEffect(() => {
3071
- setFromToken(configs?.fromToken || null);
3072
- setFromChain(configs?.fromChain || null);
3073
- }, [configs?.fromToken, configs?.fromChain]);
3013
+ const chain = blockchains.find(chain => chain.name === config?.from?.blockchain);
3014
+ const token = tokens.find(t => tokensAreEqual(t, config?.from?.token || null));
3015
+ setFromChain(chain || null);
3016
+ setFromToken(token || null);
3017
+ }, [config?.from?.token, config?.from?.blockchain]);
3074
3018
  useEffect(() => {
3075
- setToChain(null);
3076
- setFromChain(null);
3077
- setFromToken(null);
3078
- setToToken(null);
3079
- }, [configs?.fromChains, configs?.toChains, configs?.fromTokens, configs?.toTokens]);
3019
+ setAffiliateRef(config?.affiliateRef || null);
3020
+ }, [config?.affiliateRef]);
3080
3021
  return React.createElement(React.Fragment, null, React.createElement(Header, null, React.createElement(Button, {
3081
3022
  size: "small",
3082
3023
  suffix: React.createElement(AddWalletIcon, {
@@ -3089,15 +3030,17 @@ function Layout(_ref) {
3089
3030
  onClick: () => {
3090
3031
  if (!connectWalletsButtonDisabled) navigate(navigationRoutes.wallets);
3091
3032
  }
3092
- }, connectedWalletsImages?.length ? connectedWalletsImages.map((walletImage, index) => React.createElement(WalletImage, {
3093
- key: index,
3094
- src: walletImage
3095
- })) : React.createElement(React.Fragment, null), React.createElement("div", {
3033
+ }, connectedWalletsImages?.length ? connectedWalletsImages.map((walletImage, index) => React.createElement(WalletImageContainer, {
3034
+ key: index
3035
+ }, React.createElement(Image, {
3036
+ src: walletImage,
3037
+ size: 24
3038
+ }))) : React.createElement(React.Fragment, null), React.createElement("div", {
3096
3039
  className: "balance"
3097
3040
  }, React.createElement(Typography, {
3098
3041
  variant: "body2"
3099
3042
  }, !accounts?.length ? t('Connect Wallet') : `$${totalBalance || 0}`), fetchingBalance && React.createElement(Spinner, null)))), React.createElement(AppRoutes, {
3100
- configs: configs
3043
+ config: config
3101
3044
  }));
3102
3045
  }
3103
3046
 
@@ -3140,17 +3083,20 @@ function usePrevious(value) {
3140
3083
 
3141
3084
  function useTheme(_ref) {
3142
3085
  let {
3143
- primary = '#5FA425',
3144
- background = '#fff',
3145
- foreground = '#000',
3146
- error = '#FF0000',
3147
- warning = '#F5A623',
3148
- success = '#0070F3',
3086
+ colors: themeColors,
3149
3087
  fontFamily = 'Robot',
3150
- borderRadius = 8
3088
+ borderRadius = 8,
3089
+ mode = 'auto'
3151
3090
  } = _ref;
3152
3091
  const theme = useSettingsStore.use.theme();
3153
3092
  const fetchMeta = useMetaStore.use.fetchMeta();
3093
+ const setTheme = useSettingsStore.use.setTheme();
3094
+ const primary = themeColors?.primary || '#5FA425',
3095
+ background = themeColors?.background || '#fff',
3096
+ foreground = themeColors?.foreground || '#000',
3097
+ error = themeColors?.error || '#FF0000',
3098
+ warning = themeColors?.warning || '#F5A623',
3099
+ success = themeColors?.success || '#0070F3';
3154
3100
  const colors = {
3155
3101
  neutrals200: '#FAFAFA',
3156
3102
  neutrals300: '#f2f2f2',
@@ -3192,6 +3138,9 @@ function useTheme(_ref) {
3192
3138
  colors,
3193
3139
  radii: {
3194
3140
  5: `${borderRadius}px`
3141
+ },
3142
+ shadows: {
3143
+ s: '0px 3px 5px 3px #f0f2f5, 0px 6px 10px 3px #f0f2f5, 0px 1px 18px 3px #f0f2f5'
3195
3144
  }
3196
3145
  });
3197
3146
  const customeDarkTheme = createTheme({
@@ -3210,6 +3159,9 @@ function useTheme(_ref) {
3210
3159
  },
3211
3160
  radii: {
3212
3161
  5: `${borderRadius}px`
3162
+ },
3163
+ shadows: {
3164
+ s: '0px 3px 5px 3px #222, 0px 6px 10px 3px #222, 0px 1px 18px 3px #222'
3213
3165
  }
3214
3166
  });
3215
3167
  const [OSTheme, setOSTheme] = useState(customeLightTheme);
@@ -3228,6 +3180,9 @@ function useTheme(_ref) {
3228
3180
  window.matchMedia('(prefers-color-scheme: dark)').removeEventListener('change', switchTheme);
3229
3181
  };
3230
3182
  }, []);
3183
+ useEffect(() => {
3184
+ if (mode !== 'auto') setTheme(mode);
3185
+ }, [mode]);
3231
3186
  const prevFont = usePrevious(fontFamily);
3232
3187
  useLayoutEffect(() => {
3233
3188
  const {
@@ -3332,6 +3287,11 @@ function QueueManager(props) {
3332
3287
  canSwitchNetworkTo,
3333
3288
  getWalletInfo
3334
3289
  } = useWallets();
3290
+ const swapQueueDef = useMemo(() => {
3291
+ return makeQueueDefinition({
3292
+ API_KEY: getConfig('API_KEY')
3293
+ });
3294
+ }, []);
3335
3295
  const {
3336
3296
  blockchains
3337
3297
  } = useMetaStore.use.meta();
@@ -3392,29 +3352,27 @@ function QueueManager(props) {
3392
3352
 
3393
3353
  const SwapBox = _ref => {
3394
3354
  let {
3395
- configs
3355
+ config
3396
3356
  } = _ref;
3397
3357
  globalStyles();
3398
- globalFont(configs?.fontFamily || 'Roboto');
3358
+ globalFont(config?.theme?.fontFamily || 'Roboto');
3399
3359
  const {
3400
3360
  activeTheme
3401
3361
  } = useTheme({
3402
- ...configs.colors,
3403
- borderRadius: configs?.borderRadius,
3404
- fontFamily: configs?.fontFamily
3362
+ ...config?.theme
3405
3363
  });
3406
3364
  const {
3407
3365
  blockchains
3408
3366
  } = useMetaStore.use.meta();
3409
3367
  const disconnectWallet = useWalletsStore.use.disconnectWallet();
3410
3368
  const connectWallet = useWalletsStore.use.connectWallet();
3411
- const setTheme = useSettingsStore.use.setTheme();
3412
3369
  const {
3413
3370
  changeLanguage
3414
3371
  } = useSelectLanguage();
3415
3372
  const clearConnectedWallet = useWalletsStore.use.clearConnectedWallet();
3416
3373
  const [lastConnectedWalletWithNetwork, setLastConnectedWalletWithNetwork] = useState('');
3417
3374
  const [disconnectedWallet, setDisconnectedWallet] = useState();
3375
+ const currentPage = useUiStore.use.currentPage();
3418
3376
  const evmBasedChainNames = blockchains.filter(isEvmBlockchain$1).map(chain => chain.name);
3419
3377
  const onUpdateState = (type, event, value, state, supportedChains) => {
3420
3378
  if (event === Events.ACCOUNTS) {
@@ -3439,19 +3397,16 @@ const SwapBox = _ref => {
3439
3397
  };
3440
3398
  let providers = allProviders();
3441
3399
  useEffect(() => {
3442
- if (configs.theme !== 'auto') setTheme(configs.theme);
3443
- }, [configs.theme]);
3444
- useEffect(() => {
3445
- const wallets = configs.wallets;
3400
+ const wallets = config?.wallets;
3446
3401
  clearConnectedWallet();
3447
- providers = wallets === 'all' ? allProviders() : allProviders().filter(provider => {
3402
+ providers = !wallets ? allProviders() : allProviders().filter(provider => {
3448
3403
  const type = provider.config.type;
3449
3404
  return wallets.find(w => w === type);
3450
3405
  });
3451
- }, [configs?.wallets]);
3406
+ }, [config?.wallets]);
3452
3407
  useEffect(() => {
3453
- changeLanguage(configs?.languege);
3454
- }, [configs?.languege]);
3408
+ changeLanguage(config?.language || 'en');
3409
+ }, [config?.language]);
3455
3410
  return React.createElement(Provider$1, {
3456
3411
  allBlockChains: blockchains,
3457
3412
  providers: providers,
@@ -3460,21 +3415,15 @@ const SwapBox = _ref => {
3460
3415
  id: "pageContainer",
3461
3416
  className: activeTheme
3462
3417
  }, React.createElement(QueueManager, null, React.createElement(SwapContainer, {
3463
- style: {
3464
- width: configs?.width || 'auto',
3465
- height: configs?.height || 'auto'
3466
- }
3418
+ fixedHeight: currentPage !== navigationRoutes.home
3467
3419
  }, React.createElement(AppRouter, {
3468
- title: configs.title,
3469
- titleSize: configs.titleSize,
3470
- titleWeight: configs.titleWeight,
3471
3420
  lastConnectedWallet: lastConnectedWalletWithNetwork,
3472
3421
  disconnectedWallet: disconnectedWallet,
3473
3422
  clearDisconnectedWallet: () => {
3474
3423
  setDisconnectedWallet(undefined);
3475
3424
  }
3476
3425
  }, React.createElement(Layout, {
3477
- configs: configs
3426
+ config: config
3478
3427
  }))))));
3479
3428
  };
3480
3429