@imtbl/checkout-widgets 2.24.8 → 2.24.9-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-BQfrLKCo.js → AddTokensWidget-CIR8BF_I.js} +24 -297
- package/dist/browser/{BridgeWidget-6KlgTXwZ.js → BridgeWidget-C5Uljhhx.js} +13 -294
- package/dist/browser/{CommerceWidget-CcCuv661.js → CommerceWidget-CeBBYCbK.js} +17 -47
- package/dist/browser/{FeesBreakdown-DvoQJlP-.js → FeesBreakdown-BU4haotD.js} +1 -1
- package/dist/browser/{OnRampWidget-DaL34PiA.js → OnRampWidget-Ccvb3QkT.js} +5 -80
- package/dist/browser/{SaleWidget-D-IBBRTL.js → SaleWidget-CPARFlzv.js} +61 -219
- package/dist/browser/{SpendingCapHero-Z5NIcrWw.js → SpendingCapHero-B-0YYZho.js} +1 -1
- package/dist/browser/{SwapWidget-C4B2Answ.js → SwapWidget-ujE6uX-N.js} +12 -206
- package/dist/browser/{TokenImage-DucOedrZ.js → TokenImage-BeUf_Ulv.js} +1 -1
- package/dist/browser/{TopUpView-BIvdNYib.js → TopUpView-GMv3360Q.js} +3 -54
- package/dist/browser/{WalletApproveHero-ge2JSOYk.js → WalletApproveHero-BJi7ufqM.js} +4 -12
- package/dist/browser/{WalletWidget-hiUotMuQ.js → WalletWidget-BABrqsfd.js} +4 -96
- package/dist/browser/{index-2esq4Cem.js → index-CcxHW36j.js} +1275 -9717
- package/dist/browser/{index-DWNAmu0n.js → index-Cp1w6map.js} +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/{useInterval-1gu4cbu3.js → useInterval-DbCsm_gG.js} +1 -1
- package/dist/types/components/FormComponents/SelectForm/SelectForm.d.ts +1 -5
- package/dist/types/components/FormComponents/SelectInput/SelectInput.d.ts +1 -5
- package/dist/types/components/Transak/TransakIframe.d.ts +0 -1
- package/dist/types/components/Transak/useTransakEvents.d.ts +0 -4
- package/dist/types/components/WalletDrawer/ConnectWalletDrawer.d.ts +1 -2
- package/dist/types/lib/squid/hooks/useExecute.d.ts +1 -2
- package/dist/types/views/top-up/TopUpView.d.ts +1 -5
- package/dist/types/widgets/add-tokens/hooks/useError.d.ts +1 -1
- package/dist/types/widgets/purchase/components/PurchaseConnectWalletDrawer.d.ts +1 -3
- package/dist/types/widgets/sale/hooks/useSaleEvents.d.ts +5 -31
- package/dist/types/widgets/swap/components/Fees.d.ts +1 -1
- package/package.json +7 -9
- package/src/components/ConnectLoader/ConnectLoader.tsx +0 -16
- package/src/components/FormComponents/SelectForm/SelectForm.tsx +2 -18
- package/src/components/FormComponents/SelectInput/SelectInput.tsx +1 -12
- package/src/components/RouteOptionsDrawer/RouteOptionsDrawer.tsx +2 -26
- package/src/components/Transactions/ChangeWallet.tsx +1 -12
- package/src/components/Transactions/ClaimWithdrawalInProgress.tsx +0 -11
- package/src/components/Transactions/NoTransactions.tsx +0 -10
- package/src/components/Transactions/TransactionItemWithdrawPending.tsx +1 -13
- package/src/components/Transactions/Transactions.tsx +2 -28
- package/src/components/Transak/TransakIframe.tsx +0 -6
- package/src/components/Transak/useTransakEvents.ts +1 -70
- package/src/components/WalletDrawer/ConnectWalletDrawer.tsx +2 -35
- package/src/components/WalletDrawer/PayWithWalletDrawer.tsx +0 -1
- package/src/context/view-context/test-components/ViewContextTestComponent.tsx +14 -15
- package/src/lib/squid/hooks/useExecute.ts +5 -18
- package/src/views/top-up/TopUpView.tsx +5 -56
- package/src/widgets/add-tokens/AddTokensRoot.tsx +28 -29
- package/src/widgets/add-tokens/AddTokensWidget.tsx +2 -17
- package/src/widgets/add-tokens/components/TokenDrawerMenu.tsx +2 -18
- package/src/widgets/add-tokens/hooks/useError.tsx +1 -18
- package/src/widgets/add-tokens/hooks/useErrorHandler.ts +2 -12
- package/src/widgets/add-tokens/views/AddTokens.tsx +8 -154
- package/src/widgets/add-tokens/views/Review.tsx +6 -94
- package/src/widgets/bridge/BridgeWidget.tsx +0 -35
- package/src/widgets/bridge/BridgeWidgetRoot.tsx +17 -18
- package/src/widgets/bridge/components/BridgeForm.tsx +0 -20
- package/src/widgets/bridge/components/BridgeReviewSummary.tsx +1 -49
- package/src/widgets/bridge/components/WalletAndNetworkSelector.tsx +3 -122
- package/src/widgets/bridge/views/ApproveTransaction.tsx +1 -15
- package/src/widgets/bridge/views/Bridge.tsx +1 -16
- package/src/widgets/bridge/views/BridgeReview.tsx +1 -12
- package/src/widgets/bridge/views/ClaimWithdrawal.tsx +0 -11
- package/src/widgets/bridge/views/MoveInProgress.tsx +0 -24
- package/src/widgets/bridge/views/WalletNetworkSelectionView.tsx +1 -12
- package/src/widgets/connect/ConnectWidget.tsx +2 -18
- package/src/widgets/connect/ConnectWidgetRoot.tsx +15 -16
- package/src/widgets/connect/components/WalletList.tsx +6 -55
- package/src/widgets/connect/views/ConnectWallet.tsx +1 -12
- package/src/widgets/connect/views/ReadyToConnect.tsx +2 -29
- package/src/widgets/connect/views/SwitchNetworkEth.tsx +3 -22
- package/src/widgets/connect/views/SwitchNetworkZkEVM.tsx +0 -18
- package/src/widgets/immutable-commerce/CommerceWidgetRoot.tsx +17 -19
- package/src/widgets/on-ramp/OnRampWidget.tsx +0 -2
- package/src/widgets/on-ramp/OnRampWidgetRoot.tsx +23 -24
- package/src/widgets/on-ramp/views/OnRampMain.tsx +1 -91
- package/src/widgets/purchase/PurchaseWidgetRoot.tsx +22 -23
- package/src/widgets/purchase/components/PurchaseConnectWalletDrawer.tsx +2 -34
- package/src/widgets/purchase/components/PurchaseDeliverToWalletDrawer.tsx +0 -1
- package/src/widgets/purchase/components/PurchasePayWithWalletDrawer.tsx +0 -2
- package/src/widgets/purchase/components/PurchaseRouteOptionsDrawer/RouteOptionsDrawer.tsx +1 -30
- package/src/widgets/purchase/components/WithCard.tsx +0 -4
- package/src/widgets/purchase/views/Purchase.tsx +1 -2
- package/src/widgets/sale/SaleWidget.tsx +0 -2
- package/src/widgets/sale/SaleWidgetRoot.tsx +32 -33
- package/src/widgets/sale/components/OrderReview.tsx +2 -29
- package/src/widgets/sale/components/WithCard.tsx +0 -2
- package/src/widgets/sale/hooks/useSaleEvents.ts +3 -185
- package/src/widgets/sale/views/OrderSummary.tsx +2 -15
- package/src/widgets/sale/views/PayWithCard.tsx +4 -46
- package/src/widgets/sale/views/PayWithCoins.tsx +4 -9
- package/src/widgets/sale/views/PaymentMethods.tsx +3 -6
- package/src/widgets/sale/views/SaleErrorView.tsx +1 -1
- package/src/widgets/swap/SwapWidget.tsx +0 -24
- package/src/widgets/swap/SwapWidgetRoot.tsx +29 -30
- package/src/widgets/swap/components/Fees.tsx +1 -1
- package/src/widgets/swap/components/SwapForm.tsx +2 -140
- package/src/widgets/swap/views/ApproveERC20Onboarding.tsx +1 -36
- package/src/widgets/swap/views/SwapCoins.tsx +0 -17
- package/src/widgets/swap/views/SwapInProgress.tsx +0 -14
- package/src/widgets/transfer/TransferForm.tsx +3 -25
- package/src/widgets/transfer/TransferWidget.tsx +1 -23
- package/src/widgets/wallet/WalletWidgetRoot.tsx +24 -25
- package/src/widgets/wallet/components/BalanceItem/BalanceItem.tsx +1 -50
- package/src/widgets/wallet/components/NetworkMenu/NetworkMenu.tsx +0 -13
- package/src/widgets/wallet/components/WalletAddress/WalletAddress.tsx +0 -13
- package/src/widgets/wallet/views/CoinInfo.tsx +1 -12
- package/src/widgets/wallet/views/Settings.tsx +1 -15
- package/src/widgets/wallet/views/WalletBalances.tsx +0 -24
- package/tsconfig.json +0 -1
- package/dist/browser/auto-track-C-H4NHVE.js +0 -105
- package/dist/browser/index-CcQ-5rAF.js +0 -446
- package/dist/browser/index-CvpdSuud.js +0 -5634
- package/dist/browser/index-D3m5uC9C.js +0 -60
- package/dist/browser/index-DJEaNohG.js +0 -65
- package/dist/browser/index-DPz4F2rf.js +0 -27
- package/dist/browser/index-DQZhPkHy.js +0 -65
- package/dist/browser/index.umd-brf0Qwxh.js +0 -32
- package/dist/browser/is-plan-event-enabled-mXX0dwl-.js +0 -17
- package/dist/types/context/analytics-provider/CustomAnalyticsProvider.d.ts +0 -7
- package/dist/types/context/analytics-provider/SegmentAnalyticsProvider.d.ts +0 -42
- package/dist/types/context/analytics-provider/SetupAnalytics.d.ts +0 -7
- package/dist/types/lib/analytics/identifyUser.d.ts +0 -8
- package/dist/types/lib/analytics/identifyUser.test.d.ts +0 -1
- package/src/context/analytics-provider/CustomAnalyticsProvider.tsx +0 -22
- package/src/context/analytics-provider/SegmentAnalyticsProvider.ts +0 -41
- package/src/context/analytics-provider/SetupAnalytics.tsx +0 -35
- package/src/lib/analytics/identifyUser.test.ts +0 -44
- package/src/lib/analytics/identifyUser.ts +0 -26
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
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 { ch as toQuantity, ci as toBeHex, cj as getAddress, ck as keccak256, cl as concat, cm as AbiCoder, cn as axios, co as ZeroAddress, k as Contract, Y as isAddress, bG as r, aL as ChainId, cp as ChainName, cq as CheckoutErrorType, r as reactExports, I as IMTBLWidgetEvents, B as BridgeEventType, s as jsxs, q as jsx, cr as ShimmerBox, aK as MenuItem, w as Stack, u as useTranslation, y as Body, v as Button, t as Box, cs as PASSPORT_URL, L as Link, ct as getChainImage, aY as FramedImage, b2 as EllipsizedText, b8 as Icon, cu as getChainIdBySlug, aP as ViewContext, aD as Fragment, az as Divider, V as ViewActions, cv as useWalletConnect, cw as Logo, cx as RawImage, cy as isWalletConnectProvider, z as CryptoFiatContext, aW as isNativeToken, aX as getTokenImageByAddress, cz as getNativeSymbolByChainSlug, c3 as formatUnits, j as calculateCryptoToFiat, E as EventTargetContext, l as TokenFilterTypes, cA as JsonRpcProvider, $ as CryptoFiatActions, aF as WrappedBrowserProvider, bi as useInjectedProviders, cB as retry, G as HeaderNavigation, bZ as FooterLogo, aB as WalletDrawer, x as SimpleLayout, cC as getChainSlugById, aG as isPassportProvider, cD as DEFAULT_TRANSACTIONS_RETRY_POLICY, aE as WalletProviderRdns, _ as LoadingView, N as useTheme, H as Heading, cE as getChainNameById, cF as getWalletProviderNameByProvider, cG as WalletProviderName, ay as Drawer, a_ as ButtCon, cH as ButtonNavigationStyles, K as orchestrationEvents, D as tokenValueFormat, i as formatZeroAmount, cI as NATIVE, bO as Z$1, p as parseUnits, M as amountInputValidation, Q as CloudImage, cJ as ETH_TOKEN_SYMBOL, R as getRemoteImage, bz as PriceDisplay, cK as GasEstimateType, cL as DEFAULT_QUOTE_REFRESH_INTERVAL, cM as addChainChangedListener, cN as removeChainChangedListener, cO as isAddressSanctioned, cP as IMX_TOKEN_SYMBOL, a3 as SharedViews, cQ as DEFAULT_TOKEN_DECIMALS, cR as parseChainId, m as dist, cS as CHECKOUT_CDN_BASE_URL, cT as heroBackGroundStyles, cU as heroImageStyles, b9 as Badge, cV as SimpleTextBody, cW as FooterButton, cX as getEthTokenImage, cY as WITHDRAWAL_CLAIM_GAS_LIMIT, cZ as getGasPriceInWei, bC as viewReducer, bD as initialViewState, c_ as a, c$ as StatusView, b_ as StatusType, a4 as ErrorView, bK as ServiceUnavailableErrorView, U as CryptoFiatProvider, F as getDefaultTokenImage } from './index-CcxHW36j.js';
|
|
2
|
+
import { B as BridgeWidgetViews, T as TopUpView } from './TopUpView-GMv3360Q.js';
|
|
3
|
+
import { T as TokenImage } from './TokenImage-BeUf_Ulv.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-BJi7ufqM.js';
|
|
5
|
+
import { f as fetchRiskAssessmentV2, r as resultHasSanctionedWallets, F as FeesBreakdown } from './FeesBreakdown-BU4haotD.js';
|
|
6
|
+
import { u as useInterval } from './useInterval-DbCsm_gG.js';
|
|
7
7
|
|
|
8
8
|
const d=[{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`}];(function(e){return e.SUCCESS=`SUCCESS`,e.PENDING=`PENDING`,e.FAILED=`FAILED`,e})({});(function(e){return e.DEPOSIT=`DEPOSIT`,e.WITHDRAW=`WITHDRAW`,e.FINALISE_WITHDRAWAL=`FINALISE_WITHDRAWAL`,e})({});(function(e){return e[e.DEPOSIT_SOURCE=15e4]=`DEPOSIT_SOURCE`,e[e.DEPOSIT_DESTINATION=25e4]=`DEPOSIT_DESTINATION`,e[e.WITHDRAW_SOURCE=25e4]=`WITHDRAW_SOURCE`,e[e.WITHDRAW_DESTINATION=25e4]=`WITHDRAW_DESTINATION`,e[e.MAP_TOKEN_SOURCE=2e5]=`MAP_TOKEN_SOURCE`,e[e.MAP_TOKEN_DESTINATION=2e5]=`MAP_TOKEN_DESTINATION`,e[e.FINALISE_WITHDRAWAL=2e5]=`FINALISE_WITHDRAWAL`,e[e.APPROVE_TOKEN=55e3]=`APPROVE_TOKEN`,e})({});(function(e){return e.PENDING=`PENDING`,e.PROCESSING=`PROCESSING`,e.COMPLETE=`COMPLETE`,e.RETRY=`RETRY`,e.ERROR=`ERROR`,e.NOT_ENOUGH_GAS=`NOT_ENOUGH_GAS`,e.FLOW_RATE_CONTROLLED=`FLOW_RATE_CONTROLLED`,e})({});const g=`NATIVE`,_=`11155111`,y=`15003`,b=`13473`,x=`13371`,C=`0x0000000000000000000000000000000000000eee`,w=`0x7a8dc26796a1e50e6e190b70259f58f6a4edd5b22280ceecc82b687b8e982869`,T=`0x07b0d4304f82012bd3b70b1d531c160e326067c90829e2a3d386722ad10b89c3`,E=`0x0000000000000000000000000000000000000000000000000000000000000004`,D={mainnet:`0x3a0c2ba54d6cbd3121f01b96dfd20e99d1696c9d`,testnet:`0x1CcCa691501174B4A623CeDA58cC8f1a76dc3439`,devnet:``},O={mainnet:`0xf57e7e7c23978c3caec3c3548e3d615c346e79ff`,testnet:`0xe2629e08f4125d14e446660028bD98ee60EE69F2`,devnet:``},ee={mainnet:`0x52a6c53869ce09a731cd772f245b97a4401d3348`,testnet:`0xe9E96d1aad82562b7588F03f49aD34186f996478`,devnet:``},te={mainnet:`0x4f49b53928a71e553bb1b0f66a5bcb54fd4e8932`,testnet:`0x6328Ac88ba8D466a0F551FC7C42C61d1aC7f92ab`,devnet:``},ne={mainnet:`0x4f49b53928a71e553bb1b0f66a5bcb54fd4e8932`,testnet:`0x6328Ac88ba8D466a0F551FC7C42C61d1aC7f92ab`,devnet:``},k={mainnet:`immutable`,testnet:`immutable`,devnet:``},A={mainnet:`0x4F4495243837681061C4743b74B3eEdf548D56A5`,testnet:`0xe432150cce91c13a887f7D836923d5597adD8E31`,devnet:``},j={rootChainID:_,childChainID:y},M={rootChainID:_,childChainID:b},N={rootChainID:`1`,childChainID:x},P={mainnet:`https://api.gmp.axelarscan.io`,testnet:`https://testnet.api.gmp.axelarscan.io`,devnet:`https://stagenet.api.gmp.axelarscan.io`},F={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`},I={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`}},L={deposit:{token:`deposit`,tokenTo:`depositTo`,native:`depositETH`,nativeTo:`depositToETH`},withdraw:{token:`withdraw`,tokenTo:`withdrawTo`,native:`withdrawIMX`,nativeTo:`withdrawIMXTo`}};(function(e){return e.UNSUPPORTED_ERROR=`UNSUPPORTED_ERROR`,e.INVALID_ADDRESS=`INVALID_ADDRESS`,e.INVALID_AMOUNT=`INVALID_AMOUNT`,e.INTERNAL_ERROR=`INTERNAL_ERROR`,e.PROVIDER_ERROR=`PROVIDER_ERROR`,e.ROOT_PROVIDER_ERROR=`ROOT_PROVIDER_ERROR`,e.CHILD_PROVIDER_ERROR=`CHILD_PROVIDER_ERROR`,e.TRANSACTION_REVERTED=`TRANSACTION_REVERTED`,e.INVALID_TOKEN=`INVALID_TOKEN`,e.INVALID_TRANSACTION=`INVALID_TRANSACTION`,e.INVALID_SOURCE_CHAIN_ID=`INVALID_SOURCE_CHAIN_ID`,e.INVALID_DESTINATION_CHAIN_ID=`INVALID_DESTINATION_CHAIN_ID`,e.INVALID_SOURCE_OR_DESTINATION_CHAIN=`INVALID_SOURCE_OR_DESTINATION_CHAIN`,e.CHAIN_IDS_MATCH=`CHAIN_IDS_MATCH`,e.AXELAR_CHAIN_NOT_FOUND=`AXELAR_CHAIN_NOT_FOUND`,e.AXELAR_GAS_ESTIMATE_FAILED=`AXELAR_GAS_ESTIMATE_FAILED`,e.TENDERLY_GAS_ESTIMATE_FAILED=`TENDERLY_GAS_ESTIMATE_FAILED`,e.INVALID_RECIPIENT=`INVALID_RECIPIENT`,e.FLOW_RATE_ERROR=`FLOW_RATE_ERROR`,e.INVALID_FLOWRATE_INDEX=`INVALID_FLOWRATE_INDEX`,e})({});var R=class extends Error{type;constructor(e,t){super(e),this.type=t;}};const z=async(e,t,n)=>{try{return await e()}catch(e){let r=`${t}: ${e.message||`UnknownError`}`;throw new R(r,t)}};async function B(e,t,r){return await z(async()=>new Contract(e,t,r),`PROVIDER_ERROR`)}function V(e,t){let n;return n=e===N.rootChainID||e===N.childChainID?t.mainnet:e===M.rootChainID||e===M.childChainID?t.testnet:t.devnet,n}function ie(e){return V(e,ee)}function ae(e,t){return e.toUpperCase()===ie(t).toUpperCase()}function H(e){return V(e,O)}function oe(e,t){return e.toUpperCase()===H(t).toUpperCase()}function se(e){return V(e,te)}function ce(e){return V(e,ne)}function le(e){return V(e,k)}function ue(e){return V(e,A)}function U(e){return V(e,P)}function de(e){return V(e,F)}function fe(e){return V(e,D)}function W(e,t){return e.toUpperCase()===fe(t).toUpperCase()}function G(e,t){return e.sourceChainId===t.rootChainID&&e.destinationChainId===t.childChainID&&e.action===`DEPOSIT`}function pe(e,t){return e===t.rootChainID}function K(e,t){return e.sourceChainId===t.childChainID&&e.destinationChainId===t.rootChainID&&e.action===`WITHDRAW`}function me(e,t,n){return K(t,n)&&!W(e,t.sourceChainId)}function he(e){return !(`token`in e)||e.token.toUpperCase()===`NATIVE`}function ge(e,t,n){return K(t,n)&&W(e,t.sourceChainId)}async function _e(e){let t=`Please upgrade to the latest version of the Bridge SDK or provide valid configuration`,n=await z(async()=>e.rootProvider.getNetwork(),`ROOT_PROVIDER_ERROR`);if(n.chainId.toString()!==e.bridgeInstance.rootChainID)throw new R(`Rootchain provider chainID ${n.chainId} does not match expected chainID ${e.bridgeInstance.rootChainID}. ${t}`,`UNSUPPORTED_ERROR`);let r=await z(async()=>e.childProvider.getNetwork(),`CHILD_PROVIDER_ERROR`);if(r.chainId.toString()!==e.bridgeInstance.childChainID)throw new R(`Childchain provider chainID ${r.chainId} does not match expected chainID ${e.bridgeInstance.childChainID}. ${t} `,`UNSUPPORTED_ERROR`)}async function ve(e,t,n,r){let i;if(t===r.bridgeInstance.rootChainID){if(!ae(e,t))return;i=r.rootProvider;}else {if(!oe(e,t))return;i=r.childProvider;}if((await i.getCode(n)).length<=2)return;let a=await B(n,[`function receive()`],i);try{await a.receive.estimateGas();}catch{try{await i.estimateGas({to:n});}catch{throw new R(`address ${n} is not a valid receipient`,`INVALID_RECIPIENT`)}}}async function q(e,t,n){if(e!==n.bridgeInstance.rootChainID&&e!==n.bridgeInstance.childChainID)throw new R(`the sourceChainId ${e} is not a valid`,`INVALID_SOURCE_CHAIN_ID`);if(t!==n.bridgeInstance.rootChainID&&t!==n.bridgeInstance.childChainID)throw new R(`the destinationChainId ${t} is not a valid`,`INVALID_DESTINATION_CHAIN_ID`);if(e===t)throw new R(`the sourceChainId ${e} cannot be the same as the destinationChainId ${t}`,`CHAIN_IDS_MATCH`)}async function ye(e,t){if(await q(e.sourceChainId,e.destinationChainId,t),!isAddress(e.senderAddress)||!isAddress(e.recipientAddress))throw new R(`address ${e.senderAddress} or ${e.recipientAddress} is not a valid address`,`INVALID_ADDRESS`);if(e.amount<=0n)throw new R(`deposit amount ${e.amount.toString()} is invalid`,`INVALID_AMOUNT`);if(e.token.toUpperCase()!==`NATIVE`&&!isAddress(e.token))throw new R(`token address ${e.token} is not a valid address`,`INVALID_ADDRESS`)}function be(e,t){if(e.action===`FINALISE_WITHDRAWAL`&&e.sourceChainId!==t.bridgeInstance.rootChainID)throw new R(`Finalised withdrawals must be on the root chain (${t.bridgeInstance.rootChainID})`,`INVALID_SOURCE_CHAIN_ID`);if(!(`destinationChainId`in e))throw new R(`DEPOSIT or WITHDRAW used without destinationChainId`,`INVALID_DESTINATION_CHAIN_ID`);let n={sourceChainId:e.sourceChainId,destinationChainId:e.destinationChainId,action:e.action};if(!G(n,t.bridgeInstance)&&!K(n,t.bridgeInstance))throw new R(`This request is neither a valid deposit nor a valid withdrawal`,`INVALID_SOURCE_OR_DESTINATION_CHAIN`)}const xe=e=>!!e.maxFeePerGas&&!!e.maxPriorityFeePerGas,Se=e=>{if(xe(e)){let{maxFeePerGas:t,maxPriorityFeePerGas:n}=e;return t===null||n===null?null:n+(t-n)/BigInt(2)}return e.gasPrice?e.gasPrice:null};function J(e,t){let n=Se(e);return n?n*BigInt(t):BigInt(0)}const Y=[{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 Ce(e){return keccak256(AbiCoder.defaultAbiCoder().encode([`bytes`,`uint256`],[e,new Date().getTime()]))}function we(e,n,r,i){return AbiCoder.defaultAbiCoder().encode([`bytes32`,`address`,`address`,`address`,`uint256`],[w,e,n,r,i])}async function Te(e,t){return B(e,Y,t)}async function Ee(e,t,n){if(e.toUpperCase()===`NATIVE`||W(e,t))return H(t);let r=await Te(e,n);return z(()=>r.rootToken(),`PROVIDER_ERROR`)}function De(e){let t={};return e.forEach(e=>{let{contractAddress:n,stateDiff:r}=e,{storageSlot:i,value:a}=r;t[n]===void 0&&(t[n]={stateDiff:{}}),t[n].stateDiff[i]=a;}),t}async function X(t,n,r){let i,a=de(t),o=r?De(r):void 0;try{i=await axios.post(a,{jsonrpc:`2.0`,id:0,method:`tenderly_simulateBundle`,params:[n,`latest`,o]},{headers:{"Content-Type":`application/json`}});}catch(e){i=e.response;}if(i.data.error)throw new R(`Estimating gas failed with the reason: ${i.data.error.message}`,`TENDERLY_GAS_ESTIMATE_FAILED`);let s=i.data.result;if(s.length!==n.length)throw new R(`Estimating gas failed with mismatched responses`,`TENDERLY_GAS_ESTIMATE_FAILED`);let c=[],l=!1,u=!1,d=!1,f=0,p=!1,m=n.find(e=>e.data?.startsWith(`0x84a3291a0`))!==void 0;for(let e=0;e<s.length;e++){if(s[e].error)throw new R(`Estimating deposit gas failed with the reason: ${s[e].error.message}`,`TENDERLY_GAS_ESTIMATE_FAILED`);if(s[e].gasUsed===void 0)throw new R(`Estimating gas did not return simulation results`,`TENDERLY_GAS_ESTIMATE_FAILED`);if(m&&s[e].logs!==void 0){let t=s[e].logs.find(e=>e.name===`QueuedWithdrawal`);if(t!==void 0){let e=new Map(t.inputs.map(e=>[e.name,e.value]));l=e.get(`delayWithdrawalLargeAmount`)||!1,u=e.get(`delayWithdrawalUnknownToken`)||!1,d=e.get(`withdrawalQueueActivated`)||!1;}}if(m&&s[e].trace!==void 0){let t=s[e].trace.find(e=>e.method===`largeTransferThresholds`);t!==void 0&&(f=t.output,p=!0);}p||c.push(s[e].gasUsed);}return {gas:c,delayWithdrawalLargeAmount:l,delayWithdrawalUnknownToken:u,withdrawalQueueActivated:d,largeTransferThresholds:f}}async function Oe(e,t,n,r,i,o){let s,c;if(r.toUpperCase()===`NATIVE`)e===t?(s=i.native,c=[n]):(s=i.nativeTo,c=[t,n]);else {let o=getAddress(r);e===t?(s=i.token,c=[o,n]):(s=i.tokenTo,c=[o,t,n]);}return await z(async()=>o.interface.encodeFunctionData(s,c),`INTERNAL_ERROR`)}const Z=[{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`}],Q=[{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`}],$=[{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`}];(function(e){return e.SRC_GATEWAY_CALLED=`source_gateway_called`,e.DEST_GATEWAY_APPROVED=`destination_gateway_approved`,e.DEST_EXECUTED=`destination_executed`,e.EXPRESS_EXECUTED=`express_executed`,e.DEST_EXECUTE_ERROR=`error`,e.DEST_EXECUTING=`executing`,e.APPROVING=`approving`,e.FORECALLED=`forecalled`,e.FORECALLED_WITHOUT_GAS_PAID=`forecalled_without_gas_paid`,e.NOT_EXECUTED=`not_executed`,e.NOT_EXECUTED_WITHOUT_GAS_PAID=`not_executed_without_gas_paid`,e.INSUFFICIENT_FEE=`insufficient_fee`,e.UNKNOWN_ERROR=`unknown_error`,e.CANNOT_FETCH_STATUS=`cannot_fetch_status`,e.SRC_GATEWAY_CONFIRMED=`confirmed`,e})({});(function(e){return e.GAS_UNPAID=`gas_unpaid`,e.GAS_PAID=`gas_paid`,e.GAS_PAID_NOT_ENOUGH_GAS=`gas_paid_not_enough_gas`,e.GAS_PAID_ENOUGH_GAS=`gas_paid_enough_gas`,e})({});const je=e=>{let{error:t,status:n}=e;return n===`error`&&t?`error`:n===`executed`?`destination_executed`:n===`approved`?`destination_gateway_approved`:n===`called`?`source_gateway_called`:n===`executing`?`executing`:n},Me=e=>{if(e.error)return {message:e.error.error.message,txHash:e.error.error.transactionHash,chain:e.error.chain};if(e.is_insufficient_fee)return {message:`Insufficient fee`,txHash:e.call.transaction.hash,chain:e.call.chain}},Ne=async(e,t)=>fetch(`${e}?${new URLSearchParams(t).toString()}`,{method:`GET`,headers:{"Content-Type":`application/json`},cache:`no-store`}).then(e=>e.json()).then(e=>e.data),Pe=async(e,t,n)=>Ne(e,{method:`searchGMP`,txHash:t,txLogIndex:n}).then(e=>e.find(e=>e.id.indexOf(t)>-1||e.call.transactionHash.indexOf(t)>-1)).catch(()=>void 0),Fe=async(e,t,n)=>{let r=await Pe(e,t,n);if(!r)return {status:`cannot_fetch_status`};let{call:i,gas_status:a,gas_paid:o,executed:s,express_executed:c,approved:l,callback:u}=r,d={status:a,details:o},f=r.time_spent;return f&&(f.total=f.total||Object.values(f).reduce((e,t)=>e+t,0)),{status:je(r),error:Me(r),timeSpent:f,gasPaidInfo:d,callTx:i,executed:s,expressExecuted:c,approved:l,callback:u}};var Ie=class{config;initialised;constructor(e){this.config=e,this.initialised=!1;}async initialise(){this.initialised||=(await _e(this.config),!0);}async getFee(e){let[,,t]=await Promise.all([this.initialise(),async()=>{e.action!==`FINALISE_WITHDRAWAL`&&await q(e.sourceChainId,e.destinationChainId,this.config);},this.getFeePrivate(e)]);return t}async getFinaliseWithdrawFee(){return J(await this.config.rootProvider.getFeeData(),2e5)}async getDepositOrWithdrawFee(e){let t;t=e.sourceChainId===this.config.bridgeInstance.rootChainID?await this.config.rootProvider.getFeeData():await this.config.childProvider.getFeeData();let n=BigInt(0),r=BigInt(0),i=BigInt(0),a;if(e.action===`DEPOSIT`)a={sourceChainId:e.sourceChainId,destinationChainId:e.destinationChainId,action:`DEPOSIT`};else if(e.action===`WITHDRAW`)a={sourceChainId:e.sourceChainId,destinationChainId:e.destinationChainId,action:`WITHDRAW`};else throw new R(`Invalid action`,`INTERNAL_ERROR`);if(!(G(a,this.config.bridgeInstance)||K(a,this.config.bridgeInstance)))throw new R(`Invalid direction`,`INTERNAL_ERROR`);he(e)||(G(a,this.config.bridgeInstance)||`token`in e&&ge(e.token,a,this.config.bridgeInstance))&&(r=J(t,55e3));let o;return e.action===`DEPOSIT`?(n=J(t,15e4),o=25e4):(n=J(t,25e4),o=25e4),i=await this.getAxelarFee(e.sourceChainId,e.destinationChainId,o,e.gasMultiplier),{sourceChainFee:n,approvalFee:r,bridgeFee:i}}async getFeePrivate(e){be(e,this.config);let t=BigInt(0),n=BigInt(0),r=BigInt(0);if(e.action===`FINALISE_WITHDRAWAL`)t=await this.getFinaliseWithdrawFee();else {let i=await this.getDepositOrWithdrawFee(e);t=i.sourceChainFee,n=i.approvalFee,r=i.bridgeFee;}let i=t+n+r;return {sourceChainGas:t,approvalFee:n,bridgeFee:r,imtblFee:BigInt(`0`),totalFees:i}}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 t=G(e,this.config.bridgeInstance)?L.deposit:L.withdraw,t}async getBridgeContract(e){if(G(e,this.config.bridgeInstance)){let e=this.config.bridgeContracts.rootERC20BridgeFlowRate;return await B(e,Z,this.config.rootProvider)}let t=this.config.bridgeContracts.childERC20Bridge;return await B(t,$,this.config.childProvider)}async getConfigAndBridgeTxCalldata(e,t,n,r,i){return Oe(e,t,n,r,await this.getBridgeMethods(i),await this.getBridgeContract(i))}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(),ye(e,this.config),ve(e.token,e.destinationChainId,e.recipientAddress,this.config),this.getUnsignedBridgeBundledTxPrivate(e)]);return t}async getUnsignedBridgeBundledTxPrivate(e){let t;if(t=pe(e.sourceChainId,this.config.bridgeInstance)?{sourceChainId:e.sourceChainId,destinationChainId:e.destinationChainId,action:`DEPOSIT`}:{sourceChainId:e.sourceChainId,destinationChainId:e.destinationChainId,action:`WITHDRAW`},G(t,this.config.bridgeInstance))return this.getUnsignedBridgeDepositBundledTxPrivate(t,e.senderAddress,e.recipientAddress,e.token,e.amount,e.gasMultiplier);if(K(t,this.config.bridgeInstance))return this.getUnsignedBridgeWithdrawBundledTxPrivate(t,e.senderAddress,e.recipientAddress,e.token,e.amount,e.gasMultiplier);throw new R(`Invalid Bridge Bundled TX`,`INVALID_TRANSACTION`)}async getUnsignedBridgeDepositBundledTxPrivate(e,t,n,r,i,a){let[o,s,c,l]=await Promise.all([this.getAllowance(e,r,t),this.config.rootProvider.getFeeData(),this.getDynamicDepositGas(this.config.bridgeInstance.rootChainID,t,n,r,i),this.getAxelarFee(this.config.bridgeInstance.rootChainID,this.config.bridgeInstance.childChainID,25e4,a)]),u,d,f=BigInt(0),p=BigInt(0),m=l,h=BigInt(0);if(r.toUpperCase()!==`NATIVE`&&o<i){u=r.startsWith(`0x`)?r:`0x${r}`;let e=await B(u,Q,this.config.rootProvider);d={data:await z(async()=>e.interface.encodeFunctionData(`approve`,[this.config.bridgeContracts.rootERC20BridgeFlowRate,i]),`INTERNAL_ERROR`),to:u,value:0,from:t,chainId:parseInt(this.config.bridgeInstance.rootChainID,10)},p=J(s,c.approvalGas);}else u=null,d=null;let g=await this.getConfigAndBridgeTxCalldata(t,n,i,r,e),_=r.toUpperCase()===`NATIVE`?(i+m).toString():m.toString(),v={data:g,to:this.config.bridgeContracts.rootERC20BridgeFlowRate,value:_,from:t,chainId:parseInt(this.config.bridgeInstance.rootChainID,10)};f=J(s,c.sourceChainGas);let y=f+p+m+h;return {feeData:{sourceChainGas:f,approvalFee:p,bridgeFee:m,imtblFee:h,totalFees:y},contractToApprove:u,unsignedApprovalTx:d,unsignedBridgeTx:v,delayWithdrawalLargeAmount:null,delayWithdrawalUnknownToken:null,withdrawalQueueActivated:null,largeTransferThresholds:null}}async getUnsignedBridgeWithdrawBundledTxPrivate(e,t,n,r,i,a){let[o,s,c]=await Promise.all([this.getAllowance(e,r,t),this.config.childProvider.getFeeData(),await this.getDynamicWithdrawGasRootChain(e.destinationChainId,t,n,r,i)]),l=c.gas[0],u=await this.getAxelarFee(this.config.bridgeInstance.childChainID,this.config.bridgeInstance.rootChainID,l,a),d,f,p=BigInt(0),m=BigInt(0),h=u,g=BigInt(0);if(W(r,this.config.bridgeInstance.childChainID)&&o<i){d=r;let e=await B(r,Q,this.config.childProvider);f={data:await z(async()=>e.interface.encodeFunctionData(`approve`,[this.config.bridgeContracts.childERC20Bridge,i]),`INTERNAL_ERROR`),to:r,value:0,from:t,chainId:parseInt(this.config.bridgeInstance.childChainID,10)},m=J(s,55e3);}else d=null,f=null;let _=await this.getConfigAndBridgeTxCalldata(t,n,i,r,e),v=r.toUpperCase()===`NATIVE`?(i+h).toString():h.toString(),y={data:_,to:this.config.bridgeContracts.rootERC20BridgeFlowRate,value:v,from:t,chainId:parseInt(this.config.bridgeInstance.rootChainID,10)};p=J(s,25e4);let b=p+m+h+g;return {feeData:{sourceChainGas:p,approvalFee:m,bridgeFee:h,imtblFee:g,totalFees:b},contractToApprove:d,unsignedApprovalTx:f,unsignedBridgeTx:y,delayWithdrawalLargeAmount:c.delayWithdrawalLargeAmount,delayWithdrawalUnknownToken:c.delayWithdrawalUnknownToken,withdrawalQueueActivated:c.withdrawalQueueActivated,largeTransferThresholds:c.largeTransferThresholds}}async getDynamicDepositGas(e,t,n,r,i){let a=[];if(r.toUpperCase()!==`NATIVE`){let e=await B(r,Q,this.config.rootProvider),n=await z(async()=>e.interface.encodeFunctionData(`approve`,[this.config.bridgeContracts.rootERC20BridgeFlowRate,i]),`INTERNAL_ERROR`);a.push({from:t,to:r,data:n});}let o={action:`DEPOSIT`,sourceChainId:e,destinationChainId:this.config.bridgeInstance.childChainID},s=await this.getConfigAndBridgeTxCalldata(t,n,i,r,o),u=r.toUpperCase()===`NATIVE`?toQuantity(toBeHex(i+BigInt(1))):`0x1`;a.push({from:t,to:this.config.bridgeContracts.rootERC20BridgeFlowRate,data:s,value:u});let{gas:d}=await X(e,a),f={};return d.length===1?(f.approvalGas=0,[f.sourceChainGas]=d):[f.approvalGas,f.sourceChainGas]=d,f}async getDynamicWithdrawGasRootChain(e,n,r,o,c){let l=await Ee(o,e,this.config.childProvider),u=we(l,n,r,c.toString()),f=Ce(u),p=le(e),m=getAddress(se(e)).toString(),h=ce(e),g=keccak256(u),_=keccak256(concat([keccak256(AbiCoder.defaultAbiCoder().encode([`bytes32`,`bytes32`,`string`,`string`,`address`,`bytes32`],[T,f,p,m,h,g])),E])),v=await B(h,d,this.config.rootProvider),y=await z(async()=>v.interface.encodeFunctionData(`execute`,[f,p,m,u]),`INTERNAL_ERROR`),b=ue(e),x=[{from:n,to:h,data:y}],S=this.config.bridgeContracts.rootERC20BridgeFlowRate,C=await B(S,Z,this.config.rootProvider),w=await z(async()=>C.interface.encodeFunctionData(`largeTransferThresholds`,[l]),`INTERNAL_ERROR`);return x.push({from:n,to:S,data:w}),await X(e,x,[{contractAddress:b,stateDiff:{storageSlot:_,value:`0x0000000000000000000000000000000000000000000000000000000000000001`}}])}async getAllowance(e,t,n){if(t.toUpperCase()===`NATIVE`||me(t,e,this.config.bridgeInstance))return BigInt(0);let r,i;G(e,this.config.bridgeInstance)?(r=this.config.rootProvider,i=this.config.bridgeContracts.rootERC20BridgeFlowRate):(r=this.config.childProvider,i=this.config.bridgeContracts.childERC20Bridge);let a=await B(t,Q,r);return await z(()=>a.allowance(n,i),`PROVIDER_ERROR`)}async getAxelarFee(t,n,r,i=`auto`){let a=I[t],o=I[n];if(!a)throw new R(`Source chainID ${t} can not be matched to an Axelar chain.`,`AXELAR_CHAIN_NOT_FOUND`);if(!o)throw new R(`Destination chainID ${n} can not be matched to an Axelar chain.`,`AXELAR_CHAIN_NOT_FOUND`);let s=U(t),c={method:`estimateGasFee`,sourceChain:a.id,destinationChain:o.id,symbol:a.symbol,gasLimit:r,gasMultiplier:i,minGasPrice:1e9},l;try{l=await axios.post(s,c);}catch(e){l=e.response;}if(l.data.error)throw new R(`Estimating Axelar Gas failed with the reason: ${l.data.message}`,`AXELAR_GAS_ESTIMATE_FAILED`);try{return BigInt(`${l.data}`)}catch(e){throw new R(`Estimating Axelar Gas failed with the reason: ${e}`,`AXELAR_GAS_ESTIMATE_FAILED`)}}async getTransactionStatus(e){let t={transactions:[]},n=await this.getAxelarStatus(e.transactions,e.sourceChainId),r=await this.getUniqueReceivers(n,e.sourceChainId),i=[];for(let e of r)i.push(this.getPendingWithdrawals({recipient:e}));let a=[];try{a=await Promise.all(i);}catch(e){throw new R(`Failed to fetch the pending withdrawals with: ${e}`,`FLOW_RATE_ERROR`)}t.transactions=n;for(let e of t.transactions)e.status===`COMPLETE`&&(()=>{for(let t of a){let n=t.pending.findIndex(t=>t.amount.toString()===e.amount.toString()&&t.token===e.token&&t.withdrawer===e.sender&&t.recipient===e.recipient);if(n!==-1){e.status=`FLOW_RATE_CONTROLLED`,e.data={canWithdraw:t.pending[n].canWithdraw,timeoutStart:t.pending[n].timeoutStart,timeoutEnd:t.pending[n].timeoutEnd},t.pending.splice(n,1);return}}})();return t}async getUniqueReceivers(e,t){let n=[],r=[y,b,x].includes(t);for(let t=0,i=e.length;t<i;t++)e[t].status===`COMPLETE`&&r&&e[t].recipient&&n.findIndex(n=>n===e[t].recipient)===-1&&n.push(e[t].recipient);return n}async getAxelarStatus(e,n){let r=[],i=[],a=U(n),o=[`gas_unpaid`,`gas_paid_not_enough_gas`],s=new AbiCoder;for(let t of e)i.push(Fe(a,t.txHash));let c;try{c=await Promise.all(i);}catch(e){throw new R(`Failed to fetch the Axelar Status with the reason: ${e}`,`AXELAR_GAS_ESTIMATE_FAILED`)}for(let t=0,n=c.length;t<n;t++){let n;switch(c[t].status){case`cannot_fetch_status`:n=`PENDING`;break;case`source_gateway_called`:case`destination_gateway_approved`:case`executing`:case`confirmed`:case`approving`:n=`PROCESSING`;break;case`not_executed`:n=`RETRY`;break;case`not_executed_without_gas_paid`:case`insufficient_fee`:n=`NOT_ENOUGH_GAS`;break;case`destination_executed`:n=`COMPLETE`;break;default:n=`ERROR`;}c[t].gasPaidInfo&&o.includes(c[t].gasPaidInfo.status)&&(n=`NOT_ENOUGH_GAS`);let i={txHash:e[t].txHash,status:n,data:{gmpResponse:c[t].status}},a;c[t]?.callTx?.returnValues?.payload&&(a=s.decode([`bytes32`,`address`,`address`,`address`,`uint256`],c[t].callTx.returnValues.payload),i={...i,token:a[1],sender:a[2],recipient:a[3],amount:a[4]}),r.push(i);}return r}async getFlowRateInfo(e){if(!e.tokens||e.tokens.length===0)throw new R(`invalid tokens array ${e.tokens}`,`INVALID_TOKEN`);let t=this.config.bridgeContracts.rootERC20BridgeFlowRate,n=await B(t,Z,this.config.rootProvider),r=[];r.push(n.withdrawalQueueActivated()),r.push(n.withdrawalDelay());for(let t of e.tokens)t.toUpperCase()===`NATIVE`&&(t=C),r.push(n.flowRateBuckets(t)),r.push(n.largeTransferThresholds(t));let i;try{i=await Promise.all(r);}catch{throw new R(`unable to query contract for flowrate info`,`INTERNAL_ERROR`)}let a={},o=i[0],s=Number(i[1]);i.splice(0,2);for(let t=0,n=e.tokens.length;t<n;t++){let n=t*2;a[e.tokens[t]]={capacity:i[n].capacity,depth:i[n].depth,refillTime:Number(i[n].refillTime),refillRate:i[n].refillRate,largeTransferThreshold:i[n+1]};}return {withdrawalQueueActivated:o,withdrawalDelay:s,tokens:a}}async getPendingWithdrawals(e){if(!e.recipient)throw new R(`invalid recipient ${e.recipient}`,`INVALID_RECIPIENT`);let t=this.config.bridgeContracts.rootERC20BridgeFlowRate,n=await B(t,Z,this.config.rootProvider),r=await n.getPendingWithdrawalsLength(e.recipient),i={pending:[]};if(Number(r)===0)return i;let a=[];for(let e=0;e<Number(r);e++)a.push(e);let o=await n.getPendingWithdrawals(e.recipient,a),s=Math.floor(Date.now()/1e3),c=await n.withdrawalDelay();for(let t=0,n=o.length;t<n;t++){let n=Number(o[t].timestamp+c);n>s?i.pending[t]={canWithdraw:!1}:i.pending[t]={canWithdraw:!0},i.pending[t].recipient=e.recipient,i.pending[t].withdrawer=o[t].withdrawer,i.pending[t].token=o[t].token,i.pending[t].amount=o[t].amount,i.pending[t].timeoutStart=Number(o[t].timestamp),i.pending[t].timeoutEnd=n;}return i}async getFlowRateWithdrawTx(e){if(!e.recipient)throw new R(`invalid recipient ${e.recipient}`,`INVALID_RECIPIENT`);if(e.index<0)throw new R(`invalid index ${e.index}`,`INVALID_FLOWRATE_INDEX`);let t=this.config.bridgeContracts.rootERC20BridgeFlowRate,n=await B(t,Z,this.config.rootProvider),i=await n.getPendingWithdrawals(e.recipient,[e.index]);if(i[0].withdrawer===ZeroAddress||i[0].token===ZeroAddress||i[0].amount===BigInt(0)||i[0].timestamp===BigInt(0))throw new R(`pending withdrawal not found for ${e.recipient} at index ${e.index}`,`FLOW_RATE_ERROR`);let a=await n.withdrawalDelay(),o=Number(i[0].timestamp+a);if(o>Math.floor(Date.now()/1e3))return {pendingWithdrawal:{canWithdraw:!1,withdrawer:i[0].withdrawer,recipient:e.recipient,token:i[0].token,amount:i[0].amount,timeoutStart:Number(i[0].timestamp),timeoutEnd:o},unsignedTx:null};let s=await z(async()=>n.interface.encodeFunctionData(`finaliseQueuedWithdrawal`,[e.recipient,e.index]),`INTERNAL_ERROR`);return {pendingWithdrawal:{canWithdraw:!0,withdrawer:i[0].withdrawer,recipient:e.recipient,token:i[0].token,amount:i[0].amount,timeoutStart:Number(i[0].timestamp),timeoutEnd:o},unsignedTx:{data:s,to:this.config.bridgeContracts.rootERC20BridgeFlowRate,value:0,chainId:parseInt(this.config.bridgeInstance.rootChainID,10)}}}async getTokenMapping(e){if(e.rootToken.toUpperCase()===`NATIVE`||e.rootToken===this.config.bridgeContracts.rootChainWrappedETH){let t=this.config.bridgeContracts.childERC20Bridge,n=await(await B(t,$,this.config.childProvider)).childETHToken();return {rootToken:e.rootToken,childToken:n}}let t=this.config.bridgeContracts.rootERC20BridgeFlowRate,n=await(await B(t,Z,this.config.rootProvider)).rootTokenToChildToken(e.rootToken);return n===ZeroAddress?{rootToken:e.rootToken,childToken:null}:n===e.rootToken?{rootToken:e.rootToken,childToken:g}:{rootToken:e.rootToken,childToken:n}}};const Le=[j,M],Re=[N],ze={[r.SANDBOX]:Le,[r.PRODUCTION]:Re},Be=new Map().set(j,{rootERC20BridgeFlowRate:`0x0`,childERC20Bridge:`0x0`,rootChainIMX:`0x0`,rootChainWrappedETH:`0x0`,childChainWrappedETH:`0x0`,childChainWrappedIMX:`0x0`}).set(M,{rootERC20BridgeFlowRate:`0x0D3C59c779Fd552C27b23F723E80246c840100F5`,childERC20Bridge:`0x0D3C59c779Fd552C27b23F723E80246c840100F5`,rootChainIMX:`0xe2629e08f4125d14e446660028bD98ee60EE69F2`,rootChainWrappedETH:`0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9`,childChainWrappedETH:`0xe9E96d1aad82562b7588F03f49aD34186f996478`,childChainWrappedIMX:`0x1CcCa691501174B4A623CeDA58cC8f1a76dc3439`}).set(N,{rootERC20BridgeFlowRate:`0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6`,childERC20Bridge:`0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6`,rootChainIMX:`0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF`,rootChainWrappedETH:`0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`,childChainWrappedETH:`0x52a6c53869ce09a731cd772f245b97a4401d3348`,childChainWrappedIMX:`0x3a0c2ba54d6cbd3121f01b96dfd20e99d1696c9d`});var Ve=class{baseConfig;bridgeInstance;bridgeContracts;rootProvider;childProvider;constructor({bridgeInstance:e,rootProvider:t,childProvider:n,baseConfig:r,overrides:i}){if(this.baseConfig=r,this.bridgeInstance=e,this.rootProvider=t,this.childProvider=n,i){this.bridgeContracts=i.bridgeContracts;return}if(!ze[r.environment].includes(e)||!Be.has(e))throw Error(`Bridge instance with rootchain ${e.rootChainID} and childchain ${e.childChainID} is not supported in environment ${r.environment}`);let a=Be.get(e);if(!a)throw Error(`Bridge instance with rootchain ${e.rootChainID} and childchain ${e.childChainID} is not supported in environment ${r.environment}`);this.bridgeContracts=a;}};
|
|
9
9
|
|
|
@@ -345,7 +345,6 @@ function TransactionDetails({ transaction, environment }) {
|
|
|
345
345
|
|
|
346
346
|
function TransactionItemWithdrawPending({ label, transaction, fiatAmount, amount, icon, defaultTokenImage, environment, }) {
|
|
347
347
|
const { viewDispatch } = reactExports.useContext(ViewContext);
|
|
348
|
-
const { track } = useAnalytics();
|
|
349
348
|
const translation = useTranslation();
|
|
350
349
|
const dateNowUnixMs = reactExports.useMemo(() => new Date().getTime(), []);
|
|
351
350
|
const withdrawalReadyDate = reactExports.useMemo(() => (transaction.details.current_status.withdrawal_ready_at
|
|
@@ -398,13 +397,7 @@ function TransactionItemWithdrawPending({ label, transaction, fiatAmount, amount
|
|
|
398
397
|
},
|
|
399
398
|
borderTopRightRadius: '0',
|
|
400
399
|
borderTopLeftRadius: '0',
|
|
401
|
-
},
|
|
402
|
-
&& track({
|
|
403
|
-
userJourney: UserJourney.BRIDGE,
|
|
404
|
-
screen: 'TransactionItem',
|
|
405
|
-
control: 'Accordion',
|
|
406
|
-
controlType: 'Button',
|
|
407
|
-
}), children: [jsx(Accordion.TargetLeftSlot, { sx: { pr: 'base.spacing.x2' }, children: jsxs(MenuItem, { size: "xSmall", children: [jsx(MenuItem.FramedImage, { circularFrame: true, use: (jsx(TokenImage, { src: icon, name: label, defaultImage: defaultTokenImage })) }), jsx(MenuItem.Label, { children: label }), jsx(MenuItem.Caption, { children: translation.t('views.TRANSACTIONS.status.withdrawalPending.caption') }), jsx(MenuItem.PriceDisplay, { fiatAmount: fiatAmount, price: amount })] }) }), jsxs(Accordion.ExpandedContent, { sx: {
|
|
400
|
+
}, children: [jsx(Accordion.TargetLeftSlot, { sx: { pr: 'base.spacing.x2' }, children: jsxs(MenuItem, { size: "xSmall", children: [jsx(MenuItem.FramedImage, { circularFrame: true, use: (jsx(TokenImage, { src: icon, name: label, defaultImage: defaultTokenImage })) }), jsx(MenuItem.Label, { children: label }), jsx(MenuItem.Caption, { children: translation.t('views.TRANSACTIONS.status.withdrawalPending.caption') }), jsx(MenuItem.PriceDisplay, { fiatAmount: fiatAmount, price: amount })] }) }), jsxs(Accordion.ExpandedContent, { sx: {
|
|
408
401
|
pr: '0',
|
|
409
402
|
pl: '0',
|
|
410
403
|
mb: 'base.spacing.x3',
|
|
@@ -452,16 +445,9 @@ function ChangeWallet({ onChangeWalletClick }) {
|
|
|
452
445
|
const [walletLogoUrl, setWalletLogoUrl] = reactExports.useState(undefined);
|
|
453
446
|
const [isWalletConnect, setIsWalletConnect] = reactExports.useState(false);
|
|
454
447
|
const { isWalletConnectEnabled, getWalletLogoUrl } = useWalletConnect();
|
|
455
|
-
const { track } = useAnalytics();
|
|
456
448
|
const walletAddress = from?.walletAddress || '';
|
|
457
449
|
const walletProviderInfo = from?.walletProviderInfo;
|
|
458
450
|
const handleChangeWalletClick = () => {
|
|
459
|
-
track({
|
|
460
|
-
userJourney: UserJourney.BRIDGE,
|
|
461
|
-
screen: BridgeWidgetViews.TRANSACTIONS,
|
|
462
|
-
controlType: 'Button',
|
|
463
|
-
control: 'Pressed',
|
|
464
|
-
});
|
|
465
451
|
onChangeWalletClick();
|
|
466
452
|
};
|
|
467
453
|
reactExports.useEffect(() => {
|
|
@@ -528,7 +514,6 @@ const passportBodyStyle = {
|
|
|
528
514
|
};
|
|
529
515
|
|
|
530
516
|
function NoTransactions({ checkout, isPassport, changeWallet, }) {
|
|
531
|
-
const { page } = useAnalytics();
|
|
532
517
|
const { t } = useTranslation();
|
|
533
518
|
const [passportLink, setPassportLink] = reactExports.useState('');
|
|
534
519
|
reactExports.useEffect(() => {
|
|
@@ -536,12 +521,6 @@ function NoTransactions({ checkout, isPassport, changeWallet, }) {
|
|
|
536
521
|
return;
|
|
537
522
|
setPassportLink(PASSPORT_URL[checkout.config.environment]);
|
|
538
523
|
}, [checkout]);
|
|
539
|
-
reactExports.useEffect(() => {
|
|
540
|
-
page({
|
|
541
|
-
userJourney: UserJourney.BRIDGE,
|
|
542
|
-
screen: 'NoTransactions',
|
|
543
|
-
});
|
|
544
|
-
}, []);
|
|
545
524
|
return (jsxs(Box, { sx: containerStyles$2, children: [jsx(ChangeWallet, { onChangeWalletClick: changeWallet }), jsxs(Box, { sx: noTransactionsContainerStyle, children: [jsx(Body, { size: "small", sx: noTransactionsBodyStyle, children: t('views.TRANSACTIONS.status.noTransactions.body') }), jsx(Body, { size: "small", sx: noTransactionsBodyStyle, children: "Can't find your pending withdrawal? Try connecting with your L1 wallet." }), isPassport && (jsxs(Body, { size: "small", sx: passportBodyStyle, children: [t('views.TRANSACTIONS.status.noTransactions.passport.body'), ' ', jsx(Link, { size: "small", rc: jsx("a", { target: "_blank", href: passportLink, rel: "noreferrer" }), children: t('views.TRANSACTIONS.status.noTransactions.passport.link') })] }))] })] }));
|
|
546
525
|
}
|
|
547
526
|
|
|
@@ -580,9 +559,7 @@ function Transactions({ defaultTokenImage, onBackButtonClick, themeOverrides, })
|
|
|
580
559
|
const { eventTargetState: { eventTarget }, } = reactExports.useContext(EventTargetContext);
|
|
581
560
|
const { cryptoFiatDispatch } = reactExports.useContext(CryptoFiatContext);
|
|
582
561
|
const { bridgeDispatch, bridgeState: { checkout, from, tokenBridge }, } = reactExports.useContext(BridgeContext);
|
|
583
|
-
const { page } = useAnalytics();
|
|
584
562
|
const { t } = useTranslation();
|
|
585
|
-
const { track } = useAnalytics();
|
|
586
563
|
const [loading, setLoading] = reactExports.useState(true);
|
|
587
564
|
const [knownTokenMap, setKnownTokenMap] = reactExports.useState(undefined);
|
|
588
565
|
const [txs, setTxs] = reactExports.useState([]);
|
|
@@ -699,15 +676,6 @@ function Transactions({ defaultTokenImage, onBackButtonClick, themeOverrides, })
|
|
|
699
676
|
return { [rootChainName]: rootData, [childChainName]: childData };
|
|
700
677
|
}, [checkout, cryptoFiatDispatch, rootChainTokensHashmap, childChainTokensHashmap]);
|
|
701
678
|
const handleWalletChange = reactExports.useCallback(async (event) => {
|
|
702
|
-
track({
|
|
703
|
-
userJourney: UserJourney.BRIDGE,
|
|
704
|
-
screen: 'EmptyStateNotConnected',
|
|
705
|
-
control: 'WalletProvider',
|
|
706
|
-
controlType: 'Select',
|
|
707
|
-
extras: {
|
|
708
|
-
walletProviderName: event.providerDetail.info.name,
|
|
709
|
-
},
|
|
710
|
-
});
|
|
711
679
|
try {
|
|
712
680
|
let changeAccount = false;
|
|
713
681
|
if (event.providerDetail.info.rdns === WalletProviderRdns.METAMASK) {
|
|
@@ -740,7 +708,7 @@ function Transactions({ defaultTokenImage, onBackButtonClick, themeOverrides, })
|
|
|
740
708
|
finally {
|
|
741
709
|
setShowWalletDrawer(false);
|
|
742
710
|
}
|
|
743
|
-
}, [checkout, bridgeDispatch
|
|
711
|
+
}, [checkout, bridgeDispatch]);
|
|
744
712
|
const handleBackButtonClick = () => {
|
|
745
713
|
if (from) {
|
|
746
714
|
bridgeDispatch({
|
|
@@ -802,12 +770,6 @@ function Transactions({ defaultTokenImage, onBackButtonClick, themeOverrides, })
|
|
|
802
770
|
setLoading(false);
|
|
803
771
|
})();
|
|
804
772
|
}, [from, checkout, fetchData]);
|
|
805
|
-
reactExports.useEffect(() => {
|
|
806
|
-
page({
|
|
807
|
-
userJourney: UserJourney.BRIDGE,
|
|
808
|
-
screen: 'Transactions',
|
|
809
|
-
});
|
|
810
|
-
}, [page]);
|
|
811
773
|
return (jsx(SimpleLayout, { testId: "bridge-view", header: (jsx(HeaderNavigation, { showBack: true, onBackButtonClick: handleBackButtonClick, title: t('views.TRANSACTIONS.layoutHeading'), onCloseButtonClick: () => sendBridgeWidgetCloseEvent(eventTarget) })), footer: jsx(FooterLogo, {}), children: jsxs(Box, { sx: transactionsContainerStyle, children: [jsxs(Box, { sx: transactionsListContainerStyle, children: [!from?.browserProvider && (jsx(EmptyStateNotConnected, { openWalletDrawer: () => setShowWalletDrawer(true) })), from?.browserProvider && loading && jsx(Shimmer, {}), from?.browserProvider
|
|
812
774
|
&& !loading
|
|
813
775
|
&& txs.length > 0
|
|
@@ -821,13 +783,6 @@ function Transactions({ defaultTokenImage, onBackButtonClick, themeOverrides, })
|
|
|
821
783
|
function ClaimWithdrawalInProgress({ transactionResponse }) {
|
|
822
784
|
const { t } = useTranslation();
|
|
823
785
|
const { viewDispatch } = reactExports.useContext(ViewContext);
|
|
824
|
-
const { page } = useAnalytics();
|
|
825
|
-
reactExports.useEffect(() => {
|
|
826
|
-
page({
|
|
827
|
-
userJourney: UserJourney.BRIDGE,
|
|
828
|
-
screen: 'ClaimWithdrawalInProgress',
|
|
829
|
-
});
|
|
830
|
-
}, []);
|
|
831
786
|
reactExports.useEffect(() => {
|
|
832
787
|
if (!transactionResponse)
|
|
833
788
|
return;
|
|
@@ -987,7 +942,6 @@ function WalletAndNetworkSelector({ themeOverrides }) {
|
|
|
987
942
|
const { viewDispatch } = reactExports.useContext(ViewContext);
|
|
988
943
|
const { providers } = useInjectedProviders({ checkout });
|
|
989
944
|
const { environment } = checkout.config;
|
|
990
|
-
const { track } = useAnalytics();
|
|
991
945
|
// add default state from context values
|
|
992
946
|
// if user has clicked back button
|
|
993
947
|
const defaultFromBrowserProvider = from?.browserProvider ?? null;
|
|
@@ -1076,28 +1030,10 @@ function WalletAndNetworkSelector({ themeOverrides }) {
|
|
|
1076
1030
|
setFromWalletBrowserProvider(provider);
|
|
1077
1031
|
const address = await (await provider.getSigner()).getAddress();
|
|
1078
1032
|
setFromWalletAddress(address.toLowerCase());
|
|
1079
|
-
track({
|
|
1080
|
-
userJourney: UserJourney.BRIDGE,
|
|
1081
|
-
screen: 'WalletAndNetwork',
|
|
1082
|
-
control: 'FromWallet',
|
|
1083
|
-
controlType: 'Select',
|
|
1084
|
-
extras: {
|
|
1085
|
-
walletAddress: address.toLowerCase(),
|
|
1086
|
-
},
|
|
1087
|
-
});
|
|
1088
1033
|
/** if Passport skip from network selector and default to zkEVM */
|
|
1089
1034
|
if (isPassportProvider(provider)) {
|
|
1090
1035
|
setFromNetwork(imtblZkEvmNetworkChainId);
|
|
1091
1036
|
setFromWalletDrawerOpen(false);
|
|
1092
|
-
track({
|
|
1093
|
-
userJourney: UserJourney.BRIDGE,
|
|
1094
|
-
screen: 'WalletAndNetwork',
|
|
1095
|
-
control: 'FromNetwork',
|
|
1096
|
-
controlType: 'Select',
|
|
1097
|
-
extras: {
|
|
1098
|
-
chainId: imtblZkEvmNetworkChainId,
|
|
1099
|
-
},
|
|
1100
|
-
});
|
|
1101
1037
|
return;
|
|
1102
1038
|
}
|
|
1103
1039
|
/**
|
|
@@ -1128,30 +1064,12 @@ function WalletAndNetworkSelector({ themeOverrides }) {
|
|
|
1128
1064
|
clearToWalletSelections();
|
|
1129
1065
|
setFromNetworkDrawerOpen(false);
|
|
1130
1066
|
setFromNetwork(chainId);
|
|
1131
|
-
track({
|
|
1132
|
-
userJourney: UserJourney.BRIDGE,
|
|
1133
|
-
screen: 'WalletAndNetwork',
|
|
1134
|
-
control: 'FromNetwork',
|
|
1135
|
-
controlType: 'Select',
|
|
1136
|
-
extras: {
|
|
1137
|
-
chainId,
|
|
1138
|
-
},
|
|
1139
|
-
});
|
|
1140
1067
|
}, [checkout, fromWalletBrowserProvider]);
|
|
1141
1068
|
const handleToNetworkSelection = reactExports.useCallback(async (chainId) => {
|
|
1142
1069
|
if (!toWalletBrowserProvider)
|
|
1143
1070
|
return;
|
|
1144
1071
|
setToNetworkDrawerOpen(false);
|
|
1145
1072
|
setToNetwork(chainId);
|
|
1146
|
-
track({
|
|
1147
|
-
userJourney: UserJourney.BRIDGE,
|
|
1148
|
-
screen: 'WalletAndNetwork',
|
|
1149
|
-
control: 'ToNetwork',
|
|
1150
|
-
controlType: 'Select',
|
|
1151
|
-
extras: {
|
|
1152
|
-
chainId,
|
|
1153
|
-
},
|
|
1154
|
-
});
|
|
1155
1073
|
}, [checkout, toWalletBrowserProvider]);
|
|
1156
1074
|
const handleSettingToNetwork = reactExports.useCallback((toAddress) => {
|
|
1157
1075
|
// If the toWallet is Passport the toNetwork can only be L2
|
|
@@ -1161,15 +1079,6 @@ function WalletAndNetworkSelector({ themeOverrides }) {
|
|
|
1161
1079
|
: imtblZkEvmNetworkChainId;
|
|
1162
1080
|
setToNetwork(theToNetwork);
|
|
1163
1081
|
setToWalletDrawerOpen(false);
|
|
1164
|
-
track({
|
|
1165
|
-
userJourney: UserJourney.BRIDGE,
|
|
1166
|
-
screen: 'WalletAndNetwork',
|
|
1167
|
-
control: 'ToNetwork',
|
|
1168
|
-
controlType: 'Select',
|
|
1169
|
-
extras: {
|
|
1170
|
-
chainId: theToNetwork,
|
|
1171
|
-
},
|
|
1172
|
-
});
|
|
1173
1082
|
}, [fromWalletAddress, fromNetwork]);
|
|
1174
1083
|
const handleWalletConnectToWalletConnection = reactExports.useCallback(async (provider) => {
|
|
1175
1084
|
setToWalletBrowserProvider(provider);
|
|
@@ -1179,15 +1088,6 @@ function WalletAndNetworkSelector({ themeOverrides }) {
|
|
|
1179
1088
|
.then((address) => {
|
|
1180
1089
|
setToWalletAddress(address.toLowerCase());
|
|
1181
1090
|
handleSettingToNetwork(address.toLowerCase());
|
|
1182
|
-
track({
|
|
1183
|
-
userJourney: UserJourney.BRIDGE,
|
|
1184
|
-
screen: 'WalletAndNetwork',
|
|
1185
|
-
control: 'ToWallet',
|
|
1186
|
-
controlType: 'Select',
|
|
1187
|
-
extras: {
|
|
1188
|
-
walletAddress: address.toLowerCase(),
|
|
1189
|
-
},
|
|
1190
|
-
});
|
|
1191
1091
|
});
|
|
1192
1092
|
}, [handleSettingToNetwork]);
|
|
1193
1093
|
const handleToWalletSelection = reactExports.useCallback(async (event) => {
|
|
@@ -1198,15 +1098,6 @@ function WalletAndNetworkSelector({ themeOverrides }) {
|
|
|
1198
1098
|
const address = await (await fromWalletBrowserProvider.getSigner()).getAddress();
|
|
1199
1099
|
setToWalletAddress(address.toLowerCase());
|
|
1200
1100
|
handleSettingToNetwork(address.toLowerCase());
|
|
1201
|
-
track({
|
|
1202
|
-
userJourney: UserJourney.BRIDGE,
|
|
1203
|
-
screen: 'WalletAndNetwork',
|
|
1204
|
-
control: 'ToWallet',
|
|
1205
|
-
controlType: 'Select',
|
|
1206
|
-
extras: {
|
|
1207
|
-
walletAddress: address.toLowerCase(),
|
|
1208
|
-
},
|
|
1209
|
-
});
|
|
1210
1101
|
return;
|
|
1211
1102
|
}
|
|
1212
1103
|
try {
|
|
@@ -1221,15 +1112,6 @@ function WalletAndNetworkSelector({ themeOverrides }) {
|
|
|
1221
1112
|
setToWalletBrowserProvider(connectedProvider);
|
|
1222
1113
|
setToWalletAddress(address.toLowerCase());
|
|
1223
1114
|
handleSettingToNetwork(address.toLowerCase());
|
|
1224
|
-
track({
|
|
1225
|
-
userJourney: UserJourney.BRIDGE,
|
|
1226
|
-
screen: 'WalletAndNetwork',
|
|
1227
|
-
control: 'ToWallet',
|
|
1228
|
-
controlType: 'Select',
|
|
1229
|
-
extras: {
|
|
1230
|
-
walletAddress: address.toLowerCase(),
|
|
1231
|
-
},
|
|
1232
|
-
});
|
|
1233
1115
|
}
|
|
1234
1116
|
}
|
|
1235
1117
|
catch (error) {
|
|
@@ -1277,33 +1159,6 @@ function WalletAndNetworkSelector({ themeOverrides }) {
|
|
|
1277
1159
|
},
|
|
1278
1160
|
},
|
|
1279
1161
|
});
|
|
1280
|
-
track({
|
|
1281
|
-
userJourney: UserJourney.BRIDGE,
|
|
1282
|
-
screen: 'WalletAndNetwork',
|
|
1283
|
-
control: 'Next',
|
|
1284
|
-
controlType: 'Button',
|
|
1285
|
-
extras: {
|
|
1286
|
-
fromWalletAddress,
|
|
1287
|
-
fromNetwork,
|
|
1288
|
-
fromWallet: {
|
|
1289
|
-
address: fromWalletAddress,
|
|
1290
|
-
rdns: fromWallet?.providerDetail.info.rdns,
|
|
1291
|
-
uuid: fromWallet?.providerDetail.info.uuid,
|
|
1292
|
-
isPassportWallet: isPassportProvider(fromWalletBrowserProvider),
|
|
1293
|
-
isMetaMask: isMetaMaskProvider(fromWalletBrowserProvider),
|
|
1294
|
-
},
|
|
1295
|
-
toWalletAddress,
|
|
1296
|
-
toNetwork,
|
|
1297
|
-
toWallet: {
|
|
1298
|
-
address: toWalletAddress,
|
|
1299
|
-
rdns: toWallet?.providerDetail.info.rdns,
|
|
1300
|
-
uuid: toWallet?.providerDetail.info.uuid,
|
|
1301
|
-
isPassportWallet: isPassportProvider(toWalletBrowserProvider),
|
|
1302
|
-
isMetaMask: isMetaMaskProvider(toWalletBrowserProvider),
|
|
1303
|
-
},
|
|
1304
|
-
moveType: fromNetwork && fromNetwork === toNetwork ? 'transfer' : 'bridge',
|
|
1305
|
-
},
|
|
1306
|
-
});
|
|
1307
1162
|
viewDispatch({
|
|
1308
1163
|
payload: {
|
|
1309
1164
|
type: ViewActions.UPDATE_VIEW,
|
|
@@ -1359,13 +1214,6 @@ function WalletNetworkSelectionView({ showBackButton, themeOverrides, }) {
|
|
|
1359
1214
|
const { t } = useTranslation();
|
|
1360
1215
|
const { viewDispatch } = reactExports.useContext(ViewContext);
|
|
1361
1216
|
const { eventTargetState: { eventTarget } } = reactExports.useContext(EventTargetContext);
|
|
1362
|
-
const { page } = useAnalytics();
|
|
1363
|
-
reactExports.useEffect(() => {
|
|
1364
|
-
page({
|
|
1365
|
-
userJourney: UserJourney.BRIDGE,
|
|
1366
|
-
screen: 'WalletNetworkSelection',
|
|
1367
|
-
});
|
|
1368
|
-
}, []);
|
|
1369
1217
|
return (jsx(SimpleLayout, { testId: "bridge-view", header: (jsx(HeaderNavigation, { title: t('views.WALLET_NETWORK_SELECTION.layoutHeading'), onCloseButtonClick: () => sendBridgeWidgetCloseEvent(eventTarget), rightActions: (jsx(ButtCon, { icon: "Minting", sx: ButtonNavigationStyles(), onClick: () => {
|
|
1370
1218
|
viewDispatch({
|
|
1371
1219
|
payload: {
|
|
@@ -1455,7 +1303,6 @@ function BridgeForm(props) {
|
|
|
1455
1303
|
const { cryptoFiatState, cryptoFiatDispatch } = reactExports.useContext(CryptoFiatContext);
|
|
1456
1304
|
const { viewDispatch } = reactExports.useContext(ViewContext);
|
|
1457
1305
|
const { testId, defaultAmount, defaultTokenAddress, isTokenBalancesLoading, defaultTokenImage, environment, theme, themeOverrides, } = props;
|
|
1458
|
-
const { track } = useAnalytics();
|
|
1459
1306
|
// Form state
|
|
1460
1307
|
const [formAmount, setFormAmount] = reactExports.useState(defaultAmount || '');
|
|
1461
1308
|
const [amountError, setAmountError] = reactExports.useState('');
|
|
@@ -1652,16 +1499,6 @@ function BridgeForm(props) {
|
|
|
1652
1499
|
},
|
|
1653
1500
|
});
|
|
1654
1501
|
}
|
|
1655
|
-
track({
|
|
1656
|
-
userJourney: UserJourney.BRIDGE,
|
|
1657
|
-
screen: 'TokenAmount',
|
|
1658
|
-
control: 'Review',
|
|
1659
|
-
controlType: 'Button',
|
|
1660
|
-
extras: {
|
|
1661
|
-
tokenAddress: formToken.token.address,
|
|
1662
|
-
amount: formAmount,
|
|
1663
|
-
},
|
|
1664
|
-
});
|
|
1665
1502
|
bridgeDispatch({
|
|
1666
1503
|
payload: {
|
|
1667
1504
|
type: BridgeActions.SET_TOKEN_AND_AMOUNT,
|
|
@@ -1685,14 +1522,13 @@ function BridgeForm(props) {
|
|
|
1685
1522
|
formToken,
|
|
1686
1523
|
from,
|
|
1687
1524
|
getRiskAssessment,
|
|
1688
|
-
track,
|
|
1689
1525
|
viewDispatch,
|
|
1690
1526
|
]);
|
|
1691
1527
|
const retrySubmitBridgeValues = async () => {
|
|
1692
1528
|
setShowTxnRejectedState(false);
|
|
1693
1529
|
await submitBridgeValues();
|
|
1694
1530
|
};
|
|
1695
|
-
return (jsxs(Box, { testId: testId, sx: bridgeFormWrapperStyles, children: [jsxs(Box, { sx: { paddingX: 'base.spacing.x4' }, children: [jsx(Heading, { testId: `${testId}-content-heading`, size: "small", weight: "regular", sx: { paddingBottom: 'base.spacing.x4' }, children: t('views.BRIDGE_FORM.content.title') }), (!defaultTokenAddress || !isTokenBalancesLoading) && (jsxs(Box, { sx: formInputsContainerStyles, children: [jsx(SelectForm, {
|
|
1531
|
+
return (jsxs(Box, { testId: testId, sx: bridgeFormWrapperStyles, children: [jsxs(Box, { sx: { paddingX: 'base.spacing.x4' }, children: [jsx(Heading, { testId: `${testId}-content-heading`, size: "small", weight: "regular", sx: { paddingBottom: 'base.spacing.x4' }, children: t('views.BRIDGE_FORM.content.title') }), (!defaultTokenAddress || !isTokenBalancesLoading) && (jsxs(Box, { sx: formInputsContainerStyles, children: [jsx(SelectForm, { testId: "bridge-token", options: tokensOptions, optionsLoading: isTokenBalancesLoading, coinSelectorHeading: t('views.BRIDGE_FORM.bridgeForm.from.selectorTitle'), selectedOption: selectedOption, subtext: tokenBalanceSubtext, textAlign: "left", errorMessage: t(tokenError), onSelectChange: (option) => handleSelectTokenChange(option), defaultTokenImage: defaultTokenImage, environment: environment, theme: theme, themeOverrides: themeOverrides }), jsx(TextInputForm, { testId: "bridge-amount", type: "number", value: formAmount, placeholder: t('views.BRIDGE_FORM.bridgeForm.from.inputPlaceholder'), subtext: `${t('views.BRIDGE_FORM.content.fiatPricePrefix')} $${formatZeroAmount(amountFiatValue, true)}`, validator: amountInputValidation, onTextInputChange: (value) => handleBridgeAmountChange(value), onTextInputEnter: submitBridgeValues, textAlign: "right", inputMode: "decimal", errorMessage: t(amountError) })] })), defaultTokenAddress && isTokenBalancesLoading && (jsx(TokenSelectShimmer, { sx: formInputsContainerStyles }))] }), jsxs(Box, { sx: bridgeFormButtonContainerStyles, children: [jsx(Button, { testId: `${testId}-button`, variant: "primary", onClick: submitBridgeValues, size: "large", children: t('views.BRIDGE_FORM.bridgeForm.buttonText') }), jsx(TransactionRejected, { visible: showTxnRejectedState, showHeaderBar: false, onCloseDrawer: () => setShowTxnRejectedState(false), onRetry: retrySubmitBridgeValues })] })] }));
|
|
1696
1532
|
}
|
|
1697
1533
|
|
|
1698
1534
|
const REFRESH_TOKENS_INTERVAL_MS = 10000;
|
|
@@ -1703,19 +1539,7 @@ function Bridge({ amount, tokenAddress, defaultTokenImage, theme, themeOverrides
|
|
|
1703
1539
|
const { eventTargetState: { eventTarget } } = reactExports.useContext(EventTargetContext);
|
|
1704
1540
|
const [isTokenBalancesLoading, setIsTokenBalancesLoading] = reactExports.useState(false);
|
|
1705
1541
|
const showBackButton = true;
|
|
1706
|
-
|
|
1707
|
-
reactExports.useEffect(() => {
|
|
1708
|
-
if (amount || tokenAddress) {
|
|
1709
|
-
page({
|
|
1710
|
-
userJourney: UserJourney.BRIDGE,
|
|
1711
|
-
screen: 'TokenAmount',
|
|
1712
|
-
extras: {
|
|
1713
|
-
amount,
|
|
1714
|
-
tokenAddress,
|
|
1715
|
-
},
|
|
1716
|
-
});
|
|
1717
|
-
}
|
|
1718
|
-
}, []);
|
|
1542
|
+
reactExports.useEffect(() => { }, []);
|
|
1719
1543
|
// This is used to refresh the balances after the Bridge widget
|
|
1720
1544
|
// has been loaded so that processing transfers will be eventually
|
|
1721
1545
|
// reflected.
|
|
@@ -2000,7 +1824,6 @@ function BridgeReviewSummary() {
|
|
|
2000
1824
|
const { viewDispatch } = reactExports.useContext(ViewContext);
|
|
2001
1825
|
const { bridgeState: { checkout, tokenBridge, from, to, token, amount, tokenBalances, riskAssessment, }, bridgeDispatch, } = reactExports.useContext(BridgeContext);
|
|
2002
1826
|
const { environment } = checkout.config;
|
|
2003
|
-
const { track } = useAnalytics();
|
|
2004
1827
|
const { cryptoFiatState } = reactExports.useContext(CryptoFiatContext);
|
|
2005
1828
|
const [loading, setLoading] = reactExports.useState(false);
|
|
2006
1829
|
const [estimates, setEstimates] = reactExports.useState(undefined);
|
|
@@ -2260,36 +2083,6 @@ function BridgeReviewSummary() {
|
|
|
2260
2083
|
// eslint-disable-next-line no-console
|
|
2261
2084
|
console.error('Current network check failed', err);
|
|
2262
2085
|
}
|
|
2263
|
-
track({
|
|
2264
|
-
userJourney: UserJourney.BRIDGE,
|
|
2265
|
-
screen: 'Summary',
|
|
2266
|
-
control: 'Submit',
|
|
2267
|
-
controlType: 'Button',
|
|
2268
|
-
extras: {
|
|
2269
|
-
fromWalletAddress: fromAddress,
|
|
2270
|
-
fromNetwork,
|
|
2271
|
-
fromWallet: {
|
|
2272
|
-
address: fromAddress,
|
|
2273
|
-
rdns: from?.walletProviderInfo?.rdns,
|
|
2274
|
-
uuid: from?.walletProviderInfo?.uuid,
|
|
2275
|
-
isPassportWallet: isPassportProvider(from?.browserProvider),
|
|
2276
|
-
isMetaMask: isMetaMaskProvider(from?.browserProvider),
|
|
2277
|
-
},
|
|
2278
|
-
toWalletAddress: toAddress,
|
|
2279
|
-
toNetwork,
|
|
2280
|
-
toWallet: {
|
|
2281
|
-
address: toAddress,
|
|
2282
|
-
rdns: to?.walletProviderInfo?.rdns,
|
|
2283
|
-
uuid: to?.walletProviderInfo?.uuid,
|
|
2284
|
-
isPassportWallet: isPassportProvider(to?.browserProvider),
|
|
2285
|
-
isMetaMask: isMetaMaskProvider(to?.browserProvider),
|
|
2286
|
-
},
|
|
2287
|
-
amount,
|
|
2288
|
-
fiatAmount: fromFiatAmount,
|
|
2289
|
-
tokenAddress: token?.address,
|
|
2290
|
-
moveType: isTransfer ? 'transfer' : 'bridge',
|
|
2291
|
-
},
|
|
2292
|
-
});
|
|
2293
2086
|
viewDispatch({
|
|
2294
2087
|
payload: {
|
|
2295
2088
|
type: ViewActions.UPDATE_VIEW,
|
|
@@ -2315,14 +2108,7 @@ function BridgeReviewSummary() {
|
|
|
2315
2108
|
color: 'base.color.text.body.secondary',
|
|
2316
2109
|
}, children: abbreviateAddress(fromAddress ?? '') })] }), fromNetwork && (jsx(MenuItem.FramedImage, { use: (jsx("img", { src: getChainImage(environment, fromNetwork), alt: networkName[fromNetwork] })), sx: networkIconStyles }))] }), jsx(Box, { sx: arrowIconWrapperStyles, children: jsx(Icon, { icon: "ArrowBackward", sx: arrowIconStyles }) }), jsxs(MenuItem, { testId: `${testId}-to-address`, size: "xSmall", emphasized: true, sx: topMenuItemStyles, children: [(toWalletIsWalletConnect && toWalletLogoUrl) ? (jsxs(Fragment, { children: [jsx(MenuItem.FramedImage, { imageUrl: toWalletLogoUrl, alt: "walletconnect", sx: wcWalletLogoStyles }), jsx(Logo, { logo: "WalletConnectSymbol", sx: wcStickerLogoStyles })] })) : (to?.walletProviderInfo && (jsx(RawImage, { src: to?.walletProviderInfo.icon, alt: to?.walletProviderInfo.name, sx: rawImageStyle }))), jsxs(MenuItem.Label, { sx: { marginLeft: (toWalletIsWalletConnect && toWalletLogoUrl) ? '0px' : '45px' }, children: [jsx("strong", { children: t('views.BRIDGE_REVIEW.toLabel.heading') }), ' ', jsx(Body, { size: "small", sx: {
|
|
2317
2110
|
color: 'base.color.text.body.secondary',
|
|
2318
|
-
}, children: abbreviateAddress(toAddress ?? '') })] }), toNetwork && (jsx(MenuItem.FramedImage, { use: (jsx("img", { src: getChainImage(environment, toNetwork), alt: networkName[toNetwork] })), sx: networkIconStyles }))] }), jsx(Fees, { gasFeeValue: gasFee, gasFeeFiatValue: gasFeeFiatValue, gasFeeToken: estimates?.token, fees: formatFeeBreakdown(),
|
|
2319
|
-
track({
|
|
2320
|
-
userJourney: UserJourney.BRIDGE,
|
|
2321
|
-
screen: 'MoveCoins',
|
|
2322
|
-
control: 'ViewFees',
|
|
2323
|
-
controlType: 'Button',
|
|
2324
|
-
});
|
|
2325
|
-
}, sx: { borderTopRightRadius: '0', borderTopLeftRadius: '0' }, loading: loading }), jsx(Box, { sx: {
|
|
2111
|
+
}, children: abbreviateAddress(toAddress ?? '') })] }), toNetwork && (jsx(MenuItem.FramedImage, { use: (jsx("img", { src: getChainImage(environment, toNetwork), alt: networkName[toNetwork] })), sx: networkIconStyles }))] }), jsx(Fees, { gasFeeValue: gasFee, gasFeeFiatValue: gasFeeFiatValue, gasFeeToken: estimates?.token, fees: formatFeeBreakdown(), sx: { borderTopRightRadius: '0', borderTopLeftRadius: '0' }, loading: loading }), jsx(Box, { sx: {
|
|
2326
2112
|
flex: 1,
|
|
2327
2113
|
display: 'flex',
|
|
2328
2114
|
flexDirection: 'column',
|
|
@@ -2358,13 +2144,6 @@ function BridgeReviewSummary() {
|
|
|
2358
2144
|
function BridgeReview() {
|
|
2359
2145
|
const { t } = useTranslation();
|
|
2360
2146
|
const { eventTargetState: { eventTarget } } = reactExports.useContext(EventTargetContext);
|
|
2361
|
-
const { page } = useAnalytics();
|
|
2362
|
-
reactExports.useEffect(() => {
|
|
2363
|
-
page({
|
|
2364
|
-
userJourney: UserJourney.BRIDGE,
|
|
2365
|
-
screen: 'Review',
|
|
2366
|
-
});
|
|
2367
|
-
}, []);
|
|
2368
2147
|
return (jsx(SimpleLayout, { testId: "bridge-review", header: (jsx(HeaderNavigation, { showBack: true, title: t('views.BRIDGE_REVIEW.layoutHeading'), onCloseButtonClick: () => sendBridgeWidgetCloseEvent(eventTarget) })), footer: (jsx(FooterLogo, {})), children: jsx(BridgeReviewSummary, {}) }));
|
|
2369
2148
|
}
|
|
2370
2149
|
|
|
@@ -2385,25 +2164,10 @@ function RocketHero({ environment }) {
|
|
|
2385
2164
|
function MoveInProgress({ transactionHash, isTransfer }) {
|
|
2386
2165
|
const { t } = useTranslation();
|
|
2387
2166
|
const { eventTargetState: { eventTarget } } = reactExports.useContext(EventTargetContext);
|
|
2388
|
-
const { page } = useAnalytics();
|
|
2389
|
-
const { cryptoFiatState } = reactExports.useContext(CryptoFiatContext);
|
|
2390
2167
|
const { viewDispatch } = reactExports.useContext(ViewContext);
|
|
2391
|
-
const { bridgeState: { checkout,
|
|
2168
|
+
const { bridgeState: { checkout, }, } = reactExports.useContext(BridgeContext);
|
|
2392
2169
|
reactExports.useEffect(() => {
|
|
2393
2170
|
sendBridgeTransactionSentEvent(eventTarget, transactionHash);
|
|
2394
|
-
const fiatAmount = calculateCryptoToFiat(amount, token?.symbol ?? '', cryptoFiatState.conversions);
|
|
2395
|
-
page({
|
|
2396
|
-
userJourney: UserJourney.BRIDGE,
|
|
2397
|
-
screen: 'InProgress',
|
|
2398
|
-
extras: {
|
|
2399
|
-
fromWalletAddress: from?.walletAddress,
|
|
2400
|
-
toWalletAddress: to?.walletAddress,
|
|
2401
|
-
amount,
|
|
2402
|
-
fiatAmount,
|
|
2403
|
-
tokenAddress: token?.address,
|
|
2404
|
-
moveType: isTransfer ? 'transfer' : 'bridge',
|
|
2405
|
-
},
|
|
2406
|
-
});
|
|
2407
2171
|
}, []);
|
|
2408
2172
|
return (jsx(SimpleLayout, { testId: "move-in-progress-view", header: (jsx(HeaderNavigation, { transparent: true, onCloseButtonClick: () => sendBridgeWidgetCloseEvent(eventTarget), rightActions: (jsxs(Fragment, { children: [jsx(ButtCon, { icon: "Minting", sx: ButtonNavigationStyles(), onClick: () => {
|
|
2409
2173
|
viewDispatch({
|
|
@@ -2426,16 +2190,6 @@ function ApproveTransaction({ bridgeTransaction }) {
|
|
|
2426
2190
|
const { checkout, from, to, token, amount, } = bridgeState;
|
|
2427
2191
|
const { viewDispatch } = reactExports.useContext(ViewContext);
|
|
2428
2192
|
const { eventTargetState: { eventTarget } } = reactExports.useContext(EventTargetContext);
|
|
2429
|
-
const { page } = useAnalytics();
|
|
2430
|
-
reactExports.useEffect(() => {
|
|
2431
|
-
page({
|
|
2432
|
-
userJourney: UserJourney.BRIDGE,
|
|
2433
|
-
screen: 'ApproveTransaction',
|
|
2434
|
-
extras: {
|
|
2435
|
-
moveType: bridgeTransaction ? 'bridge' : 'transfer',
|
|
2436
|
-
},
|
|
2437
|
-
});
|
|
2438
|
-
}, []);
|
|
2439
2193
|
// Local state
|
|
2440
2194
|
const [actionDisabled, setActionDisabled] = reactExports.useState(false);
|
|
2441
2195
|
const [txProcessing, setTxProcessing] = reactExports.useState(false);
|
|
@@ -2702,13 +2456,6 @@ function ClaimWithdrawal({ transaction }) {
|
|
|
2702
2456
|
const { bridgeState: { checkout, tokenBridge, from } } = reactExports.useContext(BridgeContext);
|
|
2703
2457
|
const { viewDispatch } = reactExports.useContext(ViewContext);
|
|
2704
2458
|
const { eventTargetState: { eventTarget } } = reactExports.useContext(EventTargetContext);
|
|
2705
|
-
const { page } = useAnalytics();
|
|
2706
|
-
reactExports.useEffect(() => {
|
|
2707
|
-
page({
|
|
2708
|
-
userJourney: UserJourney.BRIDGE,
|
|
2709
|
-
screen: 'ClaimWithdrawal',
|
|
2710
|
-
});
|
|
2711
|
-
}, []);
|
|
2712
2459
|
const [txProcessing, setTxProcessing] = reactExports.useState(false);
|
|
2713
2460
|
const [loading, setLoading] = reactExports.useState(false);
|
|
2714
2461
|
const [hasWithdrawError, setHasWithdrawError] = reactExports.useState(false);
|
|
@@ -2893,7 +2640,6 @@ function BridgeWidget({ checkout, browserProvider, config, amount, tokenAddress,
|
|
|
2893
2640
|
const { environment, isOnRampEnabled, isSwapEnabled, isBridgeEnabled, theme, themeOverrides, } = config;
|
|
2894
2641
|
const defaultTokenImage = getDefaultTokenImage(checkout.config.environment, theme);
|
|
2895
2642
|
const { eventTargetState: { eventTarget } } = reactExports.useContext(EventTargetContext);
|
|
2896
|
-
const { page } = useAnalytics();
|
|
2897
2643
|
const [viewState, viewDispatch] = reactExports.useReducer(viewReducer, {
|
|
2898
2644
|
...initialViewState,
|
|
2899
2645
|
view: { type: BridgeWidgetViews.WALLET_NETWORK_SELECTION },
|
|
@@ -2988,39 +2734,12 @@ function BridgeWidget({ checkout, browserProvider, config, amount, tokenAddress,
|
|
|
2988
2734
|
if (viewState.view.type === BridgeWidgetViews.BRIDGE_FAILURE) {
|
|
2989
2735
|
reason = viewState.view.reason;
|
|
2990
2736
|
}
|
|
2991
|
-
page({
|
|
2992
|
-
userJourney: UserJourney.BRIDGE,
|
|
2993
|
-
screen: 'Failed',
|
|
2994
|
-
extras: {
|
|
2995
|
-
reason,
|
|
2996
|
-
},
|
|
2997
|
-
});
|
|
2998
2737
|
sendBridgeFailedEvent(eventTarget, reason);
|
|
2999
2738
|
} })), viewState.view.type === BridgeWidgetViews.APPROVE_TRANSACTION && (jsx(ApproveTransaction, { bridgeTransaction: viewState.view.approveTransaction && viewState.view.transaction
|
|
3000
2739
|
? { approveTransaction: viewState.view.approveTransaction, transaction: viewState.view.transaction }
|
|
3001
|
-
: undefined })), viewState.view.type === BridgeWidgetViews.TRANSACTIONS && (jsx(Transactions, { onBackButtonClick: goBackToWalletNetworkSelector, defaultTokenImage: defaultTokenImage, themeOverrides: themeOverrides })), viewState.view.type === BridgeWidgetViews.CLAIM_WITHDRAWAL && (jsx(ClaimWithdrawal, { transaction: viewState.view.transaction })), viewState.view.type === SharedViews.ERROR_VIEW && (jsx(ErrorView, { actionText: t('views.ERROR_VIEW.actionText'), onActionClick: goBackToWalletNetworkSelectorClearState, onCloseClick: () => sendBridgeWidgetCloseEvent(eventTarget),
|
|
3002
|
-
page({
|
|
3003
|
-
userJourney: UserJourney.BRIDGE,
|
|
3004
|
-
screen: 'Error',
|
|
3005
|
-
});
|
|
3006
|
-
} })), viewState.view.type === SharedViews.TOP_UP_VIEW && (jsx(TopUpView, { analytics: { userJourney: UserJourney.BRIDGE }, widgetEvent: IMTBLWidgetEvents.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: () => {
|
|
3007
|
-
page({
|
|
3008
|
-
userJourney: UserJourney.BRIDGE,
|
|
3009
|
-
screen: 'ClaimWithdrawalSuccess',
|
|
3010
|
-
});
|
|
2740
|
+
: undefined })), viewState.view.type === BridgeWidgetViews.TRANSACTIONS && (jsx(Transactions, { onBackButtonClick: goBackToWalletNetworkSelector, defaultTokenImage: defaultTokenImage, themeOverrides: themeOverrides })), viewState.view.type === BridgeWidgetViews.CLAIM_WITHDRAWAL && (jsx(ClaimWithdrawal, { transaction: viewState.view.transaction })), viewState.view.type === SharedViews.ERROR_VIEW && (jsx(ErrorView, { actionText: t('views.ERROR_VIEW.actionText'), onActionClick: goBackToWalletNetworkSelectorClearState, onCloseClick: () => sendBridgeWidgetCloseEvent(eventTarget) })), viewState.view.type === SharedViews.TOP_UP_VIEW && (jsx(TopUpView, { widgetEvent: IMTBLWidgetEvents.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: () => {
|
|
3011
2741
|
sendBridgeClaimWithdrawalSuccessEvent(eventTarget, viewState.view.transactionHash);
|
|
3012
2742
|
}, onActionClick: updateToTransactionsPage, statusType: StatusType.SUCCESS, testId: "claim-withdrawal-success-view" })), viewState.view.type === BridgeWidgetViews.CLAIM_WITHDRAWAL_FAILURE && (jsx(StatusView, { statusText: t('views.CLAIM_WITHDRAWAL.IN_PROGRESS.failure.text'), actionText: t('views.CLAIM_WITHDRAWAL.IN_PROGRESS.failure.actionText'), onRenderEvent: () => {
|
|
3013
|
-
let reason = '';
|
|
3014
|
-
if (viewState.view.type === BridgeWidgetViews.CLAIM_WITHDRAWAL_FAILURE) {
|
|
3015
|
-
reason = viewState.view.reason;
|
|
3016
|
-
}
|
|
3017
|
-
page({
|
|
3018
|
-
userJourney: UserJourney.BRIDGE,
|
|
3019
|
-
screen: 'ClaimWithdrawalFailure',
|
|
3020
|
-
extras: {
|
|
3021
|
-
reason,
|
|
3022
|
-
},
|
|
3023
|
-
});
|
|
3024
2743
|
sendBridgeClaimWithdrawalFailedEvent(eventTarget, viewState.view.transactionHash, 'Transaction failed');
|
|
3025
2744
|
}, onActionClick: updateToTransactionsPage, statusType: StatusType.FAILURE, onCloseClick: () => sendBridgeWidgetCloseEvent(eventTarget), testId: "claim-withdrawal-fail-view" })), viewState.view.type === BridgeWidgetViews.SERVICE_UNAVAILABLE && (jsx(ServiceUnavailableErrorView, { onCloseClick: () => sendBridgeWidgetCloseEvent(eventTarget), onBackButtonClick: () => {
|
|
3026
2745
|
viewDispatch({
|