@privy-io/react-auth 1.86.0 → 1.87.0-beta-20240920172644
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-TIACG3L3.js → chunk-4GRYKTVV.js} +1 -1
- package/dist/chunk-LTAXBMI2.js +3376 -0
- package/dist/{chunk-QVSCWGK3.js → chunk-NGIQBA55.js} +3 -3
- package/dist/chunk-V5T6BXGX.js +1 -0
- package/dist/esm/{chunk-TIACG3L3.js → chunk-4GRYKTVV.js} +1 -1
- package/dist/esm/chunk-LTAXBMI2.js +3376 -0
- package/dist/esm/{chunk-QVSCWGK3.js → chunk-NGIQBA55.js} +1 -1
- package/dist/esm/chunk-V5T6BXGX.js +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/smart-wallets.js +1 -1
- package/dist/esm/solana.js +1 -1
- package/dist/esm/ui.js +1 -1
- package/dist/index.d.ts +24 -3
- package/dist/index.js +1 -1
- package/dist/smart-wallets.js +1 -1
- package/dist/solana.d.ts +2 -2
- package/dist/solana.js +1 -1
- package/dist/{types-2f8e9783.d.ts → types-eaea6708.d.ts} +15 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +8 -8
- package/package.json +1 -1
- package/dist/chunk-7M4DBJFW.js +0 -3376
- package/dist/chunk-Z4PCJGI3.js +0 -1
- package/dist/esm/chunk-7M4DBJFW.js +0 -3376
- package/dist/esm/chunk-Z4PCJGI3.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as _,oa as F,ra as D,sa as b,ta as V}from"./chunk-Z4PCJGI3.js";import{useContext as he}from"react";import{createContext as de,useContext as pe,useEffect as fe}from"react";var tt={login:{onComplete:[],onError:[],onOAuthLoginComplete:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},setWalletRecovery:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},sendSolanaTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]},oAuthAuthorization:{onOAuthTokenGrant:[]},fundWallet:{onUserExited:[]},customAuth:{onAuthenticated:[],onUnauthenticated:[]}},me=de(void 0),N=()=>pe(me);function y(t,r){if(!r)return;let n=N().current[t];return fe(()=>{for(let[i,o]of Object.entries(r))n.hasOwnProperty(i)||console.warn(`Invalid event type "${i}" for action "${t}"`),n[i]?.push(o);return()=>{for(let[i,o]of Object.entries(r))n.hasOwnProperty(i)||console.warn(`Invalid event type "${i}" for action "${t}"`),n[i]=n[i]?.filter(s=>s!==o)}},[r])}function ye(t,r,e,...n){for(let i of t.current[r][e])i(...n)}function rt(){let t=N();return(r,e,...n)=>ye(t,r,e,...n)}function st(t){let{logout:r}=he(b);return y("logout",t),{logout:r}}import{useContext as ve}from"react";function pt(t){let{login:r}=ve(b);return y("login",t),{login:r}}import{useContext as ge}from"react";function vt(t){let{connectWallet:r}=ge(b);return y("connectWallet",t),{connectWallet:r}}var At=t=>{y("fundWallet",t);let{fundWallet:r}=V();return{fundWallet:r}};var S=class{constructor(){this._cache={}}get(r){return this._cache[r]}put(r,e){e!==void 0?this._cache[r]=e:this.del(r)}del(r){delete this._cache[r]}getKeys(){return Object.keys(this._cache)}},P=class{get(r){let e=localStorage.getItem(r);return e===null?void 0:JSON.parse(e)}put(r,e){e!==void 0?localStorage.setItem(r,JSON.stringify(e)):this.del(r)}del(r){localStorage.removeItem(r)}getKeys(){return Object.entries(localStorage).map(([r])=>r)}};function wt(){try{let t="privy:__session_storage__test",r="blobby",e=new P;return e.put(t,r),e.del(t),!0}catch{return!1}}function _e(){return typeof window<"u"&&window.localStorage?new P:new S}var A=_e();function B(){let t=window,r=t.ethereum;if(!r)return[];let e=[];if(r.providers?.length)for(let n of r.providers)n&&e.push(n);return e.push(t.ethereum),e}var T=t=>{if(t.isApexWallet)return"Apex Wallet";if(t.isAvalanche)return"Core Wallet";if(t.isBackpack)return"Backpack";if(t.isBifrost)return"Bifrost Wallet";if(t.isBitKeep)return"BitKeep";if(t.isBitski)return"Bitski";if(t.isBlockWallet)return"BlockWallet";if(t.isBraveWallet)return"Brave Wallet";if(t.isClover)return"Clover";if(t.isCoin98)return"Coin98 Wallet";if(t.isCoinbaseWallet)return"Coinbase Wallet";if(t.isDawn)return"Dawn Wallet";if(t.isDefiant)return"Defiant";if(t.isDesig)return"Desig Wallet";if(t.isEnkrypt)return"Enkrypt";if(t.isExodus)return"Exodus";if(t.isFordefi)return"Fordefi";if(t.isFrame)return"Frame";if(t.isFrontier)return"Frontier Wallet";if(t.isGamestop)return"GameStop Wallet";if(t.isHaqqWallet)return"HAQQ Wallet";if(t.isHyperPay)return"HyperPay Wallet";if(t.isImToken)return"ImToken";if(t.isHaloWallet)return"Halo Wallet";if(t.isKuCoinWallet)return"KuCoin Wallet";if(t.isMathWallet)return"MathWallet";if(t.isNovaWallet)return"Nova Wallet";if(t.isOkxWallet||t.isOKExWallet)return"OKX Wallet";if(t.isOneInchIOSWallet||t.isOneInchAndroidWallet)return"1inch Wallet";if(t.isOneKey)return"OneKey Wallet";if(t.isOpera)return"Opera";if(t.isPhantom)return"Phantom";if(t.isPortal)return"Ripio Portal";if(t.isRabby)return"Rabby Wallet";if(t.isRainbow)return"Rainbow";if(t.isSafePal)return"SafePal Wallet";if(t.isStatus)return"Status";if(t.isSubWallet)return"SubWallet";if(t.isTalisman)return"Talisman";if(t.isTally||t.isTaho)return"Taho";if(t.isTokenPocket)return"TokenPocket";if(t.isTokenary)return"Tokenary";if(t.isTrust||t.isTrustWallet)return"Trust Wallet";if(t.isTTWallet)return"TTWallet";if(t.isXDEFI)return"XDEFI Wallet";if(t.isZeal)return"Zeal";if(t.isZerion)return"Zerion";if(t.isMetaMask)return"MetaMask"};var R=(t,r)=>{if(!t.isMetaMask)return!1;if(t.isMetaMask&&!r)return!0;if(t.isBraveWallet&&!t._events&&!t._state||T(t)!=="MetaMask")return!1;if(t.providers){for(let e of t.providers)if(!R(e))return!1}return!0},Tt=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Ct=()=>{let t=window;if(!t.ethereum)return!1;if(t.ethereum.isCoinbaseWallet)return!0;if(t.ethereum.providers){for(let r of t.ethereum.providers)if(r&&r.isCoinbaseWallet)return!0}return!1};import{StaticJsonRpcProvider as x}from"@ethersproject/providers";var It=(t,r)=>{let e=[],n=[];for(let[i,o]of t.entries())i<r?e.push(o):n.push(o);return[e,n]},Ut=t=>!!String(t).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),Lt=(t,r)=>{let e=t.slice(0),n=[];for(;e.length;)n.push(e.splice(0,r));return n},O=(t,r=3,e=4,n="ethereum")=>{if(!t)return"";let i=n==="ethereum"?2:0,o=3;if(r+e+i+o>=t.length)return t;let s=t.slice(0,i+r),c=t.slice(t.length-e,t.length);return`${s}...${c}`},be=t=>new Promise(r=>setTimeout(r,t));function jt(t,{interval:r=100,timeout:e=5e3}={}){return new Promise((n,i)=>{let o=0,s,c=()=>{if(o>=e){i("Max attempts reached without result");return}if(s=t(),o+=r,s!=null){n(s);return}setTimeout(c,r)};c()})}var $t=(t,r={})=>{let e=r.delayMs||150,n=r.maxAttempts||270;return new Promise(async(i,o)=>{let s=!1,c=0;for(;!s&&c<n;){if(r.abortSignal?.aborted)return;t().then(l=>{s=!0,i(l)},(...l)=>{s=!0,o(...l)}),c+=1,await be(e)}s||o(new Error("Exceeded max attempts before resolving function"))})},Ft=(t,r,e={},n={})=>{let i=new URL(r,t);for(let[s,c]of Object.entries(e))c!==void 0&&i.searchParams.set(s,c);let o=Object.entries(n);if(o.length>0){let s=new URLSearchParams;for(let[c,l]of o)s.append(c,l);i.hash=s.toString()}return i.href};var Dt=t=>t.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),Vt=t=>typeof t=="string"?t:"0x"+t.toString(16);async function Nt(t,r,e,n=3e3){let i=!1,o=window;return new Promise(s=>{o.ethereum?c():(window.addEventListener("ethereum#initialized",c,{once:!0}),setTimeout(()=>{c()},n));function c(){if(i)return;i=!0,window.removeEventListener("ethereum#initialized",c);let l=t.getProviders();console.debug("Detected injected providers:",l.map(d=>d.info));let u=[];for(let d of l)r.includes("coinbase_wallet")&&d.info.rdns==="com.coinbase.wallet"||u.push({type:d.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:d});for(let d of B()){let h=T(d);if(!l.some(p=>p.info.name===h)){if(R(d,!0)&&!u.find(p=>p.type==="metamask")){u.push({type:"metamask",legacyInjectedProvider:d});continue}if(h==="Phantom"&&!u.find(p=>p.type==="phantom")){u.push({type:"phantom",legacyInjectedProvider:d});continue}if(h==="Coinbase Wallet"&&!u.find(p=>p.type==="coinbase_wallet"&&e?.coinbaseWallet?.connectionOptions!=="smartWalletOnly")){u.push({type:"coinbase_wallet",legacyInjectedProvider:d});continue}u.find(p=>p.type==="unknown_browser_extension")||u.push({type:"unknown_browser_extension",legacyInjectedProvider:d})}}s(u)}})}function Bt(t){return`eip155:${String(Number(t))}`}var Gt=(t,r,e,n)=>{let i=Number(t),o=r.find(s=>s.id===i);if(!o)throw new _(`Unsupported chainId ${t}`,4901);return Ae(o,e,n)},Ae=(t,r,e)=>{let n=t.id,i=Number(t.id),o;if(t.rpcUrls.privyWalletOverride&&t.rpcUrls.privyWalletOverride.http[0])o=t.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[i])o=r.rpcUrls[i];else if(t.rpcUrls.privy?.http[0]){let s=new URL(t.rpcUrls.privy.http[0]);s.searchParams.append("privyAppId",e),o=s.toString()}else t.rpcUrls.public?.http[0]?o=t.rpcUrls.public.http[0]:o=t.rpcUrls.default?.http[0];if(!o)throw new _(`No RPC url found for ${n}`);return o},G=(t,r)=>{let e=Number(t),n=r.find(i=>i.id===e);if(!n)throw new _(`Unsupported chainId ${t}`,4901);return n.blockExplorers?.default.url},Ht=(t,r,e,n)=>{let i=Number(t),o=r.find(c=>c.id===i);if(!o)throw new _(`Unsupported chainId ${t}`,4901);let s;if(o.rpcUrls.privyWalletOverride&&o.rpcUrls.privyWalletOverride.http[0]?s=new x(o.rpcUrls.privyWalletOverride.http[0]):e.rpcUrls&&e.rpcUrls[i]?s=new x(e.rpcUrls[i]):o.rpcUrls.privy?.http[0]?s=new x({url:o.rpcUrls.privy.http[0],headers:{"privy-app-id":n.appId}}):o.rpcUrls.public?.http[0]?s=new x(o.rpcUrls.public.http[0]):s=new x(o.rpcUrls.default?.http[0]),!s)throw new _(`No RPC url found for ${t}`);return s},Kt=t=>{let r={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},e=t.types.EIP712Domain??Object.entries(t.domain).map(([n,i])=>{if(i!=null&&typeof n=="string"&&n in r)return{name:n,type:r[n]}}).filter(n=>n!==void 0);return{...t,types:{...t.types,EIP712Domain:e}}};function zt(t,{min:r,max:e}){return Math.min(Math.max(t,r),e)}import{getAddress as H}from"@ethersproject/address";function a(t){return t?new Date(t*1e3):null}function We(t){let r=[];for(let e of t){let n=e.type;switch(e.type){case"wallet":let i={address:e.address,type:e.type,imported:e.imported,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at),chainType:e.chain_type,chainId:e.chain_id,walletClient:e.wallet_client_type==="privy"?"privy":"unknown",walletClientType:e.wallet_client_type,connectorType:e.connector_type,recoveryMethod:e.recovery_method,walletIndex:e.wallet_index};r.push(i);break;case"smart_wallet":let o={address:e.address,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at),smartWalletType:e.smart_wallet_type};r.push(o);break;case"cross_app":let s={type:e.type,subject:e.subject,embeddedWallets:e.embedded_wallets,smartWallets:e.smart_wallets,providerApp:{id:e.provider_app_id},verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(s);break;case"email":let c={address:e.address,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(c);break;case"phone":let l={number:e.phoneNumber,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(l);break;case"google_oauth":let u={subject:e.subject,email:e.email,name:e.name,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(u);break;case"spotify_oauth":let d={subject:e.subject,email:e.email,name:e.name,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(d);break;case"instagram_oauth":let h={subject:e.subject,username:e.username,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(h);break;case"twitter_oauth":let p={subject:e.subject,username:e.username,name:e.name,type:e.type,profilePictureUrl:e.profile_picture_url,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(p);break;case"discord_oauth":let g={subject:e.subject,username:e.username,email:e.email,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(g);break;case"github_oauth":let w={subject:e.subject,username:e.username,name:e.name,email:e.email,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(w);break;case"tiktok_oauth":let m={subject:e.subject,username:e.username,name:e.name,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(m);break;case"linkedin_oauth":let v={subject:e.subject,name:e.name,email:e.email,vanityName:e.vanity_name,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(v);break;case"apple_oauth":let E={subject:e.subject,email:e.email,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(E);break;case"custom_auth":r.push({type:e.type,customUserId:e.custom_user_id,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)});break;case"farcaster":let $={type:e.type,fid:e.fid,ownerAddress:e.owner_address,displayName:e.display_name,username:e.username,bio:e.bio,pfp:e.profile_picture_url,url:e.homepage_url,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at),signerPublicKey:e.signer_public_key};r.push($);break;case"passkey":let k={type:e.type,enrolledInMfa:e.enrolled_in_mfa,credentialId:e.credential_id,authenticatorName:e.authenticator_name,createdWithDevice:e.created_with_device,createdWithOs:e.created_with_os,createdWithBrowser:e.created_with_browser,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(k);break;case"telegram":let M={type:e.type,telegramUserId:e.telegram_user_id,firstName:e.first_name,lastName:e.last_name,username:e.username,photoUrl:e.photo_url,verifiedAt:a(e.first_verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(M);break;default:console.warn(`Unrecognized account type: ${n}. Please consider upgrading the Privy SDK.`)}}return r}function f(t,r){return t.slice().sort((e,n)=>(n.firstVerifiedAt??n.verifiedAt).getTime()-(e.firstVerifiedAt??e.verifiedAt).getTime()).find(e=>e.type===r)}var K=t=>t?.linkedAccounts.find(r=>r.type==="wallet"&&r.walletClientType==="privy"&&!r.imported&&r.chainType==="ethereum"&&r.walletIndex===0)||null,Qt=t=>t?.linkedAccounts.filter(r=>r.type==="wallet"&&r.walletClientType==="privy"&&!r.imported&&r.chainType==="ethereum"),we=t=>t?.linkedAccounts.filter(r=>r.type==="wallet"&&r.walletClientType==="privy"&&r.chainType==="ethereum"),ke=t=>t?.linkedAccounts.find(r=>r.type==="wallet"&&r.walletClientType==="privy"&&!r.imported&&r.chainType==="solana")||null,Xt=t=>t?.linkedAccounts.find(r=>r.type==="wallet"&&r.walletClientType==="privy"&&r.imported&&r.chainType==="ethereum")||null,qt=(t,r)=>{let e=we(t).find(i=>H(i.address)===H(r)),n=e?e.imported?e:K(t):void 0;return{signingWallet:e,rootWallet:n}},xe=t=>t.linkedAccounts.filter(r=>r.type==="wallet"),Yt=(t,r)=>K(t)||ke(t)?!1:r==="all-users"||r==="users-without-wallets"&&!xe(t)?.length;function er(t){if(!t)return null;let r=We(t.linked_accounts),e=f(r,"wallet"),n=f(r,"smart_wallet"),i=f(r,"email"),o=f(r,"phone"),s=f(r,"google_oauth"),c=f(r,"twitter_oauth"),l=f(r,"discord_oauth"),u=f(r,"github_oauth"),d=f(r,"spotify_oauth"),h=f(r,"instagram_oauth"),p=f(r,"tiktok_oauth"),g=f(r,"linkedin_oauth"),w=f(r,"apple_oauth"),m=f(r,"farcaster"),v=f(r,"telegram"),E=t.mfa_methods.map(({type:k,verified_at:M})=>({type:k,verifiedAt:a(M)}));return{id:t.id,createdAt:a(t.created_at),linkedAccounts:r,email:i&&{address:i?.address},phone:o&&{number:o?.number},wallet:e&&{address:e.address,chainType:e.chainType,chainId:e.chainId,walletClient:e.walletClient,walletClientType:e.walletClientType,connectorType:e.connectorType,recoveryMethod:e.recoveryMethod,imported:e.imported,walletIndex:e.walletIndex},smartWallet:n&&{address:n.address,smartWalletType:n.smartWalletType},google:s&&{subject:s.subject,email:s.email,name:s.name},twitter:c&&{subject:c.subject,username:c.username,name:c.name,profilePictureUrl:c.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:u&&{subject:u.subject,username:u.username,name:u.name,email:u.email},spotify:d&&{subject:d.subject,email:d.email,name:d.name},instagram:h&&{subject:h.subject,username:h.username},tiktok:p&&{subject:p.subject,username:p.username,name:p.name},linkedin:g&&{subject:g.subject,name:g.name,email:g.email,vanityName:g.vanityName},apple:w&&{subject:w.subject,email:w.email},farcaster:m&&{fid:m.fid,ownerAddress:m.ownerAddress,displayName:m.displayName,username:m.username,bio:m.bio,pfp:m.pfp,url:m.url,signerPublicKey:m.signerPublicKey},telegram:v&&{telegramUserId:v.telegramUserId,firstName:v.firstName,lastName:v.lastName,username:v.username,photoUrl:v.photoUrl},mfaMethods:E.map(k=>k.type),hasAcceptedTerms:t.has_accepted_terms??!1,isGuest:t.is_guest,customMetadata:t.custom_metadata}}import{useEffect as Pe,useState as Te}from"react";var nr=t=>{let[r,e]=Te("auto");return Pe(()=>{let n=new ResizeObserver(i=>{e(i[0]?.contentRect.height??"auto")});return t.current&&n.observe(t.current),()=>{t.current&&n.unobserve(t.current)}},[t.current]),r};import J from"styled-components";import{jsx as z}from"react/jsx-runtime";var Z=({...t})=>z("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:z("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:t.color||"var(--privy-color-foreground-3)"})});import{jsx as W,jsxs as Q}from"react/jsx-runtime";var I=J.div`
|
|
1
|
+
import{i as _,oa as F,ra as D,sa as b,ta as V}from"./chunk-V5T6BXGX.js";import{useContext as he}from"react";import{createContext as de,useContext as pe,useEffect as fe}from"react";var tt={login:{onComplete:[],onError:[],onOAuthLoginComplete:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},setWalletRecovery:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},sendSolanaTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]},oAuthAuthorization:{onOAuthTokenGrant:[]},fundWallet:{onUserExited:[]},customAuth:{onAuthenticated:[],onUnauthenticated:[]}},me=de(void 0),N=()=>pe(me);function y(t,r){if(!r)return;let n=N().current[t];return fe(()=>{for(let[i,o]of Object.entries(r))n.hasOwnProperty(i)||console.warn(`Invalid event type "${i}" for action "${t}"`),n[i]?.push(o);return()=>{for(let[i,o]of Object.entries(r))n.hasOwnProperty(i)||console.warn(`Invalid event type "${i}" for action "${t}"`),n[i]=n[i]?.filter(s=>s!==o)}},[r])}function ye(t,r,e,...n){for(let i of t.current[r][e])i(...n)}function rt(){let t=N();return(r,e,...n)=>ye(t,r,e,...n)}function st(t){let{logout:r}=he(b);return y("logout",t),{logout:r}}import{useContext as ve}from"react";function pt(t){let{login:r}=ve(b);return y("login",t),{login:r}}import{useContext as ge}from"react";function vt(t){let{connectWallet:r}=ge(b);return y("connectWallet",t),{connectWallet:r}}var At=t=>{y("fundWallet",t);let{fundWallet:r}=V();return{fundWallet:r}};var S=class{constructor(){this._cache={}}get(r){return this._cache[r]}put(r,e){e!==void 0?this._cache[r]=e:this.del(r)}del(r){delete this._cache[r]}getKeys(){return Object.keys(this._cache)}},P=class{get(r){let e=localStorage.getItem(r);return e===null?void 0:JSON.parse(e)}put(r,e){e!==void 0?localStorage.setItem(r,JSON.stringify(e)):this.del(r)}del(r){localStorage.removeItem(r)}getKeys(){return Object.entries(localStorage).map(([r])=>r)}};function wt(){try{let t="privy:__session_storage__test",r="blobby",e=new P;return e.put(t,r),e.del(t),!0}catch{return!1}}function _e(){return typeof window<"u"&&window.localStorage?new P:new S}var A=_e();function B(){let t=window,r=t.ethereum;if(!r)return[];let e=[];if(r.providers?.length)for(let n of r.providers)n&&e.push(n);return e.push(t.ethereum),e}var T=t=>{if(t.isApexWallet)return"Apex Wallet";if(t.isAvalanche)return"Core Wallet";if(t.isBackpack)return"Backpack";if(t.isBifrost)return"Bifrost Wallet";if(t.isBitKeep)return"BitKeep";if(t.isBitski)return"Bitski";if(t.isBlockWallet)return"BlockWallet";if(t.isBraveWallet)return"Brave Wallet";if(t.isClover)return"Clover";if(t.isCoin98)return"Coin98 Wallet";if(t.isCoinbaseWallet)return"Coinbase Wallet";if(t.isDawn)return"Dawn Wallet";if(t.isDefiant)return"Defiant";if(t.isDesig)return"Desig Wallet";if(t.isEnkrypt)return"Enkrypt";if(t.isExodus)return"Exodus";if(t.isFordefi)return"Fordefi";if(t.isFrame)return"Frame";if(t.isFrontier)return"Frontier Wallet";if(t.isGamestop)return"GameStop Wallet";if(t.isHaqqWallet)return"HAQQ Wallet";if(t.isHyperPay)return"HyperPay Wallet";if(t.isImToken)return"ImToken";if(t.isHaloWallet)return"Halo Wallet";if(t.isKuCoinWallet)return"KuCoin Wallet";if(t.isMathWallet)return"MathWallet";if(t.isNovaWallet)return"Nova Wallet";if(t.isOkxWallet||t.isOKExWallet)return"OKX Wallet";if(t.isOneInchIOSWallet||t.isOneInchAndroidWallet)return"1inch Wallet";if(t.isOneKey)return"OneKey Wallet";if(t.isOpera)return"Opera";if(t.isPhantom)return"Phantom";if(t.isPortal)return"Ripio Portal";if(t.isRabby)return"Rabby Wallet";if(t.isRainbow)return"Rainbow";if(t.isSafePal)return"SafePal Wallet";if(t.isStatus)return"Status";if(t.isSubWallet)return"SubWallet";if(t.isTalisman)return"Talisman";if(t.isTally||t.isTaho)return"Taho";if(t.isTokenPocket)return"TokenPocket";if(t.isTokenary)return"Tokenary";if(t.isTrust||t.isTrustWallet)return"Trust Wallet";if(t.isTTWallet)return"TTWallet";if(t.isXDEFI)return"XDEFI Wallet";if(t.isZeal)return"Zeal";if(t.isZerion)return"Zerion";if(t.isMetaMask)return"MetaMask"};var R=(t,r)=>{if(!t.isMetaMask)return!1;if(t.isMetaMask&&!r)return!0;if(t.isBraveWallet&&!t._events&&!t._state||T(t)!=="MetaMask")return!1;if(t.providers){for(let e of t.providers)if(!R(e))return!1}return!0},Tt=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Ct=()=>{let t=window;if(!t.ethereum)return!1;if(t.ethereum.isCoinbaseWallet)return!0;if(t.ethereum.providers){for(let r of t.ethereum.providers)if(r&&r.isCoinbaseWallet)return!0}return!1};import{StaticJsonRpcProvider as x}from"@ethersproject/providers";var It=(t,r)=>{let e=[],n=[];for(let[i,o]of t.entries())i<r?e.push(o):n.push(o);return[e,n]},Ut=t=>!!String(t).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),Lt=(t,r)=>{let e=t.slice(0),n=[];for(;e.length;)n.push(e.splice(0,r));return n},O=(t,r=3,e=4,n="ethereum")=>{if(!t)return"";let i=n==="ethereum"?2:0,o=3;if(r+e+i+o>=t.length)return t;let s=t.slice(0,i+r),c=t.slice(t.length-e,t.length);return`${s}...${c}`},be=t=>new Promise(r=>setTimeout(r,t));function jt(t,{interval:r=100,timeout:e=5e3}={}){return new Promise((n,i)=>{let o=0,s,c=()=>{if(o>=e){i("Max attempts reached without result");return}if(s=t(),o+=r,s!=null){n(s);return}setTimeout(c,r)};c()})}var $t=(t,r={})=>{let e=r.delayMs||150,n=r.maxAttempts||270;return new Promise(async(i,o)=>{let s=!1,c=0;for(;!s&&c<n;){if(r.abortSignal?.aborted)return;t().then(l=>{s=!0,i(l)},(...l)=>{s=!0,o(...l)}),c+=1,await be(e)}s||o(new Error("Exceeded max attempts before resolving function"))})},Ft=(t,r,e={},n={})=>{let i=new URL(r,t);for(let[s,c]of Object.entries(e))c!==void 0&&i.searchParams.set(s,c);let o=Object.entries(n);if(o.length>0){let s=new URLSearchParams;for(let[c,l]of o)s.append(c,l);i.hash=s.toString()}return i.href};var Dt=t=>t.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),Vt=t=>typeof t=="string"?t:"0x"+t.toString(16);async function Nt(t,r,e,n=3e3){let i=!1,o=window;return new Promise(s=>{o.ethereum?c():(window.addEventListener("ethereum#initialized",c,{once:!0}),setTimeout(()=>{c()},n));function c(){if(i)return;i=!0,window.removeEventListener("ethereum#initialized",c);let l=t.getProviders();console.debug("Detected injected providers:",l.map(d=>d.info));let u=[];for(let d of l)r.includes("coinbase_wallet")&&d.info.rdns==="com.coinbase.wallet"||u.push({type:d.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:d});for(let d of B()){let h=T(d);if(!l.some(p=>p.info.name===h)){if(R(d,!0)&&!u.find(p=>p.type==="metamask")){u.push({type:"metamask",legacyInjectedProvider:d});continue}if(h==="Phantom"&&!u.find(p=>p.type==="phantom")){u.push({type:"phantom",legacyInjectedProvider:d});continue}if(h==="Coinbase Wallet"&&!u.find(p=>p.type==="coinbase_wallet"&&e?.coinbaseWallet?.connectionOptions!=="smartWalletOnly")){u.push({type:"coinbase_wallet",legacyInjectedProvider:d});continue}u.find(p=>p.type==="unknown_browser_extension")||u.push({type:"unknown_browser_extension",legacyInjectedProvider:d})}}s(u)}})}function Bt(t){return`eip155:${String(Number(t))}`}var Gt=(t,r,e,n)=>{let i=Number(t),o=r.find(s=>s.id===i);if(!o)throw new _(`Unsupported chainId ${t}`,4901);return Ae(o,e,n)},Ae=(t,r,e)=>{let n=t.id,i=Number(t.id),o;if(t.rpcUrls.privyWalletOverride&&t.rpcUrls.privyWalletOverride.http[0])o=t.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[i])o=r.rpcUrls[i];else if(t.rpcUrls.privy?.http[0]){let s=new URL(t.rpcUrls.privy.http[0]);s.searchParams.append("privyAppId",e),o=s.toString()}else t.rpcUrls.public?.http[0]?o=t.rpcUrls.public.http[0]:o=t.rpcUrls.default?.http[0];if(!o)throw new _(`No RPC url found for ${n}`);return o},G=(t,r)=>{let e=Number(t),n=r.find(i=>i.id===e);if(!n)throw new _(`Unsupported chainId ${t}`,4901);return n.blockExplorers?.default.url},Ht=(t,r,e,n)=>{let i=Number(t),o=r.find(c=>c.id===i);if(!o)throw new _(`Unsupported chainId ${t}`,4901);let s;if(o.rpcUrls.privyWalletOverride&&o.rpcUrls.privyWalletOverride.http[0]?s=new x(o.rpcUrls.privyWalletOverride.http[0]):e.rpcUrls&&e.rpcUrls[i]?s=new x(e.rpcUrls[i]):o.rpcUrls.privy?.http[0]?s=new x({url:o.rpcUrls.privy.http[0],headers:{"privy-app-id":n.appId}}):o.rpcUrls.public?.http[0]?s=new x(o.rpcUrls.public.http[0]):s=new x(o.rpcUrls.default?.http[0]),!s)throw new _(`No RPC url found for ${t}`);return s},Kt=t=>{let r={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},e=t.types.EIP712Domain??Object.entries(t.domain).map(([n,i])=>{if(i!=null&&typeof n=="string"&&n in r)return{name:n,type:r[n]}}).filter(n=>n!==void 0);return{...t,types:{...t.types,EIP712Domain:e}}};function zt(t,{min:r,max:e}){return Math.min(Math.max(t,r),e)}import{getAddress as H}from"@ethersproject/address";function a(t){return t?new Date(t*1e3):null}function We(t){let r=[];for(let e of t){let n=e.type;switch(e.type){case"wallet":let i={address:e.address,type:e.type,imported:e.imported,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at),chainType:e.chain_type,chainId:e.chain_id,walletClient:e.wallet_client_type==="privy"?"privy":"unknown",walletClientType:e.wallet_client_type,connectorType:e.connector_type,recoveryMethod:e.recovery_method,walletIndex:e.wallet_index};r.push(i);break;case"smart_wallet":let o={address:e.address,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at),smartWalletType:e.smart_wallet_type};r.push(o);break;case"cross_app":let s={type:e.type,subject:e.subject,embeddedWallets:e.embedded_wallets,smartWallets:e.smart_wallets,providerApp:{id:e.provider_app_id},verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(s);break;case"email":let c={address:e.address,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(c);break;case"phone":let l={number:e.phoneNumber,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(l);break;case"google_oauth":let u={subject:e.subject,email:e.email,name:e.name,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(u);break;case"spotify_oauth":let d={subject:e.subject,email:e.email,name:e.name,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(d);break;case"instagram_oauth":let h={subject:e.subject,username:e.username,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(h);break;case"twitter_oauth":let p={subject:e.subject,username:e.username,name:e.name,type:e.type,profilePictureUrl:e.profile_picture_url,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(p);break;case"discord_oauth":let g={subject:e.subject,username:e.username,email:e.email,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(g);break;case"github_oauth":let w={subject:e.subject,username:e.username,name:e.name,email:e.email,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(w);break;case"tiktok_oauth":let m={subject:e.subject,username:e.username,name:e.name,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(m);break;case"linkedin_oauth":let v={subject:e.subject,name:e.name,email:e.email,vanityName:e.vanity_name,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(v);break;case"apple_oauth":let E={subject:e.subject,email:e.email,type:e.type,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(E);break;case"custom_auth":r.push({type:e.type,customUserId:e.custom_user_id,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)});break;case"farcaster":let $={type:e.type,fid:e.fid,ownerAddress:e.owner_address,displayName:e.display_name,username:e.username,bio:e.bio,pfp:e.profile_picture_url,url:e.homepage_url,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at),signerPublicKey:e.signer_public_key};r.push($);break;case"passkey":let k={type:e.type,enrolledInMfa:e.enrolled_in_mfa,credentialId:e.credential_id,authenticatorName:e.authenticator_name,createdWithDevice:e.created_with_device,createdWithOs:e.created_with_os,createdWithBrowser:e.created_with_browser,verifiedAt:a(e.verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(k);break;case"telegram":let M={type:e.type,telegramUserId:e.telegram_user_id,firstName:e.first_name,lastName:e.last_name,username:e.username,photoUrl:e.photo_url,verifiedAt:a(e.first_verified_at),firstVerifiedAt:a(e.first_verified_at),latestVerifiedAt:a(e.latest_verified_at)};r.push(M);break;default:console.warn(`Unrecognized account type: ${n}. Please consider upgrading the Privy SDK.`)}}return r}function f(t,r){return t.slice().sort((e,n)=>(n.firstVerifiedAt??n.verifiedAt).getTime()-(e.firstVerifiedAt??e.verifiedAt).getTime()).find(e=>e.type===r)}var K=t=>t?.linkedAccounts.find(r=>r.type==="wallet"&&r.walletClientType==="privy"&&!r.imported&&r.chainType==="ethereum"&&r.walletIndex===0)||null,Qt=t=>t?.linkedAccounts.filter(r=>r.type==="wallet"&&r.walletClientType==="privy"&&!r.imported&&r.chainType==="ethereum"),we=t=>t?.linkedAccounts.filter(r=>r.type==="wallet"&&r.walletClientType==="privy"&&r.chainType==="ethereum"),ke=t=>t?.linkedAccounts.find(r=>r.type==="wallet"&&r.walletClientType==="privy"&&!r.imported&&r.chainType==="solana")||null,Xt=t=>t?.linkedAccounts.find(r=>r.type==="wallet"&&r.walletClientType==="privy"&&r.imported&&r.chainType==="ethereum")||null,qt=(t,r)=>{let e=we(t).find(i=>H(i.address)===H(r)),n=e?e.imported?e:K(t):void 0;return{signingWallet:e,rootWallet:n}},xe=t=>t.linkedAccounts.filter(r=>r.type==="wallet"),Yt=(t,r)=>K(t)||ke(t)?!1:r==="all-users"||r==="users-without-wallets"&&!xe(t)?.length;function er(t){if(!t)return null;let r=We(t.linked_accounts),e=f(r,"wallet"),n=f(r,"smart_wallet"),i=f(r,"email"),o=f(r,"phone"),s=f(r,"google_oauth"),c=f(r,"twitter_oauth"),l=f(r,"discord_oauth"),u=f(r,"github_oauth"),d=f(r,"spotify_oauth"),h=f(r,"instagram_oauth"),p=f(r,"tiktok_oauth"),g=f(r,"linkedin_oauth"),w=f(r,"apple_oauth"),m=f(r,"farcaster"),v=f(r,"telegram"),E=t.mfa_methods.map(({type:k,verified_at:M})=>({type:k,verifiedAt:a(M)}));return{id:t.id,createdAt:a(t.created_at),linkedAccounts:r,email:i&&{address:i?.address},phone:o&&{number:o?.number},wallet:e&&{address:e.address,chainType:e.chainType,chainId:e.chainId,walletClient:e.walletClient,walletClientType:e.walletClientType,connectorType:e.connectorType,recoveryMethod:e.recoveryMethod,imported:e.imported,walletIndex:e.walletIndex},smartWallet:n&&{address:n.address,smartWalletType:n.smartWalletType},google:s&&{subject:s.subject,email:s.email,name:s.name},twitter:c&&{subject:c.subject,username:c.username,name:c.name,profilePictureUrl:c.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:u&&{subject:u.subject,username:u.username,name:u.name,email:u.email},spotify:d&&{subject:d.subject,email:d.email,name:d.name},instagram:h&&{subject:h.subject,username:h.username},tiktok:p&&{subject:p.subject,username:p.username,name:p.name},linkedin:g&&{subject:g.subject,name:g.name,email:g.email,vanityName:g.vanityName},apple:w&&{subject:w.subject,email:w.email},farcaster:m&&{fid:m.fid,ownerAddress:m.ownerAddress,displayName:m.displayName,username:m.username,bio:m.bio,pfp:m.pfp,url:m.url,signerPublicKey:m.signerPublicKey},telegram:v&&{telegramUserId:v.telegramUserId,firstName:v.firstName,lastName:v.lastName,username:v.username,photoUrl:v.photoUrl},mfaMethods:E.map(k=>k.type),hasAcceptedTerms:t.has_accepted_terms??!1,isGuest:t.is_guest,customMetadata:t.custom_metadata}}import{useEffect as Pe,useState as Te}from"react";var nr=t=>{let[r,e]=Te("auto");return Pe(()=>{let n=new ResizeObserver(i=>{e(i[0]?.contentRect.height??"auto")});return t.current&&n.observe(t.current),()=>{t.current&&n.unobserve(t.current)}},[t.current]),r};import J from"styled-components";import{jsx as z}from"react/jsx-runtime";var Z=({...t})=>z("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:z("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:t.color||"var(--privy-color-foreground-3)"})});import{jsx as W,jsxs as Q}from"react/jsx-runtime";var I=J.div`
|
|
2
2
|
margin-top: 16px;
|
|
3
3
|
font-size: 13px;
|
|
4
4
|
text-align: center;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var L=(t,n,o)=>{if(!n.has(t))throw TypeError("Cannot "+o)};var ut=(t,n,o)=>(L(t,n,"read from private field"),o?o.call(t):n.get(t)),ht=(t,n,o)=>{if(n.has(t))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(t):n.set(t,o)},gt=(t,n,o,s)=>(L(t,n,"write to private field"),s?s.call(t,o):n.set(t,o),o);var yt=(t,n,o)=>(L(t,n,"access private method"),o);var F="1.87.0-beta-20240920172644";var H="34357d3c125c2bcf2ce2bc3309d98715",_t="https://auth.privy.io",Ct=2e4,St=1400,At=2500,wt=4e3,Tt=F;var kt="privy:token",Pt="privy-token",xt="privy:refresh_token",Wt="privy-refresh-token",vt="privy:id_token",Ot="privy-id-token",It="privy-session",Ut="privy:session_transfer_token",De="privy:wallet",Lt="privy:caid",Rt=t=>`privy:guest:${t}`,Mt=t=>`privy:cross-app:${t}`,Nt="privy:state_code",Dt="privy:code_verifier",Ft="privy:headless_oauth",Ht="privy:oauth_disable_signup",jt=t=>`${De}:${t}`,Kt="privy:connectors",Yt="privy:connections";var Gt=12e4,Bt=1,qt="0x1",zt=3e4,Vt="https://api.moonpay.com/v1",Xt="https://api.moonpay.com/v1",$t="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Zt="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";var Jt="deprecated";var j={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-mainnet.rpc.privy.systems"]},alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}};var K={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0};var Y={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}};var G={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0};var B={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-mainnet.rpc.privy.systems"]},blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}}};var q={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0};var z={id:80085,network:"berachain-artio",name:"Berachain Artio",nativeCurrency:{name:"BERA",symbol:"BERA",decimals:18},rpcUrls:{default:{http:["https://berachain-artio.rpc.privy.systems"]},public:{http:["https://berachain-artio.rpc.privy.systems"]}},blockExplorers:{default:{name:"Beratrail",url:"https://artio.beratrail.io"}},testnet:!0};var V={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1};var X={id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0};var $={id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}};var Z={id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}};var J={id:17069,name:"Garnet Holesky",network:"garnet-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.garnetchain.com"]},public:{http:["https://rpc.garnetchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.garnetchain.com"}}};var Q={id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}};var ee={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1};var te={id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0};var ne={id:42,network:"lukso",name:"LUKSO",nativeCurrency:{name:"LUKSO",symbol:"LYX",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.lukso.network"],webSocket:["wss://ws-rpc.mainnet.lukso.network"]}},blockExplorers:{default:{name:"LUKSO Mainnet Explorer",url:"https://explorer.execution.mainnet.lukso.network"}}};var W={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://mainnet.rpc.privy.systems"]},alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}};var oe={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-mainnet.rpc.privy.systems"]},alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}};var se={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0};var ie={id:137,name:"Polygon Mainnet",network:"polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}};var ae={id:80002,name:"Polygon Amoy",network:"polygon-amoy",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0};var re={id:690,name:"Redstone",network:"redstone",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.redstonechain.com"]},public:{http:["https://rpc.redstonechain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.redstone.xyz/"}}};var le={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{privy:{http:["https://sepolia.rpc.privy.systems"]},alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0};var pe={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}};var ce={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0};var de={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0};var v=[j,K,le,W,oe,se,ie,ae,V,X,$,Z,B,q,z,ne,ee,te,Y,G,pe,de,ce,Q,re,J],Qn=new Set(v.map(t=>t.id));import{createContext as Fe,useContext as He}from"react";var e=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var je=Fe({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:e,login:e,connectOrCreateWallet:e,linkEmail:e,linkPhone:e,linkFarcaster:e,linkWallet:e,startCrossAppAuthFlow:e,linkGoogle:e,linkTwitter:e,linkDiscord:e,linkGithub:e,linkSpotify:e,linkInstagram:e,linkTelegram:e,linkTiktok:e,linkLinkedIn:e,linkApple:e,linkPasskey:e,updateEmail:e,updatePhone:e,logout:e,getAccessToken:e,getEthereumProvider:e,getEthersProvider:e,getWeb3jsProvider:e,unlinkEmail:e,unlinkPhone:e,unlinkWallet:e,unlinkGoogle:e,unlinkTwitter:e,unlinkDiscord:e,unlinkGithub:e,unlinkSpotify:e,unlinkInstagram:e,unlinkTiktok:e,unlinkLinkedIn:e,unlinkApple:e,unlinkCrossAppAccount:e,unlinkFarcaster:e,unlinkTelegram:e,unlinkPasskey:e,setActiveWallet:e,forkSession:e,createWallet:e,importWallet:e,signMessage:e,signTypedData:e,enrollInMfa:e,initEnrollmentWithSms:e,initEnrollmentWithTotp:e,initEnrollmentWithPasskey:e,promptMfa:e,init:e,submitEnrollmentWithSms:e,submitEnrollmentWithTotp:e,submitEnrollmentWithPasskey:e,unenroll:e,submit:e,cancel:e,sendTransaction:e,sendSolanaTransaction:e,exportWallet:e,setWalletPassword:e,setWalletRecovery:e,requestFarcasterSignerFromWarpcast:e,getFarcasterSignerPublicKey:e,signFarcasterMessage:e,createGuestAccount:e,initLoginWithEmail:e,initLoginWithSms:e,otpState:{status:"initial"},loginWithCode:e,fundWallet:e,initLoginWithHeadlessOAuth:e,loginWithHeadlessOAuth:e,generateSiweMessage:e,linkWithSiwe:e,signMessageWithCrossAppWallet:e,signTypedDataWithCrossAppWallet:e,sendTransactionWithCrossAppWallet:e,isHeadlessOAuthLoading:!1,isModalOpen:!1,mfaMethods:[]}),so=()=>He(je);import{createContext as Ke,useContext as Ye}from"react";var Ge=Ke(null);function ro(){let t=Ye(Ge);if(t===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return t}import{FetchError as Be}from"ofetch";var g=class extends Error{constructor(o,s,i){super(o);s instanceof Error&&(this.cause=s),this.privyErrorCode=i}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},O=class extends g{constructor(o,s,i,r,l,p){super(i,r,l);this.type=o;this.status=s,this.data=p}},u=class extends g{constructor(o,s,i){super(o,s,i);this.type="client_error"}},me=class extends u{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var ue=class extends g{constructor(o,s,i){super(o,s,i);this.type="connector_error"}},co=t=>{if(t instanceof g)return t;if(!(t instanceof Be))return qe(t);if(!t.response)return new O("api_error",null,t.message,t);let{type:n,message:o,error:s,code:i}=t.data;return new O(n||"ApiError",t.response.status,o||s,t,i,t.data)},qe=t=>t instanceof g?t:t instanceof Error?new u(t.message,t):new u(`Internal error: ${t}`);var he=class extends u{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},ge=class extends u{constructor(n="Embedded wallet error",o){super(n,o,"unknown_embedded_wallet_error")}},ye=class extends u{constructor(n="User must be authenticated"){super(n,void 0,"must_be_authenticated")}};var fe=class extends u{constructor(n){super("This application is in development mode and must be upgraded to production to log in new users.",n,"max_accounts_reached")}};import{useContext as Pe,useEffect as ke,useMemo as st,useState as it}from"react";import{createContext as at}from"react";var d={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:H,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"all"}},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};var be=({input:t})=>{if(!t||!t.primary[0])return;let n=[t.primary[0]],o=[];t.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`");for(let s of t.primary.slice(1))n.includes(s)?console.warn(`Duplicated login method: ${s}`):n.push(s);for(let s of t.overflow??[])!n.includes(s)&&!o.includes(s)?o.push(s):console.warn(`Duplicated login method: ${s}`);return{primary:n,overflow:o}};var ze=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets","rabby_wallet","safe"]),Ee=t=>ze.has(t),_e=(t,n,o)=>o.indexOf(t)===n,Ce=({input:t,overrides:n})=>n?n.primary.concat(n.overflow??[]).filter(Ee).filter(_e):t?t.filter(Ee).filter(_e):d.appearance.walletList;import y from"tinycolor2";var Se="#FFFFFF",Ve="#040217",Xe=Se,$e="#1E1E1D";function Ze(t){return t<.8&&t>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),t>.5?"light":"dark"}function m(t,n){let o=Math.max(0,Math.min(1,t.toHsl().l+n));return y({...t.toHsl(),l:o})}var Je="#51BA81",Qe="#FFB74D",et="#EC6351",tt=Se,nt=Ve;function Ae({backgroundTheme:t,accentHex:n}){let o;switch(t){case"light":o=Xe;break;case"dark":o=$e;break;default:o=t;break}let s=y(o),i=y(n),r=y(Je),l=y(Qe),p=y(et),a=Ze(s.getLuminance()),c=m(s,a==="light"?-.04:.11),h=m(s,a==="light"?-.88:.87),f=m(s,a==="light"?-.7:.75),b=m(s,a==="light"?-.43:.45).desaturate(a==="light"?60:20),E=m(s,a==="light"?-.08:.25).desaturate(a==="light"?60:20),_=m(i,.15),C=m(i,-.06),S=m(p,.3),A=m(l,.3),w=y(i.getLuminance()>.5?nt:tt),P=m(r,-.16),x=m(r,.4);return{colorScheme:a,background:s.toHslString(),background2:c.toHslString(),foreground:h.toHslString(),foreground2:f.toHslString(),foreground3:b.toHslString(),foreground4:E.toHslString(),accent:i.toHslString(),accentLight:_.toHslString(),accentDark:C.toHslString(),foregroundAccent:w.toHslString(),success:r.toHslString(),successDark:P.toHslString(),successLight:x.toHslString(),error:p.toHslString(),errorLight:S.toHslString(),warn:l.toHslString(),warnLight:A.toHslString()}}function R(t,n,o){let s=o?console.warn:()=>{},i,r,l,p,a,c,h,f,b,E,_,C,S,A,w;n?.loginMethods?(i=n.loginMethods.includes("email"),r=n.loginMethods.includes("sms"),p=n.loginMethods.includes("wallet"),a=n.loginMethods.includes("google"),c=n.loginMethods.includes("twitter"),h=n.loginMethods.includes("discord"),b=n.loginMethods.includes("spotify"),E=n.loginMethods.includes("instagram"),f=n.loginMethods.includes("tiktok"),C=n.loginMethods.includes("github"),_=n.loginMethods.includes("linkedin"),S=n.loginMethods.includes("apple"),A=n.loginMethods.includes("farcaster"),w=n.loginMethods.includes("telegram")):(i=t.emailAuth,r=t.smsAuth,p=t.walletAuth,a=t.googleOAuth,c=t.twitterOAuth,h=t.discordOAuth,C=t.githubOAuth,b=t.spotifyOAuth,E=t.instagramOAuth,f=t.tiktokOAuth,_=t.linkedinOAuth,S=t.appleOAuth,A=t.farcasterAuth,w=t.telegramAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?l=!1:t.passkeyAuth&&(l=!0);let P=[i,r].filter(Boolean),x=[a,c,h,C,b,E,f,_,S,A,w].filter(Boolean),I=[p].filter(Boolean);if(P.length+x.length+I.length===0)throw new Error("You must enable at least one login method");let T=n?.appearance?.showWalletLoginFirst!==void 0?n?.appearance?.showWalletLoginFirst:t.showWalletLoginFirst;T&&I.length===0?(s("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),T=!1):!T&&x.length+P.length===0&&(s("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),T=!0);let We=n?.externalWallets?.walletConnect?.enabled??!0;n?.loginMethods&&n.loginMethodsAndOrder&&s("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let ve=Ce({input:n?.appearance?.walletList,overrides:n?.loginMethodsAndOrder}),Oe=be({input:n?.loginMethodsAndOrder}),Ie=n?.intl?.defaultCountry??"US",{chains:Ue,defaultChain:Le}=ot({additionalChains:n?.additionalChains,supportedChains:n?.supportedChains,defaultChainFromConfig:n?.defaultChain,hasRpcConfigDefined:Object.keys(n?.rpcConfig?.rpcUrls??{}).length>0}),Re=!!n?.defaultChain,U=n?.customAuth?.getCustomAccessToken&&n?.customAuth?.enabled!==!1,k,N=!(t.enforceWalletUis??!0);if(t.legacyWalletUiConfig??!0?U?k=n?.embeddedWallets?.noPromptOnSignature??!0:k=n?.embeddedWallets?.noPromptOnSignature??N:k=N,n?.embeddedWallets?.waitForTransactionConfirmation===!1&&k!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:D,...Me}=n?.embeddedWallets??{};return{id:t.id,name:t.name,allowlistConfig:t.allowlistConfig,legacyWalletUiConfig:t.legacyWalletUiConfig,appearance:{logo:n?.appearance?.logo??t.logoUrl,landingHeader:n?.appearance?.landingHeader??d.appearance.landingHeader,loginMessage:typeof n?.appearance?.loginMessage=="string"?n?.appearance?.loginMessage.slice(0,100):n?.appearance?.loginMessage,palette:Ae({backgroundTheme:n?.appearance?.theme??d.appearance.theme,accentHex:n?.appearance?.accentColor??t.accentColor??d.appearance.accentColor}),loginGroupPriority:T?"web3-first":"web2-first",hideDirectWeb2Inputs:!!n?.appearance?.hideDirectWeb2Inputs,walletList:ve,walletChainType:n?.appearance?.walletChainType??"ethereum-only"},loginMethods:{wallet:p,email:i,sms:r,passkey:l,google:a,twitter:c,discord:h,github:C,spotify:b,instagram:E,tiktok:f,linkedin:_,apple:S,farcaster:A,telegram:w},loginMethodsAndOrder:Oe,legal:{termsAndConditionsUrl:n?.legal?.termsAndConditionsUrl??t.termsAndConditionsUrl,privacyPolicyUrl:n?.legal?.privacyPolicyUrl??t.privacyPolicyUrl,requireUsersAcceptTerms:t.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:n?.walletConnectCloudProjectId??t.walletConnectCloudProjectId??d.walletConnectCloudProjectId,rpcConfig:{rpcUrls:n?.rpcConfig?.rpcUrls??d.rpcConfig.rpcUrls,rpcTimeouts:n?.rpcConfig?.rpcTimeouts??d.rpcConfig.rpcTimeouts},chains:Ue,defaultChain:Le,intl:{defaultCountry:Ie},shouldEnforceDefaultChainOnConnect:Re,captchaEnabled:t.captchaEnabled??d.captchaEnabled,captchaSiteKey:t.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:n?.externalWallets?.coinbaseWallet?.connectionOptions??d.externalWallets.coinbaseWallet.connectionOptions},walletConnect:{enabled:We},solana:{connectors:n?.externalWallets?.solana?.connectors}},embeddedWallets:{...t.embeddedWalletConfig,...typeof D=="boolean"?{requireUserOwnedRecoveryOnCreate:D}:{},...U?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...Me,noPromptOnSignature:k},mfa:{methods:t.mfaMethods??[],noPromptOnMfaRequired:n?.mfa?.noPromptOnMfaRequired??!1},customAuth:U?{enabled:!0,...n.customAuth}:void 0,loginConfig:{telegramAuthConfiguration:t.telegramAuthConfiguration},headless:!!n?.headless,render:{standalone:n?._render?.standalone??d._render.standalone},fundingConfig:t.fundingConfig,fundingMethodConfig:{...n?.fundingMethodConfig??d.fundingMethodConfig,moonpay:{...n?.fundingMethodConfig?.moonpay??d.fundingMethodConfig.moonpay,useSandbox:n?.fundingMethodConfig?.moonpay.useSandbox??n?.fiatOnRamp?.useSandbox??d.fundingMethodConfig.moonpay.useSandbox}}}}function we(t,n){if(!t)return{legacyCreateEmbeddedWalletFlag:n};let{appearance:o,additionalChains:s,supportedChains:i,defaultChain:r,externalWallets:l,...p}=t;return{...p,...s?{additionalChains:s.map(c=>c.id)}:void 0,...i?{supportedChains:i.map(c=>c.id)}:void 0,...r?{defaultChain:r.id}:void 0,...l?{walletConnect:l.walletConnect,coinbaseWallet:l.coinbaseWallet,solana:{connectors:l.solana?.connectors?.get().map(c=>c.walletClientType)}}:void 0,legacyCreateEmbeddedWalletFlag:n}}function ot({additionalChains:t,supportedChains:n,defaultChainFromConfig:o,hasRpcConfigDefined:s}){let i;if(t&&n&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),n){if(n.length===0)throw new Error("`supportedChains` must contain at least one chain");n.filter(a=>a.rpcUrls.privyWalletOverride).length>0&&s&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),i=n.map(a=>a.rpcUrls.privyWalletOverride?a:v.find(h=>h.id===a.id)??a)}else i=v.concat(t??[]);let r=n?i[0]:W,l=o??r;if(!i.find(p=>p.id===l.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:i,defaultChain:l}}var Te=function(t,n=0){let o=3735928559^n,s=1103547991^n;for(let i=0,r;i<t.length;i++)r=t.charCodeAt(i),o=Math.imul(o^r,2654435761),s=Math.imul(s^r,1597334677);return o=Math.imul(o^o>>>16,2246822507),o^=Math.imul(s^s>>>13,3266489909),s=Math.imul(s^s>>>16,2246822507),s^=Math.imul(o^o>>>13,3266489909),4294967296*(2097151&s)+(o>>>0)};import{jsx as lt}from"react/jsx-runtime";var xe={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},rt=R(xe,void 0,!1),M=at({appConfig:rt,isServerConfigLoaded:!1}),Uo=({children:t,legacyCreateEmbeddedWalletFlag:n,client:o,clientConfig:s})=>{let[i,r]=it(null),l=st(()=>R(i??xe,s,!!i),[i,s]);return ke(()=>{if(!i)return;let p=we(s,n),a=Te(JSON.stringify(p)).toString(),c=`privy:sent:${i.id}:${a}`;localStorage.getItem(c)||(o.createAnalyticsEvent({eventName:"sdk_initialize",payload:p}),localStorage.setItem(c,"t"))},[s,n,i]),ke(()=>{i||(async()=>{try{let a=await o.getServerConfig();a.customApiUrl&&o.updateApiUrl(a.customApiUrl),r(a)}catch(a){console.warn("Error generating app config: ",a)}})()},[]),lt(M.Provider,{value:{appConfig:l,isServerConfigLoaded:!!i},children:t})},Lo=()=>{let{appConfig:t}=Pe(M);return t},Ro=()=>{let{isServerConfigLoaded:t}=Pe(M);return t};import{createContext as pt,useContext as ct}from"react";var dt=pt({isNewUserThisSession:!1,walletConnectionStatus:null,connectors:[],solanaWallets:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,client:null,appId:"notAdded",customAuthStatus:{status:"not-enabled"},noPromptOnSignature:{current:!1},nativeTokenSymbolForChainId:e,initializeWalletProxy:e,getAuthMeta:e,getAuthFlow:e,closePrivyModal:e,openPrivyModal:e,connectWallet:e,initLoginWithWallet:e,loginWithWallet:e,initLoginWithFarcaster:e,loginWithFarcaster:e,loginWithCode:e,initLoginWithEmail:e,initLoginWithSms:e,initUpdateEmail:e,initUpdatePhone:e,resendEmailCode:e,resendSmsCode:e,initLoginWithHeadlessOAuth:e,loginWithHeadlessOAuth:e,crossAppAuthFlow:e,initLoginWithOAuth:e,recoveryOAuthFlow:e,loginWithOAuth:e,passkeyAuthState:{status:"initial"},setPasskeyAuthState:e,initLoginWithPasskey:e,loginWithPasskey:e,initLinkWithPasskey:e,linkWithPasskey:e,refreshUser:e,loginWithGuestAccountFlow:e,walletProxy:null,createAnalyticsEvent:e,acceptTerms:e,getUsdTokenPrice:e,getUsdPriceForSol:e,recoverEmbeddedEthereumWallet:e,getMoonpaySignedUrl:e,initCoinbaseOnRamp:e,getCoinbaseOnRampStatus:e,updateWallets:e,fundWallet:e,setReadyToTrue:e,requestFarcasterSignerStatus:e,initLoginWithTelegram:e,loginWithTelegram:e,generateSiweMessage:e,linkWithSiwe:e,linkSmartWallet:e,embeddedSolanaWallet:null,createEmbeddedSolanaWallet:e,recoverEmbeddedSolanaWallet:e,exportSolanaWallet:e,solanaSignMessage:e,connectCoinbaseSmartWallet:e,initiateAccountTransfer:e}),Ho=()=>ct(dt);export{ut as a,ht as b,gt as c,yt as d,g as e,O as f,u as g,me as h,ue as i,co as j,qe as k,he as l,ge as m,ye as n,fe as o,_t as p,Ct as q,St as r,At as s,wt as t,Tt as u,kt as v,Pt as w,xt as x,Wt as y,vt as z,Ot as A,It as B,Ut as C,Lt as D,Rt as E,Mt as F,Nt as G,Dt as H,Ft as I,Ht as J,jt as K,Kt as L,Yt as M,Gt as N,Bt as O,qt as P,zt as Q,Vt as R,Xt as S,$t as T,Zt as U,Jt as V,e as W,j as X,K as Y,Y as Z,G as _,B as $,q as aa,V as ba,ee as ca,W as da,oe as ea,se as fa,ie as ga,ae as ha,le as ia,pe as ja,v as ka,Qn as la,rt as ma,Uo as na,Lo as oa,Ro as pa,dt as qa,Ho as ra,je as sa,so as ta,Ge as ua,ro as va};
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as I,B as J,C as K,D as L,E as M,F as N,G as O,H as P,I as Q,J as R,K as S,L as T,M as U,a as b,b as c,c as d,d as e,f as g,g as h,h as i,i as k,j as m,k as n,l as o,m as r,n as s,o as t,p as u,q as v,r as x,s as y,t as z,u as A,v as B,w as
|
|
1
|
+
import{A as I,B as J,C as K,D as L,E as M,F as N,G as O,H as P,I as Q,J as R,K as S,L as T,M as U,N as V,a as b,b as c,c as d,d as e,f as g,g as h,h as i,i as k,j as m,k as n,l as o,m as r,n as s,o as t,p as u,q as v,r as x,s as y,t as z,u as A,v as B,w as C,x as E,y as G,z as H}from"./chunk-LTAXBMI2.js";import{R as l,aa as w,ba as D,ca as F}from"./chunk-NGIQBA55.js";import{c as p,f as W}from"./chunk-4GRYKTVV.js";import{ka as f,ta as j,u as a,va as q}from"./chunk-V5T6BXGX.js";export{d as AsExternalProvider,i as Captcha,g as ConnectorManager,e as EthereumWalletConnector,t as LoginModal,h as PrivyClient,v as PrivyProvider,c as PrivyProxyProvider,f as SUPPORTED_CHAINS,a as VERSION,b as WalletConnector,p as addRpcUrlOverrideToChain,o as errorIndicatesMaxMfaRetries,m as errorIndicatesMfaTimeout,n as errorIndicatesMfaVerificationFailed,u as getAccessToken,W as getEmbeddedConnectedWallet,H as useConnectCoinbaseSmartWallet,D as useConnectWallet,E as useCreateWallet,I as useCrossAppAccounts,T as useCustomAuth,U as useExperimentalFarcasterSigner,V as useFarcasterSigner,F as useFundWallet,M as useGuestAccounts,C as useLinkAccount,B as useLinkWithSiwe,w as useLogin,y as useLoginWithEmail,x as useLoginWithOAuth,z as useLoginWithPasskey,A as useLoginWithSms,l as useLogout,r as useMfa,s as useMfaEnrollment,Q as useModalStatus,S as useOAuthTokens,j as usePrivy,k as useRegisterMfaListener,K as useSendSolanaTransaction,J as useSendTransaction,L as useSetWalletPassword,N as useSetWalletRecovery,O as useSignMessage,P as useSignTypedData,G as useSolanaWallets,R as useToken,q as useWallets};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as I,d as _,e as G,f as b}from"./chunk-
|
|
1
|
+
import{b as I,d as _,e as G,f as b}from"./chunk-4GRYKTVV.js";import{g as A,oa as E,ra as h,ta as N,va as F}from"./chunk-V5T6BXGX.js";import{createContext as ee,useContext as te,useEffect as L,useState as B}from"react";import{createSmartAccountClient as $}from"permissionless";import{toBiconomySmartAccount as q,toEcdsaKernelSmartAccount as Q,toLightSmartAccount as V,toSafeSmartAccount as Y}from"permissionless/accounts";import{createPimlicoClient as j}from"permissionless/clients/pimlico";import{createPublicClient as O,http as x}from"viem";import{entryPoint06Address as K,entryPoint07Address as z}from"viem/account-abstraction";var J=({calls:r,chain:t,maxPriorityFeePerGas:n,maxFeePerGas:o,nonce:l})=>r.map(c=>({to:c.to||void 0,data:c.data,value:c.value,chainId:t.id,nonce:l,maxFeePerGas:o,maxPriorityFeePerGas:n})),H=()=>{let{chains:r,noPromptOnSignature:t,openPrivyModal:n}=h(),o=E(),{setModalData:l}=I();return{getSmartWalletClient:async(c,P,i,T)=>{let u=_(r),p=G(i.chainId),d=u.find(e=>e.id===p);if(!d)throw new Error(`Error finding chain object for smart wallet network ${i.chainId} in app config. Please ensure you have a chain object for ${i.chainId} in app config.`);let C=await c.getEthereumProvider(),{sendTransaction:S,signMessage:y,signTypedData:W,...a}=await Z({owner:C,smartWalletType:P,chain:d,paymasterContext:T,...i});return{...a,sendTransaction:async e=>{if(o.embeddedWallets.noPromptOnSignature||t.current)return await S(e);let m=[];"calls"in e&&typeof e.calls<"u"?m=[...e.calls]:"to"in e&&(m=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let g=async()=>{if(!a.paymaster)return!1;let{paymasterAndData:f,paymasterData:v}=await a.prepareUserOperation({calls:m,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return Number(f??v??0)>0};return new Promise(async(f,v)=>{t.current=!0,l({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:()=>{}},sendTransaction:{transactionRequests:J({calls:m,chain:d,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),rootWallet:{address:a.account.address},transactingWallet:{address:a.account.address,walletIndex:null},getIsSponsored:g,onConfirm:()=>S(e),onSuccess:k=>f(k.hash),onFailure:v,uiOptions:{}}}),n("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1})},signMessage:async({message:e})=>o.embeddedWallets.noPromptOnSignature||t.current?await y({message:e}):new Promise(async(m,g)=>{t.current=!0,l({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>y({message:e}),onSuccess:f=>m(f),onFailure:g,uiOptions:{}}}),n("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1}),signTypedData:async e=>t.current?await W(e):new Promise(async(m,g)=>{t.current=!0,l({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>W(e),onSuccess:f=>m(f),onFailure:g,uiOptions:{}}}),n("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1})}}}},R={address:K,version:"0.6"},M={address:z,version:"0.7"},X=({owner:r,smartWalletType:t,chain:n})=>{let o=O({chain:n,transport:x()});switch(t){case"safe":return Y({client:o,entryPoint:M,owners:[r],version:"1.4.1"});case"kernel":return Q({client:o,version:"0.3.1",entryPoint:M,owners:[r]});case"biconomy":return q({client:o,owners:[r],entryPoint:R});case"light_account":return V({client:o,entryPoint:R,owner:r,version:"1.1.0"});default:throw new Error(`Invalid smart account type: ${t}.`)}},Z=async({owner:r,smartWalletType:t,chain:n,bundlerUrl:o,paymasterUrl:l,paymasterContext:c})=>{let P=O({chain:n,transport:x()}),i=await X({owner:r,smartWalletType:t,chain:n}),u=!!l?j({transport:x(l),entryPoint:i.entryPoint}):void 0;return $({account:i,chain:n,paymaster:u,paymasterContext:c,bundlerTransport:x(o),userOperation:{estimateFeesPerGas:async()=>{let p=await P.estimateFeesPerGas();return{...p,maxFeePerGas:p.maxFeePerGas*115n/100n,maxPriorityFeePerGas:p.maxPriorityFeePerGas*115n/100n}}}})};import{jsx as re}from"react/jsx-runtime";var U=ee({client:void 0}),ne=({config:r,children:t})=>{let[n,o]=B(null),{getSmartWalletClient:l}=H(),{generateSiweMessage:c,linkSmartWallet:P,client:i,noPromptOnSignature:T}=h(),{defaultChain:u}=E(),{wallets:p}=F(),{user:d}=N(),[C,S]=B(),y=b(p);return L(()=>{!n&&i&&(async()=>{try{if(!i){console.warn("No client found");return}let a=await i.getSmartWalletsConfig();o(a)}catch(a){console.warn("Error generating smart wallet config: ",a)}})()},[!!i]),L(()=>{(async()=>{if(!n?.enabled||!d||!y){S(void 0);return}if(C)return;let a=n.configuredNetworks.find(s=>s.chainId===`eip155:${u.id}`);if(!a)throw new A(`The defaultChain ${u.name} (eip155:${u.id}) must be configured in the smart wallet configuration in your dashboard`);if(d.smartWallet)try{let s=await l(y,d.smartWallet.smartWalletType,a,r?.paymasterContext);S(s);return}catch(s){console.error("Error loading smart wallet:",s);return}try{let s=await l(y,n.smartWalletType,a,r?.paymasterContext),w=await c({address:s.account.address,chainId:a.chainId});T.current=!0;let D=await s.signMessage({message:w});await P({signature:D,message:w,smartWalletType:n.smartWalletType}),S(s)}catch(s){console.error("Error creating smart wallet:",s)}finally{T.current=!1}})()},[!!n?.enabled,!!d?.smartWallet,!!y]),re(U.Provider,{value:{client:C},children:t})},ae=()=>te(U);export{ne as SmartWalletsProvider,ae as useSmartWallets};
|
package/dist/esm/solana.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as a,
|
|
1
|
+
import{e as a,y as m}from"./chunk-LTAXBMI2.js";import"./chunk-NGIQBA55.js";import"./chunk-4GRYKTVV.js";import"./chunk-V5T6BXGX.js";import{isWalletAdapterCompatibleStandardWallet as C}from"@solana/wallet-adapter-base";import{StandardWalletAdapter as S}from"@solana/wallet-standard-wallet-adapter-base";import{getWallets as f}from"@wallet-standard/app";var u=l=>{let{get:r,on:c}=f(),p=l?.shouldAutoConnect??!0,t=i(r()),e=t.map(o=>new a(o,p)),s=[],d;return{_setOnConnectorsUpdated:o=>{d=o},onMount:()=>{s.push(c("register",(...o)=>{t=t.concat(...i(o)),e=t.map(n=>new a(n,p)),d?.(e)}),c("unregister",(...o)=>{t=t.filter(n=>o.some(W=>n.wallet===W)),e=t.map(n=>new a(n,p)),d?.(e)}))},onUnmount:()=>{let o=s.pop();for(;o;)o(),o=s.pop()},get:()=>e}},i=l=>l.filter(C).map(r=>new S({wallet:r}));export{a as SolanaAdapterConnector,u as toSolanaWalletConnectors,m as useSolanaWallets};
|
package/dist/esm/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{D as q,K as j,Q as e1,R as t1,V as o1,W as r1,Z as n1,aa as i1,ba as s1,ca as l1,h as I,r as Y,v as J}from"./chunk-
|
|
1
|
+
import{D as q,K as j,Q as e1,R as t1,V as o1,W as r1,Z as n1,aa as i1,ba as s1,ca as l1,h as I,r as Y,v as J}from"./chunk-NGIQBA55.js";import{oa as Q,ra as R,ta as g,va as w}from"./chunk-V5T6BXGX.js";import{jsx as a1}from"react/jsx-runtime";var p1=e=>a1("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:a1("path",{d:"M9.99999 10.8333C12.3012 10.8333 14.1667 8.96785 14.1667 6.66667C14.1667 4.36548 12.3012 2.5 9.99999 2.5C7.69881 2.5 5.83333 4.36548 5.83333 6.66667C5.83333 8.96785 7.69881 10.8333 9.99999 10.8333ZM9.99999 10.8333C11.7681 10.8333 13.4638 11.5357 14.714 12.786C15.9643 14.0362 16.6667 15.7319 16.6667 17.5M9.99999 10.8333C8.23188 10.8333 6.53619 11.5357 5.28595 12.786C4.03571 14.0362 3.33333 15.7319 3.33333 17.5",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});import P2 from"styled-components";var H=P2.button`
|
|
2
2
|
--size: ${({$size:e})=>`${e}px`};
|
|
3
3
|
|
|
4
4
|
-webkit-font-smoothing: antialiased;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import react__default, { MouseEvent } from 'react';
|
|
3
|
-
import { C as Chain, W as WalletConnector, B as BaseConnectedEthereumWallet, a as RpcConfig, P as PrivyProxyProvider, E as Embedded1193Provider, b as WalletClientType, c as ConnectedWalletMetadata, d as ConnectorType, e as WalletListEntry, f as ExternalWalletsConfig, g as BaseConnectedWallet, S as SolanaWalletConnector, h as EIP1193Provider, U as User, O as OAuthTokens, i as OAuthProviderType, M as MoonpaySignRequest, j as MoonpaySignResponse, k as SmartWalletConfig, l as PrivyServerConfig, m as PrivyFarcasterSignerInitResponse, L as LoginMethod, T as TelegramAuthResult, n as PrivyClientConfig, o as ConnectWalletModalOptions, p as LoginModalOptions, q as CreateWalletOptions, r as Wallet, s as SetWalletRecoveryOptions, t as SignMessageModalUIOptions, u as SignTypedDataParams, v as MfaMethod, w as UnsignedTransactionRequest, x as SendTransactionModalUIOptions, F as FundWalletConfig, y as TransactionReceipt, z as ConnectedWallet, A as PrivyIframeErrorTypesType, D as PrivyErrorCode, G as LinkedAccountWithMetadata, H as UserRecoveryMethod, I as FundingMethod, J as LoginWithCode, K as
|
|
4
|
-
export {
|
|
3
|
+
import { C as Chain, W as WalletConnector, B as BaseConnectedEthereumWallet, a as RpcConfig, P as PrivyProxyProvider, E as Embedded1193Provider, b as WalletClientType, c as ConnectedWalletMetadata, d as ConnectorType, e as WalletListEntry, f as ExternalWalletsConfig, g as BaseConnectedWallet, S as SolanaWalletConnector, h as EIP1193Provider, U as User, O as OAuthTokens, i as OAuthProviderType, M as MoonpaySignRequest, j as MoonpaySignResponse, k as SmartWalletConfig, l as PrivyServerConfig, m as PrivyFarcasterSignerInitResponse, L as LoginMethod, T as TelegramAuthResult, n as PrivyClientConfig, o as ConnectWalletModalOptions, p as LoginModalOptions, q as CreateWalletOptions, r as Wallet, s as SetWalletRecoveryOptions, t as SignMessageModalUIOptions, u as SignTypedDataParams, v as MfaMethod, w as UnsignedTransactionRequest, x as SendTransactionModalUIOptions, F as FundWalletConfig, y as TransactionReceipt, z as ConnectedWallet, A as PrivyIframeErrorTypesType, D as PrivyErrorCode, G as LinkedAccountWithMetadata, H as UserRecoveryMethod, I as FundingMethod, J as LoginWithCode, K as PasskeyFlowState, N as OtpFlowState, Q as UnsignedTransactionRequestWithChainId, V as CustomAuthFlowState } from './types-eaea6708.js';
|
|
4
|
+
export { ac as Apple, am as AppleOAuthWithMetadata, X as AsExternalProvider, aB as ConnectedSolanaWallet, au as ContractUIOptions, af as CrossAppAccount, ap as CrossAppAccountWithMetadata, a9 as Discord, ai as DiscordOAuthWithMetadata, ar as Email, a4 as EmailWithMetadata, ay as Farcaster, an as FarcasterWithMetadata, aa as Github, aj as GithubOAuthWithMetadata, a7 as Google, ag as GoogleOAuthWithMetadata, ab as LinkedIn, al as LinkedInOAuthWithMetadata, aA as LoginMethodOrderOption, Z as MessageTypes, _ as MoonpayConfig, $ as MoonpayCurrencyCode, aw as MoonpayFundingConfig, a0 as MoonpayPaymentMethod, av as NativeFundingConfig, a3 as NonEmptyArray, az as Passkey, aq as PasskeyWithMetadata, as as Phone, a5 as PhoneWithMetadata, ax as PriceDisplayOptions, a1 as Quantity, ae as Telegram, ao as TelegramWithMetadata, ad as Tiktok, ak as TiktokOAuthWithMetadata, a2 as TransactionLog, at as TransactionUIOptions, a8 as Twitter, ah as TwitterOAuthWithMetadata, Y as TypedMessage, a6 as WalletWithMetadata } from './types-eaea6708.js';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import { TurnstileProps } from '@marsidev/react-turnstile';
|
|
7
7
|
import EventEmitter from 'eventemitter3';
|
|
@@ -1822,6 +1822,27 @@ type UseLoginWithEmail = {
|
|
|
1822
1822
|
*/
|
|
1823
1823
|
declare const useLoginWithEmail: () => UseLoginWithEmail;
|
|
1824
1824
|
|
|
1825
|
+
type UseLoginWithPasskey = {
|
|
1826
|
+
/**
|
|
1827
|
+
* Logs in a user with a passkey without using any Privy UIs.
|
|
1828
|
+
*
|
|
1829
|
+
* @returns a Promise that resolves if the passkey is valid, or rejects if there was an error.
|
|
1830
|
+
*/
|
|
1831
|
+
loginWithPasskey: () => Promise<void>;
|
|
1832
|
+
/**
|
|
1833
|
+
* State of the passkey flow.
|
|
1834
|
+
*/
|
|
1835
|
+
state: PasskeyFlowState;
|
|
1836
|
+
};
|
|
1837
|
+
/**
|
|
1838
|
+
* @experimental
|
|
1839
|
+
*
|
|
1840
|
+
* Use this hook to log the user in with passkey, without using any Privy UIs.
|
|
1841
|
+
*
|
|
1842
|
+
* @returns loginWithPasskey - {@link loginWithPasskey} - logs a user in with a passkey
|
|
1843
|
+
*/
|
|
1844
|
+
declare const useLoginWithPasskey: (callbacks?: PrivyEvents["login"]) => UseLoginWithPasskey;
|
|
1845
|
+
|
|
1825
1846
|
type SendCodeToSms = {
|
|
1826
1847
|
phoneNumber: string;
|
|
1827
1848
|
};
|
|
@@ -2410,4 +2431,4 @@ declare const LoginModal: ({ open }: {
|
|
|
2410
2431
|
open: boolean;
|
|
2411
2432
|
}) => react_jsx_runtime.JSX.Element;
|
|
2412
2433
|
|
|
2413
|
-
export { CallbackError, Captcha, ConnectWalletModalOptions, ConnectedWallet, ConnectorManager, CustomAuthFlowState, EIP1193Provider, EthereumWalletConnector, FundWalletConfig, LoginModal, LoginModalOptions, LoginWithCode, MfaMethod, OAuthProviderType, OAuthTokens, PrivyClient, PrivyClientConfig, PrivyEvents, PrivyInterface, PrivyProvider, PrivyProviderProps, PrivyProxyProvider, DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, SendCodeToEmail, SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, SolanaTransactionReceipt, SupportedSolanaTransaction, TransactionReceipt, UnsignedTransactionRequest, UseConnectCoinbaseSmartWalletInterface, UseCustomAuth, UseFundWalletInterface, UseLoginWithEmail, UseLoginWithSms, UseOAuthTokens, UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, addRpcUrlOverrideToChain, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getAccessToken, getEmbeddedConnectedWallet, useConnectCoinbaseSmartWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useExperimentalFarcasterSigner, useFarcasterSigner, useFundWallet, useGuestAccounts, useLinkAccount, useLinkWithSiwe, useLogin, useLoginWithEmail, useLoginWithOAuth, useLoginWithSms, useLogout, useMfa, useMfaEnrollment, useModalStatus, useOAuthTokens, usePrivy, useRegisterMfaListener, useSendSolanaTransaction, useSendTransaction, useSetWalletPassword, useSetWalletRecovery, useSignMessage, useSignTypedData, useToken, useWallets };
|
|
2434
|
+
export { CallbackError, Captcha, ConnectWalletModalOptions, ConnectedWallet, ConnectorManager, CustomAuthFlowState, EIP1193Provider, EthereumWalletConnector, FundWalletConfig, LoginModal, LoginModalOptions, LoginWithCode, MfaMethod, OAuthProviderType, OAuthTokens, PasskeyFlowState, PrivyClient, PrivyClientConfig, PrivyEvents, PrivyInterface, PrivyProvider, PrivyProviderProps, PrivyProxyProvider, DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, SendCodeToEmail, SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, SolanaTransactionReceipt, SupportedSolanaTransaction, TransactionReceipt, UnsignedTransactionRequest, UseConnectCoinbaseSmartWalletInterface, UseCustomAuth, UseFundWalletInterface, UseLoginWithEmail, UseLoginWithPasskey, UseLoginWithSms, UseOAuthTokens, UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, addRpcUrlOverrideToChain, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getAccessToken, getEmbeddedConnectedWallet, useConnectCoinbaseSmartWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useExperimentalFarcasterSigner, useFarcasterSigner, useFundWallet, useGuestAccounts, useLinkAccount, useLinkWithSiwe, useLogin, useLoginWithEmail, useLoginWithOAuth, useLoginWithPasskey, useLoginWithSms, useLogout, useMfa, useMfaEnrollment, useModalStatus, useOAuthTokens, usePrivy, useRegisterMfaListener, useSendSolanaTransaction, useSendTransaction, useSetWalletPassword, useSetWalletRecovery, useSignMessage, useSignTypedData, useToken, useWallets };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkLTAXBMI2js = require('./chunk-LTAXBMI2.js');var _chunkNGIQBA55js = require('./chunk-NGIQBA55.js');var _chunk4GRYKTVVjs = require('./chunk-4GRYKTVV.js');var _chunkV5T6BXGXjs = require('./chunk-V5T6BXGX.js');exports.AsExternalProvider = _chunkLTAXBMI2js.c; exports.Captcha = _chunkLTAXBMI2js.h; exports.ConnectorManager = _chunkLTAXBMI2js.f; exports.EthereumWalletConnector = _chunkLTAXBMI2js.d; exports.LoginModal = _chunkLTAXBMI2js.o; exports.PrivyClient = _chunkLTAXBMI2js.g; exports.PrivyProvider = _chunkLTAXBMI2js.q; exports.PrivyProxyProvider = _chunkLTAXBMI2js.b; exports.SUPPORTED_CHAINS = _chunkV5T6BXGXjs.ka; exports.VERSION = _chunkV5T6BXGXjs.u; exports.WalletConnector = _chunkLTAXBMI2js.a; exports.addRpcUrlOverrideToChain = _chunk4GRYKTVVjs.c; exports.errorIndicatesMaxMfaRetries = _chunkLTAXBMI2js.l; exports.errorIndicatesMfaTimeout = _chunkLTAXBMI2js.j; exports.errorIndicatesMfaVerificationFailed = _chunkLTAXBMI2js.k; exports.getAccessToken = _chunkLTAXBMI2js.p; exports.getEmbeddedConnectedWallet = _chunk4GRYKTVVjs.f; exports.useConnectCoinbaseSmartWallet = _chunkLTAXBMI2js.z; exports.useConnectWallet = _chunkNGIQBA55js.ba; exports.useCreateWallet = _chunkLTAXBMI2js.x; exports.useCrossAppAccounts = _chunkLTAXBMI2js.A; exports.useCustomAuth = _chunkLTAXBMI2js.L; exports.useExperimentalFarcasterSigner = _chunkLTAXBMI2js.M; exports.useFarcasterSigner = _chunkLTAXBMI2js.N; exports.useFundWallet = _chunkNGIQBA55js.ca; exports.useGuestAccounts = _chunkLTAXBMI2js.E; exports.useLinkAccount = _chunkLTAXBMI2js.w; exports.useLinkWithSiwe = _chunkLTAXBMI2js.v; exports.useLogin = _chunkNGIQBA55js.aa; exports.useLoginWithEmail = _chunkLTAXBMI2js.s; exports.useLoginWithOAuth = _chunkLTAXBMI2js.r; exports.useLoginWithPasskey = _chunkLTAXBMI2js.t; exports.useLoginWithSms = _chunkLTAXBMI2js.u; exports.useLogout = _chunkNGIQBA55js.R; exports.useMfa = _chunkLTAXBMI2js.m; exports.useMfaEnrollment = _chunkLTAXBMI2js.n; exports.useModalStatus = _chunkLTAXBMI2js.I; exports.useOAuthTokens = _chunkLTAXBMI2js.K; exports.usePrivy = _chunkV5T6BXGXjs.ta; exports.useRegisterMfaListener = _chunkLTAXBMI2js.i; exports.useSendSolanaTransaction = _chunkLTAXBMI2js.C; exports.useSendTransaction = _chunkLTAXBMI2js.B; exports.useSetWalletPassword = _chunkLTAXBMI2js.D; exports.useSetWalletRecovery = _chunkLTAXBMI2js.F; exports.useSignMessage = _chunkLTAXBMI2js.G; exports.useSignTypedData = _chunkLTAXBMI2js.H; exports.useSolanaWallets = _chunkLTAXBMI2js.y; exports.useToken = _chunkLTAXBMI2js.J; exports.useWallets = _chunkV5T6BXGXjs.va;
|
package/dist/smart-wallets.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk4GRYKTVVjs = require('./chunk-4GRYKTVV.js');var _chunkV5T6BXGXjs = require('./chunk-V5T6BXGX.js');var _react = require('react');var _permissionless = require('permissionless');var _accounts = require('permissionless/accounts');var _pimlico = require('permissionless/clients/pimlico');var _viem = require('viem');var _accountabstraction = require('viem/account-abstraction');var J=({calls:r,chain:t,maxPriorityFeePerGas:n,maxFeePerGas:o,nonce:l})=>r.map(c=>({to:c.to||void 0,data:c.data,value:c.value,chainId:t.id,nonce:l,maxFeePerGas:o,maxPriorityFeePerGas:n})),H=()=>{let{chains:r,noPromptOnSignature:t,openPrivyModal:n}=_chunkV5T6BXGXjs.ra.call(void 0, ),o=_chunkV5T6BXGXjs.oa.call(void 0, ),{setModalData:l}=_chunk4GRYKTVVjs.b.call(void 0, );return{getSmartWalletClient:async(c,P,i,T)=>{let u=_chunk4GRYKTVVjs.d.call(void 0, r),p=_chunk4GRYKTVVjs.e.call(void 0, i.chainId),d=u.find(e=>e.id===p);if(!d)throw new Error(`Error finding chain object for smart wallet network ${i.chainId} in app config. Please ensure you have a chain object for ${i.chainId} in app config.`);let C=await c.getEthereumProvider(),{sendTransaction:S,signMessage:y,signTypedData:W,...a}=await Z({owner:C,smartWalletType:P,chain:d,paymasterContext:T,...i});return{...a,sendTransaction:async e=>{if(o.embeddedWallets.noPromptOnSignature||t.current)return await S(e);let m=[];"calls"in e&&typeof e.calls<"u"?m=[...e.calls]:"to"in e&&(m=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let g=async()=>{if(!a.paymaster)return!1;let{paymasterAndData:f,paymasterData:v}=await a.prepareUserOperation({calls:m,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return Number(_nullishCoalesce(_nullishCoalesce(f, () => (v)), () => (0)))>0};return new Promise(async(f,v)=>{t.current=!0,l({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:()=>{}},sendTransaction:{transactionRequests:J({calls:m,chain:d,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),rootWallet:{address:a.account.address},transactingWallet:{address:a.account.address,walletIndex:null},getIsSponsored:g,onConfirm:()=>S(e),onSuccess:k=>f(k.hash),onFailure:v,uiOptions:{}}}),n("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1})},signMessage:async({message:e})=>o.embeddedWallets.noPromptOnSignature||t.current?await y({message:e}):new Promise(async(m,g)=>{t.current=!0,l({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>y({message:e}),onSuccess:f=>m(f),onFailure:g,uiOptions:{}}}),n("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1}),signTypedData:async e=>t.current?await W(e):new Promise(async(m,g)=>{t.current=!0,l({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>W(e),onSuccess:f=>m(f),onFailure:g,uiOptions:{}}}),n("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1})}}}},R={address:_accountabstraction.entryPoint06Address,version:"0.6"},M={address:_accountabstraction.entryPoint07Address,version:"0.7"},X=({owner:r,smartWalletType:t,chain:n})=>{let o=_viem.createPublicClient.call(void 0, {chain:n,transport:_viem.http.call(void 0, )});switch(t){case"safe":return _accounts.toSafeSmartAccount.call(void 0, {client:o,entryPoint:M,owners:[r],version:"1.4.1"});case"kernel":return _accounts.toEcdsaKernelSmartAccount.call(void 0, {client:o,version:"0.3.1",entryPoint:M,owners:[r]});case"biconomy":return _accounts.toBiconomySmartAccount.call(void 0, {client:o,owners:[r],entryPoint:R});case"light_account":return _accounts.toLightSmartAccount.call(void 0, {client:o,entryPoint:R,owner:r,version:"1.1.0"});default:throw new Error(`Invalid smart account type: ${t}.`)}},Z=async({owner:r,smartWalletType:t,chain:n,bundlerUrl:o,paymasterUrl:l,paymasterContext:c})=>{let P=_viem.createPublicClient.call(void 0, {chain:n,transport:_viem.http.call(void 0, )}),i=await X({owner:r,smartWalletType:t,chain:n}),u=!!l?_pimlico.createPimlicoClient.call(void 0, {transport:_viem.http.call(void 0, l),entryPoint:i.entryPoint}):void 0;return _permissionless.createSmartAccountClient.call(void 0, {account:i,chain:n,paymaster:u,paymasterContext:c,bundlerTransport:_viem.http.call(void 0, o),userOperation:{estimateFeesPerGas:async()=>{let p=await P.estimateFeesPerGas();return{...p,maxFeePerGas:p.maxFeePerGas*115n/100n,maxPriorityFeePerGas:p.maxPriorityFeePerGas*115n/100n}}}})};var _jsxruntime = require('react/jsx-runtime');var U=_react.createContext.call(void 0, {client:void 0}),ne= exports.SmartWalletsProvider =({config:r,children:t})=>{let[n,o]=_react.useState.call(void 0, null),{getSmartWalletClient:l}=H(),{generateSiweMessage:c,linkSmartWallet:P,client:i,noPromptOnSignature:T}=_chunkV5T6BXGXjs.ra.call(void 0, ),{defaultChain:u}=_chunkV5T6BXGXjs.oa.call(void 0, ),{wallets:p}=_chunkV5T6BXGXjs.va.call(void 0, ),{user:d}=_chunkV5T6BXGXjs.ta.call(void 0, ),[C,S]=_react.useState.call(void 0, ),y=_chunk4GRYKTVVjs.f.call(void 0, p);return _react.useEffect.call(void 0, ()=>{!n&&i&&(async()=>{try{if(!i){console.warn("No client found");return}let a=await i.getSmartWalletsConfig();o(a)}catch(a){console.warn("Error generating smart wallet config: ",a)}})()},[!!i]),_react.useEffect.call(void 0, ()=>{(async()=>{if(!_optionalChain([n, 'optionalAccess', _2 => _2.enabled])||!d||!y){S(void 0);return}if(C)return;let a=n.configuredNetworks.find(s=>s.chainId===`eip155:${u.id}`);if(!a)throw new (0, _chunkV5T6BXGXjs.g)(`The defaultChain ${u.name} (eip155:${u.id}) must be configured in the smart wallet configuration in your dashboard`);if(d.smartWallet)try{let s=await l(y,d.smartWallet.smartWalletType,a,_optionalChain([r, 'optionalAccess', _3 => _3.paymasterContext]));S(s);return}catch(s){console.error("Error loading smart wallet:",s);return}try{let s=await l(y,n.smartWalletType,a,_optionalChain([r, 'optionalAccess', _4 => _4.paymasterContext])),w=await c({address:s.account.address,chainId:a.chainId});T.current=!0;let D=await s.signMessage({message:w});await P({signature:D,message:w,smartWalletType:n.smartWalletType}),S(s)}catch(s){console.error("Error creating smart wallet:",s)}finally{T.current=!1}})()},[!!_optionalChain([n, 'optionalAccess', _5 => _5.enabled]),!!_optionalChain([d, 'optionalAccess', _6 => _6.smartWallet]),!!y]),_jsxruntime.jsx.call(void 0, U.Provider,{value:{client:C},children:t})},ae= exports.useSmartWallets =()=>_react.useContext.call(void 0, U);exports.SmartWalletsProvider = ne; exports.useSmartWallets = ae;
|
package/dist/solana.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { S as SolanaAdapterConnector,
|
|
1
|
+
import { aB as ConnectedSolanaWallet, r as Wallet } from './types-eaea6708.js';
|
|
2
|
+
export { S as SolanaAdapterConnector, aC as toSolanaWalletConnectors } from './types-eaea6708.js';
|
|
3
3
|
import { Transaction, VersionedTransaction, ParsedTransactionWithMeta } from '@solana/web3.js';
|
|
4
4
|
import '@metamask/eth-sig-util';
|
|
5
5
|
import '@ethersproject/providers';
|
package/dist/solana.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkLTAXBMI2js = require('./chunk-LTAXBMI2.js');require('./chunk-NGIQBA55.js');require('./chunk-4GRYKTVV.js');require('./chunk-V5T6BXGX.js');var _walletadapterbase = require('@solana/wallet-adapter-base');var _walletstandardwalletadapterbase = require('@solana/wallet-standard-wallet-adapter-base');var _app = require('@wallet-standard/app');var u=l=>{let{get:r,on:c}=_app.getWallets.call(void 0, ),p=_nullishCoalesce(_optionalChain([l, 'optionalAccess', _ => _.shouldAutoConnect]), () => (!0)),t=i(r()),e=t.map(o=>new (0, _chunkLTAXBMI2js.e)(o,p)),s=[],d;return{_setOnConnectorsUpdated:o=>{d=o},onMount:()=>{s.push(c("register",(...o)=>{t=t.concat(...i(o)),e=t.map(n=>new (0, _chunkLTAXBMI2js.e)(n,p)),_optionalChain([d, 'optionalCall', _2 => _2(e)])}),c("unregister",(...o)=>{t=t.filter(n=>o.some(W=>n.wallet===W)),e=t.map(n=>new (0, _chunkLTAXBMI2js.e)(n,p)),_optionalChain([d, 'optionalCall', _3 => _3(e)])}))},onUnmount:()=>{let o=s.pop();for(;o;)o(),o=s.pop()},get:()=>e}},i=l=>l.filter(_walletadapterbase.isWalletAdapterCompatibleStandardWallet).map(r=>new (0, _walletstandardwalletadapterbase.StandardWalletAdapter)({wallet:r}));exports.SolanaAdapterConnector = _chunkLTAXBMI2js.e; exports.toSolanaWalletConnectors = u; exports.useSolanaWallets = _chunkLTAXBMI2js.y;
|
|
@@ -1826,6 +1826,20 @@ type OtpFlowState = {
|
|
|
1826
1826
|
} | {
|
|
1827
1827
|
status: 'done';
|
|
1828
1828
|
};
|
|
1829
|
+
type PasskeyFlowState = {
|
|
1830
|
+
status: 'initial';
|
|
1831
|
+
} | {
|
|
1832
|
+
status: 'error';
|
|
1833
|
+
error: Error | null;
|
|
1834
|
+
} | {
|
|
1835
|
+
status: 'generating-challenge';
|
|
1836
|
+
} | {
|
|
1837
|
+
status: 'awaiting-passkey';
|
|
1838
|
+
} | {
|
|
1839
|
+
status: 'submitting-response';
|
|
1840
|
+
} | {
|
|
1841
|
+
status: 'done';
|
|
1842
|
+
};
|
|
1829
1843
|
/**
|
|
1830
1844
|
* UI configuration object for the embedded wallet's Sign Message screen
|
|
1831
1845
|
*/
|
|
@@ -2191,4 +2205,4 @@ type EthereumRpcResponseType = eth_signTransactionResponse | eth_populateTransac
|
|
|
2191
2205
|
type SolanaRpcRequestType = solana_signMessage;
|
|
2192
2206
|
type SolanaRpcResponseType = solana_signMessageResponse;
|
|
2193
2207
|
|
|
2194
|
-
export {
|
|
2208
|
+
export { MoonpayCurrencyCode as $, PrivyIframeErrorTypesType as A, BaseConnectedEthereumWallet as B, Chain as C, PrivyErrorCode as D, Embedded1193Provider as E, FundWalletConfig as F, LinkedAccountWithMetadata as G, UserRecoveryMethod as H, FundingMethod as I, LoginWithCode as J, PasskeyFlowState as K, LoginMethod as L, MoonpaySignRequest as M, OtpFlowState as N, OAuthTokens as O, PrivyProxyProvider as P, UnsignedTransactionRequestWithChainId as Q, RuntimeLoginOverridableOptions as R, SolanaWalletConnector as S, TelegramAuthResult as T, User as U, CustomAuthFlowState as V, WalletConnector as W, AsExternalProvider as X, TypedMessage as Y, MessageTypes as Z, MoonpayConfig as _, RpcConfig as a, MoonpayPaymentMethod as a0, Quantity as a1, TransactionLog as a2, NonEmptyArray as a3, EmailWithMetadata as a4, PhoneWithMetadata as a5, WalletWithMetadata as a6, Google as a7, Twitter as a8, Discord as a9, LoginMethodOrderOption as aA, ConnectedSolanaWallet as aB, toSolanaWalletConnectors as aC, Github as aa, LinkedIn as ab, Apple as ac, Tiktok as ad, Telegram as ae, CrossAppAccount as af, GoogleOAuthWithMetadata as ag, TwitterOAuthWithMetadata as ah, DiscordOAuthWithMetadata as ai, GithubOAuthWithMetadata as aj, TiktokOAuthWithMetadata as ak, LinkedInOAuthWithMetadata as al, AppleOAuthWithMetadata as am, FarcasterWithMetadata as an, TelegramWithMetadata as ao, CrossAppAccountWithMetadata as ap, PasskeyWithMetadata as aq, Email as ar, Phone as as, TransactionUIOptions as at, ContractUIOptions as au, NativeFundingConfig as av, MoonpayFundingConfig as aw, PriceDisplayOptions as ax, Farcaster as ay, Passkey as az, WalletClientType as b, ConnectedWalletMetadata as c, ConnectorType as d, WalletListEntry as e, ExternalWalletsConfig as f, BaseConnectedWallet as g, EIP1193Provider as h, OAuthProviderType as i, MoonpaySignResponse as j, SmartWalletConfig as k, PrivyServerConfig as l, PrivyFarcasterSignerInitResponse as m, PrivyClientConfig as n, ConnectWalletModalOptions as o, LoginModalOptions as p, CreateWalletOptions as q, Wallet as r, SetWalletRecoveryOptions as s, SignMessageModalUIOptions as t, SignTypedDataParams as u, MfaMethod as v, UnsignedTransactionRequest as w, SendTransactionModalUIOptions as x, TransactionReceipt as y, ConnectedWallet as z };
|
package/dist/ui.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { R as RuntimeLoginOverridableOptions } from './types-
|
|
2
|
+
import { R as RuntimeLoginOverridableOptions } from './types-eaea6708.js';
|
|
3
3
|
import '@metamask/eth-sig-util';
|
|
4
4
|
import '@ethersproject/providers';
|
|
5
5
|
import 'eventemitter3';
|