@privy-io/react-auth
Version:
React client for the Privy Auth API
23 lines (22 loc) • 1.75 kB
JavaScript
import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{styled as n}from"styled-components";import{formatUnits as i}from"viem";import{s as o,a as s,g as a,b as l}from"./ethers-D1WT71Ay.mjs";import{g as c}from"./getFormattedUsdFromLamports-B6EqSEho.mjs";import{g as m}from"./transaction-CnfuREWo.mjs";import{D as d}from"./useActiveWallet-3RHPIBxJ.mjs";const p=({weiQuantities:t,tokenPrice:r,tokenSymbol:n})=>{let i=o(t),l=r?s(i,r):void 0,c=a(i,n);/*#__PURE__*/return e(u,{children:l||c})},h=({weiQuantities:n,tokenPrice:i,tokenSymbol:l})=>{let c=o(n),m=i?s(c,i):void 0,d=a(c,l);/*#__PURE__*/return e(u,{children:m?/*#__PURE__*/r(t,{children:[/*#__PURE__*/e(g,{children:"USD"}),"<$0.01"===m?
/*#__PURE__*/r(S,{children:[/*#__PURE__*/e(x,{children:"<"}),"$0.01"]}):m]}):d})},f=({quantities:n,tokenPrice:o,tokenSymbol:s="SOL",tokenDecimals:a=9})=>{let l=n.reduce(((e,t)=>e+t),0n),d=o&&"SOL"===s&&9===a?c(l,o):void 0,p="SOL"===s&&9===a?m(l):`${i(l,a)} ${s}`;/*#__PURE__*/return e(u,{children:d?/*#__PURE__*/e(t,{children:"<$0.01"===d?
/*#__PURE__*/r(S,{children:[/*#__PURE__*/e(x,{children:"<"}),"$0.01"]}):d}):p})};let u=n.span`
font-size: 14px;
line-height: 140%;
display: flex;
gap: 4px;
align-items: center;
`,g=n.span`
font-size: 12px;
line-height: 12px;
color: var(--privy-color-foreground-3);
`,x=n.span`
font-size: 10px;
`,S=n.span`
display: flex;
align-items: center;
`;function k(e,t){return`https://explorer.solana.com/account/${e}?chain=${t}`}const v=t=>/*#__PURE__*/e(y,{href:"ethereum"===t.chainType?l(t.chainId,t.walletAddress):k(t.walletAddress,t.chainId),target:"_blank",children:d(t.walletAddress)});let y=n.a`
&:hover {
text-decoration: underline;
}
`;export{p as H,h as P,f as S,v as W};