@multiversx/sdk-dapp-liquidity 2.3.0-alpha.2 → 2.3.0-alpha.3

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "MultiversX",
4
4
  "description": "A complete toolkit for bridging assets between MultiversX, Ethereum, BNB Chain and Sui",
5
5
  "license": "MIT",
6
- "version": "2.3.0-alpha.2",
6
+ "version": "2.3.0-alpha.3",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/multiversx/mx-sdk-dapp-liquidity.git"
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),Bs=require("@fortawesome/free-solid-svg-icons/faSpinner"),ys=require("@fortawesome/react-fontawesome"),As=require("@multiversx/sdk-dapp-utils/out/helpers/formatAmount"),ks=require("@reown/appkit/react"),Ns=require("@wagmi/core"),Ss=require("lodash/debounce"),t=require("react"),k=require("react-toastify"),ws=require("./hooks/useBridgeTokenSelection.js"),Ds=require("./utils/bridgeFormHelpers.js"),De=require("../../../constants/index.js"),Ms=require("../../../helpers/getApiURL.js");require("../../constants/index.js");const H=require("../../../helpers/safeImageUrl.js");require("@solana/web3.js");require("bitcoinjs-lib");require("viem");const N=require("../../../types/chainType.js"),Es=require("../../context/useWeb3App.js"),L=require("../../helpers/resolveBridgeApiChainId.js"),Rs=require("../../hooks/useAccount.js"),Fs=require("../../hooks/useBridgeApiChainId.js"),S=require("../../hooks/useBridgeFormik.js"),Vs=require("../../hooks/useDisconnectOnChainTypeChange.js"),Ps=require("../../hooks/useFetchBridgeData.js"),Ts=require("../../hooks/useGetChainId.js"),Us=require("../../hooks/useNamespaceAddress.js"),Hs=require("../../hooks/useSendTransactions.js"),Ls=require("../../hooks/useSignTransaction.js"),Os=require("../../queries/useGetHistory.query.js"),Gs=require("../../queries/useGetRate.mutation.js"),Me=require("../../utils/mxClsx.js"),Ee=require("../AmountCard/AmountCard.js"),Re=require("../AmountInput/AmountInput.js"),Ws=require("../base/MxButton/MxButton.js");require("../base/MxCard/MxCard.js");require("../base/MxLink/MxLink.js");require("../base/MxSearch/MxSearch.js");require("@fortawesome/free-solid-svg-icons/faClose");require("@headlessui/react");require("react-dom");require("react-popper");require("../base/MxTooltip/components/TooltipContainer/TooltipContainer.js");const Xs=require("../BridgeHistory/BridgeHistory.js"),zs=require("../Connect/BridgeConnectButton.js");require("wagmi");const Qs=require("../Connect/MvxConnectButton.js"),$s=require("../Connect/BridgeAccountDisplay.js"),Ks=require("../Connect/MvxAccountDisplay.js");require("@reown/appkit-controllers");const Ys=require("../ToggleDirection/ToggleDirection.js"),Fe=require("../TokenSelector/TokenSelector.js");let O;const Js=({mvxChainId:G,mvxAddress:l,username:Ve,callbackRoute:Pe="/",firstTokenIdentifier:Te,secondTokenIdentifier:Ue,firstTokenAmount:w,secondTokenAmount:j,refetchTrigger:He,showHistory:Le,forcedDestinationTokenSymbol:Oe,onSuccessfullySentTransaction:D,onFailedSentTransaction:b,onHistoryClose:M,onMvxConnect:oe,onMvxDisconnect:Ge,onNavigate:We,onChangeDirection:Xe})=>{var ve,Be;const ze=t.useRef(null),ce=t.useRef(void 0),[W,Qe]=t.useState(!1),[E,I]=t.useState(!1),[$e,Ke]=t.useState(1),[X,z]=t.useState(0),Ye=Rs.useAccount(),{switchNetwork:le}=ks.useAppKitNetwork(),ue=Os.useInvalidateHistoryQuery(),{config:de,options:me,supportedChains:C,nativeAuthToken:Q,bridgeOnly:Je}=Es.useWeb3App(),$=Ts.useGetChainId(),he=Fs.useBridgeApiChainId(),{evmTokensWithBalances:Ze,mvxTokensWithBalances:es,isTokensLoading:ss,isLoadingEvmTokensBalances:ts,isLoadingMvxTokensBalances:ns,chains:v=[],isChainsLoading:is}=Ps.useFetchBridgeData({refetchTrigger:He,mvxAddress:l,mvxApiURL:me.mvxApiURL}),K=ss||ts||ns||is,rs=t.useMemo(()=>C.find(n=>L.sameBridgeApiChainId(n.id,$)),[$,C]),c=t.useMemo(()=>v.find(n=>n.chainId.toString()===G.toString()),[$,v]),{evm:ge,solana:qe,bitcoin:pe,sui:xe}=Ls.useSignTransaction(),be=Hs.useSendTransactions(),{mutate:as,data:d,isPending:B,error:f}=Gs.useGetRateMutation(),y=((ve=f==null?void 0:f.response)==null?void 0:ve.status)===400?(Be=f==null?void 0:f.response)==null?void 0:Be.data.message:void 0,os=t.useCallback(n=>{const x=C.find(u=>L.sameBridgeApiChainId(u.id,n.id));x&&le(x)},[C,le]),{firstToken:e,secondToken:o,fromOptions:R,toOptions:cs,selectedChainOption:r,onChangeFirstSelect:fe,onChangeSecondSelect:ls,handleChangeDirection:us}=ws.useBridgeTokenSelection({chains:v,activeChain:rs,sdkChains:C,switchNetwork:os,fromTokens:Ze,toTokens:es,firstTokenIdentifier:Te,secondTokenIdentifier:Ue,forcedDestinationTokenSymbol:Oe,isTokensLoading:K,callbackRoute:Pe,onNavigate:We}),ds=t.useMemo(()=>e?De.MVX_CHAIN_IDS.includes(e.chainId.toString()):!1,[e==null?void 0:e.chainId]),ms=t.useMemo(()=>o?De.MVX_CHAIN_IDS.includes(o.chainId.toString()):!1,[o==null?void 0:o.chainId]),[m,hs]=t.useState(w??""),[F,V]=t.useState(j??""),a=t.useMemo(()=>e?v.find(n=>L.sameBridgeApiChainId(n.chainId,e.chainId))??r:r,[e==null?void 0:e.chainId,v,r]),P=t.useMemo(()=>L.toBridgeApiChainId(e==null?void 0:e.chainId)??he,[e==null?void 0:e.chainId,he]);Vs.useDisconnectOnChainTypeChange(a==null?void 0:a.chainType);const q=Us.useNamespaceAddress(a==null?void 0:a.chainType),_e=q,je=Ye.isConnected&&!!q,Y=m!==""&&F!=="",J=t.useCallback(Ss(async n=>{!n||!Number(n)||!q||!(e!=null&&e.address)||!(o!=null&&o.address)||!r||!P||as({nativeAuthToken:Q??"",body:{tokenIn:e.address,amountIn:n,fromChainId:P,tokenOut:o.address,toChainId:G}})},500),[q,P,e==null?void 0:e.address,o==null?void 0:o.address,r]),h=t.useCallback(n=>{hs(()=>n)},[]),_=t.useCallback(n=>{V(()=>n)},[]),gs=t.useCallback(()=>{M==null||M()},[M]),qs=t.useCallback(()=>{const n=As.formatAmount({decimals:e==null?void 0:e.decimals,input:(e==null?void 0:e.balance)??"0",addCommas:!1,digits:4});p.setFieldValue("firstAmount",n),h(n)},[e==null?void 0:e.balance,e==null?void 0:e.decimals,h]),Ie=t.useCallback(async n=>{h(""),_(""),ue(),ue(),D==null||D(n)},[h,_,D]),ps=()=>{us(),Xe()};t.useEffect(()=>{const n=ce.current;if(ce.current=r==null?void 0:r.chainId,!!n&&(r==null?void 0:r.chainId)!==(e==null?void 0:e.chainId)){const x=R==null?void 0:R.find(u=>u.chainId.toString()===(r==null?void 0:r.chainId));if(!x)return;fe(x)}},[r==null?void 0:r.chainId]);const xs=t.useCallback(async({transactions:n,provider:x})=>{var ye,Ae,ke;const u=[];I(!0),z(()=>n.length);try{let A=-1;for(const i of n){++A;try{switch(Ds.resolveSigningChainType(i,a)){case N.ChainType.evm:{const g=await ge.signTransaction({...i,value:BigInt(i.value),gas:BigInt(i.gasLimit),account:_e});if(!g||(u.push({...i,txHash:g}),A===n.length-1||!g))break;const U=await Ns.waitForTransactionReceipt(de,{confirmations:1,hash:g});console.info({transactionReceipt:U,hash:g});break}case N.ChainType.sol:if(!i.instructions||!i.feePayer)break;const ae=await qe.signTransaction({feePayer:i.feePayer,instructions:i.instructions,recentBlockhash:i.recentBlockhash});if(!ae)break;u.push({...i,txHash:ae});break;case N.ChainType.btc:if(!i.bitcoinParams){console.error("No bitcoin params");break}const vs=await pe.signTransaction(i.bitcoinParams);u.push({...i,txHash:vs});break;case N.ChainType.sui:{const g=(ye=i.suiParams)==null?void 0:ye.transactionBytes,U=(Ae=i.suiParams)==null?void 0:Ae.sender;if(!g||!U){console.error("No Sui transaction bytes or sender address");break}const we=await xe.signTransaction({transaction:g,address:U});if(!we)break;u.push({...i,suiParams:{...i.suiParams,signature:we}});break}default:k.toast.error("Provider not supported"),I(!1);return}z(()=>n.length-1-A)}catch{k.toast.dismiss(),k.toast.error("Transaction aborted"),b==null||b("Transaction aborted"),I(!1);return}}const{data:re}=await be({transactions:u,provider:x,url:Ms.getApiURL()??"",token:Q??""}),Ne=((ke=re.transactions)==null?void 0:ke.map(i=>i.txHash).filter(i=>!!i))??[],Se=u.map(i=>i.txHash).filter(i=>!!i),Cs=Ne.length>0?Ne:Se.length>0?Se:re.batchId?[re.batchId]:[];Ie(Cs),I(!1)}catch(A){console.error(A),k.toast.dismiss(),k.toast.error("Transaction cancelled"),b==null||b("Transaction cancelled"),I(!1),z(0),fs(),h(""),_("")}},[a==null?void 0:a.chainType,_e,de,h,_,Q,Ie,be,pe.signTransaction,ge.signTransaction,qe.signTransaction,xe.signTransaction]),{formik:p,firstAmountError:Z,secondAmountError:ee,fromChainError:se,senderAddressError:te,receiverAddressError:ne,confirmRateError:ie,handleBlur:T,handleChange:Ce,handleSubmit:bs,resetSwapForm:fs}=S.useBridgeFormik({isMvxConnected:!!l,rate:d,sender:q??"",receiver:l??"",firstToken:e,firstAmount:m,fromChainId:P,toChainId:G,secondToken:o,secondAmount:F,setForceRefetchRate:Ke,senderChainType:a==null?void 0:a.chainType,receiverChainType:N.ChainType.mvx,onSubmit:xs}),_s=!!(Z||ee||se||y||te||ne||ie),js=t.useMemo(()=>m!==""?y??Z:void 0,[Z,m,y]),Is=t.useMemo(()=>F!==""?se??ee:void 0,[se,ee,F]);return t.useEffect(()=>(m||V(""),J(m),O&&clearInterval(O),O=setInterval(()=>{J(m)},50*1e3),()=>clearInterval(O)),[m,$e,J]),t.useEffect(()=>{d!=null&&d.amountOut&&(p.setFieldValue(S.BridgeFormikValuesEnum.secondAmount,d.amountOut),V(d.amountOut))},[d==null?void 0:d.amountOut]),t.useEffect(()=>{y&&(p.setFieldValue(S.BridgeFormikValuesEnum.secondAmount,"0"),V("0"))},[y]),t.useEffect(()=>{w&&(p.setFieldValue(S.BridgeFormikValuesEnum.firstAmount,w),h(w))},[]),t.useEffect(()=>{j&&(p.setFieldValue(S.BridgeFormikValuesEnum.secondAmount,j),_(j))},[j]),s.jsx(s.Fragment,{children:s.jsxs("form",{ref:ze,noValidate:!0,className:"liq-flex liq-flex-col liq-gap-1 liq-relative",autoComplete:"off",onSubmit:bs,children:[Le&&s.jsx(Xs.BridgeHistory,{mvxAddress:l,onClose:gs}),s.jsxs(Ee.AmountCard,{className:Me.mxClsx("liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",{"liq-pointer-events-none":W,"focus-within:liq-outline-neutral-700/75 hover:liq-outline-neutral-700/55 hover:focus-within:liq-outline-neutral-700/80":!W}),children:[s.jsxs("div",{className:"liq-flex liq-items-center liq-gap-1",children:[s.jsx("span",{children:"From"}),s.jsx($s.BridgeAccountDisplay,{disabled:B,activeChain:a})]}),te&&s.jsx("div",{className:"liq-text-red-400 liq-text-xs liq-mt-1",children:te}),s.jsxs("div",{className:"liq-flex liq-justify-between liq-gap-1",children:[s.jsx(Re.AmountInput,{inputName:"firstAmount",inputValue:p.values.firstAmount,amountError:js,disabled:!1,onInputDebounceChange:h,onInputChange:Ce,onBlur:T}),s.jsx(Fe.TokenSelector,{name:"firstToken",disabled:B,options:R,areOptionsLoading:K,isMvxSelector:ds,isDestination:!1,color:"neutral-850",onChange:fe,onBlur:T,onMaxBtnClick:qs,selectedOption:e,onTokenSelectorDisplay:n=>Qe(n)})]})]}),s.jsx("div",{className:"liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10",children:Je&&s.jsx(Ys.ToggleDirection,{onChangeDirection:ps})}),s.jsxs(Ee.AmountCard,{className:Me.mxClsx("liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",{"liq-pointer-events-none":W}),children:[s.jsxs("div",{className:"liq-flex liq-items-center liq-gap-1",children:[s.jsx("span",{children:"To"}),s.jsx(Ks.MvxAccountDisplay,{accountAddress:l,chainIcon:H.safeImageUrl(c==null?void 0:c.pngUrl),username:Ve,accountExplorerUrl:`${me.mvxExplorerAddress}/accounts/${l}`,showTag:!0,onDisconnect:Ge,onConnect:oe})]}),ne&&s.jsx("div",{className:"liq-text-red-400 liq-text-xs liq-mt-1",children:ne}),ie&&s.jsx("div",{className:"liq-text-red-400 liq-text-xs liq-mt-1",children:ie}),s.jsxs("div",{className:"liq-flex liq-justify-between liq-gap-1",children:[s.jsx(Re.AmountInput,{inputName:"secondAmount",inputValue:p.values.secondAmount,amountError:Is,disabled:!1,onInputDebounceChange:_,onInputChange:Ce,onBlur:T}),s.jsx(Fe.TokenSelector,{name:"secondToken",disabled:B,omitDisableClass:!0,options:cs,areOptionsLoading:K,isMvxSelector:ms,color:"neutral-850",onChange:ls,onBlur:T,selectedOption:o})]})]}),s.jsxs("div",{className:"liq-flex liq-items-center liq-justify-center",children:[!l&&s.jsx(Qs.MvxConnectButton,{mvxAccountAddress:l,icon:H.safeImageUrl(c==null?void 0:c.pngUrl),onClick:oe}),l&&!je&&s.jsx(zs.BridgeConnectButton,{className:"liq-w-full liq-rounded-xl liq-bg-neutral-850/50 liq-px-8 liq-py-3 liq-font-semibold liq-text-primary-200 liq-transition-colors liq-duration-200 hover:enabled:liq-bg-primary-700/80 disabled:liq-opacity-50",disabled:B,activeChain:a}),l&&je&&s.jsxs(Ws.MxButton,{type:"submit",variant:"neutral-850",className:"liq-w-full disabled:liq-bg-neutral-850/50 liq-py-3 hover:enabled:liq-bg-primary !liq-text-primary-200",disabled:!Y||B||!l||!q||_s||E,children:[Y&&!E&&s.jsxs("div",{className:"liq-flex liq-justify-center liq-items-center liq-gap-2",children:[s.jsx("div",{children:"Deposit on "}),s.jsx("img",{src:H.safeImageUrl(c==null?void 0:c.pngUrl),alt:"",className:"liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"}),s.jsx("div",{children:"MultiversX"})]}),!Y&&!E&&s.jsx("span",{className:"liq-text-neutral-100",children:"Enter amount"}),E&&s.jsxs("div",{className:"liq-flex liq-justify-center liq-items-center liq-gap-2",children:[s.jsx(ys.FontAwesomeIcon,{icon:Bs.faSpinner,spin:!0,className:"liq-mx-1 liq-flex liq-items-center"}),s.jsx("div",{children:"Depositing on"}),s.jsx("img",{src:H.safeImageUrl(c==null?void 0:c.pngUrl),alt:"",className:"liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"}),s.jsx("div",{children:"MultiversX"})]})]})]}),q&&X>0&&s.jsx("div",{className:"liq-flex liq-items-center liq-justify-center liq-text-neutral-300 liq-text-sm",children:s.jsxs("div",{children:["You will be asked to sign ",X," ",X>1?"transactions":"transaction"," ","on your wallet"]})})]})})};exports.Deposit=Js;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),Bs=require("@fortawesome/free-solid-svg-icons/faSpinner"),ys=require("@fortawesome/react-fontawesome"),As=require("@multiversx/sdk-dapp-utils/out/helpers/formatAmount"),Ns=require("@reown/appkit/react"),ks=require("@wagmi/core"),Ss=require("lodash/debounce"),t=require("react"),k=require("react-toastify"),ws=require("./hooks/useBridgeTokenSelection.js"),Ds=require("./utils/bridgeFormHelpers.js"),De=require("../../../constants/index.js"),Ms=require("../../../helpers/getApiURL.js");require("../../constants/index.js");const L=require("../../../helpers/safeImageUrl.js");require("@solana/web3.js");require("bitcoinjs-lib");require("viem");const S=require("../../../types/chainType.js"),Es=require("../../context/useWeb3App.js"),T=require("../../helpers/resolveBridgeApiChainId.js"),Rs=require("../../hooks/useAccount.js"),Fs=require("../../hooks/useBridgeApiChainId.js"),w=require("../../hooks/useBridgeFormik.js"),Vs=require("../../hooks/useDisconnectOnChainTypeChange.js"),Ps=require("../../hooks/useFetchBridgeData.js"),Us=require("../../hooks/useGetChainId.js"),Hs=require("../../hooks/useNamespaceAddress.js"),Ls=require("../../hooks/useSendTransactions.js"),Ts=require("../../hooks/useSignTransaction.js"),Os=require("../../queries/useGetHistory.query.js"),Gs=require("../../queries/useGetRate.mutation.js"),Me=require("../../utils/mxClsx.js"),Ee=require("../AmountCard/AmountCard.js"),Re=require("../AmountInput/AmountInput.js"),Ws=require("../base/MxButton/MxButton.js");require("../base/MxCard/MxCard.js");require("../base/MxLink/MxLink.js");require("../base/MxSearch/MxSearch.js");require("@fortawesome/free-solid-svg-icons/faClose");require("@headlessui/react");require("react-dom");require("react-popper");require("../base/MxTooltip/components/TooltipContainer/TooltipContainer.js");const Xs=require("../BridgeHistory/BridgeHistory.js"),zs=require("../Connect/BridgeConnectButton.js");require("wagmi");const Qs=require("../Connect/MvxConnectButton.js"),$s=require("../Connect/BridgeAccountDisplay.js"),Ks=require("../Connect/MvxAccountDisplay.js");require("@reown/appkit-controllers");const Ys=require("../ToggleDirection/ToggleDirection.js"),Fe=require("../TokenSelector/TokenSelector.js");let O;const Js=({mvxChainId:G,mvxAddress:l,username:Ve,callbackRoute:Pe="/",firstTokenIdentifier:Ue,secondTokenIdentifier:He,firstTokenAmount:D,secondTokenAmount:j,refetchTrigger:Le,showHistory:Te,forcedDestinationTokenSymbol:Oe,onSuccessfullySentTransaction:M,onFailedSentTransaction:b,onHistoryClose:E,onMvxConnect:ce,onMvxDisconnect:Ge,onNavigate:We,onChangeDirection:Xe})=>{var ve,Be;const ze=t.useRef(null),le=t.useRef(void 0),[W,Qe]=t.useState(!1),[R,I]=t.useState(!1),[$e,Ke]=t.useState(1),[X,z]=t.useState(0),Ye=Rs.useAccount(),{switchNetwork:ue}=Ns.useAppKitNetwork(),de=Os.useInvalidateHistoryQuery(),{config:me,options:he,supportedChains:C,nativeAuthToken:Q,bridgeOnly:Je}=Es.useWeb3App(),$=Us.useGetChainId(),ge=Fs.useBridgeApiChainId(),{evmTokensWithBalances:Ze,mvxTokensWithBalances:es,isTokensLoading:ss,isLoadingEvmTokensBalances:ts,isLoadingMvxTokensBalances:ns,chains:v=[],isChainsLoading:is}=Ps.useFetchBridgeData({refetchTrigger:Le,mvxAddress:l,mvxApiURL:he.mvxApiURL}),K=ss||ts||ns||is,rs=t.useMemo(()=>C.find(n=>T.sameBridgeApiChainId(n.id,$)),[$,C]),c=t.useMemo(()=>v.find(n=>n.chainId.toString()===G.toString()),[$,v]),{evm:qe,solana:pe,bitcoin:xe,sui:be}=Ts.useSignTransaction(),fe=Ls.useSendTransactions(),{mutate:as,data:d,isPending:B,error:f}=Gs.useGetRateMutation(),y=((ve=f==null?void 0:f.response)==null?void 0:ve.status)===400?(Be=f==null?void 0:f.response)==null?void 0:Be.data.message:void 0,os=t.useCallback(n=>{const x=C.find(u=>T.sameBridgeApiChainId(u.id,n.id));x&&ue(x)},[C,ue]),{firstToken:e,secondToken:o,fromOptions:A,toOptions:cs,selectedChainOption:r,onChangeFirstSelect:Y,onChangeSecondSelect:ls,handleChangeDirection:us}=ws.useBridgeTokenSelection({chains:v,activeChain:rs,sdkChains:C,switchNetwork:os,fromTokens:Ze,toTokens:es,firstTokenIdentifier:Ue,secondTokenIdentifier:He,forcedDestinationTokenSymbol:Oe,isTokensLoading:K,callbackRoute:Pe,onNavigate:We}),ds=t.useMemo(()=>e?De.MVX_CHAIN_IDS.includes(e.chainId.toString()):!1,[e==null?void 0:e.chainId]),ms=t.useMemo(()=>o?De.MVX_CHAIN_IDS.includes(o.chainId.toString()):!1,[o==null?void 0:o.chainId]),[m,hs]=t.useState(D??""),[F,V]=t.useState(j??""),a=t.useMemo(()=>e?v.find(n=>T.sameBridgeApiChainId(n.chainId,e.chainId))??r:r,[e==null?void 0:e.chainId,v,r]),P=t.useMemo(()=>T.toBridgeApiChainId(e==null?void 0:e.chainId)??ge,[e==null?void 0:e.chainId,ge]);Vs.useDisconnectOnChainTypeChange(a==null?void 0:a.chainType);const q=Hs.useNamespaceAddress(a==null?void 0:a.chainType),_e=q,je=Ye.isConnected&&!!q,J=m!==""&&F!=="",Z=t.useCallback(Ss(async n=>{!n||!Number(n)||!q||!(e!=null&&e.address)||!(o!=null&&o.address)||!r||!P||as({nativeAuthToken:Q??"",body:{tokenIn:e.address,amountIn:n,fromChainId:P,tokenOut:o.address,toChainId:G}})},500),[q,P,e==null?void 0:e.address,o==null?void 0:o.address,r]),h=t.useCallback(n=>{hs(()=>n)},[]),_=t.useCallback(n=>{V(()=>n)},[]),gs=t.useCallback(()=>{E==null||E()},[E]),qs=t.useCallback(()=>{const n=As.formatAmount({decimals:e==null?void 0:e.decimals,input:(e==null?void 0:e.balance)??"0",addCommas:!1,digits:4});p.setFieldValue("firstAmount",n),h(n)},[e==null?void 0:e.balance,e==null?void 0:e.decimals,h]),Ie=t.useCallback(async n=>{h(""),_(""),de(),de(),M==null||M(n)},[h,_,M]),ps=()=>{us(),Xe()};t.useEffect(()=>{const n=le.current;if(le.current=r==null?void 0:r.chainId,!!n&&(r==null?void 0:r.chainId)!==(e==null?void 0:e.chainId)){const x=A==null?void 0:A.find(u=>u.chainId.toString()===(r==null?void 0:r.chainId));if(!x)return;Y(x)}},[r==null?void 0:r.chainId,e==null?void 0:e.chainId,A,Y]);const xs=t.useCallback(async({transactions:n,provider:x})=>{var ye,Ae,Ne;const u=[];I(!0),z(()=>n.length);try{let N=-1;for(const i of n){++N;try{switch(Ds.resolveSigningChainType(i,a)){case S.ChainType.evm:{const g=await qe.signTransaction({...i,value:BigInt(i.value),gas:BigInt(i.gasLimit),account:_e});if(!g||(u.push({...i,txHash:g}),N===n.length-1||!g))break;const H=await ks.waitForTransactionReceipt(me,{confirmations:1,hash:g});console.info({transactionReceipt:H,hash:g});break}case S.ChainType.sol:if(!i.instructions||!i.feePayer)break;const oe=await pe.signTransaction({feePayer:i.feePayer,instructions:i.instructions,recentBlockhash:i.recentBlockhash});if(!oe)break;u.push({...i,txHash:oe});break;case S.ChainType.btc:if(!i.bitcoinParams){console.error("No bitcoin params");break}const vs=await xe.signTransaction(i.bitcoinParams);u.push({...i,txHash:vs});break;case S.ChainType.sui:{const g=(ye=i.suiParams)==null?void 0:ye.transactionBytes,H=(Ae=i.suiParams)==null?void 0:Ae.sender;if(!g||!H){console.error("No Sui transaction bytes or sender address");break}const we=await be.signTransaction({transaction:g,address:H});if(!we)break;u.push({...i,suiParams:{...i.suiParams,signature:we}});break}default:k.toast.error("Provider not supported"),I(!1);return}z(()=>n.length-1-N)}catch{k.toast.dismiss(),k.toast.error("Transaction aborted"),b==null||b("Transaction aborted"),I(!1);return}}const{data:ae}=await fe({transactions:u,provider:x,url:Ms.getApiURL()??"",token:Q??""}),ke=((Ne=ae.transactions)==null?void 0:Ne.map(i=>i.txHash).filter(i=>!!i))??[],Se=u.map(i=>i.txHash).filter(i=>!!i),Cs=ke.length>0?ke:Se.length>0?Se:ae.batchId?[ae.batchId]:[];Ie(Cs),I(!1)}catch(N){console.error(N),k.toast.dismiss(),k.toast.error("Transaction cancelled"),b==null||b("Transaction cancelled"),I(!1),z(0),fs(),h(""),_("")}},[a==null?void 0:a.chainType,_e,me,h,_,Q,Ie,fe,xe.signTransaction,qe.signTransaction,pe.signTransaction,be.signTransaction]),{formik:p,firstAmountError:ee,secondAmountError:se,fromChainError:te,senderAddressError:ne,receiverAddressError:ie,confirmRateError:re,handleBlur:U,handleChange:Ce,handleSubmit:bs,resetSwapForm:fs}=w.useBridgeFormik({isMvxConnected:!!l,rate:d,sender:q??"",receiver:l??"",firstToken:e,firstAmount:m,fromChainId:P,toChainId:G,secondToken:o,secondAmount:F,setForceRefetchRate:Ke,senderChainType:a==null?void 0:a.chainType,receiverChainType:S.ChainType.mvx,onSubmit:xs}),_s=!!(ee||se||te||y||ne||ie||re),js=t.useMemo(()=>m!==""?y??ee:void 0,[ee,m,y]),Is=t.useMemo(()=>F!==""?te??se:void 0,[te,se,F]);return t.useEffect(()=>(m||V(""),Z(m),O&&clearInterval(O),O=setInterval(()=>{Z(m)},50*1e3),()=>clearInterval(O)),[m,$e,Z]),t.useEffect(()=>{d!=null&&d.amountOut&&(p.setFieldValue(w.BridgeFormikValuesEnum.secondAmount,d.amountOut),V(d.amountOut))},[d==null?void 0:d.amountOut]),t.useEffect(()=>{y&&(p.setFieldValue(w.BridgeFormikValuesEnum.secondAmount,"0"),V("0"))},[y]),t.useEffect(()=>{D&&(p.setFieldValue(w.BridgeFormikValuesEnum.firstAmount,D),h(D))},[]),t.useEffect(()=>{j&&(p.setFieldValue(w.BridgeFormikValuesEnum.secondAmount,j),_(j))},[j]),s.jsx(s.Fragment,{children:s.jsxs("form",{ref:ze,noValidate:!0,className:"liq-flex liq-flex-col liq-gap-1 liq-relative",autoComplete:"off",onSubmit:bs,children:[Te&&s.jsx(Xs.BridgeHistory,{mvxAddress:l,onClose:gs}),s.jsxs(Ee.AmountCard,{className:Me.mxClsx("liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",{"liq-pointer-events-none":W,"focus-within:liq-outline-neutral-700/75 hover:liq-outline-neutral-700/55 hover:focus-within:liq-outline-neutral-700/80":!W}),children:[s.jsxs("div",{className:"liq-flex liq-items-center liq-gap-1",children:[s.jsx("span",{children:"From"}),s.jsx($s.BridgeAccountDisplay,{disabled:B,activeChain:a})]}),ne&&s.jsx("div",{className:"liq-text-red-400 liq-text-xs liq-mt-1",children:ne}),s.jsxs("div",{className:"liq-flex liq-justify-between liq-gap-1",children:[s.jsx(Re.AmountInput,{inputName:"firstAmount",inputValue:p.values.firstAmount,amountError:js,disabled:!1,onInputDebounceChange:h,onInputChange:Ce,onBlur:U}),s.jsx(Fe.TokenSelector,{name:"firstToken",disabled:B,options:A,areOptionsLoading:K,isMvxSelector:ds,isDestination:!1,color:"neutral-850",onChange:Y,onBlur:U,onMaxBtnClick:qs,selectedOption:e,onTokenSelectorDisplay:n=>Qe(n)})]})]}),s.jsx("div",{className:"liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10",children:Je&&s.jsx(Ys.ToggleDirection,{onChangeDirection:ps})}),s.jsxs(Ee.AmountCard,{className:Me.mxClsx("liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",{"liq-pointer-events-none":W}),children:[s.jsxs("div",{className:"liq-flex liq-items-center liq-gap-1",children:[s.jsx("span",{children:"To"}),s.jsx(Ks.MvxAccountDisplay,{accountAddress:l,chainIcon:L.safeImageUrl(c==null?void 0:c.pngUrl),username:Ve,accountExplorerUrl:`${he.mvxExplorerAddress}/accounts/${l}`,showTag:!0,onDisconnect:Ge,onConnect:ce})]}),ie&&s.jsx("div",{className:"liq-text-red-400 liq-text-xs liq-mt-1",children:ie}),re&&s.jsx("div",{className:"liq-text-red-400 liq-text-xs liq-mt-1",children:re}),s.jsxs("div",{className:"liq-flex liq-justify-between liq-gap-1",children:[s.jsx(Re.AmountInput,{inputName:"secondAmount",inputValue:p.values.secondAmount,amountError:Is,disabled:!1,onInputDebounceChange:_,onInputChange:Ce,onBlur:U}),s.jsx(Fe.TokenSelector,{name:"secondToken",disabled:B,omitDisableClass:!0,options:cs,areOptionsLoading:K,isMvxSelector:ms,color:"neutral-850",onChange:ls,onBlur:U,selectedOption:o})]})]}),s.jsxs("div",{className:"liq-flex liq-items-center liq-justify-center",children:[!l&&s.jsx(Qs.MvxConnectButton,{mvxAccountAddress:l,icon:L.safeImageUrl(c==null?void 0:c.pngUrl),onClick:ce}),l&&!je&&s.jsx(zs.BridgeConnectButton,{className:"liq-w-full liq-rounded-xl liq-bg-neutral-850/50 liq-px-8 liq-py-3 liq-font-semibold liq-text-primary-200 liq-transition-colors liq-duration-200 hover:enabled:liq-bg-primary-700/80 disabled:liq-opacity-50",disabled:B,activeChain:a}),l&&je&&s.jsxs(Ws.MxButton,{type:"submit",variant:"neutral-850",className:"liq-w-full disabled:liq-bg-neutral-850/50 liq-py-3 hover:enabled:liq-bg-primary !liq-text-primary-200",disabled:!J||B||!l||!q||_s||R,children:[J&&!R&&s.jsxs("div",{className:"liq-flex liq-justify-center liq-items-center liq-gap-2",children:[s.jsx("div",{children:"Deposit on "}),s.jsx("img",{src:L.safeImageUrl(c==null?void 0:c.pngUrl),alt:"",className:"liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"}),s.jsx("div",{children:"MultiversX"})]}),!J&&!R&&s.jsx("span",{className:"liq-text-neutral-100",children:"Enter amount"}),R&&s.jsxs("div",{className:"liq-flex liq-justify-center liq-items-center liq-gap-2",children:[s.jsx(ys.FontAwesomeIcon,{icon:Bs.faSpinner,spin:!0,className:"liq-mx-1 liq-flex liq-items-center"}),s.jsx("div",{children:"Depositing on"}),s.jsx("img",{src:L.safeImageUrl(c==null?void 0:c.pngUrl),alt:"",className:"liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"}),s.jsx("div",{children:"MultiversX"})]})]})]}),q&&X>0&&s.jsx("div",{className:"liq-flex liq-items-center liq-justify-center liq-text-neutral-300 liq-text-sm",children:s.jsxs("div",{children:["You will be asked to sign ",X," ",X>1?"transactions":"transaction"," ","on your wallet"]})})]})})};exports.Deposit=Js;
@@ -6,19 +6,19 @@ import { useAppKitNetwork as Vi } from "@reown/appkit/react";
6
6
  import { waitForTransactionReceipt as Fi } from "@wagmi/core";
7
7
  import Li from "lodash/debounce";
8
8
  import { useRef as Le, useState as B, useMemo as g, useCallback as f, useEffect as N } from "react";
9
- import { toast as M } from "react-toastify";
10
- import { useBridgeTokenSelection as ki } from "./hooks/useBridgeTokenSelection.mjs";
11
- import { resolveSigningChainType as Ui } from "./utils/bridgeFormHelpers.mjs";
12
- import { MVX_CHAIN_IDS as ke } from "../../../constants/index.mjs";
13
- import { getApiURL as ji } from "../../../helpers/getApiURL.mjs";
9
+ import { toast as P } from "react-toastify";
10
+ import { useBridgeTokenSelection as Ui } from "./hooks/useBridgeTokenSelection.mjs";
11
+ import { resolveSigningChainType as ji } from "./utils/bridgeFormHelpers.mjs";
12
+ import { MVX_CHAIN_IDS as Ue } from "../../../constants/index.mjs";
13
+ import { getApiURL as ki } from "../../../helpers/getApiURL.mjs";
14
14
  import "../../constants/index.mjs";
15
15
  import { safeImageUrl as z } from "../../../helpers/safeImageUrl.mjs";
16
16
  import "@solana/web3.js";
17
17
  import "bitcoinjs-lib";
18
18
  import "viem";
19
- import { ChainType as P } from "../../../types/chainType.mjs";
19
+ import { ChainType as V } from "../../../types/chainType.mjs";
20
20
  import { useWeb3App as Hi } from "../../context/useWeb3App.mjs";
21
- import { sameBridgeApiChainId as de, toBridgeApiChainId as Oi } from "../../helpers/resolveBridgeApiChainId.mjs";
21
+ import { sameBridgeApiChainId as me, toBridgeApiChainId as Oi } from "../../helpers/resolveBridgeApiChainId.mjs";
22
22
  import { useAccount as Wi } from "../../hooks/useAccount.mjs";
23
23
  import { useBridgeApiChainId as Xi } from "../../hooks/useBridgeApiChainId.mjs";
24
24
  import { useBridgeFormik as zi, BridgeFormikValuesEnum as G } from "../../hooks/useBridgeFormik.mjs";
@@ -30,8 +30,8 @@ import { useSendTransactions as Ki } from "../../hooks/useSendTransactions.mjs";
30
30
  import { useSignTransaction as Yi } from "../../hooks/useSignTransaction.mjs";
31
31
  import { useInvalidateHistoryQuery as Ji } from "../../queries/useGetHistory.query.mjs";
32
32
  import { useGetRateMutation as Zi } from "../../queries/useGetRate.mutation.mjs";
33
- import { mxClsx as Ue } from "../../utils/mxClsx.mjs";
34
- import { AmountCard as je } from "../AmountCard/AmountCard.mjs";
33
+ import { mxClsx as je } from "../../utils/mxClsx.mjs";
34
+ import { AmountCard as ke } from "../AmountCard/AmountCard.mjs";
35
35
  import { AmountInput as He } from "../AmountInput/AmountInput.mjs";
36
36
  import { MxButton as Ti } from "../base/MxButton/MxButton.mjs";
37
37
  import "../base/MxCard/MxCard.mjs";
@@ -49,40 +49,40 @@ import { MvxConnectButton as tt } from "../Connect/MvxConnectButton.mjs";
49
49
  import { BridgeAccountDisplay as nt } from "../Connect/BridgeAccountDisplay.mjs";
50
50
  import { MvxAccountDisplay as rt } from "../Connect/MvxAccountDisplay.mjs";
51
51
  import "@reown/appkit-controllers";
52
- import { ToggleDirection as ot } from "../ToggleDirection/ToggleDirection.mjs";
52
+ import { ToggleDirection as at } from "../ToggleDirection/ToggleDirection.mjs";
53
53
  import { TokenSelector as Oe } from "../TokenSelector/TokenSelector.mjs";
54
54
  let Q;
55
- const an = ({
55
+ const on = ({
56
56
  mvxChainId: _,
57
57
  mvxAddress: c,
58
58
  username: We,
59
59
  callbackRoute: Xe = "/",
60
60
  firstTokenIdentifier: ze,
61
61
  secondTokenIdentifier: Ge,
62
- firstTokenAmount: V,
62
+ firstTokenAmount: F,
63
63
  secondTokenAmount: C,
64
64
  refetchTrigger: Qe,
65
65
  showHistory: _e,
66
66
  forcedDestinationTokenSymbol: $e,
67
- onSuccessfullySentTransaction: F,
67
+ onSuccessfullySentTransaction: L,
68
68
  onFailedSentTransaction: I,
69
- onHistoryClose: L,
70
- onMvxConnect: me,
69
+ onHistoryClose: U,
70
+ onMvxConnect: ue,
71
71
  onMvxDisconnect: Ke,
72
72
  onNavigate: Ye,
73
73
  onChangeDirection: Je
74
74
  }) => {
75
75
  var De, Se;
76
- const Ze = Le(null), ue = Le(void 0), [$, Te] = B(!1), [k, A] = B(!1), [ei, ii] = B(1), [K, Y] = B(0), ti = Wi(), { switchNetwork: pe } = Vi(), he = Ji(), {
77
- config: ge,
78
- options: fe,
76
+ const Ze = Le(null), pe = Le(void 0), [$, Te] = B(!1), [j, A] = B(!1), [ei, ii] = B(1), [K, Y] = B(0), ti = Wi(), { switchNetwork: he } = Vi(), ge = Ji(), {
77
+ config: fe,
78
+ options: qe,
79
79
  supportedChains: w,
80
80
  nativeAuthToken: J,
81
81
  bridgeOnly: ni
82
- } = Hi(), Z = _i(), qe = Xi(), {
82
+ } = Hi(), Z = _i(), be = Xi(), {
83
83
  evmTokensWithBalances: ri,
84
- mvxTokensWithBalances: oi,
85
- isTokensLoading: ai,
84
+ mvxTokensWithBalances: ai,
85
+ isTokensLoading: oi,
86
86
  isLoadingEvmTokensBalances: si,
87
87
  isLoadingMvxTokensBalances: li,
88
88
  chains: D = [],
@@ -90,10 +90,10 @@ const an = ({
90
90
  } = Qi({
91
91
  refetchTrigger: Qe,
92
92
  mvxAddress: c,
93
- mvxApiURL: fe.mvxApiURL
94
- }), T = ai || si || li || ci, di = g(() => w.find((i) => de(i.id, Z)), [Z, w]), s = g(() => D.find(
93
+ mvxApiURL: qe.mvxApiURL
94
+ }), T = oi || si || li || ci, di = g(() => w.find((i) => me(i.id, Z)), [Z, w]), s = g(() => D.find(
95
95
  (i) => i.chainId.toString() === _.toString()
96
- ), [Z, D]), { evm: be, solana: ve, bitcoin: Ie, sui: xe } = Yi(), ye = Ki(), {
96
+ ), [Z, D]), { evm: ve, solana: Ie, bitcoin: xe, sui: ye } = Yi(), Be = Ki(), {
97
97
  mutate: mi,
98
98
  data: m,
99
99
  isPending: S,
@@ -101,49 +101,49 @@ const an = ({
101
101
  } = Zi(), R = ((De = x == null ? void 0 : x.response) == null ? void 0 : De.status) === 400 ? (Se = x == null ? void 0 : x.response) == null ? void 0 : Se.data.message : void 0, ui = f(
102
102
  (i) => {
103
103
  const v = w.find(
104
- (d) => de(d.id, i.id)
104
+ (d) => me(d.id, i.id)
105
105
  );
106
- v && pe(v);
106
+ v && he(v);
107
107
  },
108
- [w, pe]
108
+ [w, he]
109
109
  ), {
110
110
  firstToken: e,
111
- secondToken: a,
112
- fromOptions: U,
111
+ secondToken: o,
112
+ fromOptions: E,
113
113
  toOptions: pi,
114
114
  selectedChainOption: r,
115
- onChangeFirstSelect: Be,
115
+ onChangeFirstSelect: ee,
116
116
  onChangeSecondSelect: hi,
117
117
  handleChangeDirection: gi
118
- } = ki({
118
+ } = Ui({
119
119
  chains: D,
120
120
  activeChain: di,
121
121
  sdkChains: w,
122
122
  switchNetwork: ui,
123
123
  fromTokens: ri,
124
- toTokens: oi,
124
+ toTokens: ai,
125
125
  firstTokenIdentifier: ze,
126
126
  secondTokenIdentifier: Ge,
127
127
  forcedDestinationTokenSymbol: $e,
128
128
  isTokensLoading: T,
129
129
  callbackRoute: Xe,
130
130
  onNavigate: Ye
131
- }), fi = g(() => e ? ke.includes(e.chainId.toString()) : !1, [e == null ? void 0 : e.chainId]), qi = g(() => a ? ke.includes(a.chainId.toString()) : !1, [a == null ? void 0 : a.chainId]), [u, bi] = B(V ?? ""), [j, H] = B(C ?? ""), o = g(() => e ? D.find(
132
- (i) => de(i.chainId, e.chainId)
131
+ }), fi = g(() => e ? Ue.includes(e.chainId.toString()) : !1, [e == null ? void 0 : e.chainId]), qi = g(() => o ? Ue.includes(o.chainId.toString()) : !1, [o == null ? void 0 : o.chainId]), [u, bi] = B(F ?? ""), [k, H] = B(C ?? ""), a = g(() => e ? D.find(
132
+ (i) => me(i.chainId, e.chainId)
133
133
  ) ?? r : r, [e == null ? void 0 : e.chainId, D, r]), O = g(
134
- () => Oi(e == null ? void 0 : e.chainId) ?? qe,
135
- [e == null ? void 0 : e.chainId, qe]
134
+ () => Oi(e == null ? void 0 : e.chainId) ?? be,
135
+ [e == null ? void 0 : e.chainId, be]
136
136
  );
137
- Gi(o == null ? void 0 : o.chainType);
138
- const q = $i(o == null ? void 0 : o.chainType), Ne = q, Ce = ti.isConnected && !!q, ee = u !== "" && j !== "", ie = f(
137
+ Gi(a == null ? void 0 : a.chainType);
138
+ const q = $i(a == null ? void 0 : a.chainType), Ne = q, Ce = ti.isConnected && !!q, ie = u !== "" && k !== "", te = f(
139
139
  Li(async (i) => {
140
- !i || !Number(i) || !q || !(e != null && e.address) || !(a != null && a.address) || !r || !O || mi({
140
+ !i || !Number(i) || !q || !(e != null && e.address) || !(o != null && o.address) || !r || !O || mi({
141
141
  nativeAuthToken: J ?? "",
142
142
  body: {
143
143
  tokenIn: e.address,
144
144
  amountIn: i,
145
145
  fromChainId: O,
146
- tokenOut: a.address,
146
+ tokenOut: o.address,
147
147
  toChainId: _
148
148
  }
149
149
  });
@@ -152,7 +152,7 @@ const an = ({
152
152
  q,
153
153
  O,
154
154
  e == null ? void 0 : e.address,
155
- a == null ? void 0 : a.address,
155
+ o == null ? void 0 : o.address,
156
156
  r
157
157
  ]
158
158
  ), p = f((i) => {
@@ -160,8 +160,8 @@ const an = ({
160
160
  }, []), y = f((i) => {
161
161
  H(() => i);
162
162
  }, []), vi = f(() => {
163
- L == null || L();
164
- }, [L]), Ii = f(() => {
163
+ U == null || U();
164
+ }, [U]), Ii = f(() => {
165
165
  const i = Pi({
166
166
  decimals: e == null ? void 0 : e.decimals,
167
167
  input: (e == null ? void 0 : e.balance) ?? "0",
@@ -171,27 +171,32 @@ const an = ({
171
171
  b.setFieldValue("firstAmount", i), p(i);
172
172
  }, [e == null ? void 0 : e.balance, e == null ? void 0 : e.decimals, p]), Ae = f(
173
173
  async (i) => {
174
- p(""), y(""), he(), he(), F == null || F(i);
174
+ p(""), y(""), ge(), ge(), L == null || L(i);
175
175
  },
176
176
  [
177
177
  p,
178
178
  y,
179
- F
179
+ L
180
180
  ]
181
181
  ), xi = () => {
182
182
  gi(), Je();
183
183
  };
184
184
  N(() => {
185
- const i = ue.current;
186
- if (ue.current = r == null ? void 0 : r.chainId, !!i && (r == null ? void 0 : r.chainId) !== (e == null ? void 0 : e.chainId)) {
187
- const v = U == null ? void 0 : U.find(
185
+ const i = pe.current;
186
+ if (pe.current = r == null ? void 0 : r.chainId, !!i && (r == null ? void 0 : r.chainId) !== (e == null ? void 0 : e.chainId)) {
187
+ const v = E == null ? void 0 : E.find(
188
188
  (d) => d.chainId.toString() === (r == null ? void 0 : r.chainId)
189
189
  );
190
190
  if (!v)
191
191
  return;
192
- Be(v);
192
+ ee(v);
193
193
  }
194
- }, [r == null ? void 0 : r.chainId]);
194
+ }, [
195
+ r == null ? void 0 : r.chainId,
196
+ e == null ? void 0 : e.chainId,
197
+ E,
198
+ ee
199
+ ]);
195
200
  const yi = f(
196
201
  async ({
197
202
  transactions: i,
@@ -201,13 +206,13 @@ const an = ({
201
206
  const d = [];
202
207
  A(!0), Y(() => i.length);
203
208
  try {
204
- let E = -1;
209
+ let M = -1;
205
210
  for (const t of i) {
206
- ++E;
211
+ ++M;
207
212
  try {
208
- switch (Ui(t, o)) {
209
- case P.evm: {
210
- const h = await be.signTransaction({
213
+ switch (ji(t, a)) {
214
+ case V.evm: {
215
+ const h = await ve.signTransaction({
211
216
  ...t,
212
217
  value: BigInt(t.value),
213
218
  gas: BigInt(t.gasLimit),
@@ -216,10 +221,10 @@ const an = ({
216
221
  if (!h || (d.push({
217
222
  ...t,
218
223
  txHash: h
219
- }), E === i.length - 1 || !h))
224
+ }), M === i.length - 1 || !h))
220
225
  break;
221
226
  const X = await Fi(
222
- ge,
227
+ fe,
223
228
  {
224
229
  confirmations: 1,
225
230
  hash: h
@@ -231,27 +236,27 @@ const an = ({
231
236
  });
232
237
  break;
233
238
  }
234
- case P.sol:
239
+ case V.sol:
235
240
  if (!t.instructions || !t.feePayer)
236
241
  break;
237
- const ce = await ve.signTransaction({
242
+ const de = await Ie.signTransaction({
238
243
  feePayer: t.feePayer,
239
244
  instructions: t.instructions,
240
245
  recentBlockhash: t.recentBlockhash
241
246
  });
242
- if (!ce)
247
+ if (!de)
243
248
  break;
244
249
  d.push({
245
250
  ...t,
246
- txHash: ce
251
+ txHash: de
247
252
  });
248
253
  break;
249
- case P.btc:
254
+ case V.btc:
250
255
  if (!t.bitcoinParams) {
251
256
  console.error("No bitcoin params");
252
257
  break;
253
258
  }
254
- const Si = await Ie.signTransaction(
259
+ const Si = await xe.signTransaction(
255
260
  t.bitcoinParams
256
261
  );
257
262
  d.push({
@@ -259,13 +264,13 @@ const an = ({
259
264
  txHash: Si
260
265
  });
261
266
  break;
262
- case P.sui: {
267
+ case V.sui: {
263
268
  const h = (Re = t.suiParams) == null ? void 0 : Re.transactionBytes, X = (Ee = t.suiParams) == null ? void 0 : Ee.sender;
264
269
  if (!h || !X) {
265
270
  console.error("No Sui transaction bytes or sender address");
266
271
  break;
267
272
  }
268
- const Fe = await xe.signTransaction({
273
+ const Fe = await ye.signTransaction({
269
274
  transaction: h,
270
275
  address: X
271
276
  });
@@ -281,50 +286,50 @@ const an = ({
281
286
  break;
282
287
  }
283
288
  default:
284
- M.error("Provider not supported"), A(!1);
289
+ P.error("Provider not supported"), A(!1);
285
290
  return;
286
291
  }
287
292
  Y(
288
- () => i.length - 1 - E
293
+ () => i.length - 1 - M
289
294
  );
290
295
  } catch {
291
- M.dismiss(), M.error("Transaction aborted"), I == null || I("Transaction aborted"), A(!1);
296
+ P.dismiss(), P.error("Transaction aborted"), I == null || I("Transaction aborted"), A(!1);
292
297
  return;
293
298
  }
294
299
  }
295
- const { data: le } = await ye({
300
+ const { data: ce } = await Be({
296
301
  transactions: d,
297
302
  provider: v,
298
- url: ji() ?? "",
303
+ url: ki() ?? "",
299
304
  token: J ?? ""
300
- }), Pe = ((Me = le.transactions) == null ? void 0 : Me.map((t) => t.txHash).filter((t) => !!t)) ?? [], Ve = d.map((t) => t.txHash).filter((t) => !!t), Di = Pe.length > 0 ? Pe : Ve.length > 0 ? Ve : le.batchId ? [le.batchId] : [];
305
+ }), Pe = ((Me = ce.transactions) == null ? void 0 : Me.map((t) => t.txHash).filter((t) => !!t)) ?? [], Ve = d.map((t) => t.txHash).filter((t) => !!t), Di = Pe.length > 0 ? Pe : Ve.length > 0 ? Ve : ce.batchId ? [ce.batchId] : [];
301
306
  Ae(Di), A(!1);
302
- } catch (E) {
303
- console.error(E), M.dismiss(), M.error("Transaction cancelled"), I == null || I("Transaction cancelled"), A(!1), Y(0), Ni(), p(""), y("");
307
+ } catch (M) {
308
+ console.error(M), P.dismiss(), P.error("Transaction cancelled"), I == null || I("Transaction cancelled"), A(!1), Y(0), Ni(), p(""), y("");
304
309
  }
305
310
  },
306
311
  [
307
- o == null ? void 0 : o.chainType,
312
+ a == null ? void 0 : a.chainType,
308
313
  Ne,
309
- ge,
314
+ fe,
310
315
  p,
311
316
  y,
312
317
  J,
313
318
  Ae,
314
- ye,
315
- Ie.signTransaction,
316
- be.signTransaction,
319
+ Be,
320
+ xe.signTransaction,
317
321
  ve.signTransaction,
318
- xe.signTransaction
322
+ Ie.signTransaction,
323
+ ye.signTransaction
319
324
  ]
320
325
  ), {
321
326
  formik: b,
322
- firstAmountError: te,
323
- secondAmountError: ne,
324
- fromChainError: re,
327
+ firstAmountError: ne,
328
+ secondAmountError: re,
329
+ fromChainError: ae,
325
330
  senderAddressError: oe,
326
- receiverAddressError: ae,
327
- confirmRateError: se,
331
+ receiverAddressError: se,
332
+ confirmRateError: le,
328
333
  handleBlur: W,
329
334
  handleChange: we,
330
335
  handleSubmit: Bi,
@@ -338,24 +343,24 @@ const an = ({
338
343
  firstAmount: u,
339
344
  fromChainId: O,
340
345
  toChainId: _,
341
- secondToken: a,
342
- secondAmount: j,
346
+ secondToken: o,
347
+ secondAmount: k,
343
348
  setForceRefetchRate: ii,
344
- senderChainType: o == null ? void 0 : o.chainType,
345
- receiverChainType: P.mvx,
349
+ senderChainType: a == null ? void 0 : a.chainType,
350
+ receiverChainType: V.mvx,
346
351
  onSubmit: yi
347
- }), Ci = !!(te || ne || re || R || oe || ae || se), Ai = g(() => u !== "" ? R ?? te : void 0, [te, u, R]), wi = g(() => j !== "" ? re ?? ne : void 0, [re, ne, j]);
348
- return N(() => (u || H(""), ie(u), Q && clearInterval(Q), Q = setInterval(() => {
349
- ie(u);
350
- }, 50 * 1e3), () => clearInterval(Q)), [u, ei, ie]), N(() => {
352
+ }), Ci = !!(ne || re || ae || R || oe || se || le), Ai = g(() => u !== "" ? R ?? ne : void 0, [ne, u, R]), wi = g(() => k !== "" ? ae ?? re : void 0, [ae, re, k]);
353
+ return N(() => (u || H(""), te(u), Q && clearInterval(Q), Q = setInterval(() => {
354
+ te(u);
355
+ }, 50 * 1e3), () => clearInterval(Q)), [u, ei, te]), N(() => {
351
356
  m != null && m.amountOut && (b.setFieldValue(G.secondAmount, m.amountOut), H(m.amountOut));
352
357
  }, [m == null ? void 0 : m.amountOut]), N(() => {
353
358
  R && (b.setFieldValue(G.secondAmount, "0"), H("0"));
354
359
  }, [R]), N(() => {
355
- V && (b.setFieldValue(
360
+ F && (b.setFieldValue(
356
361
  G.firstAmount,
357
- V
358
- ), p(V));
362
+ F
363
+ ), p(F));
359
364
  }, []), N(() => {
360
365
  C && (b.setFieldValue(
361
366
  G.secondAmount,
@@ -372,9 +377,9 @@ const an = ({
372
377
  children: [
373
378
  _e && /* @__PURE__ */ n(et, { mvxAddress: c, onClose: vi }),
374
379
  /* @__PURE__ */ l(
375
- je,
380
+ ke,
376
381
  {
377
- className: Ue(
382
+ className: je(
378
383
  "liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",
379
384
  {
380
385
  "liq-pointer-events-none": $,
@@ -388,7 +393,7 @@ const an = ({
388
393
  nt,
389
394
  {
390
395
  disabled: S,
391
- activeChain: o
396
+ activeChain: a
392
397
  }
393
398
  )
394
399
  ] }),
@@ -411,12 +416,12 @@ const an = ({
411
416
  {
412
417
  name: "firstToken",
413
418
  disabled: S,
414
- options: U,
419
+ options: E,
415
420
  areOptionsLoading: T,
416
421
  isMvxSelector: fi,
417
422
  isDestination: !1,
418
423
  color: "neutral-850",
419
- onChange: Be,
424
+ onChange: ee,
420
425
  onBlur: W,
421
426
  onMaxBtnClick: Ii,
422
427
  selectedOption: e,
@@ -427,11 +432,11 @@ const an = ({
427
432
  ]
428
433
  }
429
434
  ),
430
- /* @__PURE__ */ n("div", { className: "liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10", children: ni && /* @__PURE__ */ n(ot, { onChangeDirection: xi }) }),
435
+ /* @__PURE__ */ n("div", { className: "liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10", children: ni && /* @__PURE__ */ n(at, { onChangeDirection: xi }) }),
431
436
  /* @__PURE__ */ l(
432
- je,
437
+ ke,
433
438
  {
434
- className: Ue(
439
+ className: je(
435
440
  "liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",
436
441
  {
437
442
  "liq-pointer-events-none": $
@@ -446,15 +451,15 @@ const an = ({
446
451
  accountAddress: c,
447
452
  chainIcon: z(s == null ? void 0 : s.pngUrl),
448
453
  username: We,
449
- accountExplorerUrl: `${fe.mvxExplorerAddress}/accounts/${c}`,
454
+ accountExplorerUrl: `${qe.mvxExplorerAddress}/accounts/${c}`,
450
455
  showTag: !0,
451
456
  onDisconnect: Ke,
452
- onConnect: me
457
+ onConnect: ue
453
458
  }
454
459
  )
455
460
  ] }),
456
- ae && /* @__PURE__ */ n("div", { className: "liq-text-red-400 liq-text-xs liq-mt-1", children: ae }),
457
461
  se && /* @__PURE__ */ n("div", { className: "liq-text-red-400 liq-text-xs liq-mt-1", children: se }),
462
+ le && /* @__PURE__ */ n("div", { className: "liq-text-red-400 liq-text-xs liq-mt-1", children: le }),
458
463
  /* @__PURE__ */ l("div", { className: "liq-flex liq-justify-between liq-gap-1", children: [
459
464
  /* @__PURE__ */ n(
460
465
  He,
@@ -480,7 +485,7 @@ const an = ({
480
485
  color: "neutral-850",
481
486
  onChange: hi,
482
487
  onBlur: W,
483
- selectedOption: a
488
+ selectedOption: o
484
489
  }
485
490
  )
486
491
  ] })
@@ -493,7 +498,7 @@ const an = ({
493
498
  {
494
499
  mvxAccountAddress: c,
495
500
  icon: z(s == null ? void 0 : s.pngUrl),
496
- onClick: me
501
+ onClick: ue
497
502
  }
498
503
  ),
499
504
  c && !Ce && /* @__PURE__ */ n(
@@ -501,7 +506,7 @@ const an = ({
501
506
  {
502
507
  className: "liq-w-full liq-rounded-xl liq-bg-neutral-850/50 liq-px-8 liq-py-3 liq-font-semibold liq-text-primary-200 liq-transition-colors liq-duration-200 hover:enabled:liq-bg-primary-700/80 disabled:liq-opacity-50",
503
508
  disabled: S,
504
- activeChain: o
509
+ activeChain: a
505
510
  }
506
511
  ),
507
512
  c && Ce && /* @__PURE__ */ l(
@@ -510,9 +515,9 @@ const an = ({
510
515
  type: "submit",
511
516
  variant: "neutral-850",
512
517
  className: "liq-w-full disabled:liq-bg-neutral-850/50 liq-py-3 hover:enabled:liq-bg-primary !liq-text-primary-200",
513
- disabled: !ee || S || !c || !q || Ci || k,
518
+ disabled: !ie || S || !c || !q || Ci || j,
514
519
  children: [
515
- ee && !k && /* @__PURE__ */ l("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
520
+ ie && !j && /* @__PURE__ */ l("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
516
521
  /* @__PURE__ */ n("div", { children: "Deposit on " }),
517
522
  /* @__PURE__ */ n(
518
523
  "img",
@@ -524,8 +529,8 @@ const an = ({
524
529
  ),
525
530
  /* @__PURE__ */ n("div", { children: "MultiversX" })
526
531
  ] }),
527
- !ee && !k && /* @__PURE__ */ n("span", { className: "liq-text-neutral-100", children: "Enter amount" }),
528
- k && /* @__PURE__ */ l("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
532
+ !ie && !j && /* @__PURE__ */ n("span", { className: "liq-text-neutral-100", children: "Enter amount" }),
533
+ j && /* @__PURE__ */ l("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
529
534
  /* @__PURE__ */ n(
530
535
  Mi,
531
536
  {
@@ -562,5 +567,5 @@ const an = ({
562
567
  ) });
563
568
  };
564
569
  export {
565
- an as Deposit
570
+ on as Deposit
566
571
  };
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),ct=require("@multiversx/sdk-dapp-utils/out/helpers/formatAmount"),lt=require("@reown/appkit/react"),ut=require("lodash/debounce"),i=require("react"),ue=require("react-toastify"),dt=require("./hooks/useBridgeTokenSelection.js"),de=require("../../../constants/index.js"),mt=require("../../../helpers/getApiURL.js");require("../../constants/index.js");const Y=require("../../../helpers/safeImageUrl.js");require("@solana/web3.js");require("bitcoinjs-lib");require("viem");const qt=require("../../../types/chainType.js"),ht=require("../../../types/providerType.js"),me=require("../../context/useWeb3App.js"),D=require("../../helpers/resolveBridgeApiChainId.js");require("yup");require("@multiversx/sdk-dapp-utils/out/helpers/parseAmount");require("bignumber.js");const pt=require("../../hooks/useAccount.js");require("axios");const I=require("../../hooks/useBridgeFormik.js"),gt=require("../../hooks/useFetchBridgeData.js"),xt=require("../../hooks/useBridgeApiChainId.js");require("@tanstack/react-query");const _t=require("../../hooks/useGetChainId.js"),ft=require("../../hooks/useSendTransactions.js");require("@reown/appkit-adapter-solana/react");require("wagmi");require("@reown/appkit-controllers");const jt=require("../../hooks/useDisconnectOnChainTypeChange.js"),Ct=require("../../hooks/useNamespaceAddress.js"),bt=require("../../queries/useGetHistory.query.js"),vt=require("../../queries/useGetRate.mutation.js"),qe=require("../../utils/mxClsx.js"),he=require("../AmountCard/AmountCard.js"),pe=require("../AmountInput/AmountInput.js"),It=require("../base/MxButton/MxButton.js");require("../base/MxCard/MxCard.js");require("../base/MxLink/MxLink.js");require("../base/MxSearch/MxSearch.js");require("@fortawesome/free-solid-svg-icons/faClose");require("@fortawesome/react-fontawesome");require("@headlessui/react");require("react-dom");require("react-popper");require("../base/MxTooltip/components/TooltipContainer/TooltipContainer.js");const At=require("../BridgeHistory/BridgeHistory.js"),Bt=require("../Connect/BridgeConnectButton.js"),yt=require("../Connect/MvxConnectButton.js"),Nt=require("../Connect/BridgeAccountDisplay.js"),Mt=require("../Connect/MvxAccountDisplay.js"),Et=require("../ToggleDirection/ToggleDirection.js"),ge=require("../TokenSelector/TokenSelector.js");let k;const wt=({mvxChainId:A,mvxAddress:a,username:xe,callbackRoute:_e="/",firstTokenIdentifier:fe,secondTokenIdentifier:je,firstTokenAmount:B,secondTokenAmount:_,refetchTrigger:Ce,showHistory:be,forcedDestinationTokenSymbol:ve,onSuccessfullySentTransaction:d,onFailedSentTransaction:q,onHistoryClose:y,onMvxConnect:J,onMvxDisconnect:Ie,onNavigate:Ae,onChangeDirection:Be})=>{var ce,le;const ye=i.useRef(null),[O,Ne]=i.useState(!1),[Me,Ee]=i.useState(1),[R,Z]=i.useState(0),[T,ee]=i.useState([]),we=pt.useAccount(),{switchNetwork:te}=lt.useAppKitNetwork(),ie=bt.useInvalidateHistoryQuery(),{options:se,supportedChains:f,nativeAuthToken:V,bridgeOnly:De}=me.useWeb3App(),F=_t.useGetChainId(),re=xt.useBridgeApiChainId(),ne=ft.useSendTransactions(),{signMvxTransactions:L,resetMvxTransactionHash:S,latestMvxTransactionHash:U}=me.useWeb3App(),{evmTokensWithBalances:ke,mvxTokensWithBalances:Oe,isTokensLoading:Re,isLoadingEvmTokensBalances:Ve,isLoadingMvxTokensBalances:Fe,chains:j=[],isChainsLoading:Le}=gt.useFetchBridgeData({refetchTrigger:Ce,mvxAddress:a,mvxApiURL:se.mvxApiURL}),G=Re||Ve||Fe||Le,Se=i.useMemo(()=>f.find(t=>D.sameBridgeApiChainId(t.id,F)),[F,f]),h=i.useMemo(()=>j.find(t=>t.chainId.toString()===A.toString()),[F,j]),{mutate:Ue,data:o,isPending:C,error:p}=vt.useGetRateMutation(),b=((ce=p==null?void 0:p.response)==null?void 0:ce.status)===400?(le=p==null?void 0:p.response)==null?void 0:le.data.message:void 0,Ge=i.useCallback(t=>{const x=f.find(at=>D.sameBridgeApiChainId(at.id,t.id));x&&te(x)},[f,te]),{firstToken:s,secondToken:r,fromOptions:He,toOptions:We,selectedChainOption:v,onChangeFirstSelect:Pe,onChangeSecondSelect:Qe,handleChangeDirection:Xe}=dt.useBridgeTokenSelection({chains:j,activeChain:Se,sdkChains:f,switchNetwork:Ge,fromTokens:Oe,toTokens:ke,firstTokenIdentifier:fe,secondTokenIdentifier:je,forcedDestinationTokenSymbol:ve,isTokensLoading:G,mvxChainId:A,callbackRoute:_e,onNavigate:Ae}),$e=()=>{Xe(),Be()},[c,ze]=i.useState(B??""),[N,M]=i.useState(_??""),Ke=i.useMemo(()=>s?de.MVX_CHAIN_IDS.includes(s.chainId.toString()):!1,[s==null?void 0:s.chainId]),Ye=i.useMemo(()=>r?de.MVX_CHAIN_IDS.includes(r.chainId.toString()):!1,[r==null?void 0:r.chainId]),n=i.useMemo(()=>r?j.find(t=>D.sameBridgeApiChainId(t.chainId,r.chainId))??v:v,[r==null?void 0:r.chainId,j,v]),E=i.useMemo(()=>D.toBridgeApiChainId(r==null?void 0:r.chainId)??re,[r==null?void 0:r.chainId,re]);jt.useDisconnectOnChainTypeChange(n==null?void 0:n.chainType);const l=Ct.useNamespaceAddress(n==null?void 0:n.chainType),Je=l,oe=we.isConnected&&!!l,H=c!==""&&N!=="",W=i.useCallback(ut(async t=>{!t||!Number(t)||!l||!(s!=null&&s.address)||!(r!=null&&r.address)||!v||!E||Ue({nativeAuthToken:V??"",body:{tokenIn:s.address,amountIn:t,fromChainId:A,tokenOut:r.address,toChainId:E}})},500),[l,E,s==null?void 0:s.address,r==null?void 0:r.address,v]),u=i.useCallback(t=>{ze(()=>t)},[]),g=i.useCallback(t=>{M(()=>t)},[]),Ze=i.useCallback(()=>{y==null||y()},[y]),Te=i.useCallback(()=>{const t=ct.formatAmount({decimals:s==null?void 0:s.decimals,input:(s==null?void 0:s.balance)??"0",addCommas:!1,digits:4});m.setFieldValue("firstAmount",t),u(t)},[s==null?void 0:s.balance,s==null?void 0:s.decimals,u]),et=i.useCallback(async t=>{u(""),g(""),ie(),ie(),d==null||d(t)},[u,g,d]),tt=i.useCallback(async({transactions:t})=>{Z(()=>t.length);try{if(!L)throw new Error("signMvxTransactions function is not provided");await L(t),ee(t)}catch(x){console.error(x),ue.toast.dismiss(),ue.toast.error("Transaction cancelled"),q==null||q("Transaction cancelled"),Z(0),st(),u(""),g("")}},[Je,u,g,V,et,L]),{formik:m,firstAmountError:P,secondAmountError:Q,fromChainError:X,senderAddressError:$,receiverAddressError:z,confirmRateError:K,handleBlur:w,handleChange:ae,handleSubmit:it,resetSwapForm:st}=I.useBridgeFormik({isMvxConnected:!!a,rate:o,sender:a??"",receiver:l??"",firstToken:s,firstAmount:c,fromChainId:A,toChainId:E,secondToken:r,secondAmount:N,setForceRefetchRate:Ee,senderChainType:qt.ChainType.mvx,receiverChainType:n==null?void 0:n.chainType,onSubmit:tt}),rt=!!(P||Q||X||b||$||z||K),nt=i.useMemo(()=>c!==""?b??P:void 0,[P,c,b]),ot=i.useMemo(()=>N!==""?X??Q:void 0,[X,Q,N]);return i.useEffect(()=>(c||M(""),W(c),k&&clearInterval(k),k=setInterval(()=>{W(c)},50*1e3),()=>clearInterval(k)),[c,Me,W]),i.useEffect(()=>{o!=null&&o.amountOut&&(m.setFieldValue(I.BridgeFormikValuesEnum.secondAmount,o.amountOut),M(o.amountOut))},[o==null?void 0:o.amountOut]),i.useEffect(()=>{b&&(m.setFieldValue(I.BridgeFormikValuesEnum.secondAmount,"0"),M("0"))},[b]),i.useEffect(()=>{B&&(m.setFieldValue(I.BridgeFormikValuesEnum.firstAmount,B),u(B))},[]),i.useEffect(()=>{_&&(m.setFieldValue(I.BridgeFormikValuesEnum.secondAmount,_),g(_))},[_]),i.useEffect(()=>{if(U)try{const t=U;ne({transactions:T.map(x=>({...x,txHash:t,receiver:l})),provider:(o==null?void 0:o.provider)??ht.ProviderType.None,url:mt.getApiURL()??"",token:V??""}),d==null||d([t])}catch(t){console.error("Error while sending transactions:",t),q==null||q("An error occurred while sending the transaction");return}finally{S==null||S(),ee([])}},[U,T,o==null?void 0:o.provider,ne]),e.jsx(e.Fragment,{children:e.jsxs("form",{ref:ye,noValidate:!0,className:"liq-flex liq-flex-col liq-gap-1 liq-relative",autoComplete:"off",onSubmit:it,children:[be&&e.jsx(At.BridgeHistory,{mvxAddress:a,onClose:Ze}),e.jsxs(he.AmountCard,{className:qe.mxClsx("liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",{"liq-pointer-events-none":O,"focus-within:liq-outline-neutral-700/75 hover:liq-outline-neutral-700/55 hover:focus-within:liq-outline-neutral-700/80":!O}),children:[e.jsxs("div",{className:"liq-flex liq-items-center liq-gap-1",children:[e.jsx("span",{children:"From"}),e.jsx(Mt.MvxAccountDisplay,{accountAddress:a,chainIcon:Y.safeImageUrl(h==null?void 0:h.pngUrl),username:xe,accountExplorerUrl:`${se.mvxExplorerAddress}/accounts/${a}`,showTag:!0,onDisconnect:Ie,onConnect:J})]}),$&&e.jsx("div",{className:"liq-text-red-400 liq-text-xs liq-mt-1",children:$}),e.jsxs("div",{className:"liq-flex liq-justify-between liq-gap-1",children:[e.jsx(pe.AmountInput,{inputName:"firstAmount",inputValue:m.values.firstAmount,amountError:nt,disabled:!1,onInputDebounceChange:u,onInputChange:ae,onBlur:w}),e.jsx(ge.TokenSelector,{name:"firstToken",disabled:C,options:He,areOptionsLoading:G,isMvxSelector:Ke,isDestination:!1,color:"neutral-850",onChange:Pe,onBlur:w,onMaxBtnClick:Te,selectedOption:s,onTokenSelectorDisplay:t=>Ne(t)})]})]}),e.jsx("div",{className:"liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10",children:De&&e.jsx(Et.ToggleDirection,{onChangeDirection:$e})}),e.jsxs(he.AmountCard,{className:qe.mxClsx("liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",{"liq-pointer-events-none":O}),children:[e.jsxs("div",{className:"liq-flex liq-items-center liq-gap-1",children:[e.jsx("span",{children:"To"}),e.jsx(Nt.BridgeAccountDisplay,{disabled:C,activeChain:n})]}),z&&e.jsx("div",{className:"liq-text-red-400 liq-text-xs liq-mt-1",children:z}),K&&e.jsx("div",{className:"liq-text-red-400 liq-text-xs liq-mt-1",children:K}),e.jsxs("div",{className:"liq-flex liq-justify-between liq-gap-1",children:[e.jsx(pe.AmountInput,{inputName:"secondAmount",inputValue:m.values.secondAmount,amountError:ot,disabled:!1,onInputDebounceChange:g,onInputChange:ae,onBlur:w}),e.jsx(ge.TokenSelector,{name:"secondToken",disabled:C,omitDisableClass:!0,options:We,areOptionsLoading:G,isMvxSelector:Ye,color:"neutral-850",onChange:Qe,onBlur:w,selectedOption:r})]})]}),e.jsxs("div",{className:"liq-flex liq-items-center liq-justify-center",children:[!a&&e.jsx(yt.MvxConnectButton,{mvxAccountAddress:a,icon:Y.safeImageUrl(h==null?void 0:h.pngUrl),onClick:J}),a&&!oe&&e.jsx(Bt.BridgeConnectButton,{className:"liq-w-full liq-rounded-xl liq-bg-neutral-850/50 liq-px-8 liq-py-3 liq-font-semibold liq-text-primary-200 liq-transition-colors liq-duration-200 hover:enabled:liq-bg-primary-700/80 disabled:liq-opacity-50",disabled:C,activeChain:n}),a&&oe&&e.jsxs(It.MxButton,{"data-testid":"submit-button",type:"submit",variant:"neutral-850",className:"liq-w-full disabled:liq-bg-neutral-850/50 liq-py-3 hover:enabled:liq-bg-primary !liq-text-primary-200",disabled:!H||C||!a||!l||rt,children:[H&&e.jsxs("div",{className:"liq-flex liq-justify-center liq-items-center liq-gap-2",children:[e.jsx("div",{children:"Transfer to "}),e.jsx("img",{src:Y.safeImageUrl(n==null?void 0:n.pngUrl),alt:"",className:"liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"}),e.jsx("div",{children:n==null?void 0:n.networkName})]}),!H&&e.jsx("span",{className:"liq-text-neutral-100",children:"Enter amount"})]})]}),l&&R>0&&e.jsx("div",{className:"liq-flex liq-items-center liq-justify-center liq-text-neutral-300 liq-text-sm",children:e.jsxs("div",{children:["You will be asked to sign ",R," ",R>1?"transactions":"transaction"," ","on your wallet"]})})]})})};exports.Transfer=wt;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),ct=require("@multiversx/sdk-dapp-utils/out/helpers/formatAmount"),lt=require("@reown/appkit/react"),ut=require("lodash/debounce"),i=require("react"),ue=require("react-toastify"),dt=require("./hooks/useBridgeTokenSelection.js"),de=require("../../../constants/index.js"),mt=require("../../../helpers/getApiURL.js");require("../../constants/index.js");const Y=require("../../../helpers/safeImageUrl.js");require("@solana/web3.js");require("bitcoinjs-lib");require("viem");const qt=require("../../../types/chainType.js"),ht=require("../../../types/providerType.js"),me=require("../../context/useWeb3App.js"),k=require("../../helpers/resolveBridgeApiChainId.js");require("yup");require("@multiversx/sdk-dapp-utils/out/helpers/parseAmount");require("bignumber.js");const pt=require("../../hooks/useAccount.js");require("axios");const I=require("../../hooks/useBridgeFormik.js"),gt=require("../../hooks/useFetchBridgeData.js"),xt=require("../../hooks/useBridgeApiChainId.js");require("@tanstack/react-query");const _t=require("../../hooks/useGetChainId.js"),ft=require("../../hooks/useSendTransactions.js");require("@reown/appkit-adapter-solana/react");require("wagmi");require("@reown/appkit-controllers");const jt=require("../../hooks/useDisconnectOnChainTypeChange.js"),Ct=require("../../hooks/useNamespaceAddress.js"),bt=require("../../queries/useGetHistory.query.js"),vt=require("../../queries/useGetRate.mutation.js"),qe=require("../../utils/mxClsx.js"),he=require("../AmountCard/AmountCard.js"),pe=require("../AmountInput/AmountInput.js"),It=require("../base/MxButton/MxButton.js");require("../base/MxCard/MxCard.js");require("../base/MxLink/MxLink.js");require("../base/MxSearch/MxSearch.js");require("@fortawesome/free-solid-svg-icons/faClose");require("@fortawesome/react-fontawesome");require("@headlessui/react");require("react-dom");require("react-popper");require("../base/MxTooltip/components/TooltipContainer/TooltipContainer.js");const At=require("../BridgeHistory/BridgeHistory.js"),Bt=require("../Connect/BridgeConnectButton.js"),yt=require("../Connect/MvxConnectButton.js"),Nt=require("../Connect/BridgeAccountDisplay.js"),Mt=require("../Connect/MvxAccountDisplay.js"),Et=require("../ToggleDirection/ToggleDirection.js"),ge=require("../TokenSelector/TokenSelector.js");let O;const wt=({mvxChainId:A,mvxAddress:a,username:xe,callbackRoute:_e="/",firstTokenIdentifier:fe,secondTokenIdentifier:je,firstTokenAmount:B,secondTokenAmount:_,refetchTrigger:Ce,showHistory:be,forcedDestinationTokenSymbol:ve,onSuccessfullySentTransaction:d,onFailedSentTransaction:q,onHistoryClose:y,onMvxConnect:J,onMvxDisconnect:Ie,onNavigate:Ae,onChangeDirection:Be})=>{var ce,le;const ye=i.useRef(null),[R,Ne]=i.useState(!1),[Me,Ee]=i.useState(1),[V,Z]=i.useState(0),[T,ee]=i.useState([]),we=pt.useAccount(),{switchNetwork:te}=lt.useAppKitNetwork(),ie=bt.useInvalidateHistoryQuery(),{options:se,supportedChains:f,nativeAuthToken:N,bridgeOnly:De}=me.useWeb3App(),F=_t.useGetChainId(),re=xt.useBridgeApiChainId(),ne=ft.useSendTransactions(),{signMvxTransactions:L,resetMvxTransactionHash:S,latestMvxTransactionHash:U}=me.useWeb3App(),{evmTokensWithBalances:ke,mvxTokensWithBalances:Oe,isTokensLoading:Re,isLoadingEvmTokensBalances:Ve,isLoadingMvxTokensBalances:Fe,chains:j=[],isChainsLoading:Le}=gt.useFetchBridgeData({refetchTrigger:Ce,mvxAddress:a,mvxApiURL:se.mvxApiURL}),G=Re||Ve||Fe||Le,Se=i.useMemo(()=>f.find(t=>k.sameBridgeApiChainId(t.id,F)),[F,f]),h=i.useMemo(()=>j.find(t=>t.chainId.toString()===A.toString()),[F,j]),{mutate:Ue,data:o,isPending:C,error:p}=vt.useGetRateMutation(),b=((ce=p==null?void 0:p.response)==null?void 0:ce.status)===400?(le=p==null?void 0:p.response)==null?void 0:le.data.message:void 0,Ge=i.useCallback(t=>{const x=f.find(at=>k.sameBridgeApiChainId(at.id,t.id));x&&te(x)},[f,te]),{firstToken:s,secondToken:r,fromOptions:He,toOptions:We,selectedChainOption:v,onChangeFirstSelect:Pe,onChangeSecondSelect:Qe,handleChangeDirection:Xe}=dt.useBridgeTokenSelection({chains:j,activeChain:Se,sdkChains:f,switchNetwork:Ge,fromTokens:Oe,toTokens:ke,firstTokenIdentifier:fe,secondTokenIdentifier:je,forcedDestinationTokenSymbol:ve,isTokensLoading:G,mvxChainId:A,callbackRoute:_e,onNavigate:Ae}),$e=()=>{Xe(),Be()},[l,ze]=i.useState(B??""),[M,E]=i.useState(_??""),Ke=i.useMemo(()=>s?de.MVX_CHAIN_IDS.includes(s.chainId.toString()):!1,[s==null?void 0:s.chainId]),Ye=i.useMemo(()=>r?de.MVX_CHAIN_IDS.includes(r.chainId.toString()):!1,[r==null?void 0:r.chainId]),n=i.useMemo(()=>r?j.find(t=>k.sameBridgeApiChainId(t.chainId,r.chainId))??v:v,[r==null?void 0:r.chainId,j,v]),w=i.useMemo(()=>k.toBridgeApiChainId(r==null?void 0:r.chainId)??re,[r==null?void 0:r.chainId,re]);jt.useDisconnectOnChainTypeChange(n==null?void 0:n.chainType);const c=Ct.useNamespaceAddress(n==null?void 0:n.chainType),Je=c,oe=we.isConnected&&!!c,H=l!==""&&M!=="",W=i.useCallback(ut(async t=>{!t||!Number(t)||!c||!(s!=null&&s.address)||!(r!=null&&r.address)||!v||!w||Ue({nativeAuthToken:N??"",body:{tokenIn:s.address,amountIn:t,fromChainId:A,tokenOut:r.address,toChainId:w}})},500),[c,w,s==null?void 0:s.address,r==null?void 0:r.address,v]),u=i.useCallback(t=>{ze(()=>t)},[]),g=i.useCallback(t=>{E(()=>t)},[]),Ze=i.useCallback(()=>{y==null||y()},[y]),Te=i.useCallback(()=>{const t=ct.formatAmount({decimals:s==null?void 0:s.decimals,input:(s==null?void 0:s.balance)??"0",addCommas:!1,digits:4});m.setFieldValue("firstAmount",t),u(t)},[s==null?void 0:s.balance,s==null?void 0:s.decimals,u]),et=i.useCallback(async t=>{u(""),g(""),ie(),ie(),d==null||d(t)},[u,g,d]),tt=i.useCallback(async({transactions:t})=>{Z(()=>t.length);try{if(!L)throw new Error("signMvxTransactions function is not provided");await L(t),ee(t)}catch(x){console.error(x),ue.toast.dismiss(),ue.toast.error("Transaction cancelled"),q==null||q("Transaction cancelled"),Z(0),st(),u(""),g("")}},[Je,u,g,N,et,L]),{formik:m,firstAmountError:P,secondAmountError:Q,fromChainError:X,senderAddressError:$,receiverAddressError:z,confirmRateError:K,handleBlur:D,handleChange:ae,handleSubmit:it,resetSwapForm:st}=I.useBridgeFormik({isMvxConnected:!!a,rate:o,sender:a??"",receiver:c??"",firstToken:s,firstAmount:l,fromChainId:A,toChainId:w,secondToken:r,secondAmount:M,setForceRefetchRate:Ee,senderChainType:qt.ChainType.mvx,receiverChainType:n==null?void 0:n.chainType,onSubmit:tt}),rt=!!(P||Q||X||b||$||z||K),nt=i.useMemo(()=>l!==""?b??P:void 0,[P,l,b]),ot=i.useMemo(()=>M!==""?X??Q:void 0,[X,Q,M]);return i.useEffect(()=>(l||E(""),W(l),O&&clearInterval(O),O=setInterval(()=>{W(l)},50*1e3),()=>clearInterval(O)),[l,Me,W]),i.useEffect(()=>{o!=null&&o.amountOut&&(m.setFieldValue(I.BridgeFormikValuesEnum.secondAmount,o.amountOut),E(o.amountOut))},[o==null?void 0:o.amountOut]),i.useEffect(()=>{b&&(m.setFieldValue(I.BridgeFormikValuesEnum.secondAmount,"0"),E("0"))},[b]),i.useEffect(()=>{B&&(m.setFieldValue(I.BridgeFormikValuesEnum.firstAmount,B),u(B))},[]),i.useEffect(()=>{_&&(m.setFieldValue(I.BridgeFormikValuesEnum.secondAmount,_),g(_))},[_]),i.useEffect(()=>{if(U)try{const t=U;ne({transactions:T.map(x=>({...x,txHash:t,receiver:c})),provider:(o==null?void 0:o.provider)??ht.ProviderType.None,url:mt.getApiURL()??"",token:N??""}),d==null||d([t])}catch(t){console.error("Error while sending transactions:",t),q==null||q("An error occurred while sending the transaction");return}finally{S==null||S(),ee([])}},[U,T,c,N,o==null?void 0:o.provider,ne]),e.jsx(e.Fragment,{children:e.jsxs("form",{ref:ye,noValidate:!0,className:"liq-flex liq-flex-col liq-gap-1 liq-relative",autoComplete:"off",onSubmit:it,children:[be&&e.jsx(At.BridgeHistory,{mvxAddress:a,onClose:Ze}),e.jsxs(he.AmountCard,{className:qe.mxClsx("liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",{"liq-pointer-events-none":R,"focus-within:liq-outline-neutral-700/75 hover:liq-outline-neutral-700/55 hover:focus-within:liq-outline-neutral-700/80":!R}),children:[e.jsxs("div",{className:"liq-flex liq-items-center liq-gap-1",children:[e.jsx("span",{children:"From"}),e.jsx(Mt.MvxAccountDisplay,{accountAddress:a,chainIcon:Y.safeImageUrl(h==null?void 0:h.pngUrl),username:xe,accountExplorerUrl:`${se.mvxExplorerAddress}/accounts/${a}`,showTag:!0,onDisconnect:Ie,onConnect:J})]}),$&&e.jsx("div",{className:"liq-text-red-400 liq-text-xs liq-mt-1",children:$}),e.jsxs("div",{className:"liq-flex liq-justify-between liq-gap-1",children:[e.jsx(pe.AmountInput,{inputName:"firstAmount",inputValue:m.values.firstAmount,amountError:nt,disabled:!1,onInputDebounceChange:u,onInputChange:ae,onBlur:D}),e.jsx(ge.TokenSelector,{name:"firstToken",disabled:C,options:He,areOptionsLoading:G,isMvxSelector:Ke,isDestination:!1,color:"neutral-850",onChange:Pe,onBlur:D,onMaxBtnClick:Te,selectedOption:s,onTokenSelectorDisplay:t=>Ne(t)})]})]}),e.jsx("div",{className:"liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10",children:De&&e.jsx(Et.ToggleDirection,{onChangeDirection:$e})}),e.jsxs(he.AmountCard,{className:qe.mxClsx("liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",{"liq-pointer-events-none":R}),children:[e.jsxs("div",{className:"liq-flex liq-items-center liq-gap-1",children:[e.jsx("span",{children:"To"}),e.jsx(Nt.BridgeAccountDisplay,{disabled:C,activeChain:n})]}),z&&e.jsx("div",{className:"liq-text-red-400 liq-text-xs liq-mt-1",children:z}),K&&e.jsx("div",{className:"liq-text-red-400 liq-text-xs liq-mt-1",children:K}),e.jsxs("div",{className:"liq-flex liq-justify-between liq-gap-1",children:[e.jsx(pe.AmountInput,{inputName:"secondAmount",inputValue:m.values.secondAmount,amountError:ot,disabled:!1,onInputDebounceChange:g,onInputChange:ae,onBlur:D}),e.jsx(ge.TokenSelector,{name:"secondToken",disabled:C,omitDisableClass:!0,options:We,areOptionsLoading:G,isMvxSelector:Ye,color:"neutral-850",onChange:Qe,onBlur:D,selectedOption:r})]})]}),e.jsxs("div",{className:"liq-flex liq-items-center liq-justify-center",children:[!a&&e.jsx(yt.MvxConnectButton,{mvxAccountAddress:a,icon:Y.safeImageUrl(h==null?void 0:h.pngUrl),onClick:J}),a&&!oe&&e.jsx(Bt.BridgeConnectButton,{className:"liq-w-full liq-rounded-xl liq-bg-neutral-850/50 liq-px-8 liq-py-3 liq-font-semibold liq-text-primary-200 liq-transition-colors liq-duration-200 hover:enabled:liq-bg-primary-700/80 disabled:liq-opacity-50",disabled:C,activeChain:n}),a&&oe&&e.jsxs(It.MxButton,{"data-testid":"submit-button",type:"submit",variant:"neutral-850",className:"liq-w-full disabled:liq-bg-neutral-850/50 liq-py-3 hover:enabled:liq-bg-primary !liq-text-primary-200",disabled:!H||C||!a||!c||rt,children:[H&&e.jsxs("div",{className:"liq-flex liq-justify-center liq-items-center liq-gap-2",children:[e.jsx("div",{children:"Transfer to "}),e.jsx("img",{src:Y.safeImageUrl(n==null?void 0:n.pngUrl),alt:"",className:"liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg"}),e.jsx("div",{children:n==null?void 0:n.networkName})]}),!H&&e.jsx("span",{className:"liq-text-neutral-100",children:"Enter amount"})]})]}),c&&V>0&&e.jsx("div",{className:"liq-flex liq-items-center liq-justify-center liq-text-neutral-300 liq-text-sm",children:e.jsxs("div",{children:["You will be asked to sign ",V," ",V>1?"transactions":"transaction"," ","on your wallet"]})})]})})};exports.Transfer=wt;
@@ -21,7 +21,7 @@ import "@multiversx/sdk-dapp-utils/out/helpers/parseAmount";
21
21
  import "bignumber.js";
22
22
  import { useAccount as xi } from "../../hooks/useAccount.mjs";
23
23
  import "axios";
24
- import { useBridgeFormik as Ai, BridgeFormikValuesEnum as F } from "../../hooks/useBridgeFormik.mjs";
24
+ import { useBridgeFormik as Ai, BridgeFormikValuesEnum as U } from "../../hooks/useBridgeFormik.mjs";
25
25
  import { useFetchBridgeData as Ni } from "../../hooks/useFetchBridgeData.mjs";
26
26
  import { useBridgeApiChainId as Bi } from "../../hooks/useBridgeApiChainId.mjs";
27
27
  import "@tanstack/react-query";
@@ -54,7 +54,7 @@ import { BridgeAccountDisplay as Ui } from "../Connect/BridgeAccountDisplay.mjs"
54
54
  import { MvxAccountDisplay as ji } from "../Connect/MvxAccountDisplay.mjs";
55
55
  import { ToggleDirection as Pi } from "../ToggleDirection/ToggleDirection.mjs";
56
56
  import { TokenSelector as Ce } from "../TokenSelector/TokenSelector.mjs";
57
- let U;
57
+ let j;
58
58
  const Qt = ({
59
59
  mvxChainId: D,
60
60
  mvxAddress: a,
@@ -76,10 +76,10 @@ const Qt = ({
76
76
  onChangeDirection: Oe
77
77
  }) => {
78
78
  var pe, ue;
79
- const Me = gi(null), [j, Re] = C(!1), [Ve, Le] = C(1), [P, te] = C(0), [re, oe] = C([]), Fe = xi(), { switchNetwork: ne } = hi(), ae = Oi(), {
79
+ const Me = gi(null), [P, Re] = C(!1), [Ve, Le] = C(1), [W, te] = C(0), [re, oe] = C([]), Fe = xi(), { switchNetwork: ne } = hi(), ae = Oi(), {
80
80
  options: le,
81
81
  supportedChains: A,
82
- nativeAuthToken: W,
82
+ nativeAuthToken: M,
83
83
  bridgeOnly: Ue
84
84
  } = ge(), G = wi(), se = Bi(), ce = yi(), {
85
85
  signMvxTransactions: Q,
@@ -137,29 +137,29 @@ const Qt = ({
137
137
  onNavigate: Ee
138
138
  }), Se = () => {
139
139
  Ze(), Oe();
140
- }, [s, ke] = C(E ?? ""), [M, R] = C(x ?? ""), Te = d(() => i ? fe.includes(i.chainId.toString()) : !1, [i == null ? void 0 : i.chainId]), ei = d(() => t ? fe.includes(t.chainId.toString()) : !1, [t == null ? void 0 : t.chainId]), o = d(() => t ? N.find(
140
+ }, [c, ke] = C(E ?? ""), [R, V] = C(x ?? ""), Te = d(() => i ? fe.includes(i.chainId.toString()) : !1, [i == null ? void 0 : i.chainId]), ei = d(() => t ? fe.includes(t.chainId.toString()) : !1, [t == null ? void 0 : t.chainId]), o = d(() => t ? N.find(
141
141
  (e) => ee(e.chainId, t.chainId)
142
- ) ?? y : y, [t == null ? void 0 : t.chainId, N, y]), V = d(
142
+ ) ?? y : y, [t == null ? void 0 : t.chainId, N, y]), L = d(
143
143
  () => Ii(t == null ? void 0 : t.chainId) ?? se,
144
144
  [t == null ? void 0 : t.chainId, se]
145
145
  );
146
146
  Di(o == null ? void 0 : o.chainType);
147
- const c = Ei(o == null ? void 0 : o.chainType), ii = c, me = Fe.isConnected && !!c, H = s !== "" && M !== "", K = p(
147
+ const s = Ei(o == null ? void 0 : o.chainType), ii = s, me = Fe.isConnected && !!s, H = c !== "" && R !== "", K = p(
148
148
  fi(async (e) => {
149
- !e || !Number(e) || !c || !(i != null && i.address) || !(t != null && t.address) || !y || !V || ze({
150
- nativeAuthToken: W ?? "",
149
+ !e || !Number(e) || !s || !(i != null && i.address) || !(t != null && t.address) || !y || !L || ze({
150
+ nativeAuthToken: M ?? "",
151
151
  body: {
152
152
  tokenIn: i.address,
153
153
  amountIn: e,
154
154
  fromChainId: D,
155
155
  tokenOut: t.address,
156
- toChainId: V
156
+ toChainId: L
157
157
  }
158
158
  });
159
159
  }, 500),
160
160
  [
161
- c,
162
- V,
161
+ s,
162
+ L,
163
163
  i == null ? void 0 : i.address,
164
164
  t == null ? void 0 : t.address,
165
165
  y
@@ -167,7 +167,7 @@ const Qt = ({
167
167
  ), m = p((e) => {
168
168
  ke(() => e);
169
169
  }, []), v = p((e) => {
170
- R(() => e);
170
+ V(() => e);
171
171
  }, []), ti = p(() => {
172
172
  O == null || O();
173
173
  }, [O]), ri = p(() => {
@@ -202,7 +202,7 @@ const Qt = ({
202
202
  ii,
203
203
  m,
204
204
  v,
205
- W,
205
+ M,
206
206
  oi,
207
207
  Q
208
208
  ]
@@ -214,7 +214,7 @@ const Qt = ({
214
214
  senderAddressError: Z,
215
215
  receiverAddressError: S,
216
216
  confirmRateError: k,
217
- handleBlur: L,
217
+ handleBlur: F,
218
218
  handleChange: de,
219
219
  handleSubmit: ai,
220
220
  resetSwapForm: li
@@ -222,32 +222,32 @@ const Qt = ({
222
222
  isMvxConnected: !!a,
223
223
  rate: n,
224
224
  sender: a ?? "",
225
- receiver: c ?? "",
225
+ receiver: s ?? "",
226
226
  firstToken: i,
227
- firstAmount: s,
227
+ firstAmount: c,
228
228
  fromChainId: D,
229
- toChainId: V,
229
+ toChainId: L,
230
230
  secondToken: t,
231
- secondAmount: M,
231
+ secondAmount: R,
232
232
  setForceRefetchRate: Le,
233
233
  senderChainType: bi.mvx,
234
234
  receiverChainType: o == null ? void 0 : o.chainType,
235
235
  onSubmit: ni
236
- }), si = !!(X || Y || J || w || Z || S || k), ci = d(() => s !== "" ? w ?? X : void 0, [X, s, w]), mi = d(() => M !== "" ? J ?? Y : void 0, [J, Y, M]);
237
- return I(() => (s || R(""), K(s), U && clearInterval(U), U = setInterval(() => {
238
- K(s);
239
- }, 50 * 1e3), () => clearInterval(U)), [s, Ve, K]), I(() => {
240
- n != null && n.amountOut && (h.setFieldValue(F.secondAmount, n.amountOut), R(n.amountOut));
236
+ }), si = !!(X || Y || J || w || Z || S || k), ci = d(() => c !== "" ? w ?? X : void 0, [X, c, w]), mi = d(() => R !== "" ? J ?? Y : void 0, [J, Y, R]);
237
+ return I(() => (c || V(""), K(c), j && clearInterval(j), j = setInterval(() => {
238
+ K(c);
239
+ }, 50 * 1e3), () => clearInterval(j)), [c, Ve, K]), I(() => {
240
+ n != null && n.amountOut && (h.setFieldValue(U.secondAmount, n.amountOut), V(n.amountOut));
241
241
  }, [n == null ? void 0 : n.amountOut]), I(() => {
242
- w && (h.setFieldValue(F.secondAmount, "0"), R("0"));
242
+ w && (h.setFieldValue(U.secondAmount, "0"), V("0"));
243
243
  }, [w]), I(() => {
244
244
  E && (h.setFieldValue(
245
- F.firstAmount,
245
+ U.firstAmount,
246
246
  E
247
247
  ), m(E));
248
248
  }, []), I(() => {
249
249
  x && (h.setFieldValue(
250
- F.secondAmount,
250
+ U.secondAmount,
251
251
  x
252
252
  ), v(x));
253
253
  }, [x]), I(() => {
@@ -258,11 +258,11 @@ const Qt = ({
258
258
  transactions: re.map((b) => ({
259
259
  ...b,
260
260
  txHash: e,
261
- receiver: c
261
+ receiver: s
262
262
  })),
263
263
  provider: (n == null ? void 0 : n.provider) ?? Ci.None,
264
264
  url: vi() ?? "",
265
- token: W ?? ""
265
+ token: M ?? ""
266
266
  }), u == null || u([e]);
267
267
  } catch (e) {
268
268
  console.error("Error while sending transactions:", e), f == null || f(
@@ -275,6 +275,8 @@ const Qt = ({
275
275
  }, [
276
276
  $,
277
277
  re,
278
+ s,
279
+ M,
278
280
  n == null ? void 0 : n.provider,
279
281
  ce
280
282
  ]), /* @__PURE__ */ r(pi, { children: /* @__PURE__ */ l(
@@ -293,8 +295,8 @@ const Qt = ({
293
295
  className: qe(
294
296
  "liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",
295
297
  {
296
- "liq-pointer-events-none": j,
297
- "focus-within:liq-outline-neutral-700/75 hover:liq-outline-neutral-700/55 hover:focus-within:liq-outline-neutral-700/80": !j
298
+ "liq-pointer-events-none": P,
299
+ "focus-within:liq-outline-neutral-700/75 hover:liq-outline-neutral-700/55 hover:focus-within:liq-outline-neutral-700/80": !P
298
300
  }
299
301
  ),
300
302
  children: [
@@ -324,7 +326,7 @@ const Qt = ({
324
326
  disabled: !1,
325
327
  onInputDebounceChange: m,
326
328
  onInputChange: de,
327
- onBlur: L
329
+ onBlur: F
328
330
  }
329
331
  ),
330
332
  /* @__PURE__ */ r(
@@ -338,7 +340,7 @@ const Qt = ({
338
340
  isDestination: !1,
339
341
  color: "neutral-850",
340
342
  onChange: Ye,
341
- onBlur: L,
343
+ onBlur: F,
342
344
  onMaxBtnClick: ri,
343
345
  selectedOption: i,
344
346
  onTokenSelectorDisplay: (e) => Re(e)
@@ -355,7 +357,7 @@ const Qt = ({
355
357
  className: qe(
356
358
  "liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6",
357
359
  {
358
- "liq-pointer-events-none": j
360
+ "liq-pointer-events-none": P
359
361
  }
360
362
  ),
361
363
  children: [
@@ -381,7 +383,7 @@ const Qt = ({
381
383
  disabled: !1,
382
384
  onInputDebounceChange: v,
383
385
  onInputChange: de,
384
- onBlur: L
386
+ onBlur: F
385
387
  }
386
388
  ),
387
389
  /* @__PURE__ */ r(
@@ -395,7 +397,7 @@ const Qt = ({
395
397
  isMvxSelector: ei,
396
398
  color: "neutral-850",
397
399
  onChange: Je,
398
- onBlur: L,
400
+ onBlur: F,
399
401
  selectedOption: t
400
402
  }
401
403
  )
@@ -427,7 +429,7 @@ const Qt = ({
427
429
  type: "submit",
428
430
  variant: "neutral-850",
429
431
  className: "liq-w-full disabled:liq-bg-neutral-850/50 liq-py-3 hover:enabled:liq-bg-primary !liq-text-primary-200",
430
- disabled: !H || B || !a || !c || si,
432
+ disabled: !H || B || !a || !s || si,
431
433
  children: [
432
434
  H && /* @__PURE__ */ l("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
433
435
  /* @__PURE__ */ r("div", { children: "Transfer to " }),
@@ -446,11 +448,11 @@ const Qt = ({
446
448
  }
447
449
  )
448
450
  ] }),
449
- c && P > 0 && /* @__PURE__ */ r("div", { className: "liq-flex liq-items-center liq-justify-center liq-text-neutral-300 liq-text-sm", children: /* @__PURE__ */ l("div", { children: [
451
+ s && W > 0 && /* @__PURE__ */ r("div", { className: "liq-flex liq-items-center liq-justify-center liq-text-neutral-300 liq-text-sm", children: /* @__PURE__ */ l("div", { children: [
450
452
  "You will be asked to sign ",
451
- P,
453
+ W,
452
454
  " ",
453
- P > 1 ? "transactions" : "transaction",
455
+ W > 1 ? "transactions" : "transaction",
454
456
  " ",
455
457
  "on your wallet"
456
458
  ] }) })
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("@fortawesome/free-solid-svg-icons/faPowerOff"),p=require("@fortawesome/react-fontawesome"),g=require("@reown/appkit/react"),r=require("../../../helpers/getDisplayName.js"),j=require("./SwitchChainButton.js"),y=require("../../../types/chainType.js"),f=require("../../hooks/useAccount.js"),N=require("../../hooks/useNamespaceAddress.js"),b=require("../../hooks/useSuiConnect.js");require("clsx");require("tailwind-merge");require("../base/MxCard/MxCard.js");const _=require("../base/MxLink/MxLink.js");require("../base/MxSearch/MxSearch.js");require("@fortawesome/free-solid-svg-icons/faClose");require("@headlessui/react");require("react");require("react-dom");require("react-popper");require("../base/MxTooltip/components/TooltipContainer/TooltipContainer.js");require("../../constants/index.js");const w=require("../CopyButton/CopyButton.js"),h=require("../TrimAddress/TrimAddress.js"),k=({activeChain:s,disabled:n})=>{var c;const t=f.useAccount(),{disconnect:q}=g.useDisconnect(),l=b.useSuiConnect(),d=N.useNamespaceAddress(s==null?void 0:s.chainType),o=(s==null?void 0:s.chainType)===y.ChainType.sui,i=d??t.address,a=async u=>{try{u.preventDefault(),o?await l.disconnect():await q()}catch(m){console.error("Failed to disconnect:",m)}};return i?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:s==null?void 0:s.pngUrl,alt:"",className:"liq-w-6 liq-h-6 liq-rounded-lg"}),e.jsx("span",{className:"liq-truncate liq-text-gray-400",children:r.getDisplayName(s)}),e.jsx("span",{className:"liq-ml-[-5px]",children:":"}),e.jsx("div",{className:"liq-flex liq-items-center liq-justify-between",children:e.jsxs("div",{className:"liq-flex liq-max-w-[10rem] liq-items-center liq-gap-1",children:[e.jsx(_.MxLink,{to:`${(c=s==null?void 0:s.blockExplorerUrls)==null?void 0:c[0]}/address/${i}`,target:"_blank",showExternalIcon:!1,className:"!liq-relative",children:e.jsx("div",{className:"liq-flex liq-min-w-0 liq-flex-grow liq-overflow-hidden liq-leading-none liq-max-w-[10rem]",children:e.jsx(h.TrimAddress,{address:i,"data-testid":"evm-address"})})}),e.jsx(w.CopyButton,{text:i,className:"liq-text-sm","data-testid":"evm-copy-button"})]})}),e.jsx("div",{className:"liq-ml-auto liq-mr-0 liq-flex liq-items-center liq-gap-1",children:e.jsx("button",{className:"focus-primary liq-flex liq-items-center liq-gap-1 liq-rounded-xl liq-px-0 liq-py-2 liq-text-sm liq-font-semibold liq-text-neutral-400 liq-transition-colors liq-duration-200 hover:enabled:liq-text-white disabled:liq-opacity-50",onClick:a,"data-testid":"evm-disconnect-button",children:e.jsx(p.FontAwesomeIcon,{icon:x.faPowerOff})})})]}):o?e.jsxs("div",{className:"liq-flex liq-max-w-full liq-items-center liq-gap-2",children:[e.jsx("button",{disabled:n||l.isConnecting,onClick:()=>l.connect(),className:"liq-rounded-lg liq-font-semibold liq-transition-colors liq-duration-200 disabled:liq-opacity-50 liq-bg-neutral-750 !liq-text-primary-200 hover:enabled:liq-bg-primary liq-px-2",children:e.jsx("div",{className:"liq-flex liq-items-center",children:e.jsxs("div",{className:"liq-flex liq-justify-center liq-items-center liq-gap-2",children:[e.jsx("div",{children:l.isConnecting?"Connecting...":"Connect"}),e.jsx("img",{src:s==null?void 0:s.pngUrl,alt:"",className:"liq-w-4 liq-h-4 liq-rounded-sm"}),e.jsx("div",{className:"liq-truncate md:liq-text-clip",children:r.getDisplayName(s)})]})})}),l.isConnecting&&e.jsx("button",{type:"button",onClick:()=>void l.cancelPendingConnection(),className:"liq-shrink-0 liq-rounded-lg liq-px-2 liq-py-1 liq-text-xs liq-font-medium liq-text-neutral-400 hover:liq-text-white",children:"Cancel"})]}):e.jsx(j.SwitchChainButton,{disabled:n,className:"liq-rounded-lg liq-font-semibold liq-transition-colors liq-duration-200 disabled:liq-opacity-50 liq-bg-neutral-750 !liq-text-primary-200 hover:enabled:liq-bg-primary liq-px-2",children:e.jsx("div",{className:"liq-flex liq-items-center",children:e.jsxs("div",{className:"liq-flex liq-justify-center liq-items-center liq-gap-2",children:[e.jsx("div",{children:t.isConnecting?"Connecting...":"Connect"}),e.jsx("img",{src:s==null?void 0:s.pngUrl,alt:"",className:"liq-w-4 liq-h-4 liq-rounded-sm"}),e.jsx("div",{className:"liq-truncate md:liq-text-clip",children:r.getDisplayName(s)})]})})})};exports.BridgeAccountDisplay=k;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("@fortawesome/free-solid-svg-icons/faPowerOff"),g=require("@fortawesome/react-fontawesome"),j=require("@reown/appkit/react"),r=require("../../../helpers/getDisplayName.js"),y=require("./SwitchChainButton.js"),n=require("../../../types/chainType.js"),f=require("../../hooks/useAccount.js"),N=require("../../hooks/useNamespaceAddress.js"),b=require("../../hooks/useSuiConnect.js");require("clsx");require("tailwind-merge");require("../base/MxCard/MxCard.js");const _=require("../base/MxLink/MxLink.js");require("../base/MxSearch/MxSearch.js");require("@fortawesome/free-solid-svg-icons/faClose");require("@headlessui/react");require("react");require("react-dom");require("react-popper");require("../base/MxTooltip/components/TooltipContainer/TooltipContainer.js");require("../../constants/index.js");const w=require("../CopyButton/CopyButton.js"),h=require("../TrimAddress/TrimAddress.js"),k=({activeChain:s,disabled:t})=>{var d;const o=f.useAccount(),{disconnect:u}=j.useDisconnect(),l=b.useSuiConnect(),c=N.useNamespaceAddress(s==null?void 0:s.chainType),q=(s==null?void 0:s.chainType)===n.ChainType.sui,i=(s==null?void 0:s.chainType)===n.ChainType.evm||(s==null?void 0:s.chainType)===n.ChainType.sui?c:c??o.address,m=async a=>{try{a.preventDefault(),q?await l.disconnect():await u()}catch(x){console.error("Failed to disconnect:",x)}};return i?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:s==null?void 0:s.pngUrl,alt:"",className:"liq-w-6 liq-h-6 liq-rounded-lg"}),e.jsx("span",{className:"liq-truncate liq-text-gray-400",children:r.getDisplayName(s)}),e.jsx("span",{className:"liq-ml-[-5px]",children:":"}),e.jsx("div",{className:"liq-flex liq-items-center liq-justify-between",children:e.jsxs("div",{className:"liq-flex liq-max-w-[10rem] liq-items-center liq-gap-1",children:[e.jsx(_.MxLink,{to:`${(d=s==null?void 0:s.blockExplorerUrls)==null?void 0:d[0]}/address/${i}`,target:"_blank",showExternalIcon:!1,className:"!liq-relative",children:e.jsx("div",{className:"liq-flex liq-min-w-0 liq-flex-grow liq-overflow-hidden liq-leading-none liq-max-w-[10rem]",children:e.jsx(h.TrimAddress,{address:i,"data-testid":"evm-address"})})}),e.jsx(w.CopyButton,{text:i,className:"liq-text-sm","data-testid":"evm-copy-button"})]})}),e.jsx("div",{className:"liq-ml-auto liq-mr-0 liq-flex liq-items-center liq-gap-1",children:e.jsx("button",{className:"focus-primary liq-flex liq-items-center liq-gap-1 liq-rounded-xl liq-px-0 liq-py-2 liq-text-sm liq-font-semibold liq-text-neutral-400 liq-transition-colors liq-duration-200 hover:enabled:liq-text-white disabled:liq-opacity-50",onClick:m,"data-testid":"evm-disconnect-button",children:e.jsx(g.FontAwesomeIcon,{icon:p.faPowerOff})})})]}):q?e.jsxs("div",{className:"liq-flex liq-max-w-full liq-items-center liq-gap-2",children:[e.jsx("button",{disabled:t||l.isConnecting,onClick:()=>l.connect(),className:"liq-rounded-lg liq-font-semibold liq-transition-colors liq-duration-200 disabled:liq-opacity-50 liq-bg-neutral-750 !liq-text-primary-200 hover:enabled:liq-bg-primary liq-px-2",children:e.jsx("div",{className:"liq-flex liq-items-center",children:e.jsxs("div",{className:"liq-flex liq-justify-center liq-items-center liq-gap-2",children:[e.jsx("div",{children:l.isConnecting?"Connecting...":"Connect"}),e.jsx("img",{src:s==null?void 0:s.pngUrl,alt:"",className:"liq-w-4 liq-h-4 liq-rounded-sm"}),e.jsx("div",{className:"liq-truncate md:liq-text-clip",children:r.getDisplayName(s)})]})})}),l.isConnecting&&e.jsx("button",{type:"button",onClick:()=>void l.cancelPendingConnection(),className:"liq-shrink-0 liq-rounded-lg liq-px-2 liq-py-1 liq-text-xs liq-font-medium liq-text-neutral-400 hover:liq-text-white",children:"Cancel"})]}):e.jsx(y.SwitchChainButton,{disabled:t,className:"liq-rounded-lg liq-font-semibold liq-transition-colors liq-duration-200 disabled:liq-opacity-50 liq-bg-neutral-750 !liq-text-primary-200 hover:enabled:liq-bg-primary liq-px-2",children:e.jsx("div",{className:"liq-flex liq-items-center",children:e.jsxs("div",{className:"liq-flex liq-justify-center liq-items-center liq-gap-2",children:[e.jsx("div",{children:o.isConnecting?"Connecting...":"Connect"}),e.jsx("img",{src:s==null?void 0:s.pngUrl,alt:"",className:"liq-w-4 liq-h-4 liq-rounded-sm"}),e.jsx("div",{className:"liq-truncate md:liq-text-clip",children:r.getDisplayName(s)})]})})})};exports.BridgeAccountDisplay=k;
@@ -1,17 +1,17 @@
1
- import { jsxs as r, Fragment as f, jsx as l } from "react/jsx-runtime";
2
- import { faPowerOff as x } from "@fortawesome/free-solid-svg-icons/faPowerOff";
3
- import { FontAwesomeIcon as g } from "@fortawesome/react-fontawesome";
4
- import { useDisconnect as y } from "@reown/appkit/react";
5
- import { getDisplayName as s } from "../../../helpers/getDisplayName.mjs";
6
- import { SwitchChainButton as N } from "./SwitchChainButton.mjs";
7
- import { ChainType as b } from "../../../types/chainType.mjs";
1
+ import { jsxs as r, Fragment as x, jsx as e } from "react/jsx-runtime";
2
+ import { faPowerOff as g } from "@fortawesome/free-solid-svg-icons/faPowerOff";
3
+ import { FontAwesomeIcon as y } from "@fortawesome/react-fontawesome";
4
+ import { useDisconnect as N } from "@reown/appkit/react";
5
+ import { getDisplayName as t } from "../../../helpers/getDisplayName.mjs";
6
+ import { SwitchChainButton as b } from "./SwitchChainButton.mjs";
7
+ import { ChainType as o } from "../../../types/chainType.mjs";
8
8
  import { useAccount as w } from "../../hooks/useAccount.mjs";
9
- import { useNamespaceAddress as h } from "../../hooks/useNamespaceAddress.mjs";
10
- import { useSuiConnect as k } from "../../hooks/useSuiConnect.mjs";
9
+ import { useNamespaceAddress as k } from "../../hooks/useNamespaceAddress.mjs";
10
+ import { useSuiConnect as A } from "../../hooks/useSuiConnect.mjs";
11
11
  import "clsx";
12
12
  import "tailwind-merge";
13
13
  import "../base/MxCard/MxCard.mjs";
14
- import { MxLink as A } from "../base/MxLink/MxLink.mjs";
14
+ import { MxLink as T } from "../base/MxLink/MxLink.mjs";
15
15
  import "../base/MxSearch/MxSearch.mjs";
16
16
  import "@fortawesome/free-solid-svg-icons/faClose";
17
17
  import "@headlessui/react";
@@ -22,86 +22,86 @@ import "../base/MxTooltip/components/TooltipContainer/TooltipContainer.mjs";
22
22
  import "../../constants/index.mjs";
23
23
  import { CopyButton as j } from "../CopyButton/CopyButton.mjs";
24
24
  import { TrimAddress as D } from "../TrimAddress/TrimAddress.mjs";
25
- const Z = ({
26
- activeChain: e,
27
- disabled: o
25
+ const v = ({
26
+ activeChain: l,
27
+ disabled: n
28
28
  }) => {
29
- var d;
30
- const n = w(), { disconnect: c } = y(), i = k(), q = h(e == null ? void 0 : e.chainType), m = (e == null ? void 0 : e.chainType) === b.sui, t = q ?? n.address, a = async (p) => {
29
+ var q;
30
+ const m = w(), { disconnect: p } = N(), i = A(), d = k(l == null ? void 0 : l.chainType), c = (l == null ? void 0 : l.chainType) === o.sui, s = (l == null ? void 0 : l.chainType) === o.evm || (l == null ? void 0 : l.chainType) === o.sui ? d : d ?? m.address, a = async (u) => {
31
31
  try {
32
- p.preventDefault(), m ? await i.disconnect() : await c();
33
- } catch (u) {
34
- console.error("Failed to disconnect:", u);
32
+ u.preventDefault(), c ? await i.disconnect() : await p();
33
+ } catch (f) {
34
+ console.error("Failed to disconnect:", f);
35
35
  }
36
36
  };
37
- return t ? /* @__PURE__ */ r(f, { children: [
38
- /* @__PURE__ */ l(
37
+ return s ? /* @__PURE__ */ r(x, { children: [
38
+ /* @__PURE__ */ e(
39
39
  "img",
40
40
  {
41
- src: e == null ? void 0 : e.pngUrl,
41
+ src: l == null ? void 0 : l.pngUrl,
42
42
  alt: "",
43
43
  className: "liq-w-6 liq-h-6 liq-rounded-lg"
44
44
  }
45
45
  ),
46
- /* @__PURE__ */ l("span", { className: "liq-truncate liq-text-gray-400", children: s(e) }),
47
- /* @__PURE__ */ l("span", { className: "liq-ml-[-5px]", children: ":" }),
48
- /* @__PURE__ */ l("div", { className: "liq-flex liq-items-center liq-justify-between", children: /* @__PURE__ */ r("div", { className: "liq-flex liq-max-w-[10rem] liq-items-center liq-gap-1", children: [
49
- /* @__PURE__ */ l(
50
- A,
46
+ /* @__PURE__ */ e("span", { className: "liq-truncate liq-text-gray-400", children: t(l) }),
47
+ /* @__PURE__ */ e("span", { className: "liq-ml-[-5px]", children: ":" }),
48
+ /* @__PURE__ */ e("div", { className: "liq-flex liq-items-center liq-justify-between", children: /* @__PURE__ */ r("div", { className: "liq-flex liq-max-w-[10rem] liq-items-center liq-gap-1", children: [
49
+ /* @__PURE__ */ e(
50
+ T,
51
51
  {
52
- to: `${(d = e == null ? void 0 : e.blockExplorerUrls) == null ? void 0 : d[0]}/address/${t}`,
52
+ to: `${(q = l == null ? void 0 : l.blockExplorerUrls) == null ? void 0 : q[0]}/address/${s}`,
53
53
  target: "_blank",
54
54
  showExternalIcon: !1,
55
55
  className: "!liq-relative",
56
- children: /* @__PURE__ */ l("div", { className: "liq-flex liq-min-w-0 liq-flex-grow liq-overflow-hidden liq-leading-none liq-max-w-[10rem]", children: /* @__PURE__ */ l(
56
+ children: /* @__PURE__ */ e("div", { className: "liq-flex liq-min-w-0 liq-flex-grow liq-overflow-hidden liq-leading-none liq-max-w-[10rem]", children: /* @__PURE__ */ e(
57
57
  D,
58
58
  {
59
- address: t,
59
+ address: s,
60
60
  "data-testid": "evm-address"
61
61
  }
62
62
  ) })
63
63
  }
64
64
  ),
65
- /* @__PURE__ */ l(
65
+ /* @__PURE__ */ e(
66
66
  j,
67
67
  {
68
- text: t,
68
+ text: s,
69
69
  className: "liq-text-sm",
70
70
  "data-testid": "evm-copy-button"
71
71
  }
72
72
  )
73
73
  ] }) }),
74
- /* @__PURE__ */ l("div", { className: "liq-ml-auto liq-mr-0 liq-flex liq-items-center liq-gap-1", children: /* @__PURE__ */ l(
74
+ /* @__PURE__ */ e("div", { className: "liq-ml-auto liq-mr-0 liq-flex liq-items-center liq-gap-1", children: /* @__PURE__ */ e(
75
75
  "button",
76
76
  {
77
77
  className: "focus-primary liq-flex liq-items-center liq-gap-1 liq-rounded-xl liq-px-0 liq-py-2 liq-text-sm liq-font-semibold liq-text-neutral-400 liq-transition-colors liq-duration-200 hover:enabled:liq-text-white disabled:liq-opacity-50",
78
78
  onClick: a,
79
79
  "data-testid": "evm-disconnect-button",
80
- children: /* @__PURE__ */ l(g, { icon: x })
80
+ children: /* @__PURE__ */ e(y, { icon: g })
81
81
  }
82
82
  ) })
83
- ] }) : m ? /* @__PURE__ */ r("div", { className: "liq-flex liq-max-w-full liq-items-center liq-gap-2", children: [
84
- /* @__PURE__ */ l(
83
+ ] }) : c ? /* @__PURE__ */ r("div", { className: "liq-flex liq-max-w-full liq-items-center liq-gap-2", children: [
84
+ /* @__PURE__ */ e(
85
85
  "button",
86
86
  {
87
- disabled: o || i.isConnecting,
87
+ disabled: n || i.isConnecting,
88
88
  onClick: () => i.connect(),
89
89
  className: "liq-rounded-lg liq-font-semibold liq-transition-colors liq-duration-200 disabled:liq-opacity-50 liq-bg-neutral-750 !liq-text-primary-200 hover:enabled:liq-bg-primary liq-px-2",
90
- children: /* @__PURE__ */ l("div", { className: "liq-flex liq-items-center", children: /* @__PURE__ */ r("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
91
- /* @__PURE__ */ l("div", { children: i.isConnecting ? "Connecting..." : "Connect" }),
92
- /* @__PURE__ */ l(
90
+ children: /* @__PURE__ */ e("div", { className: "liq-flex liq-items-center", children: /* @__PURE__ */ r("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
91
+ /* @__PURE__ */ e("div", { children: i.isConnecting ? "Connecting..." : "Connect" }),
92
+ /* @__PURE__ */ e(
93
93
  "img",
94
94
  {
95
- src: e == null ? void 0 : e.pngUrl,
95
+ src: l == null ? void 0 : l.pngUrl,
96
96
  alt: "",
97
97
  className: "liq-w-4 liq-h-4 liq-rounded-sm"
98
98
  }
99
99
  ),
100
- /* @__PURE__ */ l("div", { className: "liq-truncate md:liq-text-clip", children: s(e) })
100
+ /* @__PURE__ */ e("div", { className: "liq-truncate md:liq-text-clip", children: t(l) })
101
101
  ] }) })
102
102
  }
103
103
  ),
104
- i.isConnecting && /* @__PURE__ */ l(
104
+ i.isConnecting && /* @__PURE__ */ e(
105
105
  "button",
106
106
  {
107
107
  type: "button",
@@ -110,26 +110,26 @@ const Z = ({
110
110
  children: "Cancel"
111
111
  }
112
112
  )
113
- ] }) : /* @__PURE__ */ l(
114
- N,
113
+ ] }) : /* @__PURE__ */ e(
114
+ b,
115
115
  {
116
- disabled: o,
116
+ disabled: n,
117
117
  className: "liq-rounded-lg liq-font-semibold liq-transition-colors liq-duration-200 disabled:liq-opacity-50 liq-bg-neutral-750 !liq-text-primary-200 hover:enabled:liq-bg-primary liq-px-2",
118
- children: /* @__PURE__ */ l("div", { className: "liq-flex liq-items-center", children: /* @__PURE__ */ r("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
119
- /* @__PURE__ */ l("div", { children: n.isConnecting ? "Connecting..." : "Connect" }),
120
- /* @__PURE__ */ l(
118
+ children: /* @__PURE__ */ e("div", { className: "liq-flex liq-items-center", children: /* @__PURE__ */ r("div", { className: "liq-flex liq-justify-center liq-items-center liq-gap-2", children: [
119
+ /* @__PURE__ */ e("div", { children: m.isConnecting ? "Connecting..." : "Connect" }),
120
+ /* @__PURE__ */ e(
121
121
  "img",
122
122
  {
123
- src: e == null ? void 0 : e.pngUrl,
123
+ src: l == null ? void 0 : l.pngUrl,
124
124
  alt: "",
125
125
  className: "liq-w-4 liq-h-4 liq-rounded-sm"
126
126
  }
127
127
  ),
128
- /* @__PURE__ */ l("div", { className: "liq-truncate md:liq-text-clip", children: s(e) })
128
+ /* @__PURE__ */ e("div", { className: "liq-truncate md:liq-text-clip", children: t(l) })
129
129
  ] }) })
130
130
  }
131
131
  );
132
132
  };
133
133
  export {
134
- Z as BridgeAccountDisplay
134
+ v as BridgeAccountDisplay
135
135
  };