UNPKG

@privy-io/react-auth

Version:

React client for the Privy Auth API

4 lines (3 loc) 2.12 kB
import{jsx as e,Fragment as t,jsxs as i}from"react/jsx-runtime";import{styled as n}from"styled-components";import{formatUnits as o}from"viem";import{s as r,a,g as s,b as c}from"./ethers-C3Y94dat.mjs";import{g as l}from"./getFormattedUsdFromLamports-B6EqSEho.mjs";import{g as d}from"./transaction-CnfuREWo.mjs";import{D as m}from"./useActiveWallet-Bsy5GTCV.mjs";const p=({weiQuantities:t,tokenPrice:i,tokenSymbol:n})=>{let o=r(t),c=i?a(o,i):void 0,l=s(o,n);/*#__PURE__*/return e(y,{children:c||l})},h=({weiQuantities:n,tokenPrice:o,tokenSymbol:c})=>{let l=r(n),d=o?a(l,o):void 0,m=s(l,c);/*#__PURE__*/return e(y,{children:d?/*#__PURE__*/i(t,{children:[/*#__PURE__*/e(g,{children:"USD"}),"<$0.01"===d? /*#__PURE__*/i(x,{children:[/*#__PURE__*/e(u,{children:"<"}),"$0.01"]}):d]}):m})},f=({quantities:n,tokenPrice:r,tokenSymbol:a="SOL",tokenDecimals:s=9})=>{let c=n.reduce(((e,t)=>e+t),0n),m=r&&"SOL"===a&&9===s?l(c,r):void 0,p="SOL"===a&&9===s?d(c):`${o(c,s)} ${a}`;/*#__PURE__*/return e(y,{children:m?/*#__PURE__*/e(t,{children:"<$0.01"===m? /*#__PURE__*/i(x,{children:[/*#__PURE__*/e(u,{children:"<"}),"$0.01"]}):m}):p})};let y=/*#__PURE__*/n.span.withConfig({displayName:"StyledPriceDisplay",componentId:"sc-3cd56c8a-0"})(["font-size:14px;line-height:140%;display:flex;gap:4px;align-items:center;"]),g=/*#__PURE__*/n.span.withConfig({displayName:"StyledPriceUnit",componentId:"sc-3cd56c8a-1"})(["font-size:12px;line-height:12px;color:var(--privy-color-foreground-3);"]),u=/*#__PURE__*/n.span.withConfig({displayName:"TinyLessThan",componentId:"sc-3cd56c8a-2"})(["font-size:10px;"]),x=/*#__PURE__*/n.span.withConfig({displayName:"FlexCenter",componentId:"sc-3cd56c8a-3"})(["display:flex;align-items:center;"]);function S(e,t){return`https://explorer.solana.com/account/${e}?chain=${t}`}const k=t=>/*#__PURE__*/e(w,{href:"ethereum"===t.chainType?c(t.chainId,t.walletAddress):S(t.walletAddress,t.chainId),target:"_blank",children:m(t.walletAddress)});let w=/*#__PURE__*/n.a.withConfig({displayName:"StyledLink",componentId:"sc-dd6c0f9f-0"})(["&:hover{text-decoration:underline;}"]);export{p as H,h as P,f as S,k as W};