@privy-io/react-auth 1.41.0 → 1.42.0-beta-20231002184247
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +196 -196
- package/dist/index.d.ts +39 -6
- package/dist/index.js +194 -194
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var qp=(e,t,o)=>{if(!t.has(e))throw TypeError("Cannot "+o)};var qa=(e,t,o)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,o)};var ja=(e,t,o)=>(qp(e,t,"access private method"),o);import{getAddress as ii}from"@ethersproject/address";import{StaticJsonRpcProvider as V1,Web3Provider as Fa}from"@ethersproject/providers";import{useEffect as bt,useMemo as $1,useRef as Wp,useState as Q}from"react";import{FetchError as jp}from"ofetch";var Qe=class extends Error{constructor(o,r,n){super(o);r instanceof Error&&(this.cause=r),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Io=class extends Qe{constructor(o,r,n,i,a){super(n,i,a);this.type=o;this.status=r}},v=class extends Qe{constructor(o,r,n){super(o,r,n);this.type="client_error"}},Mr=class extends v{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var U=class extends Qe{constructor(o,r,n){super(o,r,n);this.type="connector_error"}},te=e=>{if(e instanceof Qe)return e;if(!(e instanceof jp))return Oe(e);if(!e.response)return new Io("api_error",null,e.message,e);let{type:t,message:o,error:r,code:n}=e.data;return new Io(t||"ApiError",e.response.status,o||r,e,n)},Oe=e=>e instanceof Qe?e:e instanceof Error?new v(e.message,e):new v(`Internal error: ${e}`);var sr=class extends v{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},He=class extends v{constructor(t="Embedded wallet error",o){super(t,o,"unknown_embedded_wallet_error")}},Dr=class extends v{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}},Wo=class extends v{constructor(){super("User attempted to exit password dialog before confirming password",void 0,"embedded_wallet_password_unconfirmed")}};var Ur=()=>"/api/v1/sessions",Ka=()=>"/api/v1/sessions/logout",Ya=()=>"/api/v1/sessions/fork",Fr=()=>"/api/v1/sessions/fork/recover",Ja=()=>"/api/v1/siwe/init",Qa=()=>"/api/v1/siwe/authenticate",Za=()=>"/api/v1/siwe/link",Xa=()=>"/api/v1/passwordless/init",es=()=>"/api/v1/passwordless/authenticate",ts=()=>"/api/v1/passwordless/link",os=()=>"/api/v1/passwordless_sms/init",rs=()=>"/api/v1/passwordless_sms/authenticate",ns=()=>"/api/v1/passwordless_sms/link",is=()=>"/api/v1/oauth/init",as=()=>"/api/v1/oauth/authenticate",ss=()=>"/api/v1/oauth/link",ls=()=>"/api/v1/siwe/unlink",cs=()=>"/api/v1/passwordless/unlink",ds=()=>"/api/v1/passwordless_sms/unlink",ps=()=>"/api/v1/oauth/unlink",us=()=>"/api/v1/analytics_events",ms=()=>"/api/v1/plugins/moonpay_on_ramp/sign",hs=()=>"/api/v1/custom_jwt_account/authenticate";var No=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new v("Auth flow has no API instance");try{let t=hs(),o=await this.api.post(t,{token:this.meta.token});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw te(t)}}async link(){throw new Error("Unimplemented")}};var co=class{constructor(t,o){this.meta={email:t,captchaToken:o}}async authenticate(){if(!this.api)throw new v("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new v("Email and email code must be set prior to calling authenticate.");try{let t=es(),o=await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw te(t)}}async link(){if(!this.api)throw new v("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new v("Email and email code must be set prior to calling authenticate.");try{let t=ts();return await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw te(t)}}async sendCodeEmail(t,o){if(!this.api)throw new v("Auth flow has no API instance");if(t&&(this.meta.email=t),o&&(this.meta.captchaToken=o),!this.meta.email)throw new v("Email must be set when initialzing authentication.");try{let r=Xa();return await this.api.post(r,{email:this.meta.email,token:this.meta.captchaToken})}catch(r){throw te(r)}}};var Ut=class{constructor(t,o,r){this.meta={provider:t},this.meta.authorizationCode=o,this.meta.stateCode=r}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new v("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new v("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new v("User denied confirmation during OAuth flow");try{let t=as(),o=await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){let o=te(t);throw o.privyErrorCode?new v(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new v("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new v("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new v("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new v("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new v("User denied confirmation during OAuth flow");try{let t=ss();return await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})}catch(t){throw te(t)}}async getAuthorizationUrl(){if(!this.api)throw new v("Auth flow has no API instance");if(!this.meta.provider)throw new v("Provider must be set when initialzing OAuth authentication.");try{let t=is();return await this.api.post(t,{provider:this.meta.provider,redirect_to:window.location.href},{baseURL:this.api?.fallbackApiUrl})}catch(t){throw te(t)}}};var Ge=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var po=class{constructor(t){this.createSiweMessage=(t,o,r,n,i,a,l)=>`${r} wants you to sign in with your Ethereum account:
|
|
2
2
|
${o}
|
|
3
3
|
|
|
4
4
|
${l}
|
|
@@ -6,10 +6,10 @@ ${l}
|
|
|
6
6
|
URI: ${n}
|
|
7
7
|
Version: 1
|
|
8
8
|
Chain ID: ${t}
|
|
9
|
-
Nonce: ${
|
|
10
|
-
Issued At: ${
|
|
9
|
+
Nonce: ${a}
|
|
10
|
+
Issued At: ${i}
|
|
11
11
|
Resources:
|
|
12
|
-
- https://privy.io`;this.getNonceOnce=new He(this._getNonceOnce.bind(this)),this.wallet=t}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(Ya(),{message:t,signature:o,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType});return{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(t){throw te(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign();return await this.api.post(Ja(),{message:t,signature:o,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw te(t)}}async sign(){if(!this.api)throw new w("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new w("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.api)throw new w("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(Ka(),{address:t})).nonce}async buildSiweMessage(){if(!this.api)throw new w("Auth flow has no API instance");let t=this.wallet.address,o=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(o,t,this.nonce),this.preparedMessage}prepareMessage(t,o,r){let n=window.location.host,a=window.location.origin,i="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",l=new Date().toISOString();return this.createSiweMessage(t,o,n,a,l,r,i)}};var uo=class{constructor(t,o){this.meta={phoneNumber:t,captchaToken:o}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new w("phone number and sms code must be set prior to calling authenticate.");try{let t=ts(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw te(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new w("phone number and sms code must be set prior to calling authenticate.");try{let t=os();return await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw te(t)}}async sendSmsCode(t,o){if(!this.api)throw new w("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),o&&(this.meta.captchaToken=o),!this.meta.phoneNumber)throw new w("phone nNumber must be set when initialzing authentication.");try{let r=es();return await this.api.post(r,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(r){throw te(r)}}};import{v4 as Nu}from"uuid";function Qe(e){return new Date(e*1e3)}function qp(e){let t=[];for(let o of e){let r=o.type;switch(o.type){case"wallet":let n={address:o.address,type:o.type,verifiedAt:Qe(o.verified_at),chainType:"ethereum",chainId:o.chain_id,walletClient:o.wallet_client_type==="privy"?"privy":"unknown",walletClientType:o.wallet_client_type,connectorType:o.connector_type,recoveryMethod:o.recovery_method};t.push(n);break;case"email":let a={address:o.address,type:o.type,verifiedAt:Qe(o.verified_at)};t.push(a);break;case"phone":let i={number:o.phoneNumber,type:o.type,verifiedAt:Qe(o.verified_at)};t.push(i);break;case"google_oauth":let l={subject:o.subject,email:o.email,name:o.name,type:o.type,verifiedAt:Qe(o.verified_at)};t.push(l);break;case"twitter_oauth":let s={subject:o.subject,username:o.username,name:o.name,type:o.type,verifiedAt:Qe(o.verified_at)};t.push(s);break;case"discord_oauth":let c={subject:o.subject,username:o.username,email:o.email,type:o.type,verifiedAt:Qe(o.verified_at)};t.push(c);break;case"github_oauth":let v={subject:o.subject,username:o.username,name:o.name,email:o.email,type:o.type,verifiedAt:Qe(o.verified_at)};t.push(v);break;case"linkedin_oauth":let h={subject:o.subject,name:o.name,email:o.email,type:o.type,verifiedAt:Qe(o.verified_at)};t.push(h);break;case"apple_oauth":let C={subject:o.subject,email:o.email,type:o.type,verifiedAt:Qe(o.verified_at)};t.push(C);break;case"custom_auth":t.push({type:o.type,customUserId:o.custom_user_id,verifiedAt:Qe(o.verified_at)});break;default:console.warn(`Unrecognized account type: ${r}. Please consider upgrading the Privy SDK.`)}}return t}function xt(e,t){return e.sort((o,r)=>r.verifiedAt.getTime()-o.verifiedAt.getTime()),e.find(o=>o.type===t)}var Y=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClient==="privy"),jp=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Ft=(e,t)=>t==="all-users"&&!Y(e)||t==="users-without-wallets"&&!jp(e)?.length;function Tt(e){if(!e)return null;let t=qp(e.linked_accounts),o=xt(t,"wallet"),r=xt(t,"email"),n=xt(t,"phone"),a=xt(t,"google_oauth"),i=xt(t,"twitter_oauth"),l=xt(t,"discord_oauth"),s=xt(t,"github_oauth"),c=xt(t,"linkedin_oauth"),v=xt(t,"apple_oauth");return{id:e.id,createdAt:Qe(e.created_at),linkedAccounts:t,email:r&&{address:r?.address},phone:n&&{number:n?.number},wallet:o&&{address:o.address,chainType:o.chainType,chainId:o.chainId,walletClient:o.walletClient,walletClientType:o.walletClientType,connectorType:o.connectorType,recoveryMethod:o.recoveryMethod},google:a&&{subject:a.subject,email:a.email,name:a.name},twitter:i&&{subject:i.subject,username:i.username,name:i.name},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},linkedin:c&&{subject:c.subject,name:c.name,email:c.email},apple:v&&{subject:v.subject,email:v.email}}}import{getAddress as Qs}from"@ethersproject/address";import Au from"eventemitter3";var ms="1.41.0";var Br="4df5e2316331463a9130964bd6078dfa",hs="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",fs="34357d3c125c2bcf2ce2bc3309d98715",ys="0x4AAAAAAAJFhr_rDU7HKpyw",Hr="https://auth.privy.io",gs=2e4,Ze=1400,vs=2500,li=ms;var Lo="privy:token",ci="privy-token",Gr="privy:refresh_token",di="privy-refresh-token",ws="privy-session",lr="privy:session_transfer_token",Yp="privy:wallet",cr="privy:caid",pi=e=>`${Yp}:${e}`,ui="privy:connectors",mi="privy:connections";var at=1,zr="0x1",Cs="https://api.moonpay.com/v1",bs="https://api.moonpay.com/v1",Es="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",xs="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";var hi=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,o){o!==void 0?this._cache[t]=o:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},fi=class{get(t){let o=localStorage.getItem(t);return o===null?void 0:JSON.parse(o)}put(t,o){o!==void 0?localStorage.setItem(t,JSON.stringify(o)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function Jp(){return typeof window<"u"&&window.localStorage?new fi:new hi}var $=Jp();import{isPossiblePhoneNumber as Qp}from"libphonenumber-js/min";var Vr=()=>{let e=window;if(!e.ethereum)return!1;if($r(window.ethereum,!0))return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if($r(t,!0))return!0}return!1},dr=()=>{let e=window;if(!e.ethereum)return!1;if($r(window.ethereum,!1))return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if($r(t,!1))return!0}return!!window.ethereum.isZerion},$r=(e,t)=>e.isMetaMask?e.isMetaMask&&!t?!0:!(e.isBraveWallet&&!e._events&&!e._state||e.isApexWallet||e.isAvalanche||e.isBitKeep||e.isBlockWallet||e.isKuCoinWallet||e.isMathWallet||e.isOkxWallet||e.isOKExWallet||e.isOneInchIOSWallet||e.isOneInchAndroidWallet||e.isOpera||e.isPhantom||e.isPortal||e.isRabby||e.isRainbow||e.isTokenPocket||e.isTokenary||e.isZerion):!1,Ge=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),qr=()=>{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.isCoinbaseWallet)return!0}return!1};var Ts=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,}))$/),Ps=e=>Qp(String(e),"US"),_s=(e,t)=>{let o=e.slice(0),r=[];for(;o.length;)r.push(o.splice(0,t));return r},Bt=(e,t=3,o=4)=>{if(!e)return"";let r=2,n=3;if(t+o+r+n>=e.length)return e;let a=e.slice(0,r+t),i=e.slice(e.length-o,e.length);return`${a}...${i}`},yi=e=>new Promise(t=>setTimeout(t,e)),Ss=(e,t={})=>{let o=t.delayMs||150,r=t.maxAttempts||270;return new Promise(async(n,a)=>{let i=!1,l=0;for(;!i&&l<r;){if(t.abortSignal?.aborted)return;e().then(()=>{i=!0,n()},(...s)=>{i=!0,a(...s)}),l+=1,await yi(o)}i||a(new Error("Exceeded max attempts before resolving function"))})},jr=(e,t,o={})=>{let r=new URL(t,e);for(let[n,a]of Object.entries(o))r.searchParams.set(n,a);return r.href};var gi=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),pr=e=>typeof e=="string"?e:"0x"+e.toString(16);async function As(e=3e3){let t=!1,o=window;return new Promise(r=>{o.ethereum?n():(window.addEventListener("ethereum#initialized",n,{once:!0}),setTimeout(()=>{n()},e));function n(){if(t)return;t=!0,window.removeEventListener("ethereum#initialized",n);let a=[];Vr()&&a.push("metamask"),Ge()&&a.push("phantom"),o.ethereum&&o.ethereum.isBraveWallet&&a.push("brave"),r(a)}})}function Kr(e){return`eip155:${String(Number(e))}`}var Xe=(e,t,o)=>{let r=Number(e),n=t.find(i=>i.id===r);if(!n)throw new D(`Unsupported chainId ${e}`,4901);let a;if(o.rpcUrls[r]?a=o.rpcUrls[r]:n.rpcUrls.infura?.http[0]?a=n.rpcUrls.infura.http[0]+"/"+Br:n.rpcUrls.blast?.http[0]?a=n.rpcUrls.blast.http[0]+"/"+hs:a=n.rpcUrls.default?.http[0],!a)throw new D(`No RPC url found for ${e}`);return a},Rs=(e,t)=>{let o=Number(e),r=t.find(n=>n.id===o);if(!r)throw new D(`Unsupported chainId ${e}`,4901);return r.blockExplorers?.default.url};import lu from"@coinbase/wallet-sdk";import{jsx as ks,jsxs as Zp}from"react/jsx-runtime";var st=({style:e,...t})=>Zp("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[ks("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),ks("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});import{getAddress as pt}from"@ethersproject/address";import{Web3Provider as Ms}from"@ethersproject/providers";import{default as au}from"eventemitter3";import{StaticJsonRpcProvider as Ws}from"@ethersproject/providers";import nu from"eventemitter3";var Xp=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],Is=e=>Xp.includes(e);import{ErrorCode as eu}from"@ethersproject/logger";var Oo=class extends D{constructor(){super("Wallet timeout");this.type="wallet_error"}},Mo=class extends D{constructor(){super("User rejected connection");this.type="wallet_error"}},ct=e=>{if(e instanceof D)return e;if(e?.code&&e?.reason){let t=new Te(e);return e.code===eu.ACTION_REJECTED&&(t.details=Ae.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Te(e):new D("Unknown connector error",e)},lt=class extends Je{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},Te=class extends lt{constructor(o){let r=o;super(r.message,r.code,r.data);let n=Object.values(Ae).find(a=>a.eipCode===r.code);this.details=n||Ae.UNKNOWN_ERROR,r.code===-32002&&(r.message?.includes("already pending for origin")?r.message?.includes("wallet_requestPermissions")?this.details=Ae.E32002_CONNECTION_ALREADY_PENDING:this.details=Ae.E32002_REQUEST_ALREADY_PENDING:r.message?.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=Ae.E32002_WALLET_LOCKED))}},tu={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}},ou={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},ru={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}},Ae={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...ru,...ou},Pt={...tu,...Ae};var iu=12e4,vi=(e=new Oo,t=iu)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),Z=class{constructor(t){this.removeListener=(t,o)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,o)}catch{console.warn("Unable to remove wallet provider listener")}};this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(o=>{this.removeListener(o.eventName,o.listener)}),this.walletProvider=t,this._subscriptions.forEach(o=>{this.walletProvider?.on(o.eventName,o.listener)})};this.walletProvider=t,this._subscriptions=[]}on(t,o){if(this.walletProvider)return this.walletProvider.on(t,o);this._subscriptions.push({eventName:t,listener:o})}async request(t){if(!this.walletProvider)throw new D(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),vi()]).catch(o=>{throw ct(o)})}},Ht=class extends Error{constructor(o,r,n){super(o);this.code=r,this.data=n}},Yr=class extends nu{constructor(o,r,n,a,i=1){super();this.walletProxy=o,this.address=r,this.chainId=i,this.rpcConfig=n,this.chains=a,this.provider=new Ws(Xe(i,this.chains,n))}async handleSendTransaction(o){if(!o.params||!Array.isArray(o.params))throw new Ht(`Invalid params for ${o.method}`,4200);let r=o.params[0];if(!await _t()||!this.address)throw new Ht("Disconnected",4900);return(await Ls(r)).transactionHash}handleSwitchEthereumChain(o){if(!o.params||!Array.isArray(o.params))throw new Ht(`Invalid params for ${o.method}`,4200);let r;if(typeof o.params[0]=="string")r=o.params[0];else if("chainId"in o.params[0]&&typeof o.params[0].chainId=="string")r=o.params[0].chainId;else throw new Ht(`Invalid params for ${o.method}`,4200);this.chainId=Number(r),this.provider=new Ws(Xe(this.chainId,this.chains,this.rpcConfig)),this.emit("chainChanged",r)}async handlePersonalSign(o){if(!o.params||!Array.isArray(o.params))throw new Error("Invalid params for eth_estimateGas");let r=o.params[0];return await Ns(r)}async handleEstimateGas(o){if(!o.params||!Array.isArray(o.params))throw new Error("Invalid params for eth_estimateGas");delete o.params[0].gasPrice,delete o.params[0].maxFeePerGas,delete o.params[0].maxPriorityFeePerGas;let r={...o.params[0],chainId:pr(this.chainId)};try{return await this.provider.send("eth_estimateGas",[r])}catch{return delete r.from,await this.provider.send("eth_estimateGas",[r])}}async request(o){switch(console.debug("Embedded1193Provider.request() called with args",o),o.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return pr(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(o);case"eth_sendTransaction":return this.handleSendTransaction(o);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(o);case"personal_sign":return this.handlePersonalSign(o);default:break}if(Is(o.method)){let r=await _t();if(await Os(),!r||!this.address)throw new Ht("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.address,accessToken:r,request:{method:o.method,params:o.params}})).response.data}catch(n){throw console.error(n),new Ht("Disconnected",4900)}}else return this.provider.send(o.method,o.params)}async connect(){let o=await _t();if(!o||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:o})).address}catch(r){return console.error(r),null}}},dt=class extends Z{constructor(o){super(o)}},Gt=class extends Z{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var su=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Le=class extends au{constructor(o,r){super();this.onAccountsChanged=o=>{o.length===0?this.onDisconnect():this.syncAccounts(o)};this.onChainChanged=o=>{this.wallets.forEach(r=>{r.chainId=Kr(o),this.walletClientType==="privy"&&$.put(pi(r.address),o)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=o,this.chains=r,this.connected=!1,this.initialized=!1}buildConnectedWallet(o,r){let n=async()=>!!this.wallets.find(a=>pt(a.address)===pt(o));return{address:pt(o),chainId:r,switchChain:async a=>{if(!n)throw new D("Wallet is not currently connected.");let i=this.wallets.find(h=>pt(h.address)===pt(o))?.chainId;if(!i)throw new D("Unable to determine current chainId.");let l,s;if(typeof a=="number"?(l=`0x${a.toString(16)}`,s=a):(l=a,s=Number(a)),i===Kr(l))return;let c=this.chains.find(h=>h.id===s);if(!c)throw new D(`Unsupported chainId: ${a}`);let v=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})};try{return await v()}catch(h){if(su(h,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:l,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:[c.rpcUrls.public?.http[0]??""],blockExplorerUrls:[c.blockExplorers?.default.url??""]}]}),v();throw this.walletClientType==="rainbow"&&h.message?.includes("wallet_switchEthereumChain")?new D(`Rainbow does not support the chainId ${r}`):h}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:n,getEthereumProvider:async()=>{if(!await n())throw new D("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await n())throw new D("Wallet is not currently connected.");return new Ms(new dt(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await n())throw new D("Wallet is not currently connected.");return new Gt(this.proxyProvider)},sign:async a=>{if(!await n())throw new D("Wallet is not currently connected.");return await this.sign(a)},disconnect:()=>{this.disconnect()}}}async syncAccounts(o){let r=o;if(r===void 0){let c=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(c)&&(r=c)}if(!r||!Array.isArray(r)||r.length<=0||!r[0])return;let n=r[0],a=pt(n),i=[],l;if(this.walletClientType==="privy"){l=$.get(pi(a))||zr;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let c=await this.proxyProvider.request({method:"eth_chainId"});if(typeof c!="string")throw new Error("Invalid chainId returned from provider");l=c}catch(c){console.warn(`Failed to get chainId from provider, defaulting to ${zr}`,c),l=zr}let s=Kr(l);i.find(c=>pt(c.address)===a)||i.push(this.buildConnectedWallet(pt(n),s)),Jr(i,this.wallets)||(this.wallets=i,this.emit("walletsUpdated"))}async getConnectedWallet(){let o=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((r,n)=>n.connectedAt-r.connectedAt).find(r=>o.find(n=>pt(n)===pt(r.address)))||null}async isConnected(){let o=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(o)&&o.length>0}async sign(o){return await this.connect({showPrompt:!1}),new Ms(new dt(this.proxyProvider)).getSigner().signMessage(o)}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}};var cu=e=>{let t=`https://mainnet.infura.io/v3/${Br}`,o=1;return e.makeWeb3Provider(t,o)},Qr,Zr=class extends Le{constructor(o){super("coinbase_wallet",o);this.connectorType="coinbase_wallet";this.proxyProvider=new Z,this.subscribeListeners(),Qr||(Qr=new lu({appName:"Privy",darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(cu(Qr)),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){Qr.disconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:st}}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new D("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([o[0]])}catch(o){throw ct(o)}}};import{jsx as Ds}from"react/jsx-runtime";var Do=({...e})=>Ds("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Ds("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)"})});var Xr=class extends Le{constructor(o,r){super("privy",r);this.connectorType="embedded";this.proxyProvider=o,this.subscribeListeners(),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[pr(o?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Do}}disconnect(){this.connected=!1}async promptConnection(){}};import{getAddress as Ew}from"@ethersproject/address";import{Web3Provider as Tw}from"@ethersproject/providers";import{isMobile as pu}from"react-device-detect";import{jsx as Oe,jsxs as du}from"react/jsx-runtime";var be=({style:e,...t})=>du("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...e},...t,children:[Oe("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),Oe("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),Oe("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),Oe("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),Oe("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),Oe("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),Oe("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),Oe("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),Oe("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),Oe("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),Oe("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),Oe("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),Oe("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});var en=class extends Le{constructor(o){super("metamask",o);this.connectorType="injected";this.proxyProvider=new Z,this.subscribeListeners();let r=window,n=r.ethereum,a=r.ethereum.providers||[];for(let i of a)if(i.isMetaMask){n=i;break}this.proxyProvider.setWalletProvider(n),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:"MetaMask",icon:be}}disconnect(){console.warn("Metamask does not support programmatic disconnect.")}async promptConnection(){try{!pu&&Vr()&&await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new D("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw ct(o)}}};import{jsx as Us,jsxs as uu}from"react/jsx-runtime";var ze=({style:e,...t})=>uu("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...e},...t,children:[Us("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),Us("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});var tn=class extends Le{constructor(o){super("phantom",o);this.connectorType="injected";this.proxyProvider=new Z,this.subscribeListeners(),this.proxyProvider.setWalletProvider(window.phantom.ethereum),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:"Phantom",icon:ze}}disconnect(){console.warn("Phantom does not support programmatic disconnect.")}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new D("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw ct(o)}}};import{EthereumProvider as xu,OPTIONAL_EVENTS as Tu,OPTIONAL_METHODS as Pu}from"@walletconnect/ethereum-provider";import bi from"@walletconnect/qrcode-modal";import{isAndroid as _u,isMobile as Su}from"react-device-detect";import{createContext as hu,useContext as fu,useEffect as wi,useRef as yu,useState as Bs}from"react";import{jsx as mu}from"react/jsx-runtime";function Fs(e){return mu("link",{rel:"prefetch",href:e.src})}var T=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as gu,jsxs as vu}from"react/jsx-runtime";var et="LANDING",Hs=hu({ready:!1,app:null,currentScreen:et,lastScreen:et,navigate:T,navigateBack:T,resetNavigation:T,setModalData:T,outerClickRef:null}),Gs=e=>{let t=e.appConfig,o=e.authenticated,r=e.visible,[n,a]=Bs(e.initialScreen||et),[i,l]=Bs(e.initialScreen||et);wi(()=>{o||a(et)},[o]),wi(()=>{r||(l(et),a(et))},[r]),wi(()=>{e.initialScreen&&n===et&&(a(e.initialScreen),l(e.initialScreen))},[e.initialScreen]);let s=e.initialScreen&&n===et?e.initialScreen:n,c=yu(null),v={ready:!!t?.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:s,lastScreen:i,navigate:h=>{l(n),a(h)},navigateBack:()=>{a(i)},resetNavigation:()=>{e.setInitialScreen(null),l(et),a(et)},outerClickRef:c};return vu(Hs.Provider,{value:v,children:[(typeof t?.appearance?.logo=="string"||t?.appearance?.logo?.type==="img")&&gu(Fs,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},g=()=>fu(Hs);import{jsx as Uo,jsxs as wu}from"react/jsx-runtime";var Fo=({style:e,...t})=>{let{app:o}=g();return wu("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[Uo("rect",{width:"28",height:"28",rx:"3",fill:o?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),Uo("g",{clipPath:"url(#clip0_1765_9946)",children:Uo("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),Uo("defs",{children:Uo("clipPath",{id:"clip0_1765_9946",children:Uo("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};import{isAndroid as $s,isDesktop as Cu,isMobileOnly as bu}from"react-device-detect";var on=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[o,r]of Object.entries(Vs))if(r.hostname===t)return{walletClientType:o,entry:r}};var Vs={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",image_id:"5195e9db-94d8-4579-6f11-ef553be95100",hostname:"metamask.io",mobile:{native:"metamask:"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",image_id:"0528ee7e-16d1-4089-21e3-bbfb41933100",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",image_id:"a1cb2777-f8f9-49b0-53fd-443d20ee0b00",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",image_id:"7a33d7f1-3d12-4b5c-f3ee-5cd83cb1b500",hostname:"rainbow.me",mobile:{universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",image_id:"bff9cf1f-df19-42ce-f62a-87f04df13c00",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",image_id:"f216b371-96cf-409a-9d88-296392b85800",hostname:"zerion.io",mobile:{universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",image_id:"215158d2-614b-49c9-410f-77aa661c3900",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",image_id:"1bf33a89-b049-4a1c-d1f6-4dd7419ee400",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",image_id:"2cd67b4c-282b-4809-e7c0-a88cd5116f00",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",image_id:"7c5ff577-a68d-49c5-02cd-3d83637b0b00",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",image_id:"6f913b80-86c0-46f9-61ca-cc90a1805900",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",image_id:"252753e7-b783-4e03-7f77-d39864530900",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",image_id:"3f7075d0-4ab7-4db5-404d-3e4c05e6fe00",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",image_id:"cfc07342-23ea-4f3f-f071-ec9d2cd86b00",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",image_id:"52b1da3c-9e72-40ae-5dac-6142addd9c00",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",image_id:"ebac7b39-688c-41e3-7912-a4fefba74600",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",image_id:"4c16cad4-cac9-4643-6726-c696efaf5200",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",image_id:"e2024511-2c9b-46d7-3111-52df3d241700",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",image_id:"5b1cddfb-056e-4e78-029a-54de5d70c500",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",image_id:"dda0f0fb-34e8-4a57-dcea-b008e7d1ff00",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",image_id:"26a8f588-3231-4411-60ce-5bb6b805a700",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",image_id:"4725dda0-4471-4d0f-7adf-6bbe8b929c00",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",image_id:"61abe2ca-b06d-4a8b-de3e-8326f523e900",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",image_id:"c39b3a16-1a38-4588-f089-cb7aeb584700",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",image_id:"204b2240-5ce4-4996-6ec4-f06a22726900",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",image_id:"fc460647-ea95-447a-99f0-1bff8fa4be00",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",image_id:"f9854c79-14ba-4987-42e1-4a82abbf5700",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",image_id:"f78dab27-7165-4a3d-fdb1-fcff06c0a700",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",image_id:"79285c9f-2630-451e-0680-c71b42fb7400",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",image_id:"2d8006c3-852b-458a-d6b0-916c5ba76800",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",image_id:"339b9e9d-e2a7-46eb-4ed3-272321257a00",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",image_id:"cae1be94-9f53-4eba-b915-f6e381d5a500",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",image_id:"7eec7187-3f48-4fda-53bb-b0ad55749a00",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",image_id:"add9626b-a5fa-4c12-178c-e5584e6dcd00",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",image_id:"c268e78d-ffb0-4c8b-5cad-04c3add48500",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",image_id:"a7106965-91cc-4a73-4688-c5c72ae0ed00",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",image_id:"f90bc33f-f085-40cf-7538-fae5ae84f900",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",image_id:"691c0716-5213-4b99-e837-079268313800",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",image_id:"a5d9dd15-8cef-42de-8bed-09e01a8b0200",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",image_id:"b57b2163-1bd8-4f6b-3311-470767e6d200",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",image_id:"3ccbd966-97e8-45a0-1ceb-6141a8978e00",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",image_id:"6487869b-1165-4f30-aa3a-115665be8300",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",image_id:"10c75467-6612-48ad-b97b-63985e922200",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",image_id:"363fae03-882a-4d81-a721-6e6f6e9ac500",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",image_id:"32e89601-0490-42fc-0cc4-8627d62a2000",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",image_id:"98183be0-3125-45ee-a6b6-fbd47ebefd00",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",image_id:"75dd1471-77e9-4811-ce57-ec8fc980ec00",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",image_id:"374258d3-c749-4f37-7815-77e61f798c00",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",image_id:"ea0140c7-787c-43a4-838f-d5ab6a342000",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}}},qs=(e,t="md")=>`https://registry.walletconnect.com/v2/logo/${t}/${e}`;function Ci(e){return{name:e.displayName||"",universalLink:e.mobile.universal||"",deepLink:e.mobile.native||""}}function Eu(e){let t="mobile";return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>Ci(o))}function js(){return Eu(Vs)}function Ks(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${e}`:""}function Ys(e,t){return $s?e:Ks(e,Ci(t))}var Js="WALLETCONNECT_DEEPLINK_CHOICE";function zs(e){let t=e.href.split("?")[0];$.put(Js,{...e,href:t})}var ur=(e,t)=>{if(!e||Cu){$.del(Js);return}if($s){zs({name:"Unknown",href:t||"wc:"});return}else if(bu){let o=Ks(t||"wc:",Ci(e));zs({name:e?.displayName||"",href:o})}};var mr=class extends Le{constructor(o,r,n,a){super(a||"unknown",n);this.connectorType="wallet_connect_v2";this.walletConnectCloudProjectId=o,this.rpcConfig=r,this.proxyProvider=new Z,this.createProvider().then(i=>{if(this.provider=i,this.proxyProvider.setWalletProvider(i),this.subscribeListeners(),i.session){if(this.walletProvider.session?.peer.metadata.url){let l=on(this.walletProvider.session?.peer.metadata.url);this.walletEntry=l?.entry,this.walletClientType=l?.walletClientType||"unknown",ur(this.walletEntry)}this.connected=!0,this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}else this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return this.walletProvider.connected}get walletBranding(){return this.walletEntry?{name:this.walletEntry.displayName,icon:this.walletClientType==="metamask"?be:qs(this.walletEntry.image_id)}:{name:gi(this.walletProvider.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider.session?.peer.metadata.icons?.[0]||Fo}}resetConnection(){this.walletProvider&&this.walletProvider.connected&&(this.walletProvider.signer.session=void 0,this.walletEntry=void 0,ur(void 0),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((o,r)=>{let n=()=>{r(new Mo)};this.onQrModalClosed=n,(async()=>{let i="",l=await Promise.race([this.walletProvider.enable(),vi()]);if(l.length>0&&(i=l[0]),!i||i==="")throw new D("Unable to retrieve address");if(this.walletProvider.session?.peer.metadata.url){let s=on(this.walletProvider.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts(l),o()})().catch(i=>{if(i){r(ct(i));return}r(new D("Unknown error during connection"))}).finally(()=>bi.close())})}disconnect(){this.walletProvider.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(o){this.proxyProvider.setWalletProvider(o)}async createProvider(){let o={};for(let n of this.chains){let a=Xe(n.id,this.chains,this.rpcConfig);a&&(o[n.id]=a)}let r=await xu.init({projectId:this.walletConnectCloudProjectId,chains:[1],optionalChains:this.chains.map(n=>n.id),optionalEvents:Tu,optionalMethods:Pu,rpcMap:o,showQrModal:!1});return r.on("display_uri",n=>{if(_u)window.open(n,"_self");else if(Su&&this.walletEntry){ur(this.walletEntry,n);let i=Ys(n,this.walletEntry);window.open(i,"_self","noopener,noreferrer")}else bi.open(n,()=>{this.onQrModalClosed&&this.onQrModalClosed()},{mobileLinks:js().map(a=>a.name)})}),r.on("connect",()=>{if(bi.close(),r.session?.peer.metadata.url){let n=on(r.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown",ur(this.walletEntry)}}),r}async enableProvider(){return this.walletProvider.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider.enable()}};var Ei=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(r=>r.type=="wallet"&&r.address===Qs(t)).length:!1},hr=class extends Au{constructor(o,r,n){super();this.getEthereumProvider=()=>{let o=this.wallets[0],r=this.walletConnectors.find(n=>n.wallets.find(a=>a.address===o?.address));return!o||!r?new Z:r.proxyProvider};this.walletConnectCloudProjectId=o,this.rpcConfig=r,this.chains=n,this.walletConnectors=[],this.initialized=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let o=new Set,r=this.walletConnectors.flatMap(a=>a.wallets).sort((a,i)=>a.connectedAt&&i.connectedAt?i.connectedAt-a.connectedAt:0).filter(a=>{let i=`${a.address}${a.walletClientType}${a.connectorType}`;return o.has(i)?!1:(o.add(i),!0)}),n=r.findIndex(a=>a.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&r.unshift(r.splice(n,1)[0]),r}initialize(){this.initialized||($.get(ui)&&($.getKeys().forEach(o=>{o.startsWith("walletconnect")&&$.del(o)}),$.del(ui)),As().then(o=>o.forEach(r=>{switch(r){case"metamask":this.createWalletConnector("injected","metamask");break;case"phantom":this.createWalletConnector("injected","phantom");break;case"unknown":default:break}})),(qr()||$.getKeys().find(o=>o.startsWith("-walletlink")))&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),this.createWalletConnector("wallet_connect_v2","unknown"),this.initialized=!0)}findWalletConnector(o,r){return o==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===o)||null:this.walletConnectors.find(n=>n.connectorType===o&&n.walletClientType===r)||null}onInitialized(o){o.wallets.forEach(r=>{let n=this.storedConnections.find(a=>a.address===r.address&&a.connectorType===r.connectorType&&a.walletClientType===r.walletClientType);n&&(r.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.emit("walletsUpdated")}onWalletsUpdated(o){o.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(o,r){if(!this.findWalletConnector("embedded","privy")){let a=new Yr(o,r,this.rpcConfig,this.chains),i=new Xr(a,this.chains);this.addWalletConnector(i)}}removeEmbeddedWalletConnector(){let o=this.findWalletConnector("embedded","privy");if(o){let r=this.walletConnectors.indexOf(o);this.walletConnectors.splice(r,1),this.saveConnectionHistory(),this.emit("walletsUpdated")}}async createWalletConnector(o,r){let n=this.findWalletConnector(o,r);if(n)return n instanceof mr&&n.resetConnection(),n;let i=(()=>{switch(o){case"injected":switch(r){case"phantom":return Ge()?new tn(this.chains):null;case"metamask":default:return dr()?new en(this.chains):null}case"coinbase_wallet":return new Zr(this.chains);case"wallet_connect_v2":return new mr(this.walletConnectCloudProjectId,this.rpcConfig,this.chains)}})();return i&&this.addWalletConnector(i),i||null}addWalletConnector(o){this.walletConnectors.push(o),o.on("initialized",()=>this.onInitialized(o)),o.on("walletsUpdated",()=>this.onWalletsUpdated(o))}loadConnectionHistory(){let o=i=>i&&typeof i.address=="string"&&typeof i.connectorType=="string"&&typeof i.walletClientType=="string"&&typeof i.connectedAt=="number",r=$.get(mi);return r&&Array.isArray(r)&&r.map(i=>o(i)).every(Boolean)?r:[]}saveConnectionHistory(){let o=this.wallets.map(r=>({address:r.address,connectorType:r.connectorType,walletClientType:r.walletClientType,connectedAt:r.connectedAt}));$.put(mi,o)}async activeWalletSign(o){let r=this.wallets,n=r.length>0?r[0]:null;return n?n.sign(o):null}setActiveWallet(o){this.activeWallet=Qs(o),this.emit("walletsUpdated")}};function Jr(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++){let r=e[o],n=t[o];if(r?.address!==n?.address||r?.chainId!==n?.chainId||r?.connectorType!==n?.connectorType||r?.connectedAt!==n?.connectedAt||r?.walletClientType!==n?.walletClientType||r?.isConnected!==n?.isConnected||r?.linked!==n?.linked)return!1}return!0}import{ofetch as Ru}from"ofetch";var ku=[Ur(),Fr()],Iu=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal},rn=class{constructor(t,o,r){this.appId=t,this.sdkVersion=li,this.client=o,this.defaults=r,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=Ru.create({baseURL:this.defaults.baseURL,retry:3,retryDelay:500,credentials:"include",onRequest:async({request:n,options:a})=>{let i=new Headers(a.headers);i.set("privy-app-id",this.appId),i.set("privy-client",`react-auth:${this.sdkVersion}`);let l=!ku.includes(n.toString());if(!i.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&i.set("authorization",`Bearer ${s}`)}a.headers=i,a.signal||(a.signal=Iu(this.defaults.timeout))},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new Mr}})}async get(t,o){try{return await this.baseFetch(t,o)}catch(r){throw te(r)}}async post(t,o,r){try{return await this.baseFetch(t,{method:"POST",...o?{body:o}:{},...r})}catch(n){throw te(n)}}async delete(t,o){try{return await this.baseFetch(t,{method:"DELETE",...o})}catch(r){throw te(r)}}};import fr from"js-cookie";function Zs(e){return e instanceof co?"email":e instanceof uo?"sms":e instanceof po?"siwe":e instanceof Wo?"custom_auth":e instanceof Ut?e.meta.provider:null}import*as Xs from"jose";var ut=class{static parse(t){try{return new ut(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Xs.decodeJwt(t)}get subject(){return this._decoded.sub}get expiration(){return this._decoded.exp}get issuer(){return this._decoded.iss}get audience(){return this._decoded.aud}isExpired(t=0){let o=Date.now(),r=(this.expiration-t)*1e3;return o>=r}};var Wu=30,nn=class{constructor(){this.authenticateOnce=new He(async t=>this._authenticate(t)),this.linkOnce=new He(async t=>this._link(t)),this.refreshOnce=new He(this._refresh.bind(this)),this.destroyOnce=new He(this._destroy.bind(this)),this.forkSessionOnce=new He(this._forkSession.bind(this))}get token(){try{let t=$.get(Lo);return typeof t=="string"?new ut(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=$.get(Gr);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=$.get(lr);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=fr.get(ws);return t!==void 0&&t.length>0}catch(t){console.error(t)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||typeof this.token=="string"&&typeof this.refreshToken=="string"}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=ut.parse(this.token);return t!==null&&!t.isExpired(Wu)}authenticate(t){return this.authenticateOnce.execute(t)}link(t){return this.linkOnce.execute(t)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}async _authenticate(t){try{let{token:o,refresh_token:r,user:n,is_new_user:a}=await t.authenticate();this.storeToken(o),this.storeRefreshToken(r);let i=Zs(t);return i&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate",{method:i,isNewUser:a}),i==="siwe"&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate_siwe",{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}),{user:Tt(n),isNewUser:a}}catch(o){throw console.warn("Error authenticating session"),Ne(o)}}async _link(t){try{let o=await t.link();return Tt(o)}catch(o){throw console.warn("Error linking account"),Ne(o)}}async _refresh(){if(!this.api)throw new w("Session has no API instance");if(!this.client)throw new w("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,o=this.refreshToken,r=this.forkedToken;try{let n;if(t&&o||this.mightHaveServerCookies){let a={};t&&(a.authorization=`Bearer ${t}`);let i=o?{refresh_token:o}:{};n=await this.api.post(Ur(),i,{headers:a}),r&&this.clearForkedToken()}else if(r)n=await this.api.post(Fr(),{refresh_token:r}),this.clearForkedToken();else return null;return this.storeToken(n.token),this.storeRefreshToken(n.refresh_token),Tt(n.user)}catch(n){if(n instanceof ko&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw Ne(n)}}async _destroy(){try{await this.api?.post(qa(),{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new w("Session has no API instance");let t=this.refreshToken;try{let o=await this.api.post(ja(),{refresh_token:t});return this.storeToken(o.token),this.storeRefreshToken(o.refresh_token),o.new_session_refresh_token}catch(o){throw Ne(o)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){if($.put(Lo,t),!this.client?.useServerCookies){let o=ut.parse(t)?.expiration;fr.set(ci,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else $.del(Lo),fr.remove(ci)}storeRefreshToken(t){typeof t=="string"?($.put(Gr,t),this.client?.useServerCookies||fr.set(di,t,{sameSite:"Strict",secure:!0,expires:30})):($.del(Gr),fr.remove(di))}clearForkedToken(){$.del(lr)}};var xi,an,el,yr=class{constructor(t){$a(this,an);this.apiUrl=t.apiUrl||Hr,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||gs,this.appId=t.appId,this.clientAnalyticsId=Va(this,an,el).call(this),xi||(xi=new nn),this.session=xi,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager(t,o,r){this.connectors||(this.connectors=new hr(t,o,r))}generateApi(){let t=new rn(this.appId,this,{baseURL:this.apiUrl,timeout:this.timeout});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new w("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new w("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){t.api=this.api,this.authFlow=t}async unlinkEmail(t){try{let o=await this.api.post(ss(),{address:t});return Tt(o)}catch(o){throw Ne(o)}}async unlinkPhone(t){try{let o=await this.api.post(ls(),{phoneNumber:t});return Tt(o)}catch(o){throw Ne(o)}}async unlinkWallet(t){try{let o=await this.api.post(as(),{address:t});return Tt(o)}catch(o){throw Ne(o)}}async unlinkOAuth(t,o){try{let r=await this.api.post(cs(),{provider:t,subject:o});return Tt(r)}catch(r){throw Ne(r)}}async createAnalyticsEvent(t,o,r){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(ds(),{event_name:t,client_id:this.clientAnalyticsId,payload:{...o||{},clientTimestamp:r?r.toISOString():new Date().toISOString()}})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(ps(),t)}catch(o){throw Ne(o)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?ut.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){try{let t=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl});return{id:t.id,name:t.name,verificationKey:t.verification_key,logoUrl:t.logo_url||void 0,accentColor:t.accent_color||void 0,showWalletLoginFirst:t.show_wallet_login_first,allowlistConfig:{errorTitle:t.allowlist_config.error_title,errorDetail:t.allowlist_config.error_detail,errorCtaText:t.allowlist_config.cta_text,errorCtaLink:t.allowlist_config.cta_link},walletAuth:t.wallet_auth,emailAuth:t.email_auth,smsAuth:t.sms_auth,googleOAuth:t.google_oauth,twitterOAuth:t.twitter_oauth,discordOAuth:t.discord_oauth,githubOAuth:t.github_oauth,linkedinOAuth:t.linkedin_oauth,appleOAuth:t.apple_oauth,termsAndConditionsUrl:t.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:t.embedded_wallet_config?.create_on_login,requireUserPasswordOnCreate:t.embedded_wallet_config?.require_user_password_on_create},privacyPolicyUrl:t.privacy_policy_url,customApiUrl:t.custom_api_url,walletConnectCloudProjectId:t.wallet_connect_cloud_project_id,fiatOnRampEnabled:t.fiat_on_ramp_enabled,captchaEnabled:t.captcha_enabled,twitterOAuthOnMobileEnabled:t.twitter_oauth_on_mobile_enabled,createdAt:new Date(t.created_at*1e3),updatedAt:new Date(t.updated_at*1e3)}}catch(t){throw Ne(t)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t.id}&tokenSymbol=${t.nativeCurrency.symbol}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t.id}`);return}}async forkSession(){return await this.session.forkSession()}};an=new WeakSet,el=function(){if(typeof window>"u")return null;try{let o=$.get(cr);if(typeof o=="string"&&o.length>0)return o}catch{}let t=Nu();try{return $.put(cr,t),t}catch{return t}};import"wicg-inert";import{disableBodyScroll as s1,clearAllBodyScrollLocks as l1}from"body-scroll-lock";import{useRef as c1,useCallback as d1}from"react";import{useEffect as np}from"react";import p1 from"react-dom";import La from"styled-components";import{createContext as Lu,useContext as Ou}from"react";var Ti=Lu({isNewUserThisSession:!1,isLinking:!1,linkingHint:null,walletConnectionStatus:null,rpcConfig:{rpcUrls:{}},chains:[],nativeTokenSymbolForChainId:T,captchaData:{enabled:!1,ready:!1,execute:T,remove:T,token:void 0,error:void 0},initializeWalletProxy:T,getAuthMeta:T,getAuthFlow:T,closePrivyModal:T,connectWallet:T,initLoginWithWallet:T,loginWithWallet:T,loginWithCode:T,initLoginWithEmail:T,initLoginWithSms:T,resendEmailCode:T,resendSmsCode:T,initLoginWithOAuth:T,loginWithOAuth:T,refreshUser:T,walletProxy:null,createAnalyticsEvent:T,getUsdTokenPrice:T,recoverEmbeddedWallet:T,getFiatOnRampConfig:T,updateWallets:T}),P=()=>Ou(Ti);import{createContext as Mu,useContext as Du}from"react";var tt=Mu({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:T,login:T,linkEmail:T,linkPhone:T,linkWallet:T,linkGoogle:T,linkTwitter:T,linkDiscord:T,linkGithub:T,linkLinkedIn:T,linkApple:T,logout:T,getAccessToken:T,getEthereumProvider:T,getEthersProvider:T,getWeb3jsProvider:T,unlinkEmail:T,unlinkPhone:T,unlinkWallet:T,unlinkGoogle:T,unlinkTwitter:T,unlinkDiscord:T,unlinkGithub:T,unlinkLinkedIn:T,unlinkApple:T,setActiveWallet:T,forkSession:T,createWallet:T,signMessage:T,sendTransaction:T,exportWallet:T,setWalletPassword:T}),V=()=>Du(tt);import Wi from"styled-components";import $t,{css as Ai}from"styled-components";import _i from"styled-components";import{Fragment as Fu,jsx as Pi,jsxs as Bu}from"react/jsx-runtime";var sn=({success:e,fail:t})=>Bu(Fu,{children:[Pi(mo,{className:e?"success":t?"fail":""}),Pi(Si,{className:e?"success":t?"fail":""})]}),mo=_i.span`
|
|
12
|
+
- https://privy.io`;this.getNonceOnce=new Ge(this._getNonceOnce.bind(this)),this.wallet=t}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new v("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(Qa(),{message:t,signature:o,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType});return{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(t){throw te(t)}}async link(){if(!this.api)throw new v("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign();return await this.api.post(Za(),{message:t,signature:o,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw te(t)}}async sign(){if(!this.api)throw new v("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new v("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.api)throw new v("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(Ja(),{address:t})).nonce}async buildSiweMessage(){if(!this.api)throw new v("Auth flow has no API instance");let t=this.wallet.address,o=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(o,t,this.nonce),this.preparedMessage}prepareMessage(t,o,r){let n=window.location.host,i=window.location.origin,a="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",l=new Date().toISOString();return this.createSiweMessage(t,o,n,i,l,r,a)}};var uo=class{constructor(t,o){this.meta={phoneNumber:t,captchaToken:o}}async authenticate(){if(!this.api)throw new v("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new v("phone number and sms code must be set prior to calling authenticate.");try{let t=rs(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw te(t)}}async link(){if(!this.api)throw new v("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new v("phone number and sms code must be set prior to calling authenticate.");try{let t=ns();return await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw te(t)}}async sendSmsCode(t,o){if(!this.api)throw new v("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),o&&(this.meta.captchaToken=o),!this.meta.phoneNumber)throw new v("phone nNumber must be set when initialzing authentication.");try{let r=os();return await this.api.post(r,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(r){throw te(r)}}};import{v4 as Ou}from"uuid";function ze(e){return new Date(e*1e3)}function Kp(e){let t=[];for(let o of e){let r=o.type;switch(o.type){case"wallet":let n={address:o.address,type:o.type,verifiedAt:ze(o.verified_at),chainType:"ethereum",chainId:o.chain_id,walletClient:o.wallet_client_type==="privy"?"privy":"unknown",walletClientType:o.wallet_client_type,connectorType:o.connector_type,recoveryMethod:o.recovery_method};t.push(n);break;case"email":let i={address:o.address,type:o.type,verifiedAt:ze(o.verified_at)};t.push(i);break;case"phone":let a={number:o.phoneNumber,type:o.type,verifiedAt:ze(o.verified_at)};t.push(a);break;case"google_oauth":let l={subject:o.subject,email:o.email,name:o.name,type:o.type,verifiedAt:ze(o.verified_at)};t.push(l);break;case"twitter_oauth":let s={subject:o.subject,username:o.username,name:o.name,type:o.type,verifiedAt:ze(o.verified_at)};t.push(s);break;case"discord_oauth":let c={subject:o.subject,username:o.username,email:o.email,type:o.type,verifiedAt:ze(o.verified_at)};t.push(c);break;case"github_oauth":let w={subject:o.subject,username:o.username,name:o.name,email:o.email,type:o.type,verifiedAt:ze(o.verified_at)};t.push(w);break;case"tiktok_oauth":let m={subject:o.subject,username:o.username,type:o.type,verifiedAt:ze(o.verified_at)};t.push(m);break;case"linkedin_oauth":let b={subject:o.subject,name:o.name,email:o.email,type:o.type,verifiedAt:ze(o.verified_at)};t.push(b);break;case"apple_oauth":let h={subject:o.subject,email:o.email,type:o.type,verifiedAt:ze(o.verified_at)};t.push(h);break;case"custom_auth":t.push({type:o.type,customUserId:o.custom_user_id,verifiedAt:ze(o.verified_at)});break;default:console.warn(`Unrecognized account type: ${r}. Please consider upgrading the Privy SDK.`)}}return t}function at(e,t){return e.sort((o,r)=>r.verifiedAt.getTime()-o.verifiedAt.getTime()),e.find(o=>o.type===t)}var Y=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClient==="privy"),Yp=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Ft=(e,t)=>t==="all-users"&&!Y(e)||t==="users-without-wallets"&&!Yp(e)?.length;function Tt(e){if(!e)return null;let t=Kp(e.linked_accounts),o=at(t,"wallet"),r=at(t,"email"),n=at(t,"phone"),i=at(t,"google_oauth"),a=at(t,"twitter_oauth"),l=at(t,"discord_oauth"),s=at(t,"github_oauth"),c=at(t,"tiktok_oauth"),w=at(t,"linkedin_oauth"),m=at(t,"apple_oauth");return{id:e.id,createdAt:ze(e.created_at),linkedAccounts:t,email:r&&{address:r?.address},phone:n&&{number:n?.number},wallet:o&&{address:o.address,chainType:o.chainType,chainId:o.chainId,walletClient:o.walletClient,walletClientType:o.walletClientType,connectorType:o.connectorType,recoveryMethod:o.recoveryMethod},google:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},tiktok:c&&{subject:c.subject,username:c.username},linkedin:w&&{subject:w.subject,name:w.name},apple:m&&{subject:m.subject,email:m.email}}}import{getAddress as Xs}from"@ethersproject/address";import Ru from"eventemitter3";var fs="1.42.0-beta-20231002184247";var Br="4df5e2316331463a9130964bd6078dfa",ys="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",gs="34357d3c125c2bcf2ce2bc3309d98715",vs="0x4AAAAAAAJFhr_rDU7HKpyw",Hr="https://auth.privy.io",ws=2e4,Ze=1400,Cs=2500,ci=fs;var Oo="privy:token",di="privy-token",Gr="privy:refresh_token",pi="privy-refresh-token",bs="privy-session",lr="privy:session_transfer_token",Qp="privy:wallet",cr="privy:caid",ui=e=>`${Qp}:${e}`,mi="privy:connectors",hi="privy:connections";var st=1,zr="0x1",Es="https://api.moonpay.com/v1",xs="https://api.moonpay.com/v1",Ts="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Ps="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";var fi=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,o){o!==void 0?this._cache[t]=o:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},yi=class{get(t){let o=localStorage.getItem(t);return o===null?void 0:JSON.parse(o)}put(t,o){o!==void 0?localStorage.setItem(t,JSON.stringify(o)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function Zp(){return typeof window<"u"&&window.localStorage?new yi:new fi}var V=Zp();import{isPossiblePhoneNumber as Xp}from"libphonenumber-js/min";var $r=()=>{let e=window;if(!e.ethereum)return!1;if(Vr(window.ethereum,!0))return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(Vr(t,!0))return!0}return!1},dr=()=>{let e=window;if(!e.ethereum)return!1;if(Vr(window.ethereum,!1))return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(Vr(t,!1))return!0}return!!window.ethereum.isZerion},Vr=(e,t)=>e.isMetaMask?e.isMetaMask&&!t?!0:!(e.isBraveWallet&&!e._events&&!e._state||e.isApexWallet||e.isAvalanche||e.isBitKeep||e.isBlockWallet||e.isKuCoinWallet||e.isMathWallet||e.isOkxWallet||e.isOKExWallet||e.isOneInchIOSWallet||e.isOneInchAndroidWallet||e.isOpera||e.isPhantom||e.isPortal||e.isRabby||e.isRainbow||e.isTokenPocket||e.isTokenary||e.isZerion):!1,Ve=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),qr=()=>{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.isCoinbaseWallet)return!0}return!1};var _s=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,}))$/),Ss=e=>Xp(String(e),"US"),As=(e,t)=>{let o=e.slice(0),r=[];for(;o.length;)r.push(o.splice(0,t));return r},Bt=(e,t=3,o=4)=>{if(!e)return"";let r=2,n=3;if(t+o+r+n>=e.length)return e;let i=e.slice(0,r+t),a=e.slice(e.length-o,e.length);return`${i}...${a}`},gi=e=>new Promise(t=>setTimeout(t,e)),ks=(e,t={})=>{let o=t.delayMs||150,r=t.maxAttempts||270;return new Promise(async(n,i)=>{let a=!1,l=0;for(;!a&&l<r;){if(t.abortSignal?.aborted)return;e().then(()=>{a=!0,n()},(...s)=>{a=!0,i(...s)}),l+=1,await gi(o)}a||i(new Error("Exceeded max attempts before resolving function"))})},jr=(e,t,o={})=>{let r=new URL(t,e);for(let[n,i]of Object.entries(o))r.searchParams.set(n,i);return r.href};var vi=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),pr=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Rs(e=3e3){let t=!1,o=window;return new Promise(r=>{o.ethereum?n():(window.addEventListener("ethereum#initialized",n,{once:!0}),setTimeout(()=>{n()},e));function n(){if(t)return;t=!0,window.removeEventListener("ethereum#initialized",n);let i=[];$r()&&i.push("metamask"),Ve()&&i.push("phantom"),o.ethereum&&o.ethereum.isBraveWallet&&i.push("brave"),r(i)}})}function Kr(e){return`eip155:${String(Number(e))}`}var Xe=(e,t,o)=>{let r=Number(e),n=t.find(a=>a.id===r);if(!n)throw new U(`Unsupported chainId ${e}`,4901);let i;if(o.rpcUrls[r]?i=o.rpcUrls[r]:n.rpcUrls.infura?.http[0]?i=n.rpcUrls.infura.http[0]+"/"+Br:n.rpcUrls.blast?.http[0]?i=n.rpcUrls.blast.http[0]+"/"+ys:i=n.rpcUrls.default?.http[0],!i)throw new U(`No RPC url found for ${e}`);return i},Is=(e,t)=>{let o=Number(e),r=t.find(n=>n.id===o);if(!r)throw new U(`Unsupported chainId ${e}`,4901);return r.blockExplorers?.default.url};import du from"@coinbase/wallet-sdk";import{jsx as Ws,jsxs as eu}from"react/jsx-runtime";var lt=({style:e,...t})=>eu("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[Ws("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Ws("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});import{getAddress as ut}from"@ethersproject/address";import{Web3Provider as Us}from"@ethersproject/providers";import{default as lu}from"eventemitter3";import{StaticJsonRpcProvider as Ls}from"@ethersproject/providers";import au from"eventemitter3";var tu=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],Ns=e=>tu.includes(e);import{ErrorCode as ou}from"@ethersproject/logger";var Mo=class extends U{constructor(){super("Wallet timeout");this.type="wallet_error"}},Do=class extends U{constructor(){super("User rejected connection");this.type="wallet_error"}},dt=e=>{if(e instanceof U)return e;if(e?.code&&e?.reason){let t=new Te(e);return e.code===ou.ACTION_REJECTED&&(t.details=Ae.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Te(e):new U("Unknown connector error",e)},ct=class extends Qe{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},Te=class extends ct{constructor(o){let r=o;super(r.message,r.code,r.data);let n=Object.values(Ae).find(i=>i.eipCode===r.code);this.details=n||Ae.UNKNOWN_ERROR,r.code===-32002&&(r.message?.includes("already pending for origin")?r.message?.includes("wallet_requestPermissions")?this.details=Ae.E32002_CONNECTION_ALREADY_PENDING:this.details=Ae.E32002_REQUEST_ALREADY_PENDING:r.message?.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=Ae.E32002_WALLET_LOCKED))}},ru={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}},nu={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},iu={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}},Ae={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...iu,...nu},Pt={...ru,...Ae};var su=12e4,wi=(e=new Mo,t=su)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),Z=class{constructor(t){this.removeListener=(t,o)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,o)}catch{console.warn("Unable to remove wallet provider listener")}};this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(o=>{this.removeListener(o.eventName,o.listener)}),this.walletProvider=t,this._subscriptions.forEach(o=>{this.walletProvider?.on(o.eventName,o.listener)})};this.walletProvider=t,this._subscriptions=[]}on(t,o){if(this.walletProvider)return this.walletProvider.on(t,o);this._subscriptions.push({eventName:t,listener:o})}async request(t){if(!this.walletProvider)throw new U(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),wi()]).catch(o=>{throw dt(o)})}},Ht=class extends Error{constructor(o,r,n){super(o);this.code=r,this.data=n}},Yr=class extends au{constructor(o,r,n,i,a=1){super();this.walletProxy=o,this.address=r,this.chainId=a,this.rpcConfig=n,this.chains=i,this.provider=new Ls(Xe(a,this.chains,n))}async handleSendTransaction(o){if(!o.params||!Array.isArray(o.params))throw new Ht(`Invalid params for ${o.method}`,4200);let r=o.params[0];if(!await _t()||!this.address)throw new Ht("Disconnected",4900);return(await Ms(r)).transactionHash}handleSwitchEthereumChain(o){if(!o.params||!Array.isArray(o.params))throw new Ht(`Invalid params for ${o.method}`,4200);let r;if(typeof o.params[0]=="string")r=o.params[0];else if("chainId"in o.params[0]&&typeof o.params[0].chainId=="string")r=o.params[0].chainId;else throw new Ht(`Invalid params for ${o.method}`,4200);this.chainId=Number(r),this.provider=new Ls(Xe(this.chainId,this.chains,this.rpcConfig)),this.emit("chainChanged",r)}async handlePersonalSign(o){if(!o.params||!Array.isArray(o.params))throw new Error("Invalid params for eth_estimateGas");let r=o.params[0];return await Os(r)}async handleEstimateGas(o){if(!o.params||!Array.isArray(o.params))throw new Error("Invalid params for eth_estimateGas");delete o.params[0].gasPrice,delete o.params[0].maxFeePerGas,delete o.params[0].maxPriorityFeePerGas;let r={...o.params[0],chainId:pr(this.chainId)};try{return await this.provider.send("eth_estimateGas",[r])}catch{return delete r.from,await this.provider.send("eth_estimateGas",[r])}}async request(o){switch(console.debug("Embedded1193Provider.request() called with args",o),o.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return pr(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(o);case"eth_sendTransaction":return this.handleSendTransaction(o);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(o);case"personal_sign":return this.handlePersonalSign(o);default:break}if(Ns(o.method)){let r=await _t();if(await Ds(),!r||!this.address)throw new Ht("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.address,accessToken:r,request:{method:o.method,params:o.params}})).response.data}catch(n){throw console.error(n),new Ht("Disconnected",4900)}}else return this.provider.send(o.method,o.params)}async connect(){let o=await _t();if(!o||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:o})).address}catch(r){return console.error(r),null}}},pt=class extends Z{constructor(o){super(o)}},Gt=class extends Z{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var cu=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Me=class extends lu{constructor(o,r){super();this.onAccountsChanged=o=>{o.length===0?this.onDisconnect():this.syncAccounts(o)};this.onChainChanged=o=>{this.wallets.forEach(r=>{r.chainId=Kr(o),this.walletClientType==="privy"&&V.put(ui(r.address),o)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=o,this.chains=r,this.connected=!1,this.initialized=!1}buildConnectedWallet(o,r){let n=async()=>!!this.wallets.find(i=>ut(i.address)===ut(o));return{address:ut(o),chainId:r,switchChain:async i=>{if(!n)throw new U("Wallet is not currently connected.");let a=this.wallets.find(m=>ut(m.address)===ut(o))?.chainId;if(!a)throw new U("Unable to determine current chainId.");let l,s;if(typeof i=="number"?(l=`0x${i.toString(16)}`,s=i):(l=i,s=Number(i)),a===Kr(l))return;let c=this.chains.find(m=>m.id===s);if(!c)throw new U(`Unsupported chainId: ${i}`);let w=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})};try{return await w()}catch(m){if(cu(m,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:l,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:[c.rpcUrls.public?.http[0]??""],blockExplorerUrls:[c.blockExplorers?.default.url??""]}]}),w();throw this.walletClientType==="rainbow"&&m.message?.includes("wallet_switchEthereumChain")?new U(`Rainbow does not support the chainId ${r}`):m}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:n,getEthereumProvider:async()=>{if(!await n())throw new U("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await n())throw new U("Wallet is not currently connected.");return new Us(new pt(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await n())throw new U("Wallet is not currently connected.");return new Gt(this.proxyProvider)},sign:async i=>{if(!await n())throw new U("Wallet is not currently connected.");return await this.sign(i)},disconnect:()=>{this.disconnect()}}}async syncAccounts(o){let r=o;if(r===void 0){let c=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(c)&&(r=c)}if(!r||!Array.isArray(r)||r.length<=0||!r[0])return;let n=r[0],i=ut(n),a=[],l;if(this.walletClientType==="privy"){l=V.get(ui(i))||zr;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let c=await this.proxyProvider.request({method:"eth_chainId"});if(typeof c!="string")throw new Error("Invalid chainId returned from provider");l=c}catch(c){console.warn(`Failed to get chainId from provider, defaulting to ${zr}`,c),l=zr}let s=Kr(l);a.find(c=>ut(c.address)===i)||a.push(this.buildConnectedWallet(ut(n),s)),Jr(a,this.wallets)||(this.wallets=a,this.emit("walletsUpdated"))}async getConnectedWallet(){let o=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((r,n)=>n.connectedAt-r.connectedAt).find(r=>o.find(n=>ut(n)===ut(r.address)))||null}async isConnected(){let o=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(o)&&o.length>0}async sign(o){return await this.connect({showPrompt:!1}),new Us(new pt(this.proxyProvider)).getSigner().signMessage(o)}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}};var pu=e=>{let t=`https://mainnet.infura.io/v3/${Br}`,o=1;return e.makeWeb3Provider(t,o)},Qr,Zr=class extends Me{constructor(o){super("coinbase_wallet",o);this.connectorType="coinbase_wallet";this.proxyProvider=new Z,this.subscribeListeners(),Qr||(Qr=new du({appName:"Privy",darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(pu(Qr)),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){Qr.disconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:lt}}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new U("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([o[0]])}catch(o){throw dt(o)}}};import{jsx as Fs}from"react/jsx-runtime";var Uo=({...e})=>Fs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Fs("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)"})});var Xr=class extends Me{constructor(o,r){super("privy",r);this.connectorType="embedded";this.proxyProvider=o,this.subscribeListeners(),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[pr(o?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Uo}}disconnect(){this.connected=!1}async promptConnection(){}};import{getAddress as Pw}from"@ethersproject/address";import{Web3Provider as Sw}from"@ethersproject/providers";import{isMobile as mu}from"react-device-detect";import{jsx as De,jsxs as uu}from"react/jsx-runtime";var be=({style:e,...t})=>uu("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...e},...t,children:[De("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),De("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),De("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),De("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),De("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),De("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),De("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),De("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),De("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),De("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),De("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),De("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),De("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});var en=class extends Me{constructor(o){super("metamask",o);this.connectorType="injected";this.proxyProvider=new Z,this.subscribeListeners();let r=window,n=r.ethereum,i=r.ethereum.providers||[];for(let a of i)if(a.isMetaMask){n=a;break}this.proxyProvider.setWalletProvider(n),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:"MetaMask",icon:be}}disconnect(){console.warn("Metamask does not support programmatic disconnect.")}async promptConnection(){try{!mu&&$r()&&await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new U("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw dt(o)}}};import{jsx as Bs,jsxs as hu}from"react/jsx-runtime";var $e=({style:e,...t})=>hu("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...e},...t,children:[Bs("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),Bs("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});var tn=class extends Me{constructor(o){super("phantom",o);this.connectorType="injected";this.proxyProvider=new Z,this.subscribeListeners(),this.proxyProvider.setWalletProvider(window.phantom.ethereum),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:"Phantom",icon:$e}}disconnect(){console.warn("Phantom does not support programmatic disconnect.")}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new U("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw dt(o)}}};import{EthereumProvider as Pu,OPTIONAL_EVENTS as _u,OPTIONAL_METHODS as Su}from"@walletconnect/ethereum-provider";import Ei from"@walletconnect/qrcode-modal";import{isAndroid as Au,isMobile as ku}from"react-device-detect";import{createContext as yu,useContext as gu,useEffect as Ci,useRef as vu,useState as Gs}from"react";import{jsx as fu}from"react/jsx-runtime";function Hs(e){return fu("link",{rel:"prefetch",href:e.src})}var x=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as wu,jsxs as Cu}from"react/jsx-runtime";var et="LANDING",zs=yu({ready:!1,app:null,currentScreen:et,lastScreen:et,navigate:x,navigateBack:x,resetNavigation:x,setModalData:x,outerClickRef:null}),Vs=e=>{let t=e.appConfig,o=e.authenticated,r=e.visible,[n,i]=Gs(e.initialScreen||et),[a,l]=Gs(e.initialScreen||et);Ci(()=>{o||i(et)},[o]),Ci(()=>{r||(l(et),i(et))},[r]),Ci(()=>{e.initialScreen&&n===et&&(i(e.initialScreen),l(e.initialScreen))},[e.initialScreen]);let s=e.initialScreen&&n===et?e.initialScreen:n,c=vu(null),w={ready:!!t?.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:s,lastScreen:a,navigate:m=>{l(n),i(m)},navigateBack:()=>{i(a)},resetNavigation:()=>{e.setInitialScreen(null),l(et),i(et)},outerClickRef:c};return Cu(zs.Provider,{value:w,children:[(typeof t?.appearance?.logo=="string"||t?.appearance?.logo?.type==="img")&&wu(Hs,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},g=()=>gu(zs);import{jsx as Fo,jsxs as bu}from"react/jsx-runtime";var Bo=({style:e,...t})=>{let{app:o}=g();return bu("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[Fo("rect",{width:"28",height:"28",rx:"3",fill:o?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),Fo("g",{clipPath:"url(#clip0_1765_9946)",children:Fo("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),Fo("defs",{children:Fo("clipPath",{id:"clip0_1765_9946",children:Fo("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};import{isAndroid as qs,isDesktop as Eu,isMobileOnly as xu}from"react-device-detect";var on=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[o,r]of Object.entries(js))if(r.hostname===t)return{walletClientType:o,entry:r}};var js={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",image_id:"5195e9db-94d8-4579-6f11-ef553be95100",hostname:"metamask.io",mobile:{native:"metamask:"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",image_id:"0528ee7e-16d1-4089-21e3-bbfb41933100",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",image_id:"a1cb2777-f8f9-49b0-53fd-443d20ee0b00",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",image_id:"7a33d7f1-3d12-4b5c-f3ee-5cd83cb1b500",hostname:"rainbow.me",mobile:{universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",image_id:"bff9cf1f-df19-42ce-f62a-87f04df13c00",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",image_id:"f216b371-96cf-409a-9d88-296392b85800",hostname:"zerion.io",mobile:{universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",image_id:"215158d2-614b-49c9-410f-77aa661c3900",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",image_id:"1bf33a89-b049-4a1c-d1f6-4dd7419ee400",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",image_id:"2cd67b4c-282b-4809-e7c0-a88cd5116f00",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",image_id:"7c5ff577-a68d-49c5-02cd-3d83637b0b00",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",image_id:"6f913b80-86c0-46f9-61ca-cc90a1805900",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",image_id:"252753e7-b783-4e03-7f77-d39864530900",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",image_id:"3f7075d0-4ab7-4db5-404d-3e4c05e6fe00",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",image_id:"cfc07342-23ea-4f3f-f071-ec9d2cd86b00",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",image_id:"52b1da3c-9e72-40ae-5dac-6142addd9c00",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",image_id:"ebac7b39-688c-41e3-7912-a4fefba74600",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",image_id:"4c16cad4-cac9-4643-6726-c696efaf5200",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",image_id:"e2024511-2c9b-46d7-3111-52df3d241700",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",image_id:"5b1cddfb-056e-4e78-029a-54de5d70c500",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",image_id:"dda0f0fb-34e8-4a57-dcea-b008e7d1ff00",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",image_id:"26a8f588-3231-4411-60ce-5bb6b805a700",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",image_id:"4725dda0-4471-4d0f-7adf-6bbe8b929c00",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",image_id:"61abe2ca-b06d-4a8b-de3e-8326f523e900",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",image_id:"c39b3a16-1a38-4588-f089-cb7aeb584700",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",image_id:"204b2240-5ce4-4996-6ec4-f06a22726900",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",image_id:"fc460647-ea95-447a-99f0-1bff8fa4be00",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",image_id:"f9854c79-14ba-4987-42e1-4a82abbf5700",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",image_id:"f78dab27-7165-4a3d-fdb1-fcff06c0a700",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",image_id:"79285c9f-2630-451e-0680-c71b42fb7400",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",image_id:"2d8006c3-852b-458a-d6b0-916c5ba76800",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",image_id:"339b9e9d-e2a7-46eb-4ed3-272321257a00",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",image_id:"cae1be94-9f53-4eba-b915-f6e381d5a500",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",image_id:"7eec7187-3f48-4fda-53bb-b0ad55749a00",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",image_id:"add9626b-a5fa-4c12-178c-e5584e6dcd00",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",image_id:"c268e78d-ffb0-4c8b-5cad-04c3add48500",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",image_id:"a7106965-91cc-4a73-4688-c5c72ae0ed00",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",image_id:"f90bc33f-f085-40cf-7538-fae5ae84f900",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",image_id:"691c0716-5213-4b99-e837-079268313800",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",image_id:"a5d9dd15-8cef-42de-8bed-09e01a8b0200",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",image_id:"b57b2163-1bd8-4f6b-3311-470767e6d200",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",image_id:"3ccbd966-97e8-45a0-1ceb-6141a8978e00",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",image_id:"6487869b-1165-4f30-aa3a-115665be8300",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",image_id:"10c75467-6612-48ad-b97b-63985e922200",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",image_id:"363fae03-882a-4d81-a721-6e6f6e9ac500",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",image_id:"32e89601-0490-42fc-0cc4-8627d62a2000",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",image_id:"98183be0-3125-45ee-a6b6-fbd47ebefd00",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",image_id:"75dd1471-77e9-4811-ce57-ec8fc980ec00",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",image_id:"374258d3-c749-4f37-7815-77e61f798c00",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",image_id:"ea0140c7-787c-43a4-838f-d5ab6a342000",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}}},Ks=(e,t="md")=>`https://registry.walletconnect.com/v2/logo/${t}/${e}`;function bi(e){return{name:e.displayName||"",universalLink:e.mobile.universal||"",deepLink:e.mobile.native||""}}function Tu(e){let t="mobile";return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>bi(o))}function Ys(){return Tu(js)}function Js(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${e}`:""}function Qs(e,t){return qs?e:Js(e,bi(t))}var Zs="WALLETCONNECT_DEEPLINK_CHOICE";function $s(e){let t=e.href.split("?")[0];V.put(Zs,{...e,href:t})}var ur=(e,t)=>{if(!e||Eu){V.del(Zs);return}if(qs){$s({name:"Unknown",href:t||"wc:"});return}else if(xu){let o=Js(t||"wc:",bi(e));$s({name:e?.displayName||"",href:o})}};var mr=class extends Me{constructor(o,r,n,i){super(i||"unknown",n);this.connectorType="wallet_connect_v2";this.walletConnectCloudProjectId=o,this.rpcConfig=r,this.proxyProvider=new Z,this.createProvider().then(a=>{if(this.provider=a,this.proxyProvider.setWalletProvider(a),this.subscribeListeners(),a.session){if(this.walletProvider.session?.peer.metadata.url){let l=on(this.walletProvider.session?.peer.metadata.url);this.walletEntry=l?.entry,this.walletClientType=l?.walletClientType||"unknown",ur(this.walletEntry)}this.connected=!0,this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}else this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return this.walletProvider.connected}get walletBranding(){return this.walletEntry?{name:this.walletEntry.displayName,icon:this.walletClientType==="metamask"?be:Ks(this.walletEntry.image_id)}:{name:vi(this.walletProvider.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider.session?.peer.metadata.icons?.[0]||Bo}}resetConnection(){this.walletProvider&&this.walletProvider.connected&&(this.walletProvider.signer.session=void 0,this.walletEntry=void 0,ur(void 0),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((o,r)=>{let n=()=>{r(new Do)};this.onQrModalClosed=n,(async()=>{let a="",l=await Promise.race([this.walletProvider.enable(),wi()]);if(l.length>0&&(a=l[0]),!a||a==="")throw new U("Unable to retrieve address");if(this.walletProvider.session?.peer.metadata.url){let s=on(this.walletProvider.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts(l),o()})().catch(a=>{if(a){r(dt(a));return}r(new U("Unknown error during connection"))}).finally(()=>Ei.close())})}disconnect(){this.walletProvider.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(o){this.proxyProvider.setWalletProvider(o)}async createProvider(){let o={};for(let n of this.chains){let i=Xe(n.id,this.chains,this.rpcConfig);i&&(o[n.id]=i)}let r=await Pu.init({projectId:this.walletConnectCloudProjectId,chains:[1],optionalChains:this.chains.map(n=>n.id),optionalEvents:_u,optionalMethods:Su,rpcMap:o,showQrModal:!1});return r.on("display_uri",n=>{if(Au)window.open(n,"_self");else if(ku&&this.walletEntry){ur(this.walletEntry,n);let a=Qs(n,this.walletEntry);window.open(a,"_self","noopener,noreferrer")}else Ei.open(n,()=>{this.onQrModalClosed&&this.onQrModalClosed()},{mobileLinks:Ys().map(i=>i.name)})}),r.on("connect",()=>{if(Ei.close(),r.session?.peer.metadata.url){let n=on(r.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown",ur(this.walletEntry)}}),r}async enableProvider(){return this.walletProvider.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider.enable()}};var xi=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(r=>r.type=="wallet"&&r.address===Xs(t)).length:!1},hr=class extends Ru{constructor(o,r,n){super();this.getEthereumProvider=()=>{let o=this.wallets[0],r=this.walletConnectors.find(n=>n.wallets.find(i=>i.address===o?.address));return!o||!r?new Z:r.proxyProvider};this.walletConnectCloudProjectId=o,this.rpcConfig=r,this.chains=n,this.walletConnectors=[],this.initialized=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let o=new Set,r=this.walletConnectors.flatMap(i=>i.wallets).sort((i,a)=>i.connectedAt&&a.connectedAt?a.connectedAt-i.connectedAt:0).filter(i=>{let a=`${i.address}${i.walletClientType}${i.connectorType}`;return o.has(a)?!1:(o.add(a),!0)}),n=r.findIndex(i=>i.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&r.unshift(r.splice(n,1)[0]),r}initialize(){this.initialized||(V.get(mi)&&(V.getKeys().forEach(o=>{o.startsWith("walletconnect")&&V.del(o)}),V.del(mi)),Rs().then(o=>o.forEach(r=>{switch(r){case"metamask":this.createWalletConnector("injected","metamask");break;case"phantom":this.createWalletConnector("injected","phantom");break;case"unknown":default:break}})),(qr()||V.getKeys().find(o=>o.startsWith("-walletlink")))&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),this.createWalletConnector("wallet_connect_v2","unknown"),this.initialized=!0)}findWalletConnector(o,r){return o==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===o)||null:this.walletConnectors.find(n=>n.connectorType===o&&n.walletClientType===r)||null}onInitialized(o){o.wallets.forEach(r=>{let n=this.storedConnections.find(i=>i.address===r.address&&i.connectorType===r.connectorType&&i.walletClientType===r.walletClientType);n&&(r.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.emit("walletsUpdated")}onWalletsUpdated(o){o.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(o,r){if(!this.findWalletConnector("embedded","privy")){let i=new Yr(o,r,this.rpcConfig,this.chains),a=new Xr(i,this.chains);this.addWalletConnector(a)}}removeEmbeddedWalletConnector(){let o=this.findWalletConnector("embedded","privy");if(o){let r=this.walletConnectors.indexOf(o);this.walletConnectors.splice(r,1),this.saveConnectionHistory(),this.emit("walletsUpdated")}}async createWalletConnector(o,r){let n=this.findWalletConnector(o,r);if(n)return n instanceof mr&&n.resetConnection(),n;let a=(()=>{switch(o){case"injected":switch(r){case"phantom":return Ve()?new tn(this.chains):null;case"metamask":default:return dr()?new en(this.chains):null}case"coinbase_wallet":return new Zr(this.chains);case"wallet_connect_v2":return new mr(this.walletConnectCloudProjectId,this.rpcConfig,this.chains)}})();return a&&this.addWalletConnector(a),a||null}addWalletConnector(o){this.walletConnectors.push(o),o.on("initialized",()=>this.onInitialized(o)),o.on("walletsUpdated",()=>this.onWalletsUpdated(o))}loadConnectionHistory(){let o=a=>a&&typeof a.address=="string"&&typeof a.connectorType=="string"&&typeof a.walletClientType=="string"&&typeof a.connectedAt=="number",r=V.get(hi);return r&&Array.isArray(r)&&r.map(a=>o(a)).every(Boolean)?r:[]}saveConnectionHistory(){let o=this.wallets.map(r=>({address:r.address,connectorType:r.connectorType,walletClientType:r.walletClientType,connectedAt:r.connectedAt}));V.put(hi,o)}async activeWalletSign(o){let r=this.wallets,n=r.length>0?r[0]:null;return n?n.sign(o):null}setActiveWallet(o){this.activeWallet=Xs(o),this.emit("walletsUpdated")}};function Jr(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++){let r=e[o],n=t[o];if(r?.address!==n?.address||r?.chainId!==n?.chainId||r?.connectorType!==n?.connectorType||r?.connectedAt!==n?.connectedAt||r?.walletClientType!==n?.walletClientType||r?.isConnected!==n?.isConnected||r?.linked!==n?.linked)return!1}return!0}import{ofetch as Iu}from"ofetch";var Wu=[Ur(),Fr()],Nu=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal},rn=class{constructor(t,o,r){this.appId=t,this.sdkVersion=ci,this.client=o,this.defaults=r,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=Iu.create({baseURL:this.defaults.baseURL,retry:3,retryDelay:500,credentials:"include",onRequest:async({request:n,options:i})=>{let a=new Headers(i.headers);a.set("privy-app-id",this.appId),a.set("privy-client",`react-auth:${this.sdkVersion}`);let l=!Wu.includes(n.toString());if(!a.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&a.set("authorization",`Bearer ${s}`)}i.headers=a,i.signal||(i.signal=Nu(this.defaults.timeout))},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new Mr}})}async get(t,o){try{return await this.baseFetch(t,o)}catch(r){throw te(r)}}async post(t,o,r){try{return await this.baseFetch(t,{method:"POST",...o?{body:o}:{},...r})}catch(n){throw te(n)}}async delete(t,o){try{return await this.baseFetch(t,{method:"DELETE",...o})}catch(r){throw te(r)}}};import fr from"js-cookie";function el(e){return e instanceof co?"email":e instanceof uo?"sms":e instanceof po?"siwe":e instanceof No?"custom_auth":e instanceof Ut?e.meta.provider:null}import*as tl from"jose";var mt=class{static parse(t){try{return new mt(t)}catch{return null}}constructor(t){this.value=t,this._decoded=tl.decodeJwt(t)}get subject(){return this._decoded.sub}get expiration(){return this._decoded.exp}get issuer(){return this._decoded.iss}get audience(){return this._decoded.aud}isExpired(t=0){let o=Date.now(),r=(this.expiration-t)*1e3;return o>=r}};var Lu=30,nn=class{constructor(){this.authenticateOnce=new Ge(async t=>this._authenticate(t)),this.linkOnce=new Ge(async t=>this._link(t)),this.refreshOnce=new Ge(this._refresh.bind(this)),this.destroyOnce=new Ge(this._destroy.bind(this)),this.forkSessionOnce=new Ge(this._forkSession.bind(this))}get token(){try{let t=V.get(Oo);return typeof t=="string"?new mt(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=V.get(Gr);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=V.get(lr);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=fr.get(bs);return t!==void 0&&t.length>0}catch(t){console.error(t)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||typeof this.token=="string"&&typeof this.refreshToken=="string"}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=mt.parse(this.token);return t!==null&&!t.isExpired(Lu)}authenticate(t){return this.authenticateOnce.execute(t)}link(t){return this.linkOnce.execute(t)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}async _authenticate(t){try{let{token:o,refresh_token:r,user:n,is_new_user:i}=await t.authenticate();this.storeToken(o),this.storeRefreshToken(r);let a=el(t);return a&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate",{method:a,isNewUser:i}),a==="siwe"&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate_siwe",{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}),{user:Tt(n),isNewUser:i}}catch(o){throw console.warn("Error authenticating session"),Oe(o)}}async _link(t){try{let o=await t.link();return Tt(o)}catch(o){throw console.warn("Error linking account"),Oe(o)}}async _refresh(){if(!this.api)throw new v("Session has no API instance");if(!this.client)throw new v("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,o=this.refreshToken,r=this.forkedToken;try{let n;if(t&&o||this.mightHaveServerCookies){let i={};t&&(i.authorization=`Bearer ${t}`);let a=o?{refresh_token:o}:{};n=await this.api.post(Ur(),a,{headers:i}),r&&this.clearForkedToken()}else if(r)n=await this.api.post(Fr(),{refresh_token:r}),this.clearForkedToken();else return null;return this.storeToken(n.token),this.storeRefreshToken(n.refresh_token),Tt(n.user)}catch(n){if(n instanceof Io&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw Oe(n)}}async _destroy(){try{await this.api?.post(Ka(),{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new v("Session has no API instance");let t=this.refreshToken;try{let o=await this.api.post(Ya(),{refresh_token:t});return this.storeToken(o.token),this.storeRefreshToken(o.refresh_token),o.new_session_refresh_token}catch(o){throw Oe(o)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){if(V.put(Oo,t),!this.client?.useServerCookies){let o=mt.parse(t)?.expiration;fr.set(di,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else V.del(Oo),fr.remove(di)}storeRefreshToken(t){typeof t=="string"?(V.put(Gr,t),this.client?.useServerCookies||fr.set(pi,t,{sameSite:"Strict",secure:!0,expires:30})):(V.del(Gr),fr.remove(pi))}clearForkedToken(){V.del(lr)}};var Ti,an,ol,yr=class{constructor(t){qa(this,an);this.apiUrl=t.apiUrl||Hr,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||ws,this.appId=t.appId,this.clientAnalyticsId=ja(this,an,ol).call(this),Ti||(Ti=new nn),this.session=Ti,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager(t,o,r){this.connectors||(this.connectors=new hr(t,o,r))}generateApi(){let t=new rn(this.appId,this,{baseURL:this.apiUrl,timeout:this.timeout});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new v("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new v("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){t.api=this.api,this.authFlow=t}async unlinkEmail(t){try{let o=await this.api.post(cs(),{address:t});return Tt(o)}catch(o){throw Oe(o)}}async unlinkPhone(t){try{let o=await this.api.post(ds(),{phoneNumber:t});return Tt(o)}catch(o){throw Oe(o)}}async unlinkWallet(t){try{let o=await this.api.post(ls(),{address:t});return Tt(o)}catch(o){throw Oe(o)}}async unlinkOAuth(t,o){try{let r=await this.api.post(ps(),{provider:t,subject:o});return Tt(r)}catch(r){throw Oe(r)}}async createAnalyticsEvent(t,o,r){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(us(),{event_name:t,client_id:this.clientAnalyticsId,payload:{...o||{},clientTimestamp:r?r.toISOString():new Date().toISOString()}})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(ms(),t)}catch(o){throw Oe(o)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?mt.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){try{let t=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl});return{id:t.id,name:t.name,verificationKey:t.verification_key,logoUrl:t.logo_url||void 0,accentColor:t.accent_color||void 0,showWalletLoginFirst:t.show_wallet_login_first,allowlistConfig:{errorTitle:t.allowlist_config.error_title,errorDetail:t.allowlist_config.error_detail,errorCtaText:t.allowlist_config.cta_text,errorCtaLink:t.allowlist_config.cta_link},walletAuth:t.wallet_auth,emailAuth:t.email_auth,smsAuth:t.sms_auth,googleOAuth:t.google_oauth,twitterOAuth:t.twitter_oauth,discordOAuth:t.discord_oauth,githubOAuth:t.github_oauth,tiktokOAuth:t.tiktok_oauth,linkedinOAuth:t.linkedin_oauth,appleOAuth:t.apple_oauth,termsAndConditionsUrl:t.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:t.embedded_wallet_config?.create_on_login,requireUserPasswordOnCreate:t.embedded_wallet_config?.require_user_password_on_create},privacyPolicyUrl:t.privacy_policy_url,customApiUrl:t.custom_api_url,walletConnectCloudProjectId:t.wallet_connect_cloud_project_id,fiatOnRampEnabled:t.fiat_on_ramp_enabled,captchaEnabled:t.captcha_enabled,twitterOAuthOnMobileEnabled:t.twitter_oauth_on_mobile_enabled,createdAt:new Date(t.created_at*1e3),updatedAt:new Date(t.updated_at*1e3)}}catch(t){throw Oe(t)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t.id}&tokenSymbol=${t.nativeCurrency.symbol}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t.id}`);return}}async forkSession(){return await this.session.forkSession()}};an=new WeakSet,ol=function(){if(typeof window>"u")return null;try{let o=V.get(cr);if(typeof o=="string"&&o.length>0)return o}catch{}let t=Ou();try{return V.put(cr,t),t}catch{return t}};import"wicg-inert";import{disableBodyScroll as d1,clearAllBodyScrollLocks as p1}from"body-scroll-lock";import{useRef as u1,useCallback as m1}from"react";import{useEffect as ap}from"react";import h1 from"react-dom";import Ma from"styled-components";import{createContext as Mu,useContext as Du}from"react";var Pi=Mu({isNewUserThisSession:!1,isLinking:!1,linkingHint:null,walletConnectionStatus:null,rpcConfig:{rpcUrls:{}},chains:[],nativeTokenSymbolForChainId:x,captchaData:{enabled:!1,ready:!1,execute:x,remove:x,token:void 0,error:void 0},initializeWalletProxy:x,getAuthMeta:x,getAuthFlow:x,closePrivyModal:x,connectWallet:x,initLoginWithWallet:x,loginWithWallet:x,loginWithCode:x,initLoginWithEmail:x,initLoginWithSms:x,resendEmailCode:x,resendSmsCode:x,initLoginWithOAuth:x,loginWithOAuth:x,refreshUser:x,walletProxy:null,createAnalyticsEvent:x,getUsdTokenPrice:x,recoverEmbeddedWallet:x,getFiatOnRampConfig:x,updateWallets:x}),_=()=>Du(Pi);import{createContext as Uu,useContext as Fu}from"react";var tt=Uu({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:x,login:x,linkEmail:x,linkPhone:x,linkWallet:x,linkGoogle:x,linkTwitter:x,linkDiscord:x,linkGithub:x,linkTiktok:x,linkLinkedIn:x,linkApple:x,logout:x,getAccessToken:x,getEthereumProvider:x,getEthersProvider:x,getWeb3jsProvider:x,unlinkEmail:x,unlinkPhone:x,unlinkWallet:x,unlinkGoogle:x,unlinkTwitter:x,unlinkDiscord:x,unlinkGithub:x,unlinkTiktok:x,unlinkLinkedIn:x,unlinkApple:x,setActiveWallet:x,forkSession:x,createWallet:x,signMessage:x,sendTransaction:x,exportWallet:x,setWalletPassword:x}),$=()=>Fu(tt);import Ni from"styled-components";import Vt,{css as ki}from"styled-components";import Si from"styled-components";import{Fragment as Hu,jsx as _i,jsxs as Gu}from"react/jsx-runtime";var sn=({success:e,fail:t})=>Gu(Hu,{children:[_i(mo,{className:e?"success":t?"fail":""}),_i(Ai,{className:e?"success":t?"fail":""})]}),mo=Si.span`
|
|
13
13
|
&& {
|
|
14
14
|
width: 82px;
|
|
15
15
|
height: 82px;
|
|
@@ -42,13 +42,13 @@ Resources:
|
|
|
42
42
|
border-color: var(--privy-color-error);
|
|
43
43
|
border-bottom-color: var(--privy-color-error);
|
|
44
44
|
}
|
|
45
|
-
`,Si
|
|
45
|
+
`,Ai=Si(mo)`
|
|
46
46
|
&& {
|
|
47
47
|
border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
|
|
48
48
|
animation: none;
|
|
49
49
|
opacity: 0.5;
|
|
50
50
|
}
|
|
51
|
-
`,zt=e=>
|
|
51
|
+
`,zt=e=>_i(Bu,{color:e.color||"var(--privy-color-foreground-3)"}),Bu=Si(mo)`
|
|
52
52
|
&& {
|
|
53
53
|
height: 0.9rem;
|
|
54
54
|
width: 0.9rem;
|
|
@@ -57,7 +57,7 @@ Resources:
|
|
|
57
57
|
/* Override default Loader to match button transitions */
|
|
58
58
|
transition: border-color 200ms ease;
|
|
59
59
|
}
|
|
60
|
-
`;import{jsx as
|
|
60
|
+
`;import{jsx as ht,jsxs as ln}from"react/jsx-runtime";var cn=Vt.button`
|
|
61
61
|
display: flex;
|
|
62
62
|
flex-direction: row;
|
|
63
63
|
align-items: center;
|
|
@@ -79,20 +79,20 @@ Resources:
|
|
|
79
79
|
color: var(--privy-color-foreground-3);
|
|
80
80
|
cursor: not-allowed;
|
|
81
81
|
}
|
|
82
|
-
`,K=({children:e,loading:t,disabled:o,loadingText:r="Loading...",...n})=>
|
|
83
|
-
${e=>e.hideAnimations&&
|
|
82
|
+
`,K=({children:e,loading:t,disabled:o,loadingText:r="Loading...",...n})=>ht(rl,{disabled:t||o,...n,children:t?ln("span",{children:[ht(zt,{}),r?ht("span",{children:r}):null]}):e}),P0=Vt(K)`
|
|
83
|
+
${e=>e.hideAnimations&&ki`
|
|
84
84
|
&& {
|
|
85
85
|
transition: none;
|
|
86
86
|
}
|
|
87
87
|
`}
|
|
88
|
-
`,dn=({children:e,loading:t,disabled:o,annotation:r,loadingText:n="Loading...",...
|
|
88
|
+
`,dn=({children:e,loading:t,disabled:o,annotation:r,loadingText:n="Loading...",...i})=>ln(rl,{as:"a",disabled:t||o,...i,children:[!!r&&ht("div",{style:{position:"absolute",top:"-1.5rem"},children:ht(zu,{children:r})}),t?ln("span",{children:[ht(zt,{}),n?ht("span",{children:n}):null]}):e]}),zu=Vt.span`
|
|
89
89
|
color: var(--privy-color-foreground-3);
|
|
90
90
|
text-align: center;
|
|
91
91
|
font-size: 0.625rem;
|
|
92
92
|
font-style: normal;
|
|
93
93
|
font-weight: 400;
|
|
94
94
|
line-height: 140%; /* 0.875rem */
|
|
95
|
-
`,
|
|
95
|
+
`,rl=Vt(cn)`
|
|
96
96
|
position: relative;
|
|
97
97
|
|
|
98
98
|
&& {
|
|
@@ -118,7 +118,7 @@ Resources:
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
/* If an anchor tag, :disabled isn't a thing, so manually set state */
|
|
121
|
-
${e=>e.disabled?
|
|
121
|
+
${e=>e.disabled?ki`
|
|
122
122
|
&&&,
|
|
123
123
|
&&&:hover,
|
|
124
124
|
&&&:active {
|
|
@@ -137,7 +137,7 @@ Resources:
|
|
|
137
137
|
opacity: 1;
|
|
138
138
|
animation: fadein 200ms ease;
|
|
139
139
|
}
|
|
140
|
-
`,
|
|
140
|
+
`,nl=({children:e,loading:t,disabled:o,loadingText:r="Loading...",...n})=>ht(Vu,{disabled:t||o,...n,children:t?ln("span",{children:[ht(zt,{}),r?ht("span",{children:r}):null]}):e}),Vu=Vt(cn)`
|
|
141
141
|
&& {
|
|
142
142
|
border-width: 1px;
|
|
143
143
|
border-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-foreground-4)"};
|
|
@@ -166,7 +166,7 @@ Resources:
|
|
|
166
166
|
opacity: 1;
|
|
167
167
|
animation: fadein 200ms ease;
|
|
168
168
|
}
|
|
169
|
-
`,fe
|
|
169
|
+
`,fe=Vt.button`
|
|
170
170
|
&& {
|
|
171
171
|
padding: 12px 16px;
|
|
172
172
|
font-weight: 500;
|
|
@@ -179,7 +179,7 @@ Resources:
|
|
|
179
179
|
transition: opacity 200ms ease, background-color 200ms ease, color 200ms ease;
|
|
180
180
|
user-select: none;
|
|
181
181
|
|
|
182
|
-
${e=>e.invisible&&
|
|
182
|
+
${e=>e.invisible&&ki`
|
|
183
183
|
pointer-events: none;
|
|
184
184
|
`}
|
|
185
185
|
|
|
@@ -197,10 +197,10 @@ Resources:
|
|
|
197
197
|
cursor: not-allowed;
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
-
`,pn
|
|
200
|
+
`,pn=Vt.div`
|
|
201
201
|
/* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
|
|
202
202
|
height: 44px;
|
|
203
|
-
`,un
|
|
203
|
+
`,un=Vt.button`
|
|
204
204
|
display: flex;
|
|
205
205
|
flex-direction: row;
|
|
206
206
|
align-items: center;
|
|
@@ -238,7 +238,7 @@ Resources:
|
|
|
238
238
|
color: var(--privy-color-foreground-3);
|
|
239
239
|
cursor: not-allowed;
|
|
240
240
|
}
|
|
241
|
-
`;import
|
|
241
|
+
`;import $u from"styled-components";var il=$u.span`
|
|
242
242
|
&& {
|
|
243
243
|
width: 82px;
|
|
244
244
|
height: 82px;
|
|
@@ -254,7 +254,7 @@ Resources:
|
|
|
254
254
|
border-color: var(--privy-color-accent);
|
|
255
255
|
border-bottom-color: var(--privy-color-accent);
|
|
256
256
|
}
|
|
257
|
-
`;import
|
|
257
|
+
`;import qe from"styled-components";var pe=qe.div`
|
|
258
258
|
display: flex;
|
|
259
259
|
flex-direction: column;
|
|
260
260
|
align-items: flex-start;
|
|
@@ -262,35 +262,35 @@ Resources:
|
|
|
262
262
|
margin-top: auto;
|
|
263
263
|
gap: 16px;
|
|
264
264
|
flex-grow: 100;
|
|
265
|
-
`,Ri
|
|
265
|
+
`,Ri=qe.div`
|
|
266
266
|
display: flex;
|
|
267
267
|
flex-direction: column;
|
|
268
268
|
align-items: center;
|
|
269
269
|
justify-content: center;
|
|
270
270
|
flex-grow: 1;
|
|
271
271
|
width: 100%;
|
|
272
|
-
`,
|
|
272
|
+
`,al=qe.div`
|
|
273
273
|
display: flex;
|
|
274
274
|
flex-direction: column;
|
|
275
275
|
align-items: center;
|
|
276
276
|
width: 100%;
|
|
277
|
-
|
|
277
|
+
`,$t=qe(Ri)`
|
|
278
278
|
gap: 16px;
|
|
279
|
-
`,
|
|
279
|
+
`,Ii=qe.div`
|
|
280
280
|
display: flex;
|
|
281
281
|
flex-direction: column;
|
|
282
282
|
width: 100%;
|
|
283
|
-
`,qt
|
|
283
|
+
`,qt=qe.div`
|
|
284
284
|
display: flex;
|
|
285
285
|
flex-direction: column;
|
|
286
286
|
gap: 8px;
|
|
287
287
|
min-height: 76px;
|
|
288
|
-
`,
|
|
288
|
+
`,I0=qe.div`
|
|
289
289
|
display: flex;
|
|
290
290
|
flex-direction: column;
|
|
291
291
|
justify-content: space-between;
|
|
292
292
|
height: 100%;
|
|
293
|
-
`,
|
|
293
|
+
`,sl=qe.div`
|
|
294
294
|
display: flex;
|
|
295
295
|
flex-direction: column;
|
|
296
296
|
justify-content: flex-start;
|
|
@@ -313,13 +313,13 @@ Resources:
|
|
|
313
313
|
color: var(--privy-color-foreground-3);
|
|
314
314
|
font-size: 14px;
|
|
315
315
|
}
|
|
316
|
-
`,
|
|
316
|
+
`,R=qe.div`
|
|
317
317
|
height: 16px;
|
|
318
|
-
`,O
|
|
318
|
+
`,O=qe.div`
|
|
319
319
|
height: 12px;
|
|
320
|
-
`,
|
|
320
|
+
`,ll=qe.div`
|
|
321
321
|
position: relative;
|
|
322
|
-
`,
|
|
322
|
+
`,cl=qe.div`
|
|
323
323
|
background-color: var(--privy-color-accent);
|
|
324
324
|
display: flex;
|
|
325
325
|
justify-content: center;
|
|
@@ -327,7 +327,7 @@ Resources:
|
|
|
327
327
|
border-radius: 50%;
|
|
328
328
|
border-color: white;
|
|
329
329
|
border-width: 2px !important;
|
|
330
|
-
`;import
|
|
330
|
+
`;import dl from"styled-components";import{Fragment as ju,jsx as Ho,jsxs as pl}from"react/jsx-runtime";var qu=dl.div`
|
|
331
331
|
margin-top: 16px;
|
|
332
332
|
font-size: 12px;
|
|
333
333
|
text-align: center;
|
|
@@ -336,7 +336,7 @@ Resources:
|
|
|
336
336
|
&& > a {
|
|
337
337
|
color: var(--privy-color-accent);
|
|
338
338
|
}
|
|
339
|
-
`;function mn(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:o}}=e.app,r=!!t,n=!!o,
|
|
339
|
+
`;function mn(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:o}}=e.app,r=!!t,n=!!o,i=r&&n;return!r&&!n?null:pl(qu,{children:["By logging in I agree to the"," ",n&&Ho("a",{href:o,target:"_blank",children:i?"Terms":"Terms of Service"}),i&&" & ",r&&Ho("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var B=({protectedByPrivy:e})=>Ho(J,{children:e?pl(ju,{children:[Ho(Uo,{className:"hide-on-mobile"}),Ho("span",{className:"hide-on-mobile",children:Ho("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})})]}):null}),J=dl.div`
|
|
340
340
|
display: flex;
|
|
341
341
|
align-items: center;
|
|
342
342
|
justify-content: center;
|
|
@@ -365,7 +365,7 @@ Resources:
|
|
|
365
365
|
@media all and (display-mode: standalone) {
|
|
366
366
|
padding-bottom: 30px;
|
|
367
367
|
}
|
|
368
|
-
`;import{ArrowLeftIcon as
|
|
368
|
+
`;import{ArrowLeftIcon as Ku,XMarkIcon as Yu}from"@heroicons/react/24/outline";import ml from"styled-components";import{jsx as ot,jsxs as em}from"react/jsx-runtime";var ul=()=>ot("div",{}),Ju=({backFn:e})=>ot("div",{children:ot(Ku,{height:"16px",width:"16px",strokeWidth:2,onClick:e})}),Qu=e=>ot("div",{children:ot("div",{children:ot(Yu,{height:"16px",width:"16px",strokeWidth:2,onClick:e.onClose})})});var S=({backFn:e,onClose:t,title:o,closeable:r=!0})=>{let{closePrivyModal:n}=_(),{app:i}=g();return em(Zu,{children:[e?ot(Ju,{backFn:e}):ot(ul,{}),o&&ot(Xu,{children:o}),i?.render.inDialog&&r?ot(Qu,{onClose:t||(()=>n())}):ot(ul,{})]})},Zu=ml.div`
|
|
369
369
|
padding-top: 16px;
|
|
370
370
|
display: flex;
|
|
371
371
|
align-items: center;
|
|
@@ -422,14 +422,14 @@ Resources:
|
|
|
422
422
|
height: 30px;
|
|
423
423
|
margin-bottom: 10px;
|
|
424
424
|
}
|
|
425
|
-
`,
|
|
425
|
+
`,Xu=ml.div`
|
|
426
426
|
overflow: hidden;
|
|
427
427
|
white-space: nowrap;
|
|
428
428
|
max-width: 100%;
|
|
429
429
|
text-overflow: ellipsis;
|
|
430
430
|
text-align: center;
|
|
431
431
|
color: var(--privy-color-foreground-2);
|
|
432
|
-
`;import{jsx as
|
|
432
|
+
`;import{jsx as hl}from"react/jsx-runtime";var fl=({style:e,...t})=>hl("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...t,children:hl("path",{fillRule:"evenodd",d:"M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z",clipRule:"evenodd"})});import{Fragment as Wi,jsx as je,jsxs as hn}from"react/jsx-runtime";var yl=()=>{let{navigate:e,app:t}=g(),o=t?.allowlistConfig.errorTitle||"You don't have access to this app",r=t?.allowlistConfig.errorDetail||"Have you been invited?",n=t?.allowlistConfig.errorCtaText||"Try another account";return hn(Wi,{children:[je(S,{}),je(R,{}),hn(tm,{children:[je(rm,{children:hn("div",{children:[je(il,{}),je(fl,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),hn(om,{children:[typeof o=="string"?je("h3",{children:o}):je(Wi,{children:o}),typeof r=="string"?je("p",{children:r}):je(Wi,{children:r})]}),t?.allowlistConfig.errorCtaLink?je(fe,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):je(fe,{onClick:()=>{e("LANDING")},children:n})]}),je(J,{})]})},tm=Ni.div`
|
|
433
433
|
display: flex;
|
|
434
434
|
flex-direction: column;
|
|
435
435
|
align-items: center;
|
|
@@ -437,11 +437,11 @@ Resources:
|
|
|
437
437
|
margin-left: 27px;
|
|
438
438
|
margin-right: 27px;
|
|
439
439
|
gap: 24px;
|
|
440
|
-
`,
|
|
440
|
+
`,om=Ni.div`
|
|
441
441
|
display: flex;
|
|
442
442
|
flex-direction: column;
|
|
443
443
|
gap: 8px;
|
|
444
|
-
`,
|
|
444
|
+
`,rm=Ni.div`
|
|
445
445
|
display: flex;
|
|
446
446
|
flex-direction: column;
|
|
447
447
|
justify-content: center;
|
|
@@ -464,9 +464,9 @@ Resources:
|
|
|
464
464
|
left: -19px;
|
|
465
465
|
top: -19px;
|
|
466
466
|
}
|
|
467
|
-
`;import{EnvelopeIcon as
|
|
467
|
+
`;import{EnvelopeIcon as am,PhoneIcon as sm}from"@heroicons/react/24/outline";import{useEffect as wl,useState as fn}from"react";import{isMobile as lm}from"react-device-detect";import vr from"styled-components";import Li from"styled-components";import{Fragment as im,jsx as gr,jsxs as vl}from"react/jsx-runtime";var ft=({title:e,description:t,children:o,...r})=>gr(gl,{...r,children:vl(im,{children:[gr("h3",{children:e}),typeof t=="string"?gr("p",{children:t}):t,o]})}),jt=Li(ft)`
|
|
468
468
|
margin-bottom: 24px;
|
|
469
|
-
`,Ee=({title:e,description:t,icon:o,children:r,...n})=>
|
|
469
|
+
`,Ee=({title:e,description:t,icon:o,children:r,...n})=>vl(nm,{...n,children:[o||null,gr("h3",{children:e}),typeof t=="string"?gr("p",{children:t}):t,r]}),gl=Li.div`
|
|
470
470
|
display: flex;
|
|
471
471
|
flex-direction: column;
|
|
472
472
|
justify-content: flex-start;
|
|
@@ -486,7 +486,7 @@ Resources:
|
|
|
486
486
|
color: var(--privy-color-foreground-2);
|
|
487
487
|
font-size: 14px;
|
|
488
488
|
}
|
|
489
|
-
`,
|
|
489
|
+
`,nm=Li(gl)`
|
|
490
490
|
align-items: center;
|
|
491
491
|
text-align: center;
|
|
492
492
|
gap: 16px;
|
|
@@ -494,7 +494,7 @@ Resources:
|
|
|
494
494
|
h3 {
|
|
495
495
|
margin-bottom: 24px;
|
|
496
496
|
}
|
|
497
|
-
`;import{Fragment as
|
|
497
|
+
`;import{Fragment as Oi,jsx as ue,jsxs as Kt}from"react/jsx-runtime";var Mi=6,Cl=new Array(Mi).fill(""),cm=1400;var El=()=>{let{app:e,navigate:t,setModalData:o}=g(),{closePrivyModal:r,resendEmailCode:n,resendSmsCode:i,getAuthMeta:a,loginWithCode:l,updateWallets:s}=_(),{authenticated:c,user:w}=$(),[m,b]=fn(Cl),[h,C]=fn(!1),[E,y]=fn(null),[P,T]=fn(null),W=a()?.email?0:1,N=e?.render.inDialog?Ze:0,A=e?.render.inDialog?N-500:0;wl(()=>{if(c&&h&&w)if(Ft(w,e?.embeddedWallets?.createOnLogin)){let G=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:X=>console.error(X),callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},A);return()=>clearTimeout(G)}else{s();let G=setTimeout(r,N);return()=>clearTimeout(G)}},[c,h,w]),wl(()=>{if(E&&P===0){let j=setTimeout(()=>{b(Cl),y(null),document.querySelector("input[name=code-0]")?.focus()},cm);return()=>clearTimeout(j)}},[E]);let I=j=>{let G=j.currentTarget.value.replace(" ","");if(G==="")return;if(isNaN(Number(G))){y("Code should be numeric"),T(1);return}y(null),T(null);let X=Number(j.currentTarget.name?.charAt(5)),M=[...G||[""]].slice(0,Mi-X),de=[...m.slice(0,X),...M,...m.slice(X+M.length)];b(de);let z=M.length,ee=Math.min(Math.max(X+z,0),Mi-1);isNaN(Number(j.currentTarget.value))||document.querySelector(`input[name=code-${ee}]`)?.focus(),de.every(Fe=>Fe&&!isNaN(+Fe))&&(document.querySelector(`input[name=code-${ee}]`)?.blur(),l(de.join("")).then(()=>C(!0)).catch(F=>{F?.status===422?y("Invalid or expired verification code"):y("Issue verifying code"),T(0)})),j.preventDefault()},D=j=>{P===1&&(y(null),T(null));let G=[...m.slice(0,j),"",...m.slice(j+1)];b(G),j>0&&document.querySelector(`input[name=code-${j-1}]`)?.focus()},ce=W==0?ue(am,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):ue(sm,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),H=W==0?Kt("p",{children:["Please check ",ue(bl,{children:a()?.email})," for an email from privy.io and enter your code below."]}):Kt("p",{children:["Please check ",ue(bl,{children:a()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return Kt(Oi,{children:[ue(S,{},"header"),ue(R,{}),Kt(dm,{children:[ue(Ee,{title:"Enter confirmation code",description:H,icon:ce}),Kt(al,{children:[Kt(pm,{children:[ue(um,{fail:!!E,success:h,children:ue("span",{children:E||(h?"Success!":"")})}),ue("div",{children:m.map((j,G)=>ue("input",{name:`code-${G}`,type:"text",value:m[G],onChange:I,onKeyUp:X=>{X.key==="Backspace"&&D(G)},inputMode:"numeric",autoFocus:G===0,pattern:"[0-9]",className:`${h?"success":""} ${E?"fail":""}`,autoComplete:lm?"one-time-code":"off"},G))})]}),ue(mm,{children:W==0?Kt(Oi,{children:[ue("span",{children:"Didn't get an email?"}),ue("button",{onClick:n,children:"Resend Code"})]}):Kt(Oi,{children:[ue("span",{children:"Didn't get a message?"}),ue("button",{onClick:i,children:"Resend Code"})]})})]})]}),ue(O,{}),ue(B,{protectedByPrivy:!0})]})},dm=vr.div`
|
|
498
498
|
display: flex;
|
|
499
499
|
flex-direction: column;
|
|
500
500
|
align-items: flex-start;
|
|
@@ -502,7 +502,7 @@ Resources:
|
|
|
502
502
|
margin: auto;
|
|
503
503
|
gap: 16px;
|
|
504
504
|
flex-grow: 1;
|
|
505
|
-
`,
|
|
505
|
+
`,pm=vr.div`
|
|
506
506
|
display: flex;
|
|
507
507
|
flex-direction: column;
|
|
508
508
|
width: 100%;
|
|
@@ -558,7 +558,7 @@ Resources:
|
|
|
558
558
|
transform: translate(1px, 0px);
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
|
-
`,
|
|
561
|
+
`,um=vr.div`
|
|
562
562
|
line-height: 20px;
|
|
563
563
|
height: 20px;
|
|
564
564
|
font-size: 13px;
|
|
@@ -566,7 +566,7 @@ Resources:
|
|
|
566
566
|
display: flex;
|
|
567
567
|
justify-content: flex-end;
|
|
568
568
|
width: 100%;
|
|
569
|
-
`,
|
|
569
|
+
`,mm=vr.div`
|
|
570
570
|
font-size: 13px;
|
|
571
571
|
color: var(--privy-color-foreground-3);
|
|
572
572
|
display: flex;
|
|
@@ -580,20 +580,20 @@ Resources:
|
|
|
580
580
|
> button {
|
|
581
581
|
text-decoration: underline;
|
|
582
582
|
}
|
|
583
|
-
`,
|
|
583
|
+
`,bl=vr.span`
|
|
584
584
|
font-weight: 500;
|
|
585
585
|
word-break: break-all;
|
|
586
|
-
`;import{isMobile as
|
|
586
|
+
`;import{isMobile as Di}from"react-device-detect";import Tl from"styled-components";import hm from"styled-components";var xl=hm.span`
|
|
587
587
|
@media (max-width: 440px) {
|
|
588
588
|
display: none;
|
|
589
589
|
}
|
|
590
|
-
`;import{jsx as
|
|
590
|
+
`;import{jsx as Ke,jsxs as Go}from"react/jsx-runtime";var Yt=({connectOnly:e})=>{let{navigate:t}=g(),{initLoginWithWallet:o,connectWallet:r}=_();return Go(fm,{children:[Go(yn,{onClick:()=>{dr()?e?(r("injected","metamask"),t("AWAITING_CONNECT_ONLY_CONNECTION")):(o("injected","metamask"),t("AWAITING_CONNECTION")):Di?e?(r("wallet_connect_v2","metamask"),t("AWAITING_CONNECT_ONLY_CONNECTION")):(o("wallet_connect_v2","metamask"),t("AWAITING_CONNECTION")):t("INSTALL_METAMASK_SCREEN")},children:[Ke(be,{}),Ke("span",{children:"MetaMask"}),Ke("span",{children:dr()?"Connect":"Install"})]}),Go(yn,{onClick:()=>{e?(r("coinbase_wallet","coinbase_wallet"),t("AWAITING_CONNECT_ONLY_CONNECTION")):(o("coinbase_wallet","coinbase_wallet"),t("AWAITING_CONNECTION"))},children:[Ke(lt,{}),Go("span",{children:["Coinbase",Ke(xl,{children:" Wallet"})]}),Ke("span",{children:"Connect"})]}),(Di||Ve())&&Go(yn,{id:"privy-phantom-button",onClick:()=>{Ve()?e?(r("injected","phantom"),t("AWAITING_CONNECT_ONLY_CONNECTION")):(o("injected","phantom"),t("AWAITING_CONNECTION")):t(Di?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")},children:[Ke($e,{}),Ke("span",{children:"Phantom"}),Ke("span",{children:Ve()?"Connect":"Install"})]}),Go(yn,{onClick:()=>{e?(r("wallet_connect_v2","unknown"),t("AWAITING_CONNECT_ONLY_CONNECTION")):(o("wallet_connect_v2","unknown"),t("AWAITING_CONNECTION"))},children:[Ke(Bo,{}),Ke("span",{children:"WalletConnect"}),Ke("span",{children:"Connect"})]})]})},fm=Tl.div`
|
|
591
591
|
display: flex;
|
|
592
592
|
flex-direction: column;
|
|
593
593
|
align-items: flex-start;
|
|
594
594
|
gap: 8px;
|
|
595
595
|
width: 100%;
|
|
596
|
-
`,yn=
|
|
596
|
+
`,yn=Tl.button`
|
|
597
597
|
display: flex;
|
|
598
598
|
flex-direction: row;
|
|
599
599
|
align-items: center;
|
|
@@ -646,7 +646,7 @@ Resources:
|
|
|
646
646
|
display: none;
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
|
-
`;import
|
|
649
|
+
`;import ym from"styled-components";import{jsx as Pl,jsxs as vm}from"react/jsx-runtime";var Jt=()=>{let{navigate:e}=g();return vm(gm,{children:[Pl("span",{children:"Don\u2019t have a wallet? "}),Pl("button",{onClick:()=>{e("WALLET_EDUCATION")},children:"Create one now."})]})},gm=ym.div`
|
|
650
650
|
font-size: 13px;
|
|
651
651
|
color: var(--privy-color-foreground-3);
|
|
652
652
|
|
|
@@ -657,13 +657,13 @@ Resources:
|
|
|
657
657
|
@media (max-width: 440px) {
|
|
658
658
|
margin-top: 4px;
|
|
659
659
|
}
|
|
660
|
-
`;import{Fragment as
|
|
660
|
+
`;import{Fragment as wm,jsx as ho,jsxs as _l}from"react/jsx-runtime";var Sl=()=>{let{app:e}=g(),t=`Connect a wallet to ${e?.name}`;return _l(wm,{children:[ho(S,{},"header"),ho(R,{}),ho(jt,{title:"Connect your wallet",description:t}),_l(pe,{children:[ho(Yt,{connectOnly:!0}),ho(Jt,{})]}),ho(O,{}),ho(B,{protectedByPrivy:!0})]})};import Ui from"styled-components";import Cm from"react";import{jsx as Al}from"react/jsx-runtime";var gn=()=>{let{app:e}=g(),t=e?.appearance?.logo,o=`${e?.name} logo`,r={maxHeight:"50px"},n="100%",i="auto";return t?typeof t=="string"?Al("div",{children:Al("img",{height:n,width:i,src:t,alt:o,style:r})}):t.type==="svg"||t.type==="img"?Cm.cloneElement(t,{height:n,width:i,alt:o,style:r}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null};import{Fragment as Tm,jsx as St,jsxs as kl}from"react/jsx-runtime";var Rl=()=>{let{app:e}=g();return kl(Tm,{children:[St(S,{},"header"),e?.appearance.logo?St(xm,{children:St(gn,{})}):null,kl(Em,{children:[St(bm,{children:St("h4",{children:"Connect Wallet"})}),St(Yt,{connectOnly:!0}),St(Jt,{})]}),e&&St(mn,{app:e}),St(B,{protectedByPrivy:!0})]})},bm=Ui.div`
|
|
661
661
|
font-weight: 600;
|
|
662
662
|
color: 'var(--privy-color-foreground)';
|
|
663
663
|
display: flex;
|
|
664
664
|
justify-content: center;
|
|
665
665
|
align-items: center;
|
|
666
|
-
`,
|
|
666
|
+
`,Em=Ui.div`
|
|
667
667
|
display: flex;
|
|
668
668
|
flex-direction: column;
|
|
669
669
|
align-items: flex-start;
|
|
@@ -684,7 +684,7 @@ Resources:
|
|
|
684
684
|
border-radius: '0';
|
|
685
685
|
}
|
|
686
686
|
cursor: 'inherit';
|
|
687
|
-
`,
|
|
687
|
+
`,xm=Ui.div`
|
|
688
688
|
display: flex;
|
|
689
689
|
flex-direction: column;
|
|
690
690
|
align-items: center;
|
|
@@ -693,7 +693,7 @@ Resources:
|
|
|
693
693
|
@media (max-width: 440px) {
|
|
694
694
|
padding: 10px 10px 20px;
|
|
695
695
|
}
|
|
696
|
-
`;import{useEffect as
|
|
696
|
+
`;import{useEffect as Ll,useState as Ol}from"react";import Sm from"styled-components";import{useEffect as Fi,useState as wr}from"react";import{isMobile as Bi}from"react-device-detect";import Il from"styled-components";import{Fragment as Nl,jsx as ye,jsxs as wn}from"react/jsx-runtime";var vn=2,Cr={metamask:{name:"MetaMask",component:be},phantom:{name:"Phantom",component:$e},coinbase_wallet:{name:"Coinbase Wallet",component:lt},wallet_connect:{name:"WalletConnect",component:Bo},embedded:{name:"Privy Wallet",component:Uo}},Hi=e=>e?.privyErrorCode==="linked_to_another_user"?Pt.ERROR_USER_EXISTS:e instanceof Te&&!e.details.default?e.details:e instanceof Mo?Pt.ERROR_TIMED_OUT:e instanceof Do?Pt.ERROR_USER_REJECTED_CONNECTION:Pt.ERROR_WALLET_CONNECTION,Wl=()=>{let[e,t]=wr(!1),[o,r]=wr(!1),[n,i]=wr(void 0),{app:a,navigate:l,navigateBack:s,lastScreen:c,currentScreen:w,setModalData:m}=g(),{getAuthFlow:b,walletConnectionStatus:h,closePrivyModal:C,loginWithWallet:E,updateWallets:y}=_(),{walletConnectors:P}=$(),[T,W]=wr(0),{user:N}=$(),[A]=wr(N?.linkedAccounts.length||0),I=Bi&&h?.connector?.connectorType==="wallet_connect_v2"||Bi&&h?.connector?.connectorType==="coinbase_wallet"||Bi&&h?.connector?.connectorType==="injected"&&h?.connector?.walletClientType==="phantom",D=h?.status==="connected";Fi(()=>{let F=b();if(F&&I&&D&&!F.preparedMessage){F.buildSiweMessage();return}!F||I||!D||(async()=>{r(!0),i(void 0);try{h?.connector?.connectorType==="wallet_connect_v2"&&h?.connector?.walletClientType==="metamask"&&await gi(2500),await H()}catch(Et){console.warn("Auto-prompted signature failed",Et)}finally{r(!1)}})()},[T,D]),Fi(()=>{if(N&&e){let F;if(Ft(N,a?.embeddedWallets?.createOnLogin)){let Et=a?.render.inDialog?Ze:0,Ce=a?.render.inDialog?Et-500:0;F=setTimeout(()=>{m({createWallet:{onSuccess:()=>{},onFailure:ir=>console.error(ir),callAuthOnSuccessOnClose:!0}}),l("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},Ce)}else y(),F=setTimeout(C,Ze);return()=>clearTimeout(F)}},[N,e]);let ce=F=>{if(F?.privyErrorCode==="allowlist_rejected"){l("ALLOWLIST_REJECTION_SCREEN");return}i(Hi(F))};async function H(){try{if(await E(),!a?.render.inDialog)return C();t(!0)}catch(F){ce(F)}finally{r(!1)}}Fi(()=>{h?.connectError&&ce(h?.connectError)},[h]);let j=h?.connector?.connectorType||"metamask",G=h?.connector?.walletClientType||"metamask",X=h?.connector?.walletBranding.name||Cr[G]?.name||"MetaMask",M=h?.connector?.walletBranding.icon||Cr[G]?.component||(F=>ye(be,{...F})),de=e?`Successfully connected with ${X}`:n?n.message:D?o&&I?"Signing":"Sign to verify":`Waiting for ${X}`,z="Don\u2019t see your wallet modal? Check your other browser windows.";if(e){let F=N?.linkedAccounts.length||0;A===F?z="Wallet was already linked.":z="You\u2019re good to go!"}else T>=vn&&n?z="Unable to connect wallet":n?z=n.detail:D&&I?z="Sign the message in your wallet to verify it belongs to you.":G==="metamask"?z="For the best experience, connect only one wallet at a time.":j==="wallet_connect"?z="Open your mobile wallet app to continue":j==="coinbase_wallet"&&(qr()||(xi(N)?z="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":z="Open the Coinbase app on your phone to continue."));let ee=P?.walletConnectors?.find(F=>F.walletClientType==="coinbase_wallet"),Fe=G==="coinbase_wallet"&&(xi(N)||n===Pt.ERROR_USER_EXISTS);return wn(Nl,{children:[ye(S,{backFn:w===c?void 0:s}),ye(R,{}),wn(Pm,{children:[ye(Gi,{walletLogo:M,success:e,fail:!!n}),wn(qt,{children:[ye("h3",{children:de}),ye("p",{children:z})]}),ye(pn,{children:Fe?ye(fe,{onClick:()=>ee&&ee?.disconnect(),invisible:e,disabled:e,children:"Use a different wallet"}):n==Pt.ERROR_USER_EXISTS&&w!==c?ye(fe,{onClick:s,children:"Use a different wallet"}):D&&!e&&I?ye(fe,{onClick:()=>{r(!0),H()},disabled:o,children:o?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&T<vn?ye(fe,{onClick:()=>{W(T+1),i(void 0),D?(r(!0),H()):h?.connectRetry()},invisible:e||!n?.retryable||T>=vn,disabled:!e&&(!n?.retryable||T>=vn),children:"Retry"}):null})]}),ye(J,{})]})},Pm=Il.div`
|
|
697
697
|
display: flex;
|
|
698
698
|
flex-direction: column;
|
|
699
699
|
align-items: center;
|
|
@@ -701,7 +701,7 @@ Resources:
|
|
|
701
701
|
margin-left: 27px;
|
|
702
702
|
margin-right: 27px;
|
|
703
703
|
gap: 24px;
|
|
704
|
-
`,
|
|
704
|
+
`,_m=Il.div`
|
|
705
705
|
display: flex;
|
|
706
706
|
flex-direction: column;
|
|
707
707
|
justify-content: center;
|
|
@@ -724,7 +724,7 @@ Resources:
|
|
|
724
724
|
left: -19px;
|
|
725
725
|
top: -19px;
|
|
726
726
|
}
|
|
727
|
-
`,
|
|
727
|
+
`,Gi=e=>{let t=e.walletLogo;return ye(Nl,{children:ye(_m,{children:wn("div",{children:[ye(sn,{success:e.success,fail:e.fail}),typeof t=="string"?ye("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):ye(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as km,jsx as yt,jsxs as zi}from"react/jsx-runtime";var Cn=2,Ml=()=>{let{navigateBack:e,lastScreen:t,currentScreen:o}=g(),{walletConnectionStatus:r,closePrivyModal:n}=_(),[i,a]=Ol(void 0),[l,s]=Ol(0),c=r?.status==="connected";Ll(()=>{if(c){let P=setTimeout(n,Ze);return()=>clearTimeout(P)}},[c]);let w=P=>{a(Hi(P))};Ll(()=>{r?.connectError&&w(r?.connectError)},[r]);let m=r?.connector?.connectorType||"metamask",b=r?.connector?.walletClientType||"metamask",h=r?.connector?.walletBranding.name||Cr[b]?.name||"MetaMask",C=r?.connector?.walletBranding.icon||Cr[b]?.component||(P=>yt(be,{...P})),E=c?`Successfully connected with ${h}`:i?i.message:`Waiting for ${h}`,y="Don\u2019t see your wallet modal? Check your other browser windows.";return c?y="You\u2019re good to go!":l>=Cn&&i?y="Unable to connect wallet":i?y=i.detail:b==="metamask"?y="For the best experience, connect only one wallet at a time.":m==="wallet_connect_v2"?y="Open your mobile wallet app to continue":m==="coinbase_wallet"&&(y="Open the Coinbase app on your phone to continue."),zi(km,{children:[yt(S,{backFn:o===t?void 0:e}),yt(R,{}),zi(Am,{children:[yt(Gi,{walletLogo:C,success:c,fail:!!i}),zi(qt,{children:[yt("h3",{children:E}),yt("p",{children:y})]}),yt(pn,{children:i==Pt.ERROR_USER_EXISTS?yt(fe,{onClick:e,children:"Use a different wallet"}):!c&&i?.retryable&&l<Cn?yt(fe,{onClick:()=>{s(l+1),a(void 0),r?.connectRetry()},invisible:c||!i?.retryable||l>=Cn,disabled:!c&&(!i?.retryable||l>=Cn),children:"Retry"}):null})]}),yt(J,{})]})},Am=Sm.div`
|
|
728
728
|
display: flex;
|
|
729
729
|
flex-direction: column;
|
|
730
730
|
align-items: center;
|
|
@@ -732,7 +732,7 @@ Resources:
|
|
|
732
732
|
margin-left: 27px;
|
|
733
733
|
margin-right: 27px;
|
|
734
734
|
gap: 24px;
|
|
735
|
-
`;import{XCircleIcon as
|
|
735
|
+
`;import{XCircleIcon as Om}from"@heroicons/react/24/solid";import{useEffect as Mm,useMemo as Dm,useState as Um}from"react";import Fm from"styled-components";import bn from"styled-components";import{jsx as Vi,jsxs as Lm}from"react/jsx-runtime";var zo=({children:e})=>Vi(Rm,{children:Lm(Im,{children:[e,Vi(Wm,{}),Vi(Nm,{})]})}),Rm=bn.div`
|
|
736
736
|
height: 100%;
|
|
737
737
|
display: flex;
|
|
738
738
|
justify-content: center;
|
|
@@ -744,14 +744,14 @@ Resources:
|
|
|
744
744
|
@media all and (display-mode: standalone) {
|
|
745
745
|
margin-bottom: 30px;
|
|
746
746
|
}
|
|
747
|
-
`,
|
|
747
|
+
`,Im=bn.div`
|
|
748
748
|
position: relative;
|
|
749
749
|
height: 140px;
|
|
750
750
|
width: 140px;
|
|
751
751
|
|
|
752
752
|
opacity: 1;
|
|
753
753
|
animation: fadein 200ms ease;
|
|
754
|
-
`,
|
|
754
|
+
`,Wm=bn.div`
|
|
755
755
|
position: absolute;
|
|
756
756
|
top: 0;
|
|
757
757
|
right: 0;
|
|
@@ -764,7 +764,7 @@ Resources:
|
|
|
764
764
|
border: 4px solid var(--privy-color-accent-light);
|
|
765
765
|
border-radius: 50%;
|
|
766
766
|
}
|
|
767
|
-
`,
|
|
767
|
+
`,Nm=bn.div`
|
|
768
768
|
position: absolute;
|
|
769
769
|
top: 0;
|
|
770
770
|
right: 0;
|
|
@@ -788,22 +788,22 @@ Resources:
|
|
|
788
788
|
transform: rotate(360deg);
|
|
789
789
|
}
|
|
790
790
|
}
|
|
791
|
-
`;var
|
|
791
|
+
`;var Dl=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds"];var At=class extends Error{constructor(o,r){super(r);this.type=o}};function $i(e){let t=e.type;return typeof t=="string"&&Dl.includes(t)}function Vo(e){return $i(e)&&e.type==="wallet_not_on_device"}function Ul(e){return $i(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function Fl(e){return!!($i(e)&&e.type==="insufficient_funds"||e.code==="INSUFFICIENT_FUNDS")}function Bl(e){return e.code==="UNPREDICTABLE_GAS_LIMIT"}import{Fragment as Gl,jsx as Qt,jsxs as qi}from"react/jsx-runtime";var Hl=1,zl=()=>{let{authenticated:e,user:t,getAccessToken:o}=$(),{closePrivyModal:r,createAnalyticsEvent:n,walletProxy:i}=_(),{navigate:a,data:l,setModalData:s,outerClickRef:c}=g(),w=Dm(()=>Date.now(),[]),[m,b]=Um(!1),{onCompleteNavigateTo:h,onFailure:C}=l?.connectWallet,E=P=>{m||(b(!0),C(typeof P=="string"?new Error(P):P))};Mm(()=>{let P=Y(t),T;return!e||!P?E("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let N=await o();if(!N)return E("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:N,address:P.address});let A=(Date.now()-w)/1e3;h==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&A<Hl?T=setTimeout(()=>{a(h)},(Hl-A)*1e3):a(h)}catch(A){if(Vo(A)&&P.recoveryMethod==="privy"){let I=await o();if(!I)return E("User must be authenticated and have a Privy wallet before it can be recovered");try{n("embedded_wallet_pinless_recovery_started",{walletAddress:P.address}),(await i?.recover({address:P.address,accessToken:I}))?.address||E(new Error("Unable to recover wallet")),h?a(h):r({shouldCallAuthOnSuccess:!1}),n("embedded_wallet_recovery_completed",{walletAddress:P.address}),a(h)}catch{E("An error has occurred, please try again.")}}else Vo(A)?(s({...l,recoverWallet:{privyWallet:P,onCompleteNavigateTo:h,onFailure:C}}),a("EMBEDDED_WALLET_RECOVERY_SCREEN")):E(A)}})(),()=>clearTimeout(T)):void 0},[e,t,i]);let y=()=>{r({shouldCallAuthOnSuccess:!1}),E("User exited before wallet could be connected")};return c&&(c.current=y),qi(Gl,{children:[Qt(S,{onClose:y}),Qt(R,{}),Qt(Bm,{children:m?qi(Gl,{children:[qi($t,{children:[Qt(Om,{fill:"var(--privy-color-error)",stroke:"white",strokeWidth:".25px",width:"64px",height:"64px"}),Qt(Ee,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),Qt(K,{onClick:()=>r({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):Qt(zo,{})}),Qt(O,{})]})},Bm=Fm.div`
|
|
792
792
|
display: flex;
|
|
793
793
|
height: 100%;
|
|
794
794
|
flex-direction: column;
|
|
795
795
|
flex-grow: 1;
|
|
796
|
-
`;import{CheckCircleIcon as
|
|
796
|
+
`;import{CheckCircleIcon as Hm}from"@heroicons/react/24/solid";import{useEffect as Gm}from"react";import{Fragment as zm,jsx as $o,jsxs as Vl}from"react/jsx-runtime";var $l=()=>{let{user:e}=$(),{closePrivyModal:t,isNewUserThisSession:o,updateWallets:r}=_(),{app:n,data:i,outerClickRef:a}=g(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,w=()=>{let m=Y(e);m?(r(),l(m),t({shouldCallAuthOnSuccess:c})):s(new Error("Failed to create wallet"))};return Gm(()=>{let m=setTimeout(w,Cs);return()=>clearTimeout(m)},[]),a&&(a.current=w),Vl(zm,{children:[$o(S,{onClose:w}),$o(R,{}),Vl($t,{children:[$o(Hm,{fill:"var(--privy-color-accent)",stroke:"white",strokeWidth:".25px",width:"64px",height:"64px"}),$o(Ee,{title:o?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:o?"You\u2019ve successfully created an account.":"Your account is secured."})]}),$o(O,{}),$o(B,{protectedByPrivy:!0})]})};import{useEffect as Yl,useRef as $m,useState as ji}from"react";import kt from"styled-components";import{jsx as ke,jsxs as Vm}from"react/jsx-runtime";var ql=({style:e,...t})=>Vm("svg",{width:"320",height:"144",viewBox:"0 0 320 144",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{width:320,height:144,...e},...t,children:[ke("rect",{x:"214.681",y:"51.6852",width:"40",height:"40",rx:"20",fill:"var(--privy-color-background-2)"}),ke("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M229.848 64.9512C228.001 65.1452 226.643 66.726 226.643 68.5829V75.414C226.643 77.2883 228.026 78.8767 229.891 79.0615C231.417 79.2127 233.21 79.3518 234.643 79.3518C236.862 79.3518 239.95 79.0176 241.563 78.8225C242.183 78.7474 242.643 78.2196 242.643 77.5948V69.7756C242.643 69.1508 242.183 68.6229 241.563 68.5479C239.955 68.3534 236.883 68.0207 234.665 68.0185L234.643 68.0185L234.622 68.0185C233.219 68.0199 231.475 68.1534 229.975 68.3005C229.636 68.3007 229.346 68.0433 229.312 67.6989C229.277 67.3325 229.544 67.0063 229.911 66.9703C231.423 66.8219 233.203 66.6852 234.643 66.6852C236.246 66.6852 238.275 66.855 239.887 67.0221C240.412 67.0765 240.896 67.1309 241.309 67.1796V66.4289C241.309 65.8099 240.858 65.2851 240.244 65.2046C238.746 65.0083 235.977 64.6852 233.976 64.6852C232.734 64.6852 231.195 64.8098 229.848 64.9512ZM240.309 74.6852C240.862 74.6852 241.309 74.2375 241.309 73.6852C241.309 73.1329 240.862 72.6852 240.309 72.6852C239.757 72.6852 239.309 73.1329 239.309 73.6852C239.309 74.2375 239.757 74.6852 240.309 74.6852Z",fill:"var(--privy-color-accent)"}),ke("path",{d:"M92.6426 74.2969H89.5743M76.6426 74.2969H85.5085M77.5837 78.2687L87.1555 61.6852M84.7273 65.9017L82.2897 61.6852M91.8614 78.2687L86.6849 69.2993",stroke:"var(--privy-color-accent)","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),ke("rect",{x:"65.6426",y:"52.6852",width:"38",height:"38",rx:"19",stroke:"var(--privy-color-background-2","stroke-width":"2"}),ke("path",{d:"M103.162 71.6852H213.662",stroke:"var(--privy-color-background-2","stroke-width":"2","stroke-dasharray":"4 4"}),ke("path",{d:"M270.544 116.469C272.146 116.469 273.445 115.175 273.445 113.577C273.445 111.98 272.146 110.685 270.544 110.685C268.942 110.685 267.643 111.98 267.643 113.577C267.643 115.175 268.942 116.469 270.544 116.469Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M157.878 48.3615C160.282 48.3615 162.231 46.4193 162.231 44.0234C162.231 41.6274 160.282 39.6852 157.878 39.6852C155.475 39.6852 153.526 41.6274 153.526 44.0234C153.526 46.4193 155.475 48.3615 157.878 48.3615Z",fill:"var(--privy-color-accent-dark)"}),ke("path",{d:"M35.0825 96.1749C36.8852 96.1749 38.3466 94.7182 38.3466 92.9212C38.3466 91.1243 36.8852 89.6676 35.0825 89.6676C33.2797 89.6676 31.8184 91.1243 31.8184 92.9212C31.8184 94.7182 33.2797 96.1749 35.0825 96.1749Z",fill:"var(--privy-color-accent-dark)"}),ke("path",{d:"M164.407 103.673C166.41 103.673 168.034 102.055 168.034 100.058C168.034 98.0616 166.41 96.443 164.407 96.443C162.404 96.443 160.78 98.0616 160.78 100.058C160.78 102.055 162.404 103.673 164.407 103.673Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M292.664 33.277C294.267 33.277 295.566 31.9822 295.566 30.3849C295.566 28.7876 294.267 27.4928 292.664 27.4928C291.062 27.4928 289.763 28.7876 289.763 30.3849C289.763 31.9822 291.062 33.277 292.664 33.277Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M104 12.6997C105.302 12.6997 106.357 11.6476 106.357 10.3498C106.357 9.05206 105.302 8 104 8C102.698 8 101.643 9.05206 101.643 10.3498C101.643 11.6476 102.698 12.6997 104 12.6997Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M7.99998 68.6997C9.30194 68.6997 10.3574 67.6476 10.3574 66.3498C10.3574 65.0521 9.30194 64 7.99998 64C6.69802 64 5.64258 65.0521 5.64258 66.3498C5.64258 67.6476 6.69802 68.6997 7.99998 68.6997Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M312 60.6997C313.302 60.6997 314.357 59.6476 314.357 58.3498C314.357 57.0521 313.302 56 312 56C310.698 56 309.643 57.0521 309.643 58.3498C309.643 59.6476 310.698 60.6997 312 60.6997Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M35.544 42.4694C37.1464 42.4694 38.4454 41.1746 38.4454 39.5773C38.4454 37.98 37.1464 36.6852 35.544 36.6852C33.9416 36.6852 32.6426 37.98 32.6426 39.5773C32.6426 41.1746 33.9416 42.4694 35.544 42.4694Z",fill:"var(--privy-color-accent-light"})]});import{Fragment as th,jsx as oe,jsxs as gt}from"react/jsx-runtime";var Jl=()=>{let[e,t]=ji(null),{authenticated:o,user:r,getAccessToken:n}=$(),{closePrivyModal:i,createAnalyticsEvent:a}=_(),{data:l,outerClickRef:s}=g(),c=Y(r)?.address,{onFailure:w,onSuccess:m,origin:b,appId:h}=l.keyExport,C=y=>{i({shouldCallAuthOnSuccess:!1}),w(typeof y=="string"?new Error(y):y)},E=()=>{i({shouldCallAuthOnSuccess:!1}),m(),a("embedded_wallet_key_export_completed",{walletAddress:c})};return Yl(()=>{let y=Y(r);if(!o||!y)return C("User must be authenticated before exporting their wallet");n().then(t,C)},[o,r]),s&&(s.current=E),gt(th,{children:[oe(S,{onClose:E}),oe(R,{}),gt(Km,{children:[oe(ql,{}),gt(Ym,{children:[oe("h3",{children:"Transfer"}),gt(Xm,{children:[oe(jm,{style:{marginRight:6}}),Bt(c)]})]}),oe("p",{children:"You can take your account with you to another site using an external wallet!"}),gt(Jm,{children:[gt(jl,{children:[oe(Kl,{children:"1"}),gt("span",{children:[oe("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Follow the guide"})," ","to transfer your account to your wallet of choice."]})]}),gt(jl,{children:[oe(Kl,{children:"2"}),oe("span",{children:"Copy this key into your other wallet"})]})]}),oe("div",{style:{width:"100%"},children:e&&oe(qm,{origin:b,appId:h,accessToken:e,address:c,dimensions:{height:"44px"}})}),gt(eh,{children:[oe("h4",{children:"WARNING"}),oe("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),oe(O,{}),oe(B,{protectedByPrivy:!0})]})};function qm(e){let[t,o]=ji(e.dimensions.width),[r,n]=ji(void 0),i=$m(null);return Yl(()=>{if(i.current&&t===void 0){let{width:l}=i.current.getBoundingClientRect();o(l)}let a=getComputedStyle(document.documentElement);n({background2:a.getPropertyValue("--privy-color-background-2"),foreground3:a.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:a.getPropertyValue("--privy-color-foreground-accent"),accent:a.getPropertyValue("--privy-color-accent"),accentDark:a.getPropertyValue("--privy-color-accent-dark"),success:a.getPropertyValue("--privy-color-success")})},[]),oe("div",{ref:i,children:t&>(Qm,{children:[oe("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:jr(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,...r})}),oe(Zm,{children:"Loading..."})]})})}function jm(e){return oe("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:oe("path",{d:"M14 8.81335C14 7.98493 13.3284 7.31335 12.5 7.31335H10C10 8.41792 9.10457 9.31335 8 9.31335C6.89543 9.31335 6 8.41792 6 7.31335H3.5C2.67157 7.31335 2 7.98493 2 8.81335M14 8.81335V12.8134C14 13.6418 13.3284 14.3134 12.5 14.3134H3.5C2.67157 14.3134 2 13.6418 2 12.8134V8.81335M14 8.81335V6.81335M2 8.81335V6.81335M14 6.81335C14 5.98493 13.3284 5.31335 12.5 5.31335H3.5C2.67157 5.31335 2 5.98493 2 6.81335M14 6.81335V4.81335C14 3.98493 13.3284 3.31335 12.5 3.31335H3.5C2.67157 3.31335 2 3.98493 2 4.81335V6.81335",stroke:"var(--privy-color-foreground-3)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var Km=kt.div`
|
|
797
797
|
display: flex;
|
|
798
798
|
height: 100%;
|
|
799
799
|
flex-direction: column;
|
|
800
800
|
text-align: left;
|
|
801
|
-
`,
|
|
801
|
+
`,Ym=kt.div`
|
|
802
802
|
display: flex;
|
|
803
803
|
align-items: center;
|
|
804
804
|
justify-content: space-between;
|
|
805
805
|
margin-bottom: 8px;
|
|
806
|
-
`,
|
|
806
|
+
`,Jm=kt.div`
|
|
807
807
|
display: flex;
|
|
808
808
|
flex-direction: column;
|
|
809
809
|
gap: 24px;
|
|
@@ -811,7 +811,7 @@ Resources:
|
|
|
811
811
|
margin-top: 16px;
|
|
812
812
|
margin-left: 11px;
|
|
813
813
|
border-left: 1px solid var(--privy-color-foreground-4) !important;
|
|
814
|
-
`,
|
|
814
|
+
`,jl=kt.div`
|
|
815
815
|
display: flex;
|
|
816
816
|
align-items: top;
|
|
817
817
|
gap: 8px;
|
|
@@ -822,7 +822,7 @@ Resources:
|
|
|
822
822
|
text-decoration: underline;
|
|
823
823
|
}
|
|
824
824
|
}
|
|
825
|
-
`,
|
|
825
|
+
`,Kl=kt.div`
|
|
826
826
|
display: flex;
|
|
827
827
|
align-items: center;
|
|
828
828
|
justify-content: center;
|
|
@@ -836,10 +836,10 @@ Resources:
|
|
|
836
836
|
border-radius: 100%;
|
|
837
837
|
background: var(--privy-color-background);
|
|
838
838
|
color: var(--privy-color-accent);
|
|
839
|
-
`,
|
|
839
|
+
`,Qm=kt.div`
|
|
840
840
|
position: relative;
|
|
841
841
|
height: 44px;
|
|
842
|
-
`,
|
|
842
|
+
`,Zm=kt.div`
|
|
843
843
|
position: absolute;
|
|
844
844
|
display: flex;
|
|
845
845
|
align-items: center;
|
|
@@ -851,7 +851,7 @@ Resources:
|
|
|
851
851
|
border-radius: var(--privy-border-radius-md);
|
|
852
852
|
background-color: var(--privy-color-background-2);
|
|
853
853
|
color: var(--privy-color-foreground-3);
|
|
854
|
-
`,
|
|
854
|
+
`,Xm=kt.div`
|
|
855
855
|
display: flex;
|
|
856
856
|
align-items: center;
|
|
857
857
|
padding-top: 1px;
|
|
@@ -863,7 +863,7 @@ Resources:
|
|
|
863
863
|
border-radius: var(--privy-border-radius-md);
|
|
864
864
|
font-size: 12px;
|
|
865
865
|
font-weight: 500;
|
|
866
|
-
`,
|
|
866
|
+
`,eh=kt.div`
|
|
867
867
|
border: 2px solid var(--privy-color-background-2) !important;
|
|
868
868
|
border-radius: var(--privy-border-radius-md);
|
|
869
869
|
padding: 16px;
|
|
@@ -873,14 +873,14 @@ Resources:
|
|
|
873
873
|
&& > h4 {
|
|
874
874
|
color: var(--privy-color-error);
|
|
875
875
|
}
|
|
876
|
-
`;import{useEffect as
|
|
876
|
+
`;import{useEffect as Uh,useMemo as Fh,useRef as Bh,useState as Qi}from"react";import{ArrowDownTrayIcon as Ch,ArrowPathIcon as bh,DocumentDuplicateIcon as Eh,ExclamationTriangleIcon as xh,KeyIcon as Th,XCircleIcon as Ph}from"@heroicons/react/24/outline";import{CheckCircleIcon as Ki}from"@heroicons/react/24/solid";import{useState as ac,useMemo as Tn,useEffect as _h}from"react";import Re,{css as Yi}from"styled-components";import oh from"fast-password-entropy";import*as Ql from"secure-password-utilities";import{DEFAULT_WORDLIST as rh}from"secure-password-utilities/wordlists";var nh=95,ih=8,ah=3,sh=.3,lh=/[a-z]/,ch=/[A-Z]/,dh=/[0-9]/,ph="a-zA-Z0-9",Zl="!@#$%^&*()\\-_+.",Xl=`${ph}${Zl}`,uh=new RegExp(`[${Zl}]`),mh=new RegExp(`[${Xl}]`),ec=new RegExp(`^[${Xl}]{6,}$`),tc=(e="")=>{let t=e.split("").filter(o=>!mh.test(o)).map(o=>o.replace(" ","SPACE"));return[...new Set(t)]},En=()=>Ql.generatePassphrase(4,rh);function hh(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function fh(e){if(e.length<ih)return 0;let t=0;lh.test(e)&&(t+=1),ch.test(e)&&(t+=1),dh.test(e)&&(t+=1),uh.test(e)&&(t+=1);let o=t/ah;return Math.max(0,Math.min(1,o))}function yh(e=""){let t=fh(e),o=oh(e)/nh;return(t*sh+o)/2}function oc(e=""){let t=yh(e);return{value:t,label:hh(t)}}import xn from"styled-components";import{jsx as br,jsxs as wh}from"react/jsx-runtime";var rc=({className:e,checked:t,...o})=>br("label",{children:wh(gh,{className:e,children:[br(ic,{checked:t,...o}),br(vh,{checked:t,children:br(nc,{viewBox:"0 0 24 24",children:br("polyline",{points:"20 6 9 17 4 12"})})})]})}),gh=xn.div`
|
|
877
877
|
display: inline-block;
|
|
878
878
|
vertical-align: middle;
|
|
879
|
-
`,
|
|
879
|
+
`,nc=xn.svg`
|
|
880
880
|
fill: none;
|
|
881
881
|
stroke: white;
|
|
882
882
|
stroke-width: 3px;
|
|
883
|
-
`,
|
|
883
|
+
`,ic=xn.input.attrs({type:"checkbox"})`
|
|
884
884
|
border: 0;
|
|
885
885
|
clip: rect(0 0 0 0);
|
|
886
886
|
clippath: inset(50%);
|
|
@@ -891,7 +891,7 @@ Resources:
|
|
|
891
891
|
position: absolute;
|
|
892
892
|
white-space: nowrap;
|
|
893
893
|
width: 1px;
|
|
894
|
-
`,
|
|
894
|
+
`,vh=xn.div`
|
|
895
895
|
display: inline-block;
|
|
896
896
|
width: 18px;
|
|
897
897
|
height: 18px;
|
|
@@ -906,14 +906,14 @@ Resources:
|
|
|
906
906
|
border-width: 1px;
|
|
907
907
|
}
|
|
908
908
|
|
|
909
|
-
${
|
|
909
|
+
${ic}:focus + & {
|
|
910
910
|
box-shadow: 0 0 0 1px var(--privy-color-accent);
|
|
911
911
|
}
|
|
912
912
|
|
|
913
|
-
${
|
|
913
|
+
${nc} {
|
|
914
914
|
visibility: ${e=>e.checked?"visible":"hidden"};
|
|
915
915
|
}
|
|
916
|
-
`;import{Fragment as fo,jsx as q,jsxs as ge}from"react/jsx-runtime";var _n=({buttonHideAnimations:e,buttonLoading:t,invalidState:o,errorMessage:r,hasSetPassword:n,loading:
|
|
916
|
+
`;import{Fragment as fo,jsx as q,jsxs as ge}from"react/jsx-runtime";var _n=({buttonHideAnimations:e,buttonLoading:t,invalidState:o,errorMessage:r,hasSetPassword:n,loading:i,password:a="",onSubmit:l,onClose:s,onPasswordChange:c,onPasswordGenerate:w})=>{let[m,b]=ac(!1),[h,C]=ac(!1);_h(()=>{a&&!m&&b(!0)},[a]);let E=Tn(()=>m?(a?.length||0)<6?"Password must be at least 6 characters":ec.test(a||"")?null:`Invalid characters used ( ${tc(a).join(" ")} )`:null,[a,m]),y=Tn(()=>E?{value:0,label:"Weak"}:oc(a),[a,E]),P=Tn(()=>{let W=new Blob([a||""],{type:"text/plain"});return window.URL.createObjectURL(W)},[a]),T=Tn(()=>!!(!a?.length||E||n&&!h),[E,n,h,a]);return i?q(Dh,{children:q(zo,{})}):ge(fo,{children:[q(S,{onClose:s,title:"Secure your account",closeable:!n}),q(R,{}),r||o?ge(fo,{children:[ge($t,{children:[q(Ph,{fill:"var(--privy-color-error)",stroke:"white",strokeWidth:".25px",width:"64px",height:"64px"}),q(Ee,{title:"Something went wrong",description:r})]}),q(K,{onClick:s,children:"Close"})]}):ge(kh,{children:[ge(Lh,{children:[n?q(xh,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}):q(Th,{height:48,width:48,stroke:"var(--privy-color-accent)"}),q("h3",{style:{color:"var(--privy-color-foreground)"},children:n?"Save your password":"Set your password"}),q("p",{style:{color:"var(--privy-color-foreground-2)"},children:n?ge(fo,{children:["Privy doesn\u2019t store your password so we can't retrieve it for you later. Secure it to keep your assets safe.",q("a",{rel:"noreferrer",target:"_blank",href:"https://docs.privy.io/guide/security",style:{cursor:"pointer",color:"var(--privy-color-accent)"},children:" Learn more."})]}):q(fo,{children:"Select a strong, memorable password to secure your account."})})]}),ge(Wh,{centered:n,children:[n?q(Ih,{children:a}):q(Ji,{value:a,onChange:W=>c(W.target.value),placeholder:"enter or generate a strong password"}),!n&&q(Nh,{onClick:w})]}),n?ge(fo,{children:[ge("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[ge(lc,{onClick:()=>a&&navigator.clipboard.writeText(a),children:[q(Eh,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]}),q(Mh,{href:P,download:"privy-wallet-recovery.txt",children:ge(lc,{children:[q(Ch,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})})]}),q(sc,{children:ge(Pn,{children:[q(rc,{checked:h,onChange:W=>C(W.target.checked)}),q(fo,{children:"I understand that my password can\u2019t be recovered and I may lose my assets if I don\u2019t secure it."})]})})]}):ge(fo,{children:[q(Oh,{value:y.value===0?.01:y.value,label:y.label}),q(Ah,{error:E,children:E||`Password Strength: ${m?y.label:"--"}`}),ge(sc,{children:[ge(Pn,{children:[q(Ki,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),ge(Pn,{children:[q(Ki,{width:24,height:24,fill:"var(--privy-color-accent)"}),"You will only be asked to enter it when signing on to a new device."]}),ge(Pn,{children:[q(Ki,{width:24,height:24,fill:"var(--privy-color-accent)"}),"If you lose this device and your password, your account will be irrecoverable."]})]})]}),q(Rh,{onClick:l,loading:t,disabled:T,hideAnimations:e,children:n?"I have stored my password safely":"Set password"})]}),q(O,{}),q(B,{protectedByPrivy:!0})]})},Sh=Yi`
|
|
917
917
|
font-size: 14px;
|
|
918
918
|
font-style: normal;
|
|
919
919
|
font-weight: 400;
|
|
@@ -921,23 +921,23 @@ Resources:
|
|
|
921
921
|
letter-spacing: -0.008px;
|
|
922
922
|
text-align: left;
|
|
923
923
|
transition: color 0.1s ease-in;
|
|
924
|
-
`,
|
|
925
|
-
${
|
|
924
|
+
`,Ah=Re.span`
|
|
925
|
+
${Sh}
|
|
926
926
|
transition: color 0.1s ease-in;
|
|
927
927
|
color: ${({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
|
|
928
928
|
text-transform: ${({error:e})=>e?"":"capitalize"};
|
|
929
|
-
`,
|
|
929
|
+
`,kh=Re.div`
|
|
930
930
|
display: flex;
|
|
931
931
|
height: 100%;
|
|
932
932
|
flex-direction: column;
|
|
933
933
|
justify-content: space-between;
|
|
934
|
-
`,
|
|
935
|
-
${e=>e.hideAnimations&&
|
|
934
|
+
`,Rh=Re(K)`
|
|
935
|
+
${e=>e.hideAnimations&&Yi`
|
|
936
936
|
&& {
|
|
937
937
|
transition: none;
|
|
938
938
|
}
|
|
939
939
|
`}
|
|
940
|
-
`,
|
|
940
|
+
`,cc=Yi`
|
|
941
941
|
&& {
|
|
942
942
|
width: 100%;
|
|
943
943
|
border-width: 1px;
|
|
@@ -952,22 +952,22 @@ Resources:
|
|
|
952
952
|
font-weight: 300;
|
|
953
953
|
line-height: 22px; /* 137.5% */
|
|
954
954
|
}
|
|
955
|
-
`,
|
|
956
|
-
${
|
|
955
|
+
`,Ji=Re.input`
|
|
956
|
+
${cc}
|
|
957
957
|
|
|
958
958
|
&::placeholder {
|
|
959
959
|
color: var(--privy-color-foreground-3);
|
|
960
960
|
font-style: italic;
|
|
961
961
|
}
|
|
962
|
-
`,
|
|
963
|
-
${
|
|
964
|
-
`,
|
|
962
|
+
`,Ih=Re.div`
|
|
963
|
+
${cc}
|
|
964
|
+
`,Wh=Re.div`
|
|
965
965
|
position: relative;
|
|
966
966
|
width: 100%;
|
|
967
967
|
display: flex;
|
|
968
968
|
align-items: center;
|
|
969
969
|
justify-content: ${({centered:e})=>e?"center":"space-between"};
|
|
970
|
-
`,
|
|
970
|
+
`,Nh=Re(bh)`
|
|
971
971
|
position: absolute;
|
|
972
972
|
right: 12px;
|
|
973
973
|
height: 24px;
|
|
@@ -978,7 +978,7 @@ Resources:
|
|
|
978
978
|
:active {
|
|
979
979
|
stroke: var(--privy-color-accent-light);
|
|
980
980
|
}
|
|
981
|
-
`,
|
|
981
|
+
`,Lh=Re.div`
|
|
982
982
|
display: flex;
|
|
983
983
|
flex-direction: column;
|
|
984
984
|
align-items: center;
|
|
@@ -1000,7 +1000,7 @@ Resources:
|
|
|
1000
1000
|
font-weight: 400;
|
|
1001
1001
|
line-height: 20px;
|
|
1002
1002
|
}
|
|
1003
|
-
`,
|
|
1003
|
+
`,Oh=Re.progress`
|
|
1004
1004
|
height: 4px;
|
|
1005
1005
|
width: 100%;
|
|
1006
1006
|
margin: 8px 0;
|
|
@@ -1016,12 +1016,12 @@ Resources:
|
|
|
1016
1016
|
transition: all 0.1s ease-out;
|
|
1017
1017
|
background: ${({label:e})=>e==="Strong"&&"#78dca6"||e==="Medium"&&"var(--privy-color-warn)"||"var(--privy-color-error)"};
|
|
1018
1018
|
}
|
|
1019
|
-
`,
|
|
1019
|
+
`,sc=Re.div`
|
|
1020
1020
|
display: flex;
|
|
1021
1021
|
flex-direction: column;
|
|
1022
1022
|
margin: 20px 0;
|
|
1023
1023
|
gap: 10px;
|
|
1024
|
-
`,Pn=
|
|
1024
|
+
`,Pn=Re.div`
|
|
1025
1025
|
display: flex;
|
|
1026
1026
|
text-align: left;
|
|
1027
1027
|
align-items: center;
|
|
@@ -1041,10 +1041,10 @@ Resources:
|
|
|
1041
1041
|
> :first-child {
|
|
1042
1042
|
min-width: 24px;
|
|
1043
1043
|
}
|
|
1044
|
-
`,
|
|
1044
|
+
`,Mh=Re.a`
|
|
1045
1045
|
flex: 1;
|
|
1046
1046
|
width: 100%;
|
|
1047
|
-
`,
|
|
1047
|
+
`,lc=Re(cn)`
|
|
1048
1048
|
display: flex;
|
|
1049
1049
|
flex: 1;
|
|
1050
1050
|
gap: 4px;
|
|
@@ -1056,13 +1056,13 @@ Resources:
|
|
|
1056
1056
|
border-color: var(--privy-color-foreground-3);
|
|
1057
1057
|
border-width: 1px;
|
|
1058
1058
|
}
|
|
1059
|
-
`,
|
|
1059
|
+
`,Dh=Re.div`
|
|
1060
1060
|
height: var(--privy-height-modal-full);
|
|
1061
1061
|
|
|
1062
1062
|
@media (max-width: 440px) {
|
|
1063
1063
|
height: var(--privy-height-modal-compact);
|
|
1064
1064
|
}
|
|
1065
|
-
`;import{jsx as
|
|
1065
|
+
`;import{jsx as Hh}from"react/jsx-runtime";var dc=()=>{let{app:e,navigate:t,data:o,outerClickRef:r}=g(),[n,i]=Qi(""),[a,l]=Qi(!1),[s,c]=Qi(),w=Bh(!1),{authenticated:m,getAccessToken:b,user:h}=$(),{walletProxy:C,refreshUser:E,closePrivyModal:y,createAnalyticsEvent:P,isNewUserThisSession:T}=_(),{onSuccess:W,onFailure:N,callAuthOnSuccessOnClose:A}=o.createWallet,I=e?.embeddedWallets.requireUserPasswordOnCreate===!1,D=!!(!n||w.current)&&I,ce=Fh(()=>Y(h),[h]),H=new Ge(async()=>G());Uh(()=>{if(!m){t("LANDING"),N(new Error("User must be authenticated before creating a Privy wallet"));return}I&&!a&&!w.current&&(l(!0),H.execute().finally(()=>l(!1)))},[I,m]);let j=()=>{if(ce){console.error(new Wo);return}N(new He("User exited before creating a wallet")),y({shouldCallAuthOnSuccess:A})};r&&(r.current=()=>(j(),{closeModal:!ce}));let G=async function(){let M=await b();if(M)try{P("embedded_wallet_creation_started");let de=await C?.create({accessToken:M,recoveryPassword:s});if(!de){let ee=await E();if(de=Y(ee),!de)throw new Error("Unable to create wallet")}P("embedded_wallet_creation_completed",{walletAddress:de.address}),i("");let z=await E();if(w.current=!0,I)if(T)t("EMBEDDED_WALLET_CREATED_SCREEN");else{let ee=Y(z);ee&&(W(ee),y({shouldCallAuthOnSuccess:A}))}}catch(de){if(w.current)return;i("An error has occurred, please try again."),console.warn(de)}};return Hh(_n,{loading:D,invalidState:I&&!D,errorMessage:n,buttonHideAnimations:!Y&&a,buttonLoading:a||!C,hasSetPassword:!!ce,password:s,onClose:j,onPasswordChange:c,onPasswordGenerate:()=>c(En()),onSubmit:()=>I?y({shouldCallAuthOnSuccess:A}):(l(!0),ce?setTimeout(()=>{l(!1),t("EMBEDDED_WALLET_CREATED_SCREEN")},350):requestAnimationFrame(()=>H.execute().finally(()=>l(!1))))})};import{useEffect as Gh,useState as Sn}from"react";import{jsx as zh}from"react/jsx-runtime";var pc=()=>{let[e,t]=Sn(null),[o,r]=Sn(!1),[n,i]=Sn(""),[a,l]=Sn(),{authenticated:s,getAccessToken:c,user:w}=$(),{walletProxy:m,refreshUser:b,closePrivyModal:h,createAnalyticsEvent:C}=_(),{navigate:E,data:y,outerClickRef:P}=g(),{onSuccess:T,onFailure:W}=y.createWallet,N=Y(w),A=!!e;Gh(()=>{s||(E("LANDING"),W(new Dr("User must be authenticated before setting a password on a Privy wallet")))},[s]);let I=()=>{if(A){console.error(new Wo);return}W(new He("Exited before password was added to wallet")),h({shouldCallAuthOnSuccess:!1})};P&&(P.current=()=>(I(),{closeModal:!A}));let D=async()=>{let H=await c();if(H&&N?.address&&a&&m)try{if(C("embedded_wallet_set_password_started",{walletAddress:N.address}),!(await m.setRecoveryPassword({accessToken:H,address:N.address,recoveryPassword:a})).address){W(new He("Error setting password on privy wallet")),C("embedded_wallet_set_password_failed",{walletAddress:N.address,reason:"error setting password"});return}let G=await b(),X=Y(G);if(!X){W(new He("Error setting password on privy wallet")),C("embedded_wallet_set_password_failed",{walletAddress:N.address,reason:"wallet disconnected"});return}t(X),C("embedded_wallet_set_password_completed",{walletAddress:N.address})}catch(j){console.warn(j),i("An error has occurred, please try again."),W(j instanceof Error?j:new Error("Error setting password on privy wallet")),C("embedded_wallet_set_password_failed",{walletAddress:N.address,reason:j})}};return zh(_n,{errorMessage:n,hasSetPassword:A,buttonLoading:o,onClose:I,buttonHideAnimations:!1,password:a,onPasswordGenerate:()=>l(En()),onPasswordChange:l,onSubmit:async()=>{A?(T(e),h({shouldCallAuthOnSuccess:!1})):(r(!0),await D(),r(!1))}})};import{UserCircleIcon as Vh}from"@heroicons/react/24/outline";import{LockClosedIcon as $h}from"@heroicons/react/24/solid";import{useEffect as qh}from"react";import{Fragment as jh,jsx as Rt,jsxs as An}from"react/jsx-runtime";var uc=()=>{let{user:e}=$(),{closePrivyModal:t,createAnalyticsEvent:o}=_(),{data:r,setModalData:n,navigate:i,outerClickRef:a}=g(),{onSuccess:l,onFailure:s}=r.setWalletPassword,c=()=>{s(new He("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return qh(()=>{a&&(a.current=c)},[]),An(jh,{children:[Rt(S,{onClose:c}),Rt(R,{}),An($t,{children:[An(ll,{children:[Rt(Vh,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),Rt(cl,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:Rt($h,{width:"12px",height:"12px",fill:"white"})})]}),An(Ee,{title:"Secure Your Account",children:["Please set a password to secure your account.",Rt("p",{children:"Losing this password will make your account inaccessible on new devices. You will only be asked for it when you log on to a new device."})]})]}),Rt(K,{onClick:()=>{let m=Y(e);o("embedded_wallet_set_password_started",{walletAddress:m?.address}),n({createWallet:{onFailure:s,onSuccess:l,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),i("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),Rt(O,{}),Rt(B,{protectedByPrivy:!0})]})};import{ShieldCheckIcon as Kh}from"@heroicons/react/24/outline";import{useEffect as Yh,useState as Zi}from"react";import kn,{css as Jh}from"styled-components";import{Fragment as tf,jsx as Ye,jsxs as qo}from"react/jsx-runtime";var mc=()=>{let{authenticated:e,getAccessToken:t}=$(),{walletProxy:o,closePrivyModal:r,createAnalyticsEvent:n}=_(),{navigate:i,data:a,outerClickRef:l}=g(),[s,c]=Zi(void 0),[w,m]=Zi(""),[b,h]=Zi(!1),{privyWallet:C,onCompleteNavigateTo:E,onSuccess:y,onFailure:P}=a.recoverWallet,T=(A="User exited before their wallet could be recovered")=>{r({shouldCallAuthOnSuccess:!1}),P(typeof A=="string"?new He(A):A)};l&&(l.current=()=>T()),Yh(()=>{if(!e||!C)return T("User must be authenticated and have a Privy wallet before it can be recovered")},[e]);let W=A=>{A&&c(A)};return qo(tf,{children:[Ye(S,{onClose:T}),Ye(R,{}),qo(Zh,{children:[qo(Qh,{children:[Ye(Kh,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Ye("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),Ye("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),qo("div",{children:[Ye(Ji,{onChange:A=>W(A.target.value),disabled:b}),!!w&&Ye(Xh,{children:w})]}),qo("div",{children:[qo(sl,{children:[Ye("h4",{children:"Why is this necessary?"}),Ye("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),Ye(ef,{loading:b||!o,disabled:!s,onClick:async()=>{h(!0);let A=await t();if(A&&C&&s!==null)try{n("embedded_wallet_recovery_started",{walletAddress:C.address}),await o?.recover({address:C.address,accessToken:A,recoveryPin:s}),m(""),E?i(E):r({shouldCallAuthOnSuccess:!1}),y?.(C),n("embedded_wallet_recovery_completed",{walletAddress:C.address})}catch(I){Ul(I)?m("Invalid recovery password, please try again."):m("An error has occurred, please try again.")}finally{h(!1)}else return T("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!C&&b,children:"Recover your account"})]})]}),Ye(O,{}),Ye(B,{protectedByPrivy:!0})]})},Qh=kn.div`
|
|
1066
1066
|
display: flex;
|
|
1067
1067
|
flex-direction: column;
|
|
1068
1068
|
align-items: center;
|
|
@@ -1084,33 +1084,33 @@ Resources:
|
|
|
1084
1084
|
font-weight: 400;
|
|
1085
1085
|
line-height: 20px;
|
|
1086
1086
|
}
|
|
1087
|
-
`,
|
|
1087
|
+
`,Zh=kn.div`
|
|
1088
1088
|
display: flex;
|
|
1089
1089
|
height: 100%;
|
|
1090
1090
|
flex-direction: column;
|
|
1091
1091
|
justify-content: space-between;
|
|
1092
|
-
`,
|
|
1092
|
+
`,Xh=kn.div`
|
|
1093
1093
|
line-height: 20px;
|
|
1094
1094
|
height: 20px;
|
|
1095
1095
|
font-size: 13px;
|
|
1096
1096
|
color: var(--privy-color-error);
|
|
1097
1097
|
text-align: left;
|
|
1098
1098
|
margin-top: 0.5rem;
|
|
1099
|
-
`,
|
|
1100
|
-
${e=>e.hideAnimations&&
|
|
1099
|
+
`,ef=kn(K)`
|
|
1100
|
+
${e=>e.hideAnimations&&Jh`
|
|
1101
1101
|
&& {
|
|
1102
1102
|
// Remove animations because the recoverWallet task on the iframe partially
|
|
1103
1103
|
// blocks the renderer, so the animation stutters and doesn't look good
|
|
1104
1104
|
transition: none;
|
|
1105
1105
|
}
|
|
1106
1106
|
`}
|
|
1107
|
-
`;import{EyeSlashIcon as
|
|
1107
|
+
`;import{EyeSlashIcon as rf,LinkIcon as nf,ClockIcon as af}from"@heroicons/react/24/outline";import It from"styled-components";import{jsx as Xi,jsxs as of}from"react/jsx-runtime";var Rn=({size:e=61,...t})=>Xi("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:of("g",{id:"moonpay_symbol_wht 2",children:[Xi("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),Xi("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});import{Fragment as hc,jsx as Pe,jsxs as yo}from"react/jsx-runtime";var ea=({title:e,desc:t,icon:o})=>yo(pf,{children:[Pe(mf,{children:o}),yo(uf,{children:[Pe(cf,{children:e}),Pe(df,{children:t})]})]}),fc=({app:e,signedUrl:t,onContinue:o})=>yo(hc,{children:[yo(sf,{children:[Pe(Rn,{size:"3.75rem"}),yo(lf,{children:[e?.name," uses ",Pe("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),yo(hf,{children:[Pe(ea,{icon:Pe(nf,{width:"1rem"}),title:"Purchase assets to fund your account",desc:yo(hc,{children:["Connect a payment method (",Pe("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),Pe(ea,{icon:Pe(af,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),Pe(ea,{icon:Pe(rf,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),Pe(ff,{className:"mobile-only"})]}),Pe(pe,{children:Pe(dn,{href:t,target:"_blank",rel:"noopener noreferrer",annotation:"By clicking continue, you will be taken to MoonPay in a new tab",onClick:o,children:"Continue to Moonpay"})})]}),sf=It.div`
|
|
1108
1108
|
display: flex;
|
|
1109
1109
|
flex-direction: column;
|
|
1110
1110
|
align-items: center;
|
|
1111
1111
|
justify-content: center;
|
|
1112
1112
|
padding-top: 2rem;
|
|
1113
|
-
`,
|
|
1113
|
+
`,lf=It.span`
|
|
1114
1114
|
color: var(--privy-color-foreground);
|
|
1115
1115
|
text-align: center;
|
|
1116
1116
|
font-size: 1.125rem;
|
|
@@ -1119,64 +1119,64 @@ Resources:
|
|
|
1119
1119
|
margin: 1.5rem 0;
|
|
1120
1120
|
text-align: center;
|
|
1121
1121
|
max-width: 19.5rem;
|
|
1122
|
-
`,
|
|
1122
|
+
`,cf=It.span`
|
|
1123
1123
|
color: var(--privy-color-foreground);
|
|
1124
1124
|
font-size: 0.875rem;
|
|
1125
1125
|
font-weight: 500;
|
|
1126
1126
|
line-height: 1.225rem;
|
|
1127
1127
|
width: 100%;
|
|
1128
|
-
`,
|
|
1128
|
+
`,df=It.span`
|
|
1129
1129
|
color: var(--privy-color-foreground-2);
|
|
1130
1130
|
font-size: 0.875rem;
|
|
1131
1131
|
font-weight: 400;
|
|
1132
1132
|
line-height: 1.225rem;
|
|
1133
|
-
`,
|
|
1133
|
+
`,pf=It.div`
|
|
1134
1134
|
display: flex;
|
|
1135
1135
|
align-items: flex-start;
|
|
1136
1136
|
gap: 0.5rem;
|
|
1137
1137
|
align-self: stretch;
|
|
1138
|
-
`,
|
|
1138
|
+
`,uf=It.div`
|
|
1139
1139
|
display: flex;
|
|
1140
1140
|
flex-direction: column;
|
|
1141
1141
|
gap: 0.25rem;
|
|
1142
1142
|
align-items: flex-start;
|
|
1143
1143
|
text-align: left;
|
|
1144
1144
|
flex: 1 0 0;
|
|
1145
|
-
`,
|
|
1145
|
+
`,mf=It.div`
|
|
1146
1146
|
padding-top: 2px;
|
|
1147
|
-
`,
|
|
1147
|
+
`,hf=It.div`
|
|
1148
1148
|
display: flex;
|
|
1149
1149
|
flex-direction: column;
|
|
1150
1150
|
gap: 1.25rem;
|
|
1151
1151
|
margin: 0 0.5rem;
|
|
1152
|
-
`,
|
|
1152
|
+
`,ff=It.div`
|
|
1153
1153
|
margin: 30px 0;
|
|
1154
|
-
`;import{ofetch as
|
|
1154
|
+
`;import{ofetch as yf}from"ofetch";import{useEffect as gf,useRef as vf,useState as wf}from"react";var In="moonpay",yc="sdk_fiat_on_ramp_completed_with_status";async function gc(e,t,o,r,n=!1){let i=o.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},a=o.uiConfig||{accentColor:r.accent,theme:r.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...o,...i,...a}})}async function Cf(e,t){let o=t?xs:Es,r=t?Ps:Ts;return yf(`${o}/transactions/ext/${e}`,{query:{apiKey:r}})}function vc(e,t=!1){let[o,r]=wf(null),{createAnalyticsEvent:n}=_(),i=vf(0);return gf(()=>{let a=setInterval(async()=>{if(e)try{let[l]=await Cf(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;r(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n(yc,{status:s,provider:In,paymentMethod:l.paymentMethod,cardPaymentType:l.cardPaymentType,currency:l.currency?.code,baseCurrencyAmount:l.baseCurrencyAmount,quoteCurrencyAmount:l.quoteCurrencyAmount,feeAmount:l.feeAmount,extraFeeAmount:l.extraFeeAmount,networkFeeAmount:l.networkFeeAmount}),clearInterval(a))}catch(l){l.response?.status!==404&&(i.current+=1),i.current>=3&&(r("serviceFailure"),n(yc,{status:"serviceFailure",provider:In}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),o}import{Fragment as bf,jsx as Wn,jsxs as Ef}from"react/jsx-runtime";var wc=()=>{let{app:e,data:t,navigate:o}=g(),{createAnalyticsEvent:r}=_(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:Ef(bf,{children:[Wn(S,{title:"Fund account"},"header"),Wn(R,{}),Wn(fc,{app:e,signedUrl:n,onContinue:()=>{r("sdk_fiat_on_ramp_started",{provider:In}),o("FIAT_ON_RAMP_STATUS_SCREEN")}}),Wn(B,{protectedByPrivy:!0})]})};import{ArrowsRightLeftIcon as xf,CheckCircleIcon as Tf,XCircleIcon as Pf}from"@heroicons/react/24/solid";import{useMemo as _f}from"react";import Cc from"styled-components";import{Fragment as ta,jsx as ve,jsxs as go}from"react/jsx-runtime";var bc=()=>{let{app:e,data:t}=g(),{closePrivyModal:o}=_(),{externalTransactionId:r}=t?.fiatOnRampStatus,n=vc(r||null,e.fiatOnRamp.useSandbox);return go(ta,{children:[ve(S,{title:"Fund account"},"header"),ve(R,{}),ve(Af,{status:n,onClickCta:o}),ve(B,{protectedByPrivy:!0})]})},Sf=e=>{switch(e){case"completed":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"failed":return{title:"Something went wrong!",body:go(ta,{children:[go("p",{children:["It looks like there was an issue with your payment. Please contact"," ",ve("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),ve("p",{style:{fontStyle:"italic"},children:"Note that debit cards typically work better than credit cards here."})]}),cta:"Done"};case"serviceFailure":return{title:"Something went wrong!",body:"MoonPay ran into an error when processing your transaction. Try again?",cta:"Done"};case"waitingAuthorization":return{title:"Processing payment",body:"This may take up to a few hours. You will receive an email when the purchase is complete.",cta:"Continue"};default:return{title:"In Progress",body:"Go back to MoonPay to finish funding your account.",cta:""}}},Af=({status:e,onClickCta:t})=>{let{title:o,body:r,cta:n}=_f(()=>Sf(e),[e]);return go(ta,{children:[go(Nf,{style:{height:"100%",gap:0},children:[ve(If,{status:e}),go(qt,{children:[ve("h3",{children:o}),ve(Wf,{children:r})]})]}),n&&ve(pe,{children:ve(K,{onClick:t,children:n})})]})},kf=e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)",Rf=e=>{switch(e){case"serviceFailure":case"failed":return Pf;case"completed":return Tf;case"waitingAuthorization":return()=>ve(xf,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}});default:return}},If=({status:e})=>{if(!e||e==="pending"){let r="var(--privy-color-foreground-4)";return go("div",{style:{position:"relative"},children:[ve(mo,{color:r,style:{position:"absolute"}}),ve(Ai,{color:r}),ve(Rn,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=Rf(e),o=kf(e);return ve("div",{style:{borderColor:o,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&ve(t,{width:"4rem",height:"4rem",color:o})})},Wf=Cc.p`
|
|
1155
1155
|
font-size: 1rem;
|
|
1156
1156
|
color: var(--privy-color-foreground-3);
|
|
1157
1157
|
margin-bottom: 1rem;
|
|
1158
1158
|
display: flex;
|
|
1159
1159
|
flex-direction: column;
|
|
1160
1160
|
gap: 1rem;
|
|
1161
|
-
`,
|
|
1161
|
+
`,Nf=Cc.div`
|
|
1162
1162
|
display: flex;
|
|
1163
1163
|
flex-direction: column;
|
|
1164
1164
|
align-items: center;
|
|
1165
1165
|
justify-content: center;
|
|
1166
1166
|
margin-left: 1.75rem;
|
|
1167
1167
|
margin-right: 1.75rem;
|
|
1168
|
-
`;import{useState as
|
|
1168
|
+
`;import{useState as Kf}from"react";import*as Wt from"react-device-detect";import wt from"styled-components";import oa from"styled-components";import{jsx as Ec}from"react/jsx-runtime";var xc=({style:e,...t})=>Ec("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"17",height:"17",viewBox:"0 0 17 17",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:Ec("path",{strokeLinecap:"round",strokeLinejoin:"round",fillRule:"evenodd",clipRule:"evenodd",d:"M16.5 8.67993C16.5 9.82986 15.853 10.8287 14.9032 11.3322C15.2188 12.3599 14.97 13.5237 14.1569 14.3368C13.3437 15.1499 12.18 15.3987 11.1523 15.0831C10.6488 16.0329 9.64993 16.6799 8.5 16.6799C7.35007 16.6799 6.35126 16.0329 5.84771 15.0831C4.82003 15.3987 3.65627 15.1499 2.84314 14.3368C2.03001 13.5237 1.78124 12.3599 2.09681 11.3322C1.14699 10.8287 0.5 9.82986 0.5 8.67993C0.5 7.53 1.14699 6.53119 2.0968 6.02764C1.78125 4.99996 2.03003 3.83621 2.84315 3.02309C3.65627 2.20997 4.82002 1.96119 5.8477 2.27675C6.35125 1.32692 7.35007 0.679932 8.5 0.679932C9.64992 0.679932 10.6487 1.32691 11.1523 2.27672C12.18 1.96115 13.3437 2.20993 14.1569 3.02305C14.97 3.83618 15.2188 4.99996 14.9032 6.02764C15.853 6.53119 16.5 7.53 16.5 8.67993ZM12.2659 6.68856C12.5654 6.40238 12.5761 5.92763 12.29 5.62818C12.0038 5.32873 11.529 5.31797 11.2296 5.60416C9.73022 7.03711 8.40877 8.65489 7.3018 10.4211L5.78033 8.89963C5.48744 8.60673 5.01256 8.60673 4.71967 8.89963C4.42678 9.19252 4.42678 9.66739 4.71967 9.96029L6.92031 12.1609C7.08544 12.3261 7.31807 12.4048 7.54957 12.374C7.78106 12.3432 7.98499 12.2064 8.1012 12.0038C9.23027 10.0356 10.6362 8.24613 12.2659 6.68856Z",fill:"var(--privy-color-accent)"})});import{jsx as Of,jsxs as Mf}from"react/jsx-runtime";var Nn=oa.div`
|
|
1169
1169
|
display: flex;
|
|
1170
1170
|
flex-direction: column;
|
|
1171
1171
|
justify-content: flex-start;
|
|
1172
1172
|
gap: 4px;
|
|
1173
|
-
`,vo=
|
|
1173
|
+
`,vo=oa.div`
|
|
1174
1174
|
&&& {
|
|
1175
1175
|
margin-left: 7px; /* TODO: This is a total hack */
|
|
1176
1176
|
border-left: 2px solid var(--privy-color-foreground-4);
|
|
1177
1177
|
height: 12px;
|
|
1178
1178
|
}
|
|
1179
|
-
`,
|
|
1179
|
+
`,vt=({children:e})=>Mf(Lf,{children:[Of(xc,{style:{width:"16px",height:"16px"}}),e]}),Lf=oa.div`
|
|
1180
1180
|
display: flex;
|
|
1181
1181
|
justify-content: flex-start;
|
|
1182
1182
|
justify-items: center;
|
|
@@ -1194,7 +1194,7 @@ Resources:
|
|
|
1194
1194
|
margin-bottom: auto;
|
|
1195
1195
|
}
|
|
1196
1196
|
}
|
|
1197
|
-
`;import
|
|
1197
|
+
`;import Df from"qrcode";import Uf from"styled-components";import{Fragment as jo,jsx as _e,jsxs as _c}from"react/jsx-runtime";var Ue=7,ra=(e,t,o,r,n)=>{for(let i=t;i<t+r;i++)for(let a=o;a<o+n;a++){let l=e?.[a];l&&l[i]&&(l[i]=0)}return e},Ff=e=>{let t=Df.create(e,{errorCorrectionLevel:"high"}).modules,o=As(Array.from(t.data),t.size);return o=ra(o,0,0,Ue,Ue),o=ra(o,o.length-Ue,0,Ue,Ue),o=ra(o,0,o.length-Ue,Ue,Ue),o},Bf=({x:e,y:t,cellSize:o,bgColor:r,fgColor:n})=>_e(jo,{children:[0,1,2].map(i=>_e("circle",{r:o*(Ue-i*2)/2,cx:e+o*Ue/2,cy:t+o*Ue/2,fill:i%2!==0?r:n},`finder-${e}-${t}-${i}`))}),Hf=({cellSize:e,matrixSize:t,bgColor:o,fgColor:r})=>{let n=[[0,0],[(t-Ue)*e,0],[0,(t-Ue)*e]];return _e(jo,{children:n.map(([i,a])=>_e(Bf,{x:i,y:a,cellSize:e,bgColor:o,fgColor:r}))})},Gf=({matrix:e,cellSize:t,color:o})=>_e(jo,{children:e.map((r,n)=>r.map((i,a)=>i?_e("circle",{r:t/2.5,cx:n*t+t/2,cy:a*t+t/2,fill:o},`circle-${n}-${a}`):_e(jo,{})))}),Tc=(e,t)=>e-e%t,zf=({outputSize:e,cellSize:t,element:o,size:r,padding:n,bgColor:i})=>{if(!o)return _e(jo,{});let a=r||40,l=n||4,s=o,c=e/2-a/2-l;return _c(jo,{children:[_e("rect",{x:Tc(c,t),y:Tc(c,t),width:a+l*2+(c%t?t+.5:.5),height:a+l*2+(c%t?t+.5:.5),fill:i}),_e(s,{x:e/2-a/2,y:e/2-a/2,height:a,width:a})]})},Vf=e=>{let t=e.outputSize,o=Ff(e.url),r=t/o.length;return _c("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[_e(Gf,{matrix:o,cellSize:r,color:e.fgColor}),_e(Hf,{cellSize:r,matrixSize:o.length,fgColor:e.fgColor,bgColor:e.bgColor}),_e(zf,{outputSize:e.outputSize,cellSize:r,element:e.logo?.element,bgColor:e.bgColor})]})},$f=Uf.div`
|
|
1198
1198
|
display: flex;
|
|
1199
1199
|
justify-content: center;
|
|
1200
1200
|
align-items: center;
|
|
@@ -1209,7 +1209,7 @@ Resources:
|
|
|
1209
1209
|
border-color: ${e=>e.fgColor};
|
|
1210
1210
|
border-radius: var(--privy-border-radius-md);
|
|
1211
1211
|
}
|
|
1212
|
-
`,
|
|
1212
|
+
`,Pc=e=>{let t=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",r=e.size||160;return _e($f,{size:r,bgColor:t,fgColor:o,children:_e(Vf,{url:e.url,logo:{element:e.squareLogoElement},outputSize:r,bgColor:t,fgColor:o})})};import{jsx as qf}from"react/jsx-runtime";var Sc=({size:e})=>qf(Pc,{url:"https://coinbase-wallet.onelink.me/q5Sx/fdb9b250",squareLogoElement:lt,size:e,fgColor:"#1F1F1F"});import{jsx as Ac}from"react/jsx-runtime";var kc=e=>Ac("svg",{width:"160",height:"160",viewBox:"0 0 160 160",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Ac("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M68.853 62.127c-5.174.517-8.978 4.95-8.978 10.149v15.336c0 5.248 3.873 9.7 9.098 10.196 3.623.344 7.71.64 11.027.64 5.445 0 12.964-.799 17.098-1.294a3.445 3.445 0 0 0 3.027-3.436v-19.05c0-1.75-1.29-3.228-3.027-3.436-3.657-.438-9.961-1.113-15.136-1.264a66.647 66.647 0 0 0-1.965-.03c-.72 0-1.478.013-2.262.04-3.046.1-6.453.373-9.467.669a1.677 1.677 0 0 1-.174-3.347c3.804-.373 8.282-.717 11.903-.717 4.034 0 9.137.427 13.193.847 1.322.137 2.54.274 3.58.397v-1.582c0-1.734-1.264-3.203-2.983-3.426-3.83-.497-10.563-1.267-15.464-1.267-2.848 0-6.314.26-9.47.575Zm25.399 24.581a2.516 2.516 0 1 0 0-5.031 2.516 2.516 0 0 0 0 5.031Z",fill:"var(--privy-color-accent)"})});import{jsx as we,jsxs as jf}from"react/jsx-runtime";var Rc=({style:e,...t})=>jf("svg",{width:"286",height:"183",viewBox:"0 0 286 183",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:[we("rect",{x:"198.5",y:"133",width:"50",height:"50",rx:"25",fill:"#E1E7EF"}),we(be,{x:"206",y:"140",width:"36",height:"36"}),we("rect",{x:"192",y:"30",width:"50",height:"50",rx:"25",fill:"#0C5BFF"}),we("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M205 55C205 61.6274 210.373 67 217 67C223.627 67 229 61.6274 229 55C229 48.3726 223.627 43 217 43C210.373 43 205 48.3726 205 55ZM213.933 51.1333C213.491 51.1333 213.133 51.4915 213.133 51.9333V58.0667C213.133 58.5085 213.491 58.8667 213.933 58.8667H220.067C220.508 58.8667 220.867 58.5085 220.867 58.0667V51.9333C220.867 51.4915 220.508 51.1333 220.067 51.1333H213.933Z",fill:"white"}),we("rect",{x:"39.5",y:"18",width:"50",height:"50",rx:"50",fill:"#AB9FF2"}),we($e,{x:"44.5",y:"23",width:"40",height:"40"}),we("rect",{x:"46.5",y:"124",width:"50",height:"50",rx:"25",fill:"#141414"}),we("g",{clipPath:"url(#clip0_428_81)",children:we("path",{d:"M62.1497 143.578C67.3134 138.585 75.6867 138.585 80.8505 143.578L81.4722 144.179C81.5335 144.238 81.5822 144.308 81.6155 144.386C81.6488 144.463 81.666 144.547 81.666 144.631C81.666 144.715 81.6488 144.799 81.6155 144.876C81.5822 144.954 81.5335 145.024 81.4722 145.083L79.3462 147.139C79.2835 147.199 79.1996 147.232 79.1123 147.232C79.025 147.232 78.9411 147.199 78.8784 147.139L78.0232 146.311C74.421 142.829 68.58 142.829 64.977 146.311L64.0611 147.197C63.9984 147.257 63.9145 147.29 63.8272 147.29C63.7399 147.29 63.656 147.257 63.5933 147.197L61.4672 145.141C61.4059 145.083 61.3572 145.012 61.3239 144.935C61.2906 144.857 61.2735 144.774 61.2735 144.689C61.2735 144.605 61.2906 144.521 61.3239 144.444C61.3572 144.366 61.4059 144.296 61.4672 144.237L62.1497 143.578ZM85.248 147.829L87.1397 149.659C87.201 149.718 87.2497 149.788 87.283 149.865C87.3163 149.943 87.3334 150.027 87.3334 150.111C87.3334 150.195 87.3163 150.279 87.283 150.356C87.2497 150.434 87.201 150.504 87.1397 150.563L78.6081 158.812C78.4828 158.933 78.315 159 78.1403 159C77.9656 159 77.7978 158.933 77.6725 158.812L71.6177 152.957C71.5864 152.927 71.5443 152.91 71.5005 152.91C71.4567 152.91 71.4147 152.927 71.3833 152.957L65.3285 158.812C65.2032 158.933 65.0354 159 64.8607 159C64.686 159 64.5182 158.933 64.3929 158.812L55.8605 150.563C55.7992 150.504 55.7505 150.434 55.7172 150.356C55.6839 150.279 55.6667 150.195 55.6667 150.111C55.6667 150.027 55.6839 149.943 55.7172 149.865C55.7505 149.788 55.7992 149.718 55.8605 149.659L57.7531 147.829C57.8783 147.709 58.0459 147.642 58.2204 147.642C58.3949 147.642 58.5625 147.709 58.6878 147.829L64.7427 153.684C64.774 153.714 64.816 153.731 64.8598 153.731C64.9036 153.731 64.9457 153.714 64.977 153.684L71.0319 147.829C71.1572 147.709 71.325 147.641 71.4997 147.641C71.6743 147.641 71.8422 147.709 71.9675 147.829L78.0232 153.684C78.0545 153.714 78.0965 153.731 78.1403 153.731C78.1841 153.731 78.2262 153.714 78.2575 153.684L84.3124 147.829C84.4377 147.709 84.6055 147.641 84.7802 147.641C84.9549 147.641 85.1227 147.709 85.248 147.829Z",fill:"white"})}),we("rect",{x:"103.5",y:"58",width:"78",height:"78",rx:"39",fill:"var(--privy-color-foreground-accent)"}),we(kc,{x:"63",y:"17"}),we("rect",{x:"103.5",y:"58",width:"78",height:"78",rx:"39",stroke:"#E1E7EF",strokeWidth:"2"}),we("path",{fill:"var(--privy-color-accent)",d:"M269.405 111c8.865 0 16.052-7.163 16.052-16s-7.187-16-16.052-16c-8.865 0-16.051 7.163-16.051 16s7.186 16 16.051 16ZM133.971 24c6.649 0 12.039-5.373 12.039-12s-5.39-12-12.039-12-12.039 5.373-12.039 12 5.39 12 12.039 12ZM15.592 112c4.986 0 9.029-4.029 9.029-9 0-4.97-4.043-9-9.03-9-4.986 0-9.028 4.03-9.028 9 0 4.971 4.042 9 9.029 9Z"}),we("path",{fill:"var(--privy-color-accent-light)",d:"M152.029 177c5.541 0 10.032-4.477 10.032-10s-4.491-10-10.032-10-10.032 4.477-10.032 10 4.491 10 10.032 10ZM263.386 21c4.432 0 8.026-3.582 8.026-8s-3.594-8-8.026-8c-4.433 0-8.026 3.582-8.026 8s3.593 8 8.026 8ZM7.064 36c3.602 0 6.521-2.91 6.521-6.5s-2.92-6.5-6.52-6.5C3.462 23 .542 25.91.542 29.5S3.463 36 7.064 36Z"}),we("defs",{children:we("clipPath",{id:"clip0_428_81",children:we("rect",{width:"31.6667",height:"19.1667",fill:"white",transform:"translate(55.6667 139.833)"})})})]});import{Fragment as na,jsx as k,jsxs as se}from"react/jsx-runtime";var ia=()=>{let{navigate:e}=g(),t="https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en";return Wt.isFirefox&&(t="https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/"),se(la,{children:[k(ft,{title:"Create a MetaMask wallet",description:"Follow the instructions below to get started."}),k(ca,{children:k(be,{style:{width:"152px",height:"152px"}})}),se(Nn,{children:[k(vt,{children:se("div",{children:[k("span",{children:"Install the "}),k("a",{href:t,target:"_blank",children:"MetaMask browser extension"})]})}),k(vo,{}),k(vt,{children:"Set up your first wallet"}),k(vo,{}),k(vt,{children:"Store your recovery phrase in a safe place!"})]}),k(fe,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},aa=()=>{let{navigate:e}=g(),t="https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en";return Wt.isFirefox&&(t="https://addons.mozilla.org/en-US/firefox/addon/phantom-app/"),se(la,{children:[k(ft,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),k(ca,{children:k($e,{style:{width:"152px",height:"152px"}})}),se(Nn,{children:[k(vt,{children:se("div",{children:[k("span",{children:"Install the "}),k("a",{href:t,target:"_blank",children:"Phantom browser extension"})]})}),k(vo,{}),k(vt,{children:"Set up your first wallet"}),k(vo,{}),k(vt,{children:"Store your recovery phrase in a safe place!"})]}),k(fe,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},sa=()=>{let{navigate:e}=g();return se(la,{children:[k(ft,{title:"Create a Coinbase wallet",description:"Follow the instructions below to get started."}),k(ca,{style:{marginTop:"-24px"},children:k(Sc,{size:200})}),se(Nn,{children:[k(vt,{children:"Scan the QR code with your camera"}),k(vo,{}),k(vt,{children:"Set up your first wallet"}),k(vo,{}),k(vt,{children:"Store your seed phrase in a safe place!"})]}),k(fe,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},Nc=()=>{let[e,t]=Kf("WHAT_IS_A_WALLET"),{navigateBack:o}=g();return se(na,{children:[k(S,{backFn:e==="WHAT_IS_A_WALLET"?o:e==="PICK_A_NEW_WALLET"?()=>t("WHAT_IS_A_WALLET"):()=>t("PICK_A_NEW_WALLET")},"header"),k(R,{}),se(Yf,{children:[e==="WHAT_IS_A_WALLET"&&se(na,{children:[k(ey,{children:k(Rc,{style:{width:"240px",height:"auto",borderRadius:"var(--privy-border-radius-sm)",marginBottom:"32px"}})}),se(Ee,{title:"Get started with a new wallet",children:[k("p",{children:"Wallets help you store, send, and receive digital assets and collectibles. They are also a new\xA0way\xA0to\xA0log\xA0in."}),k("p",{children:"Instead of creating new accounts and passwords for every app, you just connect your wallet and bring your\xA0data\xA0with\xA0you."})]}),k(Zf,{children:k(Xf,{onClick:()=>{t("PICK_A_NEW_WALLET")},children:"Create a wallet"})})]}),e==="PICK_A_NEW_WALLET"&&k(na,{children:se(Jf,{children:[k(ft,{title:"Create a new wallet",description:"Select one of the wallet providers below to get started."}),se(Qf,{children:[se(Ic,{onClick:()=>{Wt.isIOS?window.location.href="https://apps.apple.com/us/app/metamask-blockchain-wallet/id1438144202":Wt.isAndroid?window.location.href="https://play.google.com/store/apps/details?id=io.metamask":t("CREATE_METAMASK_WALLET")},children:[k(be,{}),se(Wc,{children:[k("h4",{children:"MetaMask"}),k("p",{children:"Get a browser-based wallet"})]})]}),se(Ic,{onClick:()=>{Wt.isIOS?window.location.href="https://apps.apple.com/us/app/coinbase-wallet-nfts-crypto/id1278383455":Wt.isAndroid?window.location.href="https://play.google.com/store/apps/details?id=org.toshi":t("CREATE_COINBASE_WALLET")},children:[k(lt,{}),se(Wc,{children:[k("h4",{children:"Coinbase Wallet"}),k("p",{children:"Get a mobile app wallet"})]})]})]})]})}),e==="CREATE_COINBASE_WALLET"&&k(sa,{}),e==="CREATE_METAMASK_WALLET"&&k(ia,{}),e==="CREATE_PHANTOM_WALLET"&&k(aa,{})]}),k(O,{}),se(J,{children:[k("span",{children:"Still not sure? "}),k("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"}),"."]})]})},Yf=wt.div`
|
|
1213
1213
|
display: flex;
|
|
1214
1214
|
flex-direction: column;
|
|
1215
1215
|
height: 100%;
|
|
@@ -1220,19 +1220,19 @@ Resources:
|
|
|
1220
1220
|
display: none;
|
|
1221
1221
|
}
|
|
1222
1222
|
}
|
|
1223
|
-
`,
|
|
1223
|
+
`,Jf=wt.div`
|
|
1224
1224
|
display: flex;
|
|
1225
1225
|
flex-direction: column;
|
|
1226
1226
|
align-items: flex-start;
|
|
1227
1227
|
justify-content: flex-start;
|
|
1228
1228
|
text-align: left;
|
|
1229
1229
|
gap: 20px;
|
|
1230
|
-
`,
|
|
1230
|
+
`,Qf=wt.div`
|
|
1231
1231
|
display: flex;
|
|
1232
1232
|
flex-direction: column;
|
|
1233
1233
|
width: 100%;
|
|
1234
1234
|
gap: 8px;
|
|
1235
|
-
`,
|
|
1235
|
+
`,Ic=wt.button`
|
|
1236
1236
|
display: flex;
|
|
1237
1237
|
flex-direction: row;
|
|
1238
1238
|
align-items: center;
|
|
@@ -1265,24 +1265,24 @@ Resources:
|
|
|
1265
1265
|
:hover {
|
|
1266
1266
|
border: 1px solid var(--privy-color-accent-light);
|
|
1267
1267
|
}
|
|
1268
|
-
`,
|
|
1268
|
+
`,Wc=wt.div`
|
|
1269
1269
|
text-align: left;
|
|
1270
1270
|
|
|
1271
1271
|
p {
|
|
1272
1272
|
font-style: italic;
|
|
1273
1273
|
font-size: 12px;
|
|
1274
1274
|
}
|
|
1275
|
-
`,
|
|
1275
|
+
`,Zf=wt.div`
|
|
1276
1276
|
margin-top: auto;
|
|
1277
1277
|
display: flex;
|
|
1278
1278
|
align-items: flex-end;
|
|
1279
1279
|
flex-grow: 1;
|
|
1280
1280
|
width: 100%;
|
|
1281
|
-
`,
|
|
1281
|
+
`,Xf=wt(K)`
|
|
1282
1282
|
&& {
|
|
1283
1283
|
margin-top: 14px;
|
|
1284
1284
|
}
|
|
1285
|
-
`,
|
|
1285
|
+
`,la=wt.div`
|
|
1286
1286
|
display: flex;
|
|
1287
1287
|
flex-direction: column;
|
|
1288
1288
|
align-items: center;
|
|
@@ -1294,17 +1294,17 @@ Resources:
|
|
|
1294
1294
|
> :first-child > svg {
|
|
1295
1295
|
margin-top: 20px;
|
|
1296
1296
|
}
|
|
1297
|
-
`,
|
|
1297
|
+
`,ca=wt.div`
|
|
1298
1298
|
display: flex;
|
|
1299
1299
|
flex-direction: column;
|
|
1300
1300
|
align-items: center;
|
|
1301
1301
|
justify-content: center;
|
|
1302
1302
|
width: 100%;
|
|
1303
|
-
`,
|
|
1303
|
+
`,ey=wt.div`
|
|
1304
1304
|
display: flex;
|
|
1305
1305
|
justify-content: center;
|
|
1306
1306
|
flex-grow: 1;
|
|
1307
|
-
`;import{Fragment as
|
|
1307
|
+
`;import{Fragment as ty,jsx as Ko,jsxs as Lc}from"react/jsx-runtime";var Oc=()=>{let{navigateBack:e}=g();return Lc(ty,{children:[Ko(S,{backFn:e},"header"),Ko(R,{}),Ko(sa,{}),Ko(O,{}),Lc(J,{children:[Ko("span",{children:"Still not sure? "}),Ko("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})};import{Fragment as oy,jsx as Yo,jsxs as Mc}from"react/jsx-runtime";var Dc=()=>{let{navigateBack:e}=g();return Mc(oy,{children:[Yo(S,{backFn:e},"header"),Yo(R,{}),Yo(ia,{}),Yo(O,{}),Mc(J,{children:[Yo("span",{children:"Still not sure? "}),Yo("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})};import{Fragment as ry,jsx as Jo,jsxs as Uc}from"react/jsx-runtime";var Fc=()=>{let{navigateBack:e}=g();return Uc(ry,{children:[Jo(S,{backFn:e},"header"),Jo(R,{}),Jo(aa,{}),Jo(O,{}),Uc(J,{children:[Jo("span",{children:"Still not sure? "}),Jo("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})};import{useState as by}from"react";import{isMobile as $c}from"react-device-detect";import Qo from"styled-components";import{EnvelopeIcon as ny}from"@heroicons/react/24/outline";import{useEffect as da,useState as pa}from"react";import ma from"styled-components";import{Fragment as ly,jsx as wo,jsxs as ua}from"react/jsx-runtime";var Ln=e=>{let[t,o]=pa(""),[r,n]=pa(!1),[i,a]=pa(null),{isLinking:l,initLoginWithEmail:s,captchaData:c}=_(),{app:w,navigate:m}=g(),b=w?.loginMethods.wallet??!1;da(()=>{document.querySelector("#email-input")?.focus()},[]);let h=_s(t),C=()=>{n(!0),s(t,c.token).then(()=>{c.enabled&&c.remove(),m("AWAITING_PASSWORDLESS_CODE")}).catch(T=>{T?.status===422?a(T.message):T?.privyErrorCode==="allowlist_rejected"?m("ALLOWLIST_REJECTION_SCREEN"):(console.error(T),a("Issue submitting email")),n(!1)})},E="Get started without a wallet.";i?E=i:l?E="\u200B":b||(E="Get started quickly with email");let y=c.enabled&&!c.token&&!c.error,P=c.error!==void 0;return da(()=>{c.error&&a("Issue verifying you are a human")},[c.error]),da(()=>{c.ready&&c.execute()},[c.ready]),ua(ly,{children:[ua(iy,{stacked:e.stacked,children:[ua(ay,{standalone:e.stacked,children:[wo(ny,{}),wo("input",{id:"email-input",type:"email",placeholder:"your@email.com",onChange:T=>o(T.target.value),onKeyUp:T=>{T.key==="Enter"&&C()},value:t,autoComplete:"email"})]}),e.stacked?null:wo(un,{disabled:r||!h||y||P,onClick:C,children:r||y?wo(zt,{}):"Submit"})]}),c.enabled&&wo("div",{id:"cf-turnstile"}),wo(sy,{fail:!!i,children:E}),e.stacked?wo(K,{loading:r||y,loadingText:null,disabled:r||!h||y||P,onClick:C,children:"Submit"}):null]})},iy=ma.div`
|
|
1308
1308
|
width: 100%;
|
|
1309
1309
|
height: ${e=>e.stacked?"100%":"auto"};
|
|
1310
1310
|
|
|
@@ -1316,7 +1316,7 @@ Resources:
|
|
|
1316
1316
|
@media (max-width: 440px) {
|
|
1317
1317
|
margin-top: 20px;
|
|
1318
1318
|
}
|
|
1319
|
-
`,
|
|
1319
|
+
`,ay=ma.label`
|
|
1320
1320
|
display: flex;
|
|
1321
1321
|
flex-direction: row;
|
|
1322
1322
|
align-items: center;
|
|
@@ -1353,7 +1353,7 @@ Resources:
|
|
|
1353
1353
|
line-height: 24px;
|
|
1354
1354
|
}
|
|
1355
1355
|
}
|
|
1356
|
-
`,
|
|
1356
|
+
`,sy=ma.div`
|
|
1357
1357
|
line-height: 20px;
|
|
1358
1358
|
height: 20px;
|
|
1359
1359
|
font-size: 13px;
|
|
@@ -1366,7 +1366,7 @@ Resources:
|
|
|
1366
1366
|
> a {
|
|
1367
1367
|
text-decoration: underline;
|
|
1368
1368
|
}
|
|
1369
|
-
`;import{PhoneIcon as
|
|
1369
|
+
`;import{PhoneIcon as cy}from"@heroicons/react/24/outline";import{useEffect as ha,useState as fa}from"react";import ga from"styled-components";import{Fragment as my,jsx as Co,jsxs as ya}from"react/jsx-runtime";var On=e=>{let[t,o]=fa(""),[r,n]=fa(!1),[i,a]=fa(null),{isLinking:l,initLoginWithSms:s,captchaData:c}=_(),{app:w,navigate:m}=g(),b=w?.loginMethods.wallet??!1;ha(()=>{document.querySelector("#phone-number-input")?.focus()},[]);let h=Ss(t),C=()=>{n(!0),s(t,c.token).then(()=>{c.enabled&&c.remove(),m("AWAITING_PASSWORDLESS_CODE")}).catch(T=>{T?.status===422?a(T.message):T?.privyErrorCode==="allowlist_rejected"?m("ALLOWLIST_REJECTION_SCREEN"):(console.error(T),a("Issue submitting phone number")),n(!1)})},E="Get started without a wallet.";i?E=i:l?E="\u200B":b||(E="Get started quickly with your phone");let y=c.enabled&&!c.token&&!c.error,P=c.error!==void 0;return ha(()=>{c.error&&a("Issue verifying you are a human")},[c.error]),ha(()=>{c.ready&&c.execute()},[c.ready]),ya(my,{children:[ya(dy,{stacked:e.stacked,children:[ya(py,{standalone:e.stacked,children:[Co(cy,{}),Co("input",{id:"phone-number-input",type:"tel",placeholder:"555 555 5555",onChange:T=>{o(T.target.value)},onKeyUp:T=>{T.key==="Enter"&&C()},value:t,autoComplete:"tel"})]}),e.stacked?null:Co(un,{disabled:r||!h||y||P,onClick:C,children:r||y?Co(zt,{}):"Submit"})]}),c.enabled&&Co("div",{id:"cf-turnstile"}),Co(uy,{fail:!!i,children:E}),e.stacked?Co(K,{loading:r||y,loadingText:null,disabled:r||!h||y||P,onClick:C,children:"Submit"}):null]})},dy=ga.div`
|
|
1370
1370
|
display: flex;
|
|
1371
1371
|
border: 1px solid var(--privy-color-foreground-4);
|
|
1372
1372
|
width: 100%;
|
|
@@ -1380,7 +1380,7 @@ Resources:
|
|
|
1380
1380
|
@media (max-width: 440px) {
|
|
1381
1381
|
margin-top: 20px;
|
|
1382
1382
|
}
|
|
1383
|
-
`,
|
|
1383
|
+
`,py=ga.label`
|
|
1384
1384
|
display: flex;
|
|
1385
1385
|
flex-direction: row;
|
|
1386
1386
|
align-items: center;
|
|
@@ -1417,7 +1417,7 @@ Resources:
|
|
|
1417
1417
|
line-height: 24px;
|
|
1418
1418
|
}
|
|
1419
1419
|
}
|
|
1420
|
-
`,
|
|
1420
|
+
`,uy=ga.div`
|
|
1421
1421
|
line-height: 20px;
|
|
1422
1422
|
height: 20px;
|
|
1423
1423
|
font-size: 13px;
|
|
@@ -1430,12 +1430,12 @@ Resources:
|
|
|
1430
1430
|
> a {
|
|
1431
1431
|
text-decoration: underline;
|
|
1432
1432
|
}
|
|
1433
|
-
`;import{useState as fy}from"react";import Hc from"styled-components";import{jsx as Uc,jsxs as uy}from"react/jsx-runtime";var Mn=({style:e,...t})=>uy("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...e},...t,children:[Uc("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),Uc("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});import{jsx as Er,jsxs as my}from"react/jsx-runtime";var Dn=({style:e,...t})=>my("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...e},...t,children:[Er("g",{clipPath:"url(#clip0)",children:Er("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),Er("defs",{children:Er("clipPath",{id:"clip0",children:Er("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Fc}from"react/jsx-runtime";var Un=({style:e,...t})=>Fc("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...t,children:Fc("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"currentColor"})});import{jsx as Fn,jsxs as hy}from"react/jsx-runtime";var Bn=({style:e,...t})=>hy("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[Fn("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),Fn("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),Fn("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),Fn("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});import{jsx as Hn}from"react/jsx-runtime";function Gn({style:e,...t}){return Hn("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:Hn("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:Hn("g",{transform:"scale(5.12,5.12)",children:Hn("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}import{jsx as Bc}from"react/jsx-runtime";var zn=({style:e,...t})=>Bc("svg",{width:"24",height:"20",viewBox:"0 0 24 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:Bc("path",{d:"M7.54311 19.7551C16.5973 19.7551 21.5516 12.2467 21.5516 5.74656C21.5516 5.53533 21.5516 5.32409 21.542 5.11286C22.5021 4.42156 23.3375 3.54783 24 2.55888C23.1166 2.95254 22.1661 3.21178 21.1675 3.3366C22.1853 2.73171 22.963 1.76196 23.3375 0.609788C22.3869 1.17627 21.3308 1.57953 20.2074 1.80037C19.3049 0.840223 18.0279 0.244934 16.6165 0.244934C13.8993 0.244934 11.6909 2.45326 11.6909 5.17047C11.6909 5.55453 11.7389 5.92898 11.8157 6.29384C7.72554 6.09221 4.09619 4.12391 1.66703 1.14747C1.24457 1.87718 1.00453 2.72211 1.00453 3.62464C1.00453 5.3337 1.87826 6.84112 3.19366 7.72445C2.38714 7.69565 1.62862 7.47481 0.966125 7.10996C0.966125 7.12916 0.966125 7.14837 0.966125 7.17717C0.966125 9.55833 2.66558 11.5554 4.91232 12.0067C4.49945 12.1219 4.06739 12.1795 3.61612 12.1795C3.29927 12.1795 2.99203 12.1507 2.69438 12.0931C3.31848 14.0518 5.14275 15.4728 7.29347 15.5112C5.60362 16.8362 3.4817 17.6235 1.17736 17.6235C0.783698 17.6235 0.390039 17.6043 0.00598145 17.5563C2.17591 18.9389 4.76829 19.7551 7.54311 19.7551Z",fill:"#1da1f2"})});import{jsx as Ke,jsxs as gy}from"react/jsx-runtime";var Gc=({showGoogle:e,showTwitter:t,showDiscord:o,showGithub:r,showLinkedIn:n,showApple:a})=>{let[i,l]=fy(!1),{initLoginWithOAuth:s}=P(),{app:c}=g(),v=c?.appearance.palette.colorScheme;return gy(yy,{children:[e&&Ke(Jo,{onClick:()=>{l(!0),s("google")},disabled:i,children:Ke(Bn,{})}),t&&Ke(Jo,{onClick:()=>{l(!0),s("twitter")},disabled:i,children:Ke(zn,{})}),o&&Ke(Jo,{onClick:()=>{l(!0),s("discord")},disabled:i,children:Ke(Dn,{})}),r&&Ke(Jo,{onClick:()=>{l(!0),s("github")},disabled:i,children:Ke(Un,{style:{color:v==="light"?"#000":"#fff"}})}),n&&Ke(Jo,{onClick:()=>{l(!0),s("linkedin")},disabled:i,children:Ke(Gn,{})}),a&&Ke(Jo,{onClick:()=>{l(!0),s("apple")},disabled:i,children:Ke(Mn,{style:{color:v==="light"?"#000":"#fff"}})})]})},yy=Hc.div`
|
|
1433
|
+
`;import{useState as vy}from"react";import zc from"styled-components";import{jsx as Bc,jsxs as hy}from"react/jsx-runtime";var Mn=({style:e,...t})=>hy("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...e},...t,children:[Bc("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),Bc("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});import{jsx as Er,jsxs as fy}from"react/jsx-runtime";var Dn=({style:e,...t})=>fy("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...e},...t,children:[Er("g",{clipPath:"url(#clip0)",children:Er("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),Er("defs",{children:Er("clipPath",{id:"clip0",children:Er("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Hc}from"react/jsx-runtime";var Un=({style:e,...t})=>Hc("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...t,children:Hc("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"currentColor"})});import{jsx as Fn,jsxs as yy}from"react/jsx-runtime";var Bn=({style:e,...t})=>yy("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[Fn("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),Fn("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),Fn("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),Fn("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});import{jsx as Hn}from"react/jsx-runtime";function Gn({style:e,...t}){return Hn("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:Hn("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:Hn("g",{transform:"scale(5.12,5.12)",children:Hn("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}import{jsx as va,jsxs as gy}from"react/jsx-runtime";function zn(e){return gy("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...e,children:[va("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),va("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),va("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"currentColor"})]})}import{jsx as Gc}from"react/jsx-runtime";var Vn=({style:e,...t})=>Gc("svg",{width:"24",height:"20",viewBox:"0 0 24 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:Gc("path",{d:"M7.54311 19.7551C16.5973 19.7551 21.5516 12.2467 21.5516 5.74656C21.5516 5.53533 21.5516 5.32409 21.542 5.11286C22.5021 4.42156 23.3375 3.54783 24 2.55888C23.1166 2.95254 22.1661 3.21178 21.1675 3.3366C22.1853 2.73171 22.963 1.76196 23.3375 0.609788C22.3869 1.17627 21.3308 1.57953 20.2074 1.80037C19.3049 0.840223 18.0279 0.244934 16.6165 0.244934C13.8993 0.244934 11.6909 2.45326 11.6909 5.17047C11.6909 5.55453 11.7389 5.92898 11.8157 6.29384C7.72554 6.09221 4.09619 4.12391 1.66703 1.14747C1.24457 1.87718 1.00453 2.72211 1.00453 3.62464C1.00453 5.3337 1.87826 6.84112 3.19366 7.72445C2.38714 7.69565 1.62862 7.47481 0.966125 7.10996C0.966125 7.12916 0.966125 7.14837 0.966125 7.17717C0.966125 9.55833 2.66558 11.5554 4.91232 12.0067C4.49945 12.1219 4.06739 12.1795 3.61612 12.1795C3.29927 12.1795 2.99203 12.1507 2.69438 12.0931C3.31848 14.0518 5.14275 15.4728 7.29347 15.5112C5.60362 16.8362 3.4817 17.6235 1.17736 17.6235C0.783698 17.6235 0.390039 17.6043 0.00598145 17.5563C2.17591 18.9389 4.76829 19.7551 7.54311 19.7551Z",fill:"#1da1f2"})});import{jsx as Ie,jsxs as Cy}from"react/jsx-runtime";var Vc=({showGoogle:e,showTwitter:t,showDiscord:o,showGithub:r,showTiktok:n,showLinkedIn:i,showApple:a})=>{let[l,s]=vy(!1),{initLoginWithOAuth:c}=_(),{app:w}=g(),m=w?.appearance.palette.colorScheme;return Cy(wy,{children:[e&&Ie(bo,{onClick:()=>{s(!0),c("google")},disabled:l,children:Ie(Bn,{})}),t&&Ie(bo,{onClick:()=>{s(!0),c("twitter")},disabled:l,children:Ie(Vn,{})}),o&&Ie(bo,{onClick:()=>{s(!0),c("discord")},disabled:l,children:Ie(Dn,{})}),r&&Ie(bo,{onClick:()=>{s(!0),c("github")},disabled:l,children:Ie(Un,{style:{color:m==="light"?"#000":"#fff"}})}),n&&Ie(bo,{onClick:()=>{s(!0),c("tiktok")},disabled:l,children:Ie(zn,{style:{color:m==="light"?"#000":"#fff"}})}),i&&Ie(bo,{onClick:()=>{s(!0),c("linkedin")},disabled:l,children:Ie(Gn,{})}),a&&Ie(bo,{onClick:()=>{s(!0),c("apple")},disabled:l,children:Ie(Mn,{style:{color:m==="light"?"#000":"#fff"}})})]})},wy=zc.div`
|
|
1434
1434
|
display: flex;
|
|
1435
1435
|
justify-content: space-between;
|
|
1436
1436
|
width: 100%;
|
|
1437
1437
|
gap: 4px;
|
|
1438
|
-
`,
|
|
1438
|
+
`,bo=zc.button`
|
|
1439
1439
|
&& {
|
|
1440
1440
|
border-radius: var(--privy-border-radius-sm);
|
|
1441
1441
|
cursor: pointer;
|
|
@@ -1457,13 +1457,13 @@ Resources:
|
|
|
1457
1457
|
background-color: var(--privy-color-background-2);
|
|
1458
1458
|
}
|
|
1459
1459
|
}
|
|
1460
|
-
`;import{Fragment as
|
|
1460
|
+
`;import{Fragment as wa,jsx as re,jsxs as Eo}from"react/jsx-runtime";var jc=()=>{let{app:e,outerClickRef:t}=g(),{captchaData:o,closePrivyModal:r}=_(),n=e?.loginMethods.email??!1,i=e?.loginMethods.sms??!1,a=e?.loginMethods.wallet??!1,l=e?.loginMethods.google??!1,s=e?.loginMethods.twitter??!1,c=e?.loginMethods.discord??!1,w=e?.loginMethods.github??!1,m=e?.loginMethods.tiktok??!1,b=e?.loginMethods.linkedin??!1,h=e?.loginMethods.apple??!1,C=!e?.appearance.showWalletLoginFirst,E=a&&e?.appearance.showWalletLoginFirst?0:1,[y,P]=by(E),T=y==0,W=y==1,N=a,A=n||i,I=N!==A,D=()=>{o.enabled&&o.remove(),r()};return t&&(t.current=D),Eo(wa,{children:[re(S,{onClose:D},"header"),e?.appearance.logo?re(_y,{hasOnlyOneSection:I,hasTerms:!!(e?.legal.privacyPolicyUrl||e?.legal.termsAndConditionsUrl),children:re(gn,{})}):null,Eo(Sy,{reverse:C,children:[N&&re(Ey,{active:T||I,connectOnly:!1,tabIndex:C?1:0,onClick:()=>{o.enabled&&o.remove(),P(0)},isOnlySection:!A}),A&&re(xy,{active:W||I,onClick:()=>P(1),email:n,sms:i,google:l,twitter:s,twitterOAuthOnMobileEnabled:e?.loginConfig.twitterOAuthOnMobileEnabled??!1,discord:c,github:w,tiktok:m,linkedin:b,apple:h,tabIndex:C?0:1,isOnlySection:!N})]}),e&&re(mn,{app:e}),re(B,{protectedByPrivy:!0})]})};function Ey(e){return Eo(Yc,{active:e.active,onClick:e.onClick,isOnlySection:e.isOnlySection,tabIndex:e.tabIndex,children:[re(Kc,{active:e.active,children:re("h4",{children:"Connect Wallet"})}),e.active&&Eo(wa,{children:[re(Yt,{connectOnly:e.connectOnly}),re(Jt,{})]})]})}function xy(e){let t=!$c||e.twitterOAuthOnMobileEnabled&&$c,o=e.google||e.discord||e.github||e.tiktok||e.linkedin||e.twitter&&t||e.apple,r=e.email?"Email":"Phone";return Eo(Yc,{active:e.active,onClick:e.onClick,isOnlySection:e.isOnlySection,tabIndex:e.tabIndex,children:[e.isOnlySection?null:re(Kc,{active:e.active,children:re("h4",{children:o?`${r} & Social`:r})}),e.active&&e.email&&re(Ln,{}),e.active&&e.sms&&!e.email&&re(On,{}),e.active&&o&&re(Ty,{google:e.google,twitter:e.twitter&&t,discord:e.discord,github:e.github,tiktok:e.tiktok,linkedin:e.linkedin,apple:e.apple})]})}function Ty(e){return Eo(wa,{children:[Eo(Py,{children:[re(qc,{}),re("p",{children:" Or "}),re(qc,{})]}),re(Vc,{showGoogle:e.google,showDiscord:e.discord,showGithub:e.github,showLinkedIn:e.linkedin,showTwitter:e.twitter,showTiktok:e.tiktok,showApple:e.apple})]})}var Kc=Qo.div`
|
|
1461
1461
|
font-weight: ${e=>e.active?600:500};
|
|
1462
1462
|
color: ${e=>e.active?"var(--privy-color-foreground)":"var(--privy-color-foreground-2)"};
|
|
1463
1463
|
display: flex;
|
|
1464
1464
|
justify-content: center;
|
|
1465
1465
|
align-items: center;
|
|
1466
|
-
`,
|
|
1466
|
+
`,Yc=Qo.div.attrs({role:"button"})`
|
|
1467
1467
|
display: flex;
|
|
1468
1468
|
flex-direction: column;
|
|
1469
1469
|
align-items: flex-start;
|
|
@@ -1489,7 +1489,7 @@ Resources:
|
|
|
1489
1489
|
}
|
|
1490
1490
|
|
|
1491
1491
|
cursor: ${e=>e.active?"inherit":"pointer"};
|
|
1492
|
-
`,
|
|
1492
|
+
`,Py=Qo.div`
|
|
1493
1493
|
display: flex;
|
|
1494
1494
|
justify-content: center;
|
|
1495
1495
|
align-items: center;
|
|
@@ -1498,13 +1498,13 @@ Resources:
|
|
|
1498
1498
|
&& > p {
|
|
1499
1499
|
color: var(--privy-color-foreground-3);
|
|
1500
1500
|
}
|
|
1501
|
-
|
|
1501
|
+
`,qc=Qo.hr`
|
|
1502
1502
|
width: 50%;
|
|
1503
1503
|
&& {
|
|
1504
1504
|
border-top: 1px solid var(--privy-color-foreground-4);
|
|
1505
1505
|
margin: 0px 8px;
|
|
1506
1506
|
}
|
|
1507
|
-
`,
|
|
1507
|
+
`,_y=Qo.div`
|
|
1508
1508
|
display: flex;
|
|
1509
1509
|
flex-direction: column;
|
|
1510
1510
|
align-items: center;
|
|
@@ -1515,9 +1515,9 @@ Resources:
|
|
|
1515
1515
|
@media (max-width: 440px) {
|
|
1516
1516
|
padding: 10px 10px 20px;
|
|
1517
1517
|
}
|
|
1518
|
-
`,
|
|
1518
|
+
`,Sy=Qo(pe)`
|
|
1519
1519
|
flex-direction: ${e=>e.reverse?"column-reverse":"column"};
|
|
1520
|
-
`;import{EnvelopeIcon as
|
|
1520
|
+
`;import{EnvelopeIcon as Ay}from"@heroicons/react/24/outline";import{Fragment as ky,jsx as Zt,jsxs as Ry}from"react/jsx-runtime";var Jc=()=>{let{app:e}=g();return Ry(ky,{children:[Zt(S,{},"header"),Zt(R,{}),Zt(Ee,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:Zt(Ay,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Zt(pe,{children:Zt(Ln,{stacked:!0})}),Zt(O,{}),Zt(B,{protectedByPrivy:!0})]})};import{PhoneIcon as Iy}from"@heroicons/react/24/outline";import{Fragment as Wy,jsx as Xt,jsxs as Ny}from"react/jsx-runtime";var Qc=()=>{let{app:e}=g();return Ny(Wy,{children:[Xt(S,{},"header"),Xt(R,{}),Xt(Ee,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:Xt(Iy,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),Xt(pe,{children:Xt(On,{stacked:!0})}),Xt(O,{}),Xt(B,{protectedByPrivy:!0})]})};import{Fragment as Ly,jsx as xo,jsxs as Zc}from"react/jsx-runtime";var Xc=()=>{let{linkingHint:e}=_(),{app:t}=g(),o=e?`Select the wallet with ${Bt(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return Zc(Ly,{children:[xo(S,{},"header"),xo(R,{}),xo(jt,{title:`${e?"Reconnect":"Connect"} your wallet`,description:o}),Zc(pe,{children:[xo(Yt,{connectOnly:!1}),xo(Jt,{})]}),xo(O,{}),xo(B,{protectedByPrivy:!0})]})};import{jsx as ed,jsxs as Oy}from"react/jsx-runtime";var td=({style:e,...t})=>Oy("svg",{width:"164",height:"164",viewBox:"0 0 164 164",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[ed("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),ed("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]});import{Fragment as My,jsx as eo,jsxs as od}from"react/jsx-runtime";var rd=()=>{let{closePrivyModal:e}=_(),{navigate:t}=g();return od(My,{children:[eo(S,{},"header"),eo(R,{}),eo(td,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),eo(jt,{title:"Could not connect with wallet",description:"Please check that Phantom multichain is enabled and try again.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),od(pe,{children:[eo(K,{onClick:()=>t("LANDING"),children:"Try again"}),eo(nl,{onClick:()=>e(),children:"Cancel"})]}),eo(O,{}),eo(B,{protectedByPrivy:!0})]})};import{useEffect as nd,useState as id}from"react";import sd from"styled-components";function Ca(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{Fragment as Fy,jsx as Nt,jsxs as qn}from"react/jsx-runtime";var ad={google:{name:"Google",component:Bn},discord:{name:"Discord",component:Dn},github:{name:"Github",component:Un},linkedin:{name:"LinkedIn",component:Gn},twitter:{name:"Twitter",component:Vn},tiktok:{name:"Tiktok",component:zn},apple:{name:"Apple",component:Mn}},$n=()=>{let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),window.history.pushState({},"",e)},ld=()=>{let{user:e,authenticated:t}=$(),{app:o,setModalData:r,navigate:n,resetNavigation:i,data:a}=g(),{getAuthMeta:l,initLoginWithOAuth:s,loginWithOAuth:c,updateWallets:w,closePrivyModal:m}=_(),[b,h]=id(!1),[C,E]=id(void 0),y=l()?.provider||"google",P=ad[y].name,T=ad[y].component,W=o?.render.inDialog?Ze:0;nd(()=>{c().then(()=>{$n(),h(!0)}).catch(I=>{let D={retryable:!1,message:"Authentication failed"};if(I?.privyErrorCode==="allowlist_rejected"){E(void 0),i(),n("ALLOWLIST_REJECTION_SCREEN"),$n();return}else I?.privyErrorCode==="linked_to_another_user"?D.detail="This account has already been linked to another user.":I?.privyErrorCode==="invalid_credentials"?(D.retryable=!0,D.detail="Something went wrong. Try again."):I.privyErrorCode==="oauth_user_denied"&&(D.detail=`Retry and check ${Ca(y)} to finish connecting your account.`,D.retryable=!0);$n(),E(D)}).finally(()=>{a?.finishOauthFlow?.onComplete?.()})},[]),nd(()=>{if(t&&b&&e)if(Ft(e,o?.embeddedWallets?.createOnLogin)){let D=setTimeout(()=>{r({createWallet:{onSuccess:()=>{},onFailure:ce=>console.error(ce),callAuthOnSuccessOnClose:!0}}),n("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},W);return()=>clearTimeout(D)}else{let D=setTimeout(m,W);return w(),()=>clearTimeout(D)}},[t,b,e]);let N=b?`Successfully connected with ${P}`:C?C.message:`Verifying connection to ${P}`,A="";return b?A="You\u2019re good to go!":C?A=C.detail:A="Just a few moments more",qn(Fy,{children:[Nt(S,{}),Nt(R,{}),qn(Dy,{children:[Nt(Uy,{children:qn("div",{children:[Nt(sn,{success:b,fail:!!C}),Nt(T,{style:{width:"38px",height:"38px"}})]})}),qn(qt,{children:[Nt("h3",{children:N}),Nt("p",{children:A})]}),C&&C?.retryable?Nt(fe,{onClick:()=>{$n(),s(y),E(void 0)},disabled:!b&&!C?.retryable,children:"Retry"}):null]}),Nt(J,{})]})},Dy=sd.div`
|
|
1521
1521
|
display: flex;
|
|
1522
1522
|
flex-direction: column;
|
|
1523
1523
|
align-items: center;
|
|
@@ -1525,7 +1525,7 @@ Resources:
|
|
|
1525
1525
|
margin-left: 27px;
|
|
1526
1526
|
margin-right: 27px;
|
|
1527
1527
|
gap: 24px;
|
|
1528
|
-
`,
|
|
1528
|
+
`,Uy=sd.div`
|
|
1529
1529
|
display: flex;
|
|
1530
1530
|
flex-direction: column;
|
|
1531
1531
|
justify-content: center;
|
|
@@ -1548,9 +1548,9 @@ Resources:
|
|
|
1548
1548
|
left: -19px;
|
|
1549
1549
|
top: -19px;
|
|
1550
1550
|
}
|
|
1551
|
-
`;import{useEffect as
|
|
1551
|
+
`;import{useEffect as Hy,useState as dd}from"react";import Gy from"styled-components";import{isMobile as By}from"react-device-detect";var cd=(e,t)=>{let o=new URL(window.location.href),r=encodeURIComponent(o.href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=injected&privy_wallet_client=phantom`);if(!Ve()&&By)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${r}?ref=${r}`};import{Fragment as Vy,jsx as Lt,jsxs as pd}from"react/jsx-runtime";var ud=()=>{let{forkSession:e,ready:t,authenticated:o}=$(),[r,n]=dd(""),[i,a]=dd(!1);Hy(()=>{t&&o&&e().then(n)},[t,o]);let l=cd(r,!i),s={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return t&&(s.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",s.footnote="Once you're done, you can always return here and refresh to view your updated account."),i&&(s.title="Still here?",s.description="You may need to install the Phantom mobile app.",s.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),pd(Vy,{children:[Lt(S,{},"header"),Lt(R,{}),Lt(jt,{title:s.title,description:s.description}),pd(pe,{children:[Lt(zy,{children:Lt($e,{style:{width:"72px",height:"72px"}})}),Lt(dn,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?Lt("p",{children:s.footnote}):null]}),Lt(O,{}),Lt(B,{protectedByPrivy:!0})]})},zy=Gy(Ri)`
|
|
1552
1552
|
margin: 16px auto;
|
|
1553
|
-
`;import{StaticJsonRpcProvider as
|
|
1553
|
+
`;import{StaticJsonRpcProvider as zg}from"@ethersproject/providers";import{useMemo as Yd,useEffect as Jd,useState as _o}from"react";import or from"styled-components";import Ld from"styled-components";import hd from"styled-components";import{jsx as md,jsxs as jy}from"react/jsx-runtime";var jn=({label:e,children:t,valueStyles:o})=>jy($y,{children:[md("div",{children:e}),md(qy,{style:{...o},children:t})]}),$y=hd.div`
|
|
1554
1554
|
display: flex;
|
|
1555
1555
|
align-items: center;
|
|
1556
1556
|
justify-content: space-between;
|
|
@@ -1565,7 +1565,7 @@ Resources:
|
|
|
1565
1565
|
color: var(--privy-color-foreground-2);
|
|
1566
1566
|
text-align: right;
|
|
1567
1567
|
}
|
|
1568
|
-
`,
|
|
1568
|
+
`,qy=hd.div`
|
|
1569
1569
|
font-size: 14px;
|
|
1570
1570
|
line-height: 100%;
|
|
1571
1571
|
display: flex;
|
|
@@ -1574,28 +1574,28 @@ Resources:
|
|
|
1574
1574
|
border-radius: var(--privy-border-radius-full);
|
|
1575
1575
|
background-color: var(--privy-color-background-2);
|
|
1576
1576
|
padding: 4px 8px;
|
|
1577
|
-
`;import{BigNumber as
|
|
1577
|
+
`;import{BigNumber as vd}from"@ethersproject/bignumber";import Kn from"styled-components";import{BigNumber as Ky}from"@ethersproject/bignumber";import{formatEther as fd}from"@ethersproject/units";var xr=(e,t)=>(t*parseFloat(fd(e))).toFixed(2),To=(e,t=6)=>parseFloat(fd(e)).toFixed(t).replace(/0+$/,"").replace(/\.$/,""),yd=(e,t)=>{let{chains:o}=_(),r=`https://etherscan.io/address/${t}`,n=`${Is(e,o)}/address/${t}`;if(!n)return r;try{new URL(n)}catch{return r}return n},We=e=>Ky.from(e);import{jsx as ba,jsxs as gd}from"react/jsx-runtime";var wd=({weiQuantities:e,tokenPrice:t})=>{let o=e.map(We).reduce((n,i)=>n.add(i),vd.from(0)),r=xr(o.toHexString(),t);return ba(Cd,{children:r==="0.00"?"<$0.01":`$${r}`})},Ea=({weiQuantities:e,tokenPrice:t})=>{let o=e.map(We).reduce((n,i)=>n.add(i),vd.from(0)),r=xr(o.toHexString(),t);return gd(Cd,{children:[ba(Yy,{children:"USD"}),r==="0.00"?gd(Qy,{children:[ba(Jy,{children:"<"}),"$0.01"]}):`$${r}`]})},Cd=Kn.span`
|
|
1578
1578
|
font-size: 14px;
|
|
1579
1579
|
line-height: 140%;
|
|
1580
1580
|
display: flex;
|
|
1581
1581
|
gap: 4px;
|
|
1582
1582
|
align-items: center;
|
|
1583
|
-
`,
|
|
1583
|
+
`,Yy=Kn.span`
|
|
1584
1584
|
font-size: 12px;
|
|
1585
1585
|
line-height: 12px;
|
|
1586
1586
|
color: var(--privy-color-foreground-3);
|
|
1587
|
-
`,
|
|
1587
|
+
`,Jy=Kn.span`
|
|
1588
1588
|
font-size: 10px;
|
|
1589
|
-
`,
|
|
1589
|
+
`,Qy=Kn.span`
|
|
1590
1590
|
display: flex;
|
|
1591
1591
|
align-items: center;
|
|
1592
|
-
`;import
|
|
1592
|
+
`;import xa from"styled-components";import{jsx as to,jsxs as Yn}from"react/jsx-runtime";var bd=({transactionData:e,gas:t,tokenPrice:o})=>{let{nativeTokenSymbolForChainId:r}=_(),n=r(e.chainId)||"ETH";return Yn(Ii,{style:{paddingBottom:"12px"},children:[Yn(xd,{children:[to(Pd,{children:"Est. Fees"}),to("div",{children:to(Ea,{weiQuantities:[t],tokenPrice:o})})]}),to(Td,{children:`${To(We(t).toHexString())} ${n}`})]})},Ed=({transactionData:e,gas:t,tokenPrice:o})=>{let{nativeTokenSymbolForChainId:r}=_(),n=r(e.chainId)||"ETH";return Yn(Ii,{children:[Yn(xd,{children:[to(Pd,{children:"Total (including fees)"}),to("div",{children:to(Ea,{weiQuantities:[e.value||0,t],tokenPrice:o})})]}),to(Td,{children:e.value?`${To(We(e.value).add(We(t)).toHexString())} ${n}`:null})]})},xd=xa.div`
|
|
1593
1593
|
display: flex;
|
|
1594
1594
|
flex-direction: row;
|
|
1595
1595
|
justify-content: space-between;
|
|
1596
1596
|
align-items: center;
|
|
1597
1597
|
padding-top: 4px;
|
|
1598
|
-
`,
|
|
1598
|
+
`,Td=xa.div`
|
|
1599
1599
|
display: flex;
|
|
1600
1600
|
flex-direction: row;
|
|
1601
1601
|
height: 12px;
|
|
@@ -1604,23 +1604,23 @@ Resources:
|
|
|
1604
1604
|
line-height: 12px;
|
|
1605
1605
|
color: var(--privy-color-foreground-3);
|
|
1606
1606
|
font-weight: 400;
|
|
1607
|
-
`,
|
|
1607
|
+
`,Pd=xa.div`
|
|
1608
1608
|
font-size: 14px;
|
|
1609
1609
|
line-height: 22.4px;
|
|
1610
1610
|
font-weight: 400;
|
|
1611
|
-
`;import{ChevronDownIcon as
|
|
1611
|
+
`;import{ChevronDownIcon as Zy}from"@heroicons/react/24/outline";import{useContext as Po,useState as Xy}from"react";import oo from"styled-components";import{createContext as _d,useContext as d8}from"react";var Zo=_d(void 0);var Tr=_d(void 0);import{Fragment as sg,jsx as rt,jsxs as Sd}from"react/jsx-runtime";var Ad=({defaultValue:e,children:t})=>{let[o,r]=Xy(e||null),n=i=>{r(o===i?null:i)};return rt(Zo.Provider,{value:{activePanel:o,togglePanel:n},children:rt(eg,{children:t})})},kd=({value:e,children:t})=>{let{activePanel:o,togglePanel:r}=Po(Zo),n=o===e;return rt(Tr.Provider,{value:{onToggle:()=>r(e),value:e},children:rt(ng,{isActive:n,"data-open":n,children:t})})},Rd=({children:e})=>{let{activePanel:t}=Po(Zo),{onToggle:o,value:r}=Po(Tr),n=t===r;return Sd(sg,{children:[Sd(tg,{onClick:o,"data-open":n,children:[rt(rg,{children:e}),rt(ag,{isactive:n,children:rt(Zy,{height:"16px",width:"16px",strokeWidth:"2"})})]}),rt(og,{})]})},Id=({children:e})=>{let{activePanel:t}=Po(Zo),{value:o}=Po(Tr);return rt(ig,{"data-open":t===o,children:rt(Nd,{children:e})})},Wd=({children:e})=>{let{activePanel:t}=Po(Zo),{value:o}=Po(Tr);return rt(Nd,{children:typeof e=="function"?e({isActive:t===o}):e})},eg=oo.div`
|
|
1612
1612
|
display: flex;
|
|
1613
1613
|
flex-direction: column;
|
|
1614
1614
|
width: 100%;
|
|
1615
1615
|
gap: 8px;
|
|
1616
|
-
`,
|
|
1616
|
+
`,tg=oo.div`
|
|
1617
1617
|
display: flex;
|
|
1618
1618
|
justify-content: space-between;
|
|
1619
1619
|
align-items: center;
|
|
1620
1620
|
width: 100%;
|
|
1621
1621
|
cursor: pointer;
|
|
1622
1622
|
padding-bottom: 8px;
|
|
1623
|
-
`,
|
|
1623
|
+
`,og=oo.div`
|
|
1624
1624
|
width: 100%;
|
|
1625
1625
|
|
|
1626
1626
|
&& {
|
|
@@ -1628,13 +1628,13 @@ Resources:
|
|
|
1628
1628
|
border-color: var(--privy-color-foreground-4);
|
|
1629
1629
|
}
|
|
1630
1630
|
padding-bottom: 12px;
|
|
1631
|
-
`,
|
|
1631
|
+
`,rg=oo.div`
|
|
1632
1632
|
font-size: 14px;
|
|
1633
1633
|
font-weight: 500;
|
|
1634
1634
|
line-height: 19.6px;
|
|
1635
1635
|
width: 100%;
|
|
1636
1636
|
padding-right: 8px;
|
|
1637
|
-
`,
|
|
1637
|
+
`,ng=oo.div`
|
|
1638
1638
|
display: flex;
|
|
1639
1639
|
flex-direction: column;
|
|
1640
1640
|
width: 100%;
|
|
@@ -1646,7 +1646,7 @@ Resources:
|
|
|
1646
1646
|
border-color: var(--privy-color-foreground-4);
|
|
1647
1647
|
border-radius: var(--privy-border-radius-md);
|
|
1648
1648
|
}
|
|
1649
|
-
`,
|
|
1649
|
+
`,ig=oo.div`
|
|
1650
1650
|
position: relative;
|
|
1651
1651
|
overflow: hidden;
|
|
1652
1652
|
transition: max-height 0.35s ease-in-out;
|
|
@@ -1658,36 +1658,36 @@ Resources:
|
|
|
1658
1658
|
&[data-open='false'] {
|
|
1659
1659
|
max-height: 0;
|
|
1660
1660
|
}
|
|
1661
|
-
`,
|
|
1661
|
+
`,Nd=oo.div`
|
|
1662
1662
|
display: flex;
|
|
1663
1663
|
flex-direction: column;
|
|
1664
1664
|
gap: 12px;
|
|
1665
1665
|
flex: 1 1 auto;
|
|
1666
1666
|
min-height: 1px;
|
|
1667
|
-
`,
|
|
1667
|
+
`,ag=oo.div`
|
|
1668
1668
|
transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
|
|
1669
|
-
`;import
|
|
1669
|
+
`;import lg from"styled-components";import{jsx as dg}from"react/jsx-runtime";var Ta=({walletAddress:e,chainId:t=st})=>dg(cg,{href:yd(t,e),target:"_blank",children:Bt(e)}),cg=lg.a`
|
|
1670
1670
|
&:hover {
|
|
1671
1671
|
text-decoration: underline;
|
|
1672
1672
|
}
|
|
1673
|
-
`;import{Fragment as
|
|
1673
|
+
`;import{Fragment as mg,jsx as Ne,jsxs as Pa}from"react/jsx-runtime";var Jn=({from:e,to:t,txn:o,transactionInfo:r,tokenPrice:n,gas:i})=>{let a=o?.value||0;return Ne(Ad,{children:Pa(kd,{value:"details",children:[Ne(Rd,{children:Pa(pg,{children:[Ne("div",{children:r?.title||r?.actionDescription||"Details"}),n?Ne(ug,{children:Ne(wd,{weiQuantities:[a],tokenPrice:n})}):null]})}),Pa(Id,{children:[Ne(jn,{label:"From",children:Ne(Ta,{walletAddress:e,chainId:o.chainId||st})}),Ne(jn,{label:"To",children:Ne(Ta,{walletAddress:t,chainId:o.chainId||st})}),r&&r.action&&Ne(jn,{label:"Action",children:r.action}),i&&n?Ne(bd,{transactionData:o,gas:i,tokenPrice:n}):null]}),Ne(Wd,{children:({isActive:l})=>Ne(mg,{children:n&&Ne(Ed,{transactionData:o,displayFee:l,gas:i||"0x0",tokenPrice:n})})})]})})},pg=Ld.div`
|
|
1674
1674
|
display: flex;
|
|
1675
1675
|
flex-direction: row;
|
|
1676
1676
|
justify-content: space-between;
|
|
1677
|
-
`,
|
|
1677
|
+
`,ug=Ld.div`
|
|
1678
1678
|
flex-shrink: 0;
|
|
1679
1679
|
padding-left: 8px;
|
|
1680
|
-
`;import _r from"styled-components";import{jsx as Pr,jsxs as
|
|
1680
|
+
`;import _r from"styled-components";import{jsx as Pr,jsxs as wg}from"react/jsx-runtime";var _a=({description:e,contractInfo:t})=>wg(hg,{children:[t.imgUrl&&Pr(fg,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&Pr(yg,{children:Pr("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&Pr(gg,{children:t.name}),Pr(vg,{children:e||t.actionText})]}),hg=_r.div`
|
|
1681
1681
|
display: flex;
|
|
1682
1682
|
flex-direction: column;
|
|
1683
1683
|
align-items: center;
|
|
1684
1684
|
margin-bottom: 8px;
|
|
1685
|
-
`,
|
|
1685
|
+
`,fg=_r.img`
|
|
1686
1686
|
height: ${e=>e.size==="sm"?"65px":"140px"};
|
|
1687
1687
|
width: ${e=>e.size==="sm"?"65px":"140px"};
|
|
1688
1688
|
border-radius: 16px;
|
|
1689
1689
|
margin-bottom: 12px;
|
|
1690
|
-
`,
|
|
1690
|
+
`,yg=_r.div`
|
|
1691
1691
|
font-size: 12px;
|
|
1692
1692
|
line-height: 12px;
|
|
1693
1693
|
padding: 7px;
|
|
@@ -1700,7 +1700,7 @@ Resources:
|
|
|
1700
1700
|
text-decoration: underline;
|
|
1701
1701
|
}
|
|
1702
1702
|
}
|
|
1703
|
-
`,
|
|
1703
|
+
`,gg=_r.div`
|
|
1704
1704
|
font-size: 18px;
|
|
1705
1705
|
line-height: 18px;
|
|
1706
1706
|
font-weight: 500;
|
|
@@ -1708,7 +1708,7 @@ Resources:
|
|
|
1708
1708
|
white-space: nowrap;
|
|
1709
1709
|
max-width: 275px;
|
|
1710
1710
|
text-overflow: ellipsis;
|
|
1711
|
-
`,
|
|
1711
|
+
`,vg=_r.div`
|
|
1712
1712
|
font-size: 16px;
|
|
1713
1713
|
line-height: 140%;
|
|
1714
1714
|
font-weight: 400;
|
|
@@ -1717,7 +1717,7 @@ Resources:
|
|
|
1717
1717
|
white-space: nowrap;
|
|
1718
1718
|
max-width: 275px;
|
|
1719
1719
|
text-overflow: ellipsis;
|
|
1720
|
-
`;import{WalletIcon as
|
|
1720
|
+
`;import{WalletIcon as Sg}from"@heroicons/react/24/outline";import{useState as Aa,useEffect as Ag}from"react";import Ra from"styled-components";import{VoidSigner as Eg}from"@ethersproject/abstract-signer";import{EtherscanProvider as q8}from"@ethersproject/providers";import{parseUnits as Od}from"@ethersproject/units";import{ofetch as Cg}from"ofetch";var Sr={id:137,name:"Polygon Mainnet",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}};var Ar={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{alchemy:{http:["https://polygon-mumbai.g.alchemy.com/v2"],webSocket:["wss://polygon-mumbai.g.alchemy.com/v2"]},infura:{http:["https://polygon-mumbai.infura.io/v3"],webSocket:["wss://polygon-mumbai.infura.io/ws/v3"]},default:{http:["https://matic-mumbai.chainstacklabs.com"]},public:{http:["https://matic-mumbai.chainstacklabs.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"},default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},testnet:!0};var Md=[Sr.id,Ar.id],Sa=e=>({maxPriorityFee:Od(e.maxPriorityFee.toString(),"gwei").toHexString(),maxFee:Od(e.maxFee.toString(),"gwei").toHexString()}),bg=e=>({safeLow:Sa(e.safeLow),standard:Sa(e.standard),fast:Sa(e.fast)}),Dd=async e=>{let t="";switch(e){case Sr.id:t="https://gasstation.polygon.technology/v2";break;case Ar.id:t="https://gasstation-testnet.polygon.technology/v2";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return bg(await Cg(t))};function Xo(e){if(typeof e=="number"||typeof e=="bigint"||typeof e=="string")return e;if(typeof e.toHexString=="function")return e.toHexString();throw new Error(`Expected numeric value but received ${e}`)}function xg(e){let t={};return e.to!==void 0&&(t.to=e.to),e.data!==void 0&&(t.data=e.data),e.chainId!==void 0&&(t.chainId=e.chainId),e.type!==void 0&&(t.type=e.type),e.accessList!==void 0&&(t.accessList=e.accessList),e.nonce!==void 0&&(t.nonce=Xo(e.nonce)),e.gasLimit!==void 0&&(t.gasLimit=Xo(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=Xo(e.gasPrice)),e.value!==void 0&&(t.value=Xo(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=Xo(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=Xo(e.maxPriorityFeePerGas)),t}async function Qn(e,t,o){t.chainId=Number(t.chainId),Fd(t);let r=new Eg(e,o);if(delete t.gas,Md.includes(t.chainId)&&(!t.maxPriorityFeePerGas||!t.maxFeePerGas))try{let{standard:i}=await Dd(t.chainId);t.maxPriorityFeePerGas||(t.maxPriorityFeePerGas=i.maxPriorityFee),t.maxFeePerGas||(t.maxFeePerGas=i.maxFee)}catch{throw new Error("Unable to get current gas prices from Polygon gas station.")}let n=await r.populateTransaction(t);return xg(n)}async function Zn(e,t,o,r,n){r=Object.assign({chainId:st},r),Fd(r);let a=(await o.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[r]}})).response.data,s=await(await n.sendTransaction(a)).wait();return _g(s)}async function Xn(e,t,o){let r=await o.getBalance(e),n=t.value||0,i=r.sub(We(n)),a=!i.isNegative()&&!i.isZero();return{balance:r,hasSufficientFunds:a}}async function Ud(e,t){return delete e.from,await t.estimateGas(e)}function Fd(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let o of t){let r=e[o];if(!(typeof r>"u")&&!Tg(r))throw new Error(`Transaction request property '${o}' must be a valid number, bigint, or hex string representing a quantity`)}if(typeof e.chainId!="number")throw new Error("Transaction request property 'chainId' must be a number")}function Tg(e){let t=typeof e=="number",o=typeof e=="bigint",r=typeof e=="string"&&Pg(e);return t||o||r}function Pg(e){return/^-?0x[a-f0-9]+$/i.test(e)}function _g(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}import{jsx as Bd,jsxs as ka}from"react/jsx-runtime";var Hd=({wallet:e,txn:t,provider:o})=>{let[r,n]=Aa(),[i,a]=Aa(!1),[l,s]=Aa(!1),{nativeTokenSymbolForChainId:c}=_(),w=c(t.chainId)||"ETH";return Ag(()=>{(async b=>{try{let{balance:h,hasSufficientFunds:C}=await Xn(b,t,o);s(!0),a(C===!1),n(h.toHexString())}catch(h){console.warn(`Failed to fetch wallet balance with error: ${h}`)}})(e.address)},[e,t]),ka(kg,{children:[ka(Rg,{children:[Bd(Sg,{strokeWidth:"2",width:"16px",height:"16px"}),Bd("div",{children:Bt(e?.address)})]}),ka(Ig,{displayBalanceColor:l,hasFunds:!i,children:[r?To(r):0," ",w," available"]})]})},kg=Ra.div`
|
|
1721
1721
|
display: flex;
|
|
1722
1722
|
flex-direction: row;
|
|
1723
1723
|
justify-content: space-between;
|
|
@@ -1730,12 +1730,12 @@ Resources:
|
|
|
1730
1730
|
border: 1px solid var(--privy-color-foreground-4);
|
|
1731
1731
|
border-radius: var(--privy-border-radius-md);
|
|
1732
1732
|
}
|
|
1733
|
-
`,
|
|
1733
|
+
`,Rg=Ra.div`
|
|
1734
1734
|
display: flex;
|
|
1735
1735
|
flex-direction: row;
|
|
1736
1736
|
align-items: center;
|
|
1737
1737
|
gap: 8px;
|
|
1738
|
-
`,
|
|
1738
|
+
`,Ig=Ra.div`
|
|
1739
1739
|
display: flex;
|
|
1740
1740
|
align-items: center;
|
|
1741
1741
|
justify-content: center;
|
|
@@ -1745,25 +1745,25 @@ Resources:
|
|
|
1745
1745
|
background-color: var(--privy-color-background-2);
|
|
1746
1746
|
padding: 5px 8px;
|
|
1747
1747
|
color: ${e=>e.displayBalanceColor?e.hasFunds?"var(--privy-color-success-dark)":"var(--privy-color-error)":"inherit"};
|
|
1748
|
-
`;import
|
|
1748
|
+
`;import ti from"styled-components";import{StaticJsonRpcProvider as Wg}from"@ethersproject/providers";import{useState as kr,useEffect as Gd,useMemo as Ng}from"react";var ei=e=>{let{getUsdTokenPrice:t,chains:o,rpcConfig:r}=_(),[n,i]=kr(!1),[a,l]=kr(!1),[s,c]=kr(void 0),[w,m]=kr(void 0),[b,h]=kr(null),C=Ng(()=>new Wg(Xe(e.chainId||st,o,r)),[e.chainId,o,r]);return Gd(()=>{let E=e.chainId||st,y=o.find(T=>T.id===Number(E));if(!y)throw new U(`Unsupported chain: ${E}`);(async()=>{try{i(!0);let T=await t(y);T?m(T):c(new Error(`Unable to fetch token price on chain id ${y.id}`))}catch(T){c(T)}finally{i(!1)}})()},[e.chainId]),Gd(()=>{(async()=>{try{l(!0);let y=await Ud(e,C);h(y.toBigInt())}catch(y){c(y)}finally{l(!1)}})()},[e]),{tokenPrice:w,estimatedGas:b,isLoading:n||a,error:s}};import{jsx as zd,jsxs as Vd}from"react/jsx-runtime";var $d=e=>{let{tokenPrice:t}=ei(e.txn),{nativeTokenSymbolForChainId:o}=_(),r=o(e.txn.chainId)||"ETH",n="--",i=()=>{if(!t)return n;let l=e.txn.value||0,s=xr(We(l).toHexString(),t);return s==="0.00"?"<$0.01":`$${s}`},a=To(We(e.txn.value||0).toHexString());return Vd(Lg,{children:[zd(Og,{children:i()}),Vd(Mg,{children:[a," ",r]}),zd(Dg,{children:e.description})]})},Lg=ti.div`
|
|
1749
1749
|
display: flex;
|
|
1750
1750
|
flex-direction: column;
|
|
1751
1751
|
align-items: center;
|
|
1752
1752
|
margin-bottom: 20px;
|
|
1753
|
-
`,
|
|
1753
|
+
`,Og=ti.h2`
|
|
1754
1754
|
&& {
|
|
1755
1755
|
font-size: 48px;
|
|
1756
1756
|
line-height: 48px;
|
|
1757
1757
|
margin: 8px auto;
|
|
1758
1758
|
}
|
|
1759
|
-
`,
|
|
1759
|
+
`,Mg=ti.p`
|
|
1760
1760
|
margin-bottom: 12px;
|
|
1761
1761
|
&& {
|
|
1762
1762
|
font-size: 17px;
|
|
1763
1763
|
line-height: 17px;
|
|
1764
1764
|
color: var(--privy-color-foreground-3);
|
|
1765
1765
|
}
|
|
1766
|
-
`,
|
|
1766
|
+
`,Dg=ti.div`
|
|
1767
1767
|
font-size: 16px;
|
|
1768
1768
|
line-height: 22.4px;
|
|
1769
1769
|
font-weight: 400;
|
|
@@ -1771,52 +1771,52 @@ Resources:
|
|
|
1771
1771
|
white-space: nowrap;
|
|
1772
1772
|
max-width: 275px;
|
|
1773
1773
|
text-overflow: ellipsis;
|
|
1774
|
-
`;function
|
|
1774
|
+
`;function qd(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{createContext as Ug,useContext as Fg}from"react";var Ia=Ug({wallets:[]});function Wa(){return Fg(Ia)}import jd from"styled-components";import{Fragment as Gg,jsx as er,jsxs as Na}from"react/jsx-runtime";var Kd=({txn:e,receipt:t,transactionInfo:o,onClose:r,tokenPrice:n})=>Na(Gg,{children:[er(S,{onClose:r}),Na(Bg,{children:[Na("div",{children:[er(ft,{title:"Transaction complete!",description:"You're all set."}),er(Jn,{tokenPrice:n,from:t.from,to:t.to,gas:t.gasUsed,txn:e,transactionInfo:o})]}),er("div",{children:er(Hg,{loading:!1,onClick:r,children:"All Done"})})]}),er(J,{})]}),Bg=jd.div`
|
|
1775
1775
|
display: flex;
|
|
1776
1776
|
height: 100%;
|
|
1777
1777
|
flex-direction: column;
|
|
1778
1778
|
justify-content: space-between;
|
|
1779
1779
|
flex-grow: 1;
|
|
1780
|
-
`,
|
|
1780
|
+
`,Hg=jd(K)`
|
|
1781
1781
|
margin-top: 24px;
|
|
1782
1782
|
transition: color 350ms ease, background-color 350ms ease;
|
|
1783
|
-
`;import{Fragment as
|
|
1783
|
+
`;import{Fragment as La,jsx as me,jsxs as tr}from"react/jsx-runtime";var Vg=({txn:e,txnFamily:t,uiOptions:o})=>{if(t==="CONTRACT_CALL"){if(o.transactionInfo?.contractInfo)return me(_a,{contractInfo:o.transactionInfo.contractInfo,description:o.description});if(o.senderInfo)return me(_a,{contractInfo:o.senderInfo,description:o.description||o.senderInfo.actionText})}return me(La,{children:me($d,{description:o.description||o.transactionInfo?.description||"",txn:e})})},Zd=()=>{let{authenticated:e,getAccessToken:t}=$(),{wallets:o}=Wa(),{walletProxy:r,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:l,nativeTokenSymbolForChainId:s}=_(),{app:c,navigate:w,data:m,outerClickRef:b,setModalData:h}=g(),{transactionRequest:C,onSuccess:E,onFailure:y,uiOptions:P,fundWalletConfig:T}=m.sendTransaction,[W,N]=_o(null),[A,I]=_o(""),[D,ce]=_o(),[H,j]=_o(!1),[G,X]=_o(!0),[M,de]=_o(!1),[z,ee]=_o(C),{tokenPrice:Fe,estimatedGas:F}=ei(z),Et=s(C.chainId)||"ETH";Jd(()=>{e||(w("LANDING"),y(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let Ce=Yd(()=>o.find(nt=>nt.walletClientType==="privy"),[o]),ir=async()=>{if(!Ce)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:nt,externalTransactionId:ne}=await i(Ce.address,{config:T?.config||{}});h({fiatOnRampPrompt:{signedUrl:nt},fiatOnRampStatus:{externalTransactionId:ne}}),w("FIAT_ON_RAMP_PROMPT_SCREEN")},so=Yd(()=>new zg(Xe(z.chainId,l,a)),[z.chainId,a]);Jd(()=>{async function nt(){return!await t()||!r||!Ce?z:Qn(Ce.address,z,so)}nt().then(ne=>{X(!1),ee(ne)},async ne=>{X(!0);let Be=!1;if(Fl(ne))Be=!0;else if(Bl(ne))try{let{hasSufficientFunds:ko}=await Xn(Ce.address,z,so);Be=ko===!1}catch(ko){console.warn(`Cannot accurately determine if wallet has sufficient funds with error: ${ko}`)}let lo="";Be?(lo="Wallet has insufficient funds for this transaction",c?.fiatOnRamp.enabled&&j(!0)):(lo="There was an error preparing your transaction",console.error(ne)),I(lo),ce(new Te(new ct(lo,Ae.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))})},[r]);let Nr=qd(z),ai=Nr==="SEND"?`Send ${Et}`:"Review transaction",ar={modalTitle:P.header||P.modalTitle||ai,buttonText:P.buttonText||"Submit"},Ot=()=>{M||(W?E(W):y(D||new Te(new ct("The user rejected the request",Ae.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return b&&(b.current=Ot),Fe===void 0?tr(La,{children:[me(S,{title:ar.modalTitle,onClose:Ot}),me(R,{}),me(Qd,{children:me(zo,{})}),me(O,{})]}):W!==null?me(Kd,{txn:z,onClose:Ot,receipt:W,transactionInfo:P.transactionInfo,tokenPrice:Fe}):tr(La,{children:[me(S,{title:ar.modalTitle,onClose:Ot}),tr(Qd,{children:[tr(Kg,{children:[me(Vg,{txn:z,txnFamily:Nr,uiOptions:P}),Ce?me(Jn,{from:Ce.address,to:z.to,txn:z,transactionInfo:P.transactionInfo,gas:F?We(F).toHexString():void 0,tokenPrice:Fe}):null]}),tr(Yg,{children:[me($g,{children:A}),Ce?me(Hd,{txn:z,wallet:Ce,provider:so}):null,tr(qg,{children:[H&&me(K,{onClick:ir,children:"Add Funds"}),me(jg,{disabled:G||M,loading:!r||M,loadingText:M?"Submitting (may take a few minutes)...":"Loading...",onClick:async()=>{de(!0);let nt=await t();if(nt&&!M&&Ce)try{let ne=await Zn(nt,Ce.address,r,z,so);N(ne),I("")}catch(ne){let Be="";ne.reason==="processing response error"?(console.warn({transaction:z,error:ne}),Be="An error has occurred, please contact support."):Be=ne.reason||"An error has occurred, please try again.",I(Be),ce(new Te(new ct(Be,Ae.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}finally{de(!1)}},children:ar.buttonText})]})]})]}),me(J,{})]})},Qd=or.div`
|
|
1784
1784
|
display: flex;
|
|
1785
1785
|
height: 100%;
|
|
1786
1786
|
flex-direction: column;
|
|
1787
1787
|
justify-content: space-between;
|
|
1788
1788
|
flex-grow: 1;
|
|
1789
|
-
|
|
1789
|
+
`,$g=or.div`
|
|
1790
1790
|
line-height: 15px;
|
|
1791
1791
|
font-size: 13px;
|
|
1792
1792
|
color: var(--privy-color-error);
|
|
1793
1793
|
width: 100%;
|
|
1794
1794
|
margin-top: 1px;
|
|
1795
|
-
`,
|
|
1795
|
+
`,qg=or.div`
|
|
1796
1796
|
display: flex;
|
|
1797
1797
|
direction: row;
|
|
1798
1798
|
justify-content: space-between;
|
|
1799
1799
|
align-items: center;
|
|
1800
1800
|
gap: 8px;
|
|
1801
|
-
|
|
1801
|
+
`,jg=or(K)`
|
|
1802
1802
|
transition: color 350ms ease, background-color 350ms ease;
|
|
1803
|
-
`,
|
|
1803
|
+
`,Kg=or.div`
|
|
1804
1804
|
height: 100%;
|
|
1805
1805
|
display: flex;
|
|
1806
1806
|
flex-direction: column;
|
|
1807
1807
|
justify-content: space-evenly;
|
|
1808
1808
|
flex-grow: 1;
|
|
1809
|
-
`,
|
|
1809
|
+
`,Yg=or.div`
|
|
1810
1810
|
display: flex;
|
|
1811
1811
|
flex-direction: column;
|
|
1812
1812
|
gap: 8px;
|
|
1813
|
-
`;import{isHexString as
|
|
1813
|
+
`;import{isHexString as Jg}from"@ethersproject/bytes";import{toUtf8String as Qg}from"@ethersproject/strings";import{useEffect as Zg,useState as Oa}from"react";import Rr,{css as Xg}from"styled-components";import{jsx as Xd}from"react/jsx-runtime";var ep=({style:e,color:t,...o})=>Xd("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:t||"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...o,children:Xd("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{Fragment as a1,jsx as Ct,jsxs as oi}from"react/jsx-runtime";var e1=e=>{if(!Jg(e))return e;try{return Qg(e)}catch{return e}},tp=()=>{let{authenticated:e}=$(),{walletProxy:t,closePrivyModal:o}=_(),{navigate:r,data:n,outerClickRef:i}=g(),[a,l]=Oa(""),[s,c]=Oa(),[w,m]=Oa(null),b=w!==null;Zg(()=>{e||r("LANDING")},[e]);let{message:h,confirmAndSignMessage:C,onSuccess:E,onFailure:y,uiOptions:P}=n.signMessage,T=!t,W={title:P.title||"Sign message",description:P.description||"Signing this message will not cost you any fees.",buttonText:P.buttonText||"Sign and continue"},N=A=>{A?E(A):y(s||new Te(new ct("The user rejected the request.",Ae.E4001_USER_REJECTED_REQUEST.eipCode))),o({shouldCallAuthOnSuccess:!1}),m(null),l(""),c(void 0)};return i&&(i.current=()=>N(w)),oi(a1,{children:[Ct(S,{onClose:()=>N(w)}),Ct(R,{}),oi(t1,{children:[oi("div",{children:[Ct(ft,{title:W.title,description:W.description}),Ct(o1,{children:e1(h)}),Ct(r1,{fail:!0,children:a})]}),Ct(i1,{success:b,loading:T,disabled:b,onClick:async()=>{try{let A=await C();m(A),l(""),setTimeout(()=>{N(A)},Ze)}catch{l("An error has occurred, please try again."),c(new Te(new ct(a,Ae.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:b?oi(n1,{children:[Ct(ep,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",Ct("span",{children:"Success"})]}):W.buttonText})]}),Ct(O,{}),Ct(B,{protectedByPrivy:!0})]})},t1=Rr.div`
|
|
1814
1814
|
display: flex;
|
|
1815
1815
|
height: 100%;
|
|
1816
1816
|
flex-direction: column;
|
|
1817
1817
|
justify-content: space-between;
|
|
1818
1818
|
flex-grow: 1;
|
|
1819
|
-
`,
|
|
1819
|
+
`,o1=Rr.div`
|
|
1820
1820
|
background-color: var(--privy-color-background-2);
|
|
1821
1821
|
border-radius: var(--privy-border-radius-md);
|
|
1822
1822
|
padding: 12px;
|
|
@@ -1832,7 +1832,7 @@ Resources:
|
|
|
1832
1832
|
&::-webkit-scrollbar {
|
|
1833
1833
|
display: none; /* Safari and Chrome */
|
|
1834
1834
|
}
|
|
1835
|
-
`,
|
|
1835
|
+
`,r1=Rr.div`
|
|
1836
1836
|
line-height: 20px;
|
|
1837
1837
|
height: 20px;
|
|
1838
1838
|
font-size: 13px;
|
|
@@ -1841,20 +1841,20 @@ Resources:
|
|
|
1841
1841
|
justify-content: flex-start;
|
|
1842
1842
|
width: 100%;
|
|
1843
1843
|
margin-top: 4px;
|
|
1844
|
-
`,
|
|
1844
|
+
`,n1=Rr.span`
|
|
1845
1845
|
display: flex;
|
|
1846
1846
|
align-items: center;
|
|
1847
1847
|
gap: 8px;
|
|
1848
|
-
`,
|
|
1848
|
+
`,i1=Rr(K)`
|
|
1849
1849
|
transition: color 350ms ease, background-color 350ms ease;
|
|
1850
1850
|
|
|
1851
|
-
${e=>e.success&&
|
|
1851
|
+
${e=>e.success&&Xg`
|
|
1852
1852
|
&&&& {
|
|
1853
1853
|
background-color: var(--privy-color-success);
|
|
1854
1854
|
color: #ffffff;
|
|
1855
1855
|
}
|
|
1856
1856
|
`}
|
|
1857
|
-
`;import
|
|
1857
|
+
`;import l1,{createGlobalStyle as c1}from"styled-components";var s1=`
|
|
1858
1858
|
*,
|
|
1859
1859
|
::before,
|
|
1860
1860
|
::after {
|
|
@@ -2084,7 +2084,7 @@ Resources:
|
|
|
2084
2084
|
[hidden] {
|
|
2085
2085
|
display: none;
|
|
2086
2086
|
}
|
|
2087
|
-
`,
|
|
2087
|
+
`,op=s1;var rp=c1`
|
|
2088
2088
|
:root {
|
|
2089
2089
|
// Borders
|
|
2090
2090
|
--privy-border-radius-sm: 6px;
|
|
@@ -2115,10 +2115,10 @@ Resources:
|
|
|
2115
2115
|
--privy-height-modal-full: 620px;
|
|
2116
2116
|
--privy-height-modal-compact: 480px;
|
|
2117
2117
|
};
|
|
2118
|
-
`,
|
|
2118
|
+
`,np=l1.div`
|
|
2119
2119
|
// css normalize only the privy application to avoid conflicts
|
|
2120
2120
|
// with consuming application
|
|
2121
|
-
${
|
|
2121
|
+
${op}
|
|
2122
2122
|
|
|
2123
2123
|
// Privy styles
|
|
2124
2124
|
color: var(--privy-color-foreground-2);
|
|
@@ -2177,7 +2177,7 @@ Resources:
|
|
|
2177
2177
|
opacity: 1;
|
|
2178
2178
|
}
|
|
2179
2179
|
}
|
|
2180
|
-
`;import{jsx as
|
|
2180
|
+
`;import{jsx as Je,jsxs as E1}from"react/jsx-runtime";var f1={["LANDING"]:jc,["AWAITING_PASSWORDLESS_CODE"]:El,["WALLET_EDUCATION"]:Nc,["AWAITING_CONNECTION"]:Wl,["AWAITING_CONNECT_ONLY_CONNECTION"]:Ml,["PHANTOM_INTERSTITIAL_SCREEN"]:ud,["LOGIN_FAILED_SCREEN"]:rd,["AWAITING_OAUTH_SCREEN"]:ld,["ALLOWLIST_REJECTION_SCREEN"]:yl,["INSTALL_METAMASK_SCREEN"]:Dc,["INSTALL_PHANTOM_SCREEN"]:Fc,["INSTALL_COINBASE_WALLET_SCREEN"]:Oc,["LINK_EMAIL_SCREEN"]:Jc,["LINK_PHONE_SCREEN"]:Qc,["LINK_WALLET_SCREEN"]:Xc,["CONNECT_ONLY_LANDING_SCREEN"]:Rl,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Sl,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:dc,["EMBEDDED_WALLET_CREATED_SCREEN"]:$l,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:zl,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:mc,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:Jl,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:tp,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:Zd,["FIAT_ON_RAMP_PROMPT_SCREEN"]:wc,["FIAT_ON_RAMP_STATUS_SCREEN"]:bc,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:uc,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:pc},y1={["AWAITING_CONNECTION"]:"compact",["AWAITING_CONNECT_ONLY_CONNECTION"]:"compact",["CONNECT_ONLY_LANDING_SCREEN"]:"compact",["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:"compact",["AWAITING_OAUTH_SCREEN"]:"compact",["ALLOWLIST_REJECTION_SCREEN"]:"compact",["WALLET_EDUCATION"]:"full",["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:"full",["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:"compact",["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:"compact",["EMBEDDED_WALLET_RECOVERY_SCREEN"]:"compact"},g1=(e,t,o)=>{if(e==="LANDING"&&t)return"compact";let r=y1[e];return r||(o?"medium":"full")},v1=()=>{let{ready:e}=$(),{isLinking:t}=_(),{ready:o,currentScreen:r,app:n}=g(),i=!!n?.loginMethods.wallet,a=!!(n?.loginMethods.email||n?.loginMethods.sms),s=g1(r,i!==a,t);if((!e||!o)&&r!=="AWAITING_OAUTH_SCREEN")return E1(ip,{"data-height":s,children:[Je(S,{}),Je(R,{}),Je(b1,{children:Je(mo,{})}),Je(O,{}),Je(J,{})]});let c=f1[r];return c?Je(ip,{"data-height":s,children:Je(c,{})}):null},sp=()=>{let{closePrivyModal:e}=_(),{app:t,outerClickRef:o}=g(),r=()=>{if(o?.current){let{closeModal:l}=o.current()||{closeModal:!0};l&&(e(),o.current=null)}else return e()},n=m1(l=>{l.key==="Escape"&&t?.render.inDialog&&r()},[t?.render.inDialog]);ap(()=>(document.addEventListener("keydown",n,!1),()=>{document.removeEventListener("keydown",n,!1)}),[n]);let i=Je(np,{onClick:l=>l.stopPropagation(),children:Je(v1,{})}),a=t?.render.inDialog?Je(C1,{id:"privy-dialog",onClick:()=>r(),children:i}):i;return h1.createPortal(a,t?.render.inParentNodeId&&document.getElementById(t.render.inParentNodeId)||document.body)},w1=({children:e,...t})=>{let o=u1(null);return ap(()=>{document?.activeElement?.blur();let r=document?.getElementById("root")||document?.getElementById("__next");if(r)return r.setAttribute("inert","true"),d1(o?.current),()=>{let n=document?.getElementById("root")||document?.getElementById("__next");n&&(n.removeAttribute("inert"),p1())}},[t.open,t.onClose]),Je("dialog",{open:!0,role:"dialog",...t,ref:o,children:e})},C1=Ma(w1)`
|
|
2181
2181
|
position: fixed;
|
|
2182
2182
|
top: 0;
|
|
2183
2183
|
left: 0;
|
|
@@ -2192,7 +2192,7 @@ Resources:
|
|
|
2192
2192
|
z-index: 999999;
|
|
2193
2193
|
-webkit-backdrop-filter: blur(3px);
|
|
2194
2194
|
backdrop-filter: blur(3px);
|
|
2195
|
-
`,
|
|
2195
|
+
`,ip=Ma.div`
|
|
2196
2196
|
display: flex;
|
|
2197
2197
|
flex-direction: column;
|
|
2198
2198
|
text-align: center;
|
|
@@ -2229,10 +2229,10 @@ Resources:
|
|
|
2229
2229
|
min-height: 0;
|
|
2230
2230
|
}
|
|
2231
2231
|
}
|
|
2232
|
-
`,
|
|
2232
|
+
`,b1=Ma.div`
|
|
2233
2233
|
display: flex;
|
|
2234
2234
|
flex-direction: column;
|
|
2235
2235
|
align-items: center;
|
|
2236
2236
|
justify-content: center;
|
|
2237
2237
|
height: 100%;
|
|
2238
|
-
`;import{useEffect as C1}from"react";import{Fragment as E1,jsx as x1}from"react/jsx-runtime";var b1=({onLoad:e})=>{let t=window;return C1(()=>{if(document.getElementById("cf-script")!==null||t.turnstile)return;t.onloadTurnstileCallback=e;let o=document.createElement("script");o.setAttribute("src","https://challenges.cloudflare.com/turnstile/v0/api.js?onload=onloadTurnstileCallback&render=explicit"),o.setAttribute("id","cf-script"),o.setAttribute("async","true"),document.body.appendChild(o)},[]),x1(E1,{})},ap=b1;var sp={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}};var lp={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]},default:{http:["https://goerli-rollup.arbitrum.io/rpc"]},public:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"},default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var cp={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}};var dp={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0};var pp={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{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"}},testnet:!0};var up={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-goerli.blastapi.io"],webSocket:["wss://base-goerli.blastapi.io"]},default:{http:["https://goerli.base.org"]},public:{http:["https://goerli.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://goerli.basescan.org"},default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0};var mp={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1};var hp={id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0};var fp={id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}};var yp={id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}};var gp={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-goerli.g.alchemy.com/v2"],webSocket:["wss://eth-goerli.g.alchemy.com/v2"]},infura:{http:["https://goerli.infura.io/v3"],webSocket:["wss://goerli.infura.io/ws/v3"]},default:{http:["https://rpc.ankr.com/eth_goerli"]},public:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli.etherscan.io"},default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},testnet:!0};var vp={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-mainnet.infura.io/v3"],webSocket:["wss://linea-mainnet.infura.io/ws/v3"]},default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1};var wp={id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0};var Cp={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}};var bp={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}};var Ep={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-goerli.g.alchemy.com/v2"],webSocket:["wss://opt-goerli.g.alchemy.com/v2"]},infura:{http:["https://optimism-goerli.infura.io/v3"],webSocket:["wss://optimism-goerli.infura.io/ws/v3"]},default:{http:["https://goerli.optimism.io"]},public:{http:["https://goerli.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"},default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0};var xp={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0};var Ir=[sp,lp,gp,xp,Cp,bp,Ep,Sr,Ar,mp,hp,fp,yp,pp,up,vp,wp,cp,dp],Tp=new Set(Ir.map(e=>e.id));import _o from"tinycolor2";var Pp="#FFFFFF",T1="#000000",P1=Pp,_1="#1E1E1D";function S1(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"}function ro(e,t){let o=Math.max(0,Math.min(1,e.toHsl().l+t));return _o({...e.toHsl(),l:o})}function _p({backgroundTheme:e,accentHex:t,successHex:o="#51BA81",warnHex:r="#FFB74D",errorHex:n="#EC6351",whiteHex:a=Pp,blackHex:i=T1}){let l;switch(e){case"light":l=P1;break;case"dark":l=_1;break;default:l=e;break}let s=_o(l),c=_o(t),v=_o(o),h=_o(r),C=_o(n),m=S1(s.getLuminance()),E=ro(s,m==="light"?-.04:.11),b=ro(s,m==="light"?-.88:.87),f=ro(s,m==="light"?-.77:.75),_=ro(s,m==="light"?-.43:.45).desaturate(m==="light"?60:20),x=ro(s,m==="light"?-.08:.25).desaturate(m==="light"?60:20),I=ro(c,.15),N=ro(c,-.06),A=_o(c.getLuminance()>.5?i:a),W=ro(v,-.16);return{colorScheme:m,background:s.toHslString(),background2:E.toHslString(),foreground:b.toHslString(),foreground2:f.toHslString(),foreground3:_.toHslString(),foreground4:x.toHslString(),accent:c.toHslString(),accentLight:I.toHslString(),accentDark:N.toHslString(),foregroundAccent:A.toHslString(),success:v.toHslString(),successDark:W.toHslString(),error:C.toHslString(),warn:h.toHslString()}}var no={appearance:{theme:"light",accentColor:"#676FFF"},walletConnectCloudProjectId:fs,rpcConfig:{rpcUrls:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};function oi(e,t){let o=["google","twitter","discord","github","linkedin","apple"],r=t?.loginMethods?.filter(f=>o.includes(f)),n=r?.slice(0,5),a,i,l,s,c,v,h,C,m;if(t?.loginMethods?(a=t.loginMethods.includes("email"),i=t.loginMethods.includes("sms"),l=t.loginMethods.includes("wallet"),s=n?.includes("google"),c=n?.includes("twitter"),v=n?.includes("discord"),C=n?.includes("github"),h=n?.includes("linkedin"),m=n?.includes("apple")):(a=e.emailAuth,i=e.smsAuth,l=e.walletAuth,s=e.googleOAuth,c=e.twitterOAuth,v=e.discordOAuth,C=e.githubOAuth,h=e.linkedinOAuth,m=e.appleOAuth),a&&i&&(console.warn("Enabling both email and SMS passwordless is not currently supported. Disabling SMS."),i=!1),!a&&!i&&[s,c,v,C,h,m].some(f=>f))throw new Error("To enable social logins you must also enable either SMS or Email login");if(![a,i,l,s,c,v,C,h,m].some(f=>f))throw new Error("You must enable at least one login method");r&&r.length>5&&console.warn("Max number of social logins allowed is 5. Any more have been removed.");let E=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1;return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:_p({backgroundTheme:t?.appearance?.theme??no.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??no.appearance.accentColor}),showWalletLoginFirst:t?.appearance?.showWalletLoginFirst??e.showWalletLoginFirst},loginMethods:{wallet:l,email:a,sms:i,google:s,twitter:c,discord:v,github:C,linkedin:h,apple:m},legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??no.walletConnectCloudProjectId,rpcConfig:t?.rpcConfig??no.rpcConfig,chains:A1(t?.additionalChains),captchaEnabled:e.captchaEnabled??no.captchaEnabled,embeddedWallets:{...e.embeddedWalletConfig,...E?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1,noPromptOnSignature:!0}:{},...t?.embeddedWallets},customAuth:E?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??no.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??no._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??no._render.inParentNodeId}}}function Sp(e,t){return e?.appearance?.logo&&typeof e.appearance.logo=="object"&&(e.appearance.logo="component"),{...e,legacyCreateEmbeddedWalletFlag:t}}function A1(e){return!e||e.length===0?Ir.map(o=>o):Ir.concat(e.filter(o=>!Tp.has(o.id)))}import{useRef as R1,useEffect as k1}from"react";var ri=class{constructor(){this.callbacks={}}enqueue(t,o){this.callbacks[t]=o}dequeue(t,o){let r=this.callbacks[o];if(!r)throw new Error(`cannot dequeue ${t} event: no event found for id ${o}`);switch(delete this.callbacks[o],t){case"privy:iframe:ready":return r;case"privy:wallet:create":return r;case"privy:wallet:connect":return r;case"privy:wallet:recover":return r;case"privy:wallet:rpc":return r;case"privy:wallet:set-recovery-password":return r;default:throw new Error(`invalid wallet event type ${t}`)}}};import{jsx as M1}from"react/jsx-runtime";var I1=function(e){return()=>`id-${e++}`}(0);function W1(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function rr(e){return e.error!==void 0}var So=new ri,Oa=new Map,N1=(e,t)=>typeof t=="bigint"?t.toString():t,L1=(e,t)=>`${e}${JSON.stringify(t,N1)}`;function nr(e,t,o){let r=o.contentWindow;if(!r)throw new Error("iframe not initialized");let n=L1(e,t);if(e==="privy:wallet:create"){let i=Oa.get(n);if(i)return i}let a=new Promise((i,l)=>{let s=I1();So.enqueue(s,{resolve:i,reject:l}),r.postMessage({id:s,event:e,data:t},"*")}).finally(()=>{Oa.delete(n)});return Oa.set(n,a),a}function O1(e){switch(e.event){case"privy:iframe:ready":let t=So.dequeue(e.event,e.id);return rr(e)?t.reject(new At(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let o=So.dequeue(e.event,e.id);return rr(e)?o.reject(new At(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let r=So.dequeue(e.event,e.id);return rr(e)?r.reject(new At(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:recover":let n=So.dequeue(e.event,e.id);return rr(e)?n.reject(new At(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let a=So.dequeue(e.event,e.id);return rr(e)?a.reject(new At(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery-password":let i=So.dequeue(e.event,e.id);return rr(e)?i.reject(new At(e.error.type,e.error.message)):i.resolve(e.data);default:console.warn("Unsupported wallet proxy method:",e)}}function Ap(e){let t=R1(null);return k1(()=>{let o=t.current;if(!o)return;function r(s){s&&s.origin===e.origin&&W1(s.data)&&O1(s.data)}let n={create(s){return nr("privy:wallet:create",s,o)},connect(s){return nr("privy:wallet:connect",s,o)},recover(s){return nr("privy:wallet:recover",s,o)},rpc(s){return nr("privy:wallet:rpc",s,o)},setRecoveryPassword(s){return nr("privy:wallet:set-recovery-password",s,o)}};window.addEventListener("message",r);let a=()=>e.onLoad(n),i=(...s)=>{console.warn("Privy iframe failed to load: ",...s),e.onLoadFailed()},l=new AbortController;return Ss(()=>nr("privy:iframe:ready",{},o),{abortSignal:l.signal}).then(a,i),()=>{window.removeEventListener("message",r),l.abort()}},[t.current]),M1("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},src:jr(e.origin,`/apps/${e.appId}/embedded-wallets`)})}import{createContext as D1,useContext as U1,useEffect as F1}from"react";var Rp={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]}},Ma=D1(void 0),B1=()=>U1(Ma);function io(e,t){if(!t)return;let r=B1().current[e];return F1(()=>{for(let[n,a]of Object.entries(t))r.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),r[n]?.push(a);return()=>{for(let[n,a]of Object.entries(t))r.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),r[n]=r[n]?.filter(i=>i!==a)}},[t])}function le(e,t,o,...r){for(let n of e.current[t][o])n(...r)}import{jsx as ao,jsxs as Ip}from"react/jsx-runtime";function z1(e){return typeof e=="string"&&e.length===25}var Wr;function _t(){if(!Wr){let e=$.get(Lo);return Promise.resolve(e||null)}return Wr.getAccessToken()}var Wp,Ns=(e,t)=>Wp(e,t),Np,Ls=(e,t)=>Np(e,t),Lp,Os=()=>Lp(),$1=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;$.put(lr,t);let o=new URL(window.location.href);o.searchParams.delete("privy_token"),window.history.pushState({},"",o)},V1=({config:e,...t})=>{if(!z1(t.appId))throw new w("Cannot initialize the Privy provider with an invalid Privy app ID");Wr||(Wr=new yr({appId:t.appId,apiUrl:t.apiUrl||Hr}));let o=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&o.embeddedWallets?.createOnLogin===void 0&&(o.embeddedWallets||(o.embeddedWallets={}),o.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),ao(q1,{...t,config:o,client:Wr})},q1=e=>{let t=e.client,[o,r]=Q(!1),[n,a]=Q(!1),[i,l]=Q(!1),[s,c]=Q(null),[v,h]=Q(!1),[C,m]=Q([]),E=kp(C),[b,f]=Q(!1),[_,x]=Q(null),[I,N]=Q(!1),[A,W]=Q({status:"disconnected",connectError:null,connector:null,connectRetry:T}),[H,ce]=Q(null),[B,j]=Q(null),[G,X]=Q({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",requireUserPasswordOnCreate:!1},fiatOnRampEnabled:!1,captchaEnabled:!1}),[M,de]=Q(()=>{let d=Sp(e.config,e.createPrivyWalletOnLogin);return t.createAnalyticsEvent("sdk_initialize",d),oi(G,e.config)}),[z,ee]=Q(!0),[De,U]=Q({}),[bt,Ce]=Q(null),[ir,so]=Q(null),[Nr,ii]=Q(!1),[ar,Ot]=Q(),[nt,ne]=Q(),[Ue,lo]=Q(),[Ao,Ua]=Q(!1),ie=kp(Rp),Se=d=>{d&&x(d),r(!0),t.createAnalyticsEvent("modal_open",{initialScreen:d})},Lr=d=>{M.embeddedWallets.createOnLogin!=="off"&&ee(!0),Se(d)};Ct(()=>{if(!B||!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClient==="privy");if(d&&d.length>0){let p=d[0].address;t.connectors?.addEmbeddedWalletConnector(B,p)}},[B,s]),Ct(()=>{B&&ir?.(B)},[B]),Ct(()=>{(async()=>{if(!M.customAuth?.enabled)return;ee(!0);let{getCustomAccessToken:p,isLoading:u}=M.customAuth;if(!(!n||u))try{let y=await p();if(!y){await Ro.logout();return}if(i)return;t.startAuthFlow(new Wo(y));let{user:L,isNewUser:he}=await t.authenticate();L||await Ro.logout(),c(L||null),f(he||!1),l(!0),Ua(!0)}catch(y){console.warn(y),i&&await Ro.logout()}})()},[M.customAuth?.enabled,M.customAuth?.getCustomAccessToken,M.customAuth?.isLoading,n,i]),Ct(()=>{Ao&&B&&s&&Ft(s,e.config?.embeddedWallets?.createOnLogin)&&(Ua(!1),Ga(s,3e4).catch(console.error))},[Ao&&B&&s]),Ct(()=>{async function d(){let p=await t.getServerConfig();X(p);let u=oi(p,e.config);de(u),p.customApiUrl&&t.updateApiUrl(p.customApiUrl),t.initializeConnectorManager(u.walletConnectCloudProjectId,u.rpcConfig,u.chains),t.connectors?.initialize();let y=Op();$1();let L=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!L),L&&le(ie,"login","onComplete",L,!1,!0),c(L)),y||(a(!0),bt?.()),y&&L&&h(!0),Mp()}n||d()},[t,bt,n]),Ct(()=>{let d=oi(G,e.config);de(d)},[e.config]);let Op=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_oauth_code"),u=d.get("privy_oauth_state"),y=d.get("privy_oauth_provider");return p&&u&&y?(t.startAuthFlow(new Ut(y,p,u)),Lr("AWAITING_OAUTH_SCREEN"),U({finishOauthFlow:{onComplete:()=>{a(!0),bt?.()}}}),!0):!1},ai=async(d,p,u)=>{let y=await t.connectors?.createWalletConnector(d,p)||null;Fa(y,u)};async function Fa(d,p){if(!d)return W({status:"disconnected",connectError:new D("Unable to connect to wallet."),connector:null,connectRetry:T}),p?.(null);W({connector:d,status:"connecting",connectError:null,connectRetry:()=>Fa(d,p)});try{let u=await d.connect({showPrompt:!0});return W(y=>({...y,status:"connected",connectError:null,connectRetry:T})),u&&!I&&le(ie,"connectWallet","onSuccess",u),p?.(u)}catch(u){return u instanceof Je?(console.warn(u.cause?u.cause:u.message),I||le(ie,"connectWallet","onError",u.privyErrorCode||"generic_connect_wallet_error")):(console.warn(u),I||le(ie,"connectWallet","onError","unknown_connect_wallet_error")),W(y=>({...y,status:"disconnected",connectError:u})),p?.(null)}}let si=d=>{d!==null&&t.startAuthFlow(new po(d))},Mp=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),u=d.get("privy_wallet_client");if(!p||!u)return;if(u==="phantom"&&!Ge()&&Lr("LOGIN_FAILED_SCREEN"),!t.connectors)throw new w("Connector not initialized");Se("AWAITING_CONNECTION");let y=new URL(window.location.href);y.searchParams.delete("privy_connector"),y.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",y),ai(p,u,si)};Ct(()=>{n&&i&&s===null&&t.getAuthenticatedUser().then(c)},[n,i,s,t]);let Ba=()=>{h(!0),Se("LINK_WALLET_SCREEN")},Dp=d=>{if(!i||!s)return!1;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address)return!0;return!1},Up=async d=>{if(!t.connectors)throw new w("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;W(u=>({...u,connector:p,status:"connected",connectError:null,connectRetry:T})),si(d),Lr("AWAITING_CONNECTION")},Fp=async(d,p)=>{if(!t.connectors)throw new w("Connector not initialized");await ai(d,p,si)},Ha=async(d,p)=>{if(!M.fiatOnRamp.enabled)throw new w("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:u,externalTransactionId:y}=await fc(t,d,p?.config??{},M.appearance.palette,M.fiatOnRamp.useSandbox);return{signedUrl:u,externalTransactionId:y}}else throw new w("Unsupported fund provider. Currently supported option is `moonpay`.")},Or=()=>{m(d=>{let p=t.connectors?.wallets.map(u=>({...u,linked:Dp(u),loginOrLink:async()=>{if(!await u.isConnected())throw new w("Wallet is not connected");if(u.connectorType==="embedded"&&u.walletClientType==="privy")throw new w("Cannot link or login with embedded wallet");Up(u)},fund:async y=>{let{signedUrl:L,externalTransactionId:he}=await Ha(u.address,y);U({fiatOnRampPrompt:{signedUrl:L},fiatOnRampStatus:{externalTransactionId:he}}),Se("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!i)throw new w("User is not authenticated.");if(u.connectorType==="embedded"&&u.walletClientType==="privy")throw new w("Cannot unlink an embedded wallet");let y=await t.unlinkWallet(u.address);c(y)}}))||[];return Jr(d,p)?d:p})};Ct(()=>{Or()},[s?.linkedAccounts,i,n]),Ct(()=>{if(n){if(!t.connectors)throw new w("Connector not initialized");Or(),t.connectors.on("walletsUpdated",Or)}},[n]);let Bp=()=>{Se(i?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Ct(()=>{if(!C[0])return;let d=C[0],p=E.current.find(y=>y.address===d.address),u=s?.linkedAccounts.find(y=>y.type==="wallet"&&y.address===d.address);if(!p&&u){let y=Object.assign({},s);y.wallet=u&&{address:u.address,chainType:u.chainType,chainId:u.chainId,walletClient:u.walletClient,walletClientType:u.walletClientType,connectorType:u.connectorType},c(y)}E.current=C},[C]);let Ga=async(d,p)=>{if(Y(d))throw le(ie,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[y,L]=await Promise.all([Fe.initializeWalletProxy(p),_t()]);if(!y&&e.config?.customAuth?.enabled)throw le(ie,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!y||!L||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((he,xe)=>{ee(!0),U({createWallet:{onSuccess:it=>{le(ie,"createWallet","onSuccess",it),he(it)},onFailure:it=>{le(ie,"createWallet","onError","unknown_embedded_wallet_error"),xe(it)},callAuthOnSuccessOnClose:!1}}),Se("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await y.create({accessToken:L});let he=await Fe.refreshUser(),xe=Y(he);if(!xe)throw le(ie,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return le(ie,"createWallet","onSuccess",xe),xe}},Ro={ready:n,authenticated:i,user:s,walletConnectors:t.connectors||null,connectWallet:Bp,linkWallet:Ba,linkEmail:()=>{if(s?.email)throw new w("User already has an email linked to their account.");h(!0),Se("LINK_EMAIL_SCREEN")},linkPhone:()=>{if(s?.phone)throw new w("User already has a phone number linked to their account.");h(!0),Se("LINK_PHONE_SCREEN")},linkGoogle:async()=>{if(s?.google)throw new w("User already has a Google account linked to their account.");await Fe.initLoginWithOAuth("google")},linkTwitter:async()=>{if(s?.twitter)throw new w("User already has a Twitter account linked to their account.");await Fe.initLoginWithOAuth("twitter")},linkDiscord:async()=>{if(s?.discord)throw new w("User already has a Discord account linked to their account.");await Fe.initLoginWithOAuth("discord")},linkGithub:async()=>{if(s?.github)throw new w("User already has a Github account linked to their account.");await Fe.initLoginWithOAuth("github")},linkLinkedIn:async()=>{if(s?.linkedin)throw new w("User already has a LinkedIn account linked to their account.");await Fe.initLoginWithOAuth("linkedin")},linkApple:async()=>{await Fe.initLoginWithOAuth("apple")},login:async()=>{if(n||(await new Promise(d=>{Ce(()=>d)}),Ce(null)),i){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}N(!0),Lr()},logout:async()=>{await t.logout(),c(null),l(!1),x(null),le(ie,"logout","onSuccess"),h(!1),r(!1),$.del(cr)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new Z;let d=C.find(u=>s.wallet&&u.address===s.wallet.address),p=t.connectors?.walletConnectors.find(u=>u.wallets.find(y=>y.address===d?.address));return!d||!p?new Z:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new Da(new dt(new Z));let d=C.find(u=>s.wallet&&u.address===s.wallet.address),p=t.connectors?.walletConnectors.find(u=>u.wallets.find(y=>y.address===d?.address));return!d||!p?new Da(new dt(new Z)):new Da(new dt(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Gt(new Z);let d=C.find(u=>s.wallet&&u.address===s.wallet.address),p=t.connectors?.walletConnectors.find(u=>u.wallets.find(y=>y.address===d?.address));return!d||!p?new Gt(new Z):new Gt(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return c(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return c(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return c(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return c(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return c(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return c(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return c(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return c(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},setActiveWallet:async d=>{let p=C.find(y=>ni(y.address)===ni(d)),u=s?.linkedAccounts.find(y=>y.type==="wallet"&&ni(y.address)===ni(d));if(!p||!await p.isConnected())ce(d),Ba();else if(!p.linked)p.loginOrLink();else{let y=Object.assign({},s);y.wallet=u&&{address:u.address,chainType:u.chainType,chainId:u.chainId,walletClient:u.walletClient,walletClientType:u.walletClientType,connectorType:u.connectorType},c(y)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!i||!s)throw le(ie,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return Ga(s,15e3)},setWalletPassword:()=>new Promise((d,p)=>{if(!i||!s){p(new Error("User must be authenticated before adding password to Privy wallet"));return}let u=Y(s);if(!u||!B){p(new Error("Must have a Privy wallet to add a password"));return}if(u.recoveryMethod==="user-passcode"){p(new Error("Cannot set password. Embedded wallet already has a password."));return}ee(!0);let y={onSuccess:d,onFailure:p,callAuthOnSuccessOnClose:!1},L={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:p};U({setWalletPassword:y,connectWallet:L}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")}),signMessage:(d,p)=>new Promise(async(u,y)=>{if(!i||!s){y(new Error("User must be authenticated before signing with a Privy wallet"));return}let L=Y(s);if(!L){y(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){y(new Error("Message must be a non-empty string"));return}ee(!0);let he=async()=>{if(!i)return y(new Error("User must be authenticated before signing with a Privy wallet")),null;let xe=await _t();if(B&&xe)try{if(!await Fe.recoverEmbeddedWallet())return y(new Error("Unable to connect to wallet")),null;t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:L.address});let{response:it}=await B.rpc({accessToken:xe,address:L.address,request:{method:"personal_sign",params:[d,L.address]}}),Mt=it.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:L.address}),Mt}catch(Et){return y(Et),null}else return null};if(M.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");let xe=await he();xe?u(xe):y(new Te("Unable to sign message"))}else{let it={message:d,confirmAndSignMessage:he,onSuccess:Dt=>{u(Dt)},onFailure:Dt=>{y(Dt)},uiOptions:p||{}},Mt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:y};U({signMessage:it,connectWallet:Mt}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:(d,p,u)=>new Promise(async(y,L)=>{if(!i||!s){L(new Error("User must be authenticated before signing with a Privy wallet"));return}let he=Y(s);if(!he){L(new Error("Must have a Privy wallet before signing"));return}ee(!0);let xe=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Et=Object.assign({},d,{chainId:d.chainId||xe.chainId}),it=async()=>{let Mt=await _t();if(!Mt||!B){L(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await Fe.recoverEmbeddedWallet()){L(new Error("Unable to connect to wallet"));return}let za=new H1(Xe(Et.chainId,M.chains,M.rpcConfig)),Gp=await Jn(he.address,Et,za),zp=await Qn(Mt,he.address,B,Gp,za);y(zp)}catch(Dt){L(Dt)}};if(M.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),it();else{let Mt={transactionRequest:Et,onSuccess:y,onFailure:L,uiOptions:p||{},fundWalletConfig:u},Dt={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:L};U({connectWallet:Dt,sendTransaction:Mt}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),exportWallet:()=>new Promise((d,p)=>{if(!i||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!Y(s)){p(new Error("Must have a Privy wallet before exporting"));return}ee(!0);let y={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},L={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};U({keyExport:L,connectWallet:y}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")})};Wp=Ro.signMessage,Np=Ro.sendTransaction;let Fe=(()=>({isNewUserThisSession:b,isLinking:v,linkingHint:H,walletConnectionStatus:A,rpcConfig:M.rpcConfig,chains:M.chains,nativeTokenSymbolForChainId:d=>M.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,captchaData:{ready:Nr,enabled:M.captchaEnabled,execute:()=>{let d=window.turnstile;if(!d)return;let p=d.render("#cf-turnstile",{sitekey:ys,action:M.id,callback:Ot,"error-callback":ne,"expired-callback":()=>{try{d.reset(Ue),ne(void 0),Ot(void 0)}catch{ne("expired_and_failed_reset")}},"unsupported-callback":()=>{console.warn("Browser does not support Turnstile.")}});p||console.warn("Failed to render challenge."),lo(p)},remove:()=>{let d=window.turnstile;!d?.remove||!Ue||(d.remove(Ue),lo(void 0),ne(void 0),Ot(void 0))},token:ar,error:nt},initializeWalletProxy:async d=>{if(B)return B;let p=new Promise(L=>{so(()=>he=>L(he))}),u=new Promise(L=>setTimeout(()=>L(null),d)),y=await Promise.race([p,u]);return so(null),y},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0})=>{let p=n&&i&&s;d.shouldCallAuthOnSuccess&&p?(le(ie,"login","onComplete",s,b,!1),e.onSuccess?.(s,b)):I&&le(ie,"login","onError","exited_auth_flow"),t.authFlow=void 0,ce(null),x(null),N(!1),h(!1),f(!1),r(!1),t.createAnalyticsEvent("modal_closed")},connectWallet:ai,initLoginWithWallet:Fp,loginWithWallet:async()=>{if(!n)throw new sr;if(!(t.authFlow instanceof po))throw new w("Must initialize SIWE flow first.");let d,p;if(i)d=await t.link();else try{({user:d,isNewUser:p}=await t.authenticate())}catch(u){throw le(ie,"login","onError",u.privyErrorCode||"generic_connect_wallet_error"),u}c(d||s||null),f(p||!1),l(!0)},initLoginWithOAuth:async d=>{t.startAuthFlow(new Ut(d));let p=await t.authFlow.getAuthorizationUrl();p&&p.url&&window.location.assign(p.url)},loginWithOAuth:async()=>{if(!(t.authFlow instanceof Ut))throw new w("Must initialize OAuth flow before calling loginWithOAuth");let d,p;if(i)d=await t.link();else try{({user:d,isNewUser:p}=await t.authenticate())}catch(u){throw le(ie,"login","onError",u.privyErrorCode||"unknown_auth_error"),u}c(d),f(p||!1),l(!0)},initLoginWithEmail:async(d,p)=>{let u=new co(d,p);t.startAuthFlow(u);try{await u.sendCodeEmail()}catch(y){throw le(ie,"login","onError",y.privyErrorCode||"unknown_auth_error"),y}},initLoginWithSms:async(d,p)=>{let u=new uo(d,p);t.startAuthFlow(u);try{await u.sendSmsCode()}catch(y){throw le(ie,"login","onError",y.privyErrorCode||"unknown_auth_error"),y}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(!n)throw new sr;if(t.authFlow instanceof co)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof uo)t.authFlow.meta.smsCode=d.trim();else throw new w("Must initialize a passwordless code flow first");let p,u;i?p=await t.link():{user:p,isNewUser:u}=await t.authenticate(),c(p||s||null),f(u||!1),l(!0)},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:B,createAnalyticsEvent:(d,p,u)=>t.createAnalyticsEvent(d,p,u),getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let u=s?.linkedAccounts.find(L=>L.type==="wallet"&&L.walletClientType==="privy"),y=await _t();if(!y||!B||!u){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}ee(!0);try{await B.connect({accessToken:y,address:u.address}),d(!0)}catch(L){zo(L)&&u.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:u.address}),(await B.recover({address:u.address,accessToken:y})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:u.address}),d(!0)):zo(L)?(U({recoverWallet:{privyWallet:u,onFailure:p,onSuccess:()=>d(!0)}}),Se("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(L)}}),getFiatOnRampConfig:Ha,updateWallets:()=>Or()}))();Lp=Fe.recoverEmbeddedWallet;let Hp=G1(()=>({wallets:C}),[C]);return ao(tt.Provider,{value:Ro,children:ao(Ma.Provider,{value:ie,children:Ip(Ra.Provider,{value:Hp,children:[e.children,Ip(Ti.Provider,{value:Fe,children:[ao(tp,{theme:{...M.appearance.palette||{}}}),ao(Gs,{appConfig:M,data:De,setModalData:U,setInitialScreen:x,initialScreen:_,visible:o,authenticated:i,children:o?ao(ip,{}):null}),z&&G.id?ao(Ap,{appId:e.appId,origin:t.apiUrl,onLoad:j,onLoadFailed:()=>null}):null]}),M.captchaEnabled&&ao(ap,{onLoad:()=>ii(!0)})]})})})};import{useContext as j1}from"react";function K1(e){let{login:t}=j1(tt);return io("login",e),{login:t}}import{useContext as Y1}from"react";function J1(e){let{logout:t}=Y1(tt);return io("logout",e),{logout:t}}import{useContext as Q1}from"react";function Z1(e){let{connectWallet:t}=Q1(tt);return io("connectWallet",e),{connectWallet:t}}import{useContext as X1}from"react";function ev(e){let{createWallet:t}=X1(tt);return io("createWallet",e),{createWallet:t}}export{dt as AsExternalProvider,hr as ConnectorManager,yr as PrivyClient,V1 as PrivyProvider,Z as PrivyProxyProvider,Ir as SUPPORTED_CHAINS,li as VERSION,Le as WalletConnector,_t as getAccessToken,Z1 as useConnectWallet,ev as useCreateWallet,K1 as useLogin,J1 as useLogout,V as usePrivy,ka as useWallets};
|
|
2238
|
+
`;import{useEffect as x1}from"react";import{Fragment as P1,jsx as _1}from"react/jsx-runtime";var T1=({onLoad:e})=>{let t=window;return x1(()=>{if(document.getElementById("cf-script")!==null||t.turnstile)return;t.onloadTurnstileCallback=e;let o=document.createElement("script");o.setAttribute("src","https://challenges.cloudflare.com/turnstile/v0/api.js?onload=onloadTurnstileCallback&render=explicit"),o.setAttribute("id","cf-script"),o.setAttribute("async","true"),document.body.appendChild(o)},[]),_1(P1,{})},lp=T1;var cp={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}};var dp={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]},default:{http:["https://goerli-rollup.arbitrum.io/rpc"]},public:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"},default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var pp={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}};var up={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0};var mp={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{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"}},testnet:!0};var hp={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-goerli.blastapi.io"],webSocket:["wss://base-goerli.blastapi.io"]},default:{http:["https://goerli.base.org"]},public:{http:["https://goerli.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://goerli.basescan.org"},default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0};var fp={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1};var yp={id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0};var gp={id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}};var vp={id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}};var wp={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-goerli.g.alchemy.com/v2"],webSocket:["wss://eth-goerli.g.alchemy.com/v2"]},infura:{http:["https://goerli.infura.io/v3"],webSocket:["wss://goerli.infura.io/ws/v3"]},default:{http:["https://rpc.ankr.com/eth_goerli"]},public:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli.etherscan.io"},default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},testnet:!0};var Cp={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-mainnet.infura.io/v3"],webSocket:["wss://linea-mainnet.infura.io/ws/v3"]},default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1};var bp={id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0};var Ep={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}};var xp={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}};var Tp={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-goerli.g.alchemy.com/v2"],webSocket:["wss://opt-goerli.g.alchemy.com/v2"]},infura:{http:["https://optimism-goerli.infura.io/v3"],webSocket:["wss://optimism-goerli.infura.io/ws/v3"]},default:{http:["https://goerli.optimism.io"]},public:{http:["https://goerli.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"},default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0};var Pp={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0};var Ir=[cp,dp,wp,Pp,Ep,xp,Tp,Sr,Ar,fp,yp,gp,vp,mp,hp,Cp,bp,pp,up],_p=new Set(Ir.map(e=>e.id));import So from"tinycolor2";var Sp="#FFFFFF",S1="#000000",A1=Sp,k1="#1E1E1D";function R1(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"}function ro(e,t){let o=Math.max(0,Math.min(1,e.toHsl().l+t));return So({...e.toHsl(),l:o})}function Ap({backgroundTheme:e,accentHex:t,successHex:o="#51BA81",warnHex:r="#FFB74D",errorHex:n="#EC6351",whiteHex:i=Sp,blackHex:a=S1}){let l;switch(e){case"light":l=A1;break;case"dark":l=k1;break;default:l=e;break}let s=So(l),c=So(t),w=So(o),m=So(r),b=So(n),h=R1(s.getLuminance()),C=ro(s,h==="light"?-.04:.11),E=ro(s,h==="light"?-.88:.87),y=ro(s,h==="light"?-.77:.75),P=ro(s,h==="light"?-.43:.45).desaturate(h==="light"?60:20),T=ro(s,h==="light"?-.08:.25).desaturate(h==="light"?60:20),W=ro(c,.15),N=ro(c,-.06),A=So(c.getLuminance()>.5?a:i),I=ro(w,-.16);return{colorScheme:h,background:s.toHslString(),background2:C.toHslString(),foreground:E.toHslString(),foreground2:y.toHslString(),foreground3:P.toHslString(),foreground4:T.toHslString(),accent:c.toHslString(),accentLight:W.toHslString(),accentDark:N.toHslString(),foregroundAccent:A.toHslString(),success:w.toHslString(),successDark:I.toHslString(),error:b.toHslString(),warn:m.toHslString()}}var no={appearance:{theme:"light",accentColor:"#676FFF"},walletConnectCloudProjectId:gs,rpcConfig:{rpcUrls:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};function ri(e,t){let o=["google","twitter","discord","tiktok","linkedin","github","apple"],r=t?.loginMethods?.filter(P=>o.includes(P)),n=r?.slice(0,5),i,a,l,s,c,w,m,b,h,C;if(t?.loginMethods?(i=t.loginMethods.includes("email"),a=t.loginMethods.includes("sms"),l=t.loginMethods.includes("wallet"),s=n?.includes("google"),c=n?.includes("twitter"),w=n?.includes("discord"),m=n?.includes("tiktok"),h=n?.includes("github"),b=n?.includes("linkedin"),C=n?.includes("apple")):(i=e.emailAuth,a=e.smsAuth,l=e.walletAuth,s=e.googleOAuth,c=e.twitterOAuth,w=e.discordOAuth,h=e.githubOAuth,m=e.tiktokOAuth,b=e.linkedinOAuth,C=e.appleOAuth),i&&a&&(console.warn("Enabling both email and SMS passwordless is not currently supported. Disabling SMS."),a=!1),!i&&!a&&[s,c,w,h,m,b,C].some(P=>P))throw new Error("To enable social logins you must also enable either SMS or Email login");if(![i,a,l,s,c,w,h,m,b,C].some(P=>P))throw new Error("You must enable at least one login method");r&&r.length>5&&console.warn("Max number of social logins allowed is 5. Any more have been removed.");let E=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1;return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:Ap({backgroundTheme:t?.appearance?.theme??no.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??no.appearance.accentColor}),showWalletLoginFirst:t?.appearance?.showWalletLoginFirst??e.showWalletLoginFirst},loginMethods:{wallet:l,email:i,sms:a,google:s,twitter:c,discord:w,github:h,tiktok:m,linkedin:b,apple:C},legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??no.walletConnectCloudProjectId,rpcConfig:t?.rpcConfig??no.rpcConfig,chains:I1(t?.additionalChains),captchaEnabled:e.captchaEnabled??no.captchaEnabled,embeddedWallets:{...e.embeddedWalletConfig,...E?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1,noPromptOnSignature:!0}:{},...t?.embeddedWallets},customAuth:E?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??no.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??no._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??no._render.inParentNodeId}}}function kp(e,t){return e?.appearance?.logo&&typeof e.appearance.logo=="object"&&(e.appearance.logo="component"),{...e,legacyCreateEmbeddedWalletFlag:t}}function I1(e){return!e||e.length===0?Ir.map(o=>o):Ir.concat(e.filter(o=>!_p.has(o.id)))}import{useRef as W1,useEffect as N1}from"react";var ni=class{constructor(){this.callbacks={}}enqueue(t,o){this.callbacks[t]=o}dequeue(t,o){let r=this.callbacks[o];if(!r)throw new Error(`cannot dequeue ${t} event: no event found for id ${o}`);switch(delete this.callbacks[o],t){case"privy:iframe:ready":return r;case"privy:wallet:create":return r;case"privy:wallet:connect":return r;case"privy:wallet:recover":return r;case"privy:wallet:rpc":return r;case"privy:wallet:set-recovery-password":return r;default:throw new Error(`invalid wallet event type ${t}`)}}};import{jsx as F1}from"react/jsx-runtime";var L1=function(e){return()=>`id-${e++}`}(0);function O1(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function rr(e){return e.error!==void 0}var Ao=new ni,Da=new Map,M1=(e,t)=>typeof t=="bigint"?t.toString():t,D1=(e,t)=>`${e}${JSON.stringify(t,M1)}`;function nr(e,t,o){let r=o.contentWindow;if(!r)throw new Error("iframe not initialized");let n=D1(e,t);if(e==="privy:wallet:create"){let a=Da.get(n);if(a)return a}let i=new Promise((a,l)=>{let s=L1();Ao.enqueue(s,{resolve:a,reject:l}),r.postMessage({id:s,event:e,data:t},"*")}).finally(()=>{Da.delete(n)});return Da.set(n,i),i}function U1(e){switch(e.event){case"privy:iframe:ready":let t=Ao.dequeue(e.event,e.id);return rr(e)?t.reject(new At(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let o=Ao.dequeue(e.event,e.id);return rr(e)?o.reject(new At(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let r=Ao.dequeue(e.event,e.id);return rr(e)?r.reject(new At(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:recover":let n=Ao.dequeue(e.event,e.id);return rr(e)?n.reject(new At(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=Ao.dequeue(e.event,e.id);return rr(e)?i.reject(new At(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=Ao.dequeue(e.event,e.id);return rr(e)?a.reject(new At(e.error.type,e.error.message)):a.resolve(e.data);default:console.warn("Unsupported wallet proxy method:",e)}}function Rp(e){let t=W1(null);return N1(()=>{let o=t.current;if(!o)return;function r(s){s&&s.origin===e.origin&&O1(s.data)&&U1(s.data)}let n={create(s){return nr("privy:wallet:create",s,o)},connect(s){return nr("privy:wallet:connect",s,o)},recover(s){return nr("privy:wallet:recover",s,o)},rpc(s){return nr("privy:wallet:rpc",s,o)},setRecoveryPassword(s){return nr("privy:wallet:set-recovery-password",s,o)}};window.addEventListener("message",r);let i=()=>e.onLoad(n),a=(...s)=>{console.warn("Privy iframe failed to load: ",...s),e.onLoadFailed()},l=new AbortController;return ks(()=>nr("privy:iframe:ready",{},o),{abortSignal:l.signal}).then(i,a),()=>{window.removeEventListener("message",r),l.abort()}},[t.current]),F1("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},src:jr(e.origin,`/apps/${e.appId}/embedded-wallets`)})}import{createContext as B1,useContext as H1,useEffect as G1}from"react";var Ip={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]}},Ua=B1(void 0),z1=()=>H1(Ua);function io(e,t){if(!t)return;let r=z1().current[e];return G1(()=>{for(let[n,i]of Object.entries(t))r.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),r[n]?.push(i);return()=>{for(let[n,i]of Object.entries(t))r.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),r[n]=r[n]?.filter(a=>a!==i)}},[t])}function le(e,t,o,...r){for(let n of e.current[t][o])n(...r)}import{jsx as ao,jsxs as Np}from"react/jsx-runtime";function q1(e){return typeof e=="string"&&e.length===25}var Wr;function _t(){if(!Wr){let e=V.get(Oo);return Promise.resolve(e||null)}return Wr.getAccessToken()}var Lp,Os=(e,t)=>Lp(e,t),Op,Ms=(e,t)=>Op(e,t),Mp,Ds=()=>Mp(),j1=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;V.put(lr,t);let o=new URL(window.location.href);o.searchParams.delete("privy_token"),window.history.pushState({},"",o)},K1=({config:e,...t})=>{if(!q1(t.appId))throw new v("Cannot initialize the Privy provider with an invalid Privy app ID");Wr||(Wr=new yr({appId:t.appId,apiUrl:t.apiUrl||Hr}));let o=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&o.embeddedWallets?.createOnLogin===void 0&&(o.embeddedWallets||(o.embeddedWallets={}),o.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),ao(Y1,{...t,config:o,client:Wr})},Y1=e=>{let t=e.client,[o,r]=Q(!1),[n,i]=Q(!1),[a,l]=Q(!1),[s,c]=Q(null),[w,m]=Q(!1),[b,h]=Q([]),C=Wp(b),[E,y]=Q(!1),[P,T]=Q(null),[W,N]=Q(!1),[A,I]=Q({status:"disconnected",connectError:null,connector:null,connectRetry:x}),[D,ce]=Q(null),[H,j]=Q(null),[G,X]=Q({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",requireUserPasswordOnCreate:!1},fiatOnRampEnabled:!1,captchaEnabled:!1}),[M,de]=Q(()=>{let d=kp(e.config,e.createPrivyWalletOnLogin);return t.createAnalyticsEvent("sdk_initialize",d),ri(G,e.config)}),[z,ee]=Q(!0),[Fe,F]=Q({}),[Et,Ce]=Q(null),[ir,so]=Q(null),[Nr,ai]=Q(!1),[ar,Ot]=Q(),[nt,ne]=Q(),[Be,lo]=Q(),[ko,Ba]=Q(!1),ie=Wp(Ip),Se=d=>{d&&T(d),r(!0),t.createAnalyticsEvent("modal_open",{initialScreen:d})},Lr=d=>{M.embeddedWallets.createOnLogin!=="off"&&ee(!0),Se(d)};bt(()=>{if(!H||!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClient==="privy");if(d&&d.length>0){let p=d[0].address;t.connectors?.addEmbeddedWalletConnector(H,p)}},[H,s]),bt(()=>{H&&ir?.(H)},[H]),bt(()=>{(async()=>{if(!M.customAuth?.enabled)return;ee(!0);let{getCustomAccessToken:p,isLoading:u}=M.customAuth;if(!(!n||u))try{let f=await p();if(!f){await Ro.logout();return}if(a)return;t.startAuthFlow(new No(f));let{user:L,isNewUser:he}=await t.authenticate();L||await Ro.logout(),c(L||null),y(he||!1),l(!0),Ba(!0)}catch(f){console.warn(f),a&&await Ro.logout()}})()},[M.customAuth?.enabled,M.customAuth?.getCustomAccessToken,M.customAuth?.isLoading,n,a]),bt(()=>{ko&&H&&s&&Ft(s,e.config?.embeddedWallets?.createOnLogin)&&(Ba(!1),Va(s,3e4).catch(console.error))},[ko&&H&&s]),bt(()=>{async function d(){let p=await t.getServerConfig();X(p);let u=ri(p,e.config);de(u),p.customApiUrl&&t.updateApiUrl(p.customApiUrl),t.initializeConnectorManager(u.walletConnectCloudProjectId,u.rpcConfig,u.chains),t.connectors?.initialize();let f=Dp();j1();let L=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!L),L&&le(ie,"login","onComplete",L,!1,!0),c(L)),f||(i(!0),Et?.()),f&&L&&m(!0),Up()}n||d()},[t,Et,n]),bt(()=>{let d=ri(G,e.config);de(d)},[e.config]);let Dp=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_oauth_code"),u=d.get("privy_oauth_state"),f=d.get("privy_oauth_provider");return p&&u&&f?(t.startAuthFlow(new Ut(f,p,u)),Lr("AWAITING_OAUTH_SCREEN"),F({finishOauthFlow:{onComplete:()=>{i(!0),Et?.()}}}),!0):!1},si=async(d,p,u)=>{let f=await t.connectors?.createWalletConnector(d,p)||null;Ha(f,u)};async function Ha(d,p){if(!d)return I({status:"disconnected",connectError:new U("Unable to connect to wallet."),connector:null,connectRetry:x}),p?.(null);I({connector:d,status:"connecting",connectError:null,connectRetry:()=>Ha(d,p)});try{let u=await d.connect({showPrompt:!0});return I(f=>({...f,status:"connected",connectError:null,connectRetry:x})),u&&!W&&le(ie,"connectWallet","onSuccess",u),p?.(u)}catch(u){return u instanceof Qe?(console.warn(u.cause?u.cause:u.message),W||le(ie,"connectWallet","onError",u.privyErrorCode||"generic_connect_wallet_error")):(console.warn(u),W||le(ie,"connectWallet","onError","unknown_connect_wallet_error")),I(f=>({...f,status:"disconnected",connectError:u})),p?.(null)}}let li=d=>{d!==null&&t.startAuthFlow(new po(d))},Up=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),u=d.get("privy_wallet_client");if(!p||!u)return;if(u==="phantom"&&!Ve()&&Lr("LOGIN_FAILED_SCREEN"),!t.connectors)throw new v("Connector not initialized");Se("AWAITING_CONNECTION");let f=new URL(window.location.href);f.searchParams.delete("privy_connector"),f.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",f),si(p,u,li)};bt(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let Ga=()=>{m(!0),Se("LINK_WALLET_SCREEN")},Fp=d=>{if(!a||!s)return!1;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address)return!0;return!1},Bp=async d=>{if(!t.connectors)throw new v("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;I(u=>({...u,connector:p,status:"connected",connectError:null,connectRetry:x})),li(d),Lr("AWAITING_CONNECTION")},Hp=async(d,p)=>{if(!t.connectors)throw new v("Connector not initialized");await si(d,p,li)},za=async(d,p)=>{if(!M.fiatOnRamp.enabled)throw new v("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:u,externalTransactionId:f}=await gc(t,d,p?.config??{},M.appearance.palette,M.fiatOnRamp.useSandbox);return{signedUrl:u,externalTransactionId:f}}else throw new v("Unsupported fund provider. Currently supported option is `moonpay`.")},Or=()=>{h(d=>{let p=t.connectors?.wallets.map(u=>({...u,linked:Fp(u),loginOrLink:async()=>{if(!await u.isConnected())throw new v("Wallet is not connected");if(u.connectorType==="embedded"&&u.walletClientType==="privy")throw new v("Cannot link or login with embedded wallet");Bp(u)},fund:async f=>{let{signedUrl:L,externalTransactionId:he}=await za(u.address,f);F({fiatOnRampPrompt:{signedUrl:L},fiatOnRampStatus:{externalTransactionId:he}}),Se("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new v("User is not authenticated.");if(u.connectorType==="embedded"&&u.walletClientType==="privy")throw new v("Cannot unlink an embedded wallet");let f=await t.unlinkWallet(u.address);c(f)}}))||[];return Jr(d,p)?d:p})};bt(()=>{Or()},[s?.linkedAccounts,a,n]),bt(()=>{if(n){if(!t.connectors)throw new v("Connector not initialized");Or(),t.connectors.on("walletsUpdated",Or)}},[n]);let Gp=()=>{Se(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};bt(()=>{if(!b[0])return;let d=b[0],p=C.current.find(f=>f.address===d.address),u=s?.linkedAccounts.find(f=>f.type==="wallet"&&f.address===d.address);if(!p&&u){let f=Object.assign({},s);f.wallet=u&&{address:u.address,chainType:u.chainType,chainId:u.chainId,walletClient:u.walletClient,walletClientType:u.walletClientType,connectorType:u.connectorType},c(f)}C.current=b},[b]);let Va=async(d,p)=>{if(Y(d))throw le(ie,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[f,L]=await Promise.all([Le.initializeWalletProxy(p),_t()]);if(!f&&e.config?.customAuth?.enabled)throw le(ie,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!f||!L||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((he,xe)=>{ee(!0),F({createWallet:{onSuccess:it=>{le(ie,"createWallet","onSuccess",it),he(it)},onFailure:it=>{le(ie,"createWallet","onError","unknown_embedded_wallet_error"),xe(it)},callAuthOnSuccessOnClose:!1}}),Se("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await f.create({accessToken:L});let he=await Le.refreshUser(),xe=Y(he);if(!xe)throw le(ie,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return le(ie,"createWallet","onSuccess",xe),xe}},Ro={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:Gp,linkWallet:Ga,linkEmail:()=>{if(s?.email)throw new v("User already has an email linked to their account.");m(!0),Se("LINK_EMAIL_SCREEN")},linkPhone:()=>{if(s?.phone)throw new v("User already has a phone number linked to their account.");m(!0),Se("LINK_PHONE_SCREEN")},linkGoogle:async()=>{if(s?.google)throw new v("User already has a Google account linked to their account.");await Le.initLoginWithOAuth("google")},linkTwitter:async()=>{if(s?.twitter)throw new v("User already has a Twitter account linked to their account.");await Le.initLoginWithOAuth("twitter")},linkDiscord:async()=>{if(s?.discord)throw new v("User already has a Discord account linked to their account.");await Le.initLoginWithOAuth("discord")},linkGithub:async()=>{if(s?.github)throw new v("User already has a Github account linked to their account.");await Le.initLoginWithOAuth("github")},linkTiktok:async()=>{if(s?.tiktok)throw new v("User already has a Tiktok account linked to their account.");await Le.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{if(s?.linkedin)throw new v("User already has a LinkedIn account linked to their account.");await Le.initLoginWithOAuth("linkedin")},linkApple:async()=>{await Le.initLoginWithOAuth("apple")},login:async()=>{if(n||(await new Promise(d=>{Ce(()=>d)}),Ce(null)),a){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}N(!0),Lr()},logout:async()=>{await t.logout(),c(null),l(!1),T(null),le(ie,"logout","onSuccess"),m(!1),r(!1),V.del(cr)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new Z;let d=b.find(u=>s.wallet&&u.address===s.wallet.address),p=t.connectors?.walletConnectors.find(u=>u.wallets.find(f=>f.address===d?.address));return!d||!p?new Z:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new Fa(new pt(new Z));let d=b.find(u=>s.wallet&&u.address===s.wallet.address),p=t.connectors?.walletConnectors.find(u=>u.wallets.find(f=>f.address===d?.address));return!d||!p?new Fa(new pt(new Z)):new Fa(new pt(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Gt(new Z);let d=b.find(u=>s.wallet&&u.address===s.wallet.address),p=t.connectors?.walletConnectors.find(u=>u.wallets.find(f=>f.address===d?.address));return!d||!p?new Gt(new Z):new Gt(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return c(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return c(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return c(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return c(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return c(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return c(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return c(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return c(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return c(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},setActiveWallet:async d=>{let p=b.find(f=>ii(f.address)===ii(d)),u=s?.linkedAccounts.find(f=>f.type==="wallet"&&ii(f.address)===ii(d));if(!p||!await p.isConnected())ce(d),Ga();else if(!p.linked)p.loginOrLink();else{let f=Object.assign({},s);f.wallet=u&&{address:u.address,chainType:u.chainType,chainId:u.chainId,walletClient:u.walletClient,walletClientType:u.walletClientType,connectorType:u.connectorType},c(f)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw le(ie,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return Va(s,15e3)},setWalletPassword:()=>new Promise((d,p)=>{if(!a||!s){p(new Error("User must be authenticated before adding password to Privy wallet"));return}let u=Y(s);if(!u||!H){p(new Error("Must have a Privy wallet to add a password"));return}if(u.recoveryMethod==="user-passcode"){p(new Error("Cannot set password. Embedded wallet already has a password."));return}ee(!0);let f={onSuccess:d,onFailure:p,callAuthOnSuccessOnClose:!1},L={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:p};F({setWalletPassword:f,connectWallet:L}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")}),signMessage:(d,p)=>new Promise(async(u,f)=>{if(!a||!s){f(new Error("User must be authenticated before signing with a Privy wallet"));return}let L=Y(s);if(!L){f(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){f(new Error("Message must be a non-empty string"));return}ee(!0);let he=async()=>{if(!a)return f(new Error("User must be authenticated before signing with a Privy wallet")),null;let xe=await _t();if(H&&xe)try{if(!await Le.recoverEmbeddedWallet())return f(new Error("Unable to connect to wallet")),null;t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:L.address});let{response:it}=await H.rpc({accessToken:xe,address:L.address,request:{method:"personal_sign",params:[d,L.address]}}),Mt=it.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:L.address}),Mt}catch(xt){return f(xt),null}else return null};if(M.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");let xe=await he();xe?u(xe):f(new Te("Unable to sign message"))}else{let it={message:d,confirmAndSignMessage:he,onSuccess:Dt=>{u(Dt)},onFailure:Dt=>{f(Dt)},uiOptions:p||{}},Mt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:f};F({signMessage:it,connectWallet:Mt}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:(d,p,u)=>new Promise(async(f,L)=>{if(!a||!s){L(new Error("User must be authenticated before signing with a Privy wallet"));return}let he=Y(s);if(!he){L(new Error("Must have a Privy wallet before signing"));return}ee(!0);let xe=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,xt=Object.assign({},d,{chainId:d.chainId||xe.chainId}),it=async()=>{let Mt=await _t();if(!Mt||!H){L(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await Le.recoverEmbeddedWallet()){L(new Error("Unable to connect to wallet"));return}let $a=new V1(Xe(xt.chainId,M.chains,M.rpcConfig)),Vp=await Qn(he.address,xt,$a),$p=await Zn(Mt,he.address,H,Vp,$a);f($p)}catch(Dt){L(Dt)}};if(M.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),it();else{let Mt={transactionRequest:xt,onSuccess:f,onFailure:L,uiOptions:p||{},fundWalletConfig:u},Dt={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:L};F({connectWallet:Dt,sendTransaction:Mt}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),exportWallet:()=>new Promise((d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!Y(s)){p(new Error("Must have a Privy wallet before exporting"));return}ee(!0);let f={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},L={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};F({keyExport:L,connectWallet:f}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")})};Lp=Ro.signMessage,Op=Ro.sendTransaction;let Le=(()=>({isNewUserThisSession:E,isLinking:w,linkingHint:D,walletConnectionStatus:A,rpcConfig:M.rpcConfig,chains:M.chains,nativeTokenSymbolForChainId:d=>M.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,captchaData:{ready:Nr,enabled:M.captchaEnabled,execute:()=>{let d=window.turnstile;if(!d)return;let p=d.render("#cf-turnstile",{sitekey:vs,action:M.id,callback:Ot,"error-callback":ne,"expired-callback":()=>{try{d.reset(Be),ne(void 0),Ot(void 0)}catch{ne("expired_and_failed_reset")}},"unsupported-callback":()=>{console.warn("Browser does not support Turnstile.")}});p||console.warn("Failed to render challenge."),lo(p)},remove:()=>{let d=window.turnstile;!d?.remove||!Be||(d.remove(Be),lo(void 0),ne(void 0),Ot(void 0))},token:ar,error:nt},initializeWalletProxy:async d=>{if(H)return H;let p=new Promise(L=>{so(()=>he=>L(he))}),u=new Promise(L=>setTimeout(()=>L(null),d)),f=await Promise.race([p,u]);return so(null),f},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0})=>{let p=n&&a&&s;d.shouldCallAuthOnSuccess&&p?(le(ie,"login","onComplete",s,E,!1),e.onSuccess?.(s,E)):W&&le(ie,"login","onError","exited_auth_flow"),t.authFlow=void 0,ce(null),T(null),N(!1),m(!1),y(!1),r(!1),t.createAnalyticsEvent("modal_closed")},connectWallet:si,initLoginWithWallet:Hp,loginWithWallet:async()=>{if(!n)throw new sr;if(!(t.authFlow instanceof po))throw new v("Must initialize SIWE flow first.");let d,p;if(a)d=await t.link();else try{({user:d,isNewUser:p}=await t.authenticate())}catch(u){throw le(ie,"login","onError",u.privyErrorCode||"generic_connect_wallet_error"),u}c(d||s||null),y(p||!1),l(!0)},initLoginWithOAuth:async d=>{t.startAuthFlow(new Ut(d));let p=await t.authFlow.getAuthorizationUrl();p&&p.url&&window.location.assign(p.url)},loginWithOAuth:async()=>{if(!(t.authFlow instanceof Ut))throw new v("Must initialize OAuth flow before calling loginWithOAuth");let d,p;if(a)d=await t.link();else try{({user:d,isNewUser:p}=await t.authenticate())}catch(u){throw le(ie,"login","onError",u.privyErrorCode||"unknown_auth_error"),u}c(d),y(p||!1),l(!0)},initLoginWithEmail:async(d,p)=>{let u=new co(d,p);t.startAuthFlow(u);try{await u.sendCodeEmail()}catch(f){throw le(ie,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}},initLoginWithSms:async(d,p)=>{let u=new uo(d,p);t.startAuthFlow(u);try{await u.sendSmsCode()}catch(f){throw le(ie,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(!n)throw new sr;if(t.authFlow instanceof co)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof uo)t.authFlow.meta.smsCode=d.trim();else throw new v("Must initialize a passwordless code flow first");let p,u;a?p=await t.link():{user:p,isNewUser:u}=await t.authenticate(),c(p||s||null),y(u||!1),l(!0)},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:H,createAnalyticsEvent:(d,p,u)=>t.createAnalyticsEvent(d,p,u),getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let u=s?.linkedAccounts.find(L=>L.type==="wallet"&&L.walletClientType==="privy"),f=await _t();if(!f||!H||!u){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}ee(!0);try{await H.connect({accessToken:f,address:u.address}),d(!0)}catch(L){Vo(L)&&u.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:u.address}),(await H.recover({address:u.address,accessToken:f})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:u.address}),d(!0)):Vo(L)?(F({recoverWallet:{privyWallet:u,onFailure:p,onSuccess:()=>d(!0)}}),Se("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(L)}}),getFiatOnRampConfig:za,updateWallets:()=>Or()}))();Mp=Le.recoverEmbeddedWallet;let zp=$1(()=>({wallets:b}),[b]);return ao(tt.Provider,{value:Ro,children:ao(Ua.Provider,{value:ie,children:Np(Ia.Provider,{value:zp,children:[e.children,Np(Pi.Provider,{value:Le,children:[ao(rp,{theme:{...M.appearance.palette||{}}}),ao(Vs,{appConfig:M,data:Fe,setModalData:F,setInitialScreen:T,initialScreen:P,visible:o,authenticated:a,children:o?ao(sp,{}):null}),z&&G.id?ao(Rp,{appId:e.appId,origin:t.apiUrl,onLoad:j,onLoadFailed:()=>null}):null]}),M.captchaEnabled&&ao(lp,{onLoad:()=>ai(!0)})]})})})};import{useContext as J1}from"react";function Q1(e){let{login:t}=J1(tt);return io("login",e),{login:t}}import{useContext as Z1}from"react";function X1(e){let{logout:t}=Z1(tt);return io("logout",e),{logout:t}}import{useContext as ev}from"react";function tv(e){let{connectWallet:t}=ev(tt);return io("connectWallet",e),{connectWallet:t}}import{useContext as ov}from"react";function rv(e){let{createWallet:t}=ov(tt);return io("createWallet",e),{createWallet:t}}export{pt as AsExternalProvider,hr as ConnectorManager,yr as PrivyClient,K1 as PrivyProvider,Z as PrivyProxyProvider,Ir as SUPPORTED_CHAINS,ci as VERSION,Me as WalletConnector,_t as getAccessToken,tv as useConnectWallet,rv as useCreateWallet,Q1 as useLogin,X1 as useLogout,$ as usePrivy,Wa as useWallets};
|