@imtbl/sdk 1.66.1 → 1.67.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{blockchain_data-B9T-qbph.js → blockchain_data-BDPQfPJV.js} +2 -2
- package/dist/blockchain_data.js +3 -3
- package/dist/browser/checkout/{AddTokensWidget-DdZHY_JS.js → AddTokensWidget-DhAAwA2S.js} +150 -98
- package/dist/browser/checkout/{BridgeWidget-CzoLGKzK.js → BridgeWidget-CUc8HRTw.js} +23 -13
- package/dist/browser/checkout/{CommerceWidget-BGemG9RB.js → CommerceWidget-BOWOZCaz.js} +17 -17
- package/dist/browser/checkout/{CryptoFiatProvider-BwfapqZO.js → CryptoFiatProvider-CxiVWPGH.js} +1 -1
- package/dist/browser/checkout/{EllipsizedText-ngVXQGn_.js → EllipsizedText-Dz34eo3g.js} +1 -1
- package/dist/browser/checkout/{FeesBreakdown-BpgS4Cf3.js → FeesBreakdown-BW6UtIiJ.js} +1 -1
- package/dist/browser/checkout/{HandoverContent-C0qfeRAh.js → HandoverContent-Ce_52Gy0.js} +1 -1
- package/dist/browser/checkout/{OnRampWidget-Dx2XkuTt.js → OnRampWidget-vxPgznQT.js} +3 -3
- package/dist/browser/checkout/{SaleWidget-N4DUeD2I.js → SaleWidget-BdnaSjMC.js} +71 -19
- package/dist/browser/checkout/{SpendingCapHero-BeqEPpR_.js → SpendingCapHero-BL6pv3Tz.js} +1 -1
- package/dist/browser/checkout/{SwapWidget-DiA9c6Zu.js → SwapWidget-DpZ61Qy1.js} +9 -9
- package/dist/browser/checkout/{retry-aLeSin3J.js → TokenImage-CaeGAfaV.js} +15 -15
- package/dist/browser/checkout/{TopUpView-BBUB2cpE.js → TopUpView-DBCanPUb.js} +3 -3
- package/dist/browser/checkout/{WalletApproveHero-DiwEKXIx.js → WalletApproveHero-YzOD7wTV.js} +3 -3
- package/dist/browser/checkout/{WalletWidget-BNCipG33.js → WalletWidget-Baf13r5o.js} +4 -4
- package/dist/browser/checkout/{auto-track-CwlqwwA6.js → auto-track-CX-Sbbf1.js} +1 -1
- package/dist/browser/checkout/{index-bA3tzuB3.js → index-BEyIbtPl.js} +1 -1
- package/dist/browser/checkout/{index-Ze29sipG.js → index-BfJ5tYUk.js} +1 -1
- package/dist/browser/checkout/{index-DS1USgQr.js → index-BiTQa147.js} +2 -2
- package/dist/browser/checkout/{index-HL3njUMr.js → index-BnI_t7Bf.js} +1 -1
- package/dist/browser/checkout/{index-BdohR2SR.js → index-BuVcM3lx.js} +1 -1
- package/dist/browser/checkout/{index-PJGxH105.js → index-DFfgowSz.js} +1 -1
- package/dist/browser/checkout/{index-DVVgTW38.js → index-MiJtNQGp.js} +216 -143
- package/dist/browser/checkout/{index-R3d13MqX.js → index-QRMG13bY.js} +1 -1
- package/dist/browser/checkout/{index-lFfbeyAV.js → index-WkEhhO8Q.js} +1 -1
- package/dist/browser/checkout/{index.umd-_yYKRbcT.js → index.umd-Du3dKMeF.js} +1 -1
- package/dist/browser/checkout/sdk.js +4 -4
- package/dist/browser/checkout/{useInterval-D0l_aPl9.js → useInterval-CaT4s9av.js} +1 -1
- package/dist/browser/checkout/widgets-esm.js +1 -1
- package/dist/browser/checkout/widgets.js +460 -273
- package/dist/{checkout-CZ8Ekr5g.js → checkout--1mYuAXD.js} +50 -19
- package/dist/checkout.d.ts +56 -31
- package/dist/checkout.js +5 -5
- package/dist/{config-B-S2GgWx.js → config-DffHwEwF.js} +1 -1
- package/dist/config.js +1 -1
- package/dist/{index-B8OpSizY.js → index-02SYXuJF.js} +1 -1
- package/dist/{index-DkQZpG9P.js → index-BQ32RH92.js} +1 -1
- package/dist/{index-B0RD2JVo.js → index-BQ86loCt.js} +1 -1
- package/dist/{index-BqBIqxw_.js → index-ByHQAg3p.js} +4 -4
- package/dist/{index-Drj8RVbj.js → index-D4SnN7tJ.js} +1 -1
- package/dist/{index-D9UCgdaj.js → index-DZf2HB3e.js} +3 -3
- package/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +51 -20
- package/dist/index.d.ts +38 -10
- package/dist/index.js +14 -14
- package/dist/{minting_backend-CbsoaB6S.js → minting_backend-BeTIXYB2.js} +3 -3
- package/dist/minting_backend.js +5 -5
- package/dist/{orderbook-DctAuD-W.js → orderbook-CiQq6fd5.js} +1 -1
- package/dist/orderbook.js +2 -2
- package/dist/{passport-BOcQMNRG.js → passport-qhE7n9aI.js} +3 -3
- package/dist/passport.js +4 -4
- package/dist/{webhook-Cdi0qezX.js → webhook-DiIVzY9G.js} +1 -1
- package/dist/webhook.js +2 -2
- package/dist/{x-AiomNseI.js → x-wVhXYLtD.js} +3 -3
- package/dist/x.js +4 -4
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as APIError, B as BlockchainData } from './index-
|
|
2
|
-
import { i as index } from './index-
|
|
1
|
+
import { A as APIError, B as BlockchainData } from './index-DZf2HB3e.js';
|
|
2
|
+
import { i as index } from './index-BQ86loCt.js';
|
|
3
3
|
|
|
4
4
|
var blockchain_data = /*#__PURE__*/Object.freeze({
|
|
5
5
|
__proto__: null,
|
package/dist/blockchain_data.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { A as APIError, B as BlockchainData } from './index-
|
|
2
|
-
export { i as Types } from './index-
|
|
3
|
-
import './index-
|
|
1
|
+
export { A as APIError, B as BlockchainData } from './index-DZf2HB3e.js';
|
|
2
|
+
export { i as Types } from './index-BQ86loCt.js';
|
|
3
|
+
import './index-D4SnN7tJ.js';
|
|
4
4
|
import 'axios';
|
|
5
5
|
import 'lru-memorise';
|
|
6
6
|
import 'global-const';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { _ as _objectWithoutProperties, w as useTheme, x as useForwardLocalDomRef, y as useGetSubcomponentChild, z as useSplitApartChildrenAndSubComponents, r as reactExports, D as merge$2, F as useResizeObserver, p as jsxs, o 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, A as AddTokensEventType, ai as getDefaultExportFromCjs, aj as commonjsGlobal, u as useTranslation, ak as MenuItem, al as tokenValueFormat, am as DEFAULT_TOKEN_FORMATTING_DECIMALS, an as BigNumber, ao as getRemoteVideo, ap as FramedVideo, aq as motion, ar as listItemVariants, as as Divider, at as Fragment, au as listVariants, av as useProvidersContext, aw as Drawer, ax as useAnalytics, ay as UserJourney, az as isPassportProvider, 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, m as SharedViews, j 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
|
|
2
|
-
import { f as formatUnits, p as parseUnits } from './index-
|
|
3
|
-
import { E as EllipsizedText, C as Contract } from './EllipsizedText-
|
|
4
|
-
import { r as retry, T as TokenImage } from './
|
|
5
|
-
import { H as HandoverContent } from './HandoverContent-
|
|
6
|
-
import { F as FeesBreakdown } from './FeesBreakdown-
|
|
1
|
+
import { _ as _objectWithoutProperties, w as useTheme, x as useForwardLocalDomRef, y as useGetSubcomponentChild, z as useSplitApartChildrenAndSubComponents, r as reactExports, D as merge$2, F as useResizeObserver, p as jsxs, o 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, A as AddTokensEventType, ai as getDefaultExportFromCjs, aj as commonjsGlobal, u as useTranslation, ak as MenuItem, al as tokenValueFormat, am as DEFAULT_TOKEN_FORMATTING_DECIMALS, an as BigNumber, ao as getRemoteVideo, ap as FramedVideo, aq as motion, ar as listItemVariants, as as Divider, at as Fragment, au as listVariants, av as useProvidersContext, aw as Drawer, ax as useAnalytics, ay as UserJourney, az as isPassportProvider, 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, m as SharedViews, j 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 keyframes, aV as getDefaultTokenImage, aW as TokenFilterTypes, h as getL2ChainId, aX as isNativeToken, aY as getTokenImageByAddress, aZ as TextInput, a_ as VerticalMenu, a$ as useInjectedProviders, b0 as SimpleLayout, b1 as orchestrationEvents, b2 as requireSecp256k1$1, b3 as requireLib_commonjs, b4 as require$$0$2, b5 as bech32$2, b6 as bnExports$1, b7 as require$$0$3, b8 as getAugmentedNamespace, b9 as require$$0$4, ba as minimalisticAssert, bb as require$$2, bc as hash$6, bd as MaxUint256, be as merge$3, bf as SvgIcon, bg as WalletWarningHero, bh as Environment, bi as t, bj as PriceDisplay, L as LoadingView, bk as viewReducer, bl as initialViewState, bm as isValidAddress, bn as amountInputValidation, bo as CloudImage, E as ErrorView, bp as ServiceUnavailableToRegionErrorView, bq as ServiceType } from './index-MiJtNQGp.js';
|
|
2
|
+
import { f as formatUnits, p as parseUnits } from './index-WkEhhO8Q.js';
|
|
3
|
+
import { E as EllipsizedText, C as Contract } from './EllipsizedText-Dz34eo3g.js';
|
|
4
|
+
import { r as retry, T as TokenImage } from './TokenImage-CaeGAfaV.js';
|
|
5
|
+
import { H as HandoverContent } from './HandoverContent-Ce_52Gy0.js';
|
|
6
|
+
import { F as FeesBreakdown } from './FeesBreakdown-BW6UtIiJ.js';
|
|
7
7
|
|
|
8
8
|
var bannerSx = {
|
|
9
9
|
d: "flex",
|
|
@@ -2638,6 +2638,7 @@ const SQUID_NATIVE_TOKEN = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
|
|
2638
2638
|
const FIXED_HANDOVER_DURATION = 2000;
|
|
2639
2639
|
const APPROVE_TXN_ANIMATION = '/access_coins.riv';
|
|
2640
2640
|
const EXECUTE_TXN_ANIMATION = '/swapping_coins.riv';
|
|
2641
|
+
const TOKEN_PRIORITY_ORDER = ['IMX', 'USDC', 'ETH'];
|
|
2641
2642
|
|
|
2642
2643
|
function SelectedRouteOptionContainer({ children, onClick, selected, }) {
|
|
2643
2644
|
return (jsx(Stack, { direction: "row", alignItems: "center", gap: "base.spacing.x4", sx: {
|
|
@@ -2649,7 +2650,7 @@ function SelectedRouteOptionContainer({ children, onClick, selected, }) {
|
|
|
2649
2650
|
: `calc(100% + (${base.spacing.x16}))`),
|
|
2650
2651
|
}, rc: jsx("span", { ...(onClick ? { onClick } : {}) }), children: children }));
|
|
2651
2652
|
}
|
|
2652
|
-
function SelectedRouteOption({ checkout, routeData, chains, loading = false, withSelectedWallet = false,
|
|
2653
|
+
function SelectedRouteOption({ checkout, routeData, chains, loading = false, withSelectedWallet = false, insufficientBalance = false, showOnrampOption = false, onClick, }) {
|
|
2653
2654
|
const { t } = useTranslation();
|
|
2654
2655
|
const { fromToken } = routeData?.amountData ?? {};
|
|
2655
2656
|
const chain = chains?.find((c) => c.id === fromToken?.chainId);
|
|
@@ -2667,16 +2668,7 @@ function SelectedRouteOption({ checkout, routeData, chains, loading = false, wit
|
|
|
2667
2668
|
}
|
|
2668
2669
|
if ((!routeData && !loading) || insufficientBalance) {
|
|
2669
2670
|
let icon = 'Sparkle';
|
|
2670
|
-
let copy =
|
|
2671
|
-
if (!withSelectedToken && withSelectedAmount) {
|
|
2672
|
-
copy = "Add your token, we'll find the best payment";
|
|
2673
|
-
}
|
|
2674
|
-
if (withSelectedToken && !withSelectedAmount) {
|
|
2675
|
-
copy = "Add your amount, we'll find the best payment";
|
|
2676
|
-
}
|
|
2677
|
-
if (!withSelectedWallet && withSelectedToken && withSelectedAmount) {
|
|
2678
|
-
copy = "Select a wallet, we'll find the best payment";
|
|
2679
|
-
}
|
|
2671
|
+
let copy = '';
|
|
2680
2672
|
if (insufficientBalance) {
|
|
2681
2673
|
icon = 'InformationCircle';
|
|
2682
2674
|
copy = 'No routes found, choose a different wallet, token or amount.';
|
|
@@ -2694,12 +2686,13 @@ const disabledStyles = {
|
|
|
2694
2686
|
cursor: 'not-allowed',
|
|
2695
2687
|
bg: 'base.color.translucent.inverse.800',
|
|
2696
2688
|
};
|
|
2697
|
-
function SelectedWallet({ label, children, onClick, providerInfo, disabled, }) {
|
|
2689
|
+
function SelectedWallet({ label, children, onClick, providerInfo, disabled, sx, }) {
|
|
2698
2690
|
const selected = !!children && providerInfo?.rdns;
|
|
2699
2691
|
const size = selected ? 'xSmall' : 'small';
|
|
2700
2692
|
return (jsxs(MenuItem, { size: size, disabled: disabled, emphasized: !disabled, onClick: disabled ? undefined : onClick, sx: {
|
|
2701
2693
|
py: selected ? 'base.spacing.x3' : undefined,
|
|
2702
2694
|
...(disabled ? disabledStyles : {}),
|
|
2695
|
+
...sx,
|
|
2703
2696
|
}, children: [!providerInfo?.icon && (jsx(MenuItem.FramedIcon, { icon: "Wallet", variant: "bold", emphasized: false })), providerInfo?.icon && (jsx(MenuItem.FramedImage, { padded: true, sx: { mx: selected ? 'base.spacing.x2' : undefined }, use: jsx("img", { src: providerInfo.icon, alt: providerInfo.name }) })), jsx(MenuItem.Label, { children: label }), providerInfo?.name && (jsxs(MenuItem.Caption, { children: [providerInfo?.name, ' • ', jsx(EllipsizedText, { text: providerInfo.address ?? '', sx: { c: 'inherit', fontSize: 'inherit' } })] })), jsx(MenuItem.BottomSlot, { children: children })] }));
|
|
2704
2697
|
}
|
|
2705
2698
|
|
|
@@ -5954,7 +5947,132 @@ function SquidFooter() {
|
|
|
5954
5947
|
} }) }));
|
|
5955
5948
|
}
|
|
5956
5949
|
|
|
5950
|
+
const PULSE_SHADOW = keyframes `
|
|
5951
|
+
0% {
|
|
5952
|
+
box-shadow: 0 0 0 0 rgba(255, 255, 255, 1);
|
|
5953
|
+
}
|
|
5954
|
+
50% {
|
|
5955
|
+
box-shadow: 0 0 10px 3px rgba(54, 210, 227, 0.1);
|
|
5956
|
+
}
|
|
5957
|
+
100% {
|
|
5958
|
+
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
|
|
5959
|
+
}
|
|
5960
|
+
`;
|
|
5961
|
+
|
|
5962
|
+
function TokenDrawerMenu({ checkout, config, toTokenAddress, }) {
|
|
5963
|
+
const { addTokensState: { tokens, selectedToken }, addTokensDispatch, } = reactExports.useContext(AddTokensContext);
|
|
5964
|
+
const { showErrorHandover } = useError(config.environment);
|
|
5965
|
+
const [visible, setVisible] = reactExports.useState(false);
|
|
5966
|
+
const [allowedTokens, setAllowedTokens] = reactExports.useState([]);
|
|
5967
|
+
const [searchValue, setSearchValue] = reactExports.useState('');
|
|
5968
|
+
const defaultTokenImage = getDefaultTokenImage(checkout?.config.environment, config.theme);
|
|
5969
|
+
const { track } = useAnalytics();
|
|
5970
|
+
const setSelectedToken = (token) => {
|
|
5971
|
+
track({
|
|
5972
|
+
userJourney: UserJourney.ADD_TOKENS,
|
|
5973
|
+
screen: 'InputScreen',
|
|
5974
|
+
control: 'TokensMenu',
|
|
5975
|
+
controlType: 'MenuItem',
|
|
5976
|
+
extras: {
|
|
5977
|
+
tokenAddress: token?.address,
|
|
5978
|
+
},
|
|
5979
|
+
});
|
|
5980
|
+
addTokensDispatch({
|
|
5981
|
+
payload: {
|
|
5982
|
+
type: AddTokensActions.SET_SELECTED_TOKEN,
|
|
5983
|
+
selectedToken: token,
|
|
5984
|
+
},
|
|
5985
|
+
});
|
|
5986
|
+
};
|
|
5987
|
+
const handleTokenChange = reactExports.useCallback((token) => {
|
|
5988
|
+
setSelectedToken(token);
|
|
5989
|
+
setVisible(false);
|
|
5990
|
+
setSearchValue('');
|
|
5991
|
+
}, []);
|
|
5992
|
+
const isSelected = reactExports.useCallback((token) => token.address === selectedToken?.address, [selectedToken]);
|
|
5993
|
+
const tokenChoiceOptions = reactExports.useMemo(() => allowedTokens.filter((token) => {
|
|
5994
|
+
if (!searchValue)
|
|
5995
|
+
return true;
|
|
5996
|
+
return token.symbol.toLowerCase().startsWith(searchValue.toLowerCase());
|
|
5997
|
+
}), [tokens, handleTokenChange, isSelected, defaultTokenImage, searchValue]);
|
|
5998
|
+
const handleTokenIconClick = reactExports.useCallback(() => {
|
|
5999
|
+
setVisible(!visible);
|
|
6000
|
+
}, [visible]);
|
|
6001
|
+
const handleDrawerClose = reactExports.useCallback(() => {
|
|
6002
|
+
setVisible(false);
|
|
6003
|
+
setSearchValue('');
|
|
6004
|
+
}, [setVisible, setSearchValue]);
|
|
6005
|
+
reactExports.useEffect(() => {
|
|
6006
|
+
if (!checkout)
|
|
6007
|
+
return;
|
|
6008
|
+
(async () => {
|
|
6009
|
+
try {
|
|
6010
|
+
const tokenResponse = await checkout.getTokenAllowList({
|
|
6011
|
+
type: TokenFilterTypes.SWAP,
|
|
6012
|
+
chainId: getL2ChainId(checkout.config),
|
|
6013
|
+
});
|
|
6014
|
+
if (tokenResponse?.tokens.length > 0) {
|
|
6015
|
+
const updatedTokens = tokenResponse.tokens.map((token) => {
|
|
6016
|
+
if (isNativeToken(token.address)) {
|
|
6017
|
+
return {
|
|
6018
|
+
...token,
|
|
6019
|
+
icon: getTokenImageByAddress(checkout.config.environment, token.symbol),
|
|
6020
|
+
};
|
|
6021
|
+
}
|
|
6022
|
+
return token;
|
|
6023
|
+
});
|
|
6024
|
+
updatedTokens.sort((a, b) => {
|
|
6025
|
+
const aIndex = TOKEN_PRIORITY_ORDER.findIndex((token) => token === a.symbol);
|
|
6026
|
+
const bIndex = TOKEN_PRIORITY_ORDER.findIndex((token) => token === b.symbol);
|
|
6027
|
+
// If both tokens are not in the priority list, sort by symbol
|
|
6028
|
+
if (aIndex === -1 && bIndex === -1) {
|
|
6029
|
+
return a.symbol.localeCompare(b.symbol);
|
|
6030
|
+
}
|
|
6031
|
+
// If only one token is in the priority list, sort it first
|
|
6032
|
+
if (aIndex === -1) {
|
|
6033
|
+
return 1;
|
|
6034
|
+
}
|
|
6035
|
+
if (bIndex === -1) {
|
|
6036
|
+
return -1;
|
|
6037
|
+
}
|
|
6038
|
+
// If both tokens are in the priority list, sort by index
|
|
6039
|
+
return aIndex < bIndex ? -1 : 1;
|
|
6040
|
+
});
|
|
6041
|
+
setAllowedTokens(updatedTokens);
|
|
6042
|
+
if (toTokenAddress) {
|
|
6043
|
+
const preselectedToken = updatedTokens.find((token) => token.address?.toLowerCase() === toTokenAddress.toLowerCase());
|
|
6044
|
+
if (preselectedToken) {
|
|
6045
|
+
setSelectedToken(preselectedToken);
|
|
6046
|
+
}
|
|
6047
|
+
}
|
|
6048
|
+
addTokensDispatch({
|
|
6049
|
+
payload: {
|
|
6050
|
+
type: AddTokensActions.SET_ALLOWED_TOKENS,
|
|
6051
|
+
allowedTokens: tokenResponse.tokens,
|
|
6052
|
+
},
|
|
6053
|
+
});
|
|
6054
|
+
}
|
|
6055
|
+
}
|
|
6056
|
+
catch (error) {
|
|
6057
|
+
showErrorHandover(AddTokensErrorTypes.SERVICE_BREAKDOWN, { error });
|
|
6058
|
+
}
|
|
6059
|
+
})();
|
|
6060
|
+
}, [checkout, toTokenAddress]);
|
|
6061
|
+
return (jsxs(Drawer, { visible: visible, onCloseDrawer: handleDrawerClose, size: "full", headerBarTitle: "Add Tokens", drawerCloseIcon: "ChevronExpand", showHeaderBar: true, outsideClicksClose: true, escapeKeyClose: true, children: [jsx(Drawer.Target, { children: selectedToken ? (jsx(SmartClone, { onClick: handleTokenIconClick, children: jsx(FramedImage, { size: "xLarge", use: (jsx(TokenImage, { src: selectedToken?.icon, name: selectedToken?.name, defaultImage: defaultTokenImage })), padded: true, emphasized: true, circularFrame: true, sx: {
|
|
6062
|
+
cursor: 'pointer',
|
|
6063
|
+
mb: 'base.spacing.x1',
|
|
6064
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
6065
|
+
'&:hover': {
|
|
6066
|
+
boxShadow: ({ base }) => `0 0 0 ${base.border.size[200]} ${base.color.text.body.primary}`,
|
|
6067
|
+
},
|
|
6068
|
+
} }) })) : (jsx(Box, { sx: { animation: `${PULSE_SHADOW} 2s infinite ease-in-out`, borderRadius: '50%' }, children: jsx(ButtCon, { size: "large", variant: "tertiary", icon: "Add", onClick: handleTokenIconClick }) })) }), jsxs(Drawer.Content, { sx: { paddingX: 'base.spacing.x2' }, children: [jsx(TextInput, { sx: { marginBottom: 'base.spacing.x2' }, placeholder: "Search tokens", sizeVariant: "medium", onChange: (event) => {
|
|
6069
|
+
setSearchValue(event.target.value);
|
|
6070
|
+
}, children: jsx(TextInput.Icon, { icon: "Search" }) }), jsx(VerticalMenu, { sx: { maxHeight: '100%' }, children: tokenChoiceOptions.length > 0
|
|
6071
|
+
&& tokenChoiceOptions.map((token) => (jsxs(MenuItem, { size: "medium", onClick: () => handleTokenChange(token), selected: isSelected(token), emphasized: true, children: [jsx(MenuItem.FramedImage, { circularFrame: true, use: (jsx(TokenImage, { src: token.icon, name: token.name, defaultImage: defaultTokenImage })), emphasized: false }), jsx(MenuItem.Label, { children: token.symbol }), token.symbol !== token.name && (jsx(MenuItem.Caption, { children: token.name }))] }, token.name))) })] })] }));
|
|
6072
|
+
}
|
|
6073
|
+
|
|
5957
6074
|
function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOption = true, showSwapOption = true, showBridgeOption = true, onCloseButtonClick, showBackButton, onBackButtonClick, }) {
|
|
6075
|
+
const inputRef = reactExports.useRef(null);
|
|
5958
6076
|
const { fetchRoutesWithRateLimit, resetRoutes } = useRoutes();
|
|
5959
6077
|
const { showErrorHandover } = useError(config.environment);
|
|
5960
6078
|
const { addTokensState: { squid, chains, balances, tokens, selectedAmount, routes, selectedRouteData, selectedToken, isSwapAvailable, }, addTokensDispatch, } = reactExports.useContext(AddTokensContext);
|
|
@@ -5967,7 +6085,6 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
5967
6085
|
const [showPayWithDrawer, setShowPayWithDrawer] = reactExports.useState(false);
|
|
5968
6086
|
const [showDeliverToDrawer, setShowDeliverToDrawer] = reactExports.useState(false);
|
|
5969
6087
|
const [onRampAllowedTokens, setOnRampAllowedTokens] = reactExports.useState([]);
|
|
5970
|
-
const [allowedTokens, setAllowedTokens] = reactExports.useState([]);
|
|
5971
6088
|
const [inputValue, setInputValue] = reactExports.useState(selectedAmount || toAmount || '');
|
|
5972
6089
|
const [fetchingRoutes, setFetchingRoutes] = reactExports.useState(false);
|
|
5973
6090
|
const [insufficientBalance, setInsufficientBalance] = reactExports.useState(false);
|
|
@@ -5989,23 +6106,6 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
5989
6106
|
},
|
|
5990
6107
|
});
|
|
5991
6108
|
}, 2500), []);
|
|
5992
|
-
const setSelectedToken = (token) => {
|
|
5993
|
-
track({
|
|
5994
|
-
userJourney: UserJourney.ADD_TOKENS,
|
|
5995
|
-
screen: 'InputScreen',
|
|
5996
|
-
control: 'TokensMenu',
|
|
5997
|
-
controlType: 'MenuItem',
|
|
5998
|
-
extras: {
|
|
5999
|
-
tokenAddress: token?.address,
|
|
6000
|
-
},
|
|
6001
|
-
});
|
|
6002
|
-
addTokensDispatch({
|
|
6003
|
-
payload: {
|
|
6004
|
-
type: AddTokensActions.SET_SELECTED_TOKEN,
|
|
6005
|
-
selectedToken: token,
|
|
6006
|
-
},
|
|
6007
|
-
});
|
|
6008
|
-
};
|
|
6009
6109
|
const setSelectedRouteData = (route) => {
|
|
6010
6110
|
if (route) {
|
|
6011
6111
|
track({
|
|
@@ -6101,46 +6201,6 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
6101
6201
|
setSelectedRouteData(routes[0]);
|
|
6102
6202
|
}
|
|
6103
6203
|
}, [routes]);
|
|
6104
|
-
reactExports.useEffect(() => {
|
|
6105
|
-
if (!checkout)
|
|
6106
|
-
return;
|
|
6107
|
-
const fetchTokens = async () => {
|
|
6108
|
-
try {
|
|
6109
|
-
const tokenResponse = await checkout.getTokenAllowList({
|
|
6110
|
-
type: TokenFilterTypes.SWAP,
|
|
6111
|
-
chainId: getL2ChainId(checkout.config),
|
|
6112
|
-
});
|
|
6113
|
-
if (tokenResponse?.tokens.length > 0) {
|
|
6114
|
-
const updatedTokens = tokenResponse.tokens.map((token) => {
|
|
6115
|
-
if (isNativeToken(token.address)) {
|
|
6116
|
-
return {
|
|
6117
|
-
...token,
|
|
6118
|
-
icon: getTokenImageByAddress(checkout.config.environment, token.symbol),
|
|
6119
|
-
};
|
|
6120
|
-
}
|
|
6121
|
-
return token;
|
|
6122
|
-
});
|
|
6123
|
-
setAllowedTokens(updatedTokens);
|
|
6124
|
-
if (toTokenAddress) {
|
|
6125
|
-
const preselectedToken = updatedTokens.find((token) => token.address?.toLowerCase() === toTokenAddress.toLowerCase());
|
|
6126
|
-
if (preselectedToken) {
|
|
6127
|
-
setSelectedToken(preselectedToken);
|
|
6128
|
-
}
|
|
6129
|
-
}
|
|
6130
|
-
addTokensDispatch({
|
|
6131
|
-
payload: {
|
|
6132
|
-
type: AddTokensActions.SET_ALLOWED_TOKENS,
|
|
6133
|
-
allowedTokens: tokenResponse.tokens,
|
|
6134
|
-
},
|
|
6135
|
-
});
|
|
6136
|
-
}
|
|
6137
|
-
}
|
|
6138
|
-
catch (error) {
|
|
6139
|
-
showErrorHandover(AddTokensErrorTypes.SERVICE_BREAKDOWN, { error });
|
|
6140
|
-
}
|
|
6141
|
-
};
|
|
6142
|
-
fetchTokens();
|
|
6143
|
-
}, [checkout, toTokenAddress]);
|
|
6144
6204
|
reactExports.useEffect(() => {
|
|
6145
6205
|
if (!checkout)
|
|
6146
6206
|
return;
|
|
@@ -6160,10 +6220,6 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
6160
6220
|
};
|
|
6161
6221
|
fetchOnRampTokens();
|
|
6162
6222
|
}, [checkout]);
|
|
6163
|
-
const isSelected = reactExports.useCallback((token) => token.address === selectedToken, [selectedToken]);
|
|
6164
|
-
const handleTokenChange = reactExports.useCallback((token) => {
|
|
6165
|
-
setSelectedToken(token);
|
|
6166
|
-
}, []);
|
|
6167
6223
|
const sendRequestOnRampEvent = () => {
|
|
6168
6224
|
track({
|
|
6169
6225
|
userJourney: UserJourney.ADD_TOKENS,
|
|
@@ -6249,8 +6305,6 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
6249
6305
|
return false;
|
|
6250
6306
|
}, [selectedToken, onRampAllowedTokens, showOnrampOption]);
|
|
6251
6307
|
const showInitialEmptyState = !selectedToken;
|
|
6252
|
-
const defaultTokenImage = getDefaultTokenImage(checkout?.config.environment, config.theme);
|
|
6253
|
-
const tokenChoiceOptions = reactExports.useMemo(() => allowedTokens.map((token) => (jsxs(MenuItem, { size: "medium", onClick: () => handleTokenChange(token), selected: isSelected(token), emphasized: true, children: [jsx(MenuItem.FramedImage, { circularFrame: true, use: (jsx(TokenImage, { src: token.icon, name: token.name, defaultImage: defaultTokenImage })), emphasized: false }), jsx(MenuItem.Label, { children: token.symbol }), token.symbol !== token.name && (jsx(MenuItem.Caption, { children: token.name }))] }, token.name))), [allowedTokens, handleTokenChange, isSelected, defaultTokenImage]);
|
|
6254
6308
|
const shouldShowBackButton = showBackButton && onBackButtonClick;
|
|
6255
6309
|
const routeInputsReady = !!selectedToken
|
|
6256
6310
|
&& !!fromAddress
|
|
@@ -6285,18 +6339,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
6285
6339
|
px: 'base.spacing.x2',
|
|
6286
6340
|
w: '100%',
|
|
6287
6341
|
pt: 'base.spacing.x1',
|
|
6288
|
-
}, justifyContent: "center", alignItems: "center", children: [jsx(
|
|
6289
|
-
? { icon: 'Add', size: 'large', variant: 'tertiary' }
|
|
6290
|
-
: {
|
|
6291
|
-
customTarget: (jsx(FramedImage, { size: "xLarge", use: (jsx(TokenImage, { src: selectedToken?.icon, name: selectedToken?.name, defaultImage: defaultTokenImage })), padded: true, emphasized: true, circularFrame: true, sx: {
|
|
6292
|
-
cursor: 'pointer',
|
|
6293
|
-
mb: 'base.spacing.x1',
|
|
6294
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
6295
|
-
'&:hover': {
|
|
6296
|
-
boxShadow: ({ base }) => `0 0 0 ${base.border.size[200]} ${base.color.text.body.primary}`,
|
|
6297
|
-
},
|
|
6298
|
-
} })),
|
|
6299
|
-
}), 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')}
|
|
6342
|
+
}, justifyContent: "center", alignItems: "center", children: [jsx(TokenDrawerMenu, { checkout: checkout, config: config, toTokenAddress: toTokenAddress }), showInitialEmptyState ? (jsx(Body, { children: "Add Token" })) : (jsxs(HeroFormControl, { validationStatus: inputValue === '0' ? 'error' : 'success', children: [jsxs(HeroFormControl.Label, { children: ["Add", ' ', selectedToken.symbol] }), jsx(HeroTextInput, { inputRef: inputRef, 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')}
|
|
6300
6343
|
$${getFormattedNumberWithDecimalPlaces(selectedAmountUsd)}` })] }))] }), jsxs(Stack, { testId: "bottomSection", sx: {
|
|
6301
6344
|
alignSelf: 'stretch',
|
|
6302
6345
|
p: 'base.spacing.x3',
|
|
@@ -6304,18 +6347,27 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
6304
6347
|
bg: 'base.color.neutral.800',
|
|
6305
6348
|
bradtl: 'base.borderRadius.x8',
|
|
6306
6349
|
bradtr: 'base.borderRadius.x8',
|
|
6307
|
-
}, gap: "base.spacing.x4", children: [jsxs(Stack, { gap: "0px", children: [
|
|
6350
|
+
}, gap: "base.spacing.x4", children: [jsxs(Stack, { gap: "0px", children: [jsx(SelectedWallet, { sx: selectedToken
|
|
6351
|
+
&& !fromAddress
|
|
6352
|
+
&& inputValue
|
|
6353
|
+
? { animation: `${PULSE_SHADOW} 2s infinite ease-in-out` }
|
|
6354
|
+
: {}, label: "Send from", providerInfo: {
|
|
6308
6355
|
...fromProviderInfo,
|
|
6309
6356
|
address: fromAddress,
|
|
6310
6357
|
}, onClick: (event) => {
|
|
6311
6358
|
event.stopPropagation();
|
|
6312
6359
|
setShowPayWithDrawer(true);
|
|
6313
|
-
}, children: [jsx(MenuItem.BottomSlot.Divider, { sx: fromAddress ? { ml: 'base.spacing.x4' } : undefined }), jsx(SelectedRouteOption, { checkout: checkout, loading: loading, chains: chains, routeData: selectedRouteData, onClick: () => setShowOptionsDrawer(true),
|
|
6360
|
+
}, children: selectedToken && fromAddress && inputValue && (jsxs(Fragment, { children: [jsx(MenuItem.BottomSlot.Divider, { sx: fromAddress ? { ml: 'base.spacing.x4' } : undefined }), jsx(SelectedRouteOption, { checkout: checkout, loading: loading, chains: chains, routeData: selectedRouteData, onClick: () => setShowOptionsDrawer(true), withSelectedWallet: !!fromAddress, insufficientBalance: insufficientBalance, showOnrampOption: shouldShowOnRampOption })] })) }), jsx(Stack, { sx: { pos: 'relative', h: 'base.spacing.x3' }, alignItems: "center", children: jsx(FramedIcon, { icon: "ArrowDown", sx: {
|
|
6314
6361
|
top: '0',
|
|
6315
6362
|
pos: 'absolute',
|
|
6316
6363
|
translate: '0 -30%',
|
|
6317
6364
|
bg: 'base.color.neutral.800',
|
|
6318
|
-
} }) }), jsx(SelectedWallet, {
|
|
6365
|
+
} }) }), jsx(SelectedWallet, { sx: selectedToken
|
|
6366
|
+
&& fromAddress
|
|
6367
|
+
&& !toAddress
|
|
6368
|
+
&& inputValue
|
|
6369
|
+
? { animation: `${PULSE_SHADOW} 2s infinite ease-in-out` }
|
|
6370
|
+
: {}, label: "Deliver to", providerInfo: {
|
|
6319
6371
|
...toProviderInfo,
|
|
6320
6372
|
address: toAddress,
|
|
6321
6373
|
}, onClick: () => setShowDeliverToDrawer(true), disabled: lockedToProvider })] }), jsx(Button, { testId: "add-tokens-button", size: "large", variant: readyToReview ? 'primary' : 'secondary', disabled: !readyToReview, onClick: handleReviewClick, sx: { opacity: readyToReview ? 1 : 0.5 }, children: "Review" }), jsx(SquidFooter, {}), jsx(PayWithWalletDrawer, { visible: showPayWithDrawer, walletOptions: walletOptions, onClose: () => setShowPayWithDrawer(false), onPayWithCard: handleCardClick, onConnect: handleWalletConnected, insufficientBalance: insufficientBalance, showOnRampOption: shouldShowOnRampOption }), jsx(OptionsDrawer, { checkout: checkout, routes: routes, showOnrampOption: shouldShowOnRampOption, showSwapOption: showSwapOption, showBridgeOption: showBridgeOption, visible: showOptionsDrawer, onClose: () => setShowOptionsDrawer(false), onCardClick: handleCardClick, onRouteClick: handleRouteClick, insufficientBalance: insufficientBalance }), jsx(DeliverToWalletDrawer, { visible: showDeliverToDrawer, walletOptions: walletOptions, onClose: handleDeliverToClose }), jsx(OnboardingDrawer, { environment: checkout?.config.environment })] })] }) }));
|
|
@@ -174043,7 +174095,7 @@ function AddTokensWidget({ showOnrampOption = true, showSwapOption = true, showB
|
|
|
174043
174095
|
screen: 'Error',
|
|
174044
174096
|
});
|
|
174045
174097
|
} })), viewState.view.type
|
|
174046
|
-
=== SharedViews.SERVICE_UNAVAILABLE_ERROR_VIEW && (jsx(
|
|
174098
|
+
=== SharedViews.SERVICE_UNAVAILABLE_ERROR_VIEW && (jsx(ServiceUnavailableToRegionErrorView, { service: ServiceType.GENERIC, onCloseClick: () => sendAddTokensCloseEvent(eventTarget) }))] }) }) }));
|
|
174047
174099
|
}
|
|
174048
174100
|
|
|
174049
174101
|
export { AddTokensWidget as default };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as CryptoFiatContext, a as CryptoFiatActions, b as CryptoFiatProvider } from './CryptoFiatProvider-
|
|
3
|
-
import { T as TokenImage, r as retry } from './
|
|
4
|
-
import { E as EllipsizedText, C as Contract } from './EllipsizedText-
|
|
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-
|
|
6
|
-
import { B as BridgeWidgetViews, T as TopUpView } from './TopUpView-
|
|
7
|
-
import { f as formatUnits, p as parseUnits } from './index-
|
|
8
|
-
import { u as useInterval } from './useInterval-
|
|
9
|
-
import './FeesBreakdown-
|
|
1
|
+
import { c5 as axios, c6 as CheckoutErrorType, c7 as IMMUTABLE_API_BASE_URL, r as reactExports, I as IMTBLWidgetEvents, B as BridgeEventType, p as jsxs, o as jsx, c8 as ShimmerBox, ak as MenuItem, a8 as Stack, u as useTranslation, M as Body, T as Button, H as Box, c9 as PASSPORT_URL, aT as Link, ca as getChainIdBySlug, cb as getChainImage, cc as networkName, a6 as FramedImage, Q as Icon, ax as useAnalytics, ay as UserJourney, as as Divider, aL as ViewContext, at as Fragment, V as ViewActions, cd as useWalletConnect, ce as isWalletConnectProvider, cf as Logo, cg as RawImage, ch as AXELAR_SCAN_URL, aX as isNativeToken, aY as getTokenImageByAddress, ci as getNativeSymbolByChainSlug, bB as calculateCryptoToFiat, aQ as EventTargetContext, az as isPassportProvider, i as getL1ChainId, aW as TokenFilterTypes, h as getL2ChainId, aE as WalletProviderRdns, aG as Web3Provider, a$ as useInjectedProviders, bI as HeaderNavigation, bM as FooterLogo, aB as WalletDrawer, b0 as SimpleLayout, cj as getChainSlugById, ck as JsonRpcProvider, cl as DEFAULT_TRANSACTIONS_RETRY_POLICY, L as LoadingView, j as ChainId, cm as getChainNameById, w as useTheme, aA as Heading, cn as getWalletProviderNameByProvider, bz as fetchRiskAssessment, bL as isAddressSanctioned, m as SharedViews, co as isMetaMaskProvider, cp as WalletProviderName, aw as Drawer, R as ButtCon, cq as ButtonNavigationStyles, b1 as orchestrationEvents, al as tokenValueFormat, cr as formatZeroAmount, cs as NATIVE, bn as amountInputValidation, aN as getRemoteImage, bo as CloudImage, ct as ETH_TOKEN_SYMBOL, an as BigNumber, bh as Environment, cu as GasEstimateType, cv as DEFAULT_TOKEN_DECIMALS, cw as DEFAULT_QUOTE_REFRESH_INTERVAL, cx as addChainChangedListener, cy as removeChainChangedListener, cz as IMX_TOKEN_SYMBOL, cA as dist, cB as CHECKOUT_CDN_BASE_URL, cC as heroBackGroundStyles, cD as heroImageStyles, a4 as Badge, cE as SimpleTextBody, cF as FooterButton, cG as getEthTokenImage, cH as WITHDRAWAL_CLAIM_GAS_LIMIT, aV as getDefaultTokenImage, bk as viewReducer, bl as initialViewState, cI as BridgeConfiguration, cJ as ImmutableConfiguration, cK as TokenBridge, cL as StatusView, bN as StatusType, E as ErrorView, c4 as ServiceUnavailableErrorView, cM as ETH_SEPOLIA_TO_ZKEVM_TESTNET, cN as ETH_SEPOLIA_TO_ZKEVM_DEVNET, cO as ETH_MAINNET_TO_ZKEVM_MAINNET } from './index-MiJtNQGp.js';
|
|
2
|
+
import { C as CryptoFiatContext, a as CryptoFiatActions, b as CryptoFiatProvider } from './CryptoFiatProvider-CxiVWPGH.js';
|
|
3
|
+
import { T as TokenImage, r as retry } from './TokenImage-CaeGAfaV.js';
|
|
4
|
+
import { E as EllipsizedText, C as Contract } from './EllipsizedText-Dz34eo3g.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-YzOD7wTV.js';
|
|
6
|
+
import { B as BridgeWidgetViews, T as TopUpView } from './TopUpView-DBCanPUb.js';
|
|
7
|
+
import { f as formatUnits, p as parseUnits } from './index-WkEhhO8Q.js';
|
|
8
|
+
import { u as useInterval } from './useInterval-CaT4s9av.js';
|
|
9
|
+
import './FeesBreakdown-BW6UtIiJ.js';
|
|
10
10
|
|
|
11
11
|
// This module is intended to unwrap Axios default export as named.
|
|
12
12
|
// Keep top-level export same with static properties
|
|
@@ -1234,7 +1234,9 @@ function WalletAndNetworkSelector() {
|
|
|
1234
1234
|
const web3Provider = new Web3Provider(event.provider);
|
|
1235
1235
|
const connectedProvider = await connectToProvider(checkout, web3Provider, changeAccount);
|
|
1236
1236
|
// CM-793 Check for sanctioned address
|
|
1237
|
-
|
|
1237
|
+
const address = await connectedProvider.getSigner().getAddress();
|
|
1238
|
+
const sanctions = await fetchRiskAssessment([address], checkout.config);
|
|
1239
|
+
if (isAddressSanctioned(sanctions, address)) {
|
|
1238
1240
|
viewDispatch({
|
|
1239
1241
|
payload: {
|
|
1240
1242
|
type: ViewActions.UPDATE_VIEW,
|
|
@@ -1340,7 +1342,9 @@ function WalletAndNetworkSelector() {
|
|
|
1340
1342
|
const web3Provider = new Web3Provider(event.provider);
|
|
1341
1343
|
const connectedProvider = await connectToProvider(checkout, web3Provider, false);
|
|
1342
1344
|
// CM-793 Check for sanctioned address
|
|
1343
|
-
|
|
1345
|
+
const address = await connectedProvider.getSigner().getAddress();
|
|
1346
|
+
const sanctions = await fetchRiskAssessment([address], checkout.config);
|
|
1347
|
+
if (isAddressSanctioned(sanctions, address)) {
|
|
1344
1348
|
viewDispatch({
|
|
1345
1349
|
payload: {
|
|
1346
1350
|
type: ViewActions.UPDATE_VIEW,
|
|
@@ -1357,7 +1361,6 @@ function WalletAndNetworkSelector() {
|
|
|
1357
1361
|
}
|
|
1358
1362
|
else {
|
|
1359
1363
|
setToWalletWeb3Provider(connectedProvider);
|
|
1360
|
-
const address = await connectedProvider.getSigner().getAddress();
|
|
1361
1364
|
setToWalletAddress(address.toLowerCase());
|
|
1362
1365
|
handleSettingToNetwork(address.toLowerCase());
|
|
1363
1366
|
track({
|
|
@@ -3065,7 +3068,14 @@ function BridgeWidget({ checkout, web3Provider, config, amount, tokenAddress, sh
|
|
|
3065
3068
|
},
|
|
3066
3069
|
});
|
|
3067
3070
|
sendBridgeClaimWithdrawalFailedEvent(eventTarget, viewState.view.transactionHash, 'Transaction failed');
|
|
3068
|
-
}, onActionClick: updateToTransactionsPage, statusType: StatusType.FAILURE, onCloseClick: () => sendBridgeWidgetCloseEvent(eventTarget), testId: "claim-withdrawal-fail-view" })), viewState.view.type === SharedViews.SERVICE_UNAVAILABLE_ERROR_VIEW && (jsx(ServiceUnavailableErrorView, {
|
|
3071
|
+
}, onActionClick: updateToTransactionsPage, statusType: StatusType.FAILURE, onCloseClick: () => sendBridgeWidgetCloseEvent(eventTarget), testId: "claim-withdrawal-fail-view" })), viewState.view.type === SharedViews.SERVICE_UNAVAILABLE_ERROR_VIEW && (jsx(ServiceUnavailableErrorView, { onCloseClick: () => sendBridgeWidgetCloseEvent(eventTarget), onBackButtonClick: () => {
|
|
3072
|
+
viewDispatch({
|
|
3073
|
+
payload: {
|
|
3074
|
+
type: ViewActions.UPDATE_VIEW,
|
|
3075
|
+
view: { type: BridgeWidgetViews.WALLET_NETWORK_SELECTION },
|
|
3076
|
+
},
|
|
3077
|
+
});
|
|
3078
|
+
} }))] }) }) }));
|
|
3069
3079
|
}
|
|
3070
3080
|
|
|
3071
3081
|
export { BridgeWidget as default };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { 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, A as AddTokensEventType, B as BridgeEventType, O as OnRampEventType, f as SaleEventType, g as OrchestrationEventType, r as reactExports, V as ViewActions, h as getL2ChainId, i as getL1ChainId, j as ChainId, u as useTranslation, k as useViewState, l as useEventTargetState, m as SharedViews, n as commerceFlows, o as jsx, p as jsxs, L as LoadingView, E as ErrorView, q as ConnectWidget, s as ProvidersContextProvider, t as ConnectLoader, v as ViewContextProvider } from './index-
|
|
2
|
-
import SwapWidget from './SwapWidget-
|
|
3
|
-
import BridgeWidget from './BridgeWidget-
|
|
4
|
-
import { O as OnRampWidget } from './OnRampWidget-
|
|
5
|
-
import WalletWidget from './WalletWidget-
|
|
6
|
-
import SaleWidget from './SaleWidget-
|
|
7
|
-
import AddTokensWidget from './AddTokensWidget-
|
|
8
|
-
import './WalletApproveHero-
|
|
9
|
-
import './
|
|
10
|
-
import './FeesBreakdown-
|
|
11
|
-
import './CryptoFiatProvider-
|
|
12
|
-
import './useInterval-
|
|
13
|
-
import './index-
|
|
14
|
-
import './TopUpView-
|
|
15
|
-
import './SpendingCapHero-
|
|
16
|
-
import './EllipsizedText-
|
|
17
|
-
import './HandoverContent-
|
|
1
|
+
import { 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, A as AddTokensEventType, B as BridgeEventType, O as OnRampEventType, f as SaleEventType, g as OrchestrationEventType, r as reactExports, V as ViewActions, h as getL2ChainId, i as getL1ChainId, j as ChainId, u as useTranslation, k as useViewState, l as useEventTargetState, m as SharedViews, n as commerceFlows, o as jsx, p as jsxs, L as LoadingView, E as ErrorView, q as ConnectWidget, s as ProvidersContextProvider, t as ConnectLoader, v as ViewContextProvider } from './index-MiJtNQGp.js';
|
|
2
|
+
import SwapWidget from './SwapWidget-DpZ61Qy1.js';
|
|
3
|
+
import BridgeWidget from './BridgeWidget-CUc8HRTw.js';
|
|
4
|
+
import { O as OnRampWidget } from './OnRampWidget-vxPgznQT.js';
|
|
5
|
+
import WalletWidget from './WalletWidget-Baf13r5o.js';
|
|
6
|
+
import SaleWidget from './SaleWidget-BdnaSjMC.js';
|
|
7
|
+
import AddTokensWidget from './AddTokensWidget-DhAAwA2S.js';
|
|
8
|
+
import './WalletApproveHero-YzOD7wTV.js';
|
|
9
|
+
import './TokenImage-CaeGAfaV.js';
|
|
10
|
+
import './FeesBreakdown-BW6UtIiJ.js';
|
|
11
|
+
import './CryptoFiatProvider-CxiVWPGH.js';
|
|
12
|
+
import './useInterval-CaT4s9av.js';
|
|
13
|
+
import './index-WkEhhO8Q.js';
|
|
14
|
+
import './TopUpView-DBCanPUb.js';
|
|
15
|
+
import './SpendingCapHero-BL6pv3Tz.js';
|
|
16
|
+
import './EllipsizedText-Dz34eo3g.js';
|
|
17
|
+
import './HandoverContent-Ce_52Gy0.js';
|
|
18
18
|
|
|
19
19
|
const sendCheckoutEvent = (eventTarget, detail) => {
|
|
20
20
|
const event = new CustomEvent(IMTBLWidgetEvents.IMTBL_COMMERCE_WIDGET_EVENT, { detail });
|
package/dist/browser/checkout/{CryptoFiatProvider-BwfapqZO.js → CryptoFiatProvider-CxiVWPGH.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bh as Environment, c5 as axios, r as reactExports, o as jsx } from './index-MiJtNQGp.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Class representing the configuration for the CryptoFiatModule.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cP as defineReadOnly, cQ as getStatic, cR as Signer, cS as Provider, cT as getAddress, cU as Logger, cV as getContractAddress, cW as Interface, cX as shallowCopy, cY as VoidSigner, cZ as Indexed, c_ as deepCopy, c$ as isHexString, d0 as checkResultErrors, d1 as resolveProperties, an as BigNumber, d2 as accessListify, d3 as arrayify, o as jsx, _ as _objectWithoutProperties, bx as cloneElementWithCssProp, M as Body, U as _defineProperty } from './index-MiJtNQGp.js';
|
|
2
2
|
|
|
3
3
|
const version = "contracts/5.7.0";
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as jsxs, o as jsx, M as Body,
|
|
1
|
+
import { p as jsxs, o as jsx, M as Body, bj as PriceDisplay, H as Box, u as useTranslation, aw as Drawer, ak as MenuItem, at as Fragment, as as Divider, al as tokenValueFormat, cr as formatZeroAmount, bM as FooterLogo } from './index-MiJtNQGp.js';
|
|
2
2
|
|
|
3
3
|
const feesBreakdownContentStyles = {
|
|
4
4
|
display: 'flex',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as jsxs, H as Box, o as jsx, aA as Heading, M as Body, T as Button } from './index-
|
|
1
|
+
import { p as jsxs, H as Box, o as jsx, aA as Heading, M as Body, T as Button } from './index-MiJtNQGp.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 {
|
|
2
|
-
import { O as OnRampWidgetViews, T as TopUpView } from './TopUpView-
|
|
3
|
-
import { S as SpendingCapHero } from './SpendingCapHero-
|
|
1
|
+
import { d4 as global, ax as useAnalytics, r as reactExports, bY as ConnectLoaderContext, aQ as EventTargetContext, u as useTranslation, aL as ViewContext, m as SharedViews, d5 as ExchangeType, o as jsx, b0 as SimpleLayout, bI as HeaderNavigation, d6 as sendOnRampWidgetCloseEvent, b1 as orchestrationEvents, I as IMTBLWidgetEvents, H as Box, ay as UserJourney, V as ViewActions, bM as FooterLogo, p as jsxs, cE as SimpleTextBody, bk as viewReducer, bl as initialViewState, cs as NATIVE, L as LoadingView, d7 as sendOnRampSuccessEvent, bN as StatusType, cL as StatusView, d8 as sendOnRampFailedEvent } from './index-MiJtNQGp.js';
|
|
2
|
+
import { O as OnRampWidgetViews, T as TopUpView } from './TopUpView-DBCanPUb.js';
|
|
3
|
+
import { S as SpendingCapHero } from './SpendingCapHero-BL6pv3Tz.js';
|
|
4
4
|
|
|
5
5
|
function isNull(arg) {
|
|
6
6
|
return arg === null;
|