@privy-io/react-auth 1.88.0-beta-20240926133016 → 1.88.0

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.
@@ -1,4 +1,4 @@
1
- import{getAddress as e}from"@ethersproject/address";import{useState as t,useEffect as r,createContext as i,useContext as a}from"react";import{jsx as s,jsxs as l,Fragment as n}from"react/jsx-runtime";import{styled as o,keyframes as c,css as d}from"styled-components";import{u,P as p,o as f}from"./useWallets.mjs";import m from"@heroicons/react/24/outline/Square2StackIcon";import{BigNumber as h}from"@ethersproject/bignumber";import{formatEther as v}from"@ethersproject/units";import{b as y,u as _}from"./internal-context.mjs";import{StaticJsonRpcProvider as g}from"@ethersproject/providers";let b=e=>h.from(e);function w(e){if("number"==typeof e||"bigint"==typeof e||"string"==typeof e)return e;if("function"==typeof e.toHexString)return e.toHexString();throw Error(`Expected numeric value but received ${e}`)}function A(e){let t={};return void 0!==e.to&&(t.to=e.to),void 0!==e.data&&(t.data=e.data),void 0!==e.chainId&&(t.chainId=e.chainId),void 0!==e.type&&(t.type=e.type),void 0!==e.accessList&&(t.accessList=e.accessList),void 0!==e.nonce&&(t.nonce=b(e.nonce).toNumber()),void 0!==e.gasLimit&&(t.gasLimit=b(e.gasLimit)),void 0!==e.gasPrice&&(t.gasPrice=b(e.gasPrice)),void 0!==e.value&&(t.value=b(e.value)),void 0!==e.maxFeePerGas&&(t.maxFeePerGas=b(e.maxFeePerGas)),void 0!==e.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=b(e.maxPriorityFeePerGas)),t}class k{get(e){let t=localStorage.getItem(e);return null===t?void 0:JSON.parse(t)}put(e,t){void 0!==t?localStorage.setItem(e,JSON.stringify(t)):this.del(e)}del(e){localStorage.removeItem(e)}getKeys(){return Object.entries(localStorage).map((([e])=>e))}}function W(){try{let e="privy:__session_storage__test",t=new k;return t.put(e,"blobby"),t.del(e),!0}catch(e){return!1}}var T="undefined"!=typeof window&&window.localStorage?new k:new class{get(e){return this._cache[e]}put(e,t){void 0!==t?this._cache[e]=t:this.del(e)}del(e){delete this._cache[e]}getKeys(){return Object.keys(this._cache)}constructor(){this._cache={}}};const x=e=>e.isApexWallet?"Apex Wallet":e.isAvalanche?"Core Wallet":e.isBackpack?"Backpack":e.isBifrost?"Bifrost Wallet":e.isBitKeep?"BitKeep":e.isBitski?"Bitski":e.isBlockWallet?"BlockWallet":e.isBraveWallet?"Brave Wallet":e.isClover?"Clover":e.isCoin98?"Coin98 Wallet":e.isCoinbaseWallet?"Coinbase Wallet":e.isDawn?"Dawn Wallet":e.isDefiant?"Defiant":e.isDesig?"Desig Wallet":e.isEnkrypt?"Enkrypt":e.isExodus?"Exodus":e.isFordefi?"Fordefi":e.isFrame?"Frame":e.isFrontier?"Frontier Wallet":e.isGamestop?"GameStop Wallet":e.isHaqqWallet?"HAQQ Wallet":e.isHyperPay?"HyperPay Wallet":e.isImToken?"ImToken":e.isHaloWallet?"Halo Wallet":e.isKuCoinWallet?"KuCoin Wallet":e.isMathWallet?"MathWallet":e.isNovaWallet?"Nova Wallet":e.isOkxWallet||e.isOKExWallet?"OKX Wallet":e.isOneInchIOSWallet||e.isOneInchAndroidWallet?"1inch Wallet":e.isOneKey?"OneKey Wallet":e.isOpera?"Opera":e.isPhantom?"Phantom":e.isPortal?"Ripio Portal":e.isRabby?"Rabby Wallet":e.isRainbow?"Rainbow":e.isSafePal?"SafePal Wallet":e.isStatus?"Status":e.isSubWallet?"SubWallet":e.isTalisman?"Talisman":e.isTally||e.isTaho?"Taho":e.isTokenPocket?"TokenPocket":e.isTokenary?"Tokenary":e.isTrust||e.isTrustWallet?"Trust Wallet":e.isTTWallet?"TTWallet":e.isXDEFI?"XDEFI Wallet":e.isZeal?"Zeal":e.isZerion?"Zerion":e.isMetaMask?"MetaMask":void 0,P=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||"MetaMask"!==x(e))return!1;if(e.providers)for(let t of e.providers)if(!P(t))return!1;return!0},j=()=>{if("phantom"in window){let e=window;if(e?.phantom?.ethereum?.isPhantom)return!0}return!1},C=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers)for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0;return!1},$=(e,t)=>{let r=[],i=[];for(let[a,s]of e.entries())a<t?r.push(s):i.push(s);return[r,i]},I=e=>!!String(e).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,}))$/),U=(e,t)=>{let r=e.slice(0),i=[];for(;r.length;)i.push(r.splice(0,t));return i},V=(e,t=3,r=4,i="ethereum")=>{if(!e)return"";let a="ethereum"===i?2:0;return t+r+a+3>=e.length?e:`${e.slice(0,a+t)}...${e.slice(e.length-r,e.length)}`},S=e=>new Promise((t=>setTimeout(t,e)));function F(e,{interval:t=100,timeout:r=5e3}={}){return new Promise(((i,a)=>{let s,l=0,n=()=>{l>=r?a("Max attempts reached without result"):(s=e(),l+=t,null==s?setTimeout(n,t):i(s))};n()}))}const N=(e,t={})=>{let r=t.delayMs||150,i=t.maxAttempts||270;return new Promise((async(a,s)=>{let l=!1,n=0;for(;!l&&n<i;){if(t.abortSignal?.aborted)return;e().then((e=>{l=!0,a(e)}),((...e)=>{l=!0,s(...e)})),n+=1,await S(r)}l||s(Error("Exceeded max attempts before resolving function"))}))},O=(e,t,r={},i={})=>{let a=new URL(t,e);for(let[e,t]of Object.entries(r))void 0!==t&&a.searchParams.set(e,t);let s=Object.entries(i);if(s.length>0){let e=new URLSearchParams;for(let[t,r]of s)e.append(t,r);a.hash=e.toString()}return a.href},M=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),D=e=>"string"==typeof e?e:"0x"+e.toString(16);async function E(e,t,r,i=3e3){let a=!1,s=window;return new Promise((l=>{function n(){if(a)return;a=!0,window.removeEventListener("ethereum#initialized",n);let i=e.getProviders();console.debug("Detected injected providers:",i.map((e=>e.info)));let s=[];for(let e of i)t.includes("coinbase_wallet")&&"com.coinbase.wallet"===e.info.rdns||s.push({type:e.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:e});for(let e of function(){let e=window,t=e.ethereum;if(!t)return[];let r=[];if(t.providers?.length)for(let e of t.providers)e&&r.push(e);return r.push(e.ethereum),r}()){let t=x(e);if(!i.some((e=>e.info.name===t))){if(P(e,!0)&&!s.find((e=>"metamask"===e.type))){s.push({type:"metamask",legacyInjectedProvider:e});continue}if("Phantom"===t&&!s.find((e=>"phantom"===e.type))){s.push({type:"phantom",legacyInjectedProvider:e});continue}if("Coinbase Wallet"===t&&!s.find((e=>"coinbase_wallet"===e.type&&"smartWalletOnly"!==r?.coinbaseWallet?.connectionOptions))){s.push({type:"coinbase_wallet",legacyInjectedProvider:e});continue}s.find((e=>"unknown_browser_extension"===e.type))||s.push({type:"unknown_browser_extension",legacyInjectedProvider:e})}}l(s)}s.ethereum?n():(window.addEventListener("ethereum#initialized",n,{once:!0}),setTimeout((()=>{n()}),i))}))}function L(e){return`eip155:${String(Number(e))}`}const B=(e,t,r,i)=>{let a=Number(e),s=t.find((e=>e.id===a));if(!s)throw new y(`Unsupported chainId ${e}`,4901);return R(s,r,i)},R=(e,t,r)=>{let i,a=e.id,s=Number(e.id);if(e.rpcUrls.privyWalletOverride&&e.rpcUrls.privyWalletOverride.http[0])i=e.rpcUrls.privyWalletOverride.http[0];else if(t.rpcUrls&&t.rpcUrls[s])i=t.rpcUrls[s];else if(e.rpcUrls.privy?.http[0]){let t=new URL(e.rpcUrls.privy.http[0]);t.searchParams.append("privyAppId",r),i=t.toString()}else i=e.rpcUrls.public?.http[0]?e.rpcUrls.public.http[0]:e.rpcUrls.default?.http[0];if(!i)throw new y(`No RPC url found for ${a}`);return i},z=(e,t,r,i)=>{let a=Number(e),s=t.find((e=>e.id===a));if(!s)throw new y(`Unsupported chainId ${e}`,4901);return new g(s.rpcUrls.privyWalletOverride&&s.rpcUrls.privyWalletOverride.http[0]?s.rpcUrls.privyWalletOverride.http[0]:r.rpcUrls&&r.rpcUrls[a]?r.rpcUrls[a]:s.rpcUrls.privy?.http[0]?{url:s.rpcUrls.privy.http[0],headers:{"privy-app-id":i.appId}}:s.rpcUrls.public?.http[0]?s.rpcUrls.public.http[0]:s.rpcUrls.default?.http[0])},K=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map((([e,r])=>{if(null!=r&&"string"==typeof e&&e in t)return{name:e,type:t[e]}})).filter((e=>void 0!==e));return{...e,types:{...e.types,EIP712Domain:r}}};function H(e,{min:t,max:r}){return Math.min(Math.max(e,t),r)}function G(e){return e?new Date(1e3*e):null}function Z(e,t){return e.slice().sort(((e,t)=>(t.firstVerifiedAt??t.verifiedAt).getTime()-(e.firstVerifiedAt??e.verifiedAt).getTime())).find((e=>e.type===t))}const q=e=>e?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType&&!e.imported&&"ethereum"===e.chainType&&0===e.walletIndex))||null,X=e=>e?.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&!e.imported&&"ethereum"===e.chainType)),J=e=>e?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType&&!e.imported&&"solana"===e.chainType))||null,Q=e=>e?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType&&e.imported&&"ethereum"===e.chainType))||null,Y=(t,r)=>{let i=(e=>e?.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&"ethereum"===e.chainType)))(t).find((t=>e(t.address)===e(r)));return{signingWallet:i,rootWallet:i?i.imported?i:q(t):void 0}};const ee=(e,t)=>!(q(e)||J(e)||"all-users"!==t&&("users-without-wallets"!==t||(e=>e.linkedAccounts.filter((e=>"wallet"===e.type)))(e)?.length));function te(e){if(!e)return null;let t=function(e){let t=[];for(let r of e){let e=r.type;switch(r.type){case"wallet":let i={address:r.address,type:r.type,imported:r.imported,verifiedAt:G(r.verified_at),firstVerifiedAt:G(r.first_verified_at),latestVerifiedAt:G(r.latest_verified_at),chainType:r.chain_type,chainId:r.chain_id,walletClient:"privy"===r.wallet_client_type?"privy":"unknown",walletClientType:r.wallet_client_type,connectorType:r.connector_type,recoveryMethod:r.recovery_method,walletIndex:r.wallet_index};t.push(i);break;case"smart_wallet":let a={address:r.address,type:r.type,verifiedAt:G(r.verified_at),firstVerifiedAt:G(r.first_verified_at),latestVerifiedAt:G(r.latest_verified_at),smartWalletType:r.smart_wallet_type};t.push(a);break;case"cross_app":let s={type:r.type,subject:r.subject,embeddedWallets:r.embedded_wallets,smartWallets:r.smart_wallets,providerApp:{id:r.provider_app_id},verifiedAt:G(r.verified_at),firstVerifiedAt:G(r.first_verified_at),latestVerifiedAt:G(r.latest_verified_at)};t.push(s);break;case"email":let l={address:r.address,type:r.type,verifiedAt:G(r.verified_at),firstVerifiedAt:G(r.first_verified_at),latestVerifiedAt:G(r.latest_verified_at)};t.push(l);break;case"phone":let n={number:r.phoneNumber,type:r.type,verifiedAt:G(r.verified_at),firstVerifiedAt:G(r.first_verified_at),latestVerifiedAt:G(r.latest_verified_at)};t.push(n);break;case"google_oauth":let o={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:G(r.verified_at),firstVerifiedAt:G(r.first_verified_at),latestVerifiedAt:G(r.latest_verified_at)};t.push(o);break;case"spotify_oauth":let c={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:G(r.verified_at),firstVerifiedAt:G(r.first_verified_at),latestVerifiedAt:G(r.latest_verified_at)};t.push(c);break;case"instagram_oauth":let d={subject:r.subject,username:r.username,type:r.type,verifiedAt:G(r.verified_at),firstVerifiedAt:G(r.first_verified_at),latestVerifiedAt:G(r.latest_verified_at)};t.push(d);break;case"twitter_oauth":let u={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:G(r.verified_at),firstVerifiedAt:G(r.first_verified_at),latestVerifiedAt:G(r.latest_verified_at)};t.push(u);break;case"discord_oauth":let p={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:G(r.verified_at),firstVerifiedAt:G(r.first_verified_at),latestVerifiedAt:G(r.latest_verified_at)};t.push(p);break;case"github_oauth":let f={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:G(r.verified_at),firstVerifiedAt:G(r.first_verified_at),latestVerifiedAt:G(r.latest_verified_at)};t.push(f);break;case"tiktok_oauth":let m={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:G(r.verified_at),firstVerifiedAt:G(r.first_verified_at),latestVerifiedAt:G(r.latest_verified_at)};t.push(m);break;case"linkedin_oauth":let h={subject:r.subject,name:r.name,email:r.email,vanityName:r.vanity_name,type:r.type,verifiedAt:G(r.verified_at),firstVerifiedAt:G(r.first_verified_at),latestVerifiedAt:G(r.latest_verified_at)};t.push(h);break;case"apple_oauth":let v={subject:r.subject,email:r.email,type:r.type,verifiedAt:G(r.verified_at),firstVerifiedAt:G(r.first_verified_at),latestVerifiedAt:G(r.latest_verified_at)};t.push(v);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:G(r.verified_at),firstVerifiedAt:G(r.first_verified_at),latestVerifiedAt:G(r.latest_verified_at)});break;case"farcaster":let y={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:G(r.verified_at),firstVerifiedAt:G(r.first_verified_at),latestVerifiedAt:G(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(y);break;case"passkey":let _={type:r.type,enrolledInMfa:r.enrolled_in_mfa,credentialId:r.credential_id,authenticatorName:r.authenticator_name,createdWithDevice:r.created_with_device,createdWithOs:r.created_with_os,createdWithBrowser:r.created_with_browser,verifiedAt:G(r.verified_at),firstVerifiedAt:G(r.first_verified_at),latestVerifiedAt:G(r.latest_verified_at)};t.push(_);break;case"telegram":let g={type:r.type,telegramUserId:r.telegram_user_id,firstName:r.first_name,lastName:r.last_name,username:r.username,photoUrl:r.photo_url,verifiedAt:G(r.first_verified_at),firstVerifiedAt:G(r.first_verified_at),latestVerifiedAt:G(r.latest_verified_at)};t.push(g);break;default:console.warn(`Unrecognized account type: ${e}. Please consider upgrading the Privy SDK.`)}}return t}(e.linked_accounts),r=Z(t,"wallet"),i=Z(t,"smart_wallet"),a=Z(t,"email"),s=Z(t,"phone"),l=Z(t,"google_oauth"),n=Z(t,"twitter_oauth"),o=Z(t,"discord_oauth"),c=Z(t,"github_oauth"),d=Z(t,"spotify_oauth"),u=Z(t,"instagram_oauth"),p=Z(t,"tiktok_oauth"),f=Z(t,"linkedin_oauth"),m=Z(t,"apple_oauth"),h=Z(t,"farcaster"),v=Z(t,"telegram"),y=e.mfa_methods.map((({type:e,verified_at:t})=>({type:e,verifiedAt:G(t)})));return{id:e.id,createdAt:G(e.created_at),linkedAccounts:t,email:a&&{address:a?.address},phone:s&&{number:s?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod,imported:r.imported,walletIndex:r.walletIndex},smartWallet:i&&{address:i.address,smartWalletType:i.smartWalletType},google:l&&{subject:l.subject,email:l.email,name:l.name},twitter:n&&{subject:n.subject,username:n.username,name:n.name,profilePictureUrl:n.profilePictureUrl},discord:o&&{subject:o.subject,username:o.username,email:o.email},github:c&&{subject:c.subject,username:c.username,name:c.name,email:c.email},spotify:d&&{subject:d.subject,email:d.email,name:d.name},instagram:u&&{subject:u.subject,username:u.username},tiktok:p&&{subject:p.subject,username:p.username,name:p.name},linkedin:f&&{subject:f.subject,name:f.name,email:f.email,vanityName:f.vanityName},apple:m&&{subject:m.subject,email:m.email},farcaster:h&&{fid:h.fid,ownerAddress:h.ownerAddress,displayName:h.displayName,username:h.username,bio:h.bio,pfp:h.pfp,url:h.url,signerPublicKey:h.signerPublicKey},telegram:v&&{telegramUserId:v.telegramUserId,firstName:v.firstName,lastName:v.lastName,username:v.username,photoUrl:v.photoUrl},mfaMethods:y.map((e=>e.type)),hasAcceptedTerms:e.has_accepted_terms??!1,isGuest:e.is_guest,customMetadata:e.custom_metadata}}const re=({...e})=>s("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:s("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:e.color||"var(--privy-color-foreground-3)"})}),ie=e=>{let[i,a]=t("auto");return r((()=>{let t=new ResizeObserver((e=>{a(e[0]?.contentRect.height??"auto")}));return e.current&&t.observe(e.current),()=>{e.current&&t.unobserve(e.current)}}),[e.current]),i},ae={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:[]}},se=i(void 0);let le=()=>a(se);function ne(e,t){if(!t)return;let i=le().current[e];return r((()=>{for(let[r,a]of Object.entries(t))i.hasOwnProperty(r)||console.warn(`Invalid event type "${r}" for action "${e}"`),i[r]?.push(a);return()=>{for(let[r,a]of Object.entries(t))i.hasOwnProperty(r)||console.warn(`Invalid event type "${r}" for action "${e}"`),i[r]=i[r]?.filter((e=>e!==a))}}),[t])}function oe(e,t,r,...i){for(let a of e.current[t][r])a(...i)}function ce(){let e=le();return(t,r,...i)=>oe(e,t,r,...i)}let de=o.div`
1
+ import{useState as e,useEffect as r,createContext as t,useContext as i}from"react";import{jsx as o,jsxs as n,Fragment as a}from"react/jsx-runtime";import{styled as l,keyframes as s,css as c}from"styled-components";import{u as p}from"./useWallets.mjs";import{b as u,l as d,u as h,h as v}from"./privy-context.mjs";import f from"@heroicons/react/24/outline/Square2StackIcon";import{BigNumber as m}from"@ethersproject/bignumber";import{formatEther as g}from"@ethersproject/units";import{StaticJsonRpcProvider as y}from"@ethersproject/providers";let w=e=>m.from(e);function b(e){if("number"==typeof e||"bigint"==typeof e||"string"==typeof e)return e;if("function"==typeof e.toHexString)return e.toHexString();throw Error(`Expected numeric value but received ${e}`)}function W(e){let r={};return void 0!==e.to&&(r.to=e.to),void 0!==e.data&&(r.data=e.data),void 0!==e.chainId&&(r.chainId=e.chainId),void 0!==e.type&&(r.type=e.type),void 0!==e.accessList&&(r.accessList=e.accessList),void 0!==e.nonce&&(r.nonce=w(e.nonce).toNumber()),void 0!==e.gasLimit&&(r.gasLimit=w(e.gasLimit)),void 0!==e.gasPrice&&(r.gasPrice=w(e.gasPrice)),void 0!==e.value&&(r.value=w(e.value)),void 0!==e.maxFeePerGas&&(r.maxFeePerGas=w(e.maxFeePerGas)),void 0!==e.maxPriorityFeePerGas&&(r.maxPriorityFeePerGas=w(e.maxPriorityFeePerGas)),r}class x{get(e){let r=localStorage.getItem(e);return null===r?void 0:JSON.parse(r)}put(e,r){void 0!==r?localStorage.setItem(e,JSON.stringify(r)):this.del(e)}del(e){localStorage.removeItem(e)}getKeys(){return Object.entries(localStorage).map((([e])=>e))}}function P(){try{let e="privy:__session_storage__test",r=new x;return r.put(e,"blobby"),r.del(e),!0}catch(e){return!1}}var k="undefined"!=typeof window&&window.localStorage?new x:new class{get(e){return this._cache[e]}put(e,r){void 0!==r?this._cache[e]=r:this.del(e)}del(e){delete this._cache[e]}getKeys(){return Object.keys(this._cache)}constructor(){this._cache={}}};const $=e=>e.isApexWallet?"Apex Wallet":e.isAvalanche?"Core Wallet":e.isBackpack?"Backpack":e.isBifrost?"Bifrost Wallet":e.isBitKeep?"BitKeep":e.isBitski?"Bitski":e.isBlockWallet?"BlockWallet":e.isBraveWallet?"Brave Wallet":e.isClover?"Clover":e.isCoin98?"Coin98 Wallet":e.isCoinbaseWallet?"Coinbase Wallet":e.isDawn?"Dawn Wallet":e.isDefiant?"Defiant":e.isDesig?"Desig Wallet":e.isEnkrypt?"Enkrypt":e.isExodus?"Exodus":e.isFordefi?"Fordefi":e.isFrame?"Frame":e.isFrontier?"Frontier Wallet":e.isGamestop?"GameStop Wallet":e.isHaqqWallet?"HAQQ Wallet":e.isHyperPay?"HyperPay Wallet":e.isImToken?"ImToken":e.isHaloWallet?"Halo Wallet":e.isKuCoinWallet?"KuCoin Wallet":e.isMathWallet?"MathWallet":e.isNovaWallet?"Nova Wallet":e.isOkxWallet||e.isOKExWallet?"OKX Wallet":e.isOneInchIOSWallet||e.isOneInchAndroidWallet?"1inch Wallet":e.isOneKey?"OneKey Wallet":e.isOpera?"Opera":e.isPhantom?"Phantom":e.isPortal?"Ripio Portal":e.isRabby?"Rabby Wallet":e.isRainbow?"Rainbow":e.isSafePal?"SafePal Wallet":e.isStatus?"Status":e.isSubWallet?"SubWallet":e.isTalisman?"Talisman":e.isTally||e.isTaho?"Taho":e.isTokenPocket?"TokenPocket":e.isTokenary?"Tokenary":e.isTrust||e.isTrustWallet?"Trust Wallet":e.isTTWallet?"TTWallet":e.isXDEFI?"XDEFI Wallet":e.isZeal?"Zeal":e.isZerion?"Zerion":e.isMetaMask?"MetaMask":void 0,C=(e,r)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!r)return!0;if(e.isBraveWallet&&!e._events&&!e._state||"MetaMask"!==$(e))return!1;if(e.providers)for(let r of e.providers)if(!C(r))return!1;return!0},T=()=>{if("phantom"in window){let e=window;if(e?.phantom?.ethereum?.isPhantom)return!0}return!1},S=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers)for(let r of e.ethereum.providers)if(r&&r.isCoinbaseWallet)return!0;return!1},I=(e,r)=>{let t=[],i=[];for(let[o,n]of e.entries())o<r?t.push(n):i.push(n);return[t,i]},U=e=>!!String(e).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,}))$/),F=(e,r)=>{let t=e.slice(0),i=[];for(;t.length;)i.push(t.splice(0,r));return i},O=(e,r=3,t=4,i="ethereum")=>{if(!e)return"";let o="ethereum"===i?2:0;return r+t+o+3>=e.length?e:`${e.slice(0,o+r)}...${e.slice(e.length-t,e.length)}`},E=e=>new Promise((r=>setTimeout(r,e)));function D(e,{interval:r=100,timeout:t=5e3}={}){return new Promise(((i,o)=>{let n,a=0,l=()=>{a>=t?o("Max attempts reached without result"):(n=e(),a+=r,null==n?setTimeout(l,r):i(n))};l()}))}const M=(e,r={})=>{let t=r.delayMs||150,i=r.maxAttempts||270;return new Promise((async(o,n)=>{let a=!1,l=0;for(;!a&&l<i;){if(r.abortSignal?.aborted)return;e().then((e=>{a=!0,o(e)}),((...e)=>{a=!0,n(...e)})),l+=1,await E(t)}a||n(Error("Exceeded max attempts before resolving function"))}))},_=(e,r,t={},i={})=>{let o=new URL(r,e);for(let[e,r]of Object.entries(t))void 0!==r&&o.searchParams.set(e,r);let n=Object.entries(i);if(n.length>0){let e=new URLSearchParams;for(let[r,t]of n)e.append(r,t);o.hash=e.toString()}return o.href},L=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),j=e=>"string"==typeof e?e:"0x"+e.toString(16);async function A(e,r,t,i=3e3){let o=!1,n=window;return new Promise((a=>{function l(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",l);let i=e.getProviders();console.debug("Detected injected providers:",i.map((e=>e.info)));let n=[];for(let e of i)r.includes("coinbase_wallet")&&"com.coinbase.wallet"===e.info.rdns||n.push({type:e.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:e});for(let e of function(){let e=window,r=e.ethereum;if(!r)return[];let t=[];if(r.providers?.length)for(let e of r.providers)e&&t.push(e);return t.push(e.ethereum),t}()){let r=$(e);if(!i.some((e=>e.info.name===r))){if(C(e,!0)&&!n.find((e=>"metamask"===e.type))){n.push({type:"metamask",legacyInjectedProvider:e});continue}if("Phantom"===r&&!n.find((e=>"phantom"===e.type))){n.push({type:"phantom",legacyInjectedProvider:e});continue}if("Coinbase Wallet"===r&&!n.find((e=>"coinbase_wallet"===e.type&&"smartWalletOnly"!==t?.coinbaseWallet?.connectionOptions))){n.push({type:"coinbase_wallet",legacyInjectedProvider:e});continue}n.find((e=>"unknown_browser_extension"===e.type))||n.push({type:"unknown_browser_extension",legacyInjectedProvider:e})}}a(n)}n.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout((()=>{l()}),i))}))}function N(e){return`eip155:${String(Number(e))}`}const B=(e,r,t,i)=>{let o=Number(e),n=r.find((e=>e.id===o));if(!n)throw new u(`Unsupported chainId ${e}`,4901);return R(n,t,i)},R=(e,r,t)=>{let i,o=e.id,n=Number(e.id);if(e.rpcUrls.privyWalletOverride&&e.rpcUrls.privyWalletOverride.http[0])i=e.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])i=r.rpcUrls[n];else if(e.rpcUrls.privy?.http[0]){let r=new URL(e.rpcUrls.privy.http[0]);r.searchParams.append("privyAppId",t),i=r.toString()}else i=e.rpcUrls.public?.http[0]?e.rpcUrls.public.http[0]:e.rpcUrls.default?.http[0];if(!i)throw new u(`No RPC url found for ${o}`);return i},z=(e,r,t,i)=>{let o=Number(e),n=r.find((e=>e.id===o));if(!n)throw new u(`Unsupported chainId ${e}`,4901);return new y(n.rpcUrls.privyWalletOverride&&n.rpcUrls.privyWalletOverride.http[0]?n.rpcUrls.privyWalletOverride.http[0]:t.rpcUrls&&t.rpcUrls[o]?t.rpcUrls[o]:n.rpcUrls.privy?.http[0]?{url:n.rpcUrls.privy.http[0],headers:{"privy-app-id":i.appId}}:n.rpcUrls.public?.http[0]?n.rpcUrls.public.http[0]:n.rpcUrls.default?.http[0])},H=e=>{let r={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},t=e.types.EIP712Domain??Object.entries(e.domain).map((([e,t])=>{if(null!=t&&"string"==typeof e&&e in r)return{name:e,type:r[e]}})).filter((e=>void 0!==e));return{...e,types:{...e.types,EIP712Domain:t}}};function G(e,{min:r,max:t}){return Math.min(Math.max(e,r),t)}const K=({...e})=>o("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o("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:e.color||"var(--privy-color-foreground-3)"})}),Z=t=>{let[i,o]=e("auto");return r((()=>{let e=new ResizeObserver((e=>{o(e[0]?.contentRect.height??"auto")}));return t.current&&e.observe(t.current),()=>{t.current&&e.unobserve(t.current)}}),[t.current]),i},V={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:[]}},q=t(void 0);let X=()=>i(q);function J(e,t){if(!t)return;let i=X().current[e];return r((()=>{for(let[r,o]of Object.entries(t))i.hasOwnProperty(r)||console.warn(`Invalid event type "${r}" for action "${e}"`),i[r]?.push(o);return()=>{for(let[r,o]of Object.entries(t))i.hasOwnProperty(r)||console.warn(`Invalid event type "${r}" for action "${e}"`),i[r]=i[r]?.filter((e=>e!==o))}}),[t])}function Q(e,r,t,...i){for(let o of e.current[r][t])o(...i)}function Y(){let e=X();return(r,t,...i)=>Q(e,r,t,...i)}let ee=l.div`
2
2
  margin-top: 16px;
3
3
  font-size: 13px;
4
4
  text-align: center;
@@ -7,7 +7,7 @@ import{getAddress as e}from"@ethersproject/address";import{useState as t,useEffe
7
7
  && > a {
8
8
  color: var(--privy-color-accent);
9
9
  }
10
- `;function ue(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:i}}=e.app;if(i&&!e.alwaysShowImplicitConsent||!r&&!t)return s(de,{});let a=!(!t||!r);return l(de,{children:["By logging in I agree to the"," ",r&&s("a",{href:r,target:"_blank",children:a?"Terms":"Terms of Service"}),a&&" & ",t&&s("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}const pe=()=>l(fe,{children:[s(re,{}),s("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})]}),fe=o.div`
10
+ `;function re(e){let{legal:{privacyPolicyUrl:r,termsAndConditionsUrl:t,requireUsersAcceptTerms:i}}=e.app;if(i&&!e.alwaysShowImplicitConsent||!t&&!r)return o(ee,{});let a=!(!r||!t);return n(ee,{children:["By logging in I agree to the"," ",t&&o("a",{href:t,target:"_blank",children:a?"Terms":"Terms of Service"}),a&&" & ",r&&o("a",{href:r,target:"_blank",children:"Privacy Policy"})]})}const te=()=>n(ie,{children:[o(K,{}),o("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})]}),ie=l.div`
11
11
  display: flex;
12
12
  align-items: center;
13
13
  justify-content: center;
@@ -34,7 +34,7 @@ import{getAddress as e}from"@ethersproject/address";import{useState as t,useEffe
34
34
  @media all and (display-mode: standalone) {
35
35
  padding-bottom: 30px;
36
36
  }
37
- `,me=({address:e,showCopyIcon:t,url:r,className:i})=>r?s("a",{title:e,className:i,href:`${r}/address/${e}`,target:"_blank",children:V(e)}):l("button",{title:e,className:i,onClick:()=>navigator.clipboard.writeText(e).catch(console.error),children:[V(e),t&&s(he,{})]});let he=o(m)`
37
+ `,oe=({address:e,showCopyIcon:r,url:t,className:i})=>t?o("a",{title:e,className:i,href:`${t}/address/${e}`,target:"_blank",children:O(e)}):n("button",{title:e,className:i,onClick:()=>navigator.clipboard.writeText(e).catch(console.error),children:[O(e),r&&o(ne,{})]});let ne=l(f)`
38
38
  && {
39
39
  display: inline;
40
40
  }
@@ -43,7 +43,7 @@ import{getAddress as e}from"@ethersproject/address";import{useState as t,useEffe
43
43
  width: 0.875rem;
44
44
  margin-left: 0.125rem;
45
45
  color: var(--privy-color-foreground-3);
46
- `,ve=c`
46
+ `,ae=s`
47
47
  from, to {
48
48
  background: var(--privy-color-foreground-4);
49
49
  color: var(--privy-color-foreground-4);
@@ -53,52 +53,52 @@ import{getAddress as e}from"@ethersproject/address";import{useState as t,useEffe
53
53
  background: var(--privy-color-foreground-accent);
54
54
  color: var(--privy-color-foreground-accent);
55
55
  }
56
- `;const ye=d`
57
- ${e=>e.$isLoading?d`
56
+ `;const le=c`
57
+ ${e=>e.$isLoading?c`
58
58
  width: 35%;
59
- animation: ${ve} 2s linear infinite;
59
+ animation: ${ae} 2s linear infinite;
60
60
  border-radius: var(--privy-border-radius-sm);
61
61
  `:""}
62
- `,_e=({children:e,color:t,isLoading:r,isPulsing:i,className:a})=>s(ge,{$color:t,$isLoading:r,$isPulsing:i,className:a,children:e});let ge=o.span`
62
+ `,se=({children:e,color:r,isLoading:t,isPulsing:i,className:n})=>o(ce,{$color:r,$isLoading:t,$isPulsing:i,className:n,children:e});let ce=l.span`
63
63
  padding: 0.125rem 0.5rem;
64
64
  font-size: 0.75rem;
65
65
  font-weight: 500;
66
66
  line-height: 1.125rem; /* 150% */
67
67
  border-radius: var(--privy-border-radius-sm);
68
68
 
69
- ${e=>{let t,r;"green"===e.$color&&(t="var(--privy-color-success-dark)",r="var(--privy-color-success-light)"),"red"===e.$color&&(t="var(--privy-color-error)",r="var(--privy-color-error-light)"),"gray"===e.$color&&(t="var(--privy-color-foreground-2)",r="var(--privy-color-background-2)");let i=c`
69
+ ${e=>{let r,t;"green"===e.$color&&(r="var(--privy-color-success-dark)",t="var(--privy-color-success-light)"),"red"===e.$color&&(r="var(--privy-color-error)",t="var(--privy-color-error-light)"),"gray"===e.$color&&(r="var(--privy-color-foreground-2)",t="var(--privy-color-background-2)");let i=s`
70
70
  from, to {
71
- background-color: ${r};
71
+ background-color: ${t};
72
72
  }
73
73
 
74
74
  50% {
75
- background-color: rgba(${r}, 0.8);
75
+ background-color: rgba(${t}, 0.8);
76
76
  }
77
- `;return d`
78
- color: ${t};
79
- background-color: ${r};
80
- ${e.$isPulsing&&d`
77
+ `;return c`
78
+ color: ${r};
79
+ background-color: ${t};
80
+ ${e.$isPulsing&&c`
81
81
  animation: ${i} 3s linear infinite;
82
82
  `};
83
83
  `}}
84
84
 
85
- ${ye}
86
- `,be=i({});const we=({children:e})=>{let i=u(),[a,l]=t({});return ne("login",{onComplete:(e,t,r,a,s)=>{s&&"passkey"!==s.type&&"cross_app"!==s.type&&("wallet"!==s.type||"privy"!==s.walletClientType)&&(T.put(Ae(i.id),s.type),"wallet"===s.type?(T.put(ke(i.id),s.walletClientType),T.put(We(i.id),s.chainType),l({accountType:s.type,walletClientType:s.walletClientType,chainType:s.chainType})):(T.del(ke(i.id)),T.del(We(i.id)),l({accountType:s.type})))}}),r((()=>{if(!i.id)return;let e=T.get(Ae(i.id)),t=T.get(ke(i.id)),r=T.get(We(i.id));e&&l("wallet"===e?{accountType:e,walletClientType:t,chainType:r}:{accountType:e})}),[i.id]),s(be.Provider,{value:a,children:e})};let Ae=e=>`privy:${e}:recent-login-method`,ke=e=>`privy:${e}:recent-login-wallet-client`,We=e=>`privy:${e}:recent-login-chain-type`;const Te=()=>a(be);function xe(e){let{logout:t}=a(p);return ne("logout",e),{logout:t}}const Pe=o.div`
85
+ ${le}
86
+ `,pe=t({});const ue=({children:t})=>{let i=p(),[n,a]=e({});return J("login",{onComplete:(e,r,t,o,n)=>{n&&"passkey"!==n.type&&"cross_app"!==n.type&&("wallet"!==n.type||"privy"!==n.walletClientType)&&(k.put(de(i.id),n.type),"wallet"===n.type?(k.put(he(i.id),n.walletClientType),k.put(ve(i.id),n.chainType),a({accountType:n.type,walletClientType:n.walletClientType,chainType:n.chainType})):(k.del(he(i.id)),k.del(ve(i.id)),a({accountType:n.type})))}}),r((()=>{if(!i.id)return;let e=k.get(de(i.id)),r=k.get(he(i.id)),t=k.get(ve(i.id));e&&a("wallet"===e?{accountType:e,walletClientType:r,chainType:t}:{accountType:e})}),[i.id]),o(pe.Provider,{value:n,children:t})};let de=e=>`privy:${e}:recent-login-method`,he=e=>`privy:${e}:recent-login-wallet-client`,ve=e=>`privy:${e}:recent-login-chain-type`;const fe=()=>i(pe);function me(e){let{logout:r}=i(d);return J("logout",e),{logout:r}}const ge=l.div`
87
87
  display: flex;
88
88
  flex-direction: column;
89
- `,je=o.span`
89
+ `,ye=l.span`
90
90
  text-align: left;
91
91
  font-size: 0.75rem;
92
92
  font-weight: 500;
93
93
  line-height: 1.125rem; /* 150% */
94
94
 
95
95
  color: var(--privy-color-error);
96
- `,Ce=o.span`
96
+ `,we=l.span`
97
97
  color: var(--privy-color-foreground-3);
98
98
  font-size: 0.75rem;
99
99
  font-weight: 500;
100
100
  line-height: 1.125rem; /* 150% */
101
- `,$e=d`
101
+ `,be=c`
102
102
  && {
103
103
  border-width: 1px;
104
104
  padding: 0.5rem 1rem;
@@ -113,6 +113,6 @@ import{getAddress as e}from"@ethersproject/address";import{useState as t,useEffe
113
113
  align-items: center;
114
114
 
115
115
  ${e=>"error"===e.$state?"border-color: var(--privy-color-error);":""}
116
- `,Ie=o.div`
117
- ${$e}
118
- `,Ue=({errMsg:e,balance:t,address:r,isLoading:i,className:a,title:o,isPulsing:c,showIcon:d,statusColor:u="green"})=>{let p;return p=u||(e?"red":"green"),l(n,{children:[l(Ie,{className:a,$state:e?"error":void 0,children:[l(Pe,{children:[s(Ce,{children:o||"Pay with"}),s(me,{address:r,showCopyIcon:d||!!e})]}),void 0!==t&&s(_e,{isLoading:i,isPulsing:c,color:p,children:t})]}),e&&s(je,{style:{marginTop:"0.25rem"},children:e})]})},Ve=({color:e,...t})=>s("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...t,children:s("g",{children:s("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});let Se=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2}),Fe=e=>Se.format(e);const Ne=(e,t)=>{let r=Fe(t*parseFloat(e));return"$0.00"!==r?r:"<$0.01"},Oe=(e,t)=>{let r=Fe(t*parseFloat(v(e)));return"$0.00"===r?"<$0.01":r},Me=(e,t,r=6,i=!1)=>{let a=parseFloat(v(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return i?`${a} ${t}`:`${"0"===a?"<0.001":a} ${t}`},De=e=>e.map(b).reduce(((e,t)=>e.add(t)),h.from(0)).toHexString(),Ee=(e,t)=>{let{chains:r}=_(),i=`https://etherscan.io/address/${t}`,a=`${((e,t)=>{let r=Number(e),i=t.find((e=>e.id===r));if(!i)throw new y(`Unsupported chainId ${e}`,4901);return i.blockExplorers?.default.url})(e,r)}/address/${t}`;if(!a)return i;try{new URL(a)}catch{return i}return a};function Le(e){let{login:t}=a(p);return ne("login",e),{login:t}}function Be(e){let{connectWallet:t}=a(p);return ne("connectWallet",e),{connectWallet:t}}const Re=e=>{ne("fundWallet",e);let{fundWallet:t}=f();return{fundWallet:t}};export{Q as $,me as A,re as B,_e as C,Ve as D,U as E,H as F,R as G,Ie as H,$e as I,Me as J,je as K,ye as L,fe as M,Ne as N,De as O,Oe as P,I as Q,$ as R,Ee as S,ue as T,ce as U,ie as V,Ue as W,ae as X,oe as Y,J as Z,X as _,T as a,Y as a0,se as a1,we as a2,Le as a3,Be as a4,Re as a5,K as b,D as c,N as d,W as e,L as f,z as g,B as h,b as i,E as j,j as k,te as l,pe as m,ee as n,Te as o,F as p,C as q,A as r,M as s,w as t,ne as u,V as v,S as w,xe as x,q as y,O as z};
116
+ `,We=l.div`
117
+ ${be}
118
+ `,xe=({errMsg:e,balance:r,address:t,isLoading:i,className:l,title:s,isPulsing:c,showIcon:p,statusColor:u="green"})=>{let d;return d=u||(e?"red":"green"),n(a,{children:[n(We,{className:l,$state:e?"error":void 0,children:[n(ge,{children:[o(we,{children:s||"Pay with"}),o(oe,{address:t,showCopyIcon:p||!!e})]}),void 0!==r&&o(se,{isLoading:i,isPulsing:c,color:d,children:r})]}),e&&o(ye,{style:{marginTop:"0.25rem"},children:e})]})},Pe=({color:e,...r})=>o("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...r,children:o("g",{children:o("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});let ke=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2}),$e=e=>ke.format(e);const Ce=(e,r)=>{let t=$e(r*parseFloat(e));return"$0.00"!==t?t:"<$0.01"},Te=(e,r)=>{let t=$e(r*parseFloat(g(e)));return"$0.00"===t?"<$0.01":t},Se=(e,r,t=6,i=!1)=>{let o=parseFloat(g(e)).toFixed(t).replace(/0+$/,"").replace(/\.$/,"");return i?`${o} ${r}`:`${"0"===o?"<0.001":o} ${r}`},Ie=e=>e.map(w).reduce(((e,r)=>e.add(r)),m.from(0)).toHexString(),Ue=(e,r)=>{let{chains:t}=h(),i=`https://etherscan.io/address/${r}`,o=`${((e,r)=>{let t=Number(e),i=r.find((e=>e.id===t));if(!i)throw new u(`Unsupported chainId ${e}`,4901);return i.blockExplorers?.default.url})(e,t)}/address/${r}`;if(!o)return i;try{new URL(o)}catch{return i}return o};function Fe(e){let{login:r}=i(d);return J("login",e),{login:r}}function Oe(e){let{connectWallet:r}=i(d);return J("connectWallet",e),{connectWallet:r}}const Ee=e=>{J("fundWallet",e);let{fundWallet:r}=v();return{fundWallet:r}};export{oe as A,K as B,se as C,R as D,We as E,be as F,Se as G,ye as H,Ce as I,Ie as J,Te as K,le as L,ie as M,U as N,I as O,Ue as P,Y as Q,Z as R,V as S,re as T,Q as U,q as V,xe as W,ue as X,Fe as Y,Oe as Z,Ee as _,k as a,H as b,j as c,M as d,P as e,N as f,z as g,B as h,w as i,A as j,T as k,te as l,fe as m,S as n,O as o,D as p,E as q,W as r,L as s,b as t,J as u,me as v,_ as w,Pe as x,F as y,G as z};
@@ -1 +1 @@
1
- import{b as e,g as t,n as a,u as s}from"./internal-context.mjs";import{ErrorCode as n}from"@ethersproject/logger";import r from"eventemitter3";var i,o;(o=i||(i={})).MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",o.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",o.INVALID_DATA="invalid_data",o.LINKED_TO_ANOTHER_USER="linked_to_another_user",o.ALLOWLIST_REJECTED="allowlist_rejected",o.OAUTH_USER_DENIED="oauth_user_denied",o.UNKNOWN_AUTH_ERROR="unknown_auth_error",o.USER_EXITED_AUTH_FLOW="exited_auth_flow",o.MUST_BE_AUTHENTICATED="must_be_authenticated",o.UNKNOWN_CONNECT_WALLET_ERROR="unknown_connect_wallet_error",o.GENERIC_CONNECT_WALLET_ERROR="generic_connect_wallet_error",o.CLIENT_REQUEST_TIMEOUT="client_request_timeout",o.INVALID_CREDENTIALS="invalid_credentials";class l extends Error{toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(e,t,a){super(e),t instanceof Error&&(this.cause=t),this.privyErrorCode=a}}class d extends l{constructor(e,t,a){super(e),this.type="provider_error",this.code=t,this.data=a}}let c={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1},E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don’t see your wallet? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don’t see your wallet? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don’t see your wallet? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}};class _ extends d{constructor(e){super(e.message,e.code,e.data);let t=Object.values(c).find((t=>t.eipCode===e.code));this.details=t||c.UNKNOWN_ERROR,-32002===e.code&&(e.message?.includes("already pending for origin")?e.message?.includes("wallet_requestPermissions")?this.details=c.E32002_CONNECTION_ALREADY_PENDING:this.details=c.E32002_REQUEST_ALREADY_PENDING:e.message?.includes("Already processing")&&e.message.includes("eth_requestAccounts")&&(this.details=c.E32002_WALLET_LOCKED))}}class E extends e{constructor(){super("Wallet timeout"),this.type="wallet_error"}}class u extends e{constructor(){super("User rejected connection"),this.type="wallet_error"}}const h=t=>{if(t instanceof e)return t;if(t?.code&&t?.reason){let e=new m(t);return t.code===n.ACTION_REJECTED&&(e.details=c.E4001_USER_REJECTED_REQUEST),e}return t?.code?new m(t):new e("Unknown connector error",t)};class p extends t{constructor(e,t,a){super(e),this.type="provider_error",this.code=t,this.data=a}}class m extends p{constructor(e){super(e.message,e.code,e.data);let t=Object.values(c).find((t=>t.eipCode===e.code));this.details=t||c.UNKNOWN_ERROR,-32002===e.code&&(e.message?.includes("already pending for origin")?e.message?.includes("wallet_requestPermissions")?this.details=c.E32002_CONNECTION_ALREADY_PENDING:this.details=c.E32002_REQUEST_ALREADY_PENDING:e.message?.includes("Already processing")&&e.message.includes("eth_requestAccounts")&&(this.details=c.E32002_WALLET_LOCKED))}}const T={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0},ERROR_USER_LIMIT_REACHED:{message:"Unable to link",detail:"You've reached the maximum number of linked wallets.",retryable:!1},...c};class y extends r{constructor(e){super(),this.walletClientType=e,this.connected=!1,this.initialized=!1}}const R=["metamask","phantom","brave_wallet","rainbow","uniswap_wallet_extension","uniswap_extension","rabby_wallet","crypto.com_wallet_extension","coinbase_wallet","coinbase_smart_wallet","metamask","trust","safe","rainbow","uniswap","zerion","argent","spot","omni","cryptocom","blockchain","safepal","bitkeep","zengo","1inch","binance","exodus","mew_wallet","alphawallet","keyring_pro","mathwallet","unstoppable","obvious","ambire","internet_money_wallet","coin98","abc_wallet","arculus_wallet","haha","cling_wallet","broearn","copiosa","burrito_wallet","enjin_wallet","plasma_wallet","avacus","bee","pitaka","pltwallet","minerva","kryptogo","prema","slingshot","kriptonio","timeless","secux","bitizen","blocto","okx_wallet","safemoon","rabby_wallet","privy","unknown","phantom","solflare","glow"];function C(e){return"solana"===e.chainType}function g(e){return"solana"===e.type}class w extends y{get isInstalled(){return"Installed"===this.adapter.readyState}buildConnectedWallet(e,t){let s,n,r;if("Installed"!==e.readyState||!e.publicKey)throw Error("Wallet is not connected.");return"signMessage"in e&&(s=async(...t)=>{if(!e.connected)throw Error("Wallet is not connected.");return await e.signMessage(t[0])}),"sendTransaction"in e&&(n=async(...t)=>await e.sendTransaction(t[0],t[1],t[2])),"signTransaction"in e&&(r=async t=>await e.signTransaction(t)),{type:"solana",address:e.publicKey.toBase58(),meta:t,imported:!1,connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:async()=>e.connected,disconnect:()=>{try{e.disconnect()}catch(e){console.error("Wallet does not support programmatic disconnect")}},getProvider:a,signMessage:s,sendTransaction:n,signTransaction:r}}async syncAccounts(){if("Installed"===this.adapter.readyState&&this.adapter.publicKey){let e={name:this.walletBranding.name,icon:"string"==typeof this.walletBranding.icon?this.walletBranding.icon:void 0,id:this.walletBranding.id};this.wallets.find((e=>this.adapter.publicKey&&e.address===this.adapter.publicKey.toBase58()))||(this.wallets=[this.buildConnectedWallet(this.adapter,e)],this.emit("walletsUpdated"))}else this.wallets.length>0&&(this.wallets=[],this.emit("walletsUpdated"))}get walletBranding(){return{id:this.adapter.name,name:this.adapter.name,icon:this.adapter.icon}}async initialize(){this.subscribeListeners(),await this.syncAccounts(),this.shouldAutoConnect&&await this.adapter.autoConnect().catch(console.error),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}async getConnectedWallet(){return this.wallets.sort(((e,t)=>t.connectedAt-e.connectedAt))[0]||null}async isConnected(){return this.adapter.connected&&["Installed"].includes(this.adapter.readyState)}subscribeListeners(){this.adapter.addListener("disconnect",this.onDisconnect),this.adapter.addListener("connect",this.onConnect),this.adapter.addListener("error",this.onError),this.adapter.addListener("readyStateChange",this.onReadyStateChange)}unsubscribeListeners(){this.adapter.removeAllListeners()}constructor(e,t){super(function(e){return R.includes(e)}(e.name.toLowerCase())?e.name.toLowerCase():"unknown"),this.chainType="solana",this.connectorType="solana_adapter",this.disconnect=()=>{this.adapter.disconnect().then((()=>this.onDisconnect())).catch((e=>console.error("Error disconnecting",e)))},this.promptConnection=async()=>{try{await this.adapter.connect()}catch(e){throw h(e)}},this.onDisconnect=()=>{this.syncAccounts()},this.onConnect=e=>{this.syncAccounts()},this.onError=e=>{this.syncAccounts()},this.onReadyStateChange=e=>{"Installed"!==e&&(this.connected=!1),this.syncAccounts()},this.adapter=e,this.shouldAutoConnect=t,this.wallets=[]}}const N=()=>{let{embeddedSolanaWallet:e,exportSolanaWallet:t,createEmbeddedSolanaWallet:a,solanaWallets:n}=s();return{createWallet:a,exportWallet:t,wallets:n.concat(e?[e]:[])}};export{T as C,c as E,m as P,w as S,u as U,E as W,y as a,p as b,g as c,h as f,C as i,_ as l,N as u};
1
+ import{b as e,g as t,n as a,u as s,h as n,P as r}from"./privy-context.mjs";import{ErrorCode as i}from"@ethersproject/logger";import o from"eventemitter3";import{b as l}from"./user.mjs";var d,c;(c=d||(d={})).MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",c.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",c.INVALID_DATA="invalid_data",c.LINKED_TO_ANOTHER_USER="linked_to_another_user",c.ALLOWLIST_REJECTED="allowlist_rejected",c.OAUTH_USER_DENIED="oauth_user_denied",c.UNKNOWN_AUTH_ERROR="unknown_auth_error",c.USER_EXITED_AUTH_FLOW="exited_auth_flow",c.MUST_BE_AUTHENTICATED="must_be_authenticated",c.UNKNOWN_CONNECT_WALLET_ERROR="unknown_connect_wallet_error",c.GENERIC_CONNECT_WALLET_ERROR="generic_connect_wallet_error",c.CLIENT_REQUEST_TIMEOUT="client_request_timeout",c.INVALID_CREDENTIALS="invalid_credentials";class _ extends Error{toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(e,t,a){super(e),t instanceof Error&&(this.cause=t),this.privyErrorCode=a}}class E extends _{constructor(e,t,a){super(e),this.type="provider_error",this.code=t,this.data=a}}let u={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1},E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don’t see your wallet? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don’t see your wallet? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don’t see your wallet? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}};class h extends E{constructor(e){super(e.message,e.code,e.data);let t=Object.values(u).find((t=>t.eipCode===e.code));this.details=t||u.UNKNOWN_ERROR,-32002===e.code&&(e.message?.includes("already pending for origin")?e.message?.includes("wallet_requestPermissions")?this.details=u.E32002_CONNECTION_ALREADY_PENDING:this.details=u.E32002_REQUEST_ALREADY_PENDING:e.message?.includes("Already processing")&&e.message.includes("eth_requestAccounts")&&(this.details=u.E32002_WALLET_LOCKED))}}class p extends e{constructor(){super("Wallet timeout"),this.type="wallet_error"}}class m extends e{constructor(){super("User rejected connection"),this.type="wallet_error"}}const y=t=>{if(t instanceof e)return t;if(t?.code&&t?.reason){let e=new R(t);return t.code===i.ACTION_REJECTED&&(e.details=u.E4001_USER_REJECTED_REQUEST),e}return t?.code?new R(t):new e("Unknown connector error",t)};class T extends t{constructor(e,t,a){super(e),this.type="provider_error",this.code=t,this.data=a}}class R extends T{constructor(e){super(e.message,e.code,e.data);let t=Object.values(u).find((t=>t.eipCode===e.code));this.details=t||u.UNKNOWN_ERROR,-32002===e.code&&(e.message?.includes("already pending for origin")?e.message?.includes("wallet_requestPermissions")?this.details=u.E32002_CONNECTION_ALREADY_PENDING:this.details=u.E32002_REQUEST_ALREADY_PENDING:e.message?.includes("Already processing")&&e.message.includes("eth_requestAccounts")&&(this.details=u.E32002_WALLET_LOCKED))}}const g={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0},ERROR_USER_LIMIT_REACHED:{message:"Unable to link",detail:"You've reached the maximum number of linked wallets.",retryable:!1},...u};class C extends o{constructor(e){super(),this.walletClientType=e,this.connected=!1,this.initialized=!1}}const w=["metamask","phantom","brave_wallet","rainbow","uniswap_wallet_extension","uniswap_extension","rabby_wallet","crypto.com_wallet_extension","coinbase_wallet","coinbase_smart_wallet","metamask","trust","safe","rainbow","uniswap","zerion","argent","spot","omni","cryptocom","blockchain","safepal","bitkeep","zengo","1inch","binance","exodus","mew_wallet","alphawallet","keyring_pro","mathwallet","unstoppable","obvious","ambire","internet_money_wallet","coin98","abc_wallet","arculus_wallet","haha","cling_wallet","broearn","copiosa","burrito_wallet","enjin_wallet","plasma_wallet","avacus","bee","pitaka","pltwallet","minerva","kryptogo","prema","slingshot","kriptonio","timeless","secux","bitizen","blocto","okx_wallet","safemoon","rabby_wallet","privy","unknown","phantom","solflare","glow"];function N(e){return"solana"===e.chainType}function A(e){return"solana"===e.type}class D extends C{get isInstalled(){return"Installed"===this.adapter.readyState}buildConnectedWallet(e,t){let s,n,r;if("Installed"!==e.readyState||!e.publicKey)throw Error("Wallet is not connected.");return"signMessage"in e&&(s=async(...t)=>{if(!e.connected)throw Error("Wallet is not connected.");return await e.signMessage(t[0])}),"sendTransaction"in e&&(n=async(...t)=>await e.sendTransaction(t[0],t[1],t[2])),"signTransaction"in e&&(r=async t=>await e.signTransaction(t)),{type:"solana",address:e.publicKey.toBase58(),meta:t,imported:!1,connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:async()=>e.connected,disconnect:()=>{try{e.disconnect()}catch(e){console.error("Wallet does not support programmatic disconnect")}},getProvider:a,signMessage:s,sendTransaction:n,signTransaction:r}}async syncAccounts(){if("Installed"===this.adapter.readyState&&this.adapter.publicKey){let e={name:this.walletBranding.name,icon:"string"==typeof this.walletBranding.icon?this.walletBranding.icon:void 0,id:this.walletBranding.id};this.wallets.find((e=>this.adapter.publicKey&&e.address===this.adapter.publicKey.toBase58()))||(this.wallets=[this.buildConnectedWallet(this.adapter,e)],this.emit("walletsUpdated"))}else this.wallets.length>0&&(this.wallets=[],this.emit("walletsUpdated"))}get walletBranding(){return{id:this.adapter.name,name:this.adapter.name,icon:this.adapter.icon}}async initialize(){this.subscribeListeners(),await this.syncAccounts(),this.shouldAutoConnect&&await this.adapter.autoConnect().catch(console.error),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}async getConnectedWallet(){return this.wallets.sort(((e,t)=>t.connectedAt-e.connectedAt))[0]||null}async isConnected(){return this.adapter.connected&&["Installed"].includes(this.adapter.readyState)}subscribeListeners(){this.adapter.addListener("disconnect",this.onDisconnect),this.adapter.addListener("connect",this.onConnect),this.adapter.addListener("error",this.onError),this.adapter.addListener("readyStateChange",this.onReadyStateChange)}unsubscribeListeners(){this.adapter.removeAllListeners()}constructor(e,t){super(function(e){return w.includes(e)}(e.name.toLowerCase())?e.name.toLowerCase():"unknown"),this.chainType="solana",this.connectorType="solana_adapter",this.disconnect=()=>{this.adapter.disconnect().then((()=>this.onDisconnect())).catch((e=>console.error("Error disconnecting",e)))},this.promptConnection=async()=>{try{await this.adapter.connect()}catch(e){throw y(e)}},this.onDisconnect=()=>{this.syncAccounts()},this.onConnect=e=>{this.syncAccounts()},this.onError=e=>{this.syncAccounts()},this.onReadyStateChange=e=>{"Installed"!==e&&(this.connected=!1),this.syncAccounts()},this.adapter=e,this.shouldAutoConnect=t,this.wallets=[]}}const b=()=>{let{embeddedSolanaWallet:e,exportSolanaWallet:t,createEmbeddedSolanaWallet:a,solanaWallets:i,initDelegateAction:o}=s(),{user:d}=n();return{createWallet:a,exportWallet:t,delegateWalletAction:async()=>{let e=l(d);if(!e)throw new r("User must have a solana wallet in order to delegate actions");return await o({address:e.address})},wallets:i.concat(e?[e]:[])}};export{g as C,u as E,R as P,D as S,m as U,p as W,C as a,T as b,A as c,y as f,N as i,h as l,b as u};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useState as t,useMemo as a,useEffect as n,useContext as r,createContext as o}from"react";import l from"tinycolor2";import{n as i}from"./internal-context.mjs";const s="https://auth.privy.io",p=2e4,c=1400,h=2500,u=4e3,d="1.88.0-beta-20240926133016",m="privy:token",g="privy-token",f="privy:refresh_token",y="privy-refresh-token",b="privy:id_token",w="privy-id-token",k="privy-session",C="privy:session_transfer_token",v="privy:caid",E=e=>`privy:guest:${e}`,S=e=>`privy:cross-app:${e}`,A="privy:state_code",x="privy:code_verifier",O="privy:headless_oauth",W="privy:oauth_disable_signup",M=e=>`privy:wallet:${e}`,U="privy:connectors",T="privy:connections",L=12e4,H=1,F="0x1",P=3e4,_="https://api.moonpay.com/v1",j="https://api.moonpay.com/v1",z="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",B="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",I="deprecated",D={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:"34357d3c125c2bcf2ce2bc3309d98715",rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"all"}},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};let R=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","universal_profile","wallet_connect","detected_wallets","rabby_wallet","safe"]),q=e=>R.has(e),G=(e,t,a)=>a.indexOf(e)===t;const K=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(q).filter(G):e?e.filter(q).filter(G):D.appearance.walletList,Y={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"}}},Z={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},$={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"}}},X={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},J={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"}}},N={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},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},Q={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},ee={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"}}},te={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"}}},ae={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},ne={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"}}},re={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},oe={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},le={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"}}},ie=[Y,Z,oe,ee,te,ae,ne,re,V,{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},{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"}}},{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"}}},J,N,{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},{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"}}},Q,{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},$,X,le,{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},{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},{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"}}},{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/"}}},{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"}}}],se=new Set(ie.map((e=>e.id)));let pe="#FFFFFF";function ce(e,t){let a=Math.max(0,Math.min(1,e.toHsl().l+t));return l({...e.toHsl(),l:a})}function he({backgroundTheme:e,accentHex:t}){let a;switch(e){case"light":a=pe;break;case"dark":a="#1E1E1D";break;default:a=e}let n=l(a),r=l(t),o=l("#51BA81"),i=l("#FFB74D"),s=l("#EC6351"),p=function(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}(n.getLuminance()),c=ce(n,"light"===p?-.04:.11),h=ce(n,"light"===p?-.88:.87),u=ce(n,"light"===p?-.7:.75),d=ce(n,"light"===p?-.43:.45).desaturate("light"===p?60:20),m=ce(n,"light"===p?-.08:.25).desaturate("light"===p?60:20),g=ce(r,.15),f=ce(r,-.06),y=ce(s,.3),b=ce(i,.3),w=l(r.getLuminance()>.5?"#040217":pe),k=ce(o,-.16),C=ce(o,.4);return{colorScheme:p,background:n.toHslString(),background2:c.toHslString(),foreground:h.toHslString(),foreground2:u.toHslString(),foreground3:d.toHslString(),foreground4:m.toHslString(),accent:r.toHslString(),accentLight:g.toHslString(),accentDark:f.toHslString(),foregroundAccent:w.toHslString(),success:o.toHslString(),successDark:k.toHslString(),successLight:C.toHslString(),error:s.toHslString(),errorLight:y.toHslString(),warn:i.toHslString(),warnLight:b.toHslString()}}function ue(e,t,a){let n,r,o,l,i,s,p,c,h,u,d,m,g,f,y,b,w=a?console.warn:()=>{};t?.loginMethods?(n=t.loginMethods.includes("email"),r=t.loginMethods.includes("sms"),l=t.loginMethods.includes("wallet"),i=t.loginMethods.includes("google"),s=t.loginMethods.includes("twitter"),p=t.loginMethods.includes("discord"),h=t.loginMethods.includes("spotify"),u=t.loginMethods.includes("instagram"),c=t.loginMethods.includes("tiktok"),m=t.loginMethods.includes("github"),d=t.loginMethods.includes("linkedin"),g=t.loginMethods.includes("apple"),f=t.loginMethods.includes("farcaster"),y=t.loginMethods.includes("telegram")):(n=e.emailAuth,r=e.smsAuth,l=e.walletAuth,i=e.googleOAuth,s=e.twitterOAuth,p=e.discordOAuth,m=e.githubOAuth,h=e.spotifyOAuth,u=e.instagramOAuth,c=e.tiktokOAuth,d=e.linkedinOAuth,g=e.appleOAuth,f=e.farcasterAuth,y=e.telegramAuth),"undefined"!=typeof window&&"function"!=typeof window.PublicKeyCredential?o=!1:e.passkeyAuth&&(o=!0);let k=[n,r].filter(Boolean),C=[i,s,p,m,h,u,c,d,g,f,y].filter(Boolean),v=[l].filter(Boolean);if(k.length+C.length+v.length===0)throw Error("You must enable at least one login method");let E=void 0!==t?.appearance?.showWalletLoginFirst?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;E&&0===v.length?(w("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),E=!1):E||C.length+k.length!==0||(w("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),E=!0);let S=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&w("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let A=K({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),x=(({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],a=[];for(let a of(e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`"),e.primary.slice(1)))t.includes(a)?console.warn(`Duplicated login method: ${a}`):t.push(a);for(let n of e.overflow??[])t.includes(n)||a.includes(n)?console.warn(`Duplicated login method: ${n}`):a.push(n);return{primary:t,overflow:a}})({input:t?.loginMethodsAndOrder}),O=t?.intl?.defaultCountry??"US",{chains:W,defaultChain:M}=function({additionalChains:e,supportedChains:t,defaultChainFromConfig:a,hasRpcConfigDefined:n}){let r;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(0===t.length)throw Error("`supportedChains` must contain at least one chain");t.filter((e=>e.rpcUrls.privyWalletOverride)).length>0&&n&&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`."),r=t.map((e=>e.rpcUrls.privyWalletOverride?e:ie.find((t=>t.id===e.id))??e))}else r=ie.concat(e??[]);let o=t?r[0]:ee,l=a??o;if(!r.find((e=>e.id===l.id)))throw Error("`defaultChain` must be included in `supportedChains`");return{chains:r,defaultChain:l}}({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),U=!!t?.defaultChain,T=t?.customAuth?.getCustomAccessToken&&!1!==t?.customAuth?.enabled,L=!(e.enforceWalletUis??1);if(b=e.legacyWalletUiConfig??1?T?t?.embeddedWallets?.noPromptOnSignature??!0:t?.embeddedWallets?.noPromptOnSignature??L:L,!1===t?.embeddedWallets?.waitForTransactionConfirmation&&!0!==b)throw Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:H,...F}=t?.embeddedWallets??{};return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,landingHeader:t?.appearance?.landingHeader??D.appearance.landingHeader,loginMessage:"string"==typeof t?.appearance?.loginMessage?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,palette:he({backgroundTheme:t?.appearance?.theme??D.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??D.appearance.accentColor}),loginGroupPriority:E?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:A,walletChainType:t?.appearance?.walletChainType??"ethereum-only"},loginMethods:{wallet:l,email:n,sms:r,passkey:o,google:i,twitter:s,discord:p,github:m,spotify:h,instagram:u,tiktok:c,linkedin:d,apple:g,farcaster:f,telegram:y},loginMethodsAndOrder:x,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??D.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??D.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??D.rpcConfig.rpcTimeouts},chains:W,defaultChain:M,intl:{defaultCountry:O},shouldEnforceDefaultChainOnConnect:U,captchaEnabled:e.captchaEnabled??D.captchaEnabled,captchaSiteKey:e.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??D.externalWallets.coinbaseWallet.connectionOptions},walletConnect:{enabled:S},solana:{connectors:t?.externalWallets?.solana?.connectors}},embeddedWallets:{...e.embeddedWalletConfig,..."boolean"==typeof H?{requireUserOwnedRecoveryOnCreate:H}:{},...T?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...F,noPromptOnSignature:b},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:T?{enabled:!0,...t.customAuth}:void 0,loginConfig:{telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{standalone:t?._render?.standalone??D._render.standalone},fundingConfig:e.fundingConfig,fundingMethodConfig:{...t?.fundingMethodConfig??D.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??D.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??t?.fiatOnRamp?.useSandbox??D.fundingMethodConfig.moonpay.useSandbox}}}}let de={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:""};const me=ue(de,void 0,!1);let ge=o({appConfig:me,isServerConfigLoaded:!1});const fe=({children:r,legacyCreateEmbeddedWalletFlag:o,client:l,clientConfig:i})=>{let[s,p]=t(null),c=a((()=>ue(s??de,i,!!s)),[s,i]);return n((()=>{if(!s)return;let e=function(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:a,additionalChains:n,supportedChains:r,defaultChain:o,externalWallets:l,...i}=e;return{...i,...n?{additionalChains:n.map((e=>e.id))}:void 0,...r?{supportedChains:r.map((e=>e.id))}:void 0,...o?{defaultChain:o.id}:void 0,...l?{walletConnect:l.walletConnect,coinbaseWallet:l.coinbaseWallet,solana:{connectors:l.solana?.connectors?.get().map((e=>e.walletClientType))}}:void 0,legacyCreateEmbeddedWalletFlag:t}}(i,o),t=function(e,t=0){let a=3735928559^t,n=1103547991^t;for(let t,r=0;r<e.length;r++)a=Math.imul(a^(t=e.charCodeAt(r)),2654435761),n=Math.imul(n^t,1597334677);return a=Math.imul(a^a>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),4294967296*(2097151&(n=Math.imul(n^n>>>16,2246822507)^Math.imul(a^a>>>13,3266489909)))+(a>>>0)}(JSON.stringify(e)).toString(),a=`privy:sent:${s.id}:${t}`;localStorage.getItem(a)||(l.createAnalyticsEvent({eventName:"sdk_initialize",payload:e}),localStorage.setItem(a,"t"))}),[i,o,s]),n((()=>{s||(async()=>{try{let e=await l.getServerConfig();e.customApiUrl&&l.updateApiUrl(e.customApiUrl),p(e)}catch(e){console.warn("Error generating app config: ",e)}})()}),[]),e(ge.Provider,{value:{appConfig:c,isServerConfigLoaded:!!s},children:r})},ye=()=>{let{appConfig:e}=r(ge);return e},be=()=>{let{isServerConfigLoaded:e}=r(ge);return e},we=o({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:i,login:i,connectOrCreateWallet:i,linkEmail:i,linkPhone:i,linkFarcaster:i,linkWallet:i,startCrossAppAuthFlow:i,linkGoogle:i,linkTwitter:i,linkDiscord:i,linkGithub:i,linkSpotify:i,linkInstagram:i,linkTelegram:i,linkTiktok:i,linkLinkedIn:i,linkApple:i,linkPasskey:i,updateEmail:i,updatePhone:i,logout:i,getAccessToken:i,getEthereumProvider:i,getEthersProvider:i,getWeb3jsProvider:i,unlinkEmail:i,unlinkPhone:i,unlinkWallet:i,unlinkGoogle:i,unlinkTwitter:i,unlinkDiscord:i,unlinkGithub:i,unlinkSpotify:i,unlinkInstagram:i,unlinkTiktok:i,unlinkLinkedIn:i,unlinkApple:i,unlinkCrossAppAccount:i,unlinkFarcaster:i,unlinkTelegram:i,unlinkPasskey:i,setActiveWallet:i,forkSession:i,createWallet:i,importWallet:i,signMessage:i,signTypedData:i,enrollInMfa:i,initEnrollmentWithSms:i,initEnrollmentWithTotp:i,initEnrollmentWithPasskey:i,promptMfa:i,init:i,submitEnrollmentWithSms:i,submitEnrollmentWithTotp:i,submitEnrollmentWithPasskey:i,unenroll:i,submit:i,cancel:i,sendTransaction:i,sendSolanaTransaction:i,exportWallet:i,setWalletPassword:i,setWalletRecovery:i,requestFarcasterSignerFromWarpcast:i,getFarcasterSignerPublicKey:i,signFarcasterMessage:i,createGuestAccount:i,initLoginWithEmail:i,initLoginWithSms:i,otpState:{status:"initial"},loginWithCode:i,fundWallet:i,initLoginWithHeadlessOAuth:i,loginWithHeadlessOAuth:i,generateSiweMessage:i,linkWithSiwe:i,signMessageWithCrossAppWallet:i,signTypedDataWithCrossAppWallet:i,sendTransactionWithCrossAppWallet:i,isHeadlessOAuthLoading:!1,isModalOpen:!1,mfaMethods:[]}),ke=()=>r(we),Ce=o(null);function ve(){let e=r(Ce);if(null===e)throw Error("`useWallets` was called outside the PrivyProvider component");return e}export{be as $,ne as A,le as B,x as C,L as D,ve as E,C as F,u as G,O as H,b as I,_ as J,B as K,z as L,j as M,oe as N,W as O,we as P,ae as Q,f as R,A as S,m as T,re as U,d as V,P as W,N as X,X as Y,Z,fe as _,M as a,Ce as a0,ie as a1,me as a2,se as a3,F as b,U as c,T as d,S as e,k as f,E as g,I as h,g as i,y as j,w as k,s as l,p as m,v as n,ke as o,c as p,h as q,H as r,Y as s,$ as t,ye as u,J as v,V as w,Q as x,ee as y,te as z};
1
+ import{jsx as e}from"react/jsx-runtime";import{useState as t,useMemo as a,useEffect as n,useContext as r,createContext as o}from"react";import l from"tinycolor2";const i="https://auth.privy.io",s=2e4,p=1400,c=2500,h=4e3,u="1.88.0",d="privy:token",m="privy-token",g="privy:refresh_token",f="privy-refresh-token",y="privy:id_token",b="privy-id-token",w="privy-session",v="privy:session_transfer_token",C="privy:caid",k=e=>`privy:guest:${e}`,E=e=>`privy:cross-app:${e}`,S="privy:state_code",x="privy:code_verifier",O="privy:headless_oauth",A="privy:oauth_disable_signup",U=e=>`privy:wallet:${e}`,M="privy:connectors",H="privy:connections",L=12e4,W=1,T="0x1",F=3e4,P="https://api.moonpay.com/v1",_="https://api.moonpay.com/v1",z="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",j="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",B="deprecated",R={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:"34357d3c125c2bcf2ce2bc3309d98715",rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"all"}},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};let I=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","universal_profile","wallet_connect","detected_wallets","rabby_wallet","safe"]),D=e=>I.has(e),q=(e,t,a)=>a.indexOf(e)===t;const K=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(D).filter(q):e?e.filter(D).filter(q):R.appearance.walletList,Y={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"}}},Z={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},$={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"}}},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},X={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"}}},J={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},N={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},V={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},Q={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"}}},ee={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"}}},te={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},ae={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"}}},ne={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},re={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},oe={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"}}},le=[Y,Z,re,Q,ee,te,ae,ne,N,{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},{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"}}},{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"}}},X,J,{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},{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"}}},V,{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},$,G,oe,{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},{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},{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"}}},{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/"}}},{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"}}}],ie=new Set(le.map((e=>e.id)));let se="#FFFFFF";function pe(e,t){let a=Math.max(0,Math.min(1,e.toHsl().l+t));return l({...e.toHsl(),l:a})}function ce({backgroundTheme:e,accentHex:t}){let a;switch(e){case"light":a=se;break;case"dark":a="#1E1E1D";break;default:a=e}let n=l(a),r=l(t),o=l("#51BA81"),i=l("#FFB74D"),s=l("#EC6351"),p=function(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}(n.getLuminance()),c=pe(n,"light"===p?-.04:.11),h=pe(n,"light"===p?-.88:.87),u=pe(n,"light"===p?-.7:.75),d=pe(n,"light"===p?-.43:.45).desaturate("light"===p?60:20),m=pe(n,"light"===p?-.08:.25).desaturate("light"===p?60:20),g=pe(r,.15),f=pe(r,-.06),y=pe(s,.3),b=pe(i,.3),w=l(r.getLuminance()>.5?"#040217":se),v=pe(o,-.16),C=pe(o,.4);return{colorScheme:p,background:n.toHslString(),background2:c.toHslString(),foreground:h.toHslString(),foreground2:u.toHslString(),foreground3:d.toHslString(),foreground4:m.toHslString(),accent:r.toHslString(),accentLight:g.toHslString(),accentDark:f.toHslString(),foregroundAccent:w.toHslString(),success:o.toHslString(),successDark:v.toHslString(),successLight:C.toHslString(),error:s.toHslString(),errorLight:y.toHslString(),warn:i.toHslString(),warnLight:b.toHslString()}}function he(e,t,a){let n,r,o,l,i,s,p,c,h,u,d,m,g,f,y,b,w=a?console.warn:()=>{};t?.loginMethods?(n=t.loginMethods.includes("email"),r=t.loginMethods.includes("sms"),l=t.loginMethods.includes("wallet"),i=t.loginMethods.includes("google"),s=t.loginMethods.includes("twitter"),p=t.loginMethods.includes("discord"),h=t.loginMethods.includes("spotify"),u=t.loginMethods.includes("instagram"),c=t.loginMethods.includes("tiktok"),m=t.loginMethods.includes("github"),d=t.loginMethods.includes("linkedin"),g=t.loginMethods.includes("apple"),f=t.loginMethods.includes("farcaster"),y=t.loginMethods.includes("telegram")):(n=e.emailAuth,r=e.smsAuth,l=e.walletAuth,i=e.googleOAuth,s=e.twitterOAuth,p=e.discordOAuth,m=e.githubOAuth,h=e.spotifyOAuth,u=e.instagramOAuth,c=e.tiktokOAuth,d=e.linkedinOAuth,g=e.appleOAuth,f=e.farcasterAuth,y=e.telegramAuth),"undefined"!=typeof window&&"function"!=typeof window.PublicKeyCredential?o=!1:e.passkeyAuth&&(o=!0);let v=[n,r].filter(Boolean),C=[i,s,p,m,h,u,c,d,g,f,y].filter(Boolean),k=[l].filter(Boolean);if(v.length+C.length+k.length===0)throw Error("You must enable at least one login method");let E=void 0!==t?.appearance?.showWalletLoginFirst?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;E&&0===k.length?(w("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),E=!1):E||C.length+v.length!==0||(w("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),E=!0);let S=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&w("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let x=K({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),O=(({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],a=[];for(let a of(e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`"),e.primary.slice(1)))t.includes(a)?console.warn(`Duplicated login method: ${a}`):t.push(a);for(let n of e.overflow??[])t.includes(n)||a.includes(n)?console.warn(`Duplicated login method: ${n}`):a.push(n);return{primary:t,overflow:a}})({input:t?.loginMethodsAndOrder}),A=t?.intl?.defaultCountry??"US",{chains:U,defaultChain:M}=function({additionalChains:e,supportedChains:t,defaultChainFromConfig:a,hasRpcConfigDefined:n}){let r;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(0===t.length)throw Error("`supportedChains` must contain at least one chain");t.filter((e=>e.rpcUrls.privyWalletOverride)).length>0&&n&&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`."),r=t.map((e=>e.rpcUrls.privyWalletOverride?e:le.find((t=>t.id===e.id))??e))}else r=le.concat(e??[]);let o=t?r[0]:Q,l=a??o;if(!r.find((e=>e.id===l.id)))throw Error("`defaultChain` must be included in `supportedChains`");return{chains:r,defaultChain:l}}({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),H=!!t?.defaultChain,L=t?.customAuth?.getCustomAccessToken&&!1!==t?.customAuth?.enabled,W=!(e.enforceWalletUis??1);if(b=e.legacyWalletUiConfig??1?L?t?.embeddedWallets?.noPromptOnSignature??!0:t?.embeddedWallets?.noPromptOnSignature??W:W,!1===t?.embeddedWallets?.waitForTransactionConfirmation&&!0!==b)throw Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:T,...F}=t?.embeddedWallets??{};return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,landingHeader:t?.appearance?.landingHeader??R.appearance.landingHeader,loginMessage:"string"==typeof t?.appearance?.loginMessage?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,palette:ce({backgroundTheme:t?.appearance?.theme??R.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??R.appearance.accentColor}),loginGroupPriority:E?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:x,walletChainType:t?.appearance?.walletChainType??"ethereum-only"},loginMethods:{wallet:l,email:n,sms:r,passkey:o,google:i,twitter:s,discord:p,github:m,spotify:h,instagram:u,tiktok:c,linkedin:d,apple:g,farcaster:f,telegram:y},loginMethodsAndOrder:O,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??R.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??R.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??R.rpcConfig.rpcTimeouts},chains:U,defaultChain:M,intl:{defaultCountry:A},shouldEnforceDefaultChainOnConnect:H,captchaEnabled:e.captchaEnabled??R.captchaEnabled,captchaSiteKey:e.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??R.externalWallets.coinbaseWallet.connectionOptions},walletConnect:{enabled:S},solana:{connectors:t?.externalWallets?.solana?.connectors}},embeddedWallets:{...e.embeddedWalletConfig,..."boolean"==typeof T?{requireUserOwnedRecoveryOnCreate:T}:{},...L?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...F,noPromptOnSignature:b},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:L?{enabled:!0,...t.customAuth}:void 0,loginConfig:{telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{standalone:t?._render?.standalone??R._render.standalone},fundingConfig:e.fundingConfig,fundingMethodConfig:{...t?.fundingMethodConfig??R.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??R.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??t?.fiatOnRamp?.useSandbox??R.fundingMethodConfig.moonpay.useSandbox}}}}let ue={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:""};const de=he(ue,void 0,!1);let me=o({appConfig:de,isServerConfigLoaded:!1});const ge=({children:r,legacyCreateEmbeddedWalletFlag:o,client:l,clientConfig:i})=>{let[s,p]=t(null),c=a((()=>he(s??ue,i,!!s)),[s,i]);return n((()=>{if(!s)return;let e=function(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:a,additionalChains:n,supportedChains:r,defaultChain:o,externalWallets:l,...i}=e;return{...i,...n?{additionalChains:n.map((e=>e.id))}:void 0,...r?{supportedChains:r.map((e=>e.id))}:void 0,...o?{defaultChain:o.id}:void 0,...l?{walletConnect:l.walletConnect,coinbaseWallet:l.coinbaseWallet,solana:{connectors:l.solana?.connectors?.get().map((e=>e.walletClientType))}}:void 0,legacyCreateEmbeddedWalletFlag:t}}(i,o),t=function(e,t=0){let a=3735928559^t,n=1103547991^t;for(let t,r=0;r<e.length;r++)a=Math.imul(a^(t=e.charCodeAt(r)),2654435761),n=Math.imul(n^t,1597334677);return a=Math.imul(a^a>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),4294967296*(2097151&(n=Math.imul(n^n>>>16,2246822507)^Math.imul(a^a>>>13,3266489909)))+(a>>>0)}(JSON.stringify(e)).toString(),a=`privy:sent:${s.id}:${t}`;localStorage.getItem(a)||(l.createAnalyticsEvent({eventName:"sdk_initialize",payload:e}),localStorage.setItem(a,"t"))}),[i,o,s]),n((()=>{s||(async()=>{try{let e=await l.getServerConfig();e.customApiUrl&&l.updateApiUrl(e.customApiUrl),p(e)}catch(e){console.warn("Error generating app config: ",e)}})()}),[]),e(me.Provider,{value:{appConfig:c,isServerConfigLoaded:!!s},children:r})},fe=()=>{let{appConfig:e}=r(me);return e},ye=()=>{let{isServerConfigLoaded:e}=r(me);return e},be=o(null);function we(){let e=r(be);if(null===e)throw Error("`useWallets` was called outside the PrivyProvider component");return e}export{le as $,oe as A,we as B,x as C,L as D,h as E,v as F,P as G,O as H,y as I,j as J,z as K,re as L,_ as M,te as N,A as O,ne as P,J as Q,g as R,S,d as T,G as U,u as V,F as W,Z as X,ge as Y,ye as Z,be as _,U as a,de as a0,ie as a1,T as b,M as c,H as d,E as e,w as f,k as g,B as h,m as i,f as j,b as k,i as l,s as m,C as n,p as o,c as p,W as q,Y as r,$ as s,X as t,fe as u,N as v,V as w,Q as x,ee as y,ae as z};
@@ -0,0 +1 @@
1
+ import{getAddress as e}from"@ethersproject/address";function t(e){return e?new Date(1e3*e):null}function i(e,t){return e.slice().sort(((e,t)=>(t.firstVerifiedAt??t.verifiedAt).getTime()-(e.firstVerifiedAt??e.verifiedAt).getTime())).find((e=>e.type===t))}const a=e=>e?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType&&!e.imported&&"ethereum"===e.chainType&&0===e.walletIndex))||null,r=e=>e?.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&!e.imported&&"ethereum"===e.chainType)),s=e=>e?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType&&!e.imported&&"solana"===e.chainType))||null,l=e=>e?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType&&e.imported&&"ethereum"===e.chainType))||null,d=(t,i)=>{let r=(s=t,s?.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&"ethereum"===e.chainType))).find((t=>e(t.address)===e(i)));var s;return{signingWallet:r,rootWallet:r?r.imported?r:a(t):void 0}};const f=(e,t)=>!(a(e)||s(e)||"all-users"!==t&&("users-without-wallets"!==t||(e=>e.linkedAccounts.filter((e=>"wallet"===e.type)))(e)?.length));function n(e){if(!e)return null;let a=function(e){let i=[];for(let a of e){let e=a.type;switch(a.type){case"wallet":let r={address:a.address,type:a.type,imported:a.imported,verifiedAt:t(a.verified_at),firstVerifiedAt:t(a.first_verified_at),latestVerifiedAt:t(a.latest_verified_at),chainType:a.chain_type,chainId:a.chain_id,walletClient:"privy"===a.wallet_client_type?"privy":"unknown",walletClientType:a.wallet_client_type,connectorType:a.connector_type,recoveryMethod:a.recovery_method,walletIndex:a.wallet_index};i.push(r);break;case"smart_wallet":let s={address:a.address,type:a.type,verifiedAt:t(a.verified_at),firstVerifiedAt:t(a.first_verified_at),latestVerifiedAt:t(a.latest_verified_at),smartWalletType:a.smart_wallet_type};i.push(s);break;case"cross_app":let l={type:a.type,subject:a.subject,embeddedWallets:a.embedded_wallets,smartWallets:a.smart_wallets,providerApp:{id:a.provider_app_id},verifiedAt:t(a.verified_at),firstVerifiedAt:t(a.first_verified_at),latestVerifiedAt:t(a.latest_verified_at)};i.push(l);break;case"email":let d={address:a.address,type:a.type,verifiedAt:t(a.verified_at),firstVerifiedAt:t(a.first_verified_at),latestVerifiedAt:t(a.latest_verified_at)};i.push(d);break;case"phone":let f={number:a.phoneNumber,type:a.type,verifiedAt:t(a.verified_at),firstVerifiedAt:t(a.first_verified_at),latestVerifiedAt:t(a.latest_verified_at)};i.push(f);break;case"google_oauth":let n={subject:a.subject,email:a.email,name:a.name,type:a.type,verifiedAt:t(a.verified_at),firstVerifiedAt:t(a.first_verified_at),latestVerifiedAt:t(a.latest_verified_at)};i.push(n);break;case"spotify_oauth":let u={subject:a.subject,email:a.email,name:a.name,type:a.type,verifiedAt:t(a.verified_at),firstVerifiedAt:t(a.first_verified_at),latestVerifiedAt:t(a.latest_verified_at)};i.push(u);break;case"instagram_oauth":let p={subject:a.subject,username:a.username,type:a.type,verifiedAt:t(a.verified_at),firstVerifiedAt:t(a.first_verified_at),latestVerifiedAt:t(a.latest_verified_at)};i.push(p);break;case"twitter_oauth":let _={subject:a.subject,username:a.username,name:a.name,type:a.type,profilePictureUrl:a.profile_picture_url,verifiedAt:t(a.verified_at),firstVerifiedAt:t(a.first_verified_at),latestVerifiedAt:t(a.latest_verified_at)};i.push(_);break;case"discord_oauth":let m={subject:a.subject,username:a.username,email:a.email,type:a.type,verifiedAt:t(a.verified_at),firstVerifiedAt:t(a.first_verified_at),latestVerifiedAt:t(a.latest_verified_at)};i.push(m);break;case"github_oauth":let c={subject:a.subject,username:a.username,name:a.name,email:a.email,type:a.type,verifiedAt:t(a.verified_at),firstVerifiedAt:t(a.first_verified_at),latestVerifiedAt:t(a.latest_verified_at)};i.push(c);break;case"tiktok_oauth":let o={subject:a.subject,username:a.username,name:a.name,type:a.type,verifiedAt:t(a.verified_at),firstVerifiedAt:t(a.first_verified_at),latestVerifiedAt:t(a.latest_verified_at)};i.push(o);break;case"linkedin_oauth":let y={subject:a.subject,name:a.name,email:a.email,vanityName:a.vanity_name,type:a.type,verifiedAt:t(a.verified_at),firstVerifiedAt:t(a.first_verified_at),latestVerifiedAt:t(a.latest_verified_at)};i.push(y);break;case"apple_oauth":let v={subject:a.subject,email:a.email,type:a.type,verifiedAt:t(a.verified_at),firstVerifiedAt:t(a.first_verified_at),latestVerifiedAt:t(a.latest_verified_at)};i.push(v);break;case"custom_auth":i.push({type:a.type,customUserId:a.custom_user_id,verifiedAt:t(a.verified_at),firstVerifiedAt:t(a.first_verified_at),latestVerifiedAt:t(a.latest_verified_at)});break;case"farcaster":let h={type:a.type,fid:a.fid,ownerAddress:a.owner_address,displayName:a.display_name,username:a.username,bio:a.bio,pfp:a.profile_picture_url,url:a.homepage_url,verifiedAt:t(a.verified_at),firstVerifiedAt:t(a.first_verified_at),latestVerifiedAt:t(a.latest_verified_at),signerPublicKey:a.signer_public_key};i.push(h);break;case"passkey":let b={type:a.type,enrolledInMfa:a.enrolled_in_mfa,credentialId:a.credential_id,authenticatorName:a.authenticator_name,createdWithDevice:a.created_with_device,createdWithOs:a.created_with_os,createdWithBrowser:a.created_with_browser,verifiedAt:t(a.verified_at),firstVerifiedAt:t(a.first_verified_at),latestVerifiedAt:t(a.latest_verified_at)};i.push(b);break;case"telegram":let A={type:a.type,telegramUserId:a.telegram_user_id,firstName:a.first_name,lastName:a.last_name,username:a.username,photoUrl:a.photo_url,verifiedAt:t(a.first_verified_at),firstVerifiedAt:t(a.first_verified_at),latestVerifiedAt:t(a.latest_verified_at)};i.push(A);break;default:console.warn(`Unrecognized account type: ${e}. Please consider upgrading the Privy SDK.`)}}return i}(e.linked_accounts),r=i(a,"wallet"),s=i(a,"smart_wallet"),l=i(a,"email"),d=i(a,"phone"),f=i(a,"google_oauth"),n=i(a,"twitter_oauth"),u=i(a,"discord_oauth"),p=i(a,"github_oauth"),_=i(a,"spotify_oauth"),m=i(a,"instagram_oauth"),c=i(a,"tiktok_oauth"),o=i(a,"linkedin_oauth"),y=i(a,"apple_oauth"),v=i(a,"farcaster"),h=i(a,"telegram"),b=e.mfa_methods.map((({type:e,verified_at:i})=>({type:e,verifiedAt:t(i)})));return{id:e.id,createdAt:t(e.created_at),linkedAccounts:a,email:l&&{address:l?.address},phone:d&&{number:d?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod,imported:r.imported,walletIndex:r.walletIndex},smartWallet:s&&{address:s.address,smartWalletType:s.smartWalletType},google:f&&{subject:f.subject,email:f.email,name:f.name},twitter:n&&{subject:n.subject,username:n.username,name:n.name,profilePictureUrl:n.profilePictureUrl},discord:u&&{subject:u.subject,username:u.username,email:u.email},github:p&&{subject:p.subject,username:p.username,name:p.name,email:p.email},spotify:_&&{subject:_.subject,email:_.email,name:_.name},instagram:m&&{subject:m.subject,username:m.username},tiktok:c&&{subject:c.subject,username:c.username,name:c.name},linkedin:o&&{subject:o.subject,name:o.name,email:o.email,vanityName:o.vanityName},apple:y&&{subject:y.subject,email:y.email},farcaster:v&&{fid:v.fid,ownerAddress:v.ownerAddress,displayName:v.displayName,username:v.username,bio:v.bio,pfp:v.pfp,url:v.url,signerPublicKey:v.signerPublicKey},telegram:h&&{telegramUserId:h.telegramUserId,firstName:h.firstName,lastName:h.lastName,username:h.username,photoUrl:h.photoUrl},mfaMethods:b.map((e=>e.type)),hasAcceptedTerms:e.has_accepted_terms??!1,isGuest:e.is_guest,customMetadata:e.custom_metadata}}export{l as a,s as b,n as c,r as d,d as e,a as g,f as s};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@privy-io/react-auth",
3
- "version": "1.88.0-beta-20240926133016",
3
+ "version": "1.88.0",
4
4
  "description": "React client for the Privy Auth API",
5
5
  "keywords": [
6
6
  "authentication",
@@ -74,9 +74,10 @@
74
74
  "README.md"
75
75
  ],
76
76
  "scripts": {
77
- "build": "rollup -c",
77
+ "build": "rollup --config rollup.types.mjs& rollup --config rollup.build.mjs& wait",
78
78
  "clean": "rm -rf dist .turbo",
79
- "dev": "rollup -c --watch",
79
+ "d//": "To parallelize types and code build output rollup recommends running multiple instances",
80
+ "dev": "rollup --config rollup.types.mjs --watch& rollup --config rollup.dev.mjs --watch& wait",
80
81
  "format": "eslint --fix",
81
82
  "lint": "eslint && npx tsc --noEmit",
82
83
  "stories": "cd storybook && vite --port=5702",
@@ -106,7 +107,7 @@
106
107
  "@heroicons/react": "^2.1.1",
107
108
  "@marsidev/react-turnstile": "^0.4.1",
108
109
  "@metamask/eth-sig-util": "^6.0.0",
109
- "@privy-io/js-sdk-core": "0.28.3-beta-20240926133016",
110
+ "@privy-io/js-sdk-core": "0.28.3",
110
111
  "@simplewebauthn/browser": "^9.0.1",
111
112
  "@solana/wallet-adapter-base": "^0.9.23",
112
113
  "@solana/wallet-standard-wallet-adapter-base": "^1.1.2",
@@ -145,7 +146,7 @@
145
146
  "@babel/preset-typescript": "^7.24.7",
146
147
  "@jest/globals": "^29.7.0",
147
148
  "@privy-io/eslint-config-custom": "*",
148
- "@privy-io/public-api": "2.10.2-beta-20240926133016",
149
+ "@privy-io/public-api": "2.10.2",
149
150
  "@rollup/plugin-commonjs": "^26.0.1",
150
151
  "@rollup/plugin-node-resolve": "^15.2.3",
151
152
  "@rollup/plugin-replace": "^5.0.5",
@@ -1 +0,0 @@
1
- "use strict";var e,t=require("ofetch"),r=require("react");class i extends Error{toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(e,t,r){super(e),t instanceof Error&&(this.cause=t),this.privyErrorCode=r}}class s extends i{constructor(e,t,r,i,s,a){super(r,i,s),this.type=e,this.status=t,this.data=a}}class a extends i{constructor(e,t,r){super(e,t,r),this.type="client_error"}}const n=e=>e instanceof i?e:e instanceof Error?new a(e.message,e):new a(`Internal error: ${e}`);exports.PrivyErrorCode=void 0,(e=exports.PrivyErrorCode||(exports.PrivyErrorCode={})).OAUTH_ACCOUNT_SUSPENDED="oauth_account_suspended",e.MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",e.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",e.MISSING_OR_INVALID_TOKEN="missing_or_invalid_token",e.INVALID_DATA="invalid_data",e.INVALID_CAPTCHA="invalid_captcha",e.LINKED_TO_ANOTHER_USER="linked_to_another_user",e.CANNOT_LINK_MORE_OF_TYPE="cannot_link_more_of_type",e.FAILED_TO_LINK_ACCOUNT="failed_to_link_account",e.ALLOWLIST_REJECTED="allowlist_rejected",e.OAUTH_USER_DENIED="oauth_user_denied",e.OAUTH_UNEXPECTED="oauth_unexpected",e.UNKNOWN_AUTH_ERROR="unknown_auth_error",e.USER_EXITED_AUTH_FLOW="exited_auth_flow",e.USER_EXITED_LINK_FLOW="exited_link_flow",e.USER_EXITED_SET_PASSWORD_FLOW="user_exited_set_password_flow",e.MUST_BE_AUTHENTICATED="must_be_authenticated",e.UNKNOWN_CONNECT_WALLET_ERROR="unknown_connect_wallet_error",e.GENERIC_CONNECT_WALLET_ERROR="generic_connect_wallet_error",e.CLIENT_REQUEST_TIMEOUT="client_request_timeout",e.INVALID_CREDENTIALS="invalid_credentials",e.MISSING_MFA_CREDENTIALS="missing_or_invalid_mfa",e.UNKNOWN_MFA_ERROR="unknown_mfa_error",e.EMBEDDED_WALLET_ALREADY_EXISTS="embedded_wallet_already_exists",e.EMBEDDED_WALLET_NOT_FOUND="embedded_wallet_not_found",e.UNKNOWN_EMBEDDED_WALLET_ERROR="unknown_embedded_wallet_error",e.EMBEDDED_WALLET_PASSWORD_UNCONFIRMED="embedded_wallet_password_unconfirmed",e.EMBEDDED_WALLET_PASSWORD_ALREADY_EXISTS="embedded_wallet_password_already_exists",e.EMBEDDED_WALLET_RECOVERY_ALREADY_EXISTS="embedded_wallet_recovery_already_exists",e.TRANSACTION_FAILURE="transaction_failure",e.UNSUPPORTED_CHAIN_ID="unsupported_chain_id",e.NOT_SUPPORTED="not_supported",e.CAPTCHA_TIMEOUT="captcha_timeout",e.INVALID_MESSAGE="invalid_message",e.UNABLE_TO_SIGN="unable_to_sign",e.CAPTCHA_FAILURE="captcha_failure",e.CAPTCHA_DISABLED="captcha_disabled",e.SESSION_STORAGE_UNAVAILABLE="session_storage_unavailable",e.TOO_MANY_REQUESTS="too_many_requests",e.USER_LIMIT_REACHED="max_accounts_reached",e.DISALLOWED_LOGIN_METHOD="disallowed_login_method",e.PASSKEY_NOT_ALLOWED="passkey_not_allowed",e.USER_DOES_NOT_EXIST="user_does_not_exist",e.INSUFFICIENT_BALANCE="insufficient_balance",e.ACCOUNT_TRANSFER_REQUIRED="account_transfer_required";const o=()=>{throw Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")},_=r.createContext({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:o,initializeWalletProxy:o,getAuthMeta:o,getAuthFlow:o,closePrivyModal:o,openPrivyModal:o,connectWallet:o,initLoginWithWallet:o,loginWithWallet:o,initLoginWithFarcaster:o,loginWithFarcaster:o,loginWithCode:o,initLoginWithEmail:o,initLoginWithSms:o,initUpdateEmail:o,initUpdatePhone:o,resendEmailCode:o,resendSmsCode:o,initLoginWithHeadlessOAuth:o,loginWithHeadlessOAuth:o,crossAppAuthFlow:o,initLoginWithOAuth:o,recoveryOAuthFlow:o,loginWithOAuth:o,passkeyAuthState:{status:"initial"},setPasskeyAuthState:o,initLoginWithPasskey:o,loginWithPasskey:o,initLinkWithPasskey:o,linkWithPasskey:o,refreshUser:o,loginWithGuestAccountFlow:o,walletProxy:null,createAnalyticsEvent:o,acceptTerms:o,getUsdTokenPrice:o,getUsdPriceForSol:o,recoverEmbeddedEthereumWallet:o,getMoonpaySignedUrl:o,initCoinbaseOnRamp:o,getCoinbaseOnRampStatus:o,updateWallets:o,fundWallet:o,setReadyToTrue:o,requestFarcasterSignerStatus:o,initLoginWithTelegram:o,loginWithTelegram:o,generateSiweMessage:o,linkWithSiwe:o,linkSmartWallet:o,embeddedSolanaWallet:null,createEmbeddedSolanaWallet:o,recoverEmbeddedSolanaWallet:o,exportSolanaWallet:o,solanaSignMessage:o,connectCoinbaseSmartWallet:o,initiateAccountTransfer:o,emailOtpState:{status:"initial"},setEmailOtpState:o,smsOtpState:{status:"initial"},setSmsOtpState:o,siweState:{status:"initial"},setSiweState:o,oAuthState:{status:"initial"},setOAuthState:o});exports.InternalPrivyContext=_,exports.PrivyApiError=s,exports.PrivyClientError=a,exports.PrivyConnectorError=class extends i{constructor(e,t,r){super(e,t,r),this.type="connector_error"}},exports.PrivyEmbeddedWalletError=class extends a{constructor(e="Embedded wallet error",t){super(e,t,"unknown_embedded_wallet_error")}},exports.PrivyError=i,exports.PrivyNotReadyError=class extends a{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},exports.PrivyTimeoutError=class extends a{constructor(){super("Request timed out",void 0,"client_request_timeout")}},exports.PrivyUnauthenticatedError=class extends a{constructor(e="User must be authenticated"){super(e,void 0,"must_be_authenticated")}},exports.PrivyUserLimitReachedError=class extends a{constructor(e){super("This application is in development mode and must be upgraded to production to log in new users.",e,"max_accounts_reached")}},exports.formatApiError=e=>{if(e instanceof i)return e;if(!(e instanceof t.FetchError))return n(e);if(!e.response)return new s("api_error",null,e.message,e);let{type:r,message:a,error:o,code:_}=e.data;return new s(r||"ApiError",e.response.status,a||o,e,_,e.data)},exports.formatPrivyError=n,exports.notImplemented=o,exports.usePrivyInternal=()=>r.useContext(_);
@@ -1 +0,0 @@
1
- import{FetchError as e}from"ofetch";import{createContext as t,useContext as a}from"react";var s;class i extends Error{toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(e,t,a){super(e),t instanceof Error&&(this.cause=t),this.privyErrorCode=a}}class n extends i{constructor(e,t,a,s,i,n){super(a,s,i),this.type=e,this.status=t,this.data=n}}class r extends i{constructor(e,t,a){super(e,t,a),this.type="client_error"}}class _ extends r{constructor(){super("Request timed out",void 0,"client_request_timeout")}}class o extends i{constructor(e,t,a){super(e,t,a),this.type="connector_error"}}const l=t=>{if(t instanceof i)return t;if(!(t instanceof e))return d(t);if(!t.response)return new n("api_error",null,t.message,t);let{type:a,message:s,error:r,code:_}=t.data;return new n(a||"ApiError",t.response.status,s||r,t,_,t.data)},d=e=>e instanceof i?e:e instanceof Error?new r(e.message,e):new r(`Internal error: ${e}`);var E;(s=E||(E={})).OAUTH_ACCOUNT_SUSPENDED="oauth_account_suspended",s.MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",s.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",s.MISSING_OR_INVALID_TOKEN="missing_or_invalid_token",s.INVALID_DATA="invalid_data",s.INVALID_CAPTCHA="invalid_captcha",s.LINKED_TO_ANOTHER_USER="linked_to_another_user",s.CANNOT_LINK_MORE_OF_TYPE="cannot_link_more_of_type",s.FAILED_TO_LINK_ACCOUNT="failed_to_link_account",s.ALLOWLIST_REJECTED="allowlist_rejected",s.OAUTH_USER_DENIED="oauth_user_denied",s.OAUTH_UNEXPECTED="oauth_unexpected",s.UNKNOWN_AUTH_ERROR="unknown_auth_error",s.USER_EXITED_AUTH_FLOW="exited_auth_flow",s.USER_EXITED_LINK_FLOW="exited_link_flow",s.USER_EXITED_SET_PASSWORD_FLOW="user_exited_set_password_flow",s.MUST_BE_AUTHENTICATED="must_be_authenticated",s.UNKNOWN_CONNECT_WALLET_ERROR="unknown_connect_wallet_error",s.GENERIC_CONNECT_WALLET_ERROR="generic_connect_wallet_error",s.CLIENT_REQUEST_TIMEOUT="client_request_timeout",s.INVALID_CREDENTIALS="invalid_credentials",s.MISSING_MFA_CREDENTIALS="missing_or_invalid_mfa",s.UNKNOWN_MFA_ERROR="unknown_mfa_error",s.EMBEDDED_WALLET_ALREADY_EXISTS="embedded_wallet_already_exists",s.EMBEDDED_WALLET_NOT_FOUND="embedded_wallet_not_found",s.UNKNOWN_EMBEDDED_WALLET_ERROR="unknown_embedded_wallet_error",s.EMBEDDED_WALLET_PASSWORD_UNCONFIRMED="embedded_wallet_password_unconfirmed",s.EMBEDDED_WALLET_PASSWORD_ALREADY_EXISTS="embedded_wallet_password_already_exists",s.EMBEDDED_WALLET_RECOVERY_ALREADY_EXISTS="embedded_wallet_recovery_already_exists",s.TRANSACTION_FAILURE="transaction_failure",s.UNSUPPORTED_CHAIN_ID="unsupported_chain_id",s.NOT_SUPPORTED="not_supported",s.CAPTCHA_TIMEOUT="captcha_timeout",s.INVALID_MESSAGE="invalid_message",s.UNABLE_TO_SIGN="unable_to_sign",s.CAPTCHA_FAILURE="captcha_failure",s.CAPTCHA_DISABLED="captcha_disabled",s.SESSION_STORAGE_UNAVAILABLE="session_storage_unavailable",s.TOO_MANY_REQUESTS="too_many_requests",s.USER_LIMIT_REACHED="max_accounts_reached",s.DISALLOWED_LOGIN_METHOD="disallowed_login_method",s.PASSKEY_NOT_ALLOWED="passkey_not_allowed",s.USER_DOES_NOT_EXIST="user_does_not_exist",s.INSUFFICIENT_BALANCE="insufficient_balance",s.ACCOUNT_TRANSFER_REQUIRED="account_transfer_required";class u extends r{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}}class c extends r{constructor(e="Embedded wallet error",t){super(e,t,"unknown_embedded_wallet_error")}}class A extends r{constructor(e="User must be authenticated"){super(e,void 0,"must_be_authenticated")}}class S extends r{constructor(e){super("This application is in development mode and must be upgraded to production to log in new users.",e,"max_accounts_reached")}}const T=()=>{throw Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")},h=t({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:T,initializeWalletProxy:T,getAuthMeta:T,getAuthFlow:T,closePrivyModal:T,openPrivyModal:T,connectWallet:T,initLoginWithWallet:T,loginWithWallet:T,initLoginWithFarcaster:T,loginWithFarcaster:T,loginWithCode:T,initLoginWithEmail:T,initLoginWithSms:T,initUpdateEmail:T,initUpdatePhone:T,resendEmailCode:T,resendSmsCode:T,initLoginWithHeadlessOAuth:T,loginWithHeadlessOAuth:T,crossAppAuthFlow:T,initLoginWithOAuth:T,recoveryOAuthFlow:T,loginWithOAuth:T,passkeyAuthState:{status:"initial"},setPasskeyAuthState:T,initLoginWithPasskey:T,loginWithPasskey:T,initLinkWithPasskey:T,linkWithPasskey:T,refreshUser:T,loginWithGuestAccountFlow:T,walletProxy:null,createAnalyticsEvent:T,acceptTerms:T,getUsdTokenPrice:T,getUsdPriceForSol:T,recoverEmbeddedEthereumWallet:T,getMoonpaySignedUrl:T,initCoinbaseOnRamp:T,getCoinbaseOnRampStatus:T,updateWallets:T,fundWallet:T,setReadyToTrue:T,requestFarcasterSignerStatus:T,initLoginWithTelegram:T,loginWithTelegram:T,generateSiweMessage:T,linkWithSiwe:T,linkSmartWallet:T,embeddedSolanaWallet:null,createEmbeddedSolanaWallet:T,recoverEmbeddedSolanaWallet:T,exportSolanaWallet:T,solanaSignMessage:T,connectCoinbaseSmartWallet:T,initiateAccountTransfer:T,emailOtpState:{status:"initial"},setEmailOtpState:T,smsOtpState:{status:"initial"},setSmsOtpState:T,siweState:{status:"initial"},setSiweState:T,oAuthState:{status:"initial"},setOAuthState:T}),p=()=>a(h);export{h as I,r as P,E as a,o as b,_ as c,d,n as e,l as f,i as g,S as h,c as i,A as j,u as k,T as n,p as u};