UNPKG

@privy-io/react-auth

Version:

React client for the Privy Auth API

2 lines (1 loc) 780 B
import{formatEther as r}from"viem";import{u as e}from"./internal-context-Z-fyxadS.mjs";import{F as t}from"./use-export-wallet-_wu5ex5t.mjs";let a=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2}),s=r=>a.format(r);const n=(r,e)=>{let t=s(e*parseFloat(r));return"$0.00"!==t?t:"<$0.01"},o=(e,t)=>{let a=s(t*parseFloat(r(e)));return"$0.00"===a?"<$0.01":a},c=(r,e,t=6,a=!1)=>`${l(r,t,a)} ${e}`,l=(e,t=6,a=!1)=>{let s=parseFloat(r(e)).toFixed(t).replace(/0+$/,"").replace(/\.$/,"");return a?s:`${"0"===s?"<0.001":s}`},m=r=>r.reduce(((r,e)=>r+e),0n),i=(r,a)=>{let{chains:s}=e(),n=`https://etherscan.io/address/${a}`,o=`${t(r,s)}/address/${a}`;if(!o)return n;try{new URL(o)}catch{return n}return o};export{o as a,i as b,n as c,c as g,l as p,m as s};