import{o as e}from"./rolldown-runtime.js";import{n as t,t as n}from"./jsx-runtime.js";import{Mt as r,Nt as i,Qt as a,T as o,Vt as s,j as c,jt as l,m as u}from"./useActiveWallet-CEs8euQ3.js";import{k as d}from"./context-Cdw68BC2.js";import"./index-CKYEOQWW.js";import{t as f}from"./modal-context-DHfp-mFQ.js";import{F as p,M as m,P as h,_ as ee,d as te,k as g,m as ne,q as _,v,w as re,y as ie}from"./src.js";import{n as ae}from"./ErrorScreen-DeF4PptC.js";import{l as y,r as b,u as x}from"./ModalHeader-BS54PZSj.js";import{n as oe,r as se}from"./TransactionErrorView--dDzh6J1.js";import{t as S}from"./CheckCircleIcon.js";import{u as C}from"./Layouts-BlFm53ED.js";import{n as w}from"./ScreenHeader-CHmc4-Lu.js";import{t as ce}from"./useGetSolPrice-x7gfUIHJ.js";import{l as T,n as E,r as D,s as O,t as le}from"./getFormattedUsdFromLamports-B6EqSEho.js";import{n as k}from"./transaction-CnfuREWo.js";import{a as A,i as j,n as M,t as N}from"./Value-tcJV9e0L.js";import{a as P,i as F,n as I,o as L,r as ue}from"./useSolanaRpcClient-S4t4m7Vi.js";import{t as R}from"./StackedContainer-B2vaEl56.js";import{n as z,t as B}from"./WalletLink-xEZ2A5NU.js";var V=e(t(),1),H=n();function U(e){return!(`exists`in e)||`exists`in e&&e.exists}function W(e){let t=e.filter(e=>U(e)&&e.data instanceof Uint8Array);if(t.length>0){let e=t.map(e=>e.address);throw new _(h,{addresses:e})}}function G(e,t){if(!t)return Object.freeze({address:e,exists:!1});let n=m().encode(t.data[0]);return Object.freeze({...q(t),address:e,data:n,exists:!0})}function K(e,t){if(!t)return Object.freeze({address:e,exists:!1});let n=t.data.parsed.info||{};return(t.data.program||t.data.parsed.type)&&(n.parsedAccountMeta={program:t.data.program,type:t.data.parsed.type}),Object.freeze({...q(t),address:e,data:n,exists:!0})}function q(e){return Object.freeze({executable:e.executable,lamports:e.lamports,programAddress:e.owner,space:e.space})}async function J(e,t,n={}){let{abortSignal:r,...i}=n;return(await e.getMultipleAccounts(t,{...i,encoding:`jsonParsed`}).send({abortSignal:r})).value.map((e,n)=>e&&typeof e==`object`&&`parsed`in e.data?K(t[n],e):G(t[n],e))}function Y(e){let t=e.filter(e=>!e.exists);if(t.length>0){let e=t.map(e=>e.address);throw new _(p,{addresses:e})}}async function de(e,t,n){if(e.length===0)return{};let r=await J(t,e,n);return W(r),Y(r),r.reduce((e,t)=>({...e,[t.address]:t.data.addresses}),{})}c();var fe=o.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;
  }
`,pe=({instruction:e,fees:t,transactionInfo:n,solPrice:r,chain:i})=>(0,H.jsxs)(A,{children:[n?.action&&(0,H.jsxs)(j,{children:[(0,H.jsx)(N,{children:`Action`}),(0,H.jsx)(M,{children:n.action})]}),e?.total!=null&&(0,H.jsxs)(j,{children:[(0,H.jsx)(N,{children:`Total`}),(0,H.jsx)(M,{children:e.total})]}),!e?.total&&e?.amount!=null&&(0,H.jsxs)(j,{children:[(0,H.jsx)(N,{children:`Total`}),(0,H.jsx)(M,{children:(0,H.jsx)(z,{quantities:[e.amount,t],tokenPrice:r})})]}),(0,H.jsxs)(j,{children:[(0,H.jsx)(N,{children:`Fees`}),(0,H.jsx)(M,{children:(0,H.jsx)(z,{quantities:[t],tokenPrice:r})})]}),e?.to&&(0,H.jsxs)(j,{children:[(0,H.jsx)(N,{children:`To`}),(0,H.jsx)(M,{children:(0,H.jsx)(B,{walletAddress:e.to,chainId:i,chainType:`solana`})})]})]}),me=({fees:e,onClose:t,receiptHeader:n,receiptDescription:r,transactionInfo:i,solPrice:a,signOnly:o,instruction:s,chain:c})=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(b,{onClose:t}),(0,H.jsx)(R,{style:{marginBottom:`16px`},children:(0,H.jsxs)(`div`,{children:[(0,H.jsx)(fe,{color:`var(--privy-color-success-light)`}),(0,H.jsx)(S,{height:38,width:38,strokeWidth:2,stroke:`var(--privy-color-success)`})]})}),(0,H.jsx)(w,{title:n??`Transaction ${o?`signed`:`complete`}!`,description:r??`You're all set.`}),(0,H.jsx)(pe,{solPrice:a,instruction:s,fees:e,transactionInfo:i,chain:c}),(0,H.jsx)(u,{}),(0,H.jsx)(he,{loading:!1,onClick:t,children:`Close`}),(0,H.jsx)(C,{}),(0,H.jsx)(x,{})]}),he=o(y)`
  && {
    margin-top: 24px;
  }
  transition:
    color 350ms ease,
    background-color 350ms ease;
`;async function X(e,t){try{return await e}catch{return t}}function ge(e){switch(e){case`solana:mainnet`:return`mainnet-beta`;case`solana:devnet`:return`devnet`;case`solana:testnet`:return`testnet`}}async function Z({privyClient:e,chain:t,mint:n}){let r=T[t];if(!r[n]){let i=await e.getSplTokenMetadata({mintAddress:n,cluster:ge(t)});i&&(r[n]={address:n,symbol:i.symbol,decimals:i.decimals})}return r[n]}async function _e({tx:e,solanaClient:t,privyClient:n,checkFunds:r}){let i=v().decode(L(e)),a=i.staticAccounts[0]??``,o=await I({solanaClient:t,tx:e}),s=(r?await X(P({solanaClient:t,tx:e})):void 0)?.hasFunds??!0,c={},l=[],u=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 de(n,e.rpc),i=n.map(((e,n)=>[...t.addressTableLookups[n]?.writableIndexes.map((t=>{let i=r[e]?.[t];if(i)return{key:i,isWritable:!0,altIdx:n}}))??[],...t.addressTableLookups[n]?.readonlyIndexes.map((t=>{let i=r[e]?.[t];if(i)return{key:i,isWritable:!1,altIdx:n}}))??[]])).flat().filter((e=>!!e)).sort(((e,t)=>e.isWritable===t.isWritable?e.altIdx-t.altIdx:e.isWritable?-1:1)).map((({key:e})=>e));return[...t.staticAccounts,...i]}({solanaClient:t,message:i});for(let e of i.instructions){let r=i.staticAccounts[e.programAddressIndex]||``;if(r!==`TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`&&r!==`TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb`){if(r!==`11111111111111111111111111111111`){if(r===`ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`){let t=await X(function(e,t,n){let[r,i,a,o]=e.accountIndices?.map((e=>t[e]))??[];return{type:`ata-creation`,program:n,payer:r,ata:i,owner:a,mint:o}}(e,u,r));if(!t){l.push({type:`unknown`,program:r,discriminator:e.data?.[0]});continue}if(l.push(t),t.ata&&t.owner&&t.mint){c[t.ata]={owner:t.owner,mint:t.mint};continue}}if(D.includes(r)){let i=await X(be(e,u,t,n,r));if(!i){l.push({type:`unknown`,program:r,discriminator:e.data?.[0]});continue}l.push(i)}else if(O.includes(r)){let i=await X(xe(e,u,t,n,r));if(!i){l.push({type:`unknown`,program:r,discriminator:e.data?.[0]});continue}l.push(i)}else l.push({type:`unknown`,program:r,discriminator:e.data?.[0]})}else{let t=await X(ye(e,u));if(!t){l.push({type:`unknown`,program:r,discriminator:e.data?.[0]});continue}l.push(t)}}else{let i=await X(ve(e,u,t,n,c,r));if(!i){l.push({type:`unknown`,program:r,discriminator:e.data?.[0]});continue}l.push(i),i.type===`spl-transfer`&&(i.fromAta&&i.fromAccount&&i.token.address&&(c[i.fromAta]??={owner:i.fromAccount,mint:i.token.address}),i.toAta&&i.toAccount&&i.token.address&&(c[i.toAta]??={owner:i.toAccount,mint:i.token.address}))}}return{spender:a,fee:o,instructions:l,hasFunds:!!s}}function Q(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=F(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 ve(e,t,n,r,i,a){let o=e.data?.[0],s=e.accountIndices?.map((e=>t[e]))??[];if(o===1){let[e,t,n]=s;return{type:`spl-init-account`,program:a,account:e,mint:t,owner:n}}if(o===3){let t,o,[c,l,u]=s,d=``,f=l?i[l]:void 0;if(f)t=f.owner,d=f.mint;else if(l){let e=(await n.rpc.getAccountInfo(l,{commitment:`confirmed`,encoding:`jsonParsed`}).send()).value?.data;t=e?.parsed?.info?.owner,d=e?.parsed?.info?.mint??``,o=e?.parsed?.info?.tokenAmount?.decimals}!d&&c&&(d=((await n.rpc.getAccountInfo(c,{commitment:`confirmed`,encoding:`jsonParsed`}).send()).value?.data)?.parsed?.info?.mint??``);let p=await Z({privyClient:r,chain:n.chain,mint:d}),m=p?.symbol??``;return o??=p?.decimals??9,{type:`spl-transfer`,program:a,fromAta:c,fromAccount:u,toAta:l,toAccount:t,value:Q(e.data,1),token:{symbol:m,decimals:o,address:d}}}if(o===9){let[e,t,n]=s;return{type:`spl-close-account`,program:a,source:e,destination:t,owner:n}}if(o===17)return{type:`spl-sync-native`,program:a};throw Error(`Token program instruction type ${o} not supported`)}async function ye(e,t){let n=e.data?.[0],r=e.accountIndices?.map((e=>t[e]))??[];if(n===0){let[,t]=r;return{type:`create-account`,program:E,account:t?.toString(),value:Q(e.data,4),withSeed:!1}}if(n===2){let[t,n]=r;return{type:`sol-transfer`,program:E,fromAccount:t,toAccount:n,token:{symbol:`SOL`,decimals:9},value:Q(e.data,4),withSeed:!1}}if(n===3){let[,t]=r;return{type:`create-account`,program:E,account:t,withSeed:!0,value:Q(e.data.slice(e.data.length-32-8-8))}}if(n===11){let[t,n]=r;return{type:`sol-transfer`,program:E,fromAccount:t,toAccount:n,value:Q(e.data,4),token:{symbol:`SOL`,decimals:9},withSeed:!0}}throw Error(`System program instruction type ${n} not supported`)}async function be(e,t,n,r,i){let a=e.accountIndices?.map((e=>t[e]))??[],o=e.data?.[0];if(o===143){let t=a[10],o=a[11];return{type:`raydium-swap-base-input`,program:i,mintIn:t,mintOut:o,tokenIn:t?await Z({privyClient:r,chain:n.chain,mint:t}):void 0,tokenOut:o?await Z({privyClient:r,chain:n.chain,mint:o}):void 0,amountIn:Q(e.data,8),minimumAmountOut:Q(e.data,16)}}if(o===55){let t=a[10],o=a[11];return{type:`raydium-swap-base-output`,program:i,mintIn:t,mintOut:o,tokenIn:t?await Z({privyClient:r,chain:n.chain,mint:t}):void 0,tokenOut:o?await Z({privyClient:r,chain:n.chain,mint:o}):void 0,maxAmountIn:Q(e.data,8),amountOut:Q(e.data,16)}}throw Error(`Raydium swap program instruction type ${o} not supported`)}async function xe(e,t,n,r,i){let a=e.data?.[0],o=e.accountIndices?.map((e=>t[e]))??[];if([208,51,239,151,123,43,237,92].includes(a)){let t=o[5],a=o[6];return{type:`jupiter-swap-exact-out-route`,program:i,mintIn:t,mintOut:a,tokenIn:t?await Z({privyClient:r,chain:n.chain,mint:t}):void 0,tokenOut:a?await Z({privyClient:r,chain:n.chain,mint:a}):void 0,outAmount:Q(e.data,e.data.length-1-2-8-8),quotedInAmount:Q(e.data,e.data.length-1-2-8)}}if([176,209,105,168,154,125,69,62].includes(a)){let t=o[7],a=o[8];return{type:`jupiter-swap-exact-out-route`,program:i,mintIn:t,mintOut:a,tokenIn:t?await Z({privyClient:r,chain:n.chain,mint:t}):void 0,tokenOut:a?await Z({privyClient:r,chain:n.chain,mint:a}):void 0,outAmount:Q(e.data,e.data.length-1-2-8-8),quotedInAmount:Q(e.data,e.data.length-1-2-8)}}if([193,32,155,51,65,214,156,129].includes(a)){let t=o[7],a=o[8];return{type:`jupiter-swap-shared-accounts-route`,program:i,mintIn:t,mintOut:a,tokenIn:t?await Z({privyClient:r,chain:n.chain,mint:t}):void 0,tokenOut:a?await Z({privyClient:r,chain:n.chain,mint:a}):void 0,inAmount:Q(e.data,e.data.length-1-2-8-8),quotedOutAmount:Q(e.data,e.data.length-1-2-8)}}throw[62,198,214,193,213,159,108,210].includes(a)&&console.warn(`Jupiter swap program instruction 'claim' not implemented`),[116,206,27,191,166,19,0,73].includes(a)&&console.warn(`Jupiter swap program instruction 'claim_token' not implemented`),[26,74,236,151,104,64,183,249].includes(a)&&console.warn(`Jupiter swap program instruction 'close_token' not implemented`),[229,194,212,172,8,10,134,147].includes(a)&&console.warn(`Jupiter swap program instruction 'create_open_orders' not implemented`),[28,226,32,148,188,136,113,171].includes(a)&&console.warn(`Jupiter swap program instruction 'create_program_open_orders' not implemented`),[232,242,197,253,240,143,129,52].includes(a)&&console.warn(`Jupiter swap program instruction 'create_token_ledger' not implemented`),[147,241,123,100,244,132,174,118].includes(a)&&console.warn(`Jupiter swap program instruction 'create_token_account' not implemented`),[229,23,203,151,122,227,173,42].includes(a)&&console.warn(`Jupiter swap program instruction 'route' not implemented`),[150,86,71,116,167,93,14,104].includes(a)&&console.warn(`Jupiter swap program instruction 'route_with_token_ledger' not implemented`),[228,85,185,112,78,79,77,2].includes(a)&&console.warn(`Jupiter swap program instruction 'set_token_ledger' not implemented`),[230,121,143,80,119,159,106,170].includes(a)&&console.warn(`Jupiter swap program instruction 'shared_accounts_route_with_token_ledger' not implemented`),Error(`Jupiter swap program instruction type ${a} not supported`)}var $={component:()=>{let{data:e,onUserCloseViaDialogOrKeybindRef:t,setModalData:n,navigate:o}=f(),{client:c,closePrivyModal:u,walletProxy:p,showFiatPrices:m}=s(),h=d(),{user:_}=r(),y=ue()(e?.standardSignAndSendTransaction?.chain??`solana:mainnet`),[b,x]=(0,V.useState)(e?.standardSignAndSendTransaction?.transaction),[S,C]=(0,V.useState)(),[w,T]=(0,V.useState)(),[E,D]=(0,V.useState)({value:0n,isLoading:!1}),[O,A]=(0,V.useState)(!1),[j,M]=(0,V.useState)({}),[N,P]=(0,V.useState)(),F=e?.standardSignAndSendTransaction?.account,I=!!e?.standardSignAndSendTransaction?.signOnly,R=!!e?.standardSignAndSendTransaction?.isSponsored,z=F?.imported?i(_).find((e=>e.address===F.address)):l(_),{solPrice:B,isSolPriceLoading:U}=ce({enabled:m}),W=(0,V.useMemo)((()=>{if(!S)return;let e=S.spender,t=k(S.fee),n=k(E.value,3,!0),r=S.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=r.at(0);return!i||r.length>1?{fee:t,spender:e,balance:n}:i.type===`sol-transfer`?{fee:t,spender:e,balance:n,total:k(i.value)}:i.type===`spl-transfer`?{fee:t,spender:e,balance:n,total:`${a({amount:i.value,decimals:i.token.decimals})} ${i.token.symbol}`}:i.type===`raydium-swap-base-input`&&i.tokenIn&&i.tokenOut?{fee:t,spender:e,balance:n,swap:`${`${a({amount:i.amountIn,decimals:i.tokenIn.decimals})} ${i.tokenIn.symbol}`} → ${`${a({amount:i.minimumAmountOut,decimals:i.tokenOut.decimals})} ${i.tokenOut.symbol}`}`}:i.type===`raydium-swap-base-output`&&i.tokenIn&&i.tokenOut?{fee:t,spender:e,balance:n,swap:`${`${a({amount:i.maxAmountIn,decimals:i.tokenIn.decimals})} ${i.tokenIn.symbol}`} → ${`${a({amount:i.amountOut,decimals:i.tokenOut.decimals})} ${i.tokenOut.symbol}`}`}:i.type===`jupiter-swap-shared-accounts-route`&&i.tokenIn&&i.tokenOut?{fee:t,spender:e,balance:n,swap:`${`${a({amount:i.inAmount,decimals:i.tokenIn.decimals})} ${i.tokenIn.symbol}`} → ${`${a({amount:i.quotedOutAmount,decimals:i.tokenOut.decimals})} ${i.tokenOut.symbol}`}`}:i.type===`jupiter-swap-exact-out-route`&&i.tokenIn&&i.tokenOut?{fee:t,spender:e,balance:n,swap:`${`${a({amount:i.quotedInAmount,decimals:i.tokenIn.decimals})} ${i.tokenIn.symbol}`} → ${`${a({amount:i.outAmount,decimals:i.tokenOut.decimals})} ${i.tokenOut.symbol}`}`}:{fee:t,spender:e,balance:n}}),[S,F?.address,E]),G=(0,V.useMemo)((()=>{let e;if(!S||!m||!B||U)return;function t(...e){return le(e.reduce(((e,t)=>e+t),0n),B??0)}F?.address===S.spender&&(e=t(S.fee));let n=t(E.value),r=S.instructions.filter((e=>e.type===`sol-transfer`||e.type===`spl-transfer`)).at(0);return!r||S.instructions.length>1?{fee:e,balance:n}:r.type===`sol-transfer`?{fee:e,balance:n,total:t(r.value,F?.address===S.spender?S.fee:0n)}:r.type===`spl-transfer`?{fee:e,balance:n,total:`${a({amount:r.value,decimals:r.token.decimals})} ${r.token.symbol}`}:{fee:e,balance:n}}),[S,m,B,U,F?.address,E]);if((0,V.useEffect)((()=>{(async function(){if(b&&c)try{T(void 0);let e=await _e({tx:b,solanaClient:y,privyClient:c,checkFunds:!I&&!R});C(e)}catch(e){console.error(`Failed to prepare transaction`,e),T(e)}})()}),[b,y,c,I]),(0,V.useEffect)((()=>{(async function(){if(!F)return;D({value:E.value,isLoading:!0});let{value:e}=await y.rpc.getBalance(F.address,{commitment:`confirmed`}).send();D({value:e??0n,isLoading:!1})})().catch(console.error)}),[S]),!b||!e?.standardSignAndSendTransaction||!F){let t=Error(`Invalid transaction request`);return(0,H.jsx)(ae,{error:t,allowlistConfig:h.allowlistConfig,onRetry:()=>{e?.standardSignAndSendTransaction?.onFailure(t),u({shouldCallAuthOnSuccess:!1})}})}let K=()=>{if(!O)return j.signature||j.signedTransaction?e?.standardSignAndSendTransaction?.onSuccess({signature:j.signature,signedTransaction:j.signedTransaction}):e?.standardSignAndSendTransaction?.onFailure(N??w??Error(`User exited the modal before submitting the transaction`)),u({shouldCallAuthOnSuccess:!1})};t.current=K;let q=e.standardSignAndSendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl?(0,H.jsx)(`img`,{src:e.standardSignAndSendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl,alt:e.standardSignAndSendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText}):null,J=!!(e.funding&&e.funding.supportedOptions.length>0),Y=!S?.hasFunds&&J&&!R;if(j.signature||j.signedTransaction){let t=S?.instructions.filter((e=>e.type===`sol-transfer`||e.type===`spl-transfer`)),n=t?.length===1?t?.at(0):void 0;return(0,H.jsx)(me,{fees:j.fees??0n,onClose:K,transactionInfo:e.standardSignAndSendTransaction?.uiOptions.transactionInfo,solPrice:B,receiptHeader:e.standardSignAndSendTransaction?.uiOptions.successHeader,receiptDescription:e.standardSignAndSendTransaction?.uiOptions.successDescription,chain:y.chain,signOnly:I,instruction:n?.type===`sol-transfer`?{to:n.toAccount,amount:n.value}:{to:n?.toAccount||n?.toAta,total:W?.total}})}return N?(0,H.jsx)(se,{transactionError:N,chainId:y.chain,onClose:K,chainType:`solana`,onRetry:async()=>{P(void 0);let{value:e}=await y.rpc.getLatestBlockhash().send();var t,n;x((t=b,n=e,re(v().decode(L(t)),(e=>ee(e)),(e=>ie(n,e)),(e=>te(e)),(e=>new Uint8Array(ne().encode(e))))))}}):(0,H.jsx)(oe,{img:q,title:e.standardSignAndSendTransaction?.uiOptions?.transactionInfo?.title||`Confirm transaction`,subtitle:e.standardSignAndSendTransaction?.uiOptions?.description||`${h.name} wants your permission to approve the following transaction.`,cta:Y?`Add funds`:e.standardSignAndSendTransaction?.uiOptions?.buttonText||`Approve`,instructions:S?.instructions??[],network:y.chain==`solana:mainnet`?`Solana`:y.chain.replace(`solana:`,``),blockExplorerUrl:y.blockExplorerUrl,total:m?G?.total:W?.total,fee:m?G?.fee:W?.fee,balance:m?G?.balance:W?.balance,swap:W?.swap,transactingWalletAddress:F.address,disabled:!S?.hasFunds&&!J,isSubmitting:O,isPreparing:!S||E.isLoading,isTokenPriceLoading:m&&U,isMissingFunds:!S?.hasFunds,submitError:N??void 0,isSponsored:!!e.standardSignAndSendTransaction?.isSponsored,parseError:w,onClick:Y?async()=>{if(!F)return;if(!J)throw Error(`Funding wallet is not enabled`);let t=`FundingMethodSelectionScreen`;n({...e,funding:{...e.funding,methodScreen:t},solanaFundingData:e?.solanaFundingData}),o(t)}:async()=>{try{if(A(!0),O||!F||!p||!_||!z)return;let t=await e.standardSignAndSendTransaction.onConfirm(b);if(`signature`in t){let e=await async function({solanaClient:e,signature:t}){let n=g().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:y,signature:t.signature});M({...t,fees:e?.fee});return}M(t)}catch(e){console.warn({transaction:b,error:e}),P(e)}finally{A(!1)}},onClose:K})}};export{$ as StandardSignAndSendTransactionScreen,$ as default};