PageSourceSearch

https://veefriends.com/dist/StandardSignAndSendTransactionScreen-CiJd6Wf9-AAKE7LQV.p1a5swjbk2.js

js veefriends.com collected 2026-09-25 14:38:07 UTC 27,389 bytes, 451 lines download raw bytes

1import {
2  Y,
3  re
4} from "./chunk-464A4GN2.js";
5import {
6  f as f2,
7  k as k2
8} from "./chunk-K6WCEJNL.js";
9import "./chunk-VE3YG5XE.js";
10import {
11  e as e3
12} from "./chunk-F7KM5COV.js";
13import "./chunk-M6P65RCD.js";
14import {
15  y as y2
16} from "./chunk-U5PGLUIW.js";
17import {
18  c,
19  compileTransaction,
20  d as d2,
21  decompileTransactionMessage,
22  f,
23  fetchAddressesForLookupTables,
24  getBase58Decoder,
25  getCompiledTransactionMessageDecoder,
26  getTransactionEncoder,
27  l as l2,
28  pipe,
29  setTransactionMessageLifetimeUsingBlockhash,
30  u
31} from "./chunk-DDNO636S.js";
32import "./chunk-36T4QO4H.js";
33import "./chunk-YCYYQRQ6.js";
34import {
35  t as t3
36} from "./chunk-GCZOGTNX.js";
37import {
38  C,
39  a,
40  d,
41  e,
42  n as n2,
43  o,
44  r as r2,
45  t as t2
46} from "./chunk-TVWKLD4W.js";
47import {
48  t
49} from "./chunk-O42XOCBO.js";
50import "./chunk-Q3TLTUKM.js";
51import {
52  i as i2,
53  r as r3
54} from "./chunk-5HV4W27U.js";
55import {
56  r
57} from "./chunk-6ZQBQTQY.js";
58import "./chunk-DPARQJ72.js";
59import {
60  l
61} from "./chunk-GCD6STSW.js";
62import "./chunk-PO34BIG7.js";
63import "./chunk-NZGFA6TT.js";
64import "./chunk-SBGJZLCM.js";
65import "./chunk-ICAYUDB7.js";
66import "./chunk-Z2KGBNVP.js";
67import "./chunk-RNTKRQUB.js";
68import "./chunk-K3UCOUNS.js";
69import "./chunk-GGRPVGI5.js";
70import "./chunk-VJNDPFV5.js";
71import "./chunk-5VPDVLSL.js";
72import "./chunk-FWVWF5JX.js";
73import "./chunk-SYXPJXUB.js";
74import "./chunk-NOKVYAKB.js";
75import "./chunk-CNQEDY7K.js";
76import "./chunk-N2EQU7DY.js";
77import "./chunk-7XAQQ7SI.js";
78import "./chunk-JCTPOFOD.js";
79import "./chunk-NAPCM6ZT.js";
80import "./chunk-VQYZO3XL.js";
81import "./chunk-2AZ2MWPL.js";
82import "./chunk-VM7DVY42.js";
83import "./chunk-737HLBXN.js";
84import "./chunk-Z6KXXKZH.js";
85import {
86  e as e2,
87  o as o2
88} from "./chunk-HNTXONGY.js";
89import "./chunk-MV3ZEJD7.js";
90import "./chunk-SHLKPWHJ.js";
91import "./chunk-RZPXZWTC.js";
92import "./chunk-5I6QSZAY.js";
93import "./chunk-AOKX2JZY.js";
94import {
95  CheckCircleIcon_default
96} from "./chunk-DUIU7SGU.js";
97import "./chunk-HIPB5MWL.js";
98import "./chunk-ARTDLMGJ.js";
99import {
100  n
101} from "./chunk-XKUWNRAU.js";
102import {
103  s,
104  y
105} from "./chunk-BI6FLLBF.js";
106import "./chunk-GWTLZPQW.js";
107import "./chunk-TUIXK4GB.js";
108import "./chunk-2SIOJVPY.js";
109import "./chunk-DELSWSYH.js";
110import "./chunk-F6HKBNBJ.js";
111import "./chunk-EFX7LFQF.js";
112import {
113  I,
114  M2 as M,
115  P2 as P,
116  dt,
117  he,
118  i3 as i,
119  j2 as j,
120  k2 as k,
121  le,
122  require_lib
123} from "./chunk-GW6OWVAS.js";
124import {
125  require_jsx_runtime
126} from "./chunk-V3VQYMUU.js";
127import "./chunk-WAY6HQ7C.js";
128import "./chunk-KAIIOKO3.js";
129import "./chunk-F7LOI2M5.js";
130import "./chunk-GWCOH4DF.js";
131import "./chunk-FUATFXFK.js";
132import "./chunk-55ARO2SJ.js";
133import "./chunk-J46SIAYM.js";
134import "./chunk-EUVCRAFR.js";
135import "./chunk-5HUKUZMX.js";
136import "./chunk-DRQXJS52.js";
137import "./chunk-EKGTQN7B.js";
138import "./chunk-57LJOLTQ.js";
139import "./chunk-QOAWOBZZ.js";
140import "./chunk-CXC3RFJP.js";
141import "./chunk-LOYGATPO.js";
142import "./chunk-MWZBDUVS.js";
143import "./chunk-IVTAVDWF.js";
144import {
145  require_react
146} from "./chunk-2TKNTQO7.js";
147import {
148  __toESM,
149  init_buffer_shim
150} from "./chunk-DMHST2WB.js";
151
152// ../node_modules/@privy-io/react-auth/dist/esm/StandardSignAndSendTransactionScreen-CiJd6Wf9.mjs
153init_buffer_shim();
154var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
155var import_react = __toESM(require_react(), 1);
156var import_react_device_detect = __toESM(require_lib(), 1);
157var tt = /* @__PURE__ */ dt.span.withConfig({ displayName: "CircleBackground", componentId: "sc-c9f33cd-0" })(["&&{width:82px;height:82px;border-width:4px;border-style:solid;border-color:", ";background-color:", ";border-radius:50%;display:inline-block;box-sizing:border-box;}"], ((t5) => t5.color ?? "var(--privy-color-accent)"), ((t5) => t5.color ?? "var(--privy-color-accent)"));
158var nt = ({ instruction: e5, fees: a3, transactionInfo: r5, solPrice: o4, chain: i3 }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(e2, { children: [r5?.action && /* @__P
158URE__ */ (0, import_jsx_runtime.jsxs)(o2, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(r3, { children: "Action" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(i2, { children: r5.action })] }), null != e5?.total && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(o2, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(r3, { children: "Total" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(i2, { children: e5.total })] }), !e5?.total && null != e5?.amount && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(o2, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(r3, { children: "Total" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(i2, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(f2, { quantities: [e5.amount, a3], tokenPrice: o4 }) })] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(o2, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(r3, { children: "Fees" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(i2, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(f2, { quantities: [a3], tokenPrice: o4 }) })] }
158), e5?.to && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(o2, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(r3, { children: "To" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(i2, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(k2, { walletAddress: e5.to, chainId: i3, chainType: "solana" }) })] })] });
159var et = ({ fees: a3, onClose: r5, receiptHeader: o4, receiptDescription: i3, transactionInfo: s2, solPrice: c2, signOnly: l3, instruction: d3, chain: u2 }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(y, { onClose: r5 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(e3, { style: { marginBottom: "16px" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(tt, { color: "var(--privy-color-success-light)" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckCircleIcon_default, { height: 38, width: 38, strokeWidth: 2, stroke: "var(--privy-color-success)" })] }) }
159), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(r, { title: o4 ?? `Transaction ${l3 ? "signed" : "complete"}!`, description: i3 ?? "You're all set." }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(nt, { solPrice: c2, instruction: d3, fees: a3, transactionInfo: s2, chain: u2 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(he, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(at, { loading: false, onClick: r5, children: "Close" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(l, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(s, {})] });
160var at = /* @__PURE__ */ dt(n).withConfig({ displayName: "SubmitButton", componentId: "sc-3cb7ee42-0" })(["&&{margin-top:24px;}transition:color 350ms ease,background-color 350ms ease;"]);
161async function rt(t5, n4) {
162  try {
163    return await t5;
164  } catch {
165    return n4;
166  }
167}
168function ot(t5) {
169  switch (t5) {
170    case "solana:mainnet":
171      return "mainnet-beta";
172    case "solana:devnet":
173      return "devnet";
174    case "solana:testnet":
175      return "testnet";
176  }
177}
178async function it({ privyClient: t5, chain: n4, mint: e5 }) {
179  let a3 = t2[n4];
180  if (!a3[e5]) {
181    let r5 = await t5.getSplTokenMetadata({ mintAddress: e5, cluster: ot(n4) });
182    r5 && (a3[e5] = { address: e5, symbol: r5.symbol, decimals: r5.decimals });
183  }
184  return a3[e5];
185}
186async function st({ tx: t5, solanaClient: n4, privyClient: e5, checkFunds: a3 }) {
187  let r5 = getCompiledTransactionMessageDecoder().decode(c(t5)), o4 = r5.staticAccounts[0] ?? "", i3 = await l2({ solanaClient: n4, tx: t5 }), s2 = a3 ? await rt(u({ solanaClient: n4, tx: t5 })) : void 0, c2 = s2?.hasFunds ?? true, l3 = {}, d3 = [], u2 = await (async function({ solanaClient: t6, message: n5 }) {
188    if (!("addressTableLookups" in n5) || !n5.addressTableLookups) return [...n5.staticAccounts];
189    let e6 = n5.addressTableLookups.map(((t7) => t7.lookupTableAddress)), a4 = await fetchAddressesForLookupTables(e6, t6.rpc), r6 = e6.map(((t7, e7) => [...n5.addressTableLookups[e7]?.writableIndexes.map(((n6) => {
190      let r7 = a4[t7]?.[n6];
191      if (r7) return { key: r7, isWritable: true, altIdx: e7 };
192    })) ?? [], ...n5.addressTableLookups[e7]?.readonlyIndexes.map(((n6) => {
193      let r7 = a4[t7]?.[n6];
194      if (r7) return { key: r7, isWritable: false, altIdx: e7 };
195    })) ?? []])).flat().filter(((t7) => !!t7)).sort(((t7, n6) => t7.isWritable !== n6.isWritable ? t7.isWritable ? -1 : 1 : t7.altIdx - n6.altIdx)).map((({ key: t7 }) => t7));
196    return [...n5.staticAccounts, ...r6];
197  })({ solanaClient: n4, message: r5 });
198  for (let t6 of r5.instructions) {
199    let a4 = r5.staticAccounts[t6.programAddressIndex] || "";
200    if (a4 !== e && a4 !== n2) if (a4 !== a) {
201      if (a4 === o) {
202        let n5 = await rt((function(t7, n6, e6) {
203          let [a5, r6, o5, i4] = t7.accountIndices?.map(((t8) => n6[t8])) ?? [];
204          return { type: "ata-creation", program: e6, payer: a5, ata: r6, owner: o5, mint: i4 };
205        })(t6, u2, a4));
206        if (!n5) {
207          d3.push({ type: "unknown", program: a4, discriminator: t6.data?.[0] });
208          continue;
209        }
210        if (d3.push(n5), n5.ata && n5.owner && n5.mint) {
211          l3[n5.ata] = { owner: n5.owner, mint: n5.mint };
212          continue;
213        }
214      }
215      if (d.includes(a4)) {
216        let r6 = await rt(ut(t6, u2, n4, e5, a4));
217        if (!r6) {
218          d3.push({ type: "unknown", program: a4, discriminator: t6.data?.[0] });
219          continue;
220        }
221        d3.push(r6);
222      } else if (r2.includes(a4)) {
223        let r6 = await rt(mt(t6, u2, n4, e5, a4));
224        if (!r6) {
225          d3.push({ type: "unknown", program: a4, discriminator: t6.data?.[0] });
226          continue;
227        }
228        d3.push(r6);
229      } else d3.push({ type: "unknown", program: a4, discriminator: t6.data?.[0] });
230    } else {
231      let n5 = await rt(dt2(t6, u2));
232      if (!n5) {
233        d3.push({ type: "unknown", program: a4, discriminator: t6.data?.[0] });
234        continue;
235      }
236      d3.push(n5);
237    }
238    else {
239      let r6 = await rt(lt(t6, u2, n4, e5, l3, a4));
240      if (!r6) {
241        d3.push({ type: "unknown", program: a4, discriminator: t6.data?.[0] });
242        continue;
243      }
244      d3.push(r6), "spl-transfer" === r6.type && (r6.fromAta && r6.fromAccount && r6.token.address && (l3[r6.fromAta] ??= { owner: r6.fromAccount, mint: r6.token.address }), r6.toAta && r6.toAccount && r6.token.address && (l3[r6.toAta] ??= { owner: r6.toAccount, mint: r6.token.address }));
245    }
246  }
247  return { spender: o4, fee: i3, instructions: d3, hasFunds: !!c2 };
248}
249function ct(t5, n4 = 0) {
250  try {
251    return (function(t6, n5 = 0) {
252      let e6 = 0n;
253      for (let a3 = 0; a3 < 8; a3++) e6 |= BigInt(t6[n5 + a3]) << BigInt(8 * a3);
254      return e6;
255    })(t5, n4);
256  } catch {
257  }
258  try {
259    return t5.readBigInt64LE(n4);
260  } catch {
261  }
262  let e5 = f(t5);
263  try {
264    return ((t6, n5 = 0) => {
265      let e6 = t6[n5], a3 = t6[n5 + 7];
266      if (!e6 || !a3) throw Error(`Buffer offset out of range: first: ${e6}, last: ${a3}.`);
267      return (BigInt(t6[n5 + 4] + 256 * t6[n5 + 5] + 65536 * t6[n5 + 6] + (a3 << 24)) << 32n) + BigInt(e6 + 256 * t6[++n5] + 65536 * t6[++n5] + 16777216 * t6[++n5]);
268    })(e5);
269  } catch {
270  }
271  try {
272    return e5.subarray(n4).readBigInt64LE();
273  } catch {
274  }
275  try {
276    return e5.readBigInt64LE(n4);
277  } catch {
278  }
279  return 0n;
280}
281async function lt(t5, n4, e5, a3, r5, o4) {
282  let i3 = t5.data?.[0], s2 = t5.accountIndices?.map(((t6) => n4[t6])) ?? [];
283  if (1 === i3) {
284    let [t6, n5, e6] = s2;
285    return { type: "spl-init-account", program: o4, account: t6, mint: n5, owner: e6 };
286  }
287  if (3 === i3) {
288    let n5, i4, [c2, l3, d3] = s2, u2 = "", m = l3 ? r5[l3] : void 0;
289    if (m) n5 = m.owner, u2 = m.mint;
290    else if (l3) {
291      let t6 = await e5.rpc.getAccountInfo(l3, { commitment: "confirmed", encoding: "jsonParsed" }).send(), a4 = t6.value?.data;
292      n5 = a4?.parsed?.info?.owner, u2 = a4?.parsed?.info?.mint ?? "", i4 = a4?.parsed?.info?.tokenAmount?.decimals;
293    }
294    if (!u2 && c2) {
295      let t6 = await e5.rpc.getAccountInfo(c2, { commitment: "confirmed", encoding: "jsonParsed" }).send(), n6 = t6.value?.data;
296      u2 = n6?.parsed?.info?.mint ?? "";
297    }
298    let p = await it({ privyClient: a3, chain: e5.chain, mint: u2 }), f3 = p?.symbol ?? "";
299    return i4 ??= p?.decimals ?? 9, { type: "spl-transfer", program: o4, fromAta: c2, fromAccount: d3, toAta: l3, toAccount: n5, value: ct(t5.data, 1), token: { symbol: f3, decimals: i4, address: u2 } };
300  }
301  if (9 === i3) {
302    let [t6, n5, e6] = s2;
303    return { type: "spl-close-account", program: o4, source: t6, destination: n5, owner: e6 };
304  }
305  if (17 === i3) return { type: "spl-sync-native", program: o4 };
306  throw Error(`Token program instruction type ${i3} not supported`);
307}
308async function dt2(t5, n4) {
309  let e5 = t5.data?.[0], a3 = t5.accountIndices?.map(((t6) => n4[t6])) ?? [];
310  if (0 === e5) {
311    let [, n5] = a3;
312    return { type: "create-account", program: a, account: n5?.toString(), value: ct(t5.data, 4), withSeed: false };
313  }
314  if (2 === e5) {
315    let [n5, e6] = a3;
316    return { type: "sol-transfer", program: a, fromAccount: n5, toAccount: e6, token: { symbol: "SOL", decimals: 9 }, value: ct(t5.data, 4), withSeed: false };
317  }
318  if (3 === e5) {
319    let [, n5] = a3;
320    return { type: "create-account", program: a, account: n5, withSeed: true, value: ct(t5.data.slice(t5.data.length - 32 - 8 - 8)) };
321  }
322  if (11 === e5) {
323    let [n5, e6] = a3;
324    return { type: "sol-transfer", program: a, fromAccount: n5, toAccount: e6, value: ct(t5.data, 4), token: { symbol: "SOL", decimals: 9 }, withSeed: true };
325  }
326  throw Error(`System program instruction type ${e5} not supported`);
327}
328async function ut(t5, n4, e5, a3, r5) {
329  let o4 = t5.accountIndices?.map(((t6) => n4[t6])) ?? [], i3 = t5.data?.[0];
330  if (143 === i3) {
331    let n5 = o4[10], i4 = o4[11];
332    return { type: "raydium-swap-base-input", program: r5, mintIn: n5, mintOut: i4, tokenIn: n5 ? await it({ privyClient: a3, chain: e5.chain, mint: n5 }) : void 0, tokenOut: i4 ? await it({ privyClient: a3, chain: e5.chain, mint: i4 }) : void 0, amountIn: ct(t5.data, 8), minimumAmountOut: ct(t5.data, 16) };
333  }
334  if (55 === i3) {
335    let n5 = o4[10], i4 = o4[11];
336    return { type: "raydium-swap-base-output", program: r5, mintIn: n5, mintOut: i4, tokenIn: n5 ? await it({ privyClient: a3, chain: e5.chain, mint: n5 }) : void 0, tokenOut: i4 ? await it({ privyClient: a3, chain: e5.chain, mint: i4 }) : void 0, maxAmountIn: ct(t5.data, 8), amountOut: ct(t5.data, 16) };
337  }
338  throw Error(`Raydium swap program instruction type ${i3} not supported`);
339}
340async function mt(t5, n4, e5, a3, r5) {
341  let o4 = t5.data?.[0], i3 = t5.accountIndices?.map(((t6) => n4[t6])) ?? [];
342  if ([208, 51, 239, 151, 123, 43, 237, 92].includes(o4)) {
343    let n5 = i3[5], o5 = i3[6];
344    return { type: "jupiter-swap-exact-out-route", program: r5, mintIn: n5, mintOut: o5, tokenIn: n5 ? await it({ privyClient: a3, chain: e5.chain, mint: n5 }) : void 0, tokenOut: o5 ? await it({ privyClient: a3, chain: e5.chain, mint: o5 }) : void 0, outAmount: ct(t5.data, t5.data.length - 1 - 2 - 8 - 8), quotedInAmount: ct(t5.data, t5.data.length - 1 - 2 - 8) };
345  }
346  if ([176, 209, 105, 168, 154, 125, 69, 62].includes(o4)) {
347    let n5 = i3[7], o5 = i3[8];
348    return { type: "jupiter-swap-exact-out-route", program: r5, mintIn: n5, mintOut: o5, tokenIn: n5 ? await it({ privyClient: a3, chain: e5.chain, mint: n5 }) : void 0, tokenOut: o5 ? await it({ privyClient: a3, chain: e5.chain, mint: o5 }) : void 0, outAmount: ct(t5.data, t5.data.length - 1 - 2 - 8 - 8), quotedInAmount: ct(t5.data, t5.data.length - 1 - 2 - 8) };
349  }
350  if ([193, 32, 155, 51, 65, 214, 156, 129].includes(o4)) {
351    let n5 = i3[7], o5 = i3[8];
352    return { type: "jupiter-swap-shared-accounts-route", program: r5, mintIn: n5, mintOut: o5, tokenIn: n5 ? await it({ privyClient: a3, chain: e5.chain, mint: n5 }) : void 0, tokenOut: o5 ? await it({ privyClient: a3, chain: e5.chain, mint: o5 }) : void 0, inAmount: ct(t5.data, t5.data.length - 1 - 2 - 8 - 8), quotedOutAmount: ct(t5.data, t5.data.length - 1 - 2 - 8) };
353  }
354  throw [62, 198, 214, 193, 213, 159, 108, 210].includes(o4) && console.warn("Jupiter swap program instruction 'claim' not implemented"), [116, 206, 27, 191, 166, 19, 0, 73].includes(o4) && console.warn("Jupiter swap program instruction 'claim_token' not implemented"), [26, 74, 236, 151, 104, 64, 183, 249].includes(o4) && console.warn("Jupiter swap program instruction 'close_token' not implemented"), [229, 194, 212, 172, 8, 10, 134, 147].includes(o4) && console.warn("Jupiter swap program instruction 'create_open_orders' not implemented"), [28, 226, 32, 148, 188, 136, 113, 
354171].includes(o4) && console.warn("Jupiter swap program instruction 'create_program_open_orders' not implemented"), [232, 242, 197, 253, 240, 143, 129, 52].includes(o4) && console.warn("Jupiter swap program instruction 'create_token_ledger' not implemented"), [147, 241, 123, 100, 244, 132, 174, 118].includes(o4) && console.warn("Jupiter swap program instruction 'create_token_account' not implemented"), [229, 23, 203, 151, 122, 227, 173, 42].includes(o4) && console.warn("Jupiter swap program instruction 'route' not implemented"), [150, 86, 71, 116, 167, 93, 14, 104].includes(o4) && console.warn("Jupiter swap program instruction 'route_with_token_ledger' not implemented"), [228, 85, 185, 112, 78, 79, 77, 2].includes(o4) && console.warn("Jupiter swap program instruction 'set_token_ledger' not implemented"), [230, 121, 143, 80, 119, 159, 106, 170].includes(o4) && console.warn("Jupiter swap program instruction 'shared_accounts_route_with_token_ledger' not implemented"), Error(`Jupiter swap program instruction type ${o4} not supported`);
355}
356var pt = { component: () => {
357  let { data: t5, onUserCloseViaDialogOrKeybindRef: e5, setModalData: g, navigate: h } = P(), { client: y3, closePrivyModal: w, walletProxy: k3, showFiatPrices: b } = I(), v = le(), { user: I2 } = M(), A = d2()(t5?.standardSignAndSendTransaction?.chain ?? "solana:mainnet"), [S, j2] = (0, import_react.useState)(t5?.standardSignAndSendTransaction?.transaction), [C2, T] = (0, import_react.useState)(), [O, x] = (0, import_react.useState)(), [M2, q] = (0, import_react.useState)({ value: 0n, isLoading: false }), [U, V] = (0, import_react.useState)(false), [z, N] = (0, import_react.useState)({}), [Q, X] = (0, import_react.useState)(), Y2 = t5?.standardSignAndSendTransaction?.account, G = !!t5?.standardSignAndSendTransaction?.signOnly, K = Y2?.imported ? k(I2).find(((t6) => t6.address === Y2.address)) : j(I2), { solPrice: tt2, isSolPriceLoa
357ding: nt2 } = t({ enabled: b }), at2 = (0, import_react.useMemo)((() => {
358    if (!C2) return;
359    let t6 = C2.spender, n4 = t3(C2.fee), e6 = t3(M2.value, 3, true), a3 = C2.instructions.filter(((t7) => ["sol-transfer", "spl-transfer", "raydium-swap-base-input", "raydium-swap-base-output", "jupiter-swap-shared-accounts-route", "jupiter-swap-exact-out-route"].includes(t7.type))), r5 = a3.at(0);
360    if (!r5 || a3.length > 1) return { fee: n4, spender: t6, balance: e6 };
361    if ("sol-transfer" === r5.type) return { fee: n4, spender: t6, balance: e6, total: t3(r5.value) };
362    if ("spl-transfer" === r5.type) return { fee: n4, spender: t6, balance: e6, total: `${i({ amount: r5.value, decimals: r5.token.decimals })} ${r5.token.symbol}` };
363    if ("raydium-swap-base-input" === r5.type && r5.tokenIn && r5.tokenOut) {
364      return { fee: n4, spender: t6, balance: e6, swap: `${`${i({ amount: r5.amountIn, decimals: r5.tokenIn.decimals })} ${r5.tokenIn.symbol}`} \u2192 ${`${i({ amount: r5.minimumAmountOut, decimals: r5.tokenOut.decimals })} ${r5.tokenOut.symbol}`}` };
365    }
366    if ("raydium-swap-base-output" === r5.type && r5.tokenIn && r5.tokenOut) {
367      return { fee: n4, spender: t6, balance: e6, swap: `${`${i({ amount: r5.maxAmountIn, decimals: r5.tokenIn.decimals })} ${r5.tokenIn.symbol}`} \u2192 ${`${i({ amount: r5.amountOut, decimals: r5.tokenOut.decimals })} ${r5.tokenOut.symbol}`}` };
368    }
369    if ("jupiter-swap-shared-accounts-route" === r5.type && r5.tokenIn && r5.tokenOut) {
370      return { fee: n4, spender: t6, balance: e6, swap: `${`${i({ amount: r5.inAmount, decimals: r5.tokenIn.decimals })} ${r5.tokenIn.symbol}`} \u2192 ${`${i({ amount: r5.quotedOutAmount, decimals: r5.tokenOut.decimals })} ${r5.tokenOut.symbol}`}` };
371    }
372    if ("jupiter-swap-exact-out-route" === r5.type && r5.tokenIn && r5.tokenOut) {
373      return { fee: n4, spender: t6, balance: e6, swap: `${`${i({ amount: r5.quotedInAmount, decimals: r5.tokenIn.decimals })} ${r5.tokenIn.symbol}`} \u2192 ${`${i({ amount: r5.outAmount, decimals: r5.tokenOut.decimals })} ${r5.tokenOut.symbol}`}` };
374    }
375    return { fee: n4, spender: t6, balance: e6 };
376  }), [C2, Y2?.address, M2]), rt2 = (0, import_react.useMemo)((() => {
377    let t6;
378    if (!C2 || !b || !tt2 || nt2) return;
379    function n4(...t7) {
380      return C(t7.reduce(((t8, n5) => t8 + n5), 0n), tt2 ?? 0);
381    }
382    Y2?.address === C2.spender && (t6 = n4(C2.fee));
383    let e6 = n4(M2.value), a3 = C2.instructions.filter(((t7) => "sol-transfer" === t7.type || "spl-transfer" === t7.type)).at(0);
384    return !a3 || C2.instructions.length > 1 ? { fee: t6, balance: e6 } : "sol-transfer" === a3.type ? { fee: t6, balance: e6, total: n4(a3.value, Y2?.address === C2.spender ? C2.fee : 0n) } : "spl-transfer" === a3.type ? { fee: t6, balance: e6, total: `${i({ amount: a3.value, decimals: a3.token.decimals })} ${a3.token.symbol}` } : { fee: t6, balance: e6 };
385  }), [C2, b, tt2, nt2, Y2?.address, M2]);
386  if ((0, import_react.useEffect)((() => {
387    !(async function() {
388      if (S && y3) try {
389        x(void 0);
390        let t6 = await st({ tx: S, solanaClient: A, privyClient: y3, checkFunds: !G });
391        T(t6);
392      } catch (t6) {
393        console.error("Failed to prepare transaction", t6), x(t6);
394      }
395    })();
396  }), [S, A, y3, G]), (0, import_react.useEffect)((() => {
397    (async function() {
398      if (!Y2) return;
399      q({ value: M2.value, isLoading: true });
400      let { value: t6 } = await A.rpc.getBalance(Y2.address, { commitment: "confirmed" }).send();
401      q({ value: t6 ?? 0n, isLoading: false });
402    })().catch(console.error);
403  }), [C2]), !S || !t5?.standardSignAndSendTransaction || !Y2) {
404    let e6 = Error("Invalid transaction request");
405    return (0, import_jsx_runtime.jsx)(y2, { error: e6, allowlistConfig: v.allowlistConfig, onRetry: () => {
406      t5?.standardSignAndSendTransaction?.onFailure(e6), w({ shouldCallAuthOnSuccess: false });
407    } });
408  }
409  let ot2 = () => {
410    if (!U) return z.signature || z.signedTransaction ? t5?.standardSignAndSendTransaction?.onSuccess({ signature: z.signature, signedTransaction: z.signedTransaction }) : t5?.standardSignAndSendTransaction?.onFailure(Q ?? O ?? Error("User exited the modal before submitting the transaction")), w({ shouldCallAuthOnSuccess: false });
411  };
412  e5.current = ot2;
413  let it2 = t5.standardSignAndSendTransaction?.uiOptions?.transactionInfo?.contractInfo?.imgUrl ? /* @__P
413URE__ */ (0, import_jsx_runtime.jsx)("img", { src: t5.standardSignAndSendTransaction.uiOptions.transactionInfo.contractInfo.imgUrl, alt: t5.standardSignAndSendTransaction.uiOptions.transactionInfo.contractInfo.imgAltText }) : null, ct2 = !!(t5.funding && t5.funding.supportedOptions.length > 0), lt2 = !C2?.hasFunds && ct2;
414  if (z.signature || z.signedTransaction) {
415    let e6 = C2?.instructions.filter(((t6) => "sol-transfer" === t6.type || "spl-transfer" === t6.type)), a3 = 1 === e6?.length ? e6?.at(0) : void 0;
416    return (0, import_jsx_runtime.jsx)(et, { fees: z.fees ?? 0n, onClose: ot2, transactionInfo: t5.standardSignAndSendTransaction?.uiOptions.transactionInfo, solPrice: tt2, receiptHeader: t5.standardSignAndSendTransaction?.uiOptions.successHeader, receiptDescription: t5.standardSignAndSendTransaction?.uiOptions.successDescription, chain: A.chain, signOnly: G, instruction: "sol-transfer" === a3?.type ? { to: a3.toAccount, amount: a3.value } : { to: a3?.toAccount || a3?.toAta, total: at2?.total } });
417  }
418  return Q ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(re, { transactionError: Q, chainId: A.chain, onClose: ot2, chainType: "solana", onRetry: async () => {
419    X(void 0);
420    let { value: t6 } = await A.rpc.getLatestBlockhash().send();
421    var n4, e6;
422    j2((n4 = S, e6 = t6, pipe(getCompiledTransactionMessageDecoder().decode(c(n4)), ((t7) => decompileTransactionMessage(t7)), ((t7) => setTransactionMessageLifetimeUsingBlockhash(e6, t7)), ((t7) => compileTransaction(t7)), ((t7) => new Uint8Array(getTransactionEncoder().encode(t7))))));
423  } }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Y, { img: it2, title: t5.standardSignAndSendTransaction?.uiOptions?.transactionInfo?.title || "Confirm transaction", subtitle: t5.standardSignAndSendTransaction?.uiOptions?.description || `${v.name} wants your permission to approve the following transaction.`, cta: lt2 ? "Add funds" : t5.standardSignAndSendTransaction?.uiOptions?.buttonText || "Approve", instructions: C2?.instructions ?? [], network: "solana:mainnet" == A.chain ? "Solana" : A.chain.replace("solana:", ""), blockExplorerUrl: A.blockExplorerUrl, total: b ? rt2?.total : at2?.total, fee: b ? rt2?.fee : at2?.fee, balance: b ? rt2?.balance : at2?.balance, swap: at2?.swap, transactingWalletAddress: Y2.address, disabled: !C2?.hasFunds && !ct2, isSubmitting: U, isPreparing: !C2 || M2.isLoading, isTokenPriceLoading: b && nt2, isMissingFunds: !C2?.hasFunds, submitError: Q ?? void 0, isSponsored: !!t5.standardSignAndSendTransaction?.isSponsored, parseError: O, onClick: lt2 ? async () => {
424    if (!Y2) return;
425    if (!ct2) throw Error("Funding wallet is not enabled");
426    let n4 = "FundingMethodSelectionScreen";
427    g({ ...t5, funding: { ...t5.funding, methodScreen: n4 }, solanaFundingData: t5?.solanaFundingData }), h(n4);
428  } : async () => {
429    try {
430      if (V(true), U || !Y2 || !k3 || !I2 || !K) return;
431      let n4 = await t5.standardSignAndSendTransaction.onConfirm(S);
432      if ("signature" in n4) {
433        let t6 = await (async function({ solanaClient: t7, signature: n5 }) {
434          let e6 = getBase58Decoder().decode(n5), a3 = await t7.rpc.getTransaction(e6, { maxSupportedTransactionVersion: 0, commitment: "confirmed", encoding: "base64" }).send().catch((() => null));
435          return a3 ? { fee: a3.meta?.fee ?? 0n } : null;
436        })({ solanaClient: A, signature: n4.signature });
437        return void N({ ...n4, fees: t6?.fee });
438      }
439      N(n4);
440    } catch (t6) {
441      console.warn({ transaction: S, error: t6 }), X(t6);
442    } finally {
443      V(false);
444    }
445  }, onClose: ot2 });
446} };
447export {
448  pt as StandardSignAndSendTransactionScreen,
449  pt as default
450};
451//# sourceMappingURL=StandardSignAndSendTransactionScreen-CiJd6Wf9-AAKE7LQV.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.