UNPKG

@privy-io/react-auth

Version:

React client for the Privy Auth API

2 lines (1 loc) 2.52 kB
import{jsxs as t,Fragment as o,jsx as e}from"react/jsx-runtime";import{useRef as r}from"react";import{a as i}from"./Button-B8mqatRx.mjs";import{F as n}from"./Layouts-Bmf8DxNP.mjs";import{B as a}from"./ModalHeader-BLGC-7ev.mjs";import{t as m}from"./FundWalletMethodHeader-I8a6Y30s.mjs";import{N as s}from"./index-CJMgUOnw.mjs";import{T as l}from"./Title-D0pfZff-.mjs";import{a as c}from"./get-is-unified-wallet-DvKS5IUO.mjs";import{u as p}from"./useGetTokenPrice-0Bn0Y88A.mjs";import{c as d}from"./ethers-C3Y94dat.mjs";import{F as u,a as h,h as f,c as j,d as C}from"./styles-DY17fuAX.mjs";import"styled-components";import"./useActiveWallet-Bsy5GTCV.mjs";import"zustand";import"./context-Bycd1SKV.mjs";import"@privy-io/js-sdk-core";import"tinycolor2";import"react-device-detect";import"./prepareFundingModalData-CIgFwA7s.mjs";import"./internal-context-e-Eni5bG.mjs";import"ofetch";import"eventemitter3";import"./events-context-CI0iqAXA.mjs";import"viem";import"viem/utils";import"./getPublicClient-A9RSftUZ.mjs";import"./useWallets-D0lpBS44.mjs";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"./useGetSolPrice-Cfm8o9C5.mjs";const g={component:()=>{let{data:g,setModalData:v}=c(),y=g?.funding,k="solana"===y.chainType,x=r(null),{tokenPrice:D}=p(k?"solana":y.chain.id),F=k?void 0:y,M=!(!F?.erc20Address||F?.erc20ContractInfo),S=k?y.isUSDC?"USDC":"SOL":y.erc20Address?y.erc20ContractInfo?.symbol:y.chain.nativeCurrency.symbol||"ETH",T=parseFloat(y.amount),A=!isNaN(T)&&T>0,I=D?d(y.amount,D):void 0;/*#__PURE__*/return t(o,{children:[/*#__PURE__*/e(m,{}),/*#__PURE__*/e(l,{children:"Confirm or edit amount"}),/*#__PURE__*/t(n,{style:{marginTop:"32px"},children:[/*#__PURE__*/e(u,{children:M?/*#__PURE__*/e(s,{size:"50px"}):/*#__PURE__*/t(o,{children:[/*#__PURE__*/t(h,{onClick:()=>x.current?.focus(),children:[/*#__PURE__*/e(f,{ref:x,value:y.amount,onChange:t=>{let o=t.target.value;/^[0-9.]*$/.test(o)&&o.split(".").length-1<=1&&v({...g,funding:{...y,amount:o},solanaFundingData:g?.solanaFundingData?{...g.solanaFundingData,amount:o}:void 0})}}),/*#__PURE__*/e(j,{children:S})]}),!F?.erc20Address&&!(k&&y.isUSDC)&&/*#__PURE__*/e(C,{children:I&&A?`${I} USD`:""})]})}),/*#__PURE__*/e(i,{style:{marginTop:"1rem"},disabled:!A,onClick:y.onContinueWithExternalWallet,children:"Continue"})]}),/*#__PURE__*/e(a,{})]})}};export{g as FundingAmountEditScreen,g as default};