import{o as e}from"./rolldown-runtime.js";import{n as t,t as n}from"./jsx-runtime.js";import{M as r,Mt as i,Qt as a,T as o,V as s,Vt as c,W as l,j as u,ln as d,m as f,un as p,ut as ee}from"./useActiveWallet-CEs8euQ3.js";import{b as te,k as ne}from"./context-Cdw68BC2.js";import{Cn as m,Ht as re,Jt as h,n as ie}from"./ccip.js";import{i as ae,n as oe}from"./_esm.js";import"./index-CKYEOQWW.js";import{s as g}from"./toViemAccount-BywVRwQG.js";import{t as se}from"./modal-context-DHfp-mFQ.js";import{n as ce}from"./ErrorScreen-DeF4PptC.js";import{l as le,r as _,u as v}from"./ModalHeader-BS54PZSj.js";import{r as ue,t as de}from"./TransactionErrorView--dDzh6J1.js";import{u as y}from"./Layouts-BlFm53ED.js";import{t as b}from"./ScreenHeader-CHmc4-Lu.js";import{t as fe}from"./useGetTokenPrice-Bm_VkGB-.js";import{t as pe}from"./formatErc20TokenAmount-BuPk9xcy.js";import{o as x,r as me,t as he}from"./ethers-CvevhY2s.js";import{t as ge}from"./Address-y5t2AVyL.js";import{n as _e}from"./transfer-6YztDh-t.js";import{t as ve}from"./getErc20TokenInfo-DdZupEXp.js";import{t as ye}from"./useWalletBalance-D47dI-xh.js";import{t as S}from"./TransactionDetails-Gb0WrEsR.js";import{t as C}from"./JsonTree-aPaJmPx7.js";var w=n(),T=e(t(),1);u();var be=[{constant:!0,inputs:[{name:`_owner`,type:`address`}],name:`balanceOf`,outputs:[{name:`balance`,type:`uint256`}],payable:!1,stateMutability:`view`,type:`function`}],E=o.div`
  display: flex;
  flex-direction: column;
  min-height: 72px;
`,xe=({onBack:e,details:t})=>(0,w.jsxs)(E,{children:[(0,w.jsx)(_,{backFn:e}),(0,w.jsx)(C,{data:t}),(0,w.jsx)(v,{})]}),Se=({gasUsed:e,effectiveGasPrice:t})=>{if(e&&t)try{return m(e*t)}catch{return}},Ce=({txn:e,receipt:t,transactionInfo:n,onClose:r,tokenPrice:i,tokenSymbol:a,receiptHeader:o,receiptDescription:s})=>(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(_,{onClose:r}),(0,w.jsx)(b,{title:o??`Transaction complete!`,description:s??`You're all set.`}),(0,w.jsx)(S,{tokenPrice:i,from:t.from,to:t.to,gas:Se(t),txn:e,transactionInfo:n,tokenSymbol:a}),(0,w.jsx)(f,{}),(0,w.jsx)(D,{loading:!1,onClick:r,children:`All Done`}),(0,w.jsx)(y,{}),(0,w.jsx)(v,{})]}),D=o(le)`
  && {
    margin-top: 24px;
  }
  transition:
    color 350ms ease,
    background-color 350ms ease;
`,O=[{constant:!1,inputs:[{name:`_salt`,type:`bytes32`},{name:`_initializer`,type:`bytes`}],name:`deployAccount`,outputs:[{name:``,type:`bool`}],payable:!1,stateMutability:`nonpayable`,type:`function`}],k=[{name:`from`,type:`address`},{name:`param2`,type:`address`},{name:`param3`,type:`bytes`},{name:`param4`,type:`tuple`,components:[]},{type:`tuple`,components:[{name:`param5`,type:`address`},{name:`param6`,type:`uint256`},{name:`param7`,type:`uint256`},{name:`encodedInitData`,type:`bytes`}]}],A=[{constant:!1,inputs:[{name:`spender`,type:`address`},{name:`value`,type:`uint256`}],name:`approve`,outputs:[{name:``,type:`bool`}],payable:!1,stateMutability:`nonpayable`,type:`function`}],j=[{inputs:[{name:`to`,type:`address`},{name:`amount`,type:`uint256`},{name:`memo`,type:`bytes32`}],name:`transferWithMemo`,outputs:[{name:``,type:`bool`}],stateMutability:`nonpayable`,type:`function`}],we=[{inputs:[{internalType:`address`,name:`to`,type:`address`},{internalType:`uint256`,name:`amount`,type:`uint256`}],name:`mint`,outputs:[],stateMutability:`nonpayable`,type:`function`},{inputs:[{internalType:`address`,name:`to`,type:`address`},{internalType:`uint256`,name:`amount`,type:`uint256`}],name:`mint`,outputs:[],stateMutability:`payable`,type:`function`},{inputs:[{internalType:`address`,name:`to`,type:`address`}],name:`mint`,outputs:[],stateMutability:`nonpayable`,type:`function`},{inputs:[{internalType:`address`,name:`to`,type:`address`}],name:`mint`,outputs:[],stateMutability:`payable`,type:`function`},{inputs:[{internalType:`address`,name:`to`,type:`address`},{internalType:`uint256`,name:`tokenId`,type:`uint256`},{internalType:`uint256`,name:`quantity`,type:`uint256`},{internalType:`bytes`,name:`data`,type:`bytes`}],name:`mint`,outputs:[{internalType:`bool`,name:``,type:`bool`}],stateMutability:`nonpayable`,type:`function`},{inputs:[{internalType:`address`,name:`to`,type:`address`},{internalType:`uint256`,name:`tokenId`,type:`uint256`},{internalType:`uint256`,name:`quantity`,type:`uint256`},{internalType:`bytes`,name:`data`,type:`bytes`}],name:`mint`,outputs:[{internalType:`bool`,name:``,type:`bool`}],stateMutability:`payable`,type:`function`},{inputs:[{internalType:`address`,name:`to`,type:`address`},{internalType:`uint256[]`,name:`tokenIds`,type:`uint256[]`},{internalType:`uint256[]`,name:`quantities`,type:`uint256[]`},{internalType:`bytes`,name:`data`,type:`bytes`}],name:`mintBatch`,outputs:[{internalType:`bool`,name:``,type:`bool`}],stateMutability:`nonpayable`,type:`function`},{inputs:[{internalType:`address`,name:`to`,type:`address`},{internalType:`uint256[]`,name:`tokenIds`,type:`uint256[]`},{internalType:`uint256[]`,name:`quantities`,type:`uint256[]`},{internalType:`bytes`,name:`data`,type:`bytes`}],name:`mintBatch`,outputs:[{internalType:`bool`,name:``,type:`bool`}],stateMutability:`payable`,type:`function`},{inputs:[{internalType:`uint256`,name:`quantity`,type:`uint256`}],name:`mint`,outputs:[{internalType:`bool`,name:``,type:`bool`}],stateMutability:`nonpayable`,type:`function`},{inputs:[{internalType:`uint256`,name:`quantity`,type:`uint256`}],name:`mint`,outputs:[{internalType:`bool`,name:``,type:`bool`}],stateMutability:`payable`,type:`function`},{inputs:[{internalType:`address`,name:`to`,type:`address`}],name:`safeMint`,outputs:[],stateMutability:`nonpayable`,type:`function`},{inputs:[{internalType:`address`,name:`to`,type:`address`}],name:`safeMint`,outputs:[],stateMutability:`payable`,type:`function`},{inputs:[{internalType:`address`,name:`to`,type:`address`},{internalType:`string`,name:`uri`,type:`string`}],name:`safeMint`,outputs:[],stateMutability:`nonpayable`,type:`function`},{inputs:[{internalType:`address`,name:`to`,type:`address`},{internalType:`string`,name:`uri`,type:`string`}],name:`safeMint`,outputs:[],stateMutability:`payable`,type:`function`},{inputs:[{internalType:`address`,name:`to`,type:`address`},{internalType:`uint256`,name:`tokenId`,type:`uint256`}],name:`safeMint`,outputs:[],stateMutability:`nonpayable`,type:`function`},{inputs:[{internalType:`address`,name:`to`,type:`address`},{internalType:`uint256`,name:`tokenId`,type:`uint256`}],name:`safeMint`,outputs:[],stateMutability:`payable`,type:`function`},{inputs:[{internalType:`address`,name:`to`,type:`address`},{internalType:`uint256`,name:`tokenId`,type:`uint256`},{internalType:`string`,name:`uri`,type:`string`}],name:`safeMint`,outputs:[],stateMutability:`nonpayable`,type:`function`},{inputs:[{internalType:`address`,name:`to`,type:`address`},{internalType:`uint256`,name:`tokenId`,type:`uint256`},{internalType:`string`,name:`uri`,type:`string`}],name:`safeMint`,outputs:[],stateMutability:`payable`,type:`function`},{inputs:[{internalType:`address`,name:`to`,type:`address`},{internalType:`uint256`,name:`amount`,type:`uint256`}],name:`batchMint`,outputs:[],stateMutability:`nonpayable`,type:`function`},{inputs:[{internalType:`address`,name:`to`,type:`address`},{internalType:`uint256`,name:`amount`,type:`uint256`}],name:`batchMint`,outputs:[],stateMutability:`payable`,type:`function`}],M=[{constant:!1,inputs:[{name:`_from`,type:`address`},{name:`_to`,type:`address`},{name:`_tokenId`,type:`uint256`}],name:`safeTransferFrom`,outputs:[{name:``,type:`bool`}],payable:!1,stateMutability:`nonpayable`,type:`function`}],Te=[{constant:!1,inputs:[{name:`_operator`,type:`address`},{name:`_approved`,type:`bool`}],name:`setApprovalForAll`,outputs:[{name:``,type:`bool`}],payable:!1,stateMutability:`nonpayable`,type:`function`}],N=[{constant:!1,inputs:[{name:`_from`,type:`address`},{name:`_to`,type:`address`},{name:`_tokenId`,type:`uint256`}],name:`transferFrom`,outputs:[{name:``,type:`bool`}],payable:!1,stateMutability:`nonpayable`,type:`function`}],P=[{constant:!1,inputs:[{name:`_from`,type:`address`},{name:`_to`,type:`address`},{name:`_tokenIds`,type:`uint256[]`},{name:`_amounts`,type:`uint256[]`},{name:`_data`,type:`bytes`}],name:`safeBatchTransferFrom`,outputs:[{name:``,type:`bool`}],payable:!1,stateMutability:`nonpayable`,type:`function`}],F=[{constant:!1,inputs:[{name:`_from`,type:`address`},{name:`_to`,type:`address`},{name:`_tokenId`,type:`uint256`},{name:`_amount`,type:`uint256`},{name:`_data`,type:`bytes`}],name:`safeTransferFrom`,outputs:[{name:``,type:`bool`}],payable:!1,stateMutability:`nonpayable`,type:`function`}],Ee=(e,t)=>{let n=I(A,e);if(n)return{action:`approve`,functionName:`approve`,isErc20Ish:!0,isNFTIsh:!1,spender:n.args[0],amount:n.args[1]};let r=I(_e,e);if(r)return{action:`transfer`,functionName:`transfer`,isErc20Ish:!0,isNFTIsh:!1,transferTo:r.args[0],amount:r.args[1]};let i=I(j,e);if(i)return{action:`transfer`,functionName:`transferWithMemo`,isErc20Ish:!0,isNFTIsh:!1,transferTo:i.args[0],amount:i.args[1]};if(!t)return{action:`transaction`,functionName:``,isErc20Ish:!1,isNFTIsh:!1};let a=I(O,e);if(a&&typeof a.args[1]==`string`){let e=De(a.args[1]);if(e&&e[4].encodedInitData)return Ee(e[4].encodedInitData,t)}let o=I(Te,e);if(o)return{action:`approve`,functionName:`setApprovalForAll`,isNFTIsh:!0,isErc20Ish:!1,operator:o.args[0],approved:o.args[1]};let s=I(N,e);if(s)return{action:`transfer`,functionName:`transferFrom`,isNFTIsh:!0,isErc20Ish:!1,transferFrom:s.args[0],transferTo:s.args[1],tokenId:s.args[2]};let c=I(M,e);if(c)return{action:`transfer`,functionName:`safeTransferFrom`,isNFTIsh:!0,isErc20Ish:!1,transferFrom:c.args[0],transferTo:c.args[1],tokenId:c.args[2]};let l=I(F,e);if(l)return{action:`transfer`,functionName:`safeTransferFrom`,isNFTIsh:!0,isErc20Ish:!1,transferFrom:l.args[0],transferTo:l.args[1],tokenId:l.args[2],amount:l.args[3]};let u=I(P,e);if(u)return{action:`batch transfer`,functionName:`safeBatchTransferFrom`,isNFTIsh:!0,isErc20Ish:!1,transferFrom:u.args[0],transferTo:u.args[1],tokenIds:u.args[2],amounts:u.args[3]};let d=I(we,e);return d?{action:`mint`,functionName:d.functionName,isNFTIsh:!0,isErc20Ish:!1,args:d.args}:{action:`transaction`,isErc20Ish:!1,isNFTIsh:!1}},I=(e,t)=>{try{let n=ie({abi:e,data:t});return{functionName:n.functionName,args:n.args||[]}}catch{return null}},De=e=>{try{if(typeof e==`string`)return h(k,`0x${e.slice(10)}`)}catch{return null}},L=e=>`${parseFloat(e).toFixed(2)}`;function Oe(e,t){let n=[],r=new Map;if(e){for(let t of e)if(t.in[0]){let e;e=t.asset.type===`ERC721`||t.in[0].value===`approve_for_all`?{id:`nft:${t.asset.name}`,nftName:t.asset.name,nftCount:t.in.length}:{id:`token:${t.asset.type}:${t.asset.symbol}:${t.asset.name}`,iconUrl:t.asset.logo_url,value:t.in[0].value,symbol:t.asset.symbol,usdValue:t.in[0].usd_price?L(t.in[0].usd_price):void 0,decimals:t.asset.decimals},n.push(e)}else if(t.out[0]?.value){let e;e=t.asset.type===`ERC721`||t.out[0].value===`approve_for_all`?{id:`nft:${t.asset.name}`,nftName:t.asset.name}:{id:`token:${t.asset.type}:${t.asset.symbol}:${t.asset.name}`,iconUrl:t.asset.logo_url,value:t.out[0].value,symbol:t.asset.symbol,usdValue:t.out[0].usd_price?L(t.out[0].usd_price):void 0,decimals:t.asset.decimals},r.has(e.id)||r.set(e.id,e)}}for(let e of t)for(let t of Object.keys(e.spenders)){let n;n=e.asset.type===`ERC721`||e.spenders[t]?.value===`approve_for_all`?{id:`nft:${e.asset.name}`,nftName:e.asset.name}:{id:`token:${e.asset.type}:${e.asset.symbol}:${e.asset.name}`,iconUrl:e.asset.logo_url,value:e.spenders[t]?.value,symbol:e.asset.symbol,usdValue:e.spenders[t]?.usd_price?L(e.spenders[t]?.usd_price):void 0,decimals:e.asset.decimals},r.has(n.id)||r.set(n.id,n)}return{assetsIn:n,assetsOut:Array.from(r.values())}}var ke=(e,t,n,r)=>{let[i,a]=(0,T.useState)(null),{walletProxy:o}=c();return(0,T.useEffect)((()=>{i&&a(null),(async()=>{if(!o||!t)return null;let i=[],a=!0,s=await g(e,n,t,r).catch((t=>(t.message&&t.message.includes(`Insufficient balance for transaction`)||t.message&&t.message.includes(`Insufficient funds for gas * price + value`)||t.details&&t.details.includes(`insufficient funds`)||t.details&&t.details.includes(`gas required exceeds allowance`)?a=!1:i.push(t),e)));return{tx:s,totalGasEstimate:s.gas,hasFunds:a,errors:i}})().then(a)}),[e]),i},Ae=new l(new s(`There was an issue preparing your transaction`,p.E32603_DEFAULT_INTERNAL_ERROR.eipCode)),je=(e,t)=>e?.sendTransaction?`transactionRequest`in e.sendTransaction?e.sendTransaction.transactionRequest:e.sendTransaction.transactionRequests[t]:void 0,R={component:()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:t,setModalData:n,navigate:o}=se(),{client:u,rpcConfig:f,chains:m,closePrivyModal:h,walletProxy:ie,showFiatPrices:g}=c(),{user:le}=i(),_=ne(),[v,y]=(0,T.useState)(0),[b,_e]=(0,T.useState)(0),[S,C]=(0,T.useState)(je(e,v)),[E,Se]=(0,T.useState)(null),[D,O]=(0,T.useState)(),[k,A]=(0,T.useState)(!1),[j,we]=(0,T.useState)(null),[M,Te]=(0,T.useState)(null),[N,P]=(0,T.useState)(null),[F,I]=(0,T.useState)(void 0),[De,L]=(0,T.useState)(void 0),[R,Me]=(0,T.useState)(!1),[Ne,Pe]=(0,T.useState)(!1),[Fe,z]=(0,T.useState)([]),[Ie,Le]=(0,T.useState)([]),[B,V]=(0,T.useState)(`uninitiated`),[Re,ze]=(0,T.useState)(void 0);if(!S||!e?.sendTransaction||!e?.sendTransaction)return(0,w.jsx)(ce,{error:Error(`Invalid transaction request`),allowlistConfig:_.allowlistConfig,onRetry:()=>{e?.sendTransaction?.onFailure(Ae),h({shouldCallAuthOnSuccess:!1})}});let{transactingWalletAddress:H}=e.sendTransaction,U=(0,T.useMemo)((()=>m.find((e=>Number(e.id)===Number(S.chainId)))),[S.chainId]),W=U?.nativeCurrency.symbol??`ETH`,G=(0,T.useMemo)((()=>Ee(S.data,!!_.embeddedWallets.extendedCalldataDecoding)),[S.data]),{action:K,isErc20Ish:q,isNFTIsh:Be,functionName:J}=G,{toAddress:Ve,tokenAddress:He}=(0,T.useMemo)((()=>({toAddress:G.isErc20Ish?G.transferTo:S.to??void 0,tokenAddress:G.isErc20Ish?S.to:void 0})),[G]);(0,T.useEffect)((()=>{S.to&&U&&q&&ve({address:S.to,chain:U,rpcConfig:_.rpcConfig,privyAppId:_.id}).then(Se).catch(console.error)}),[S.to,U]);let{tokenPrice:Y,isTokenPriceLoading:Ue}=fe(S.chainId),{balance:We}=ye({rpcConfig:_.rpcConfig,appId:_.id,address:H,chain:U}),Ge=function({rpcConfig:e,appId:t,address:n,chain:r,tokenInfo:i}){let{chains:o}=c(),[s,l]=(0,T.useState)(null),[u,f]=(0,T.useState)(!1),p=(0,T.useMemo)((()=>{let n=r||o[0];if(n)return ae({chain:r,transport:oe(d(n,e,t))})}),[r,e,t]),ee=(0,T.useCallback)((async()=>{if(n&&p&&i.address)try{return f(!0),await p.readContract({address:i.address,abi:be,functionName:`balanceOf`,args:[n]})}catch(e){console.error(e)}finally{f(!1)}}),[p,n,i?.address,r]);return(0,T.useEffect)((()=>{ee().then((e=>e!=null&&l(e)))}),[ee]),{balance:s,isLoading:u&&s==null,formattedBalance:a({amount:s??BigInt(0),decimals:i.decimals})}}({rpcConfig:_.rpcConfig,appId:_.id,address:H,tokenInfo:{address:He||``,decimals:E?.decimals??18},chain:U}),Ke=(0,T.useMemo)((()=>ee(Number(S.chainId),m,f,{appId:_.id})),[S.chainId,f]),X=ke(S,H,Ke,e?.sendTransaction?.prepareTransactionRequest);(0,T.useEffect)((()=>{C(je(e,v))}),[v]),(0,T.useEffect)((()=>{e.sendTransaction?.getIsSponsored?e.sendTransaction.getIsSponsored().then(O).catch(console.error):O(!1)}),[e.sendTransaction.getIsSponsored]);let Z=()=>{if(!k)return j?e?.sendTransaction?.onSuccess({hash:j}):N||X?.errors[0]?e?.sendTransaction?.onFailure(N??X?.errors[0]??Ae):e?.sendTransaction?.onFailure(new l(new s(`The user rejected the request`,p.E4001_USER_REJECTED_REQUEST.eipCode))),h({shouldCallAuthOnSuccess:!1})};t.current=Z;let Q=!!(e.funding&&e.funding.supportedOptions.length>0),qe=he(BigInt(X?.totalGasEstimate??0n),W),Je=g&&Y?x(BigInt(X?.totalGasEstimate??0n),Y):void 0,Ye=he(We??0n,W,void 0,!0),Xe=g&&Y?x(We??0n,Y):void 0,Ze=E&&!Ge.isLoading&&q&&K!==`approve`?`${Ge.formattedBalance} ${E.symbol}`:void 0,Qe=e.sendTransaction?.uiOptions?.transactionInfo?.title;Qe||=K===`approve`?q?`Confirm address`:`Confirm action`:`Approve ${K}`;let $e=(0,T.useMemo)((()=>{if(e.sendTransaction?.uiOptions?.description)return e.sendTransaction?.uiOptions?.description;if(K===`approve`&&J===`setApprovalForAll`&&G.approved){let e=(0,w.jsx)(ge,{address:G.operator||``,url:U?.blockExplorers?.default?.url});return(0,w.jsxs)(w.Fragment,{children:[_.name,` would like your permission for `,e,` to transfer tokens on your behalf.`]})}if(K===`approve`&&J===`setApprovalForAll`&&!G.approved){let e=(0,w.jsx)(ge,{address:G.operator||``,url:U?.blockExplorers?.default?.url});return(0,w.jsxs)(w.Fragment,{children:[_.name,` would like your permission to revoke permissions of `,e,` from transferring tokens on your behalf.`]})}return q&&K===`approve`||q&&K===`approve`?`${_.name} would like your permission for ${r(G.spender)} to spend tokens on your behalf.`:`${_.name} wants your permission to approve the following transaction.`}),[_.name,q,G,e.sendTransaction?.uiOptions.description,J]),et=e.sendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?(0,w.jsx)(`img`,{src:e.sendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:e.sendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,$=!(!X||X.errors[0]||X.hasFunds||!1!==D),tt=$&&Q,nt=tt?`Add funds`:e.sendTransaction?.uiOptions?.buttonText||(v<b?`Continue`:`Approve`),rt=e=>{if(!e)throw Error(`Transaction scan failed`);if(e.validation.status===`Success`&&(e.validation.result_type===`Benign`?L(`safe`):e.validation.result_type===`Warning`?L(`warn`):e.validation.result_type===`Malicious`&&(L(`error`),Pe(!0))),e.simulation.status!==`Success`)throw Error(`Simulation failed`);{I(e.simulation.params);let{assetsIn:t,assetsOut:n}=Oe(e.simulation.assets_diffs,e.simulation.exposures);if(n.length===0&&t.length===0)throw Error(`No tokens found`);z(n),Le(t)}};return(0,T.useEffect)((()=>{e.sendTransaction?.scanTransaction&&_.embeddedWallets.transactionScanning.enabled&&B===`uninitiated`&&(V(`in progress`),e.sendTransaction.scanTransaction().then((e=>{rt(e),V(`completed`)})).catch((()=>V(`failed`))))}),[!!e.sendTransaction?.scanTransaction]),(0,T.useEffect)((()=>{e.sendTransaction?.scanTransaction&&B!==`failed`||((t,n,r)=>{if(_e((e=>e?.sendTransaction?`transactionRequest`in e.sendTransaction?0:e.sendTransaction.transactionRequests.length-1:0)(e)),n.isErc20Ish&&n.amount&&r){let e=pe({amount:n.amount,decimals:r.decimals});ze(e),z([{value:e,symbol:r?.symbol,decimals:r?.decimals}])}else if(t.value){let e=BigInt(t.value),n=Y?x(e,Y):void 0;z(g&&n?[{value:n}]:[{value:me(e),symbol:W,decimals:18,usdValue:n}])}else z(g?[{value:`$0`}]:[{value:`0`,symbol:W,decimals:18}])})(X?.tx??S,G,E)}),[S,X?.tx,G,E,B]),M?(0,w.jsx)(Ce,{txn:X?.tx??S,onClose:Z,receipt:M,transactionInfo:e.sendTransaction?.uiOptions.transactionInfo,tokenPrice:Y,tokenSymbol:W,receiptHeader:e.sendTransaction?.uiOptions.successHeader,receiptDescription:e.sendTransaction?.uiOptions.successDescription}):N?(0,w.jsx)(ue,{transactionError:N,transactionHash:j??void 0,chainType:`ethereum`,chainId:X?.tx.chainId??S.chainId,onClose:Z,onRetry:({resetNonce:e})=>{P(null);let t={...X?.tx??S};e&&(t.nonce=void 0),C(t)}}):R&&F?(0,w.jsx)(xe,{details:F,onBack:()=>Me(!1)}):(0,w.jsx)(de,{transactionIndex:v,onBack:b!==0&&typeof v==`number`&&v!==0?()=>{y(v-1)}:void 0,maxIndex:b,disabled:$&&!Q||Ne,isSubmitting:k,submitError:N,isPreparing:!X,isTokenPriceLoading:Ue,isTokenContractInfoLoading:!Be&&!E,prepareError:X?.errors[0],symbol:E?.symbol,chain:U,img:et,title:Qe,subtitle:$e,txValue:S.value,fee:Je??qe,isSponsored:D,from:H??``,to:Ve,tokenAddress:He??void 0,network:_.chains.find((e=>e.id===S.chainId))?.name??``,transactionDetails:{...G,formattedAmount:Re},cta:nt,missingFunds:$,action:K,balance:Ze??Xe??Ye,onClose:Z,onClick:tt?async()=>{if(!H)return;if(!Q)throw Error(`Funding wallet is not enabled`);let t=`FundingMethodSelectionScreen`;n({...e,funding:{...e.funding,methodScreen:t,chainType:`ethereum`,amount:re(BigInt(X?.tx.value??0)+BigInt(X?.totalGasEstimate?.toString()??0)),chain:U},solanaFundingData:e?.solanaFundingData}),o(t)}:async()=>{if(v<b)y(v+1);else{A(!0);try{let t=await u.getAccessToken();if(k||!t||!ie||!le)return;let n=await e.sendTransaction.onConfirm({transactionRequest:X?.tx??S});if(we(n),e.sendTransaction?.signOnly)return await new Promise((e=>setTimeout(e,te))),e?.sendTransaction?.onSuccess({hash:n}),h({shouldCallAuthOnSuccess:!1});let r=await Ke.waitForTransactionReceipt({hash:n});if(r.status===`reverted`)throw Error(`Transaction failed`);Te(r)}catch(e){console.warn({transaction:X?.tx??S,error:e}),P(e)}finally{A(!1)}}},validation:De,hasScanDetails:!!F,setIsScanDetailsOpen:Me,preventMaliciousTransaction:Ne,setPreventMaliciousTransaction:Pe,tokensSent:Fe,tokensReceived:Ie,isScanning:B===`in progress`,isCancellable:e.sendTransaction?.uiOptions?.isCancellable??!1,functionName:J})}};export{R as SendTransactionScreen,R as default};