"use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("@privy-io/js-sdk-core"),r=require("./privy-context-UTJouJ1x.js"),a=require("./context-rs-ygOK2.js"),i=require("./internal-context-CdsQ3LEl.js"),o=require("./modal-context-BgeioxwT.js"),s=require("./useGetSolPrice-BOxa4idj.js"),c=require("./ErrorScreen-CakvnnzU.js"),u=require("@heroicons/react/24/outline/CheckCircleIcon"),l=require("styled-components"),d=require("./ModalHeader-Cpls13mi.js"),p=require("./Layouts-D3TOcPhm.js"),m=require("./ScreenHeader-CgYJ5Fmg.js"),f=require("./Row-CMqYn75Q.js"),g=require("./Value-mhPsfsxe.js"),h=require("./WalletLink-Dxq-sK27.js"),y=require("./StackedContainer-CM36po_U.js"),w=require("./useActiveWallet-dTc6deka.js"),S=require("./TransactionErrorView-CIZbOcj4.js"),k=require("./transaction-DjF5X-by.js"),A=require("@solana/kit"),j=require("./useSolanaRpcClient-COqLztBk.js"),q=require("./getFormattedUsdFromLamports-Mu2fqwL2.js");function v(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("@privy-io/are-addresses-equal"),require("tinycolor2"),require("lucide-react"),require("./index-BoiKFBqR.js"),require("./toViemAccount-CopJpCYv.js"),require("jose"),require("eventemitter3"),require("./index-Ub4KpwSY.js"),require("zustand"),require("viem"),require("viem/utils"),require("./errors-CBapWvRs.js"),require("ofetch"),require("./wallet-connect-BuohfvHK.js"),require("./getPublicClient-CFd_sHBk.js"),require("viem/chains"),require("react-device-detect"),require("@coinbase/wallet-sdk"),require("@walletconnect/ethereum-provider"),require("./pkce-CmuJlEgn.js"),require("./paths-DizMb-lU.js"),require("./PrivyPluginContext-DsLtVhZA.js"),require("js-cookie"),require("@privy-io/ethereum"),require("viem/accounts"),require("mipd"),require("@scure/base"),require("./usePrivy-Dt4_yE6Q.js"),require("./use-unlink-wallet-DAxmY7kq.js"),require("./get-entropy-details-for-user-D63rM5_a.js"),require("./user-D2oPA-vS.js"),require("@privy-io/popup"),require("./events-context-Di6--rDg.js"),require("@headlessui/react"),require("@privy-io/urls"),require("./getEmbeddedConnectedWallet-D6YL2FS9.js"),require("./frame-BHa-PKpX.js"),require("@privy-io/routes"),require("./use-deposit-address-CVyd0fqP.js"),require("x402/client"),require("@privy-io/api-base"),require("./use-sign-with-user-signer-BhoaqeNG.js"),require("./reservoir-CfS214MF.js"),require("./ScreenLayout-DaFW0I3a.js"),require("./Screen-8NusMFtu.js"),require("./index-ByFhjjzH.js"),require("@heroicons/react/24/outline/ArrowLeftIcon"),require("@heroicons/react/24/outline/ArrowRightIcon"),require("@heroicons/react/24/outline/QuestionMarkCircleIcon"),require("@heroicons/react/24/outline/XMarkIcon"),require("./LoadingSkeleton-BoyADunQ.js"),require("./ethers-DEImj_8B.js"),require("@heroicons/react/24/outline"),require("./ErrorMessage-BfTVyue9.js"),require("./LabelXs-C8rLnCfU.js"),require("./Subtitle-CR8zM7ZJ.js"),require("./Title-ifTy35V5.js"),require("./Address-DW_NyDV7.js"),require("./WalletInfoCard-CG-n_44w.js"),require("./shared-DBm7PUrg.js"),require("./Checkbox-DzxHC5tk.js"),require("./ErrorBanner-dOLclNms.js"),require("@heroicons/react/24/outline/ExclamationCircleIcon"),require("./WarningBanner-DUcGaIpZ.js"),require("@heroicons/react/24/outline/ExclamationTriangleIcon"),require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon"),require("@heroicons/react/24/outline/ClipboardDocumentIcon");var b=/*#__PURE__*/v(u);const I=l.styled.span`
  && {
    width: 82px;
    height: 82px;
    border-width: 4px;
    border-style: solid;
    border-color: ${e=>e.color??"var(--privy-color-accent)"};
    background-color: ${e=>e.color??"var(--privy-color-accent)"};
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
  }
`,x=({instruction:t,fees:n,transactionInfo:r,solPrice:a,chain:i})=>/*#__PURE__*/e.jsxs(f.Rows,{children:[r?.action&&/*#__PURE__*/e.jsxs(f.Row,{children:[/*#__PURE__*/e.jsx(g.LabelSm,{children:"Action"}),/*#__PURE__*/e.jsx(g.Value,{children:r.action})]}),null!=t?.total&&/*#__PURE__*/e.jsxs(f.Row,{children:[/*#__PURE__*/e.jsx(g.LabelSm,{children:"Total"}),/*#__PURE__*/e.jsx(g.Value,{children:t.total})]}),!t?.total&&null!=t?.amount&&/*#__PURE__*/e.jsxs(f.Row,{children:[/*#__PURE__*/e.jsx(g.LabelSm,{children:"Total"}),/*#__PURE__*/e.jsx(g.Value,{children:/*#__PURE__*/e.jsx(h.SolanaPriceDisplay,{quantities:[t.amount,n],tokenPrice:a})})]}),/*#__PURE__*/e.jsxs(f.Row,{children:[/*#__PURE__*/e.jsx(g.LabelSm,{children:"Fees"}),/*#__PURE__*/e.jsx(g.Value,{children:/*#__PURE__*/e.jsx(h.SolanaPriceDisplay,{quantities:[n],tokenPrice:a})})]}),t?.to&&/*#__PURE__*/e.jsxs(f.Row,{children:[/*#__PURE__*/e.jsx(g.LabelSm,{children:"To"}),/*#__PURE__*/e.jsx(g.Value,{children:/*#__PURE__*/e.jsx(h.WalletLink,{walletAddress:t.to,chainId:i,chainType:"solana"})})]})]}),T=({fees:t,onClose:n,receiptHeader:r,receiptDescription:a,transactionInfo:i,solPrice:o,signOnly:s,instruction:c,chain:u})=>/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(d.ModalHeader,{onClose:n}),/*#__PURE__*/e.jsx(y.e,{style:{marginBottom:"16px"},children:/*#__PURE__*/e.jsxs("div",{children:[/*#__PURE__*/e.jsx(I,{color:"var(--privy-color-success-light)"}),/*#__PURE__*/e.jsx(b.default,{height:38,width:38,strokeWidth:2,stroke:"var(--privy-color-success)"})]})}),/*#__PURE__*/e.jsx(m.CenteredScreenHeader,{title:r??`Transaction ${s?"signed":"complete"}!`,description:a??"You're all set."}),/*#__PURE__*/e.jsx(x,{solPrice:o,instruction:c,fees:t,transactionInfo:i,chain:u}),/*#__PURE__*/e.jsx(w.Grow,{}),/*#__PURE__*/e.jsx(C,{loading:!1,onClick:n,children:"Close"}),/*#__PURE__*/e.jsx(p.RefactorSpacerBottom,{}),/*#__PURE__*/e.jsx(d.BlobbyFooter,{})]});let C=l.styled(d.PrimaryButton)`
  && {
    margin-top: 24px;
  }
  transition:
    color 350ms ease,
    background-color 350ms ease;
`;async function O(e,t){try{return await e}catch{return t}}function _(e){switch(e){case"solana:mainnet":return"mainnet-beta";case"solana:devnet":return"devnet";case"solana:testnet":return"testnet"}}async function P({privyClient:e,chain:t,mint:n}){let r=q.DEFAULT_TOKENS_DATA[t];if(!r[n]){let a=await e.getSplTokenMetadata({mintAddress:n,cluster:_(t)});a&&(r[n]={address:n,symbol:a.symbol,decimals:a.decimals})}return r[n]}async function E({tx:e,solanaClient:t,privyClient:n,checkFunds:r}){let a=A.getCompiledTransactionMessageDecoder().decode(j.getTransactionMessageBytes(e)),i=a.staticAccounts[0]??"",o=await j.fetchTransactionEstimatedFees({solanaClient:t,tx:e}),s=r?await O(j.simulateTransaction({solanaClient:t,tx:e})):void 0,c=s?.hasFunds??!0,u={},l=[],d=await async function({solanaClient:e,message:t}){if(!("addressTableLookups"in t)||!t.addressTableLookups)return[...t.staticAccounts];let n=t.addressTableLookups.map((e=>e.lookupTableAddress)),r=await A.fetchAddressesForLookupTables(n,e.rpc),a=n.map(((e,n)=>[...t.addressTableLookups[n]?.writableIndexes.map((t=>{let a=r[e]?.[t];if(a)return{key:a,isWritable:!0,altIdx:n}}))??[],...t.addressTableLookups[n]?.readonlyIndexes.map((t=>{let a=r[e]?.[t];if(a)return{key:a,isWritable:!1,altIdx:n}}))??[]])).flat().filter((e=>!!e)).sort(((e,t)=>e.isWritable!==t.isWritable?e.isWritable?-1:1:e.altIdx-t.altIdx)).map((({key:e})=>e));return[...t.staticAccounts,...a]}({solanaClient:t,message:a});for(let e of a.instructions){let r=a.staticAccounts[e.programAddressIndex]||"";if(r!==q.TOKEN_PROGRAM_ID&&r!==q.TOKEN_2022_PROGRAM_ID)if(r!==q.SYSTEM_PROGRAM_ID){if(r===q.ASSOCIATED_TOKEN_PROGRAM_ID){let t=await O(function(e,t,n){let[r,a,i,o]=e.accountIndices?.map((e=>t[e]))??[];return{type:"ata-creation",program:n,payer:r,ata:a,owner:i,mint:o}}(e,d,r));if(!t){l.push({type:"unknown",program:r,discriminator:e.data?.[0]});continue}if(l.push(t),t.ata&&t.owner&&t.mint){u[t.ata]={owner:t.owner,mint:t.mint};continue}}if(q.RAYDIUM_SWAP_PROGRAM_IDS.includes(r)){let a=await O(M(e,d,t,n,r));if(!a){l.push({type:"unknown",program:r,discriminator:e.data?.[0]});continue}l.push(a)}else if(q.JUPITER_SWAP_PROGRAM_IDS.includes(r)){let a=await O(F(e,d,t,n,r));if(!a){l.push({type:"unknown",program:r,discriminator:e.data?.[0]});continue}l.push(a)}else l.push({type:"unknown",program:r,discriminator:e.data?.[0]})}else{let t=await O(R(e,d));if(!t){l.push({type:"unknown",program:r,discriminator:e.data?.[0]});continue}l.push(t)}else{let a=await O($(e,d,t,n,u,r));if(!a){l.push({type:"unknown",program:r,discriminator:e.data?.[0]});continue}l.push(a),"spl-transfer"===a.type&&(a.fromAta&&a.fromAccount&&a.token.address&&(u[a.fromAta]??={owner:a.fromAccount,mint:a.token.address}),a.toAta&&a.toAccount&&a.token.address&&(u[a.toAta]??={owner:a.toAccount,mint:a.token.address}))}}return{spender:i,fee:o,instructions:l,hasFunds:!!c}}function L(e,t=0){try{return function(e,t=0){let n=0n;for(let r=0;r<8;r++)n|=BigInt(e[t+r])<<BigInt(8*r);return n}(e,t)}catch{}try{return e.readBigInt64LE(t)}catch{}let n=j.bufferFrom(e);try{return((e,t=0)=>{let n=e[t],r=e[t+7];if(!n||!r)throw Error(`Buffer offset out of range: first: ${n}, last: ${r}.`);return(BigInt(e[t+4]+256*e[t+5]+65536*e[t+6]+(r<<24))<<32n)+BigInt(n+256*e[++t]+65536*e[++t]+16777216*e[++t])})(n)}catch{}try{return n.subarray(t).readBigInt64LE()}catch{}try{return n.readBigInt64LE(t)}catch{}return 0n}async function $(e,t,n,r,a,i){let o=e.data?.[0],s=e.accountIndices?.map((e=>t[e]))??[];if(1===o){let[e,t,n]=s;return{type:"spl-init-account",program:i,account:e,mint:t,owner:n}}if(3===o){let t,o,[c,u,l]=s,d="",p=u?a[u]:void 0;if(p)t=p.owner,d=p.mint;else if(u){let e=await n.rpc.getAccountInfo(u,{commitment:"confirmed",encoding:"jsonParsed"}).send(),r=e.value?.data;t=r?.parsed?.info?.owner,d=r?.parsed?.info?.mint??"",o=r?.parsed?.info?.tokenAmount?.decimals}if(!d&&c){let e=await n.rpc.getAccountInfo(c,{commitment:"confirmed",encoding:"jsonParsed"}).send(),t=e.value?.data;d=t?.parsed?.info?.mint??""}let m=await P({privyClient:r,chain:n.chain,mint:d}),f=m?.symbol??"";return o??=m?.decimals??9,{type:"spl-transfer",program:i,fromAta:c,fromAccount:l,toAta:u,toAccount:t,value:L(e.data,1),token:{symbol:f,decimals:o,address:d}}}if(9===o){let[e,t,n]=s;return{type:"spl-close-account",program:i,source:e,destination:t,owner:n}}if(17===o)return{type:"spl-sync-native",program:i};throw Error(`Token program instruction type ${o} not supported`)}async function R(e,t){let n=e.data?.[0],r=e.accountIndices?.map((e=>t[e]))??[];if(0===n){let[,t]=r;return{type:"create-account",program:q.SYSTEM_PROGRAM_ID,account:t?.toString(),value:L(e.data,4),withSeed:!1}}if(2===n){let[t,n]=r;return{type:"sol-transfer",program:q.SYSTEM_PROGRAM_ID,fromAccount:t,toAccount:n,token:{symbol:"SOL",decimals:9},value:L(e.data,4),withSeed:!1}}if(3===n){let[,t]=r;return{type:"create-account",program:q.SYSTEM_PROGRAM_ID,account:t,withSeed:!0,value:L(e.data.slice(e.data.length-32-8-8))}}if(11===n){let[t,n]=r;return{type:"sol-transfer",program:q.SYSTEM_PROGRAM_ID,fromAccount:t,toAccount:n,value:L(e.data,4),token:{symbol:"SOL",decimals:9},withSeed:!0}}throw Error(`System program instruction type ${n} not supported`)}async function M(e,t,n,r,a){let i=e.accountIndices?.map((e=>t[e]))??[],o=e.data?.[0];if(143===o){let t=i[10],o=i[11];return{type:"raydium-swap-base-input",program:a,mintIn:t,mintOut:o,tokenIn:t?await P({privyClient:r,chain:n.chain,mint:t}):void 0,tokenOut:o?await P({privyClient:r,chain:n.chain,mint:o}):void 0,amountIn:L(e.data,8),minimumAmountOut:L(e.data,16)}}if(55===o){let t=i[10],o=i[11];return{type:"raydium-swap-base-output",program:a,mintIn:t,mintOut:o,tokenIn:t?await P({privyClient:r,chain:n.chain,mint:t}):void 0,tokenOut:o?await P({privyClient:r,chain:n.chain,mint:o}):void 0,maxAmountIn:L(e.data,8),amountOut:L(e.data,16)}}throw Error(`Raydium swap program instruction type ${o} not supported`)}async function F(e,t,n,r,a){let i=e.data?.[0],o=e.accountIndices?.map((e=>t[e]))??[];if([208,51,239,151,123,43,237,92].includes(i)){let t=o[5],i=o[6];return{type:"jupiter-swap-exact-out-route",program:a,mintIn:t,mintOut:i,tokenIn:t?await P({privyClient:r,chain:n.chain,mint:t}):void 0,tokenOut:i?await P({privyClient:r,chain:n.chain,mint:i}):void 0,outAmount:L(e.data,e.data.length-1-2-8-8),quotedInAmount:L(e.data,e.data.length-1-2-8)}}if([176,209,105,168,154,125,69,62].includes(i)){let t=o[7],i=o[8];return{type:"jupiter-swap-exact-out-route",program:a,mintIn:t,mintOut:i,tokenIn:t?await P({privyClient:r,chain:n.chain,mint:t}):void 0,tokenOut:i?await P({privyClient:r,chain:n.chain,mint:i}):void 0,outAmount:L(e.data,e.data.length-1-2-8-8),quotedInAmount:L(e.data,e.data.length-1-2-8)}}if([193,32,155,51,65,214,156,129].includes(i)){let t=o[7],i=o[8];return{type:"jupiter-swap-shared-accounts-route",program:a,mintIn:t,mintOut:i,tokenIn:t?await P({privyClient:r,chain:n.chain,mint:t}):void 0,tokenOut:i?await P({privyClient:r,chain:n.chain,mint:i}):void 0,inAmount:L(e.data,e.data.length-1-2-8-8),quotedOutAmount:L(e.data,e.data.length-1-2-8)}}throw[62,198,214,193,213,159,108,210].includes(i)&&console.warn("Jupiter swap program instruction 'claim' not implemented"),[116,206,27,191,166,19,0,73].includes(i)&&console.warn("Jupiter swap program instruction 'claim_token' not implemented"),[26,74,236,151,104,64,183,249].includes(i)&&console.warn("Jupiter swap program instruction 'close_token' not implemented"),[229,194,212,172,8,10,134,147].includes(i)&&console.warn("Jupiter swap program instruction 'create_open_orders' not implemented"),[28,226,32,148,188,136,113,171].includes(i)&&console.warn("Jupiter swap program instruction 'create_program_open_orders' not implemented"),[232,242,197,253,240,143,129,52].includes(i)&&console.warn("Jupiter swap program instruction 'create_token_ledger' not implemented"),[147,241,123,100,244,132,174,118].includes(i)&&console.warn("Jupiter swap program instruction 'create_token_account' not implemented"),[229,23,203,151,122,227,173,42].includes(i)&&console.warn("Jupiter swap program instruction 'route' not implemented"),[150,86,71,116,167,93,14,104].includes(i)&&console.warn("Jupiter swap program instruction 'route_with_token_ledger' not implemented"),[228,85,185,112,78,79,77,2].includes(i)&&console.warn("Jupiter swap program instruction 'set_token_ledger' not implemented"),[230,121,143,80,119,159,106,170].includes(i)&&console.warn("Jupiter swap program instruction 'shared_accounts_route_with_token_ledger' not implemented"),Error(`Jupiter swap program instruction type ${i} not supported`)}const D={component:()=>{let{data:u,onUserCloseViaDialogOrKeybindRef:l,setModalData:d,navigate:p}=o.usePrivyModal(),{client:m,closePrivyModal:f,walletProxy:g,showFiatPrices:h}=i.usePrivyInternal(),y=a.useAppConfig(),{user:w}=r.usePrivyContext(),v=j.useSolanaRpcClient()(u?.standardSignAndSendTransaction?.chain??"solana:mainnet"),[b,I]=t.useState(u?.standardSignAndSendTransaction?.transaction),[x,C]=t.useState(),[O,_]=t.useState(),[P,L]=t.useState({value:0n,isLoading:!1}),[$,R]=t.useState(!1),[M,F]=t.useState({}),[D,B]=t.useState(),W=u?.standardSignAndSendTransaction?.account,U=!!u?.standardSignAndSendTransaction?.signOnly,G=!!u?.standardSignAndSendTransaction?.isSponsored,J=W?.imported?r.getImportedPrivySolanaWallets(w).find((e=>e.address===W.address)):r.getPrivyPrimaryWallet(w),{solPrice:V,isSolPriceLoading:N}=s.useGetSolPrice({enabled:h}),Y=t.useMemo((()=>{if(!x)return;let e=x.spender,t=k.getNativeCurrencyFromLamports(x.fee),r=k.getNativeCurrencyFromLamports(P.value,3,!0),a=x.instructions.filter((e=>["sol-transfer","spl-transfer","raydium-swap-base-input","raydium-swap-base-output","jupiter-swap-shared-accounts-route","jupiter-swap-exact-out-route"].includes(e.type))),i=a.at(0);if(!i||a.length>1)return{fee:t,spender:e,balance:r};if("sol-transfer"===i.type)return{fee:t,spender:e,balance:r,total:k.getNativeCurrencyFromLamports(i.value)};if("spl-transfer"===i.type)return{fee:t,spender:e,balance:r,total:`${n.formatTokenAmount({amount:i.value,decimals:i.token.decimals})} ${i.token.symbol}`};if("raydium-swap-base-input"===i.type&&i.tokenIn&&i.tokenOut){return{fee:t,spender:e,balance:r,swap:`${`${n.formatTokenAmount({amount:i.amountIn,decimals:i.tokenIn.decimals})} ${i.tokenIn.symbol}`} → ${`${n.formatTokenAmount({amount:i.minimumAmountOut,decimals:i.tokenOut.decimals})} ${i.tokenOut.symbol}`}`}}if("raydium-swap-base-output"===i.type&&i.tokenIn&&i.tokenOut){return{fee:t,spender:e,balance:r,swap:`${`${n.formatTokenAmount({amount:i.maxAmountIn,decimals:i.tokenIn.decimals})} ${i.tokenIn.symbol}`} → ${`${n.formatTokenAmount({amount:i.amountOut,decimals:i.tokenOut.decimals})} ${i.tokenOut.symbol}`}`}}if("jupiter-swap-shared-accounts-route"===i.type&&i.tokenIn&&i.tokenOut){return{fee:t,spender:e,balance:r,swap:`${`${n.formatTokenAmount({amount:i.inAmount,decimals:i.tokenIn.decimals})} ${i.tokenIn.symbol}`} → ${`${n.formatTokenAmount({amount:i.quotedOutAmount,decimals:i.tokenOut.decimals})} ${i.tokenOut.symbol}`}`}}if("jupiter-swap-exact-out-route"===i.type&&i.tokenIn&&i.tokenOut){return{fee:t,spender:e,balance:r,swap:`${`${n.formatTokenAmount({amount:i.quotedInAmount,decimals:i.tokenIn.decimals})} ${i.tokenIn.symbol}`} → ${`${n.formatTokenAmount({amount:i.outAmount,decimals:i.tokenOut.decimals})} ${i.tokenOut.symbol}`}`}}return{fee:t,spender:e,balance:r}}),[x,W?.address,P]),H=t.useMemo((()=>{let e;if(!x||!h||!V||N)return;function t(...e){return q.getFormattedUsdFromLamports(e.reduce(((e,t)=>e+t),0n),V??0)}W?.address===x.spender&&(e=t(x.fee));let r=t(P.value),a=x.instructions.filter((e=>"sol-transfer"===e.type||"spl-transfer"===e.type)).at(0);return!a||x.instructions.length>1?{fee:e,balance:r}:"sol-transfer"===a.type?{fee:e,balance:r,total:t(a.value,W?.address===x.spender?x.fee:0n)}:"spl-transfer"===a.type?{fee:e,balance:r,total:`${n.formatTokenAmount({amount:a.value,decimals:a.token.decimals})} ${a.token.symbol}`}:{fee:e,balance:r}}),[x,h,V,N,W?.address,P]);if(t.useEffect((()=>{!async function(){if(b&&m)try{_(void 0);let e=await E({tx:b,solanaClient:v,privyClient:m,checkFunds:!U&&!G});C(e)}catch(e){console.error("Failed to prepare transaction",e),_(e)}}()}),[b,v,m,U]),t.useEffect((()=>{(async function(){if(!W)return;L({value:P.value,isLoading:!0});let{value:e}=await v.rpc.getBalance(W.address,{commitment:"confirmed"}).send();L({value:e??0n,isLoading:!1})})().catch(console.error)}),[x]),!b||!u?.standardSignAndSendTransaction||!W){let t=Error("Invalid transaction request");/*#__PURE__*/return e.jsx(c.ErrorScreenView,{error:t,allowlistConfig:y.allowlistConfig,onRetry:()=>{u?.standardSignAndSendTransaction?.onFailure(t),f({shouldCallAuthOnSuccess:!1})}})}let K=()=>{if(!$)return M.signature||M.signedTransaction?u?.standardSignAndSendTransaction?.onSuccess({signature:M.signature,signedTransaction:M.signedTransaction}):u?.standardSignAndSendTransaction?.onFailure(D??O??Error("User exited the modal before submitting the transaction")),f({shouldCallAuthOnSuccess:!1})};l.current=K;let z=u.standardSignAndSendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?/*#__PURE__*/e.jsx("img",{src:u.standardSignAndSendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:u.standardSignAndSendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,X=!!(u.funding&&u.funding.supportedOptions.length>0),Q=!x?.hasFunds&&X&&!G;if(M.signature||M.signedTransaction){let t=x?.instructions.filter((e=>"sol-transfer"===e.type||"spl-transfer"===e.type)),n=1===t?.length?t?.at(0):void 0;/*#__PURE__*/return e.jsx(T,{fees:M.fees??0n,onClose:K,transactionInfo:u.standardSignAndSendTransaction?.uiOptions.transactionInfo,solPrice:V,receiptHeader:u.standardSignAndSendTransaction?.uiOptions.successHeader,receiptDescription:u.standardSignAndSendTransaction?.uiOptions.successDescription,chain:v.chain,signOnly:U,instruction:"sol-transfer"===n?.type?{to:n.toAccount,amount:n.value}:{to:n?.toAccount||n?.toAta,total:Y?.total}})}return D?/*#__PURE__*/e.jsx(S.TransactionErrorView,{transactionError:D,chainId:v.chain,onClose:K,chainType:"solana",onRetry:async()=>{B(void 0);let{value:e}=await v.rpc.getLatestBlockhash().send();var t,n;I((t=b,n=e,A.pipe(A.getCompiledTransactionMessageDecoder().decode(j.getTransactionMessageBytes(t)),(e=>A.decompileTransactionMessage(e)),(e=>A.setTransactionMessageLifetimeUsingBlockhash(n,e)),(e=>A.compileTransaction(e)),(e=>new Uint8Array(A.getTransactionEncoder().encode(e))))))}}):/*#__PURE__*/e.jsx(S.SendSolanaTransactionScreenView,{img:z,title:u.standardSignAndSendTransaction?.uiOptions?.transactionInfo?.title||"Confirm transaction",subtitle:u.standardSignAndSendTransaction?.uiOptions?.description||`${y.name} wants your permission to approve the following transaction.`,cta:Q?"Add funds":u.standardSignAndSendTransaction?.uiOptions?.buttonText||"Approve",instructions:x?.instructions??[],network:"solana:mainnet"==v.chain?"Solana":v.chain.replace("solana:",""),blockExplorerUrl:v.blockExplorerUrl,total:h?H?.total:Y?.total,fee:h?H?.fee:Y?.fee,balance:h?H?.balance:Y?.balance,swap:Y?.swap,transactingWalletAddress:W.address,disabled:!x?.hasFunds&&!X,isSubmitting:$,isPreparing:!x||P.isLoading,isTokenPriceLoading:h&&N,isMissingFunds:!x?.hasFunds,submitError:D??void 0,isSponsored:!!u.standardSignAndSendTransaction?.isSponsored,parseError:O,onClick:Q?async()=>{if(!W)return;if(!X)throw Error("Funding wallet is not enabled");let e="FundingMethodSelectionScreen";d({...u,funding:{...u.funding,methodScreen:e},solanaFundingData:u?.solanaFundingData}),p(e)}:async()=>{try{if(R(!0),$||!W||!g||!w||!J)return;let e=await u.standardSignAndSendTransaction.onConfirm(b);if("signature"in e){let t=await async function({solanaClient:e,signature:t}){let n=A.getBase58Decoder().decode(t),r=await e.rpc.getTransaction(n,{maxSupportedTransactionVersion:0,commitment:"confirmed",encoding:"base64"}).send().catch((()=>null));return r?{fee:r.meta?.fee??0n}:null}({solanaClient:v,signature:e.signature});return void F({...e,fees:t?.fee})}F(e)}catch(e){console.warn({transaction:b,error:e}),B(e)}finally{R(!1)}},onClose:K})}};exports.StandardSignAndSendTransactionScreen=D,exports.default=D;
//# sourceMappingURL=StandardSignAndSendTransactionScreen-uwpkeAYv.js.map
