@imtbl/sdk 1.63.0 → 1.64.0

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 (57) hide show
  1. package/dist/{blockchain_data-Dpv5muPl.js → blockchain_data-BJFFyOsZ.js} +2 -2
  2. package/dist/blockchain_data.js +3 -3
  3. package/dist/browser/checkout/{AddTokensWidget-BfDY0LwB.js → AddTokensWidget-_RYa4euh.js} +31 -24
  4. package/dist/browser/checkout/{BridgeWidget-DreWq2OO.js → BridgeWidget-BCC7YXWj.js} +9 -8
  5. package/dist/browser/checkout/{CommerceWidget-BFEo_z63.js → CommerceWidget-B4QxFLZq.js} +17 -16
  6. package/dist/browser/checkout/CryptoFiatProvider-b0KhVg3Y.js +224 -0
  7. package/dist/browser/checkout/{EllipsizedText-_yDoxF8V.js → EllipsizedText-CF9lzi6c.js} +1 -1
  8. package/dist/browser/checkout/{FeesBreakdown-CQVi4M-W.js → FeesBreakdown-BGnZxcX5.js} +1 -1
  9. package/dist/browser/checkout/{HandoverContent-D0HXf455.js → HandoverContent-CESizLWk.js} +1 -1
  10. package/dist/browser/checkout/{OnRampWidget-BpRLbHli.js → OnRampWidget-BrGpM6Vn.js} +3 -3
  11. package/dist/browser/checkout/{SaleWidget-C-ATgwRu.js → SaleWidget-iuigaIZp.js} +15 -26
  12. package/dist/browser/checkout/{SpendingCapHero-DLdYNa0u.js → SpendingCapHero-B3sb2Wt1.js} +1 -1
  13. package/dist/browser/checkout/{SwapWidget-Dm2cQUYh.js → SwapWidget-CdXf4YYP.js} +9 -8
  14. package/dist/browser/checkout/{TopUpView-Nbu5J6zy.js → TopUpView-Bg-huhcb.js} +6 -239
  15. package/dist/browser/checkout/{WalletApproveHero-Cc6p3CkR.js → WalletApproveHero-DW6Uw6rT.js} +3 -3
  16. package/dist/browser/checkout/{WalletWidget-C25SCVnz.js → WalletWidget-ChYjXfAy.js} +7 -22
  17. package/dist/browser/checkout/{auto-track-1Zr4QLt3.js → auto-track-CgS-wbin.js} +1 -1
  18. package/dist/browser/checkout/{index-Co93fBqn.js → index-BjLYItcm.js} +24 -21
  19. package/dist/browser/checkout/{index-c7pVchOF.js → index-BqJ9Usxu.js} +1 -1
  20. package/dist/browser/checkout/{index-BYrBQsd2.js → index-C4anNRY5.js} +2 -2
  21. package/dist/browser/checkout/{index-DzrC5Kuy.js → index-CshBDuS0.js} +1 -1
  22. package/dist/browser/checkout/{index-3DC3zK0u.js → index-D6TVOnc2.js} +1 -1
  23. package/dist/browser/checkout/{index-t2b5ztUB.js → index-DoYS_inI.js} +1 -1
  24. package/dist/browser/checkout/{index-Vadzr0yp.js → index-LCMExv1j.js} +1 -1
  25. package/dist/browser/checkout/{index-DthkZUK5.js → index-bNCjF_qE.js} +1 -1
  26. package/dist/browser/checkout/{index-B7urOO_H.js → index-qYOj-RwR.js} +1 -1
  27. package/dist/browser/checkout/{index.umd-CwLr5uH5.js → index.umd-CL6Tp5Ej.js} +1 -1
  28. package/dist/browser/checkout/{retry-DqIpQ6wO.js → retry-GJcGp5Sw.js} +1 -1
  29. package/dist/browser/checkout/sdk.js +4 -4
  30. package/dist/browser/checkout/{useInterval-D42dwhRA.js → useInterval-BfG2xnz-.js} +1 -1
  31. package/dist/browser/checkout/widgets-esm.js +1 -1
  32. package/dist/browser/checkout/widgets.js +36 -65
  33. package/dist/{checkout-Dr99AQC1.js → checkout-Cs8dXzsO.js} +5 -5
  34. package/dist/checkout.js +5 -5
  35. package/dist/{config-DkJOEY8_.js → config-COmcON31.js} +1 -1
  36. package/dist/config.js +1 -1
  37. package/dist/{index-DWXUkxHc.js → index-27OfHl8u.js} +1 -1
  38. package/dist/{index-ONuhnAdl.js → index-8JzLLOmv.js} +1 -1
  39. package/dist/{index-Dvd-bDuR.js → index-B1oIamSp.js} +4 -4
  40. package/dist/{index-CK8NRXyO.js → index-BDcnlE-I.js} +1 -1
  41. package/dist/{index-B7ZGqefm.js → index-CPZC_4-h.js} +1 -1
  42. package/dist/{index-BI-lDUrN.js → index-CinJtsQi.js} +3 -3
  43. package/dist/index.browser.js +5 -5
  44. package/dist/index.browser.js.map +1 -1
  45. package/dist/index.cjs +77 -7
  46. package/dist/index.js +14 -14
  47. package/dist/{minting_backend-CpZGmZ-L.js → minting_backend-CkmXVZ0p.js} +3 -3
  48. package/dist/minting_backend.js +5 -5
  49. package/dist/{orderbook-BGc1pQHt.js → orderbook-Bi2t8guV.js} +1 -1
  50. package/dist/orderbook.js +2 -2
  51. package/dist/{passport-CsmpMk_U.js → passport-B9TINukj.js} +73 -3
  52. package/dist/passport.js +4 -4
  53. package/dist/{webhook-8q1P3n_h.js → webhook-D45ZPknC.js} +1 -1
  54. package/dist/webhook.js +2 -2
  55. package/dist/{x-BNK0EB3B.js → x-C1LIWzQf.js} +3 -3
  56. package/dist/x.js +4 -4
  57. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { A as APIError, B as BlockchainData } from './index-BI-lDUrN.js';
2
- import { i as index } from './index-B7ZGqefm.js';
1
+ import { A as APIError, B as BlockchainData } from './index-CinJtsQi.js';
2
+ import { i as index } from './index-CPZC_4-h.js';
3
3
 
4
4
  var blockchain_data = /*#__PURE__*/Object.freeze({
5
5
  __proto__: null,
@@ -1,6 +1,6 @@
1
- export { A as APIError, B as BlockchainData } from './index-BI-lDUrN.js';
2
- export { i as Types } from './index-B7ZGqefm.js';
3
- import './index-CK8NRXyO.js';
1
+ export { A as APIError, B as BlockchainData } from './index-CinJtsQi.js';
2
+ export { i as Types } from './index-CPZC_4-h.js';
3
+ import './index-BDcnlE-I.js';
4
4
  import 'axios';
5
5
  import 'lru-memorise';
6
6
  import 'global-const';
@@ -1,9 +1,9 @@
1
- import { _ as _objectWithoutProperties, x as useTheme, y as useForwardLocalDomRef, z as useGetSubcomponentChild, A as useSplitApartChildrenAndSubComponents, r as reactExports, D as merge$2, F as useResizeObserver, q as jsxs, j as jsx, G as SmartClone, H as Box, J as isChildSubcomponent, K as flattenChildren, M as Body, N as useTheme$1, Q as Icon, R as ButtCon, T as Button, U as _defineProperty, X as isDualVariantIcon, Y as _slicedToArray, Z as isNumberWithinTotal, $ as getStartingSize, a0 as BaseClickable, a1 as ClassNames, a2 as _toConsumableArray, a3 as isError, a4 as Badge, a5 as FramedIcon, a6 as FramedImage, a7 as FramedLogo, a8 as Stack, a9 as hFlex, aa as usePrevious, ab as useBrowserEffect, ac as getHeadingTextStyles, ad as vFlex, ae as centerFlexChildren, af as FormControlLabel, ag as FormControlValidation, ah as FormControlCaption, I as IMTBLWidgetEvents, ai as AddTokensEventType, aj as getDefaultExportFromCjs, ak as commonjsGlobal, l as useTranslation, al as MenuItem, am as tokenValueFormat, an as DEFAULT_TOKEN_FORMATTING_DECIMALS, ao as BigNumber, ap as getRemoteVideo, aq as FramedVideo, ar as motion, as as listItemVariants, at as Divider, au as Fragment, av as listVariants, aw as useProvidersContext, ax as Drawer, ay as useAnalytics, az as UserJourney, aA as Heading, aB as WalletDrawer, aC as UnableToConnectDrawer, aD as ChangedYourMindDrawer, aE as WalletProviderRdns, aF as getProviderSlugFromRdns, aG as Web3Provider, aH as connectEIP6963Provider, aI as identifyUser, aJ as ConnectEIP6963ProviderError, aK as ProvidersContextActions, aL as ViewContext, V as ViewActions, o as SharedViews, k as ChainId, aM as commonjsRequire, aN as getRemoteImage, aO as useHandover, aP as HandoverTarget, aQ as EventTargetContext, aR as getRemoteRive, aS as Trans, aT as Link, aU as useInjectedProviders, aV as getDefaultTokenImage, aW as OverflowDrawerMenu, aX as SimpleLayout, aY as TokenFilterTypes, h as getL2ChainId, aZ as isNativeToken, a_ as getTokenImageByAddress, a$ as orchestrationEvents, b0 as requireSecp256k1$1, b1 as requireLib_commonjs, b2 as require$$0$2, b3 as bech32$2, b4 as bnExports$1, b5 as require$$0$3, b6 as getAugmentedNamespace, b7 as require$$0$4, b8 as minimalisticAssert, b9 as require$$2, ba as hash$6, bb as MaxUint256, bc as merge$3, bd as SvgIcon, be as WalletWarningHero, bf as Environment, bg as t, bh as PriceDisplay, L as LoadingView, bi as viewReducer, bj as initialViewState, bk as isValidAddress, bl as amountInputValidation, bm as CloudImage, E as ErrorView, bn as ServiceUnavailableErrorView, bo as ServiceType } from './index-Co93fBqn.js';
2
- import { f as formatUnits, p as parseUnits } from './index-DzrC5Kuy.js';
3
- import { E as EllipsizedText, C as Contract } from './EllipsizedText-_yDoxF8V.js';
4
- import { r as retry, T as TokenImage } from './retry-DqIpQ6wO.js';
5
- import { H as HandoverContent } from './HandoverContent-D0HXf455.js';
6
- import { F as FeesBreakdown } from './FeesBreakdown-CQVi4M-W.js';
1
+ import { _ as _objectWithoutProperties, x as useTheme, y as useForwardLocalDomRef, z as useGetSubcomponentChild, A as useSplitApartChildrenAndSubComponents, r as reactExports, D as merge$2, F as useResizeObserver, q as jsxs, j as jsx, G as SmartClone, H as Box, J as isChildSubcomponent, K as flattenChildren, M as Body, N as useTheme$1, Q as Icon, R as ButtCon, T as Button, U as _defineProperty, X as isDualVariantIcon, Y as _slicedToArray, Z as isNumberWithinTotal, $ as getStartingSize, a0 as BaseClickable, a1 as ClassNames, a2 as _toConsumableArray, a3 as isError, a4 as Badge, a5 as FramedIcon, a6 as FramedImage, a7 as FramedLogo, a8 as Stack, a9 as hFlex, aa as usePrevious, ab as useBrowserEffect, ac as getHeadingTextStyles, ad as vFlex, ae as centerFlexChildren, af as FormControlLabel, ag as FormControlValidation, ah as FormControlCaption, I as IMTBLWidgetEvents, ai as AddTokensEventType, aj as getDefaultExportFromCjs, ak as commonjsGlobal, l as useTranslation, al as MenuItem, am as tokenValueFormat, an as DEFAULT_TOKEN_FORMATTING_DECIMALS, ao as BigNumber, ap as getRemoteVideo, aq as FramedVideo, ar as motion, as as listItemVariants, at as Divider, au as Fragment, av as listVariants, aw as useProvidersContext, ax as Drawer, ay as useAnalytics, az as UserJourney, aA as isPassportProvider, aB as Heading, aC as WalletDrawer, aD as UnableToConnectDrawer, aE as ChangedYourMindDrawer, aF as WalletProviderRdns, aG as getProviderSlugFromRdns, aH as Web3Provider, aI as connectEIP6963Provider, aJ as identifyUser, aK as ConnectEIP6963ProviderError, aL as ProvidersContextActions, aM as ViewContext, V as ViewActions, o as SharedViews, k as ChainId, aN as commonjsRequire, aO as getRemoteImage, aP as useHandover, aQ as HandoverTarget, aR as EventTargetContext, aS as getRemoteRive, aT as Trans, aU as Link, aV as useInjectedProviders, aW as getDefaultTokenImage, aX as OverflowDrawerMenu, aY as SimpleLayout, aZ as TokenFilterTypes, h as getL2ChainId, a_ as isNativeToken, a$ as getTokenImageByAddress, b0 as orchestrationEvents, b1 as requireSecp256k1$1, b2 as requireLib_commonjs, b3 as require$$0$2, b4 as bech32$2, b5 as bnExports$1, b6 as require$$0$3, b7 as getAugmentedNamespace, b8 as require$$0$4, b9 as minimalisticAssert, ba as require$$2, bb as hash$6, bc as MaxUint256, bd as merge$3, be as SvgIcon, bf as WalletWarningHero, bg as Environment, bh as t, bi as PriceDisplay, L as LoadingView, bj as viewReducer, bk as initialViewState, bl as isValidAddress, bm as amountInputValidation, bn as CloudImage, E as ErrorView, bo as ServiceUnavailableErrorView, bp as ServiceType } from './index-BjLYItcm.js';
2
+ import { f as formatUnits, p as parseUnits } from './index-CshBDuS0.js';
3
+ import { E as EllipsizedText, C as Contract } from './EllipsizedText-CF9lzi6c.js';
4
+ import { r as retry, T as TokenImage } from './retry-GJcGp5Sw.js';
5
+ import { H as HandoverContent } from './HandoverContent-CESizLWk.js';
6
+ import { F as FeesBreakdown } from './FeesBreakdown-BGnZxcX5.js';
7
7
 
8
8
  var bannerSx = {
9
9
  d: "flex",
@@ -1695,6 +1695,7 @@ function getRouteAndTokenBalances(routeData) {
1695
1695
  }
1696
1696
 
1697
1697
  function RouteOption({ routeData, onClick, chains, disabled = false, isFastest = false, size = 'small', rc = jsx("span", {}), selected = false, }) {
1698
+ const { t } = useTranslation();
1698
1699
  const { fromToken } = routeData.amountData;
1699
1700
  const { estimate } = routeData.route.route;
1700
1701
  const chain = chains?.find((c) => c.id === fromToken.chainId);
@@ -1712,7 +1713,7 @@ function RouteOption({ routeData, onClick, chains, disabled = false, isFastest =
1712
1713
  size,
1713
1714
  onClick: disabled ? undefined : handleClick,
1714
1715
  };
1715
- return (jsxs(MenuItem, { ...menuItemProps, children: [jsx(MenuItem.Label, { children: fromToken.name }), chain && (jsxs(Sticker, { position: { x: 'right', y: 'bottom' }, children: [jsx(Sticker.FramedImage, { use: jsx("img", { src: chain.iconUrl, alt: chain.name }), size: "xSmall" }), jsx(MenuItem.FramedImage, { circularFrame: true, use: jsx("img", { src: fromToken.iconUrl, alt: fromToken.name }) })] })), jsx(MenuItem.Caption, { children: `Balance: USD ${routeBalanceUsd}` }), jsx(MenuItem.PriceDisplay, { price: fromAmount, children: jsx(MenuItem.PriceDisplay.Caption, { children: `USD $${fromAmountUsd}` }) }), jsxs(MenuItem.BottomSlot, { children: [jsx(MenuItem.BottomSlot.Divider, {}), jsxs(Stack, { rc: jsx("span", {}), direction: "row", justifyContent: "space-between", sx: {
1716
+ return (jsxs(MenuItem, { ...menuItemProps, children: [jsx(MenuItem.Label, { children: fromToken.name }), chain && (jsxs(Sticker, { position: { x: 'right', y: 'bottom' }, children: [jsx(Sticker.FramedImage, { use: jsx("img", { src: chain.iconUrl, alt: chain.name }), size: "xSmall" }), jsx(MenuItem.FramedImage, { circularFrame: true, use: jsx("img", { src: fromToken.iconUrl, alt: fromToken.name }) })] })), jsx(MenuItem.Caption, { children: `Balance ${t('views.ADD_TOKENS.fees.fiatPricePrefix')} $${routeBalanceUsd}` }), jsx(MenuItem.PriceDisplay, { price: fromAmount, children: jsx(MenuItem.PriceDisplay.Caption, { children: `${t('views.ADD_TOKENS.fees.fiatPricePrefix')} $${fromAmountUsd}` }) }), jsxs(MenuItem.BottomSlot, { children: [jsx(MenuItem.BottomSlot.Divider, {}), jsxs(Stack, { rc: jsx("span", {}), direction: "row", justifyContent: "space-between", sx: {
1716
1717
  w: '100%',
1717
1718
  }, children: [jsxs(Body, { sx: {
1718
1719
  ...hFlex,
@@ -1722,7 +1723,7 @@ function RouteOption({ routeData, onClick, chains, disabled = false, isFastest =
1722
1723
  }, size: "xSmall", children: [jsx(Icon, { icon: "Countdown", sx: {
1723
1724
  w: 'base.icon.size.200',
1724
1725
  fill: 'base.color.text.body.secondary',
1725
- }, variant: "bold" }), estimatedDurationFormatted] }), jsxs(Body, { size: "xSmall", sx: { ...hFlex, ...centerFlexChildren }, children: [isFastest && (jsx(Badge, { badgeContent: "Fastest", variant: "emphasis", sx: { mr: 'base.spacing.x2' } })), `Fee ~ USD $${getFormattedAmounts(totalFeesUsd)}`] })] })] })] }));
1726
+ }, variant: "bold" }), estimatedDurationFormatted] }), jsxs(Body, { size: "xSmall", sx: { ...hFlex, ...centerFlexChildren }, children: [isFastest && (jsx(Badge, { badgeContent: "Fastest", variant: "emphasis", sx: { mr: 'base.spacing.x2' } })), `Fee ${t('views.ADD_TOKENS.fees.fiatPricePrefix')} $${getFormattedAmounts(totalFeesUsd)}`] })] })] })] }));
1726
1727
  }
1727
1728
 
1728
1729
  const defaultFiatOptions = [
@@ -2425,6 +2426,7 @@ const BASE_SLIPPAGE = 0.02;
2425
2426
  const useRoutes = () => {
2426
2427
  const latestRequestIdRef = reactExports.useRef(0);
2427
2428
  const { addTokensDispatch } = reactExports.useContext(AddTokensContext);
2429
+ const { providersState: { toProvider, }, } = useProvidersContext();
2428
2430
  const { track } = useAnalytics();
2429
2431
  const setRoutes = (routes) => {
2430
2432
  addTokensDispatch({
@@ -2495,6 +2497,7 @@ const useRoutes = () => {
2495
2497
  toAddress,
2496
2498
  quoteOnly,
2497
2499
  enableBoost: true,
2500
+ receiveGasOnDestination: !isPassportProvider(toProvider),
2498
2501
  }), {
2499
2502
  retryIntervalMs: 1000,
2500
2503
  retries: 5,
@@ -2618,6 +2621,7 @@ function SelectedRouteOptionContainer({ children, onClick, selected, }) {
2618
2621
  }, rc: jsx("span", { ...(onClick ? { onClick } : {}) }), children: children }));
2619
2622
  }
2620
2623
  function SelectedRouteOption({ checkout, routeData, chains, loading = false, withSelectedWallet = false, withSelectedToken = false, withSelectedAmount = false, insufficientBalance = false, showOnrampOption = false, onClick, }) {
2624
+ const { t } = useTranslation();
2621
2625
  const { fromToken } = routeData?.amountData ?? {};
2622
2626
  const chain = chains?.find((c) => c.id === fromToken?.chainId);
2623
2627
  const { routeBalanceUsd, fromAmount, fromAmountUsd } = reactExports.useMemo(() => getRouteAndTokenBalances(routeData), [routeData]);
@@ -2654,7 +2658,7 @@ function SelectedRouteOption({ checkout, routeData, chains, loading = false, wit
2654
2658
  }
2655
2659
  return (jsxs(SelectedRouteOptionContainer, { onClick: handleOnClick, selected: withSelectedWallet, children: [jsx(MenuItem.FramedIcon, { icon: icon, variant: "bold", circularFrame: true, emphasized: false }), jsx(MenuItem.Caption, { children: copy })] }));
2656
2660
  }
2657
- return (jsxs(SelectedRouteOptionContainer, { onClick: handleOnClick, selected: withSelectedWallet, children: [chain && (jsxs(Sticker, { position: { x: 'right', y: 'bottom' }, children: [jsx(Sticker.FramedImage, { use: jsx("img", { src: chain.iconUrl, alt: chain.name }), size: "xSmall", sx: { bottom: 'base.spacing.x2', right: 'base.spacing.x2' } }), jsx(MenuItem.FramedImage, { circularFrame: true, padded: true, use: jsx("img", { src: fromToken?.iconUrl, alt: fromToken?.name }) })] })), jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { w: '100%' }, children: [jsxs(Stack, { gap: "0px", children: [jsx(MenuItem.Label, { children: fromToken?.name }), jsx(MenuItem.Caption, { children: `Balance USD $${routeBalanceUsd}` })] }), jsx(MenuItem.PriceDisplay, { price: fromAmount, children: jsx(MenuItem.PriceDisplay.Caption, { children: `USD $${fromAmountUsd}` }) })] })] }));
2661
+ return (jsxs(SelectedRouteOptionContainer, { onClick: handleOnClick, selected: withSelectedWallet, children: [chain && (jsxs(Sticker, { position: { x: 'right', y: 'bottom' }, children: [jsx(Sticker.FramedImage, { use: jsx("img", { src: chain.iconUrl, alt: chain.name }), size: "xSmall", sx: { bottom: 'base.spacing.x2', right: 'base.spacing.x2' } }), jsx(MenuItem.FramedImage, { circularFrame: true, padded: true, use: jsx("img", { src: fromToken?.iconUrl, alt: fromToken?.name }) })] })), jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { w: '100%' }, children: [jsxs(Stack, { gap: "0px", children: [jsx(MenuItem.Label, { children: fromToken?.name }), jsx(MenuItem.Caption, { children: `Balance ${t('views.ADD_TOKENS.fees.fiatPricePrefix')} $${routeBalanceUsd}` })] }), jsx(MenuItem.PriceDisplay, { price: fromAmount, children: jsx(MenuItem.PriceDisplay.Caption, { children: `${t('views.ADD_TOKENS.fees.fiatPricePrefix')} $${fromAmountUsd}` }) })] })] }));
2658
2662
  }
2659
2663
 
2660
2664
  const disabledStyles = {
@@ -2871,7 +2875,7 @@ function PayWithWalletDrawer({ visible, onClose, onConnect, onPayWithCard, walle
2871
2875
  onPayWithCard?.();
2872
2876
  }, children: [jsx(MenuItem.FramedIcon, { icon: "BankCard", variant: "bold", emphasized: false }), jsx(MenuItem.Label, { children: "Pay with Card" })] }));
2873
2877
  }, [onClose, onPayWithCard]);
2874
- return (jsx(ConnectWalletDrawer, { heading: insufficientBalance ? 'Choose another option' : 'Pay With', visible: visible, onClose: onClose, providerType: "from", walletOptions: walletOptions, disabledOptions: disabledOptions, bottomSlot: payWithCardItem, onConnect: handleOnConnect, onError: handleOnError }));
2878
+ return (jsx(ConnectWalletDrawer, { heading: insufficientBalance ? 'Choose another option' : 'Send from', visible: visible, onClose: onClose, providerType: "from", walletOptions: walletOptions, disabledOptions: disabledOptions, bottomSlot: payWithCardItem, onConnect: handleOnConnect, onError: handleOnError }));
2875
2879
  }
2876
2880
 
2877
2881
  function convertToUsd(tokens, amount, token) {
@@ -5926,6 +5930,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
5926
5930
  const { addTokensState: { squid, chains, balances, tokens, selectedAmount, routes, selectedRouteData, selectedToken, isSwapAvailable, }, addTokensDispatch, } = reactExports.useContext(AddTokensContext);
5927
5931
  const { viewDispatch } = reactExports.useContext(ViewContext);
5928
5932
  const { track, page } = useAnalytics();
5933
+ const { t } = useTranslation();
5929
5934
  const { eventTargetState: { eventTarget }, } = reactExports.useContext(EventTargetContext);
5930
5935
  const [showOptionsDrawer, setShowOptionsDrawer] = reactExports.useState(false);
5931
5936
  const [showPayWithDrawer, setShowPayWithDrawer] = reactExports.useState(false);
@@ -6086,9 +6091,9 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
6086
6091
  });
6087
6092
  setAllowedTokens(updatedTokens);
6088
6093
  if (toTokenAddress) {
6089
- const token = tokenResponse.tokens.find((t) => t.address?.toLowerCase() === toTokenAddress.toLowerCase());
6090
- if (token) {
6091
- setSelectedToken(token);
6094
+ const preselectedToken = updatedTokens.find((token) => token.address?.toLowerCase() === toTokenAddress.toLowerCase());
6095
+ if (preselectedToken) {
6096
+ setSelectedToken(preselectedToken);
6092
6097
  }
6093
6098
  }
6094
6099
  addTokensDispatch({
@@ -6187,8 +6192,8 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
6187
6192
  };
6188
6193
  const shouldShowOnRampOption = reactExports.useMemo(() => {
6189
6194
  if (showOnrampOption && selectedToken) {
6190
- const token = onRampAllowedTokens.find((t) => t.address?.toLowerCase() === selectedToken.address?.toLowerCase());
6191
- return !!token;
6195
+ const isAllowedToken = onRampAllowedTokens.find((token) => token.address?.toLowerCase() === selectedToken.address?.toLowerCase());
6196
+ return !!isAllowedToken;
6192
6197
  }
6193
6198
  return false;
6194
6199
  }, [selectedToken, onRampAllowedTokens, showOnrampOption]);
@@ -6240,14 +6245,15 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
6240
6245
  boxShadow: ({ base }) => `0 0 0 ${base.border.size[200]} ${base.color.text.body.primary}`,
6241
6246
  },
6242
6247
  } })),
6243
- }), children: tokenChoiceOptions }), showInitialEmptyState ? (jsx(Body, { children: "Add Token" })) : (jsxs(HeroFormControl, { validationStatus: inputValue === '0' ? 'error' : 'success', children: [jsxs(HeroFormControl.Label, { children: ["Add", ' ', selectedToken.symbol] }), jsx(HeroTextInput, { testId: "add-tokens-amount-input", type: "number", value: inputValue, onChange: (value) => handleOnAmountInputChange(value), placeholder: "0", maxTextSize: "xLarge" }), jsxs(HeroFormControl.Caption, { children: ["USD $", getFormattedNumberWithDecimalPlaces(selectedAmountUsd)] })] }))] }), jsxs(Stack, { testId: "bottomSection", sx: {
6248
+ }), children: tokenChoiceOptions }), showInitialEmptyState ? (jsx(Body, { children: "Add Token" })) : (jsxs(HeroFormControl, { validationStatus: inputValue === '0' ? 'error' : 'success', children: [jsxs(HeroFormControl.Label, { children: ["Add", ' ', selectedToken.symbol] }), jsx(HeroTextInput, { testId: "add-tokens-amount-input", type: "number", value: inputValue, onChange: (value) => handleOnAmountInputChange(value), placeholder: "0", maxTextSize: "xLarge" }), jsx(HeroFormControl.Caption, { children: `${t('views.ADD_TOKENS.fees.fiatPricePrefix')}
6249
+ $${getFormattedNumberWithDecimalPlaces(selectedAmountUsd)}` })] }))] }), jsxs(Stack, { testId: "bottomSection", sx: {
6244
6250
  alignSelf: 'stretch',
6245
6251
  p: 'base.spacing.x3',
6246
6252
  pb: 'base.spacing.x5',
6247
6253
  bg: 'base.color.neutral.800',
6248
6254
  bradtl: 'base.borderRadius.x8',
6249
6255
  bradtr: 'base.borderRadius.x8',
6250
- }, gap: "base.spacing.x4", children: [jsxs(Stack, { gap: "0px", children: [jsxs(SelectedWallet, { label: "Pay with", providerInfo: {
6256
+ }, gap: "base.spacing.x4", children: [jsxs(Stack, { gap: "0px", children: [jsxs(SelectedWallet, { label: "Send from", providerInfo: {
6251
6257
  ...fromProviderInfo,
6252
6258
  address: fromAddress,
6253
6259
  }, onClick: (event) => {
@@ -173493,10 +173499,11 @@ function SquidIcon({ sx = {}, className, }) {
173493
173499
  }
173494
173500
 
173495
173501
  function RouteFees({ visible, onClose, routeData, totalAmount, totalFiatAmount, }) {
173502
+ const { t } = useTranslation();
173496
173503
  const feeCosts = reactExports.useMemo(() => routeData?.route.estimate.feeCosts.map((fee) => ({
173497
173504
  label: fee.name,
173498
173505
  amount: getFormattedNumber(fee.amount, fee.token.decimals),
173499
- fiatAmount: `USD ≈ ${getFormattedAmounts(fee.amountUsd)}`,
173506
+ fiatAmount: `${t('views.ADD_TOKENS.fees.fiatPricePrefix')}${getFormattedAmounts(fee.amountUsd)}`,
173500
173507
  token: {
173501
173508
  name: fee.token.name,
173502
173509
  symbol: fee.token.symbol,
@@ -173509,7 +173516,7 @@ function RouteFees({ visible, onClose, routeData, totalAmount, totalFiatAmount,
173509
173516
  const gasCosts = reactExports.useMemo(() => routeData?.route.estimate.gasCosts.map((fee) => ({
173510
173517
  label: 'Gas (transaction)',
173511
173518
  amount: getFormattedNumber(fee.amount, fee.token.decimals),
173512
- fiatAmount: `USD ≈ ${getFormattedAmounts(fee.amountUsd)}`,
173519
+ fiatAmount: `${t('views.ADD_TOKENS.fees.fiatPricePrefix')}${getFormattedAmounts(fee.amountUsd)}`,
173513
173520
  token: {
173514
173521
  name: fee.token.name,
173515
173522
  symbol: fee.token.symbol,
@@ -173628,7 +173635,7 @@ function Review({ data, showBackButton = false, onBackButtonClick, onCloseButton
173628
173635
  alignItems: 'center',
173629
173636
  c: 'base.color.text.body.secondary',
173630
173637
  cursor: 'pointer',
173631
- }, children: ["Included fees", ` USD $${getFormattedAmounts(totalFeesUsd)}`, jsx(Icon, { icon: "ChevronExpand", sx: { ml: 'base.spacing.x2', w: 'base.icon.size.200' } })] }));
173638
+ }, children: ["Included fees", ` ${t('views.ADD_TOKENS.fees.fiatPricePrefix')} $${getFormattedAmounts(totalFeesUsd)}`, jsx(Icon, { icon: "ChevronExpand", sx: { ml: 'base.spacing.x2', w: 'base.icon.size.200' } })] }));
173632
173639
  }
173633
173640
  return (jsx(Body, { size: "small", sx: {
173634
173641
  ...hFlex,
@@ -173708,7 +173715,7 @@ function Review({ data, showBackButton = false, onBackButtonClick, onCloseButton
173708
173715
  const formattedDuration = route
173709
173716
  ? getDurationFormatted(route.route.estimate.estimatedRouteDuration)
173710
173717
  : '';
173711
- return (jsxs(SimpleLayout, { header: (jsxs(Stack, { rc: jsx("header", {}), direction: "row", sx: {
173718
+ return (jsxs(SimpleLayout, { containerSx: { bg: 'transparent' }, header: (jsxs(Stack, { rc: jsx("header", {}), direction: "row", sx: {
173712
173719
  pt: 'base.spacing.x4',
173713
173720
  px: 'base.spacing.x5',
173714
173721
  h: 'base.spacing.x18',
@@ -173725,7 +173732,7 @@ function Review({ data, showBackButton = false, onBackButtonClick, onCloseButton
173725
173732
  fontSize: 'inherit',
173726
173733
  lineHeight: 'inherit',
173727
173734
  c: 'inherit',
173728
- } })] })] }), jsx(PriceDisplay, { price: getFormattedNumber(route.route.estimate.fromAmount, route.route.estimate.fromToken.decimals), sx: { flexShrink: 0, alignSelf: 'flex-start' }, children: jsx(PriceDisplay.Caption, { size: "small", children: `USD $${route?.route.estimate.fromAmountUSD ?? ''}` }) })] }), jsx(Stack, { sx: {
173735
+ } })] })] }), jsx(PriceDisplay, { price: getFormattedNumber(route.route.estimate.fromAmount, route.route.estimate.fromToken.decimals), sx: { flexShrink: 0, alignSelf: 'flex-start' }, children: jsx(PriceDisplay.Caption, { size: "small", children: `${t('views.ADD_TOKENS.fees.fiatPricePrefix')} $${route?.route.estimate.fromAmountUSD ?? ''}` }) })] }), jsx(Stack, { sx: {
173729
173736
  pos: 'relative',
173730
173737
  w: 'base.spacing.x16',
173731
173738
  ml: 'base.spacing.x7',
@@ -173753,7 +173760,7 @@ function Review({ data, showBackButton = false, onBackButtonClick, onCloseButton
173753
173760
  fontSize: 'inherit',
173754
173761
  lineHeight: 'inherit',
173755
173762
  c: 'inherit',
173756
- } })] })] }), jsx(PriceDisplay, { price: getFormattedNumber(route?.route.estimate.toAmount, route?.route.estimate.toToken.decimals), sx: { flexShrink: 0, alignSelf: 'flex-start' }, children: jsx(PriceDisplay.Caption, { size: "small", children: `USD $${route?.route.estimate.toAmountUSD ?? ''}` }) })] }), jsx(Stack, { sx: {
173763
+ } })] })] }), jsx(PriceDisplay, { price: getFormattedNumber(route?.route.estimate.toAmount, route?.route.estimate.toToken.decimals), sx: { flexShrink: 0, alignSelf: 'flex-start' }, children: jsx(PriceDisplay.Caption, { size: "small", children: `${t('views.ADD_TOKENS.fees.fiatPricePrefix')} $${route?.route.estimate.toAmountUSD ?? ''}` }) })] }), jsx(Stack, { sx: {
173757
173764
  pos: 'relative',
173758
173765
  w: 'base.spacing.x16',
173759
173766
  ml: 'base.spacing.x7',
@@ -173763,7 +173770,7 @@ function Review({ data, showBackButton = false, onBackButtonClick, onCloseButton
173763
173770
  top: '-8px',
173764
173771
  h: 'base.spacing.x5',
173765
173772
  },
173766
- } }), jsxs(Stack, { direction: "row", gap: "base.spacing.x6", sx: { py: 'base.spacing.x5', px: 'base.spacing.x7' }, alignItems: "center", children: [jsx(Stack, { direction: "row", sx: { w: 'base.spacing.x12' }, justifyContent: "center", children: jsx(FramedIcon, { icon: "Countdown", variant: "bold", size: "medium", circularFrame: true }) }), jsx(Body, { size: "small", sx: { flex: 1, c: 'base.color.text.body.secondary' }, children: formattedDuration }), routeFees] })] }), jsx(Button, { size: "large", onClick: handleTransaction, disabled: proceedDisabled, sx: { mx: 'base.spacing.x3' }, children: proceedDisabled ? 'Processing' : 'Proceed' }), jsx(SquidFooter, {})] })), !route && !showAddressMissmatchDrawer && jsx(LoadingView, { loadingText: "Securing quote" })] }), jsx(RouteFees, { routeData: route, visible: showFeeBreakdown, onClose: () => setShowFeeBreakdown(false), totalAmount: totalFees, totalFiatAmount: totalFeesUsd }), jsx(AddressMissmatchDrawer, { visible: showAddressMissmatchDrawer, onClick: () => {
173773
+ } }), jsxs(Stack, { direction: "row", gap: "base.spacing.x6", sx: { py: 'base.spacing.x5', px: 'base.spacing.x7' }, alignItems: "center", children: [jsx(Stack, { direction: "row", sx: { w: 'base.spacing.x12' }, justifyContent: "center", children: jsx(FramedIcon, { icon: "Countdown", variant: "bold", size: "medium", circularFrame: true }) }), jsx(Body, { size: "small", sx: { flex: 1, c: 'base.color.text.body.secondary' }, children: formattedDuration }), routeFees] })] }), jsx(Button, { size: "large", onClick: handleTransaction, disabled: proceedDisabled, sx: { mx: 'base.spacing.x3' }, children: proceedDisabled ? 'Processing' : 'Proceed' }), jsx(SquidFooter, {})] })), !route && !showAddressMissmatchDrawer && (jsx(LoadingView, { loadingText: "Securing quote", containerSx: { bg: 'transparent' } }))] }), jsx(RouteFees, { routeData: route, visible: showFeeBreakdown, onClose: () => setShowFeeBreakdown(false), totalAmount: totalFees, totalFiatAmount: totalFeesUsd }), jsx(AddressMissmatchDrawer, { visible: showAddressMissmatchDrawer, onClick: () => {
173767
173774
  setShowAddressMissmatchDrawer(false);
173768
173775
  viewDispatch({
173769
173776
  payload: {
@@ -1,11 +1,12 @@
1
- import { c1 as axios, c2 as CheckoutErrorType, c3 as IMMUTABLE_API_BASE_URL, r as reactExports, I as IMTBLWidgetEvents, B as BridgeEventType, q as jsxs, j as jsx, c4 as ShimmerBox, al as MenuItem, a8 as Stack, l as useTranslation, M as Body, T as Button, H as Box, c5 as PASSPORT_URL, aT as Link, c6 as getChainIdBySlug, c7 as getChainImage, c8 as networkName, a6 as FramedImage, Q as Icon, ay as useAnalytics, az as UserJourney, at as Divider, aL as ViewContext, au as Fragment, V as ViewActions, c9 as useWalletConnect, ca as isWalletConnectProvider, cb as Logo, cc as RawImage, cd as AXELAR_SCAN_URL, aZ as isNativeToken, a_ as getTokenImageByAddress, ce as getNativeSymbolByChainSlug, by as calculateCryptoToFiat, aQ as EventTargetContext, bI as isPassportProvider, i as getL1ChainId, aY as TokenFilterTypes, h as getL2ChainId, aE as WalletProviderRdns, aG as Web3Provider, aU as useInjectedProviders, bF as HeaderNavigation, bJ as FooterLogo, aB as WalletDrawer, aX as SimpleLayout, cf as getChainSlugById, cg as JsonRpcProvider, ch as DEFAULT_TRANSACTIONS_RETRY_POLICY, L as LoadingView, k as ChainId, ci as getChainNameById, x as useTheme, aA as Heading, cj as getWalletProviderNameByProvider, ck as isAddressSanctioned, o as SharedViews, cl as isMetaMaskProvider, cm as WalletProviderName, ax as Drawer, R as ButtCon, cn as ButtonNavigationStyles, a$ as orchestrationEvents, am as tokenValueFormat, co as formatZeroAmount, cp as NATIVE, bl as amountInputValidation, aN as getRemoteImage, bm as CloudImage, cq as ETH_TOKEN_SYMBOL, ao as BigNumber, bf as Environment, cr as GasEstimateType, cs as DEFAULT_TOKEN_DECIMALS, ct as DEFAULT_QUOTE_REFRESH_INTERVAL, cu as addChainChangedListener, cv as removeChainChangedListener, cw as IMX_TOKEN_SYMBOL, cx as dist, cy as CHECKOUT_CDN_BASE_URL, cz as heroBackGroundStyles, cA as heroImageStyles, a4 as Badge, cB as SimpleTextBody, cC as FooterButton, cD as getEthTokenImage, cE as WITHDRAWAL_CLAIM_GAS_LIMIT, aV as getDefaultTokenImage, bi as viewReducer, bj as initialViewState, cF as BridgeConfiguration, cG as ImmutableConfiguration, cH as TokenBridge, cI as StatusView, bK as StatusType, E as ErrorView, bn as ServiceUnavailableErrorView, bo as ServiceType, cJ as ETH_SEPOLIA_TO_ZKEVM_TESTNET, cK as ETH_SEPOLIA_TO_ZKEVM_DEVNET, cL as ETH_MAINNET_TO_ZKEVM_MAINNET } from './index-Co93fBqn.js';
2
- import { B as BridgeWidgetViews, C as CryptoFiatContext, a as CryptoFiatActions, T as TopUpView, c as CryptoFiatProvider } from './TopUpView-Nbu5J6zy.js';
3
- import { T as TokenImage, r as retry } from './retry-DqIpQ6wO.js';
4
- import { E as EllipsizedText, C as Contract } from './EllipsizedText-_yDoxF8V.js';
5
- import { A as Accordion, S as SelectForm, T as TextInputForm, a as TransactionRejected, g as getAllowedBalances, F as Fees, N as NetworkSwitchDrawer, W as WalletApproveHero } from './WalletApproveHero-Cc6p3CkR.js';
6
- import { f as formatUnits, p as parseUnits } from './index-DzrC5Kuy.js';
7
- import { u as useInterval } from './useInterval-D42dwhRA.js';
8
- import './FeesBreakdown-CQVi4M-W.js';
1
+ import { c1 as axios, c2 as CheckoutErrorType, c3 as IMMUTABLE_API_BASE_URL, r as reactExports, I as IMTBLWidgetEvents, B as BridgeEventType, q as jsxs, j as jsx, c4 as ShimmerBox, al as MenuItem, a8 as Stack, l as useTranslation, M as Body, T as Button, H as Box, c5 as PASSPORT_URL, aU as Link, c6 as getChainIdBySlug, c7 as getChainImage, c8 as networkName, a6 as FramedImage, Q as Icon, ay as useAnalytics, az as UserJourney, at as Divider, aM as ViewContext, au as Fragment, V as ViewActions, c9 as useWalletConnect, ca as isWalletConnectProvider, cb as Logo, cc as RawImage, cd as AXELAR_SCAN_URL, a_ as isNativeToken, a$ as getTokenImageByAddress, ce as getNativeSymbolByChainSlug, bz as calculateCryptoToFiat, aR as EventTargetContext, aA as isPassportProvider, i as getL1ChainId, aZ as TokenFilterTypes, h as getL2ChainId, aF as WalletProviderRdns, aH as Web3Provider, aV as useInjectedProviders, bG as HeaderNavigation, bJ as FooterLogo, aC as WalletDrawer, aY as SimpleLayout, cf as getChainSlugById, cg as JsonRpcProvider, ch as DEFAULT_TRANSACTIONS_RETRY_POLICY, L as LoadingView, k as ChainId, ci as getChainNameById, x as useTheme, aB as Heading, cj as getWalletProviderNameByProvider, ck as isAddressSanctioned, o as SharedViews, cl as isMetaMaskProvider, cm as WalletProviderName, ax as Drawer, R as ButtCon, cn as ButtonNavigationStyles, b0 as orchestrationEvents, am as tokenValueFormat, co as formatZeroAmount, cp as NATIVE, bm as amountInputValidation, aO as getRemoteImage, bn as CloudImage, cq as ETH_TOKEN_SYMBOL, ao as BigNumber, bg as Environment, cr as GasEstimateType, cs as DEFAULT_TOKEN_DECIMALS, ct as DEFAULT_QUOTE_REFRESH_INTERVAL, cu as addChainChangedListener, cv as removeChainChangedListener, cw as IMX_TOKEN_SYMBOL, cx as dist, cy as CHECKOUT_CDN_BASE_URL, cz as heroBackGroundStyles, cA as heroImageStyles, a4 as Badge, cB as SimpleTextBody, cC as FooterButton, cD as getEthTokenImage, cE as WITHDRAWAL_CLAIM_GAS_LIMIT, aW as getDefaultTokenImage, bj as viewReducer, bk as initialViewState, cF as BridgeConfiguration, cG as ImmutableConfiguration, cH as TokenBridge, cI as StatusView, bK as StatusType, E as ErrorView, bo as ServiceUnavailableErrorView, bp as ServiceType, cJ as ETH_SEPOLIA_TO_ZKEVM_TESTNET, cK as ETH_SEPOLIA_TO_ZKEVM_DEVNET, cL as ETH_MAINNET_TO_ZKEVM_MAINNET } from './index-BjLYItcm.js';
2
+ import { C as CryptoFiatContext, a as CryptoFiatActions, b as CryptoFiatProvider } from './CryptoFiatProvider-b0KhVg3Y.js';
3
+ import { T as TokenImage, r as retry } from './retry-GJcGp5Sw.js';
4
+ import { E as EllipsizedText, C as Contract } from './EllipsizedText-CF9lzi6c.js';
5
+ import { A as Accordion, S as SelectForm, T as TextInputForm, a as TransactionRejected, g as getAllowedBalances, F as Fees, N as NetworkSwitchDrawer, W as WalletApproveHero } from './WalletApproveHero-DW6Uw6rT.js';
6
+ import { B as BridgeWidgetViews, T as TopUpView } from './TopUpView-Bg-huhcb.js';
7
+ import { f as formatUnits, p as parseUnits } from './index-CshBDuS0.js';
8
+ import { u as useInterval } from './useInterval-BfG2xnz-.js';
9
+ import './FeesBreakdown-BGnZxcX5.js';
9
10
 
10
11
  // This module is intended to unwrap Axios default export as named.
11
12
  // Keep top-level export same with static properties
@@ -1,19 +1,20 @@
1
- import { r as reactExports, u as useConnectLoaderState, j as jsx, I as IMTBLWidgetEvents, C as CommerceFlowType, P as ProviderEventType, a as CommerceEventType, b as ConnectEventType, c as CommerceFailureEventType, d as CommerceSuccessEventType, W as WalletEventType, e as CommerceUserActionEventType, S as SwapEventType, B as BridgeEventType, O as OnRampEventType, f as SaleEventType, g as OrchestrationEventType, V as ViewActions, h as getL2ChainId, i as getL1ChainId, k as ChainId, l as useTranslation, m as useViewState, n as useEventTargetState, o as SharedViews, p as commerceFlows, q as jsxs, L as LoadingView, E as ErrorView, s as ConnectWidget, t as ProvidersContextProvider, v as ConnectLoader, w as ViewContextProvider } from './index-Co93fBqn.js';
2
- import SwapWidget from './SwapWidget-Dm2cQUYh.js';
3
- import BridgeWidget from './BridgeWidget-DreWq2OO.js';
4
- import { O as OnRampWidget } from './OnRampWidget-BpRLbHli.js';
5
- import WalletWidget from './WalletWidget-C25SCVnz.js';
6
- import SaleWidget from './SaleWidget-C-ATgwRu.js';
7
- import AddTokensWidget from './AddTokensWidget-BfDY0LwB.js';
8
- import './WalletApproveHero-Cc6p3CkR.js';
9
- import './retry-DqIpQ6wO.js';
10
- import './FeesBreakdown-CQVi4M-W.js';
11
- import './TopUpView-Nbu5J6zy.js';
12
- import './index-DzrC5Kuy.js';
13
- import './useInterval-D42dwhRA.js';
14
- import './SpendingCapHero-DLdYNa0u.js';
15
- import './EllipsizedText-_yDoxF8V.js';
16
- import './HandoverContent-D0HXf455.js';
1
+ import { r as reactExports, u as useConnectLoaderState, j as jsx, I as IMTBLWidgetEvents, C as CommerceFlowType, P as ProviderEventType, a as CommerceEventType, b as ConnectEventType, c as CommerceFailureEventType, d as CommerceSuccessEventType, W as WalletEventType, e as CommerceUserActionEventType, S as SwapEventType, B as BridgeEventType, O as OnRampEventType, f as SaleEventType, g as OrchestrationEventType, V as ViewActions, h as getL2ChainId, i as getL1ChainId, k as ChainId, l as useTranslation, m as useViewState, n as useEventTargetState, o as SharedViews, p as commerceFlows, q as jsxs, L as LoadingView, E as ErrorView, s as ConnectWidget, t as ProvidersContextProvider, v as ConnectLoader, w as ViewContextProvider } from './index-BjLYItcm.js';
2
+ import SwapWidget from './SwapWidget-CdXf4YYP.js';
3
+ import BridgeWidget from './BridgeWidget-BCC7YXWj.js';
4
+ import { O as OnRampWidget } from './OnRampWidget-BrGpM6Vn.js';
5
+ import WalletWidget from './WalletWidget-ChYjXfAy.js';
6
+ import SaleWidget from './SaleWidget-iuigaIZp.js';
7
+ import AddTokensWidget from './AddTokensWidget-_RYa4euh.js';
8
+ import './WalletApproveHero-DW6Uw6rT.js';
9
+ import './retry-GJcGp5Sw.js';
10
+ import './FeesBreakdown-BGnZxcX5.js';
11
+ import './CryptoFiatProvider-b0KhVg3Y.js';
12
+ import './useInterval-BfG2xnz-.js';
13
+ import './index-CshBDuS0.js';
14
+ import './TopUpView-Bg-huhcb.js';
15
+ import './SpendingCapHero-B3sb2Wt1.js';
16
+ import './EllipsizedText-CF9lzi6c.js';
17
+ import './HandoverContent-CESizLWk.js';
17
18
 
18
19
  const initialCommerceState = {
19
20
  checkout: undefined,
@@ -0,0 +1,224 @@
1
+ import { bg as Environment, c1 as axios, r as reactExports, j as jsx } from './index-BjLYItcm.js';
2
+
3
+ /**
4
+ * Class representing the configuration for the CryptoFiatModule.
5
+ */
6
+ class CryptoFiatConfiguration {
7
+ baseConfig;
8
+ /**
9
+ * Creates an instance of CryptoFiatConfiguration.
10
+ */
11
+ constructor({ baseConfig }) {
12
+ this.baseConfig = baseConfig;
13
+ }
14
+ }
15
+
16
+ const CHECKOUT_API_BASE_URL = {
17
+ [Environment.SANDBOX]: 'https://checkout-api.sandbox.immutable.com',
18
+ [Environment.PRODUCTION]: 'https://checkout-api.immutable.com',
19
+ };
20
+ const DEFAULT_FIAT_SYMBOL = 'usd';
21
+ /**
22
+ * CryptoFiat module class
23
+ */
24
+ class CryptoFiat {
25
+ coinsCache;
26
+ overridesCache;
27
+ config;
28
+ /**
29
+ * Creates an instance of CryptoFiat.
30
+ * @param {CryptoFiatConfiguration} config - configuration parameters for the module
31
+ */
32
+ constructor(config) {
33
+ this.coinsCache = null;
34
+ this.overridesCache = null;
35
+ this.config = config.baseConfig;
36
+ }
37
+ urlWithPath(path) {
38
+ return CHECKOUT_API_BASE_URL[this.config.environment] + path;
39
+ }
40
+ // Given that we could have multiple coins with the same symbol
41
+ // and we do not have the contract address we are forcing the
42
+ // conversion because we are using coingecko under the hood.
43
+ async fetchOverrides() {
44
+ if (this.overridesCache !== null)
45
+ return;
46
+ const url = this.urlWithPath('/v1/fiat/coins/overrides');
47
+ const response = await axios.get(url);
48
+ if (response.status !== 200) {
49
+ throw new Error(`Error fetching coins overrides: ${response.status} ${response.statusText}`);
50
+ }
51
+ this.overridesCache = new Map(Object.entries(response.data));
52
+ }
53
+ async fetchCoins() {
54
+ if (this.coinsCache !== null)
55
+ return;
56
+ await this.fetchOverrides();
57
+ const url = this.urlWithPath('/v1/fiat/coins/all');
58
+ const response = await axios.get(url);
59
+ if (response.status !== 200) {
60
+ throw new Error(`Error fetching coins list: ${response.status} ${response.statusText}`);
61
+ }
62
+ const { data } = response;
63
+ this.coinsCache = new Map();
64
+ for (const coin of data) {
65
+ const override = this.overridesCache.get(coin.symbol.toLowerCase());
66
+ this.coinsCache.set(coin.symbol.toLowerCase(), override || coin.id.toLowerCase());
67
+ }
68
+ }
69
+ /**
70
+ * Converts tokens with fiat currencies.
71
+ * @param {CryptoFiatConvertParams} - object containing the token symbols to get a conversion
72
+ * for and the optional fiat symbols to convert to.
73
+ * @returns {Promise<CryptoFiatConvertReturn>} - promise to return the map that associates
74
+ * token symbol to its conversion value object
75
+ * with fiat currencies.
76
+ */
77
+ async convert({ tokenSymbols, fiatSymbols = [], }) {
78
+ if (!tokenSymbols || tokenSymbols.length === 0) {
79
+ throw new Error('Error missing token symbols to convert');
80
+ }
81
+ const currencies = fiatSymbols.filter((fiatSymbol) => fiatSymbol !== '');
82
+ if (currencies.length === 0)
83
+ currencies.push(DEFAULT_FIAT_SYMBOL);
84
+ await this.fetchCoins();
85
+ const idsParam = tokenSymbols
86
+ .map((tokenSymbol) => this.coinsCache.get(tokenSymbol.toLowerCase()))
87
+ .filter((tokenSymbol) => tokenSymbol !== '' && tokenSymbol !== undefined)
88
+ .join(',');
89
+ const currenciesParam = currencies
90
+ .join(',')
91
+ .toLowerCase();
92
+ const url = this.urlWithPath(`/v1/fiat/conversion?ids=${idsParam}&currencies=${currenciesParam}`);
93
+ const response = await axios.get(url);
94
+ if (response.status !== 200) {
95
+ throw new Error(`Error fetching prices: ${response.status} ${response.statusText}`);
96
+ }
97
+ const { data } = response;
98
+ const result = {};
99
+ for (const symbol of tokenSymbols) {
100
+ const symbolKey = symbol.toLowerCase();
101
+ const coinId = this.coinsCache.get(symbolKey);
102
+ result[symbolKey] = {};
103
+ if (coinId)
104
+ result[symbolKey] = data[coinId] || {};
105
+ }
106
+ return result;
107
+ }
108
+ }
109
+
110
+ var FiatSymbols;
111
+ (function (FiatSymbols) {
112
+ FiatSymbols["USD"] = "usd";
113
+ })(FiatSymbols || (FiatSymbols = {}));
114
+ const initialCryptoFiatState = {
115
+ cryptoFiat: null,
116
+ fiatSymbol: FiatSymbols.USD,
117
+ tokenSymbols: [],
118
+ conversions: new Map(),
119
+ };
120
+ var CryptoFiatActions;
121
+ (function (CryptoFiatActions) {
122
+ CryptoFiatActions["SET_CRYPTO_FIAT"] = "SET_CRYPTO_FIAT";
123
+ CryptoFiatActions["SET_FIAT_SYMBOL"] = "SET_FIAT_SYMBOL";
124
+ CryptoFiatActions["SET_TOKEN_SYMBOLS"] = "SET_TOKEN_SYMBOLS";
125
+ CryptoFiatActions["SET_CONVERSIONS"] = "SET_CONVERSIONS";
126
+ })(CryptoFiatActions || (CryptoFiatActions = {}));
127
+ // eslint-disable-next-line @typescript-eslint/naming-convention
128
+ const CryptoFiatContext = reactExports.createContext({
129
+ cryptoFiatState: initialCryptoFiatState,
130
+ cryptoFiatDispatch: () => { },
131
+ });
132
+ const cryptoFiatReducer = (state, action) => {
133
+ switch (action.payload.type) {
134
+ case CryptoFiatActions.SET_CRYPTO_FIAT:
135
+ return {
136
+ ...state,
137
+ cryptoFiat: action.payload.cryptoFiat,
138
+ };
139
+ case CryptoFiatActions.SET_FIAT_SYMBOL:
140
+ return {
141
+ ...state,
142
+ fiatSymbol: action.payload.fiatSymbol,
143
+ };
144
+ case CryptoFiatActions.SET_TOKEN_SYMBOLS:
145
+ return {
146
+ ...state,
147
+ tokenSymbols: action.payload.tokenSymbols,
148
+ };
149
+ case CryptoFiatActions.SET_CONVERSIONS:
150
+ return {
151
+ ...state,
152
+ conversions: action.payload.conversions,
153
+ };
154
+ default:
155
+ return state;
156
+ }
157
+ };
158
+
159
+ const updateConversions = (cryptoToFiatResult, fiatSymbol) => {
160
+ const conversionMap = new Map();
161
+ // TODO: Consider using Object.keys(cryptoToFiatResult) instead of for...in
162
+ // for...in includes properties from the prototype chain
163
+ // eslint-disable-next-line no-restricted-syntax, guard-for-in
164
+ for (const tokenSymbol in cryptoToFiatResult) {
165
+ const conversion = cryptoToFiatResult[tokenSymbol];
166
+ const usdAmount = conversion[fiatSymbol];
167
+ if (usdAmount !== undefined) {
168
+ conversionMap.set(tokenSymbol, usdAmount);
169
+ }
170
+ }
171
+ return conversionMap;
172
+ };
173
+ const getCryptoToFiatConversion = async (cryptoFiat, fiatSymbol, tokenSymbols) => {
174
+ try {
175
+ if (tokenSymbols.length === 0)
176
+ return new Map();
177
+ const cryptoToFiatResult = await cryptoFiat.convert({
178
+ tokenSymbols,
179
+ fiatSymbols: [fiatSymbol],
180
+ });
181
+ return updateConversions(cryptoToFiatResult, fiatSymbol);
182
+ }
183
+ catch (err) {
184
+ return new Map();
185
+ }
186
+ };
187
+
188
+ const DEFAULT_TOKEN_SYMBOLS = ['ETH', 'IMX'];
189
+ function CryptoFiatProvider({ environment, children }) {
190
+ const [cryptoFiatState, cryptoFiatDispatch] = reactExports.useReducer(cryptoFiatReducer, initialCryptoFiatState);
191
+ const { cryptoFiat, fiatSymbol, tokenSymbols } = cryptoFiatState;
192
+ reactExports.useEffect(() => {
193
+ cryptoFiatDispatch({
194
+ payload: {
195
+ type: CryptoFiatActions.SET_CRYPTO_FIAT,
196
+ cryptoFiat: new CryptoFiat(new CryptoFiatConfiguration({
197
+ baseConfig: {
198
+ environment,
199
+ },
200
+ })),
201
+ },
202
+ });
203
+ }, []);
204
+ reactExports.useEffect(() => {
205
+ if (!cryptoFiat || !fiatSymbol)
206
+ return;
207
+ (async () => {
208
+ const conversions = await getCryptoToFiatConversion(cryptoFiat, fiatSymbol, [...new Set([...tokenSymbols, ...DEFAULT_TOKEN_SYMBOLS])]);
209
+ cryptoFiatDispatch({
210
+ payload: {
211
+ type: CryptoFiatActions.SET_CONVERSIONS,
212
+ conversions,
213
+ },
214
+ });
215
+ })();
216
+ }, [cryptoFiat, tokenSymbols, fiatSymbol]);
217
+ return (
218
+ // TODO: The object passed as the value prop to the Context provider changes every render.
219
+ // To fix this consider wrapping it in a useMemo hook.
220
+ // eslint-disable-next-line react/jsx-no-constructed-context-values
221
+ jsx(CryptoFiatContext.Provider, { value: { cryptoFiatState, cryptoFiatDispatch }, children: children }));
222
+ }
223
+
224
+ export { CryptoFiatContext as C, DEFAULT_TOKEN_SYMBOLS as D, CryptoFiatActions as a, CryptoFiatProvider as b };
@@ -1,4 +1,4 @@
1
- import { cM as defineReadOnly, cN as getStatic, cO as Signer, cP as Provider, cQ as getAddress, cR as Logger, cS as getContractAddress, cT as Interface, cU as shallowCopy, cV as VoidSigner, cW as Indexed, cX as deepCopy, cY as isHexString, cZ as checkResultErrors, c_ as resolveProperties, ao as BigNumber, c$ as accessListify, d0 as arrayify, j as jsx, _ as _objectWithoutProperties, bv as cloneElementWithCssProp, M as Body, U as _defineProperty } from './index-Co93fBqn.js';
1
+ import { cM as defineReadOnly, cN as getStatic, cO as Signer, cP as Provider, cQ as getAddress, cR as Logger, cS as getContractAddress, cT as Interface, cU as shallowCopy, cV as VoidSigner, cW as Indexed, cX as deepCopy, cY as isHexString, cZ as checkResultErrors, c_ as resolveProperties, ao as BigNumber, c$ as accessListify, d0 as arrayify, j as jsx, _ as _objectWithoutProperties, bw as cloneElementWithCssProp, M as Body, U as _defineProperty } from './index-BjLYItcm.js';
2
2
 
3
3
  const version = "contracts/5.7.0";
4
4
 
@@ -1,4 +1,4 @@
1
- import { q as jsxs, j as jsx, M as Body, bh as PriceDisplay, H as Box, l as useTranslation, ax as Drawer, al as MenuItem, au as Fragment, at as Divider, am as tokenValueFormat, co as formatZeroAmount, bJ as FooterLogo } from './index-Co93fBqn.js';
1
+ import { q as jsxs, j as jsx, M as Body, bi as PriceDisplay, H as Box, l as useTranslation, ax as Drawer, al as MenuItem, au as Fragment, at as Divider, am as tokenValueFormat, co as formatZeroAmount, bJ as FooterLogo } from './index-BjLYItcm.js';
2
2
 
3
3
  const feesBreakdownContentStyles = {
4
4
  display: 'flex',
@@ -1,4 +1,4 @@
1
- import { q as jsxs, H as Box, j as jsx, aA as Heading, M as Body, T as Button } from './index-Co93fBqn.js';
1
+ import { q as jsxs, H as Box, j as jsx, aB as Heading, M as Body, T as Button } from './index-BjLYItcm.js';
2
2
 
3
3
  function HandoverContent({ headingText, subheadingText, primaryButtonText, onPrimaryButtonClick, secondaryButtonText, onSecondaryButtonClick, }) {
4
4
  return (jsxs(Box, { sx: {
@@ -1,6 +1,6 @@
1
- import { d1 as global, ay as useAnalytics, r as reactExports, bV as ConnectLoaderContext, aQ as EventTargetContext, l as useTranslation, aL as ViewContext, o as SharedViews, d2 as ExchangeType, j as jsx, aX as SimpleLayout, bF as HeaderNavigation, d3 as sendOnRampWidgetCloseEvent, a$ as orchestrationEvents, I as IMTBLWidgetEvents, H as Box, az as UserJourney, V as ViewActions, bJ as FooterLogo, q as jsxs, cB as SimpleTextBody, bi as viewReducer, bj as initialViewState, cp as NATIVE, L as LoadingView, d4 as sendOnRampSuccessEvent, bK as StatusType, cI as StatusView, d5 as sendOnRampFailedEvent } from './index-Co93fBqn.js';
2
- import { O as OnRampWidgetViews, T as TopUpView } from './TopUpView-Nbu5J6zy.js';
3
- import { S as SpendingCapHero } from './SpendingCapHero-DLdYNa0u.js';
1
+ import { d1 as global, ay as useAnalytics, r as reactExports, bV as ConnectLoaderContext, aR as EventTargetContext, l as useTranslation, aM as ViewContext, o as SharedViews, d2 as ExchangeType, j as jsx, aY as SimpleLayout, bG as HeaderNavigation, d3 as sendOnRampWidgetCloseEvent, b0 as orchestrationEvents, I as IMTBLWidgetEvents, H as Box, az as UserJourney, V as ViewActions, bJ as FooterLogo, q as jsxs, cB as SimpleTextBody, bj as viewReducer, bk as initialViewState, cp as NATIVE, L as LoadingView, d4 as sendOnRampSuccessEvent, bK as StatusType, cI as StatusView, d5 as sendOnRampFailedEvent } from './index-BjLYItcm.js';
2
+ import { O as OnRampWidgetViews, T as TopUpView } from './TopUpView-Bg-huhcb.js';
3
+ import { S as SpendingCapHero } from './SpendingCapHero-B3sb2Wt1.js';
4
4
 
5
5
  function isNull(arg) {
6
6
  return arg === null;