@imtbl/checkout-widgets 2.24.1 → 2.24.3-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-2Bi-Ujnc.js → AddTokensWidget-DMrmDo2R.js} +25 -25
- package/dist/browser/{BridgeWidget-Bx20C7vJ.js → BridgeWidget-C3ZwEF5d.js} +50 -50
- package/dist/browser/{CommerceWidget-DfgYY_iW.js → CommerceWidget-CDGGJeeR.js} +183 -183
- package/dist/browser/{FeesBreakdown-BtJ0FKCM.js → FeesBreakdown-i_qxEQFt.js} +2 -2
- package/dist/browser/{OnRampWidget-DopM-_DG.js → OnRampWidget-BRx0TwzX.js} +6 -6
- package/dist/browser/{SaleWidget-k1Elo6I4.js → SaleWidget-gSxmV2g7.js} +65 -65
- package/dist/browser/{SpendingCapHero-D-F8nBny.js → SpendingCapHero-BxLJL-9Q.js} +1 -1
- package/dist/browser/{SwapWidget-DTKc_R13.js → SwapWidget-Bwd7fDVb.js} +23 -23
- package/dist/browser/{TokenImage-qjYDd3m2.js → TokenImage-DBv6iVIk.js} +1 -1
- package/dist/browser/{TopUpView-BoMjQTMh.js → TopUpView-Dl5z5cFC.js} +5 -5
- package/dist/browser/{WalletApproveHero-DXGuS7yb.js → WalletApproveHero-DnHtkM1S.js} +2 -2
- package/dist/browser/{WalletWidget-D2JWCMTL.js → WalletWidget-JrG6gxbu.js} +15 -15
- package/dist/browser/{auto-track-BE1V41qw.js → auto-track-BUUbNCUM.js} +1 -1
- package/dist/browser/{index-BYN_3eJq.js → index-B8BkPC1Y.js} +911 -235
- package/dist/browser/{index-DTyK6Hip.js → index-Bj-hPuPy.js} +2 -2
- package/dist/browser/{index-OfzQtXWB.js → index-C-YEXPDU.js} +1 -1
- package/dist/browser/{index-DgEkCEpw.js → index-CeWEdrkc.js} +1 -1
- package/dist/browser/{index-DQNCrGRv.js → index-CvzKMjLT.js} +1 -1
- package/dist/browser/{index-CGPllL2u.js → index-HuuqNyji.js} +1 -1
- package/dist/browser/{index-B5EIG7rU.js → index-R1ozmK7m.js} +1 -1
- package/dist/browser/{index-DfQ4K4tF.js → index-sF9vmGhg.js} +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/{index.umd-sc9SOjIm.js → index.umd-DY1kOxNW.js} +1 -1
- package/dist/browser/{useInterval-C13gRjLe.js → useInterval-B7l9NFy4.js} +1 -1
- package/package.json +7 -7
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { cp as toQuantity, cq as toBeHex, cr as getAddress, cs as keccak256, ct as concat, cu as AbiCoder, cv as axios, cw as ZeroAddress,
|
|
2
|
-
import { B as BridgeWidgetViews, T as TopUpView } from './TopUpView-
|
|
3
|
-
import { T as TokenImage } from './TokenImage-
|
|
4
|
-
import { A as Accordion, S as SelectForm, T as TextInputForm, a as TransactionRejected, g as getAllowedBalances, b as gasAmountAccordionStyles, c as gasAmountHeadingStyles, N as NetworkSwitchDrawer, W as WalletApproveHero } from './WalletApproveHero-
|
|
5
|
-
import { f as fetchRiskAssessmentV2, r as resultHasSanctionedWallets, F as FeesBreakdown } from './FeesBreakdown-
|
|
6
|
-
import { u as useInterval } from './useInterval-
|
|
1
|
+
import { cp as toQuantity, cq as toBeHex, cr as getAddress, cs as keccak256, ct as concat, cu as AbiCoder, cv as axios, cw as ZeroAddress, k as Contract, _ as isAddress, bM as r, aQ as ChainId, cx as ChainName, cy as CheckoutErrorType, r as reactExports, I as IMTBLWidgetEvents, B as BridgeEventType, s as jsxs, q as jsx, cz as ShimmerBox, aP as MenuItem, w as Stack, u as useTranslation, y as Body, v as Button, t as Box, cA as PASSPORT_URL, L as Link, cB as getChainImage, b1 as FramedImage, b7 as EllipsizedText, bd as Icon, cC as getChainIdBySlug, aU as ViewContext, z as useAnalytics, aF as Fragment, aB as Divider, U as UserJourney, V as ViewActions, cD as useWalletConnect, cE as Logo, cF as RawImage, cG as isWalletConnectProvider, D as CryptoFiatContext, a$ as isNativeToken, b0 as getTokenImageByAddress, cH as getNativeSymbolByChainSlug, cb as formatUnits, j as calculateCryptoToFiat, E as EventTargetContext, l as TokenFilterTypes, cI as JsonRpcProvider, a1 as CryptoFiatActions, aJ as WrappedBrowserProvider, bn as useInjectedProviders, cJ as retry, J as HeaderNavigation, c5 as FooterLogo, aD as WalletDrawer, x as SimpleLayout, cK as getChainSlugById, aK as isPassportProvider, cL as DEFAULT_TRANSACTIONS_RETRY_POLICY, aG as WalletProviderRdns, a0 as LoadingView, Q as useTheme, H as Heading, cM as getChainNameById, cN as getWalletProviderNameByProvider, cO as isMetaMaskProvider, cP as WalletProviderName, aA as Drawer, b3 as ButtCon, cQ as ButtonNavigationStyles, M as orchestrationEvents, F as tokenValueFormat, i as formatZeroAmount, cR as NATIVE, bU as Z$1, p as parseUnits, N as amountInputValidation, R as CloudImage, cS as ETH_TOKEN_SYMBOL, X as getRemoteImage, bF as PriceDisplay, cT as GasEstimateType, cU as DEFAULT_QUOTE_REFRESH_INTERVAL, cV as addChainChangedListener, cW as removeChainChangedListener, cX as isAddressSanctioned, cY as IMX_TOKEN_SYMBOL, a5 as SharedViews, cZ as DEFAULT_TOKEN_DECIMALS, m as dist, c_ as CHECKOUT_CDN_BASE_URL, c$ as heroBackGroundStyles, d0 as heroImageStyles, be as Badge, d1 as SimpleTextBody, d2 as FooterButton, d3 as getEthTokenImage, d4 as WITHDRAWAL_CLAIM_GAS_LIMIT, d5 as getGasPriceInWei, bH as viewReducer, bI as initialViewState, d6 as a, d7 as StatusView, c6 as StatusType, a6 as ErrorView, bQ as ServiceUnavailableErrorView, Y as CryptoFiatProvider, G as getDefaultTokenImage } from './index-B8BkPC1Y.js';
|
|
2
|
+
import { B as BridgeWidgetViews, T as TopUpView } from './TopUpView-Dl5z5cFC.js';
|
|
3
|
+
import { T as TokenImage } from './TokenImage-DBv6iVIk.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-DnHtkM1S.js';
|
|
5
|
+
import { f as fetchRiskAssessmentV2, r as resultHasSanctionedWallets, F as FeesBreakdown } from './FeesBreakdown-i_qxEQFt.js';
|
|
6
|
+
import { u as useInterval } from './useInterval-B7l9NFy4.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
|
|
|
10
10
|
const networkName = {
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
11
|
+
[ChainId.IMTBL_ZKEVM_DEVNET]: ChainName.IMTBL_ZKEVM_DEVNET,
|
|
12
|
+
[ChainId.IMTBL_ZKEVM_MAINNET]: ChainName.IMTBL_ZKEVM_MAINNET,
|
|
13
|
+
[ChainId.IMTBL_ZKEVM_TESTNET]: ChainName.IMTBL_ZKEVM_TESTNET,
|
|
14
|
+
[ChainId.ETHEREUM]: ChainName.ETHEREUM,
|
|
15
|
+
[ChainId.SEPOLIA]: ChainName.SEPOLIA,
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
async function connectToProvider(checkout, provider, changeAccount) {
|
|
@@ -37,7 +37,7 @@ async function connectToProvider(checkout, provider, changeAccount) {
|
|
|
37
37
|
connected = true;
|
|
38
38
|
}
|
|
39
39
|
catch (error) {
|
|
40
|
-
if (error.type ===
|
|
40
|
+
if (error.type === CheckoutErrorType.USER_REJECTED_REQUEST_ERROR) {
|
|
41
41
|
// eslint-disable-next-line no-console
|
|
42
42
|
console.log('User rejected request');
|
|
43
43
|
}
|
|
@@ -138,9 +138,9 @@ const bridgeReducer = (state, action) => {
|
|
|
138
138
|
};
|
|
139
139
|
|
|
140
140
|
const sendBridgeTransactionSentEvent = (eventTarget, transactionHash) => {
|
|
141
|
-
const successEvent = new CustomEvent(
|
|
141
|
+
const successEvent = new CustomEvent(IMTBLWidgetEvents.IMTBL_BRIDGE_WIDGET_EVENT, {
|
|
142
142
|
detail: {
|
|
143
|
-
type:
|
|
143
|
+
type: BridgeEventType.TRANSACTION_SENT,
|
|
144
144
|
data: {
|
|
145
145
|
transactionHash,
|
|
146
146
|
},
|
|
@@ -152,9 +152,9 @@ const sendBridgeTransactionSentEvent = (eventTarget, transactionHash) => {
|
|
|
152
152
|
eventTarget.dispatchEvent(successEvent);
|
|
153
153
|
};
|
|
154
154
|
const sendBridgeFailedEvent = (eventTarget, reason) => {
|
|
155
|
-
const failedEvent = new CustomEvent(
|
|
155
|
+
const failedEvent = new CustomEvent(IMTBLWidgetEvents.IMTBL_BRIDGE_WIDGET_EVENT, {
|
|
156
156
|
detail: {
|
|
157
|
-
type:
|
|
157
|
+
type: BridgeEventType.FAILURE,
|
|
158
158
|
data: {
|
|
159
159
|
reason,
|
|
160
160
|
timestamp: new Date().getTime(),
|
|
@@ -167,9 +167,9 @@ const sendBridgeFailedEvent = (eventTarget, reason) => {
|
|
|
167
167
|
eventTarget.dispatchEvent(failedEvent);
|
|
168
168
|
};
|
|
169
169
|
function sendBridgeWidgetCloseEvent(eventTarget) {
|
|
170
|
-
const closeWidgetEvent = new CustomEvent(
|
|
170
|
+
const closeWidgetEvent = new CustomEvent(IMTBLWidgetEvents.IMTBL_BRIDGE_WIDGET_EVENT, {
|
|
171
171
|
detail: {
|
|
172
|
-
type:
|
|
172
|
+
type: BridgeEventType.CLOSE_WIDGET,
|
|
173
173
|
data: {},
|
|
174
174
|
},
|
|
175
175
|
});
|
|
@@ -179,9 +179,9 @@ function sendBridgeWidgetCloseEvent(eventTarget) {
|
|
|
179
179
|
eventTarget.dispatchEvent(closeWidgetEvent);
|
|
180
180
|
}
|
|
181
181
|
const sendBridgeClaimWithdrawalSuccessEvent = (eventTarget, transactionHash) => {
|
|
182
|
-
const successEvent = new CustomEvent(
|
|
182
|
+
const successEvent = new CustomEvent(IMTBLWidgetEvents.IMTBL_BRIDGE_WIDGET_EVENT, {
|
|
183
183
|
detail: {
|
|
184
|
-
type:
|
|
184
|
+
type: BridgeEventType.CLAIM_WITHDRAWAL_SUCCESS,
|
|
185
185
|
data: {
|
|
186
186
|
transactionHash,
|
|
187
187
|
},
|
|
@@ -193,9 +193,9 @@ const sendBridgeClaimWithdrawalSuccessEvent = (eventTarget, transactionHash) =>
|
|
|
193
193
|
eventTarget.dispatchEvent(successEvent);
|
|
194
194
|
};
|
|
195
195
|
const sendBridgeClaimWithdrawalFailedEvent = (eventTarget, transactionHash, reason) => {
|
|
196
|
-
const failedEvent = new CustomEvent(
|
|
196
|
+
const failedEvent = new CustomEvent(IMTBLWidgetEvents.IMTBL_BRIDGE_WIDGET_EVENT, {
|
|
197
197
|
detail: {
|
|
198
|
-
type:
|
|
198
|
+
type: BridgeEventType.CLAIM_WITHDRAWAL_FAILURE,
|
|
199
199
|
data: {
|
|
200
200
|
transactionHash,
|
|
201
201
|
reason,
|
|
@@ -598,7 +598,7 @@ function Transactions({ defaultTokenImage, onBackButtonClick, themeOverrides, })
|
|
|
598
598
|
const rootChainId = checkout.config.l1ChainId;
|
|
599
599
|
try {
|
|
600
600
|
const tokens = (await checkout.getTokenAllowList({
|
|
601
|
-
type:
|
|
601
|
+
type: TokenFilterTypes.BRIDGE,
|
|
602
602
|
chainId: rootChainId,
|
|
603
603
|
})).tokens ?? [];
|
|
604
604
|
return tokens.reduce((out, current) => {
|
|
@@ -710,10 +710,10 @@ function Transactions({ defaultTokenImage, onBackButtonClick, themeOverrides, })
|
|
|
710
710
|
});
|
|
711
711
|
try {
|
|
712
712
|
let changeAccount = false;
|
|
713
|
-
if (event.providerDetail.info.rdns ===
|
|
713
|
+
if (event.providerDetail.info.rdns === WalletProviderRdns.METAMASK) {
|
|
714
714
|
changeAccount = true;
|
|
715
715
|
}
|
|
716
|
-
const browserProvider = new
|
|
716
|
+
const browserProvider = new WrappedBrowserProvider(event.provider);
|
|
717
717
|
const connectedProvider = await connectToProvider(checkout, browserProvider, changeAccount);
|
|
718
718
|
const network = await connectedProvider.getNetwork();
|
|
719
719
|
const address = await (await connectedProvider.getSigner()).getAddress();
|
|
@@ -948,7 +948,7 @@ function WalletNetworkButton({ testId, walletProvider, walletProviderDetail, wal
|
|
|
948
948
|
const [isWalletConnect, setIsWalletConnect] = reactExports.useState(false);
|
|
949
949
|
const { isWalletConnectEnabled, getWalletLogoUrl, getWalletName } = useWalletConnect();
|
|
950
950
|
const walletDisplayName = reactExports.useMemo(() => {
|
|
951
|
-
if (walletProviderDetail?.info.rdns ===
|
|
951
|
+
if (walletProviderDetail?.info.rdns === WalletProviderRdns.PASSPORT) {
|
|
952
952
|
return walletName;
|
|
953
953
|
}
|
|
954
954
|
if (isWalletConnectProvider(walletProvider)) {
|
|
@@ -1050,9 +1050,9 @@ function WalletAndNetworkSelector({ themeOverrides }) {
|
|
|
1050
1050
|
}, [toWalletBrowserProvider]);
|
|
1051
1051
|
const fromWalletSelectorOptions = reactExports.useMemo(() => providers, [providers]);
|
|
1052
1052
|
const toWalletSelectorOptions = reactExports.useMemo(() => (providers
|
|
1053
|
-
.filter((providerDetail) => (providerDetail.info.rdns !==
|
|
1054
|
-
|| (providerDetail.info.rdns ===
|
|
1055
|
-
&& fromWallet?.providerDetail?.info?.rdns !==
|
|
1053
|
+
.filter((providerDetail) => (providerDetail.info.rdns !== WalletProviderRdns.PASSPORT
|
|
1054
|
+
|| (providerDetail.info.rdns === WalletProviderRdns.PASSPORT
|
|
1055
|
+
&& fromWallet?.providerDetail?.info?.rdns !== WalletProviderRdns.PASSPORT)))), [providers, fromNetwork, fromWallet]);
|
|
1056
1056
|
reactExports.useEffect(() => {
|
|
1057
1057
|
if (!from || !to)
|
|
1058
1058
|
return;
|
|
@@ -1113,12 +1113,12 @@ function WalletAndNetworkSelector({ themeOverrides }) {
|
|
|
1113
1113
|
clearToWalletSelections();
|
|
1114
1114
|
setFromWallet(event);
|
|
1115
1115
|
let changeAccount = false;
|
|
1116
|
-
if (event.providerDetail.info.rdns ===
|
|
1116
|
+
if (event.providerDetail.info.rdns === WalletProviderRdns.METAMASK) {
|
|
1117
1117
|
changeAccount = true;
|
|
1118
1118
|
}
|
|
1119
1119
|
// Pass 'any' here so that if the user switches networks, they are still prompted to switch
|
|
1120
1120
|
// to the chosen network at the end of the bridging process.
|
|
1121
|
-
const wrappedBrowserProvider = new
|
|
1121
|
+
const wrappedBrowserProvider = new WrappedBrowserProvider(event.provider, 'any');
|
|
1122
1122
|
const connectedProvider = await connectToProvider(checkout, wrappedBrowserProvider, changeAccount);
|
|
1123
1123
|
await handleFromWalletConnectionSuccess(connectedProvider);
|
|
1124
1124
|
}, [checkout]);
|
|
@@ -1211,7 +1211,7 @@ function WalletAndNetworkSelector({ themeOverrides }) {
|
|
|
1211
1211
|
}
|
|
1212
1212
|
try {
|
|
1213
1213
|
setToWallet(event);
|
|
1214
|
-
const wrappedBrowserProvider = new
|
|
1214
|
+
const wrappedBrowserProvider = new WrappedBrowserProvider(event.provider);
|
|
1215
1215
|
const connectedProvider = await connectToProvider(checkout, wrappedBrowserProvider, false);
|
|
1216
1216
|
const address = await (await connectedProvider.getSigner()).getAddress();
|
|
1217
1217
|
if (isWalletConnectProvider(connectedProvider)) {
|
|
@@ -1327,7 +1327,7 @@ function WalletAndNetworkSelector({ themeOverrides }) {
|
|
|
1327
1327
|
display: 'flex',
|
|
1328
1328
|
flexDirection: 'column',
|
|
1329
1329
|
gap: 'base.spacing.x10',
|
|
1330
|
-
}, children: [jsx(WalletNetworkButton, { testId: testId$1, walletProviderDetail: fromWallet?.providerDetail, walletProvider: fromWalletBrowserProvider, walletName: fromWalletProviderName, walletAddress: abbreviateAddress(fromWalletAddress), chainId: fromNetwork, disableNetworkButton: fromWalletProviderName ===
|
|
1330
|
+
}, children: [jsx(WalletNetworkButton, { testId: testId$1, walletProviderDetail: fromWallet?.providerDetail, walletProvider: fromWalletBrowserProvider, walletName: fromWalletProviderName, walletAddress: abbreviateAddress(fromWalletAddress), chainId: fromNetwork, disableNetworkButton: fromWalletProviderName === WalletProviderName.PASSPORT.toString(), onWalletClick: () => {
|
|
1331
1331
|
// TODO: Force an account selection here
|
|
1332
1332
|
setFromWalletDrawerOpen(true);
|
|
1333
1333
|
}, onNetworkClick: () => setFromNetworkDrawerOpen(true), environment: environment }), jsxs(Box, { children: [jsx(Heading, { size: "xSmall", sx: { paddingBottom: 'base.spacing.x2' }, children: t('views.WALLET_NETWORK_SELECTION.toFormInput.heading') }), jsx(WalletDrawer, { testId: `${testId$1}-to`, drawerText: {
|
|
@@ -1341,13 +1341,13 @@ function WalletAndNetworkSelector({ themeOverrides }) {
|
|
|
1341
1341
|
else {
|
|
1342
1342
|
setToNetworkDrawerOpen(false);
|
|
1343
1343
|
}
|
|
1344
|
-
}, visible: fromNetworkDrawerOpen || toNetworkDrawerOpen, children: jsxs(Drawer.Content, { sx: { paddingX: 'base.spacing.x4' }, children: [jsx(NetworkItem, { testId: testId$1, chainName: imtblZkEvmNetworkName, onNetworkClick: fromNetworkDrawerOpen ? handleFromNetworkSelection : handleToNetworkSelection, chainId: imtblZkEvmNetworkChainId, environment: environment }, imtblZkEvmNetworkName), (toNetworkDrawerOpen || fromWallet?.providerDetail.info.rdns !==
|
|
1344
|
+
}, visible: fromNetworkDrawerOpen || toNetworkDrawerOpen, children: jsxs(Drawer.Content, { sx: { paddingX: 'base.spacing.x4' }, children: [jsx(NetworkItem, { testId: testId$1, chainName: imtblZkEvmNetworkName, onNetworkClick: fromNetworkDrawerOpen ? handleFromNetworkSelection : handleToNetworkSelection, chainId: imtblZkEvmNetworkChainId, environment: environment }, imtblZkEvmNetworkName), (toNetworkDrawerOpen || fromWallet?.providerDetail.info.rdns !== WalletProviderRdns.PASSPORT) && (jsx(NetworkItem, { testId: testId$1, chainName: l1NetworkName, onNetworkClick: fromNetworkDrawerOpen ? handleFromNetworkSelection : handleToNetworkSelection, chainId: l1NetworkChainId, environment: environment }, l1NetworkName))] }) }), isToWalletAndNetworkSelected && toWalletProviderName && (jsxs(Box, { sx: {
|
|
1345
1345
|
flex: 1,
|
|
1346
1346
|
display: 'flex',
|
|
1347
1347
|
flexDirection: 'column',
|
|
1348
1348
|
justifyContent: 'space-between',
|
|
1349
1349
|
}, children: [jsx(WalletNetworkButton, { testId: testId$1, walletProviderDetail: toWallet?.providerDetail, walletProvider: toWalletBrowserProvider, walletName: toWalletProviderName, walletAddress: abbreviateAddress(toWalletAddress), chainId: toNetwork, disableNetworkButton: fromNetwork === l1NetworkChainId
|
|
1350
|
-
|| toWalletProviderName ===
|
|
1350
|
+
|| toWalletProviderName === WalletProviderName.PASSPORT.toString()
|
|
1351
1351
|
|| fromWalletAddress === toWalletAddress, onWalletClick: () => {
|
|
1352
1352
|
setToWalletDrawerOpen(true);
|
|
1353
1353
|
}, onNetworkClick: () => {
|
|
@@ -1374,7 +1374,7 @@ function WalletNetworkSelectionView({ showBackButton, themeOverrides, }) {
|
|
|
1374
1374
|
},
|
|
1375
1375
|
});
|
|
1376
1376
|
}, testId: "move-transactions-button" })), showBack: showBackButton, onBackButtonClick: () => {
|
|
1377
|
-
orchestrationEvents.sendRequestGoBackEvent(eventTarget,
|
|
1377
|
+
orchestrationEvents.sendRequestGoBackEvent(eventTarget, IMTBLWidgetEvents.IMTBL_BRIDGE_WIDGET_EVENT, {});
|
|
1378
1378
|
} })), footer: jsx(FooterLogo, {}), children: jsx(WalletAndNetworkSelector, { themeOverrides: themeOverrides }) }));
|
|
1379
1379
|
}
|
|
1380
1380
|
|
|
@@ -1727,7 +1727,7 @@ function Bridge({ amount, tokenAddress, defaultTokenImage, theme, themeOverrides
|
|
|
1727
1727
|
checkout,
|
|
1728
1728
|
provider: from.browserProvider,
|
|
1729
1729
|
chainId: from?.network,
|
|
1730
|
-
allowTokenListType:
|
|
1730
|
+
allowTokenListType: TokenFilterTypes.BRIDGE,
|
|
1731
1731
|
// Skip retry given that in this case it is not needed;
|
|
1732
1732
|
// refreshBalances will be, automatically, called again
|
|
1733
1733
|
// after REFRESH_TOKENS_INTERVAL_MS.
|
|
@@ -2057,7 +2057,7 @@ function BridgeReviewSummary() {
|
|
|
2057
2057
|
return;
|
|
2058
2058
|
const tokenToTransfer = token?.address?.toLowerCase() ?? NATIVE.toUpperCase();
|
|
2059
2059
|
const gasEstimateResult = {
|
|
2060
|
-
gasEstimateType:
|
|
2060
|
+
gasEstimateType: GasEstimateType.BRIDGE_TO_L2,
|
|
2061
2061
|
fees: {},
|
|
2062
2062
|
token: checkout.config.networkMap.get(from.network)?.nativeCurrency,
|
|
2063
2063
|
};
|
|
@@ -2137,7 +2137,7 @@ function BridgeReviewSummary() {
|
|
|
2137
2137
|
transactionFeeData.approvalFee = BigInt(0);
|
|
2138
2138
|
}
|
|
2139
2139
|
const gasEstimateResult = {
|
|
2140
|
-
gasEstimateType:
|
|
2140
|
+
gasEstimateType: GasEstimateType.BRIDGE_TO_L2,
|
|
2141
2141
|
fees: {
|
|
2142
2142
|
...transactionFeeData,
|
|
2143
2143
|
totalFees: rawTotalFees,
|
|
@@ -2228,7 +2228,7 @@ function BridgeReviewSummary() {
|
|
|
2228
2228
|
return;
|
|
2229
2229
|
if (!from || !to)
|
|
2230
2230
|
return;
|
|
2231
|
-
if (riskAssessment &&
|
|
2231
|
+
if (riskAssessment && isAddressSanctioned()) {
|
|
2232
2232
|
viewDispatch({
|
|
2233
2233
|
payload: {
|
|
2234
2234
|
type: ViewActions.UPDATE_VIEW,
|
|
@@ -2461,7 +2461,7 @@ function ApproveTransaction({ bridgeTransaction }) {
|
|
|
2461
2461
|
});
|
|
2462
2462
|
}, [viewDispatch]);
|
|
2463
2463
|
const handleExceptions = (err) => {
|
|
2464
|
-
if (err.type ===
|
|
2464
|
+
if (err.type === CheckoutErrorType.UNPREDICTABLE_GAS_LIMIT) {
|
|
2465
2465
|
viewDispatch({
|
|
2466
2466
|
payload: {
|
|
2467
2467
|
type: ViewActions.UPDATE_VIEW,
|
|
@@ -2473,11 +2473,11 @@ function ApproveTransaction({ bridgeTransaction }) {
|
|
|
2473
2473
|
});
|
|
2474
2474
|
return;
|
|
2475
2475
|
}
|
|
2476
|
-
if (err.type ===
|
|
2477
|
-
|| err.type ===
|
|
2476
|
+
if (err.type === CheckoutErrorType.TRANSACTION_FAILED
|
|
2477
|
+
|| err.type === CheckoutErrorType.INSUFFICIENT_FUNDS
|
|
2478
2478
|
|| (err.receipt && err.receipt.status === 0)) {
|
|
2479
2479
|
let reason = 'Transaction failed';
|
|
2480
|
-
if (err.type ===
|
|
2480
|
+
if (err.type === CheckoutErrorType.INSUFFICIENT_FUNDS)
|
|
2481
2481
|
reason = 'Insufficient funds';
|
|
2482
2482
|
if (err.receipt && err.receipt.status === 0)
|
|
2483
2483
|
reason = 'Transaction failed to settle on chain';
|
|
@@ -2544,7 +2544,7 @@ function ApproveTransaction({ bridgeTransaction }) {
|
|
|
2544
2544
|
}
|
|
2545
2545
|
catch (e) {
|
|
2546
2546
|
setTxProcessing(false);
|
|
2547
|
-
if (e.type ===
|
|
2547
|
+
if (e.type === CheckoutErrorType.USER_REJECTED_REQUEST_ERROR) {
|
|
2548
2548
|
setRejectedBridge(true);
|
|
2549
2549
|
}
|
|
2550
2550
|
else {
|
|
@@ -2596,7 +2596,7 @@ function ApproveTransaction({ bridgeTransaction }) {
|
|
|
2596
2596
|
}
|
|
2597
2597
|
catch (error) {
|
|
2598
2598
|
setTxProcessing(false);
|
|
2599
|
-
if (error.type ===
|
|
2599
|
+
if (error.type === CheckoutErrorType.USER_REJECTED_REQUEST_ERROR) {
|
|
2600
2600
|
setRejectedBridge(true);
|
|
2601
2601
|
bridgeRejected = true;
|
|
2602
2602
|
}
|
|
@@ -2640,7 +2640,7 @@ function ApproveTransaction({ bridgeTransaction }) {
|
|
|
2640
2640
|
}
|
|
2641
2641
|
}
|
|
2642
2642
|
catch (error) {
|
|
2643
|
-
if (error.type ===
|
|
2643
|
+
if (error.type === CheckoutErrorType.USER_REJECTED_REQUEST_ERROR) {
|
|
2644
2644
|
setRejectedBridge(true);
|
|
2645
2645
|
}
|
|
2646
2646
|
else {
|
|
@@ -2763,7 +2763,7 @@ function ClaimWithdrawal({ transaction }) {
|
|
|
2763
2763
|
if (isPassportProvider(from?.browserProvider) || forceChangeAccount) {
|
|
2764
2764
|
// user should switch to MetaMask
|
|
2765
2765
|
try {
|
|
2766
|
-
const createProviderResult = await checkout.createProvider({ walletProviderName:
|
|
2766
|
+
const createProviderResult = await checkout.createProvider({ walletProviderName: WalletProviderName.METAMASK });
|
|
2767
2767
|
const connectResult = await checkout.connect({
|
|
2768
2768
|
provider: createProviderResult.provider,
|
|
2769
2769
|
requestWalletPermissions: true,
|
|
@@ -2803,7 +2803,7 @@ function ClaimWithdrawal({ transaction }) {
|
|
|
2803
2803
|
}
|
|
2804
2804
|
let gasPriceInWei = null;
|
|
2805
2805
|
if (feeData)
|
|
2806
|
-
gasPriceInWei =
|
|
2806
|
+
gasPriceInWei = getGasPriceInWei(feeData);
|
|
2807
2807
|
if (gasPriceInWei) {
|
|
2808
2808
|
ethGasCostWei = gasEstimate * gasPriceInWei;
|
|
2809
2809
|
}
|
|
@@ -3003,7 +3003,7 @@ function BridgeWidget({ checkout, browserProvider, config, amount, tokenAddress,
|
|
|
3003
3003
|
userJourney: UserJourney.BRIDGE,
|
|
3004
3004
|
screen: 'Error',
|
|
3005
3005
|
});
|
|
3006
|
-
} })), viewState.view.type === SharedViews.TOP_UP_VIEW && (jsx(TopUpView, { analytics: { userJourney: UserJourney.BRIDGE }, widgetEvent:
|
|
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
3007
|
page({
|
|
3008
3008
|
userJourney: UserJourney.BRIDGE,
|
|
3009
3009
|
screen: 'ClaimWithdrawalSuccess',
|