@imtbl/checkout-widgets 2.1.0 → 2.1.1-alpha.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.
- package/dist/browser/{AddTokensWidget-CAEeN5jP.js → AddTokensWidget-BOI_jqqf.js} +20 -20
- package/dist/browser/{BridgeWidget-e-F5P93T.js → BridgeWidget-BIG4aqCO.js} +43 -43
- package/dist/browser/{CommerceWidget-D2Mgsuic.js → CommerceWidget-BctNaeVc.js} +161 -161
- package/dist/browser/{FeesBreakdown-B1UOPiEy.js → FeesBreakdown-BiZ4yxB3.js} +1 -1
- package/dist/browser/{OnRampWidget-wpF_cgBh.js → OnRampWidget-BWkeBbU6.js} +8 -8
- package/dist/browser/{SaleWidget-BSfPxL8b.js → SaleWidget-CVnRPG65.js} +66 -66
- package/dist/browser/{SpendingCapHero-CILhoLfB.js → SpendingCapHero-DeBwDGlI.js} +1 -1
- package/dist/browser/{SwapWidget-vMANCsxT.js → SwapWidget-D9-iitLb.js} +27 -81
- package/dist/browser/{TokenImage-BhdH0d18.js → TokenImage-C7CPmmJG.js} +1 -1
- package/dist/browser/{TopUpView-CY3EuDlN.js → TopUpView-Di7OsCPP.js} +5 -5
- package/dist/browser/{WalletApproveHero-CyTk85Bm.js → WalletApproveHero-CwX2-FqG.js} +4 -4
- package/dist/browser/{WalletWidget-pdUZpb4H.js → WalletWidget-mbTCOqAX.js} +15 -15
- package/dist/browser/{auto-track-2rPY7AkR.js → auto-track-D5dim5M_.js} +1 -1
- package/dist/browser/{index-B34DP7wB.js → index-8QmdQaR5.js} +1 -1
- package/dist/browser/{index-Dy9alfIi.js → index-BWHTwu6L.js} +1 -1
- package/dist/browser/{index-C97_i5Eu.js → index-BhMqSECG.js} +374 -2675
- package/dist/browser/{index-vzCL3mjK.js → index-C3JLm3Bg.js} +1 -1
- package/dist/browser/{index-CUxnLSr2.js → index-CWi5iZjB.js} +1 -1
- package/dist/browser/{index-2XqKofW0.js → index-CbYTWdYB.js} +2 -2
- package/dist/browser/{index-BW2P5S_d.js → index-S7EaL_K2.js} +1 -1
- package/dist/browser/{index-4owhhlJv.js → index-jvl5Qum5.js} +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/{index.umd-Cub6_YHm.js → index.umd-D13RlFov.js} +1 -1
- package/dist/browser/{useInterval-BjYMowLB.js → useInterval-UWMEf1fo.js} +1 -1
- package/package.json +7 -9
- package/rollup.config.js +2 -17
- package/src/widgets/swap/components/SwapForm.tsx +2 -82
- package/dist/browser/index.cdn.js +0 -391159
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as reactExports,
|
|
2
|
-
import { T as TokenImage } from './TokenImage-
|
|
3
|
-
import { F as FeesBreakdown } from './FeesBreakdown-
|
|
1
|
+
import { r as reactExports, n as no, T as To, z as commonjsGlobal, A as getDefaultExportFromCjs, o as jsx, p as jsxs, B as Box, e as useTranslation, D as Drawer, F as Divider, H as Heading, G as Button, K as useProvidersContext, M as useAnalytics, W as WalletDrawer, U as UnableToConnectDrawer, N as Fragment, O as Gt, Q as UserJourney, X as removeSpace, Y as getProviderSlugFromRdns, Z as W, _ as isPassportProvider, $ as connectEIP6963Provider, a0 as identifyUser, a1 as ConnectEIP6963ProviderError, a2 as ProvidersContextActions, a3 as MenuItem, a4 as SQUID_NATIVE_TOKEN, J, a5 as commonjsRequire, a6 as getRemoteImage, a7 as vFlex, a8 as OnboardingPagination, a9 as ViewContext, aa as useHandover, ab as HandoverTarget, ac as EventTargetContext, V as ViewActions, ad as getRemoteRive, ae as APPROVE_TXN_ANIMATION, af as RiveStateMachineInput, ag as HandoverContent, ah as keyframes, ai as getDefaultTokenImage, aj as ae, b as getL2ChainId, ak as isNativeToken, al as getTokenImageByAddress, am as TOKEN_PRIORITY_ORDER, an as SmartClone, ao as FramedImage, ap as FramedIcon, aq as ButtCon, ar as TextInput, as as VerticalMenu, at as Body, au as EllipsizedText, av as Tooltip, aw as Sticker, ax as getDurationFormatted, ay as getTotalRouteFees, az as getRouteAndTokenBalances, aA as Stack, aB as hFlex, aC as centerFlexChildren, aD as Icon, aE as Badge, aF as getFormattedAmounts, aG as getRemoteVideo, aH as FramedVideo, aI as listVariants, aJ as motion, aK as listItemVariants, aL as Banner, aM as _t, aN as Ot, aO as useRoutes, aP as useInjectedProviders, aQ as hn, aR as RouteError, aS as HeroFormControl, aT as SimpleLayout, aU as dist, S as SharedViews, aV as orchestrationEvents, aW as HeroTextInput, aX as SquidFooter, aY as TOOLKIT_SQUID_URL, aZ as merge, a_ as SvgIcon, a$ as WalletWarningHero, b0 as getFormattedNumber, b1 as FIXED_HANDOVER_DURATION, b2 as EXECUTE_TXN_ANIMATION, b3 as Link, b4 as Trans, b5 as useExecute, b6 as getRouteChains, b7 as t, b8 as convertToNetworkChangeableProvider, b9 as verifyAndSwitchChain, ba as PriceDisplay, L as LoadingView, bb as useTheme, bc as viewReducer, bd as initialViewState, be as useSquid, bf as useTokens, bg as v4, bh as K, bi as isValidAddress, bj as amountInputValidation, bk as fetchChains, bl as fetchBalances, bm as CloudImage, q as ErrorView, bn as ServiceUnavailableErrorView } from './index-BhMqSECG.js';
|
|
2
|
+
import { T as TokenImage } from './TokenImage-C7CPmmJG.js';
|
|
3
|
+
import { F as FeesBreakdown } from './FeesBreakdown-BiZ4yxB3.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The function `useInterval` sets up an interval that repeatedly calls a given callback function with
|
|
@@ -31,9 +31,9 @@ function useInterval(callback, interval) {
|
|
|
31
31
|
|
|
32
32
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
33
33
|
function sendAddTokensCloseEvent(eventTarget) {
|
|
34
|
-
const closeWidgetEvent = new CustomEvent(
|
|
34
|
+
const closeWidgetEvent = new CustomEvent(no.IMTBL_ADD_TOKENS_WIDGET_EVENT, {
|
|
35
35
|
detail: {
|
|
36
|
-
type:
|
|
36
|
+
type: To.CLOSE_WIDGET,
|
|
37
37
|
data: {},
|
|
38
38
|
},
|
|
39
39
|
});
|
|
@@ -44,9 +44,9 @@ function sendAddTokensCloseEvent(eventTarget) {
|
|
|
44
44
|
eventTarget.dispatchEvent(closeWidgetEvent);
|
|
45
45
|
}
|
|
46
46
|
function sendConnectProviderSuccessEvent(eventTarget, providerType, provider, providerInfo) {
|
|
47
|
-
const successEvent = new CustomEvent(
|
|
47
|
+
const successEvent = new CustomEvent(no.IMTBL_ADD_TOKENS_WIDGET_EVENT, {
|
|
48
48
|
detail: {
|
|
49
|
-
type:
|
|
49
|
+
type: To.CONNECT_SUCCESS,
|
|
50
50
|
data: {
|
|
51
51
|
provider,
|
|
52
52
|
providerType,
|
|
@@ -60,9 +60,9 @@ function sendConnectProviderSuccessEvent(eventTarget, providerType, provider, pr
|
|
|
60
60
|
eventTarget.dispatchEvent(successEvent);
|
|
61
61
|
}
|
|
62
62
|
const sendAddTokensSuccessEvent = (eventTarget, transactionHash) => {
|
|
63
|
-
const successEvent = new CustomEvent(
|
|
63
|
+
const successEvent = new CustomEvent(no.IMTBL_ADD_TOKENS_WIDGET_EVENT, {
|
|
64
64
|
detail: {
|
|
65
|
-
type:
|
|
65
|
+
type: To.SUCCESS,
|
|
66
66
|
data: {
|
|
67
67
|
transactionHash,
|
|
68
68
|
},
|
|
@@ -74,9 +74,9 @@ const sendAddTokensSuccessEvent = (eventTarget, transactionHash) => {
|
|
|
74
74
|
eventTarget.dispatchEvent(successEvent);
|
|
75
75
|
};
|
|
76
76
|
const sendAddTokensFailedEvent = (eventTarget, reason) => {
|
|
77
|
-
const failedEvent = new CustomEvent(
|
|
77
|
+
const failedEvent = new CustomEvent(no.IMTBL_ADD_TOKENS_WIDGET_EVENT, {
|
|
78
78
|
detail: {
|
|
79
|
-
type:
|
|
79
|
+
type: To.FAILURE,
|
|
80
80
|
data: {
|
|
81
81
|
reason,
|
|
82
82
|
timestamp: new Date().getTime(),
|
|
@@ -668,7 +668,7 @@ function ConnectWalletDrawer({ heading, visible, onClose, onConnect, onError, pr
|
|
|
668
668
|
walletRdns: info.rdns,
|
|
669
669
|
},
|
|
670
670
|
});
|
|
671
|
-
if (info.rdns ===
|
|
671
|
+
if (info.rdns === Gt.PASSPORT) {
|
|
672
672
|
const { isConnected } = await checkout.checkIsWalletConnected({
|
|
673
673
|
provider: new W(providerDetail.provider),
|
|
674
674
|
});
|
|
@@ -714,7 +714,7 @@ function ConnectWalletDrawer({ heading, visible, onClose, onConnect, onError, pr
|
|
|
714
714
|
// Keep prev wallet change event
|
|
715
715
|
prevWalletChangeEvent.current = event;
|
|
716
716
|
const { info } = event.providerDetail;
|
|
717
|
-
if (providerType === 'to' && info.rdns !==
|
|
717
|
+
if (providerType === 'to' && info.rdns !== Gt.PASSPORT) {
|
|
718
718
|
setShowEOAWarningDrawer(true);
|
|
719
719
|
return;
|
|
720
720
|
}
|
|
@@ -3893,7 +3893,7 @@ function TokenDrawerMenu({ checkout, config, toTokenAddress, addTokensState, add
|
|
|
3893
3893
|
(async () => {
|
|
3894
3894
|
try {
|
|
3895
3895
|
const tokenResponse = await checkout.getTokenAllowList({
|
|
3896
|
-
type:
|
|
3896
|
+
type: ae.SWAP,
|
|
3897
3897
|
chainId: getL2ChainId(checkout.config),
|
|
3898
3898
|
});
|
|
3899
3899
|
if (tokenResponse?.tokens.length > 0) {
|
|
@@ -4179,8 +4179,8 @@ function SelectedRouteOption({ checkout, routeData, chains, loading = false, wit
|
|
|
4179
4179
|
}
|
|
4180
4180
|
|
|
4181
4181
|
const checkSanctionedAddresses = async (addresses, config) => {
|
|
4182
|
-
const result = await
|
|
4183
|
-
return
|
|
4182
|
+
const result = await _t(addresses, config);
|
|
4183
|
+
return Ot(result);
|
|
4184
4184
|
};
|
|
4185
4185
|
|
|
4186
4186
|
function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOption = true, showSwapOption = true, showBridgeOption = true, onCloseButtonClick, showBackButton, onBackButtonClick, }) {
|
|
@@ -4287,7 +4287,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4287
4287
|
const walletOptions = reactExports.useMemo(() => providers
|
|
4288
4288
|
// TODO: Check if must filter passport on L1
|
|
4289
4289
|
.map((detail) => {
|
|
4290
|
-
if (detail.info.rdns ===
|
|
4290
|
+
if (detail.info.rdns === Gt.PASSPORT) {
|
|
4291
4291
|
return {
|
|
4292
4292
|
...detail,
|
|
4293
4293
|
info: {
|
|
@@ -4403,7 +4403,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4403
4403
|
const fetchOnRampTokens = async () => {
|
|
4404
4404
|
try {
|
|
4405
4405
|
const tokenResponse = await checkout.getTokenAllowList({
|
|
4406
|
-
type:
|
|
4406
|
+
type: ae.ONRAMP,
|
|
4407
4407
|
chainId: getL2ChainId(checkout.config),
|
|
4408
4408
|
});
|
|
4409
4409
|
if (tokenResponse?.tokens.length > 0) {
|
|
@@ -4447,7 +4447,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4447
4447
|
showBackButton: true,
|
|
4448
4448
|
provider: toProvider,
|
|
4449
4449
|
};
|
|
4450
|
-
orchestrationEvents.sendRequestOnrampEvent(eventTarget,
|
|
4450
|
+
orchestrationEvents.sendRequestOnrampEvent(eventTarget, no.IMTBL_ADD_TOKENS_WIDGET_EVENT, data);
|
|
4451
4451
|
};
|
|
4452
4452
|
const handleCardClick = () => {
|
|
4453
4453
|
setPayWithCardClicked(true);
|
|
@@ -5296,7 +5296,7 @@ function AddTokensWidget({ showOnrampOption = true, showSwapOption = true, showB
|
|
|
5296
5296
|
objectFit: 'cover',
|
|
5297
5297
|
objectPosition: 'center',
|
|
5298
5298
|
} }), viewState.view.type === AddTokensWidgetViews.ADD_TOKENS && (jsx(AddTokens, { config: config, checkout: checkout, toTokenAddress: toTokenAddress, toAmount: toAmount, showBackButton: showBackButton, showOnrampOption: showOnrampOption, showSwapOption: showSwapOption, showBridgeOption: showBridgeOption, onCloseButtonClick: () => sendAddTokensCloseEvent(eventTarget), onBackButtonClick: () => {
|
|
5299
|
-
orchestrationEvents.sendRequestGoBackEvent(eventTarget,
|
|
5299
|
+
orchestrationEvents.sendRequestGoBackEvent(eventTarget, no.IMTBL_ADD_TOKENS_WIDGET_EVENT, {});
|
|
5300
5300
|
} })), viewState.view.type === AddTokensWidgetViews.REVIEW && (jsx(Review, { data: viewState.view.data, onCloseButtonClick: () => sendAddTokensCloseEvent(eventTarget), onBackButtonClick: () => {
|
|
5301
5301
|
viewDispatch({
|
|
5302
5302
|
payload: {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { c3 as axios, c4 as
|
|
2
|
-
import { T as TokenImage } from './TokenImage-
|
|
3
|
-
import { B as BridgeWidgetViews, T as TopUpView } from './TopUpView-
|
|
4
|
-
import { S as SelectForm, T as TextInputForm, a as TransactionRejected, g as getAllowedBalances, F as Fees, N as NetworkSwitchDrawer, W as WalletApproveHero } from './WalletApproveHero-
|
|
5
|
-
import { u as useInterval } from './useInterval-
|
|
6
|
-
import './FeesBreakdown-
|
|
1
|
+
import { c3 as axios, c4 as S, c5 as q, r as reactExports, n as no, u as uo, p as jsxs, o as jsx, c6 as ShimmerBox, a3 as MenuItem, aA as Stack, e as useTranslation, at as Body, G as Button, B as Box, c7 as PASSPORT_URL, b3 as Link, c8 as getChainIdBySlug, c9 as getChainImage, ca as networkName, ao as FramedImage, au as EllipsizedText, aD as Icon, M as useAnalytics, Q as UserJourney, cb as Accordion, F as Divider, a9 as ViewContext, N as Fragment, V as ViewActions, cc as useWalletConnect, cd as isWalletConnectProvider, ce as Logo, cf as RawImage, bU as CryptoFiatContext, cg as AXELAR_SCAN_URL, ak as isNativeToken, al as getTokenImageByAddress, ch as getNativeSymbolByChainSlug, bM as formatUnits, bt as calculateCryptoToFiat, ac as EventTargetContext, _ as isPassportProvider, d as getL1ChainId, aj as ae, b as getL2ChainId, O as Gt, Z as W, aP as useInjectedProviders, ci as retry, bC as HeaderNavigation, bF as FooterLogo, W as WalletDrawer, aT as SimpleLayout, cj as getChainSlugById, ck as JsonRpcProvider, b$ as CryptoFiatActions, cl as DEFAULT_TRANSACTIONS_RETRY_POLICY, L as LoadingView, J, cm as getChainNameById, bb as useTheme, H as Heading, cn as getWalletProviderNameByProvider, co as isMetaMaskProvider, cp as ge, D as Drawer, aq as ButtCon, cq as ButtonNavigationStyles, aV as orchestrationEvents, bI as tokenValueFormat, cr as formatZeroAmount, cs as NATIVE, aM as _t, bj as amountInputValidation, a6 as getRemoteImage, bm as CloudImage, ct as ETH_TOKEN_SYMBOL, bo as Contract, bh as K, cu as parseUnits, cv as it, cw as DEFAULT_TOKEN_DECIMALS, cx as DEFAULT_QUOTE_REFRESH_INTERVAL, cy as addChainChangedListener, cz as removeChainChangedListener, aN as Ot, cA as IMX_TOKEN_SYMBOL, S as SharedViews, cB as dist, cC as CHECKOUT_CDN_BASE_URL, cD as heroBackGroundStyles, cE as heroImageStyles, aE as Badge, cF as SimpleTextBody, cG as FooterButton, cH as getEthTokenImage, cI as WITHDRAWAL_CLAIM_GAS_LIMIT, cJ as Rt, ai as getDefaultTokenImage, bc as viewReducer, bd as initialViewState, cK as Qe, cL as r, cM as $e, cN as StatusView, bG as StatusType, q as ErrorView, bn as ServiceUnavailableErrorView, c2 as CryptoFiatProvider, cO as O, cP as $, cQ as P } from './index-BhMqSECG.js';
|
|
2
|
+
import { T as TokenImage } from './TokenImage-C7CPmmJG.js';
|
|
3
|
+
import { B as BridgeWidgetViews, T as TopUpView } from './TopUpView-Di7OsCPP.js';
|
|
4
|
+
import { S as SelectForm, T as TextInputForm, a as TransactionRejected, g as getAllowedBalances, F as Fees, N as NetworkSwitchDrawer, W as WalletApproveHero } from './WalletApproveHero-CwX2-FqG.js';
|
|
5
|
+
import { u as useInterval } from './useInterval-UWMEf1fo.js';
|
|
6
|
+
import './FeesBreakdown-BiZ4yxB3.js';
|
|
7
7
|
|
|
8
8
|
// This module is intended to unwrap Axios default export as named.
|
|
9
9
|
// Keep top-level export same with static properties
|
|
@@ -49,7 +49,7 @@ async function connectToProvider(checkout, provider, changeAccount) {
|
|
|
49
49
|
connected = true;
|
|
50
50
|
}
|
|
51
51
|
catch (error) {
|
|
52
|
-
if (error.type ===
|
|
52
|
+
if (error.type === S.USER_REJECTED_REQUEST_ERROR) {
|
|
53
53
|
// eslint-disable-next-line no-console
|
|
54
54
|
console.log('User rejected request');
|
|
55
55
|
}
|
|
@@ -220,9 +220,9 @@ const bridgeReducer = (state, action) => {
|
|
|
220
220
|
};
|
|
221
221
|
|
|
222
222
|
const sendBridgeTransactionSentEvent = (eventTarget, transactionHash) => {
|
|
223
|
-
const successEvent = new CustomEvent(
|
|
223
|
+
const successEvent = new CustomEvent(no.IMTBL_BRIDGE_WIDGET_EVENT, {
|
|
224
224
|
detail: {
|
|
225
|
-
type:
|
|
225
|
+
type: uo.TRANSACTION_SENT,
|
|
226
226
|
data: {
|
|
227
227
|
transactionHash,
|
|
228
228
|
},
|
|
@@ -234,9 +234,9 @@ const sendBridgeTransactionSentEvent = (eventTarget, transactionHash) => {
|
|
|
234
234
|
eventTarget.dispatchEvent(successEvent);
|
|
235
235
|
};
|
|
236
236
|
const sendBridgeFailedEvent = (eventTarget, reason) => {
|
|
237
|
-
const failedEvent = new CustomEvent(
|
|
237
|
+
const failedEvent = new CustomEvent(no.IMTBL_BRIDGE_WIDGET_EVENT, {
|
|
238
238
|
detail: {
|
|
239
|
-
type:
|
|
239
|
+
type: uo.FAILURE,
|
|
240
240
|
data: {
|
|
241
241
|
reason,
|
|
242
242
|
timestamp: new Date().getTime(),
|
|
@@ -249,9 +249,9 @@ const sendBridgeFailedEvent = (eventTarget, reason) => {
|
|
|
249
249
|
eventTarget.dispatchEvent(failedEvent);
|
|
250
250
|
};
|
|
251
251
|
function sendBridgeWidgetCloseEvent(eventTarget) {
|
|
252
|
-
const closeWidgetEvent = new CustomEvent(
|
|
252
|
+
const closeWidgetEvent = new CustomEvent(no.IMTBL_BRIDGE_WIDGET_EVENT, {
|
|
253
253
|
detail: {
|
|
254
|
-
type:
|
|
254
|
+
type: uo.CLOSE_WIDGET,
|
|
255
255
|
data: {},
|
|
256
256
|
},
|
|
257
257
|
});
|
|
@@ -261,9 +261,9 @@ function sendBridgeWidgetCloseEvent(eventTarget) {
|
|
|
261
261
|
eventTarget.dispatchEvent(closeWidgetEvent);
|
|
262
262
|
}
|
|
263
263
|
const sendBridgeClaimWithdrawalSuccessEvent = (eventTarget, transactionHash) => {
|
|
264
|
-
const successEvent = new CustomEvent(
|
|
264
|
+
const successEvent = new CustomEvent(no.IMTBL_BRIDGE_WIDGET_EVENT, {
|
|
265
265
|
detail: {
|
|
266
|
-
type:
|
|
266
|
+
type: uo.CLAIM_WITHDRAWAL_SUCCESS,
|
|
267
267
|
data: {
|
|
268
268
|
transactionHash,
|
|
269
269
|
},
|
|
@@ -275,9 +275,9 @@ const sendBridgeClaimWithdrawalSuccessEvent = (eventTarget, transactionHash) =>
|
|
|
275
275
|
eventTarget.dispatchEvent(successEvent);
|
|
276
276
|
};
|
|
277
277
|
const sendBridgeClaimWithdrawalFailedEvent = (eventTarget, transactionHash, reason) => {
|
|
278
|
-
const failedEvent = new CustomEvent(
|
|
278
|
+
const failedEvent = new CustomEvent(no.IMTBL_BRIDGE_WIDGET_EVENT, {
|
|
279
279
|
detail: {
|
|
280
|
-
type:
|
|
280
|
+
type: uo.CLAIM_WITHDRAWAL_FAILURE,
|
|
281
281
|
data: {
|
|
282
282
|
transactionHash,
|
|
283
283
|
reason,
|
|
@@ -705,7 +705,7 @@ function Transactions({ defaultTokenImage, onBackButtonClick, }) {
|
|
|
705
705
|
const rootChainId = getL1ChainId(checkout.config);
|
|
706
706
|
try {
|
|
707
707
|
const tokens = (await checkout.getTokenAllowList({
|
|
708
|
-
type:
|
|
708
|
+
type: ae.BRIDGE,
|
|
709
709
|
chainId: rootChainId,
|
|
710
710
|
})).tokens ?? [];
|
|
711
711
|
return tokens.reduce((out, current) => {
|
|
@@ -824,7 +824,7 @@ function Transactions({ defaultTokenImage, onBackButtonClick, }) {
|
|
|
824
824
|
});
|
|
825
825
|
try {
|
|
826
826
|
let changeAccount = false;
|
|
827
|
-
if (event.providerDetail.info.rdns ===
|
|
827
|
+
if (event.providerDetail.info.rdns === Gt.METAMASK) {
|
|
828
828
|
changeAccount = true;
|
|
829
829
|
}
|
|
830
830
|
const browserProvider = new W(event.provider);
|
|
@@ -1070,7 +1070,7 @@ function WalletNetworkButton({ testId, walletProvider, walletProviderDetail, wal
|
|
|
1070
1070
|
const [isWalletConnect, setIsWalletConnect] = reactExports.useState(false);
|
|
1071
1071
|
const { isWalletConnectEnabled, getWalletLogoUrl, getWalletName } = useWalletConnect();
|
|
1072
1072
|
const walletDisplayName = reactExports.useMemo(() => {
|
|
1073
|
-
if (walletProviderDetail?.info.rdns ===
|
|
1073
|
+
if (walletProviderDetail?.info.rdns === Gt.PASSPORT) {
|
|
1074
1074
|
return walletName;
|
|
1075
1075
|
}
|
|
1076
1076
|
if (isWalletConnectProvider(walletProvider)) {
|
|
@@ -1172,9 +1172,9 @@ function WalletAndNetworkSelector() {
|
|
|
1172
1172
|
}, [toWalletBrowserProvider]);
|
|
1173
1173
|
const fromWalletSelectorOptions = reactExports.useMemo(() => providers, [providers]);
|
|
1174
1174
|
const toWalletSelectorOptions = reactExports.useMemo(() => (providers
|
|
1175
|
-
.filter((providerDetail) => (providerDetail.info.rdns !==
|
|
1176
|
-
|| (providerDetail.info.rdns ===
|
|
1177
|
-
&& fromWallet?.providerDetail?.info?.rdns !==
|
|
1175
|
+
.filter((providerDetail) => (providerDetail.info.rdns !== Gt.PASSPORT
|
|
1176
|
+
|| (providerDetail.info.rdns === Gt.PASSPORT
|
|
1177
|
+
&& fromWallet?.providerDetail?.info?.rdns !== Gt.PASSPORT)))), [providers, fromNetwork, fromWallet]);
|
|
1178
1178
|
reactExports.useEffect(() => {
|
|
1179
1179
|
if (!from || !to)
|
|
1180
1180
|
return;
|
|
@@ -1235,7 +1235,7 @@ function WalletAndNetworkSelector() {
|
|
|
1235
1235
|
clearToWalletSelections();
|
|
1236
1236
|
setFromWallet(event);
|
|
1237
1237
|
let changeAccount = false;
|
|
1238
|
-
if (event.providerDetail.info.rdns ===
|
|
1238
|
+
if (event.providerDetail.info.rdns === Gt.METAMASK) {
|
|
1239
1239
|
changeAccount = true;
|
|
1240
1240
|
}
|
|
1241
1241
|
const wrappedBrowserProvider = new W(event.provider);
|
|
@@ -1447,7 +1447,7 @@ function WalletAndNetworkSelector() {
|
|
|
1447
1447
|
display: 'flex',
|
|
1448
1448
|
flexDirection: 'column',
|
|
1449
1449
|
gap: 'base.spacing.x10',
|
|
1450
|
-
}, children: [jsx(WalletNetworkButton, { testId: testId$1, walletProviderDetail: fromWallet?.providerDetail, walletProvider: fromWalletBrowserProvider, walletName: fromWalletProviderName, walletAddress: abbreviateAddress(fromWalletAddress), chainId: fromNetwork, disableNetworkButton: fromWalletProviderName ===
|
|
1450
|
+
}, children: [jsx(WalletNetworkButton, { testId: testId$1, walletProviderDetail: fromWallet?.providerDetail, walletProvider: fromWalletBrowserProvider, walletName: fromWalletProviderName, walletAddress: abbreviateAddress(fromWalletAddress), chainId: fromNetwork, disableNetworkButton: fromWalletProviderName === ge.PASSPORT.toString(), onWalletClick: () => {
|
|
1451
1451
|
// TODO: Force an account selection here
|
|
1452
1452
|
setFromWalletDrawerOpen(true);
|
|
1453
1453
|
}, onNetworkClick: () => setFromNetworkDrawerOpen(true), environment: environment }), jsxs(Box, { children: [jsx(Heading, { size: "xSmall", sx: { paddingBottom: 'base.spacing.x2' }, children: t('views.WALLET_NETWORK_SELECTION.toFormInput.heading') }), jsx(WalletDrawer, { testId: `${testId$1}-to`, drawerText: {
|
|
@@ -1461,13 +1461,13 @@ function WalletAndNetworkSelector() {
|
|
|
1461
1461
|
else {
|
|
1462
1462
|
setToNetworkDrawerOpen(false);
|
|
1463
1463
|
}
|
|
1464
|
-
}, visible: fromNetworkDrawerOpen || toNetworkDrawerOpen, children: jsxs(Drawer.Content, { sx: { paddingX: 'base.spacing.x4' }, children: [jsx(NetworkItem, { testId: testId$1, chainName: imtblZkEvmNetworkName, onNetworkClick: fromNetworkDrawerOpen ? handleFromNetworkSelection : handleToNetworkSelection, chainId: imtblZkEvmNetworkChainId, environment: environment }, imtblZkEvmNetworkName), (toNetworkDrawerOpen || fromWallet?.providerDetail.info.rdns !==
|
|
1464
|
+
}, visible: fromNetworkDrawerOpen || toNetworkDrawerOpen, children: jsxs(Drawer.Content, { sx: { paddingX: 'base.spacing.x4' }, children: [jsx(NetworkItem, { testId: testId$1, chainName: imtblZkEvmNetworkName, onNetworkClick: fromNetworkDrawerOpen ? handleFromNetworkSelection : handleToNetworkSelection, chainId: imtblZkEvmNetworkChainId, environment: environment }, imtblZkEvmNetworkName), (toNetworkDrawerOpen || fromWallet?.providerDetail.info.rdns !== Gt.PASSPORT) && (jsx(NetworkItem, { testId: testId$1, chainName: l1NetworkName, onNetworkClick: fromNetworkDrawerOpen ? handleFromNetworkSelection : handleToNetworkSelection, chainId: l1NetworkChainId, environment: environment }, l1NetworkName))] }) }), isToWalletAndNetworkSelected && toWalletProviderName && (jsxs(Box, { sx: {
|
|
1465
1465
|
flex: 1,
|
|
1466
1466
|
display: 'flex',
|
|
1467
1467
|
flexDirection: 'column',
|
|
1468
1468
|
justifyContent: 'space-between',
|
|
1469
1469
|
}, children: [jsx(WalletNetworkButton, { testId: testId$1, walletProviderDetail: toWallet?.providerDetail, walletProvider: toWalletBrowserProvider, walletName: toWalletProviderName, walletAddress: abbreviateAddress(toWalletAddress), chainId: toNetwork, disableNetworkButton: fromNetwork === l1NetworkChainId
|
|
1470
|
-
|| toWalletProviderName ===
|
|
1470
|
+
|| toWalletProviderName === ge.PASSPORT.toString()
|
|
1471
1471
|
|| fromWalletAddress === toWalletAddress, onWalletClick: () => {
|
|
1472
1472
|
setToWalletDrawerOpen(true);
|
|
1473
1473
|
}, onNetworkClick: () => {
|
|
@@ -1494,7 +1494,7 @@ function WalletNetworkSelectionView({ showBackButton, }) {
|
|
|
1494
1494
|
},
|
|
1495
1495
|
});
|
|
1496
1496
|
}, testId: "move-transactions-button" })), showBack: showBackButton, onBackButtonClick: () => {
|
|
1497
|
-
orchestrationEvents.sendRequestGoBackEvent(eventTarget,
|
|
1497
|
+
orchestrationEvents.sendRequestGoBackEvent(eventTarget, no.IMTBL_BRIDGE_WIDGET_EVENT, {});
|
|
1498
1498
|
} })), footer: jsx(FooterLogo, {}), children: jsx(WalletAndNetworkSelector, {}) }));
|
|
1499
1499
|
}
|
|
1500
1500
|
|
|
@@ -1664,7 +1664,7 @@ function BridgeForm(props) {
|
|
|
1664
1664
|
if (to.walletAddress.toLowerCase() !== from.walletAddress.toLowerCase()) {
|
|
1665
1665
|
addresses.push(to.walletAddress);
|
|
1666
1666
|
}
|
|
1667
|
-
const assessment = await
|
|
1667
|
+
const assessment = await _t(addresses, checkout.config);
|
|
1668
1668
|
bridgeDispatch({
|
|
1669
1669
|
payload: {
|
|
1670
1670
|
type: BridgeActions.SET_RISK_ASSESSMENT,
|
|
@@ -1811,7 +1811,7 @@ function Bridge({ amount, tokenAddress, defaultTokenImage, theme, }) {
|
|
|
1811
1811
|
checkout,
|
|
1812
1812
|
provider: from.browserProvider,
|
|
1813
1813
|
chainId: from?.network,
|
|
1814
|
-
allowTokenListType:
|
|
1814
|
+
allowTokenListType: ae.BRIDGE,
|
|
1815
1815
|
// Skip retry given that in this case it is not needed;
|
|
1816
1816
|
// refreshBalances will be, automatically, called again
|
|
1817
1817
|
// after REFRESH_TOKENS_INTERVAL_MS.
|
|
@@ -2113,7 +2113,7 @@ function BridgeReviewSummary() {
|
|
|
2113
2113
|
return;
|
|
2114
2114
|
const tokenToTransfer = token?.address?.toLowerCase() ?? NATIVE.toUpperCase();
|
|
2115
2115
|
const gasEstimateResult = {
|
|
2116
|
-
gasEstimateType:
|
|
2116
|
+
gasEstimateType: it.BRIDGE_TO_L2,
|
|
2117
2117
|
fees: {},
|
|
2118
2118
|
token: checkout.config.networkMap.get(from.network)?.nativeCurrency,
|
|
2119
2119
|
};
|
|
@@ -2193,7 +2193,7 @@ function BridgeReviewSummary() {
|
|
|
2193
2193
|
transactionFeeData.approvalFee = BigInt(0);
|
|
2194
2194
|
}
|
|
2195
2195
|
const gasEstimateResult = {
|
|
2196
|
-
gasEstimateType:
|
|
2196
|
+
gasEstimateType: it.BRIDGE_TO_L2,
|
|
2197
2197
|
fees: {
|
|
2198
2198
|
...transactionFeeData,
|
|
2199
2199
|
totalFees: rawTotalFees,
|
|
@@ -2284,7 +2284,7 @@ function BridgeReviewSummary() {
|
|
|
2284
2284
|
return;
|
|
2285
2285
|
if (!from || !to)
|
|
2286
2286
|
return;
|
|
2287
|
-
if (riskAssessment &&
|
|
2287
|
+
if (riskAssessment && Ot(riskAssessment)) {
|
|
2288
2288
|
viewDispatch({
|
|
2289
2289
|
payload: {
|
|
2290
2290
|
type: ViewActions.UPDATE_VIEW,
|
|
@@ -2514,7 +2514,7 @@ function ApproveTransaction({ bridgeTransaction }) {
|
|
|
2514
2514
|
});
|
|
2515
2515
|
}, [viewDispatch]);
|
|
2516
2516
|
const handleExceptions = (err) => {
|
|
2517
|
-
if (err.type ===
|
|
2517
|
+
if (err.type === S.UNPREDICTABLE_GAS_LIMIT) {
|
|
2518
2518
|
viewDispatch({
|
|
2519
2519
|
payload: {
|
|
2520
2520
|
type: ViewActions.UPDATE_VIEW,
|
|
@@ -2526,11 +2526,11 @@ function ApproveTransaction({ bridgeTransaction }) {
|
|
|
2526
2526
|
});
|
|
2527
2527
|
return;
|
|
2528
2528
|
}
|
|
2529
|
-
if (err.type ===
|
|
2530
|
-
|| err.type ===
|
|
2529
|
+
if (err.type === S.TRANSACTION_FAILED
|
|
2530
|
+
|| err.type === S.INSUFFICIENT_FUNDS
|
|
2531
2531
|
|| (err.receipt && err.receipt.status === 0)) {
|
|
2532
2532
|
let reason = 'Transaction failed';
|
|
2533
|
-
if (err.type ===
|
|
2533
|
+
if (err.type === S.INSUFFICIENT_FUNDS)
|
|
2534
2534
|
reason = 'Insufficient funds';
|
|
2535
2535
|
if (err.receipt && err.receipt.status === 0)
|
|
2536
2536
|
reason = 'Transaction failed to settle on chain';
|
|
@@ -2597,7 +2597,7 @@ function ApproveTransaction({ bridgeTransaction }) {
|
|
|
2597
2597
|
}
|
|
2598
2598
|
catch (e) {
|
|
2599
2599
|
setTxProcessing(false);
|
|
2600
|
-
if (e.type ===
|
|
2600
|
+
if (e.type === S.USER_REJECTED_REQUEST_ERROR) {
|
|
2601
2601
|
setRejectedBridge(true);
|
|
2602
2602
|
}
|
|
2603
2603
|
else {
|
|
@@ -2649,7 +2649,7 @@ function ApproveTransaction({ bridgeTransaction }) {
|
|
|
2649
2649
|
}
|
|
2650
2650
|
catch (error) {
|
|
2651
2651
|
setTxProcessing(false);
|
|
2652
|
-
if (error.type ===
|
|
2652
|
+
if (error.type === S.USER_REJECTED_REQUEST_ERROR) {
|
|
2653
2653
|
setRejectedBridge(true);
|
|
2654
2654
|
bridgeRejected = true;
|
|
2655
2655
|
}
|
|
@@ -2693,7 +2693,7 @@ function ApproveTransaction({ bridgeTransaction }) {
|
|
|
2693
2693
|
}
|
|
2694
2694
|
}
|
|
2695
2695
|
catch (error) {
|
|
2696
|
-
if (error.type ===
|
|
2696
|
+
if (error.type === S.USER_REJECTED_REQUEST_ERROR) {
|
|
2697
2697
|
setRejectedBridge(true);
|
|
2698
2698
|
}
|
|
2699
2699
|
else {
|
|
@@ -2816,7 +2816,7 @@ function ClaimWithdrawal({ transaction }) {
|
|
|
2816
2816
|
if (isPassportProvider(from?.browserProvider) || forceChangeAccount) {
|
|
2817
2817
|
// user should switch to MetaMask
|
|
2818
2818
|
try {
|
|
2819
|
-
const createProviderResult = await checkout.createProvider({ walletProviderName:
|
|
2819
|
+
const createProviderResult = await checkout.createProvider({ walletProviderName: ge.METAMASK });
|
|
2820
2820
|
const connectResult = await checkout.connect({
|
|
2821
2821
|
provider: createProviderResult.provider,
|
|
2822
2822
|
requestWalletPermissions: true,
|
|
@@ -2856,7 +2856,7 @@ function ClaimWithdrawal({ transaction }) {
|
|
|
2856
2856
|
}
|
|
2857
2857
|
let gasPriceInWei = null;
|
|
2858
2858
|
if (feeData)
|
|
2859
|
-
gasPriceInWei =
|
|
2859
|
+
gasPriceInWei = Rt(feeData);
|
|
2860
2860
|
if (gasPriceInWei) {
|
|
2861
2861
|
ethGasCostWei = gasEstimate * gasPriceInWei;
|
|
2862
2862
|
}
|
|
@@ -3056,7 +3056,7 @@ function BridgeWidget({ checkout, browserProvider, config, amount, tokenAddress,
|
|
|
3056
3056
|
userJourney: UserJourney.BRIDGE,
|
|
3057
3057
|
screen: 'Error',
|
|
3058
3058
|
});
|
|
3059
|
-
} })), viewState.view.type === SharedViews.TOP_UP_VIEW && (jsx(TopUpView, { analytics: { userJourney: UserJourney.BRIDGE }, widgetEvent:
|
|
3059
|
+
} })), viewState.view.type === SharedViews.TOP_UP_VIEW && (jsx(TopUpView, { analytics: { userJourney: UserJourney.BRIDGE }, widgetEvent: no.IMTBL_BRIDGE_WIDGET_EVENT, checkout: checkout, provider: browserProvider, showOnrampOption: isOnRampEnabled, showSwapOption: isSwapEnabled, showBridgeOption: isBridgeEnabled, onCloseButtonClick: () => sendBridgeWidgetCloseEvent(eventTarget) })), viewState.view.type === BridgeWidgetViews.CLAIM_WITHDRAWAL_IN_PROGRESS && (jsx(ClaimWithdrawalInProgress, { transactionResponse: viewState.view.transactionResponse })), viewState.view.type === BridgeWidgetViews.CLAIM_WITHDRAWAL_SUCCESS && (jsx(StatusView, { statusText: t('views.CLAIM_WITHDRAWAL.IN_PROGRESS.success.text'), actionText: t('views.CLAIM_WITHDRAWAL.IN_PROGRESS.success.actionText'), onRenderEvent: () => {
|
|
3060
3060
|
page({
|
|
3061
3061
|
userJourney: UserJourney.BRIDGE,
|
|
3062
3062
|
screen: 'ClaimWithdrawalSuccess',
|