@imtbl/checkout-widgets 2.10.3 → 2.10.4-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-CyYchEqL.js → AddTokensWidget-7xP3ash_.js} +24 -24
- package/dist/browser/{BridgeWidget-BGv6pl-L.js → BridgeWidget-xF3mC-MN.js} +32 -32
- package/dist/browser/{CommerceWidget-BmxPzB_7.js → CommerceWidget-Dx44BFWy.js} +182 -182
- package/dist/browser/{FeesBreakdown-CTf-10x4.js → FeesBreakdown-Dy1ctSpO.js} +2 -2
- package/dist/browser/{OnRampWidget-DHnrE80i.js → OnRampWidget-hWptERhu.js} +40 -26
- package/dist/browser/{SaleWidget-BXzTLbHG.js → SaleWidget-SueR-4Ck.js} +45 -45
- package/dist/browser/{SpendingCapHero-DgeQK3YA.js → SpendingCapHero-kPkYD5HR.js} +1 -1
- package/dist/browser/{SwapWidget-Bh2dRzCk.js → SwapWidget-B9Lgj2-6.js} +12 -12
- package/dist/browser/{TokenImage-D9BGjc4I.js → TokenImage-C44Kn3Pq.js} +1 -1
- package/dist/browser/{TopUpView-DQ6NHIsB.js → TopUpView-DZ6urV-T.js} +4 -4
- package/dist/browser/{WalletApproveHero-C8PSw4WQ.js → WalletApproveHero-B3gMB-AI.js} +2 -2
- package/dist/browser/{WalletWidget-ADG2A7wv.js → WalletWidget-Cq1IwRPp.js} +11 -11
- package/dist/browser/{auto-track-WjZIebqK.js → auto-track-1sIh5Cg-.js} +1 -1
- package/dist/browser/{index-BjDgJAyF.js → index-BAjyTG-F.js} +1 -1
- package/dist/browser/{index-BegaQ_Gy.js → index-BS6qjzzl.js} +1 -1
- package/dist/browser/{index-CTeRLgch.js → index-BpeF_Hv4.js} +1 -1
- package/dist/browser/{index-DOBGPXKx.js → index-CJrC7v34.js} +1 -1
- package/dist/browser/{index-D0vMQXbJ.js → index-C_2UQ8ka.js} +2 -2
- package/dist/browser/{index-DMgRiK35.js → index-Cc4A5E_A.js} +1 -1
- package/dist/browser/{index-CsK_1Pd3.js → index-DA9Xu4LZ.js} +1 -1
- package/dist/browser/{index-C8Pybl6W.js → index-DFAGr0d5.js} +348 -338
- package/dist/browser/index.js +1 -1
- package/dist/browser/{index.umd-TcVSRaL8.js → index.umd-BDwQTcot.js} +1 -1
- package/dist/browser/{useInterval-CI7WTOt5.js → useInterval-apxTIl_n.js} +1 -1
- package/dist/types/components/Transak/useTransakIframe.d.ts +5 -0
- package/package.json +7 -7
- package/src/components/Transak/useTransakIframe.ts +39 -12
- package/src/widgets/on-ramp/views/OnRampMain.tsx +56 -26
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { T as TokenImage } from './TokenImage-
|
|
3
|
-
import { f as fetchRiskAssessmentV2, r as resultHasSanctionedWallets, F as FeesBreakdown } from './FeesBreakdown-
|
|
1
|
+
import { b as reactExports, ac as hFlex, ad as _defineProperty, ae as _objectWithoutProperties, af as useForwardLocalDomRef, ag as _slicedToArray, ah as useResizeObserver, Q as useTheme, ai as usePrevious, aj as useGetMotionProfile, ak as useBrowserEffect, al as merge, am as getHeadingTextStyles, an as getMotionProfileSx, ao as useConvertSxToEmotionStyles, ap as DUMMY_WIDTH_PUSHER_TEXT, x as jsxs, w as jsx, B as Box, aq as useGetSubcomponentChild, ar as flattenChildren, as as vFlex, at as centerFlexChildren, au as SmartClone, av as FormControlLabel, aw as FormControlValidation, ax as FormControlCaption, r as ro, R as Ro, ay as getDefaultExportFromCjs, az as commonjsGlobal, k as useTranslation, aA as Drawer, aB as Divider, H as Heading, y as Button, aC as useProvidersContext, F as useAnalytics, aD as WalletDrawer, aE as UnableToConnectDrawer, aF as Fragment, aG as Gt, U as UserJourney, aH as removeSpace, aI as getProviderSlugFromRdns, aJ as D, aK as isPassportProvider, aL as connectEIP6963Provider, aM as identifyUser, aN as ConnectEIP6963ProviderError, aO as ProvidersContextActions, aP as MenuItem, aQ as J, aR as SQUID_NATIVE_TOKEN, aS as commonjsRequire, X as getRemoteImage, aT as OnboardingPagination, aU as ViewContext, aV as useHandover, G as EventTargetContext, aW as HandoverTarget, V as ViewActions, t as getRemoteRive, aX as APPROVE_TXN_ANIMATION, aY as RiveStateMachineInput, aZ as HandoverContent, a_ as keyframes, j as ie, a$ as isNativeToken, b0 as getTokenImageByAddress, b1 as FramedImage, b2 as FramedIcon, b3 as ButtCon, b4 as TextInput, b5 as VerticalMenu, K as getDefaultTokenImage, b6 as TOKEN_PRIORITY_ORDER, D as Body, b7 as EllipsizedText, b8 as Tooltip, b9 as Sticker, ba as getDurationFormatted, bb as getTotalRouteFees, bc as getRouteAndTokenBalances, S as Stack, bd as Icon, be as Badge, bf as getFormattedAmounts, bg as getRemoteVideo, bh as FramedVideo, bi as listVariants, bj as motion, bk as listItemVariants, bl as Banner, bm as useRoutes, bn as useInjectedProviders, bo as hn, bp as RouteError, z as SimpleLayout, bq as dist, O as orchestrationEvents, c as parseUnits, a5 as SharedViews, br as SquidFooter, bs as TOOLKIT_SQUID_URL, bt as merge$1, bu as SvgIcon, bv as WalletWarningHero, bw as getFormattedNumber, bx as FIXED_HANDOVER_DURATION, by as EXECUTE_TXN_ANIMATION, L as Link, bz as Trans, bA as useExecute, bB as getRouteChains, bC as t, bD as convertToNetworkChangeableProvider, bE as verifyAndSwitchChain, bF as PriceDisplay, a0 as LoadingView, bG as getFromAmountData, bH as viewReducer, bI as initialViewState, bJ as useSquid, bK as useTokens, bL as v4, bM as K, bN as isValidAddress, P as amountInputValidation, bO as fetchChains, bP as fetchBalances, W as CloudImage, a6 as ErrorView, bQ as ServiceUnavailableErrorView } from './index-DFAGr0d5.js';
|
|
2
|
+
import { T as TokenImage } from './TokenImage-C44Kn3Pq.js';
|
|
3
|
+
import { f as fetchRiskAssessmentV2, r as resultHasSanctionedWallets, F as FeesBreakdown } from './FeesBreakdown-Dy1ctSpO.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The function `useInterval` sets up an interval that repeatedly calls a given callback function with
|
|
@@ -292,9 +292,9 @@ HeroFormControl.inputs = SUPPORTED_INPUT_COMPONENTS_MAP;
|
|
|
292
292
|
|
|
293
293
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
294
294
|
function sendAddTokensCloseEvent(eventTarget) {
|
|
295
|
-
const closeWidgetEvent = new CustomEvent(
|
|
295
|
+
const closeWidgetEvent = new CustomEvent(ro.IMTBL_ADD_TOKENS_WIDGET_EVENT, {
|
|
296
296
|
detail: {
|
|
297
|
-
type:
|
|
297
|
+
type: Ro.CLOSE_WIDGET,
|
|
298
298
|
data: {},
|
|
299
299
|
},
|
|
300
300
|
});
|
|
@@ -305,9 +305,9 @@ function sendAddTokensCloseEvent(eventTarget) {
|
|
|
305
305
|
eventTarget.dispatchEvent(closeWidgetEvent);
|
|
306
306
|
}
|
|
307
307
|
function sendConnectProviderSuccessEvent(eventTarget, providerType, provider, providerInfo) {
|
|
308
|
-
const successEvent = new CustomEvent(
|
|
308
|
+
const successEvent = new CustomEvent(ro.IMTBL_ADD_TOKENS_WIDGET_EVENT, {
|
|
309
309
|
detail: {
|
|
310
|
-
type:
|
|
310
|
+
type: Ro.CONNECT_SUCCESS,
|
|
311
311
|
data: {
|
|
312
312
|
provider,
|
|
313
313
|
providerType,
|
|
@@ -321,9 +321,9 @@ function sendConnectProviderSuccessEvent(eventTarget, providerType, provider, pr
|
|
|
321
321
|
eventTarget.dispatchEvent(successEvent);
|
|
322
322
|
}
|
|
323
323
|
const sendAddTokensSuccessEvent = (eventTarget, transactionHash) => {
|
|
324
|
-
const successEvent = new CustomEvent(
|
|
324
|
+
const successEvent = new CustomEvent(ro.IMTBL_ADD_TOKENS_WIDGET_EVENT, {
|
|
325
325
|
detail: {
|
|
326
|
-
type:
|
|
326
|
+
type: Ro.SUCCESS,
|
|
327
327
|
data: {
|
|
328
328
|
transactionHash,
|
|
329
329
|
},
|
|
@@ -335,9 +335,9 @@ const sendAddTokensSuccessEvent = (eventTarget, transactionHash) => {
|
|
|
335
335
|
eventTarget.dispatchEvent(successEvent);
|
|
336
336
|
};
|
|
337
337
|
const sendAddTokensFailedEvent = (eventTarget, reason) => {
|
|
338
|
-
const failedEvent = new CustomEvent(
|
|
338
|
+
const failedEvent = new CustomEvent(ro.IMTBL_ADD_TOKENS_WIDGET_EVENT, {
|
|
339
339
|
detail: {
|
|
340
|
-
type:
|
|
340
|
+
type: Ro.FAILURE,
|
|
341
341
|
data: {
|
|
342
342
|
reason,
|
|
343
343
|
timestamp: new Date().getTime(),
|
|
@@ -929,7 +929,7 @@ function ConnectWalletDrawer({ heading, visible, onClose, onConnect, onError, pr
|
|
|
929
929
|
walletRdns: info.rdns,
|
|
930
930
|
},
|
|
931
931
|
});
|
|
932
|
-
if (info.rdns ===
|
|
932
|
+
if (info.rdns === Gt.PASSPORT) {
|
|
933
933
|
const { isConnected } = await checkout.checkIsWalletConnected({
|
|
934
934
|
provider: new D(providerDetail.provider),
|
|
935
935
|
});
|
|
@@ -975,7 +975,7 @@ function ConnectWalletDrawer({ heading, visible, onClose, onConnect, onError, pr
|
|
|
975
975
|
// Keep prev wallet change event
|
|
976
976
|
prevWalletChangeEvent.current = event;
|
|
977
977
|
const { info } = event.providerDetail;
|
|
978
|
-
if (providerType === 'to' && info.rdns !==
|
|
978
|
+
if (providerType === 'to' && info.rdns !== Gt.PASSPORT) {
|
|
979
979
|
setShowEOAWarningDrawer(true);
|
|
980
980
|
return;
|
|
981
981
|
}
|
|
@@ -1046,7 +1046,7 @@ function convertToUsd(tokens, amount, token) {
|
|
|
1046
1046
|
}
|
|
1047
1047
|
const address = token.address === 'native' ? SQUID_NATIVE_TOKEN : token.address;
|
|
1048
1048
|
const toToken = tokens.find((value) => value.address.toLowerCase() === address.toLowerCase()
|
|
1049
|
-
&& value.chainId ===
|
|
1049
|
+
&& value.chainId === J.IMTBL_ZKEVM_MAINNET.toString());
|
|
1050
1050
|
if (!toToken) {
|
|
1051
1051
|
return 0;
|
|
1052
1052
|
}
|
|
@@ -4154,7 +4154,7 @@ function TokenDrawerMenu({ checkout, config, toTokenAddress, addTokensState, add
|
|
|
4154
4154
|
(async () => {
|
|
4155
4155
|
try {
|
|
4156
4156
|
const tokenResponse = await checkout.getTokenAllowList({
|
|
4157
|
-
type:
|
|
4157
|
+
type: ie.SWAP,
|
|
4158
4158
|
chainId: checkout.config.l2ChainId,
|
|
4159
4159
|
});
|
|
4160
4160
|
if (tokenResponse?.tokens.length > 0) {
|
|
@@ -4553,7 +4553,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4553
4553
|
const walletOptions = reactExports.useMemo(() => providers
|
|
4554
4554
|
// TODO: Check if must filter passport on L1
|
|
4555
4555
|
.map((detail) => {
|
|
4556
|
-
if (detail.info.rdns ===
|
|
4556
|
+
if (detail.info.rdns === Gt.PASSPORT) {
|
|
4557
4557
|
return {
|
|
4558
4558
|
...detail,
|
|
4559
4559
|
info: {
|
|
@@ -4574,7 +4574,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4574
4574
|
await identifyUser(identify, toProvider, { anonymousId });
|
|
4575
4575
|
})();
|
|
4576
4576
|
}, [toProvider, lockedToProvider]);
|
|
4577
|
-
const toChain = reactExports.useMemo(() => chains?.find((chain) => chain.id ===
|
|
4577
|
+
const toChain = reactExports.useMemo(() => chains?.find((chain) => chain.id === J.IMTBL_ZKEVM_MAINNET.toString()), [chains]);
|
|
4578
4578
|
reactExports.useEffect(() => {
|
|
4579
4579
|
if (!id || isSwapAvailable === undefined) {
|
|
4580
4580
|
return;
|
|
@@ -4615,7 +4615,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4615
4615
|
&& isValidAmount) {
|
|
4616
4616
|
setFetchingRoutes(true);
|
|
4617
4617
|
try {
|
|
4618
|
-
const availableRoutes = await fetchRoutes(squid, tokens, balances,
|
|
4618
|
+
const availableRoutes = await fetchRoutes(squid, tokens, balances, J.IMTBL_ZKEVM_MAINNET.toString(), selectedToken.address === 'native'
|
|
4619
4619
|
? SQUID_NATIVE_TOKEN
|
|
4620
4620
|
: selectedToken.address, selectedAmount, 5, 1000, isSwapAvailable);
|
|
4621
4621
|
addTokensDispatch({
|
|
@@ -4669,7 +4669,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4669
4669
|
const fetchOnRampTokens = async () => {
|
|
4670
4670
|
try {
|
|
4671
4671
|
const tokenResponse = await checkout.getTokenAllowList({
|
|
4672
|
-
type:
|
|
4672
|
+
type: ie.ONRAMP,
|
|
4673
4673
|
chainId: checkout.config.l2ChainId,
|
|
4674
4674
|
});
|
|
4675
4675
|
if (tokenResponse?.tokens.length > 0) {
|
|
@@ -4700,7 +4700,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4700
4700
|
showBackButton: true,
|
|
4701
4701
|
provider: toProvider,
|
|
4702
4702
|
};
|
|
4703
|
-
orchestrationEvents.sendRequestOnrampEvent(eventTarget,
|
|
4703
|
+
orchestrationEvents.sendRequestOnrampEvent(eventTarget, ro.IMTBL_ADD_TOKENS_WIDGET_EVENT, data);
|
|
4704
4704
|
};
|
|
4705
4705
|
const handleCardClick = () => {
|
|
4706
4706
|
setPayWithCardClicked(true);
|
|
@@ -4766,7 +4766,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4766
4766
|
type: AddTokensWidgetViews.REVIEW,
|
|
4767
4767
|
data: {
|
|
4768
4768
|
balance: selectedRouteData.amountData.balance,
|
|
4769
|
-
toChainId:
|
|
4769
|
+
toChainId: J.IMTBL_ZKEVM_MAINNET.toString(),
|
|
4770
4770
|
toTokenAddress: selectedToken.address,
|
|
4771
4771
|
toAmount: selectedAmount,
|
|
4772
4772
|
additionalBuffer: selectedRouteData.amountData.additionalBuffer,
|
|
@@ -5294,9 +5294,9 @@ function Review({ data, showBackButton = false, onBackButtonClick, onCloseButton
|
|
|
5294
5294
|
action: 'Succeeded',
|
|
5295
5295
|
extras: {
|
|
5296
5296
|
contextId: id,
|
|
5297
|
-
...(route.route.params.fromChain !==
|
|
5297
|
+
...(route.route.params.fromChain !== J.IMTBL_ZKEVM_MAINNET.toString()
|
|
5298
5298
|
&& { txHash: executeTxnReceipt.hash }),
|
|
5299
|
-
...(route.route.params.fromChain ===
|
|
5299
|
+
...(route.route.params.fromChain === J.IMTBL_ZKEVM_MAINNET.toString()
|
|
5300
5300
|
&& { immutableZkEVMTxHash: executeTxnReceipt.hash }),
|
|
5301
5301
|
toTokenAddress: route.route.params.toToken,
|
|
5302
5302
|
toTokenChainId: route.route.params.toChain,
|
|
@@ -5549,7 +5549,7 @@ function AddTokensWidget({ showOnrampOption = true, showSwapOption = true, showB
|
|
|
5549
5549
|
objectFit: 'cover',
|
|
5550
5550
|
objectPosition: 'center',
|
|
5551
5551
|
} }), 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: () => {
|
|
5552
|
-
orchestrationEvents.sendRequestGoBackEvent(eventTarget,
|
|
5552
|
+
orchestrationEvents.sendRequestGoBackEvent(eventTarget, ro.IMTBL_ADD_TOKENS_WIDGET_EVENT, {});
|
|
5553
5553
|
} })), viewState.view.type === AddTokensWidgetViews.REVIEW && (jsx(Review, { data: viewState.view.data, onCloseButtonClick: () => sendAddTokensCloseEvent(eventTarget), onBackButtonClick: () => {
|
|
5554
5554
|
viewDispatch({
|
|
5555
5555
|
payload: {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { cp as toQuantity, cq as toBeHex, cr as getAddress, cs as keccak256, ct as AbiCoder, cu as concat, cv as axios, cw as ZeroAddress, h as Contract, _ as isAddress, bM as K$1, aQ as
|
|
2
|
-
import { B as BridgeWidgetViews, T as TopUpView } from './TopUpView-
|
|
3
|
-
import { T as TokenImage } from './TokenImage-
|
|
4
|
-
import { A as Accordion, S as SelectForm, T as TextInputForm, a as TransactionRejected, g as getAllowedBalances, b as gasAmountAccordionStyles, c as gasAmountHeadingStyles, N as NetworkSwitchDrawer, W as WalletApproveHero } from './WalletApproveHero-
|
|
5
|
-
import { f as fetchRiskAssessmentV2, r as resultHasSanctionedWallets, F as FeesBreakdown } from './FeesBreakdown-
|
|
6
|
-
import { u as useInterval } from './useInterval-
|
|
1
|
+
import { cp as toQuantity, cq as toBeHex, cr as getAddress, cs as keccak256, ct as AbiCoder, cu as concat, cv as axios, cw as ZeroAddress, h as Contract, _ as isAddress, bM as K$1, aQ as J$1, cx as nt$1, cy as S, b as reactExports, r as ro, l as lo, x as jsxs, w as jsx, cz as ShimmerBox, aP as MenuItem, S as Stack, k as useTranslation, D as Body, y as Button, B as Box, cA as PASSPORT_URL, L as Link, cB as getChainImage, b1 as FramedImage, b7 as EllipsizedText, bd as Icon, cC as getChainIdBySlug, aU as ViewContext, F as useAnalytics, aF as Fragment, aB as Divider, U as UserJourney, V as ViewActions, cD as useWalletConnect, cE as Logo, cF as RawImage, cG as isWalletConnectProvider, I as CryptoFiatContext, a$ as isNativeToken, b0 as getTokenImageByAddress, cH as getNativeSymbolByChainSlug, cb as formatUnits, e as calculateCryptoToFiat, G as EventTargetContext, j as ie$1, cI as JsonRpcProvider, a1 as CryptoFiatActions, aJ as D$1, bn as useInjectedProviders, cJ as retry, M as HeaderNavigation, c5 as FooterLogo, aD as WalletDrawer, z as SimpleLayout, cK as getChainSlugById, aK as isPassportProvider, cL as DEFAULT_TRANSACTIONS_RETRY_POLICY, aG as Gt, a0 as LoadingView, Q as useTheme, H as Heading, cM as getChainNameById, cN as getWalletProviderNameByProvider, cO as isMetaMaskProvider, cP as fe$1, aA as Drawer, b3 as ButtCon, cQ as ButtonNavigationStyles, O as orchestrationEvents, J as tokenValueFormat, d as formatZeroAmount, cR as NATIVE, bU as mn, c as parseUnits, P as amountInputValidation, W as CloudImage, cS as ETH_TOKEN_SYMBOL, X as getRemoteImage, bF as PriceDisplay, cT as st, cU as DEFAULT_QUOTE_REFRESH_INTERVAL, cV as addChainChangedListener, cW as removeChainChangedListener, cX as xt, cY as IMX_TOKEN_SYMBOL, a5 as SharedViews, cZ as DEFAULT_TOKEN_DECIMALS, q as dist, c_ as CHECKOUT_CDN_BASE_URL, c$ as heroBackGroundStyles, d0 as heroImageStyles, be as Badge, d1 as SimpleTextBody, d2 as FooterButton, d3 as getEthTokenImage, d4 as WITHDRAWAL_CLAIM_GAS_LIMIT, d5 as Ct, bH as viewReducer, bI as initialViewState, d6 as r, d7 as StatusView, c6 as StatusType, a6 as ErrorView, bQ as ServiceUnavailableErrorView, Y as CryptoFiatProvider, K as getDefaultTokenImage } from './index-DFAGr0d5.js';
|
|
2
|
+
import { B as BridgeWidgetViews, T as TopUpView } from './TopUpView-DZ6urV-T.js';
|
|
3
|
+
import { T as TokenImage } from './TokenImage-C44Kn3Pq.js';
|
|
4
|
+
import { A as Accordion, S as SelectForm, T as TextInputForm, a as TransactionRejected, g as getAllowedBalances, b as gasAmountAccordionStyles, c as gasAmountHeadingStyles, N as NetworkSwitchDrawer, W as WalletApproveHero } from './WalletApproveHero-B3gMB-AI.js';
|
|
5
|
+
import { f as fetchRiskAssessmentV2, r as resultHasSanctionedWallets, F as FeesBreakdown } from './FeesBreakdown-Dy1ctSpO.js';
|
|
6
|
+
import { u as useInterval } from './useInterval-apxTIl_n.js';
|
|
7
7
|
|
|
8
8
|
var ae=[{inputs:[{internalType:"address",name:"_gateway",type:"address"},{internalType:"address",name:"_initializerAddress",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"CallerNotBridge",type:"error"},{inputs:[],name:"InvalidAddress",type:"error"},{inputs:[],name:"InvalidChildBridgeAdaptor",type:"error"},{inputs:[],name:"InvalidChildChain",type:"error"},{inputs:[],name:"InvalidSourceAddress",type:"error"},{inputs:[],name:"InvalidSourceChain",type:"error"},{inputs:[],name:"NoGas",type:"error"},{inputs:[],name:"NotApprovedByGateway",type:"error"},{inputs:[],name:"UnauthorizedInitializer",type:"error"},{inputs:[],name:"UnsupportedOperation",type:"error"},{inputs:[],name:"ZeroAddresses",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"sourceChain",type:"string"},{indexed:!1,internalType:"string",name:"sourceAddress_",type:"string"},{indexed:!1,internalType:"bytes",name:"payload_",type:"bytes"}],name:"AdaptorExecute",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"string",name:"childChain",type:"string"},{indexed:!0,internalType:"string",name:"childBridgeAdaptor",type:"string"},{indexed:!0,internalType:"bytes",name:"payload",type:"bytes"}],name:"AxelarMessageSent",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"oldChildBridgeAdaptor",type:"string"},{indexed:!1,internalType:"string",name:"newChildBridgeAdaptor",type:"string"}],name:"ChildBridgeAdaptorUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"string",name:"oldChildChain",type:"string"},{indexed:!0,internalType:"string",name:"newChildChain",type:"string"}],name:"ChildChainUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldGasService",type:"address"},{indexed:!0,internalType:"address",name:"newGasService",type:"address"}],name:"GasServiceUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint8",name:"version",type:"uint8"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"previousAdminRole",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"newAdminRole",type:"bytes32"}],name:"RoleAdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleGranted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleRevoked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldRootBridge",type:"address"},{indexed:!0,internalType:"address",name:"newRootBridge",type:"address"}],name:"RootBridgeUpdated",type:"event"},{inputs:[],name:"BRIDGE_MANAGER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"DEFAULT_ADMIN_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"GAS_SERVICE_MANAGER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"TARGET_MANAGER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"childBridgeAdaptor",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"childChainId",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"commandId",type:"bytes32"},{internalType:"string",name:"sourceChain",type:"string"},{internalType:"string",name:"sourceAddress",type:"string"},{internalType:"bytes",name:"payload",type:"bytes"}],name:"execute",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"commandId",type:"bytes32"},{internalType:"string",name:"sourceChain",type:"string"},{internalType:"string",name:"sourceAddress",type:"string"},{internalType:"bytes",name:"payload",type:"bytes"},{internalType:"string",name:"tokenSymbol",type:"string"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"executeWithToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"gasService",outputs:[{internalType:"contract IAxelarGasService",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"gateway",outputs:[{internalType:"contract IAxelarGateway",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"}],name:"getRoleAdmin",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"grantBridgeManagerRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"grantGasServiceManagerRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"grantRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"grantTargetManagerRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"hasRole",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"defaultAdmin",type:"address"},{internalType:"address",name:"bridgeManager",type:"address"},{internalType:"address",name:"gasServiceManager",type:"address"},{internalType:"address",name:"targetManager",type:"address"}],internalType:"struct IRootAxelarBridgeAdaptor.InitializationRoles",name:"_adaptorRoles",type:"tuple"},{internalType:"address",name:"_rootBridge",type:"address"},{internalType:"string",name:"_childChainId",type:"string"},{internalType:"string",name:"_childBridgeAdaptor",type:"string"},{internalType:"address",name:"_gasService",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"initializerAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"renounceRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"revokeBridgeManagerRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"revokeGasServiceManagerRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"revokeRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"revokeTargetManagerRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"rootBridge",outputs:[{internalType:"contract IRootERC20Bridge",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"payload",type:"bytes"},{internalType:"address",name:"refundRecipient",type:"address"}],name:"sendMessage",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"newChildBridgeAdaptor",type:"string"}],name:"updateChildBridgeAdaptor",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"newChildChain",type:"string"}],name:"updateChildChain",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newGasService",type:"address"}],name:"updateGasService",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newRootBridge",type:"address"}],name:"updateRootBridge",outputs:[],stateMutability:"nonpayable",type:"function"}];var ie=(i=>(i.SUCCESS="SUCCESS",i.PENDING="PENDING",i.FAILED="FAILED",i))(ie||{}),W=(i=>(i.DEPOSIT="DEPOSIT",i.WITHDRAW="WITHDRAW",i.FINALISE_WITHDRAWAL="FINALISE_WITHDRAWAL",i))(W||{}),G=(d=>(d[d.DEPOSIT_SOURCE=15e4]="DEPOSIT_SOURCE",d[d.DEPOSIT_DESTINATION=25e4]="DEPOSIT_DESTINATION",d[d.WITHDRAW_SOURCE=25e4]="WITHDRAW_SOURCE",d[d.WITHDRAW_DESTINATION=25e4]="WITHDRAW_DESTINATION",d[d.MAP_TOKEN_SOURCE=2e5]="MAP_TOKEN_SOURCE",d[d.MAP_TOKEN_DESTINATION=2e5]="MAP_TOKEN_DESTINATION",d[d.FINALISE_WITHDRAWAL=2e5]="FINALISE_WITHDRAWAL",d[d.APPROVE_TOKEN=55e3]="APPROVE_TOKEN",d))(G||{}),U=(s=>(s.PENDING="PENDING",s.PROCESSING="PROCESSING",s.COMPLETE="COMPLETE",s.RETRY="RETRY",s.ERROR="ERROR",s.NOT_ENOUGH_GAS="NOT_ENOUGH_GAS",s.FLOW_RATE_CONTROLLED="FLOW_RATE_CONTROLLED",s))(U||{});var R="NATIVE",re="11155111",Ze="1",H="15003",V="13473",X="13371",se="0x0000000000000000000000000000000000000eee",oe="0x7a8dc26796a1e50e6e190b70259f58f6a4edd5b22280ceecc82b687b8e982869",de="0x07b0d4304f82012bd3b70b1d531c160e326067c90829e2a3d386722ad10b89c3",pe="0x0000000000000000000000000000000000000000000000000000000000000004",ue={mainnet:"0x3a0c2ba54d6cbd3121f01b96dfd20e99d1696c9d",testnet:"0x1CcCa691501174B4A623CeDA58cC8f1a76dc3439",devnet:""},le={mainnet:"0xf57e7e7c23978c3caec3c3548e3d615c346e79ff",testnet:"0xe2629e08f4125d14e446660028bD98ee60EE69F2",devnet:""},ye={mainnet:"0x52a6c53869ce09a731cd772f245b97a4401d3348",testnet:"0xe9E96d1aad82562b7588F03f49aD34186f996478",devnet:""},ce={mainnet:"0x4f49b53928a71e553bb1b0f66a5bcb54fd4e8932",testnet:"0x6328Ac88ba8D466a0F551FC7C42C61d1aC7f92ab",devnet:""},me={mainnet:"0x4f49b53928a71e553bb1b0f66a5bcb54fd4e8932",testnet:"0x6328Ac88ba8D466a0F551FC7C42C61d1aC7f92ab",devnet:""},Te={mainnet:"immutable",testnet:"immutable",devnet:""},ge={mainnet:"0x4F4495243837681061C4743b74B3eEdf548D56A5",testnet:"0xe432150cce91c13a887f7D836923d5597adD8E31",devnet:""},$={rootChainID:re,childChainID:H},O={rootChainID:re,childChainID:V},P={rootChainID:Ze,childChainID:X},fe={mainnet:"https://api.gmp.axelarscan.io",testnet:"https://testnet.api.gmp.axelarscan.io",devnet:"https://stagenet.api.gmp.axelarscan.io"},he={mainnet:"https://bridge-api.immutable.com/v1/tenderly/estimate",testnet:"https://bridge-api.sandbox.immutable.com/v1/tenderly/estimate",devnet:"https://bridge-api.dev.immutable.com/v1/tenderly/estimate"},K={11155111:{id:"ethereum-sepolia",symbol:"ETH"},1:{id:"ethereum",symbol:"ETH"},15003:{id:"immutable",symbol:"IMX"},13473:{id:"immutable",symbol:"IMX"},13371:{id:"immutable",symbol:"IMX"}},Q={deposit:{token:"deposit",tokenTo:"depositTo",native:"depositETH",nativeTo:"depositToETH"},withdraw:{token:"withdraw",tokenTo:"withdrawTo",native:"withdrawIMX",nativeTo:"withdrawIMXTo"}};var _=(T=>(T.UNSUPPORTED_ERROR="UNSUPPORTED_ERROR",T.INVALID_ADDRESS="INVALID_ADDRESS",T.INVALID_AMOUNT="INVALID_AMOUNT",T.INTERNAL_ERROR="INTERNAL_ERROR",T.PROVIDER_ERROR="PROVIDER_ERROR",T.ROOT_PROVIDER_ERROR="ROOT_PROVIDER_ERROR",T.CHILD_PROVIDER_ERROR="CHILD_PROVIDER_ERROR",T.TRANSACTION_REVERTED="TRANSACTION_REVERTED",T.INVALID_TOKEN="INVALID_TOKEN",T.INVALID_TRANSACTION="INVALID_TRANSACTION",T.INVALID_SOURCE_CHAIN_ID="INVALID_SOURCE_CHAIN_ID",T.INVALID_DESTINATION_CHAIN_ID="INVALID_DESTINATION_CHAIN_ID",T.INVALID_SOURCE_OR_DESTINATION_CHAIN="INVALID_SOURCE_OR_DESTINATION_CHAIN",T.CHAIN_IDS_MATCH="CHAIN_IDS_MATCH",T.AXELAR_CHAIN_NOT_FOUND="AXELAR_CHAIN_NOT_FOUND",T.AXELAR_GAS_ESTIMATE_FAILED="AXELAR_GAS_ESTIMATE_FAILED",T.TENDERLY_GAS_ESTIMATE_FAILED="TENDERLY_GAS_ESTIMATE_FAILED",T.INVALID_RECIPIENT="INVALID_RECIPIENT",T.FLOW_RATE_ERROR="FLOW_RATE_ERROR",T.INVALID_FLOWRATE_INDEX="INVALID_FLOWRATE_INDEX",T))(_||{}),y=class extends Error{type;constructor(e,t){super(e),this.type=t;}},E=async(n,e,t)=>{try{return await n()}catch(i){let a=`${e}: ${i.message}`||"UnknownError";throw new y(a,e)}};async function I(n,e,t){return await E(async()=>new Contract(n,e,t),"PROVIDER_ERROR")}function C(n,e){let t;return n===P.rootChainID||n===P.childChainID?t=e.mainnet:n===O.rootChainID||n===O.childChainID?t=e.testnet:t=e.devnet,t}function je(n){return C(n,ye)}function be(n,e){return n.toUpperCase()===je(e).toUpperCase()}function z(n){return C(n,le)}function Re(n,e){return n.toUpperCase()===z(e).toUpperCase()}function Ie(n){return C(n,ce)}function Ae(n){return C(n,me)}function Ee(n){return C(n,Te)}function we(n){return C(n,ge)}function Z(n){return C(n,fe)}function xe(n){return C(n,he)}function qe(n){return C(n,ue)}function B(n,e){return n.toUpperCase()===qe(e).toUpperCase()}function v(n,e){return n.sourceChainId===e.rootChainID&&n.destinationChainId===e.childChainID&&n.action==="DEPOSIT"}function Ce(n,e){return n===e.rootChainID}function D(n,e){return n.sourceChainId===e.childChainID&&n.destinationChainId===e.rootChainID&&n.action==="WITHDRAW"}function ve(n,e,t){return D(e,t)&&!B(n,e.sourceChainId)}function _e(n){return !("token"in n)||n.token.toUpperCase()===R}function De(n,e,t){return D(e,t)&&B(n,e.sourceChainId)}async function Me(n){let e="Please upgrade to the latest version of the Bridge SDK or provide valid configuration",t=await E(async()=>n.rootProvider.getNetwork(),"ROOT_PROVIDER_ERROR");if(t.chainId.toString()!==n.bridgeInstance.rootChainID)throw new y(`Rootchain provider chainID ${t.chainId} does not match expected chainID ${n.bridgeInstance.rootChainID}. ${e}`,"UNSUPPORTED_ERROR");let i=await E(async()=>n.childProvider.getNetwork(),"CHILD_PROVIDER_ERROR");if(i.chainId.toString()!==n.bridgeInstance.childChainID)throw new y(`Childchain provider chainID ${i.chainId} does not match expected chainID ${n.bridgeInstance.childChainID}. ${e} `,"UNSUPPORTED_ERROR")}async function Ne(n,e,t,i){let a;if(e===i.bridgeInstance.rootChainID){if(!be(n,e))return;a=i.rootProvider;}else {if(!Re(n,e))return;a=i.childProvider;}if((await a.getCode(t)).length<=2)return;let s=await I(t,["function receive()"],a);try{await s.receive.estimateGas();}catch{try{await a.estimateGas({to:t});}catch{throw new y(`address ${t} is not a valid receipient`,"INVALID_RECIPIENT")}}}async function j(n,e,t){if(!(n===t.bridgeInstance.rootChainID||n===t.bridgeInstance.childChainID))throw new y(`the sourceChainId ${n} is not a valid`,"INVALID_SOURCE_CHAIN_ID");if(!(e===t.bridgeInstance.rootChainID||e===t.bridgeInstance.childChainID))throw new y(`the destinationChainId ${e} is not a valid`,"INVALID_DESTINATION_CHAIN_ID");if(n===e)throw new y(`the sourceChainId ${n} cannot be the same as the destinationChainId ${e}`,"CHAIN_IDS_MATCH")}async function Oe(n,e){if(await j(n.sourceChainId,n.destinationChainId,e),!isAddress(n.senderAddress)||!isAddress(n.recipientAddress))throw new y(`address ${n.senderAddress} or ${n.recipientAddress} is not a valid address`,"INVALID_ADDRESS");if(n.amount<=0n)throw new y(`deposit amount ${n.amount.toString()} is invalid`,"INVALID_AMOUNT");if(n.token.toUpperCase()!==R&&!isAddress(n.token))throw new y(`token address ${n.token} is not a valid address`,"INVALID_ADDRESS")}function Pe(n,e){if(n.action==="FINALISE_WITHDRAWAL"&&n.sourceChainId!==e.bridgeInstance.rootChainID)throw new y(`Finalised withdrawals must be on the root chain (${e.bridgeInstance.rootChainID})`,"INVALID_SOURCE_CHAIN_ID");if(!("destinationChainId"in n))throw new y("DEPOSIT or WITHDRAW used without destinationChainId","INVALID_DESTINATION_CHAIN_ID");let t={sourceChainId:n.sourceChainId,destinationChainId:n.destinationChainId,action:n.action};if(!v(t,e.bridgeInstance)&&!D(t,e.bridgeInstance))throw new y("This request is neither a valid deposit nor a valid withdrawal","INVALID_SOURCE_OR_DESTINATION_CHAIN")}var Je=n=>!!n.maxFeePerGas&&!!n.maxPriorityFeePerGas,et=n=>{if(Je(n)){let{maxFeePerGas:e,maxPriorityFeePerGas:t}=n;if(e===null||t===null)return null;let i=(e-t)/BigInt(2);return t+i}return n.gasPrice?n.gasPrice:null};function w(n,e){let t=et(n);return t?t*BigInt(e):BigInt(0)}var Be=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint8",name:"version",type:"uint8"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"userAddress",type:"address"},{indexed:!1,internalType:"address",name:"relayerAddress",type:"address"},{indexed:!1,internalType:"bytes",name:"functionSignature",type:"bytes"}],name:"MetaTransactionExecuted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"bridge",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"userAddress",type:"address"},{internalType:"bytes",name:"functionSignature",type:"bytes"},{internalType:"bytes32",name:"sigR",type:"bytes32"},{internalType:"bytes32",name:"sigS",type:"bytes32"},{internalType:"uint8",name:"sigV",type:"uint8"}],name:"executeMetaTransaction",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"}],name:"getNonce",outputs:[{internalType:"uint256",name:"nonce",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"rootToken_",type:"address"},{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"},{internalType:"uint8",name:"decimals_",type:"uint8"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"offset",type:"uint256"}],name:"invalidateNext",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"rootToken",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}];function Fe(n){return keccak256(AbiCoder.defaultAbiCoder().encode(["bytes","uint256"],[n,new Date().getTime()]))}function We(n,e,t,i){return AbiCoder.defaultAbiCoder().encode(["bytes32","address","address","address","uint256"],[oe,n,e,t,i])}async function nt(n,e){return I(n,Be,e)}async function ke(n,e,t){if(n.toUpperCase()===R||B(n,e))return z(e);let i=await nt(n,t);return E(()=>i.rootToken(),"PROVIDER_ERROR")}var it="0x84a3291a0";function rt(n){let e={};return n.forEach(t=>{let{contractAddress:i,stateDiff:a}=t,{storageSlot:r,value:o}=a;e[i]===void 0&&(e[i]={stateDiff:{}}),e[i].stateDiff[r]=o;}),e}async function q(n,e,t){let i,a=xe(n),r=t?rt(t):void 0;try{i=await axios.post(a,{jsonrpc:"2.0",id:0,method:"tenderly_simulateBundle",params:[e,"latest",r]},{headers:{"Content-Type":"application/json"}});}catch(g){i=g.response;}if(i.data.error)throw new y(`Estimating gas failed with the reason: ${i.data.error.message}`,"TENDERLY_GAS_ESTIMATE_FAILED");let o=i.data.result;if(o.length!==e.length)throw new y("Estimating gas failed with mismatched responses","TENDERLY_GAS_ESTIMATE_FAILED");let s=[],d=!1,p=!1,u=!1,l=0,m=!1,f=e.find(g=>g.data?.startsWith(it))!==void 0;for(let g=0;g<o.length;g++){if(o[g].error)throw new y(`Estimating deposit gas failed with the reason: ${o[g].error.message}`,"TENDERLY_GAS_ESTIMATE_FAILED");if(o[g].gasUsed===void 0)throw new y("Estimating gas did not return simulation results","TENDERLY_GAS_ESTIMATE_FAILED");if(f&&o[g].logs!==void 0){let c=o[g].logs.find(A=>A.name==="QueuedWithdrawal");if(c!==void 0){let A=new Map(c.inputs.map(x=>[x.name,x.value]));d=A.get("delayWithdrawalLargeAmount")||!1,p=A.get("delayWithdrawalUnknownToken")||!1,u=A.get("withdrawalQueueActivated")||!1;}}if(f&&o[g].trace!==void 0){let c=o[g].trace.find(A=>A.method==="largeTransferThresholds");c!==void 0&&(l=c.output,m=!0);}m||s.push(o[g].gasUsed);}return {gas:s,delayWithdrawalLargeAmount:d,delayWithdrawalUnknownToken:p,withdrawalQueueActivated:u,largeTransferThresholds:l}}var Le="0x0000000000000000000000000000000000000000000000000000000000000001";async function Ge(n,e,t,i,a,r){let o,s;if(i.toUpperCase()===R)n===e?(o=a.native,s=[t]):(o=a.nativeTo,s=[e,t]);else {let d=getAddress(i);n===e?(o=a.token,s=[d,t]):(o=a.tokenTo,s=[d,e,t]);}return await E(async()=>r.interface.encodeFunctionData(o,s),"INTERNAL_ERROR")}var M=[{inputs:[{internalType:"address",name:"_initializerAddress",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AlreadyMapped",type:"error"},{inputs:[{internalType:"uint256",name:"actualBalance",type:"uint256"},{internalType:"uint256",name:"expectedBalance",type:"uint256"}],name:"BalanceInvariantCheckFailed",type:"error"},{inputs:[],name:"CantMapETH",type:"error"},{inputs:[],name:"CantMapIMX",type:"error"},{inputs:[],name:"CantMapWETH",type:"error"},{inputs:[],name:"ImxDepositLimitExceeded",type:"error"},{inputs:[],name:"ImxDepositLimitTooLow",type:"error"},{inputs:[{internalType:"uint256",name:"lengthOfQueue",type:"uint256"},{internalType:"uint256",name:"requestedIndex",type:"uint256"}],name:"IndexOutsideWithdrawalQueue",type:"error"},{inputs:[],name:"InsufficientValue",type:"error"},{inputs:[],name:"InvalidCapacity",type:"error"},{inputs:[],name:"InvalidChildChain",type:"error"},{inputs:[{internalType:"string",name:"reason",type:"string"}],name:"InvalidData",type:"error"},{inputs:[],name:"InvalidRefillRate",type:"error"},{inputs:[],name:"InvalidToken",type:"error"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"actualToken",type:"address"}],name:"MixedTokens",type:"error"},{inputs:[],name:"NoGas",type:"error"},{inputs:[],name:"NonWrappedNativeTransfer",type:"error"},{inputs:[],name:"NotBridgeAdaptor",type:"error"},{inputs:[],name:"NotMapped",type:"error"},{inputs:[],name:"ProvideAtLeastOneIndex",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"TokenIsZero",type:"error"},{inputs:[],name:"TokenNotSupported",type:"error"},{inputs:[],name:"UnauthorizedInitializer",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"WithdrawalAlreadyProcessed",type:"error"},{inputs:[{internalType:"uint256",name:"timeNow",type:"uint256"},{internalType:"uint256",name:"currentWithdrawalTime",type:"uint256"}],name:"WithdrawalRequestTooEarly",type:"error"},{inputs:[],name:"WrongInitializer",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{inputs:[],name:"ZeroAmount",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"who",type:"address"}],name:"ActivatedWithdrawalQueue",type:"event"},{anonymous:!1,inputs:[],name:"AutoActivatedWithdrawalQueue",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"rootToken",type:"address"},{indexed:!0,internalType:"address",name:"childToken",type:"address"},{indexed:!1,internalType:"address",name:"depositor",type:"address"},{indexed:!0,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"ChildChainERC20Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"who",type:"address"}],name:"DeactivatedWithdrawalQueue",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"withdrawer",type:"address"},{indexed:!0,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"timestamp",type:"uint256"},{indexed:!1,internalType:"uint256",name:"index",type:"uint256"}],name:"EnQueuedWithdrawal",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"rootToken",type:"address"},{indexed:!1,internalType:"address",name:"depositor",type:"address"},{indexed:!0,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"IMXDeposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint8",name:"version",type:"uint8"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"rootToken",type:"address"},{indexed:!0,internalType:"address",name:"childToken",type:"address"}],name:"L1TokenMapped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"rootToken",type:"address"},{indexed:!0,internalType:"address",name:"childToken",type:"address"},{indexed:!1,internalType:"address",name:"depositor",type:"address"},{indexed:!0,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"NativeEthDeposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"oldImxDepositLimit",type:"uint256"},{indexed:!1,internalType:"uint256",name:"newImxDepositLimit",type:"uint256"}],name:"NewImxDepositLimit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"withdrawer",type:"address"},{indexed:!0,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"timestamp",type:"uint256"},{indexed:!1,internalType:"uint256",name:"index",type:"uint256"}],name:"ProcessedWithdrawal",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"withdrawer",type:"address"},{indexed:!0,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"bool",name:"delayWithdrawalLargeAmount",type:"bool"},{indexed:!1,internalType:"bool",name:"delayWithdrawalUnknownToken",type:"bool"},{indexed:!1,internalType:"bool",name:"withdrawalQueueActivated",type:"bool"}],name:"QueuedWithdrawal",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!1,internalType:"uint256",name:"capacity",type:"uint256"},{indexed:!1,internalType:"uint256",name:"refillRate",type:"uint256"},{indexed:!1,internalType:"uint256",name:"largeTransferThreshold",type:"uint256"},{indexed:!1,internalType:"uint256",name:"previousCapacity",type:"uint256"},{indexed:!1,internalType:"uint256",name:"previousRefillRate",type:"uint256"},{indexed:!1,internalType:"uint256",name:"previousLargeTransferThreshold",type:"uint256"}],name:"RateControlThresholdSet",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"previousAdminRole",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"newAdminRole",type:"bytes32"}],name:"RoleAdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleGranted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleRevoked",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"oldRootBridgeAdaptor",type:"address"},{indexed:!1,internalType:"address",name:"newRootBridgeAdaptor",type:"address"}],name:"RootBridgeAdaptorUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"rootToken",type:"address"},{indexed:!0,internalType:"address",name:"childToken",type:"address"},{indexed:!1,internalType:"address",name:"withdrawer",type:"address"},{indexed:!0,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"RootChainERC20Withdraw",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"rootToken",type:"address"},{indexed:!0,internalType:"address",name:"childToken",type:"address"},{indexed:!1,internalType:"address",name:"withdrawer",type:"address"},{indexed:!0,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"RootChainETHWithdraw",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"rootToken",type:"address"},{indexed:!0,internalType:"address",name:"childToken",type:"address"},{indexed:!1,internalType:"address",name:"depositor",type:"address"},{indexed:!0,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"WETHDeposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"delay",type:"uint256"},{indexed:!1,internalType:"uint256",name:"previousDelay",type:"uint256"}],name:"WithdrawalDelayUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"WithdrawalForNonFlowRatedToken",type:"event"},{inputs:[],name:"ADAPTOR_MANAGER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"DEFAULT_ADMIN_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"DEPOSIT_SIG",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"MAP_TOKEN_SIG",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"NATIVE_ETH",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"NATIVE_IMX",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"PAUSER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"UNLIMITED_DEPOSIT",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"UNPAUSER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"VARIABLE_MANAGER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"WITHDRAW_SIG",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"activateWithdrawalQueue",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"childERC20Bridge",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"childETHToken",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"childTokenTemplate",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"deactivateWithdrawalQueue",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20Metadata",name:"rootToken",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"depositETH",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"contract IERC20Metadata",name:"rootToken",type:"address"},{internalType:"address",name:"receiver",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"depositTo",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"receiver",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"depositToETH",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"receiver",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"finaliseQueuedWithdrawal",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"receiver",type:"address"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256[]",name:"indices",type:"uint256[]"}],name:"finaliseQueuedWithdrawalsAggregated",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"receiver",type:"address"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"startIndex",type:"uint256"},{internalType:"uint256",name:"stopIndex",type:"uint256"},{internalType:"uint256",name:"maxFind",type:"uint256"}],name:"findPendingWithdrawals",outputs:[{components:[{internalType:"uint256",name:"index",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"timestamp",type:"uint256"}],internalType:"struct FlowRateWithdrawalQueue.FindPendingWithdrawal[]",name:"found",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"flowRateBuckets",outputs:[{internalType:"uint256",name:"capacity",type:"uint256"},{internalType:"uint256",name:"depth",type:"uint256"},{internalType:"uint256",name:"refillTime",type:"uint256"},{internalType:"uint256",name:"refillRate",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receiver",type:"address"},{internalType:"uint256[]",name:"indices",type:"uint256[]"}],name:"getPendingWithdrawals",outputs:[{components:[{internalType:"address",name:"withdrawer",type:"address"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"timestamp",type:"uint256"}],internalType:"struct FlowRateWithdrawalQueue.PendingWithdrawal[]",name:"pending",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"getPendingWithdrawalsLength",outputs:[{internalType:"uint256",name:"length",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"}],name:"getRoleAdmin",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"grantAdaptorManagerRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"grantPauserRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"grantRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"grantUnpauserRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"grantVariableManagerRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"hasRole",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"imxCumulativeDepositLimit",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"defaultAdmin",type:"address"},{internalType:"address",name:"pauser",type:"address"},{internalType:"address",name:"unpauser",type:"address"},{internalType:"address",name:"variableManager",type:"address"},{internalType:"address",name:"adaptorManager",type:"address"}],internalType:"struct IRootERC20Bridge.InitializationRoles",name:"newRoles",type:"tuple"},{internalType:"address",name:"newRootBridgeAdaptor",type:"address"},{internalType:"address",name:"newChildERC20Bridge",type:"address"},{internalType:"address",name:"newChildTokenTemplate",type:"address"},{internalType:"address",name:"newRootIMXToken",type:"address"},{internalType:"address",name:"newRootWETHToken",type:"address"},{internalType:"uint256",name:"newImxCumulativeDepositLimit",type:"uint256"},{internalType:"address",name:"rateAdmin",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"defaultAdmin",type:"address"},{internalType:"address",name:"pauser",type:"address"},{internalType:"address",name:"unpauser",type:"address"},{internalType:"address",name:"variableManager",type:"address"},{internalType:"address",name:"adaptorManager",type:"address"}],internalType:"struct IRootERC20Bridge.InitializationRoles",name:"",type:"tuple"},{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"initialize",outputs:[],stateMutability:"pure",type:"function"},{inputs:[],name:"initializerAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"largeTransferThresholds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IERC20Metadata",name:"rootToken",type:"address"}],name:"mapToken",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes",name:"data",type:"bytes"}],name:"onMessageReceive",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"renounceRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"revokeAdaptorManagerRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"revokePauserRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"revokeRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"revokeUnpauserRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"revokeVariableManagerRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"rootBridgeAdaptor",outputs:[{internalType:"contract IRootBridgeAdaptor",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"rootIMXToken",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"rootTokenToChildToken",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"rootWETHToken",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"capacity",type:"uint256"},{internalType:"uint256",name:"refillRate",type:"uint256"},{internalType:"uint256",name:"largeTransferThreshold",type:"uint256"}],name:"setRateControlThreshold",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"delay",type:"uint256"}],name:"setWithdrawalDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newImxCumulativeDepositLimit",type:"uint256"}],name:"updateImxCumulativeDepositLimit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newRootBridgeAdaptor",type:"address"}],name:"updateRootBridgeAdaptor",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"withdrawalDelay",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"withdrawalQueueActivated",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}];var k=[{inputs:[{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}];var J=[{inputs:[{internalType:"address",name:"_initializerAddress",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AlreadyMapped",type:"error"},{inputs:[{internalType:"uint256",name:"actualBalance",type:"uint256"},{internalType:"uint256",name:"expectedBalance",type:"uint256"}],name:"BalanceInvariantCheckFailed",type:"error"},{inputs:[],name:"BridgeNotSet",type:"error"},{inputs:[],name:"BurnFailed",type:"error"},{inputs:[],name:"CantMapETH",type:"error"},{inputs:[],name:"CantMapIMX",type:"error"},{inputs:[],name:"EmptyTokenContract",type:"error"},{inputs:[],name:"IncorrectBridgeAddress",type:"error"},{inputs:[],name:"InsufficientIMX",type:"error"},{inputs:[],name:"InsufficientValue",type:"error"},{inputs:[{internalType:"string",name:"reason",type:"string"}],name:"InvalidData",type:"error"},{inputs:[],name:"MintFailed",type:"error"},{inputs:[],name:"NoGas",type:"error"},{inputs:[],name:"NonWrappedNativeTransfer",type:"error"},{inputs:[],name:"NotBridgeAdaptor",type:"error"},{inputs:[],name:"NotMapped",type:"error"},{inputs:[],name:"TransferWIMXFailed",type:"error"},{inputs:[],name:"UnauthorizedInitializer",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{inputs:[],name:"ZeroAddressRootToken",type:"error"},{inputs:[],name:"ZeroAmount",type:"error"},{inputs:[],name:"ZeroValue",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"oldChildBridgeAdaptor",type:"address"},{indexed:!1,internalType:"address",name:"newChildBridgeAdaptor",type:"address"}],name:"ChildBridgeAdaptorUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"rootToken",type:"address"},{indexed:!0,internalType:"address",name:"childToken",type:"address"},{indexed:!1,internalType:"address",name:"depositor",type:"address"},{indexed:!0,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"ChildChainERC20Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"rootToken",type:"address"},{indexed:!0,internalType:"address",name:"childToken",type:"address"},{indexed:!1,internalType:"address",name:"depositor",type:"address"},{indexed:!0,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"ChildChainERC20Withdraw",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"depositor",type:"address"},{indexed:!0,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"ChildChainEthWithdraw",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"rootToken",type:"address"},{indexed:!0,internalType:"address",name:"depositor",type:"address"},{indexed:!0,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"ChildChainNativeIMXWithdraw",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"rootToken",type:"address"},{indexed:!0,internalType:"address",name:"depositor",type:"address"},{indexed:!0,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"ChildChainWrappedIMXWithdraw",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"rootToken",type:"address"},{indexed:!0,internalType:"address",name:"depositor",type:"address"},{indexed:!0,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"IMXDeposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint8",name:"version",type:"uint8"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"rootToken",type:"address"},{indexed:!1,internalType:"address",name:"childToken",type:"address"}],name:"L2TokenMapped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"rootToken",type:"address"},{indexed:!0,internalType:"address",name:"childToken",type:"address"},{indexed:!1,internalType:"address",name:"depositor",type:"address"},{indexed:!0,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"NativeEthDeposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"depositor",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"PrivilegedDeposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"previousAdminRole",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"newAdminRole",type:"bytes32"}],name:"RoleAdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleGranted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleRevoked",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[],name:"ADAPTOR_MANAGER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"DEFAULT_ADMIN_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"DEPOSIT_SIG",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"MAP_TOKEN_SIG",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"NATIVE_ETH",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"NATIVE_IMX",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"PAUSER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"PRIVILEGED_DEPOSITOR_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"UNPAUSER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"WITHDRAW_SIG",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"childBridgeAdaptor",outputs:[{internalType:"contract IChildBridgeAdaptor",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"childETHToken",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"childTokenTemplate",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"}],name:"getRoleAdmin",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"grantAdaptorManagerRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"grantPauserRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"grantRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"grantUnpauserRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"hasRole",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"defaultAdmin",type:"address"},{internalType:"address",name:"pauser",type:"address"},{internalType:"address",name:"unpauser",type:"address"},{internalType:"address",name:"adaptorManager",type:"address"},{internalType:"address",name:"initialDepositor",type:"address"},{internalType:"address",name:"treasuryManager",type:"address"}],internalType:"struct IChildERC20Bridge.InitializationRoles",name:"newRoles",type:"tuple"},{internalType:"address",name:"newBridgeAdaptor",type:"address"},{internalType:"address",name:"newChildTokenTemplate",type:"address"},{internalType:"address",name:"newRootIMXToken",type:"address"},{internalType:"address",name:"newWIMXToken",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"initializerAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"data",type:"bytes"}],name:"onMessageReceive",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"privilegedDeposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"renounceRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"revokeAdaptorManagerRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"revokePauserRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"revokeRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"revokeUnpauserRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"rootIMXToken",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"rootTokenToChildToken",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newBridgeAdaptor",type:"address"}],name:"updateChildBridgeAdaptor",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"wIMXToken",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IChildERC20",name:"childToken",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawETH",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"receiver",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawETHTo",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawIMX",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"receiver",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawIMXTo",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"contract IChildERC20",name:"childToken",type:"address"},{internalType:"address",name:"receiver",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawTo",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawWIMX",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"receiver",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdrawWIMXTo",outputs:[],stateMutability:"payable",type:"function"},{stateMutability:"payable",type:"receive"}];var ee=(c=>(c.SRC_GATEWAY_CALLED="source_gateway_called",c.DEST_GATEWAY_APPROVED="destination_gateway_approved",c.DEST_EXECUTED="destination_executed",c.EXPRESS_EXECUTED="express_executed",c.DEST_EXECUTE_ERROR="error",c.DEST_EXECUTING="executing",c.APPROVING="approving",c.FORECALLED="forecalled",c.FORECALLED_WITHOUT_GAS_PAID="forecalled_without_gas_paid",c.NOT_EXECUTED="not_executed",c.NOT_EXECUTED_WITHOUT_GAS_PAID="not_executed_without_gas_paid",c.INSUFFICIENT_FEE="insufficient_fee",c.UNKNOWN_ERROR="unknown_error",c.CANNOT_FETCH_STATUS="cannot_fetch_status",c.SRC_GATEWAY_CONFIRMED="confirmed",c))(ee||{}),Ue=(a=>(a.GAS_UNPAID="gas_unpaid",a.GAS_PAID="gas_paid",a.GAS_PAID_NOT_ENOUGH_GAS="gas_paid_not_enough_gas",a.GAS_PAID_ENOUGH_GAS="gas_paid_enough_gas",a))(Ue||{});var ot=n=>{let{error:e,status:t}=n;return t==="error"&&e?"error":t==="executed"?"destination_executed":t==="approved"?"destination_gateway_approved":t==="called"?"source_gateway_called":t==="executing"?"executing":t},dt=n=>{if(n.error)return {message:n.error.error.message,txHash:n.error.error.transactionHash,chain:n.error.chain};if(n.is_insufficient_fee)return {message:"Insufficient fee",txHash:n.call.transaction.hash,chain:n.call.chain}},pt=async(n,e)=>fetch(`${n}?${new URLSearchParams(e).toString()}`,{method:"GET",headers:{"Content-Type":"application/json"},cache:"no-store"}).then(t=>t.json()).then(t=>t.data),ut=async(n,e,t)=>pt(n,{method:"searchGMP",txHash:e,txLogIndex:t}).then(i=>i.find(a=>a.id.indexOf(e)>-1||a.call.transactionHash.indexOf(e)>-1)).catch(()=>{}),He=async(n,e,t)=>{let i=await ut(n,e,t);if(!i)return {status:"cannot_fetch_status"};let{call:a,gas_status:r,gas_paid:o,executed:s,express_executed:d,approved:p,callback:u}=i,l={status:r,details:o},m=i.time_spent;return m&&(m.total=m.total||Object.values(m).reduce((f,g)=>f+g,0)),{status:ot(i),error:dt(i),timeSpent:m,gasPaidInfo:l,callTx:a,executed:s,expressExecuted:d,approved:p,callback:u}};var Xe=class{config;initialised;constructor(e){this.config=e,this.initialised=!1;}async initialise(){this.initialised||(await Me(this.config),this.initialised=!0);}async getFee(e){let[,,t]=await Promise.all([this.initialise(),async()=>{e.action!=="FINALISE_WITHDRAWAL"&&await j(e.sourceChainId,e.destinationChainId,this.config);},this.getFeePrivate(e)]);return t}async getFinaliseWithdrawFee(){let e=await this.config.rootProvider.getFeeData();return w(e,2e5)}async getDepositOrWithdrawFee(e){let t;e.sourceChainId===this.config.bridgeInstance.rootChainID?t=await this.config.rootProvider.getFeeData():t=await this.config.childProvider.getFeeData();let i=BigInt(0),a=BigInt(0),r=BigInt(0),o;if(e.action==="DEPOSIT")o={sourceChainId:e.sourceChainId,destinationChainId:e.destinationChainId,action:"DEPOSIT"};else if(e.action==="WITHDRAW")o={sourceChainId:e.sourceChainId,destinationChainId:e.destinationChainId,action:"WITHDRAW"};else throw new y("Invalid action","INTERNAL_ERROR");if(!(v(o,this.config.bridgeInstance)||D(o,this.config.bridgeInstance)))throw new y("Invalid direction","INTERNAL_ERROR");_e(e)||(v(o,this.config.bridgeInstance)?a=w(t,55e3):"token"in e&&De(e.token,o,this.config.bridgeInstance)&&(a=w(t,55e3)));let s;return e.action==="DEPOSIT"?(i=w(t,15e4),s=25e4):(i=w(t,25e4),s=25e4),r=await this.getAxelarFee(e.sourceChainId,e.destinationChainId,s,e.gasMultiplier),{sourceChainFee:i,approvalFee:a,bridgeFee:r}}async getFeePrivate(e){Pe(e,this.config);let t=BigInt(0),i=BigInt(0),a=BigInt(0);if(e.action==="FINALISE_WITHDRAWAL")t=await this.getFinaliseWithdrawFee();else {let s=await this.getDepositOrWithdrawFee(e);t=s.sourceChainFee,i=s.approvalFee,a=s.bridgeFee;}let r=t+i+a,o=BigInt("0");return {sourceChainGas:t,approvalFee:i,bridgeFee:a,imtblFee:o,totalFees:r}}async getUnsignedApproveBridgeTx(e){let t=await this.getUnsignedBridgeBundledTx({senderAddress:e.senderAddress,recipientAddress:e.senderAddress,token:e.token,amount:e.amount,sourceChainId:e.sourceChainId,destinationChainId:e.destinationChainId,gasMultiplier:1.1});return {contractToApprove:t.contractToApprove,unsignedTx:t.unsignedApprovalTx}}async getBridgeMethods(e){let t;return v(e,this.config.bridgeInstance)?t=Q.deposit:t=Q.withdraw,t}async getBridgeContract(e){if(v(e,this.config.bridgeInstance)){let i=this.config.bridgeContracts.rootERC20BridgeFlowRate;return await I(i,M,this.config.rootProvider)}let t=this.config.bridgeContracts.childERC20Bridge;return await I(t,J,this.config.childProvider)}async getConfigAndBridgeTxCalldata(e,t,i,a,r){let o=await this.getBridgeMethods(r),s=await this.getBridgeContract(r);return Ge(e,t,i,a,o,s)}async getUnsignedBridgeTx(e){let t=await this.getUnsignedBridgeBundledTx({senderAddress:e.senderAddress,recipientAddress:e.senderAddress,token:e.token,amount:e.amount,sourceChainId:e.sourceChainId,destinationChainId:e.destinationChainId,gasMultiplier:e.gasMultiplier});return {feeData:t.feeData,unsignedTx:t.unsignedBridgeTx}}async getUnsignedBridgeBundledTx(e){let[,,,t]=await Promise.all([this.initialise(),Oe(e,this.config),Ne(e.token,e.destinationChainId,e.recipientAddress,this.config),this.getUnsignedBridgeBundledTxPrivate(e)]);return t}async getUnsignedBridgeBundledTxPrivate(e){let t;if(Ce(e.sourceChainId,this.config.bridgeInstance)?t={sourceChainId:e.sourceChainId,destinationChainId:e.destinationChainId,action:"DEPOSIT"}:t={sourceChainId:e.sourceChainId,destinationChainId:e.destinationChainId,action:"WITHDRAW"},v(t,this.config.bridgeInstance))return this.getUnsignedBridgeDepositBundledTxPrivate(t,e.senderAddress,e.recipientAddress,e.token,e.amount,e.gasMultiplier);if(D(t,this.config.bridgeInstance))return this.getUnsignedBridgeWithdrawBundledTxPrivate(t,e.senderAddress,e.recipientAddress,e.token,e.amount,e.gasMultiplier);throw new y("Invalid Bridge Bundled TX","INVALID_TRANSACTION")}async getUnsignedBridgeDepositBundledTxPrivate(e,t,i,a,r,o){let[s,d,p,u]=await Promise.all([this.getAllowance(e,a,t),this.config.rootProvider.getFeeData(),this.getDynamicDepositGas(this.config.bridgeInstance.rootChainID,t,i,a,r),this.getAxelarFee(this.config.bridgeInstance.rootChainID,this.config.bridgeInstance.childChainID,25e4,o)]),l,m,f=BigInt(0),g=BigInt(0),c=u,A=BigInt(0);if(a.toUpperCase()!==R&&s<r){l=a.startsWith("0x")?a:`0x${a}`;let F=await I(l,k,this.config.rootProvider);m={data:await E(async()=>F.interface.encodeFunctionData("approve",[this.config.bridgeContracts.rootERC20BridgeFlowRate,r]),"INTERNAL_ERROR"),to:l,value:0,from:t,chainId:parseInt(this.config.bridgeInstance.rootChainID,10)},g=w(d,p.approvalGas);}else l=null,m=null;let x=await this.getConfigAndBridgeTxCalldata(t,i,r,a,e),S=a.toUpperCase()===R?(r+c).toString():c.toString(),N={data:x,to:this.config.bridgeContracts.rootERC20BridgeFlowRate,value:S,from:t,chainId:parseInt(this.config.bridgeInstance.rootChainID,10)};f=w(d,p.sourceChainGas);let T=f+g+c+A;return {feeData:{sourceChainGas:f,approvalFee:g,bridgeFee:c,imtblFee:A,totalFees:T},contractToApprove:l,unsignedApprovalTx:m,unsignedBridgeTx:N,delayWithdrawalLargeAmount:null,delayWithdrawalUnknownToken:null,withdrawalQueueActivated:null,largeTransferThresholds:null}}async getUnsignedBridgeWithdrawBundledTxPrivate(e,t,i,a,r,o){let[s,d,p]=await Promise.all([this.getAllowance(e,a,t),this.config.childProvider.getFeeData(),await this.getDynamicWithdrawGasRootChain(e.destinationChainId,t,i,a,r)]),u=p.gas[0],l=await this.getAxelarFee(this.config.bridgeInstance.childChainID,this.config.bridgeInstance.rootChainID,u,o),m,f,g=BigInt(0),c=BigInt(0),A=l,x=BigInt(0);if(B(a,this.config.bridgeInstance.childChainID)&&s<r){m=a;let L=await I(a,k,this.config.childProvider);f={data:await E(async()=>L.interface.encodeFunctionData("approve",[this.config.bridgeContracts.childERC20Bridge,r]),"INTERNAL_ERROR"),to:a,value:0,from:t,chainId:parseInt(this.config.bridgeInstance.childChainID,10)},c=w(d,55e3);}else m=null,f=null;let S=await this.getConfigAndBridgeTxCalldata(t,i,r,a,e),N=a.toUpperCase()===R?(r+A).toString():A.toString(),T={data:S,to:this.config.bridgeContracts.rootERC20BridgeFlowRate,value:N,from:t,chainId:parseInt(this.config.bridgeInstance.rootChainID,10)};g=w(d,25e4);let F=g+c+A+x;return {feeData:{sourceChainGas:g,approvalFee:c,bridgeFee:A,imtblFee:x,totalFees:F},contractToApprove:m,unsignedApprovalTx:f,unsignedBridgeTx:T,delayWithdrawalLargeAmount:p.delayWithdrawalLargeAmount,delayWithdrawalUnknownToken:p.delayWithdrawalUnknownToken,withdrawalQueueActivated:p.withdrawalQueueActivated,largeTransferThresholds:p.largeTransferThresholds}}async getDynamicDepositGas(e,t,i,a,r){let o=[];if(a.toUpperCase()!==R){let m=await I(a,k,this.config.rootProvider),f=await E(async()=>m.interface.encodeFunctionData("approve",[this.config.bridgeContracts.rootERC20BridgeFlowRate,r]),"INTERNAL_ERROR");o.push({from:t,to:a,data:f});}let s={action:"DEPOSIT",sourceChainId:e,destinationChainId:this.config.bridgeInstance.childChainID},d=await this.getConfigAndBridgeTxCalldata(t,i,r,a,s),p=a.toUpperCase()!==R?"0x1":toQuantity(toBeHex(r+BigInt(1)));o.push({from:t,to:this.config.bridgeContracts.rootERC20BridgeFlowRate,data:d,value:p});let{gas:u}=await q(e,o),l={};return u.length===1?(l.approvalGas=0,[l.sourceChainGas]=u):[l.approvalGas,l.sourceChainGas]=u,l}async getDynamicWithdrawGasRootChain(e,t,i,a,r){let o=await ke(a,e,this.config.childProvider),s=We(o,t,i,r.toString()),d=Fe(s),p=Ee(e),u=getAddress(Ie(e)).toString(),l=Ae(e),m=keccak256(s),f=AbiCoder.defaultAbiCoder().encode(["bytes32","bytes32","string","string","address","bytes32"],[de,d,p,u,l,m]),g=keccak256(f),c=keccak256(concat([g,pe])),A=await I(l,ae,this.config.rootProvider),x=await E(async()=>A.interface.encodeFunctionData("execute",[d,p,u,s]),"INTERNAL_ERROR"),S=we(e),N=[{from:t,to:l,data:x}],T=this.config.bridgeContracts.rootERC20BridgeFlowRate,F=await I(T,M,this.config.rootProvider),L=await E(async()=>F.interface.encodeFunctionData("largeTransferThresholds",[o]),"INTERNAL_ERROR");return N.push({from:t,to:T,data:L}),await q(e,N,[{contractAddress:S,stateDiff:{storageSlot:c,value:Le}}])}async getAllowance(e,t,i){if(t.toUpperCase()===R||ve(t,e,this.config.bridgeInstance))return BigInt(0);let a,r;v(e,this.config.bridgeInstance)?(a=this.config.rootProvider,r=this.config.bridgeContracts.rootERC20BridgeFlowRate):(a=this.config.childProvider,r=this.config.bridgeContracts.childERC20Bridge);let o=await I(t,k,a);return await E(()=>o.allowance(i,r),"PROVIDER_ERROR")}async getAxelarFee(e,t,i,a="auto"){let r=K[e],o=K[t];if(!r)throw new y(`Source chainID ${e} can not be matched to an Axelar chain.`,"AXELAR_CHAIN_NOT_FOUND");if(!o)throw new y(`Destination chainID ${t} can not be matched to an Axelar chain.`,"AXELAR_CHAIN_NOT_FOUND");let s=Z(e),d={method:"estimateGasFee",sourceChain:r.id,destinationChain:o.id,symbol:r.symbol,gasLimit:i,gasMultiplier:a,minGasPrice:1e9},p;try{p=await axios.post(s,d);}catch(u){p=u.response;}if(p.data.error)throw new y(`Estimating Axelar Gas failed with the reason: ${p.data.message}`,"AXELAR_GAS_ESTIMATE_FAILED");try{return BigInt(`${p.data}`)}catch(u){throw new y(`Estimating Axelar Gas failed with the reason: ${u}`,"AXELAR_GAS_ESTIMATE_FAILED")}}async getTransactionStatus(e){let t={transactions:[]},i=await this.getAxelarStatus(e.transactions,e.sourceChainId),a=await this.getUniqueReceivers(i,e.sourceChainId),r=[];for(let s of a)r.push(this.getPendingWithdrawals({recipient:s}));let o=[];try{o=await Promise.all(r);}catch(s){throw new y(`Failed to fetch the pending withdrawals with: ${s}`,"FLOW_RATE_ERROR")}t.transactions=i;for(let s of t.transactions)s.status==="COMPLETE"&&(()=>{for(let d of o){let p=d.pending.findIndex(u=>u.amount.toString()===s.amount.toString()&&u.token===s.token&&u.withdrawer===s.sender&&u.recipient===s.recipient);if(p!==-1){s.status="FLOW_RATE_CONTROLLED",s.data={canWithdraw:d.pending[p].canWithdraw,timeoutStart:d.pending[p].timeoutStart,timeoutEnd:d.pending[p].timeoutEnd},d.pending.splice(p,1);return}}})();return t}async getUniqueReceivers(e,t){let i=[],a=[H,V,X].includes(t);for(let r=0,o=e.length;r<o;r++)e[r].status==="COMPLETE"&&a&&e[r].recipient&&i.findIndex(d=>d===e[r].recipient)===-1&&i.push(e[r].recipient);return i}async getAxelarStatus(e,t){let i=[],a=[],r=Z(t),o=["gas_unpaid","gas_paid_not_enough_gas"],s=new AbiCoder;for(let p of e)a.push(He(r,p.txHash));let d;try{d=await Promise.all(a);}catch(p){throw new y(`Failed to fetch the Axelar Status with the reason: ${p}`,"AXELAR_GAS_ESTIMATE_FAILED")}for(let p=0,u=d.length;p<u;p++){let l;switch(d[p].status){case"cannot_fetch_status":l="PENDING";break;case"source_gateway_called":case"destination_gateway_approved":case"executing":case"confirmed":case"approving":l="PROCESSING";break;case"not_executed":l="RETRY";break;case"not_executed_without_gas_paid":case"insufficient_fee":l="NOT_ENOUGH_GAS";break;case"destination_executed":l="COMPLETE";break;default:l="ERROR";}d[p].gasPaidInfo&&o.includes(d[p].gasPaidInfo.status)&&(l="NOT_ENOUGH_GAS");let m={txHash:e[p].txHash,status:l,data:{gmpResponse:d[p].status}},f;d[p]?.callTx?.returnValues?.payload&&(f=s.decode(["bytes32","address","address","address","uint256"],d[p].callTx.returnValues.payload),m={...m,token:f[1],sender:f[2],recipient:f[3],amount:f[4]}),i.push(m);}return i}async getFlowRateInfo(e){if(!e.tokens||e.tokens.length===0)throw new y(`invalid tokens array ${e.tokens}`,"INVALID_TOKEN");let t=this.config.bridgeContracts.rootERC20BridgeFlowRate,i=await I(t,M,this.config.rootProvider),a=[];a.push(i.withdrawalQueueActivated()),a.push(i.withdrawalDelay());for(let p of e.tokens)p.toUpperCase()===R&&(p=se),a.push(i.flowRateBuckets(p)),a.push(i.largeTransferThresholds(p));let r;try{r=await Promise.all(a);}catch{throw new y("unable to query contract for flowrate info","INTERNAL_ERROR")}let o={},s=r[0],d=Number(r[1]);r.splice(0,2);for(let p=0,u=e.tokens.length;p<u;p++){let l=p*2;o[e.tokens[p]]={capacity:r[l].capacity,depth:r[l].depth,refillTime:Number(r[l].refillTime),refillRate:r[l].refillRate,largeTransferThreshold:r[l+1]};}return {withdrawalQueueActivated:s,withdrawalDelay:d,tokens:o}}async getPendingWithdrawals(e){if(!e.recipient)throw new y(`invalid recipient ${e.recipient}`,"INVALID_RECIPIENT");let t=this.config.bridgeContracts.rootERC20BridgeFlowRate,i=await I(t,M,this.config.rootProvider),a=await i.getPendingWithdrawalsLength(e.recipient),r={pending:[]};if(Number(a)===0)return r;let o=[];for(let u=0;u<Number(a);u++)o.push(u);let s=await i.getPendingWithdrawals(e.recipient,o),d=Math.floor(Date.now()/1e3),p=await i.withdrawalDelay();for(let u=0,l=s.length;u<l;u++){let m=Number(s[u].timestamp+p);m>d?r.pending[u]={canWithdraw:!1}:r.pending[u]={canWithdraw:!0},r.pending[u].recipient=e.recipient,r.pending[u].withdrawer=s[u].withdrawer,r.pending[u].token=s[u].token,r.pending[u].amount=s[u].amount,r.pending[u].timeoutStart=Number(s[u].timestamp),r.pending[u].timeoutEnd=m;}return r}async getFlowRateWithdrawTx(e){if(!e.recipient)throw new y(`invalid recipient ${e.recipient}`,"INVALID_RECIPIENT");if(e.index<0)throw new y(`invalid index ${e.index}`,"INVALID_FLOWRATE_INDEX");let t=this.config.bridgeContracts.rootERC20BridgeFlowRate,i=await I(t,M,this.config.rootProvider),a=await i.getPendingWithdrawals(e.recipient,[e.index]);if(a[0].withdrawer===ZeroAddress||a[0].token===ZeroAddress||a[0].amount===BigInt(0)||a[0].timestamp===BigInt(0))throw new y(`pending withdrawal not found for ${e.recipient} at index ${e.index}`,"FLOW_RATE_ERROR");let r=await i.withdrawalDelay(),o=Number(a[0].timestamp+r),s=Math.floor(Date.now()/1e3);if(o>s)return {pendingWithdrawal:{canWithdraw:!1,withdrawer:a[0].withdrawer,recipient:e.recipient,token:a[0].token,amount:a[0].amount,timeoutStart:Number(a[0].timestamp),timeoutEnd:o},unsignedTx:null};let d=await E(async()=>i.interface.encodeFunctionData("finaliseQueuedWithdrawal",[e.recipient,e.index]),"INTERNAL_ERROR");return {pendingWithdrawal:{canWithdraw:!0,withdrawer:a[0].withdrawer,recipient:e.recipient,token:a[0].token,amount:a[0].amount,timeoutStart:Number(a[0].timestamp),timeoutEnd:o},unsignedTx:{data:d,to:this.config.bridgeContracts.rootERC20BridgeFlowRate,value:0,chainId:parseInt(this.config.bridgeInstance.rootChainID,10)}}}async getTokenMapping(e){if(e.rootToken.toUpperCase()===R||e.rootToken===this.config.bridgeContracts.rootChainWrappedETH){let r=this.config.bridgeContracts.childERC20Bridge,s=await(await I(r,J,this.config.childProvider)).childETHToken();return {rootToken:e.rootToken,childToken:s}}let t=this.config.bridgeContracts.rootERC20BridgeFlowRate,a=await(await I(t,M,this.config.rootProvider)).rootTokenToChildToken(e.rootToken);return a===ZeroAddress?{rootToken:e.rootToken,childToken:null}:a===e.rootToken?{rootToken:e.rootToken,childToken:R}:{rootToken:e.rootToken,childToken:a}}};var gt=[$,O],ft=[P],ht={[K$1.SANDBOX]:gt,[K$1.PRODUCTION]:ft},Ke=new Map().set($,{rootERC20BridgeFlowRate:"0x0",childERC20Bridge:"0x0",rootChainIMX:"0x0",rootChainWrappedETH:"0x0",childChainWrappedETH:"0x0",childChainWrappedIMX:"0x0"}).set(O,{rootERC20BridgeFlowRate:"0x0D3C59c779Fd552C27b23F723E80246c840100F5",childERC20Bridge:"0x0D3C59c779Fd552C27b23F723E80246c840100F5",rootChainIMX:"0xe2629e08f4125d14e446660028bD98ee60EE69F2",rootChainWrappedETH:"0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",childChainWrappedETH:"0xe9E96d1aad82562b7588F03f49aD34186f996478",childChainWrappedIMX:"0x1CcCa691501174B4A623CeDA58cC8f1a76dc3439"}).set(P,{rootERC20BridgeFlowRate:"0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6",childERC20Bridge:"0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6",rootChainIMX:"0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF",rootChainWrappedETH:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",childChainWrappedETH:"0x52a6c53869ce09a731cd772f245b97a4401d3348",childChainWrappedIMX:"0x3a0c2ba54d6cbd3121f01b96dfd20e99d1696c9d"}),Qe=class{baseConfig;bridgeInstance;bridgeContracts;rootProvider;childProvider;constructor({bridgeInstance:e,rootProvider:t,childProvider:i,baseConfig:a,overrides:r}){if(this.baseConfig=a,this.bridgeInstance=e,this.rootProvider=t,this.childProvider=i,r){this.bridgeContracts=r.bridgeContracts;return}if(!ht[a.environment].includes(e))throw new Error(`Bridge instance with rootchain ${e.rootChainID} and childchain ${e.childChainID} is not supported in environment ${a.environment}`);if(!Ke.has(e))throw new Error(`Bridge instance with rootchain ${e.rootChainID} and childchain ${e.childChainID} is not supported in environment ${a.environment}`);let s=Ke.get(e);if(!s)throw new Error(`Bridge instance with rootchain ${e.rootChainID} and childchain ${e.childChainID} is not supported in environment ${a.environment}`);this.bridgeContracts=s;}};
|
|
9
9
|
|
|
10
10
|
const networkName = {
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
11
|
+
[J$1.IMTBL_ZKEVM_DEVNET]: nt$1.IMTBL_ZKEVM_DEVNET,
|
|
12
|
+
[J$1.IMTBL_ZKEVM_MAINNET]: nt$1.IMTBL_ZKEVM_MAINNET,
|
|
13
|
+
[J$1.IMTBL_ZKEVM_TESTNET]: nt$1.IMTBL_ZKEVM_TESTNET,
|
|
14
|
+
[J$1.ETHEREUM]: nt$1.ETHEREUM,
|
|
15
|
+
[J$1.SEPOLIA]: nt$1.SEPOLIA,
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
async function connectToProvider(checkout, provider, changeAccount) {
|
|
@@ -138,9 +138,9 @@ const bridgeReducer = (state, action) => {
|
|
|
138
138
|
};
|
|
139
139
|
|
|
140
140
|
const sendBridgeTransactionSentEvent = (eventTarget, transactionHash) => {
|
|
141
|
-
const successEvent = new CustomEvent(
|
|
141
|
+
const successEvent = new CustomEvent(ro.IMTBL_BRIDGE_WIDGET_EVENT, {
|
|
142
142
|
detail: {
|
|
143
|
-
type:
|
|
143
|
+
type: lo.TRANSACTION_SENT,
|
|
144
144
|
data: {
|
|
145
145
|
transactionHash,
|
|
146
146
|
},
|
|
@@ -152,9 +152,9 @@ const sendBridgeTransactionSentEvent = (eventTarget, transactionHash) => {
|
|
|
152
152
|
eventTarget.dispatchEvent(successEvent);
|
|
153
153
|
};
|
|
154
154
|
const sendBridgeFailedEvent = (eventTarget, reason) => {
|
|
155
|
-
const failedEvent = new CustomEvent(
|
|
155
|
+
const failedEvent = new CustomEvent(ro.IMTBL_BRIDGE_WIDGET_EVENT, {
|
|
156
156
|
detail: {
|
|
157
|
-
type:
|
|
157
|
+
type: lo.FAILURE,
|
|
158
158
|
data: {
|
|
159
159
|
reason,
|
|
160
160
|
timestamp: new Date().getTime(),
|
|
@@ -167,9 +167,9 @@ const sendBridgeFailedEvent = (eventTarget, reason) => {
|
|
|
167
167
|
eventTarget.dispatchEvent(failedEvent);
|
|
168
168
|
};
|
|
169
169
|
function sendBridgeWidgetCloseEvent(eventTarget) {
|
|
170
|
-
const closeWidgetEvent = new CustomEvent(
|
|
170
|
+
const closeWidgetEvent = new CustomEvent(ro.IMTBL_BRIDGE_WIDGET_EVENT, {
|
|
171
171
|
detail: {
|
|
172
|
-
type:
|
|
172
|
+
type: lo.CLOSE_WIDGET,
|
|
173
173
|
data: {},
|
|
174
174
|
},
|
|
175
175
|
});
|
|
@@ -179,9 +179,9 @@ function sendBridgeWidgetCloseEvent(eventTarget) {
|
|
|
179
179
|
eventTarget.dispatchEvent(closeWidgetEvent);
|
|
180
180
|
}
|
|
181
181
|
const sendBridgeClaimWithdrawalSuccessEvent = (eventTarget, transactionHash) => {
|
|
182
|
-
const successEvent = new CustomEvent(
|
|
182
|
+
const successEvent = new CustomEvent(ro.IMTBL_BRIDGE_WIDGET_EVENT, {
|
|
183
183
|
detail: {
|
|
184
|
-
type:
|
|
184
|
+
type: lo.CLAIM_WITHDRAWAL_SUCCESS,
|
|
185
185
|
data: {
|
|
186
186
|
transactionHash,
|
|
187
187
|
},
|
|
@@ -193,9 +193,9 @@ const sendBridgeClaimWithdrawalSuccessEvent = (eventTarget, transactionHash) =>
|
|
|
193
193
|
eventTarget.dispatchEvent(successEvent);
|
|
194
194
|
};
|
|
195
195
|
const sendBridgeClaimWithdrawalFailedEvent = (eventTarget, transactionHash, reason) => {
|
|
196
|
-
const failedEvent = new CustomEvent(
|
|
196
|
+
const failedEvent = new CustomEvent(ro.IMTBL_BRIDGE_WIDGET_EVENT, {
|
|
197
197
|
detail: {
|
|
198
|
-
type:
|
|
198
|
+
type: lo.CLAIM_WITHDRAWAL_FAILURE,
|
|
199
199
|
data: {
|
|
200
200
|
transactionHash,
|
|
201
201
|
reason,
|
|
@@ -598,7 +598,7 @@ function Transactions({ defaultTokenImage, onBackButtonClick, themeOverrides, })
|
|
|
598
598
|
const rootChainId = checkout.config.l1ChainId;
|
|
599
599
|
try {
|
|
600
600
|
const tokens = (await checkout.getTokenAllowList({
|
|
601
|
-
type:
|
|
601
|
+
type: ie$1.BRIDGE,
|
|
602
602
|
chainId: rootChainId,
|
|
603
603
|
})).tokens ?? [];
|
|
604
604
|
return tokens.reduce((out, current) => {
|
|
@@ -710,7 +710,7 @@ function Transactions({ defaultTokenImage, onBackButtonClick, themeOverrides, })
|
|
|
710
710
|
});
|
|
711
711
|
try {
|
|
712
712
|
let changeAccount = false;
|
|
713
|
-
if (event.providerDetail.info.rdns ===
|
|
713
|
+
if (event.providerDetail.info.rdns === Gt.METAMASK) {
|
|
714
714
|
changeAccount = true;
|
|
715
715
|
}
|
|
716
716
|
const browserProvider = new D$1(event.provider);
|
|
@@ -948,7 +948,7 @@ function WalletNetworkButton({ testId, walletProvider, walletProviderDetail, wal
|
|
|
948
948
|
const [isWalletConnect, setIsWalletConnect] = reactExports.useState(false);
|
|
949
949
|
const { isWalletConnectEnabled, getWalletLogoUrl, getWalletName } = useWalletConnect();
|
|
950
950
|
const walletDisplayName = reactExports.useMemo(() => {
|
|
951
|
-
if (walletProviderDetail?.info.rdns ===
|
|
951
|
+
if (walletProviderDetail?.info.rdns === Gt.PASSPORT) {
|
|
952
952
|
return walletName;
|
|
953
953
|
}
|
|
954
954
|
if (isWalletConnectProvider(walletProvider)) {
|
|
@@ -1050,9 +1050,9 @@ function WalletAndNetworkSelector({ themeOverrides }) {
|
|
|
1050
1050
|
}, [toWalletBrowserProvider]);
|
|
1051
1051
|
const fromWalletSelectorOptions = reactExports.useMemo(() => providers, [providers]);
|
|
1052
1052
|
const toWalletSelectorOptions = reactExports.useMemo(() => (providers
|
|
1053
|
-
.filter((providerDetail) => (providerDetail.info.rdns !==
|
|
1054
|
-
|| (providerDetail.info.rdns ===
|
|
1055
|
-
&& fromWallet?.providerDetail?.info?.rdns !==
|
|
1053
|
+
.filter((providerDetail) => (providerDetail.info.rdns !== Gt.PASSPORT
|
|
1054
|
+
|| (providerDetail.info.rdns === Gt.PASSPORT
|
|
1055
|
+
&& fromWallet?.providerDetail?.info?.rdns !== Gt.PASSPORT)))), [providers, fromNetwork, fromWallet]);
|
|
1056
1056
|
reactExports.useEffect(() => {
|
|
1057
1057
|
if (!from || !to)
|
|
1058
1058
|
return;
|
|
@@ -1113,7 +1113,7 @@ function WalletAndNetworkSelector({ themeOverrides }) {
|
|
|
1113
1113
|
clearToWalletSelections();
|
|
1114
1114
|
setFromWallet(event);
|
|
1115
1115
|
let changeAccount = false;
|
|
1116
|
-
if (event.providerDetail.info.rdns ===
|
|
1116
|
+
if (event.providerDetail.info.rdns === Gt.METAMASK) {
|
|
1117
1117
|
changeAccount = true;
|
|
1118
1118
|
}
|
|
1119
1119
|
// Pass 'any' here so that if the user switches networks, they are still prompted to switch
|
|
@@ -1341,7 +1341,7 @@ function WalletAndNetworkSelector({ themeOverrides }) {
|
|
|
1341
1341
|
else {
|
|
1342
1342
|
setToNetworkDrawerOpen(false);
|
|
1343
1343
|
}
|
|
1344
|
-
}, 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 !==
|
|
1344
|
+
}, 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: {
|
|
1345
1345
|
flex: 1,
|
|
1346
1346
|
display: 'flex',
|
|
1347
1347
|
flexDirection: 'column',
|
|
@@ -1374,7 +1374,7 @@ function WalletNetworkSelectionView({ showBackButton, themeOverrides, }) {
|
|
|
1374
1374
|
},
|
|
1375
1375
|
});
|
|
1376
1376
|
}, testId: "move-transactions-button" })), showBack: showBackButton, onBackButtonClick: () => {
|
|
1377
|
-
orchestrationEvents.sendRequestGoBackEvent(eventTarget,
|
|
1377
|
+
orchestrationEvents.sendRequestGoBackEvent(eventTarget, ro.IMTBL_BRIDGE_WIDGET_EVENT, {});
|
|
1378
1378
|
} })), footer: jsx(FooterLogo, {}), children: jsx(WalletAndNetworkSelector, { themeOverrides: themeOverrides }) }));
|
|
1379
1379
|
}
|
|
1380
1380
|
|
|
@@ -1727,7 +1727,7 @@ function Bridge({ amount, tokenAddress, defaultTokenImage, theme, themeOverrides
|
|
|
1727
1727
|
checkout,
|
|
1728
1728
|
provider: from.browserProvider,
|
|
1729
1729
|
chainId: from?.network,
|
|
1730
|
-
allowTokenListType:
|
|
1730
|
+
allowTokenListType: ie$1.BRIDGE,
|
|
1731
1731
|
// Skip retry given that in this case it is not needed;
|
|
1732
1732
|
// refreshBalances will be, automatically, called again
|
|
1733
1733
|
// after REFRESH_TOKENS_INTERVAL_MS.
|
|
@@ -3000,7 +3000,7 @@ function BridgeWidget({ checkout, browserProvider, config, amount, tokenAddress,
|
|
|
3000
3000
|
userJourney: UserJourney.BRIDGE,
|
|
3001
3001
|
screen: 'Error',
|
|
3002
3002
|
});
|
|
3003
|
-
} })), viewState.view.type === SharedViews.TOP_UP_VIEW && (jsx(TopUpView, { analytics: { userJourney: UserJourney.BRIDGE }, widgetEvent:
|
|
3003
|
+
} })), viewState.view.type === SharedViews.TOP_UP_VIEW && (jsx(TopUpView, { analytics: { userJourney: UserJourney.BRIDGE }, widgetEvent: ro.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: () => {
|
|
3004
3004
|
page({
|
|
3005
3005
|
userJourney: UserJourney.BRIDGE,
|
|
3006
3006
|
screen: 'ClaimWithdrawalSuccess',
|