@privy-io/react-auth 1.39.0 → 1.40.0-beta-20230919233542
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 +346 -199
- package/dist/index.d.ts +21 -5
- package/dist/index.js +346 -199
- package/package.json +5 -2
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{getAddress as
|
|
1
|
+
import{getAddress as ri}from"@ethersproject/address";import{StaticJsonRpcProvider as X1,Web3Provider as Fa}from"@ethersproject/providers";import{useEffect as Ct,useMemo as ev,useRef as kp,useState as Q}from"react";import{FetchError as $p}from"ofetch";var Ke=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}]`:""}`}},ko=class extends Ke{constructor(o,r,n,i,a){super(n,i,a);this.type=o;this.status=r}},C=class extends Ke{constructor(o,r,n){super(o,r,n);this.type="client_error"}},Ur=class extends C{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var B=class extends Ke{constructor(o,r,n){super(o,r,n);this.type="connector_error"}},oe=e=>{if(e instanceof Ke)return e;if(!(e instanceof $p))return We(e);if(!e.response)return new ko("api_error",null,e.message,e);let{type:t,message:o,error:r,code:n}=e.data;return new ko(t||"ApiError",e.response.status,o||r,e,n)},We=e=>e instanceof Ke?e:e instanceof Error?new C(e.message,e):new C(`Internal error: ${e}`);var sr=class extends C{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},nt=class extends C{constructor(t="Embedded wallet error",o){super(t,o,"unknown_embedded_wallet_error")}},Fr=class extends C{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}},Wo=class extends C{constructor(){super("User attempted to exit password dialog before confirming password",void 0,"embedded_wallet_password_unconfirmed")}};var Br=()=>"/api/v1/sessions",qa=()=>"/api/v1/sessions/logout",ja=()=>"/api/v1/sessions/fork",Hr=()=>"/api/v1/sessions/fork/recover",Ka=()=>"/api/v1/siwe/init",Ya=()=>"/api/v1/siwe/authenticate",Ja=()=>"/api/v1/siwe/link",Qa=()=>"/api/v1/passwordless/init",Za=()=>"/api/v1/passwordless/authenticate",Xa=()=>"/api/v1/passwordless/link",es=()=>"/api/v1/passwordless_sms/init",ts=()=>"/api/v1/passwordless_sms/authenticate",os=()=>"/api/v1/passwordless_sms/link",rs=()=>"/api/v1/oauth/init",ns=()=>"/api/v1/oauth/authenticate",is=()=>"/api/v1/oauth/link",as=()=>"/api/v1/siwe/unlink",ss=()=>"/api/v1/passwordless/unlink",ls=()=>"/api/v1/passwordless_sms/unlink",cs=()=>"/api/v1/oauth/unlink",ds=()=>"/api/v1/analytics_events",ps=()=>"/api/v1/plugins/moonpay_on_ramp/sign",us=()=>"/api/v1/custom_jwt_account/authenticate";var Io=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{let t=us(),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 oe(t)}}async link(){throw new Error("Unimplemented")}};var lo=class{constructor(t,o){this.meta={email:t,captchaToken:o}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=Za(),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 oe(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=Xa();return await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw oe(t)}}async sendCodeEmail(t,o){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.email=t),o&&(this.meta.captchaToken=o),!this.meta.email)throw new C("Email must be set when initialzing authentication.");try{let r=Qa();return await this.api.post(r,{email:this.meta.email,token:this.meta.captchaToken})}catch(r){throw oe(r)}}};var Ot=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 C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");try{let t=ns(),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=oe(t);throw o.privyErrorCode?new C(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new C("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new C("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");try{let t=is();return await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})}catch(t){throw oe(t)}}async getAuthorizationUrl(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.provider)throw new C("Provider must be set when initialzing OAuth authentication.");try{let t=rs();return await this.api.post(t,{provider:this.meta.provider,redirect_to:window.location.href},{baseURL:this.api?.fallbackApiUrl})}catch(t){throw oe(t)}}};var Fe=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 co=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}
|
|
@@ -9,7 +9,7 @@ Chain ID: ${t}
|
|
|
9
9
|
Nonce: ${a}
|
|
10
10
|
Issued At: ${i}
|
|
11
11
|
Resources:
|
|
12
|
-
- https://privy.io`;this.getNonceOnce=new Ue(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 E("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(Ga(),{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 X(t)}}async link(){if(!this.api)throw new E("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 X(t)}}async sign(){if(!this.api)throw new E("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new E("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 E("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(Ha(),{address:t})).nonce}async buildSiweMessage(){if(!this.api)throw new E("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 lo=class{constructor(t,o){this.meta={phoneNumber:t,captchaToken:o}}async authenticate(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new E("phone number and sms code must be set prior to calling authenticate.");try{let t=Ka(),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 X(t)}}async link(){if(!this.api)throw new E("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new E("phone number and sms code must be set prior to calling authenticate.");try{let t=Ya();return await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw X(t)}}async sendSmsCode(t,o){if(!this.api)throw new E("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),o&&(this.meta.captchaToken=o),!this.meta.phoneNumber)throw new E("phone nNumber must be set when initialzing authentication.");try{let r=ja();return await this.api.post(r,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(r){throw X(r)}}};import{v4 as mu}from"uuid";function tt(e){return new Date(e*1e3)}function _p(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:tt(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:tt(o.verified_at)};t.push(i);break;case"phone":let a={number:o.phoneNumber,type:o.type,verifiedAt:tt(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:tt(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:tt(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:tt(o.verified_at)};t.push(c);break;case"github_oauth":let _={subject:o.subject,username:o.username,name:o.name,email:o.email,type:o.type,verifiedAt:tt(o.verified_at)};t.push(_);break;case"apple_oauth":let m={subject:o.subject,email:o.email,type:o.type,verifiedAt:tt(o.verified_at)};t.push(m);break;case"custom_auth":t.push({type:o.type,customUserId:o.custom_user_id,verifiedAt:tt(o.verified_at)});break;default:console.warn(`Unrecognized account type: ${r}. Please consider upgrading the Privy SDK.`)}}return t}function Mt(e,t){return e.sort((o,r)=>r.verifiedAt.getTime()-o.verifiedAt.getTime()),e.find(o=>o.type===t)}var K=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClient==="privy"),Sp=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Ot=(e,t)=>t==="all-users"&&!K(e)||t==="users-without-wallets"&&!Sp(e)?.length;function Ct(e){if(!e)return null;let t=_p(e.linked_accounts),o=Mt(t,"wallet"),r=Mt(t,"email"),n=Mt(t,"phone"),i=Mt(t,"google_oauth"),a=Mt(t,"twitter_oauth"),l=Mt(t,"discord_oauth"),s=Mt(t,"github_oauth"),c=Mt(t,"apple_oauth");return{id:e.id,createdAt:tt(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},apple:c&&{subject:c.subject,email:c.email}}}import{getAddress as zs}from"@ethersproject/address";import lu from"eventemitter3";var as="1.39.0";var Or="4df5e2316331463a9130964bd6078dfa",ss="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",ls="34357d3c125c2bcf2ce2bc3309d98715",cs="0x4AAAAAAAJFhr_rDU7HKpyw",Dr="https://auth.privy.io",ds=2e4,je=1400,ps=2500,oi=as;var Ro="privy:token",ri="privy-token",Ur="privy:refresh_token",ni="privy-refresh-token",us="privy-session",ar="privy:session_transfer_token",Rp="privy:wallet",ii=e=>`${Rp}:${e}`,ai="privy:connectors",si="privy:connections";var ot=1,Fr="0x1",ms="https://api.moonpay.com/v1",hs="https://api.moonpay.com/v1",fs="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",ys="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";var li=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)}},ci=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 kp(){return typeof window<"u"&&window.localStorage?new ci:new li}var q=kp();import{isPossiblePhoneNumber as Wp}from"libphonenumber-js/min";var Hr=()=>{let e=window;if(!e.ethereum)return!1;if(Br(window.ethereum,!0))return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(Br(t,!0))return!0}return!1},sr=()=>{let e=window;if(!e.ethereum)return!1;if(Br(window.ethereum,!1))return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(Br(t,!1))return!0}return!!window.ethereum.isZerion},Br=(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,Fe=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Gr=()=>{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 gs=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,}))$/),vs=e=>Wp(String(e),"US"),ws=(e,t)=>{let o=e.slice(0),r=[];for(;o.length;)r.push(o.splice(0,t));return r},Dt=(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}`},di=e=>new Promise(t=>setTimeout(t,e)),Cs=(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 di(o)}a||i(new Error("Exceeded max attempts before resolving function"))})},zr=(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 pi=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),lr=e=>typeof e=="string"?e:"0x"+e.toString(16);async function bs(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=[];Hr()&&i.push("metamask"),Fe()&&i.push("phantom"),o.ethereum&&o.ethereum.isBraveWallet&&i.push("brave"),r(i)}})}function Vr(e){return`eip155:${String(Number(e))}`}var Ke=(e,t,o)=>{let r=Number(e),n=t.find(a=>a.id===r);if(!n)throw new G(`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]+"/"+Or:n.rpcUrls.blast?.http[0]?i=n.rpcUrls.blast.http[0]+"/"+ss:i=n.rpcUrls.default?.http[0],!i)throw new G(`No RPC url found for ${e}`);return i};import Gp from"@coinbase/wallet-sdk";import{jsx as Es,jsxs as Ip}from"react/jsx-runtime";var rt=({style:e,...t})=>Ip("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:[Es("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Es("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 st}from"@ethersproject/address";import{Web3Provider as As}from"@ethersproject/providers";import{default as Bp}from"eventemitter3";import{StaticJsonRpcProvider as Ts}from"@ethersproject/providers";import Up from"eventemitter3";var Np=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],xs=e=>Np.includes(e);import{ErrorCode as Lp}from"@ethersproject/logger";var ko=class extends G{constructor(){super("Wallet timeout");this.type="wallet_error"}},Wo=class extends G{constructor(){super("User rejected connection");this.type="wallet_error"}},it=e=>{if(e instanceof G)return e;if(e?.code&&e?.reason){let t=new Ie(e);return e.code===Lp.ACTION_REJECTED&&(t.details=Se.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Ie(e):new G("Unknown connector error",e)},nt=class extends qe{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},Ie=class extends nt{constructor(o){let r=o;super(r.message,r.code,r.data);let n=Object.values(Se).find(i=>i.eipCode===r.code);this.details=n||Se.UNKNOWN_ERROR,r.code===-32002&&(r.message?.includes("already pending for origin")?r.message?.includes("wallet_requestPermissions")?this.details=Se.E32002_CONNECTION_ALREADY_PENDING:this.details=Se.E32002_REQUEST_ALREADY_PENDING:r.message?.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=Se.E32002_WALLET_LOCKED))}},Mp={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}},Op={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}},Dp={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}},Se={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Dp,...Op},bt={...Mp,...Se};var Fp=12e4,ui=(e=new ko,t=Fp)=>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 G(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),ui()]).catch(o=>{throw it(o)})}},Ut=class extends Error{constructor(o,r,n){super(o);this.code=r,this.data=n}},$r=class extends Up{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 Ts(Ke(a,this.chains,n))}async handleSendTransaction(o){if(!o.params||!Array.isArray(o.params))throw new Ut(`Invalid params for ${o.method}`,4200);let r=o.params[0];if(!await Et()||!this.address)throw new Ut("Disconnected",4900);return(await _s(r)).transactionHash}handleSwitchEthereumChain(o){if(!o.params||!Array.isArray(o.params))throw new Ut(`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 Ut(`Invalid params for ${o.method}`,4200);this.chainId=Number(r),this.provider=new Ts(Ke(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 Ps(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:lr(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 lr(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(xs(o.method)){let r=await Et();if(await Ss(),!r||!this.address)throw new Ut("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 Ut("Disconnected",4900)}}else return this.provider.send(o.method,o.params)}async connect(){let o=await Et();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}}},at=class extends Z{constructor(o){super(o)}},Ft=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 Hp=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Ne=class extends Bp{constructor(o,r){super();this.onAccountsChanged=o=>{o.length===0?this.onDisconnect():this.syncAccounts(o)};this.onChainChanged=o=>{this.wallets.forEach(r=>{r.chainId=Vr(o),this.walletClientType==="privy"&&q.put(ii(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=>st(i.address)===st(o));return{address:st(o),chainId:r,switchChain:async i=>{if(!n)throw new G("Wallet is not currently connected.");let a=this.wallets.find(m=>st(m.address)===st(o))?.chainId;if(!a)throw new G("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===Vr(l))return;let c=this.chains.find(m=>m.id===s);if(!c)throw new G(`Unsupported chainId: ${i}`);let _=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})};try{return await _()}catch(m){if(Hp(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??""]}]}),_();throw this.walletClientType==="rainbow"&&m.message?.includes("wallet_switchEthereumChain")?new G(`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 G("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await n())throw new G("Wallet is not currently connected.");return new As(new at(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await n())throw new G("Wallet is not currently connected.");return new Ft(this.proxyProvider)},sign:async i=>{if(!await n())throw new G("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=st(n),a=[],l;if(this.walletClientType==="privy"){l=q.get(ii(i))||Fr;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 ${Fr}`,c),l=Fr}let s=Vr(l);a.find(c=>st(c.address)===i)||a.push(this.buildConnectedWallet(st(n),s)),qr(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=>st(n)===st(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 As(new at(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 zp=e=>{let t=`https://mainnet.infura.io/v3/${Or}`,o=1;return e.makeWeb3Provider(t,o)},jr,Kr=class extends Ne{constructor(o){super("coinbase_wallet",o);this.connectorType="coinbase_wallet";this.proxyProvider=new Z,this.subscribeListeners(),jr||(jr=new Gp({appName:"Privy",darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(zp(jr)),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(){jr.disconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:rt}}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new G("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([o[0]])}catch(o){throw it(o)}}};import{jsx as Rs}from"react/jsx-runtime";var Io=({...e})=>Rs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Rs("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 Yr=class extends Ne{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:[lr(o?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Io}}disconnect(){this.connected=!1}async promptConnection(){}};import{getAddress as Iv}from"@ethersproject/address";import{Web3Provider as Lv}from"@ethersproject/providers";import{isMobile as $p}from"react-device-detect";import{jsx as Le,jsxs as Vp}from"react/jsx-runtime";var be=({style:e,...t})=>Vp("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:[Le("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),Le("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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 Jr=class extends Ne{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{!$p&&Hr()&&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 G("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw it(o)}}};import{jsx as ks,jsxs as qp}from"react/jsx-runtime";var Be=({style:e,...t})=>qp("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:[ks("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),ks("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 Qr=class extends Ne{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:Be}}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 G("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw it(o)}}};import{EthereumProvider as ru,OPTIONAL_EVENTS as nu,OPTIONAL_METHODS as iu}from"@walletconnect/ethereum-provider";import fi from"@walletconnect/qrcode-modal";import{isAndroid as au,isMobile as su}from"react-device-detect";import{createContext as Kp,useContext as Yp,useEffect as mi,useRef as Jp,useState as Is}from"react";import{jsx as jp}from"react/jsx-runtime";function Ws(e){return jp("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 Qp,jsxs as Zp}from"react/jsx-runtime";var Ye="LANDING",Ns=Kp({ready:!1,app:null,currentScreen:Ye,lastScreen:Ye,navigate:T,navigateBack:T,resetNavigation:T,setModalData:T,onCloseRef:null}),Ls=e=>{let t=e.appConfig,o=e.authenticated,r=e.visible,[n,i]=Is(e.initialScreen||Ye),[a,l]=Is(e.initialScreen||Ye);mi(()=>{o||i(Ye)},[o]),mi(()=>{r||(l(Ye),i(Ye))},[r]),mi(()=>{e.initialScreen&&n===Ye&&(i(e.initialScreen),l(e.initialScreen))},[e.initialScreen]);let s=e.initialScreen&&n===Ye?e.initialScreen:n,c=Jp(null),_={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(Ye),i(Ye)},onCloseRef:c};return Zp(Ns.Provider,{value:_,children:[(typeof t?.appearance?.logo=="string"||t?.appearance?.logo?.type==="img")&&Qp(Ws,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},v=()=>Yp(Ns);import{jsx as No,jsxs as Xp}from"react/jsx-runtime";var Lo=({style:e,...t})=>{let{app:o}=v();return Xp("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:[No("rect",{width:"28",height:"28",rx:"3",fill:o?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),No("g",{clipPath:"url(#clip0_1765_9946)",children:No("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"})}),No("defs",{children:No("clipPath",{id:"clip0_1765_9946",children:No("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};import{isAndroid as Os,isDesktop as eu,isMobileOnly as tu}from"react-device-detect";var Zr=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[o,r]of Object.entries(Ds))if(r.hostname===t)return{walletClientType:o,entry:r}};var Ds={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"}}},Us=(e,t="md")=>`https://registry.walletconnect.com/v2/logo/${t}/${e}`;function hi(e){return{name:e.displayName||"",universalLink:e.mobile.universal||"",deepLink:e.mobile.native||""}}function ou(e){let t="mobile";return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>hi(o))}function Fs(){return ou(Ds)}function Bs(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 Hs(e,t){return Os?e:Bs(e,hi(t))}var Gs="WALLETCONNECT_DEEPLINK_CHOICE";function Ms(e){let t=e.href.split("?")[0];q.put(Gs,{...e,href:t})}var cr=(e,t)=>{if(!e||eu){q.del(Gs);return}if(Os){Ms({name:"Unknown",href:t||"wc:"});return}else if(tu){let o=Bs(t||"wc:",hi(e));Ms({name:e?.displayName||"",href:o})}};var dr=class extends Ne{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=Zr(this.walletProvider.session?.peer.metadata.url);this.walletEntry=l?.entry,this.walletClientType=l?.walletClientType||"unknown",cr(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:Us(this.walletEntry.image_id)}:{name:pi(this.walletProvider.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider.session?.peer.metadata.icons?.[0]||Lo}}resetConnection(){this.walletProvider&&this.walletProvider.connected&&(this.walletProvider.signer.session=void 0,this.walletEntry=void 0,cr(void 0),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((o,r)=>{let n=()=>{r(new Wo)};this.onQrModalClosed=n,(async()=>{let a="",l=await Promise.race([this.walletProvider.enable(),ui()]);if(l.length>0&&(a=l[0]),!a||a==="")throw new G("Unable to retrieve address");if(this.walletProvider.session?.peer.metadata.url){let s=Zr(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(it(a));return}r(new G("Unknown error during connection"))}).finally(()=>fi.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=Ke(n.id,this.chains,this.rpcConfig);i&&(o[n.id]=i)}let r=await ru.init({projectId:this.walletConnectCloudProjectId,chains:[1],optionalChains:this.chains.map(n=>n.id),optionalEvents:nu,optionalMethods:iu,rpcMap:o,showQrModal:!1});return r.on("display_uri",n=>{if(au)window.open(n,"_self");else if(su&&this.walletEntry){cr(this.walletEntry,n);let a=Hs(n,this.walletEntry);window.open(a,"_self","noopener,noreferrer")}else fi.open(n,()=>{this.onQrModalClosed&&this.onQrModalClosed()},{mobileLinks:Fs().map(i=>i.name)})}),r.on("connect",()=>{if(fi.close(),r.session?.peer.metadata.url){let n=Zr(r.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown",cr(this.walletEntry)}}),r}async enableProvider(){return this.walletProvider.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider.enable()}};var yi=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(r=>r.type=="wallet"&&r.address===zs(t)).length:!1},pr=class extends lu{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||(q.get(ai)&&(q.getKeys().forEach(o=>{o.startsWith("walletconnect")&&q.del(o)}),q.del(ai)),bs().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}})),(Gr()||q.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 $r(o,r,this.rpcConfig,this.chains),a=new Yr(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 dr&&n.resetConnection(),n;let a=(()=>{switch(o){case"injected":switch(r){case"phantom":return Fe()?new Qr(this.chains):null;case"metamask":default:return sr()?new Jr(this.chains):null}case"coinbase_wallet":return new Kr(this.chains);case"wallet_connect_v2":return new dr(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=q.get(si);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}));q.put(si,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=zs(o),this.emit("walletsUpdated")}};function qr(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 cu}from"ofetch";var du=[Lr(),Mr()],pu=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal},Xr=class{constructor(t,o,r){this.appId=t,this.sdkVersion=oi,this.client=o,this.defaults=r,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=cu.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=!du.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=pu(this.defaults.timeout))},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new Nr}})}async get(t,o){try{return await this.baseFetch(t,o)}catch(r){throw X(r)}}async post(t,o,r){try{return await this.baseFetch(t,{method:"POST",...o?{body:o}:{},...r})}catch(n){throw X(n)}}async delete(t,o){try{return await this.baseFetch(t,{method:"DELETE",...o})}catch(r){throw X(r)}}};import ur from"js-cookie";function Vs(e){return e instanceof ao?"email":e instanceof lo?"sms":e instanceof so?"siwe":e instanceof So?"custom_auth":e instanceof Lt?e.meta.provider:null}import*as $s from"jose";var lt=class{static parse(t){try{return new lt(t)}catch{return null}}constructor(t){this.value=t,this._decoded=$s.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 uu=30,en=class{constructor(){this.authenticateOnce=new Ue(async t=>this._authenticate(t)),this.linkOnce=new Ue(async t=>this._link(t)),this.refreshOnce=new Ue(this._refresh.bind(this)),this.destroyOnce=new Ue(this._destroy.bind(this)),this.forkSessionOnce=new Ue(this._forkSession.bind(this))}get token(){try{let t=q.get(Ro);return typeof t=="string"?new lt(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=q.get(Ur);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=q.get(ar);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=ur.get(us);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=lt.parse(this.token);return t!==null&&!t.isExpired(uu)}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=Vs(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:Ct(n),isNewUser:i}}catch(o){throw console.warn("Error authenticating session"),We(o)}}async _link(t){try{let o=await t.link();return Ct(o)}catch(o){throw console.warn("Error linking account"),We(o)}}async _refresh(){if(!this.api)throw new E("Session has no API instance");if(!this.client)throw new E("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(Lr(),a,{headers:i}),r&&this.clearForkedToken()}else if(r)n=await this.api.post(Mr(),{refresh_token:r}),this.clearForkedToken();else return null;return this.storeToken(n.token),this.storeRefreshToken(n.refresh_token),Ct(n.user)}catch(n){if(n instanceof _o&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw We(n)}}async _destroy(){try{await this.api?.post(Fa(),{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new E("Session has no API instance");let t=this.refreshToken;try{let o=await this.api.post(Ba(),{refresh_token:t});return this.storeToken(o.token),this.storeRefreshToken(o.refresh_token),o.new_session_refresh_token}catch(o){throw We(o)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){if(q.put(Ro,t),!this.client?.useServerCookies){let o=lt.parse(t)?.expiration;ur.set(ri,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else q.del(Ro),ur.remove(ri)}storeRefreshToken(t){typeof t=="string"?(q.put(Ur,t),this.client?.useServerCookies||ur.set(ni,t,{sameSite:"Strict",secure:!0,expires:30})):(q.del(Ur),ur.remove(ni))}clearForkedToken(){q.del(ar)}};var gi,mr=class{constructor(t){this.apiUrl=t.apiUrl||Dr,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||ds,this.appId=t.appId,this.clientAnalyticsId=typeof window>"u"?null:mu(),gi||(gi=new en),this.session=gi,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager(t,o,r){this.connectors||(this.connectors=new pr(t,o,r))}generateApi(){let t=new Xr(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 E("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new E("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(es(),{address:t});return Ct(o)}catch(o){throw We(o)}}async unlinkPhone(t){try{let o=await this.api.post(ts(),{phoneNumber:t});return Ct(o)}catch(o){throw We(o)}}async unlinkWallet(t){try{let o=await this.api.post(Xa(),{address:t});return Ct(o)}catch(o){throw We(o)}}async unlinkOAuth(t,o){try{let r=await this.api.post(os(),{provider:t,subject:o});return Ct(r)}catch(r){throw We(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(rs(),{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(ns(),t)}catch(o){throw We(o)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?lt.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,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 We(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()}};import"wicg-inert";import{disableBodyScroll as vg,clearAllBodyScrollLocks as wg}from"body-scroll-lock";import{useRef as Cg,useCallback as bg}from"react";import{useEffect as Dd}from"react";import Eg from"react-dom";import Ra from"styled-components";import{createContext as hu,useContext as fu}from"react";var vi=hu({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}),S=()=>fu(vi);import{createContext as yu,useContext as gu}from"react";var Je=yu({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,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,unlinkApple:T,setActiveWallet:T,forkSession:T,createWallet:T,signMessage:T,sendTransaction:T,exportWallet:T,setWalletPassword:T}),$=()=>gu(Je);import _i from"styled-components";import Ht,{css as Ei}from"styled-components";import Ci from"styled-components";import{Fragment as wu,jsx as wi,jsxs as Cu}from"react/jsx-runtime";var tn=({success:e,fail:t})=>Cu(wu,{children:[wi(co,{className:e?"success":t?"fail":""}),wi(bi,{className:e?"success":t?"fail":""})]}),co=Ci.span`
|
|
12
|
+
- https://privy.io`;this.getNonceOnce=new Fe(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 C("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 oe(t)}}async link(){if(!this.api)throw new C("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 oe(t)}}async sign(){if(!this.api)throw new C("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new C("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 C("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 C("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 po=class{constructor(t,o){this.meta={phoneNumber:t,captchaToken:o}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("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 oe(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("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 oe(t)}}async sendSmsCode(t,o){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),o&&(this.meta.captchaToken=o),!this.meta.phoneNumber)throw new C("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 oe(r)}}};import{v4 as Iu}from"uuid";function it(e){return new Date(e*1e3)}function Vp(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:it(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:it(o.verified_at)};t.push(i);break;case"phone":let a={number:o.phoneNumber,type:o.type,verifiedAt:it(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:it(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:it(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:it(o.verified_at)};t.push(c);break;case"github_oauth":let E={subject:o.subject,username:o.username,name:o.name,email:o.email,type:o.type,verifiedAt:it(o.verified_at)};t.push(E);break;case"apple_oauth":let g={subject:o.subject,email:o.email,type:o.type,verifiedAt:it(o.verified_at)};t.push(g);break;case"custom_auth":t.push({type:o.type,customUserId:o.custom_user_id,verifiedAt:it(o.verified_at)});break;default:console.warn(`Unrecognized account type: ${r}. Please consider upgrading the Privy SDK.`)}}return t}function Dt(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"),qp=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Ut=(e,t)=>t==="all-users"&&!Y(e)||t==="users-without-wallets"&&!qp(e)?.length;function Et(e){if(!e)return null;let t=Vp(e.linked_accounts),o=Dt(t,"wallet"),r=Dt(t,"email"),n=Dt(t,"phone"),i=Dt(t,"google_oauth"),a=Dt(t,"twitter_oauth"),l=Dt(t,"discord_oauth"),s=Dt(t,"github_oauth"),c=Dt(t,"apple_oauth");return{id:e.id,createdAt:it(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},apple:c&&{subject:c.subject,email:c.email}}}import{getAddress as Js}from"@ethersproject/address";import Su from"eventemitter3";var ms="1.40.0-beta-20230919233542";var Gr="4df5e2316331463a9130964bd6078dfa",hs="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",fs="34357d3c125c2bcf2ce2bc3309d98715",ys="0x4AAAAAAAJFhr_rDU7HKpyw",zr="https://auth.privy.io",gs=2e4,Ye=1400,vs=2500,si=ms;var Lo="privy:token",li="privy-token",$r="privy:refresh_token",ci="privy-refresh-token",ws="privy-session",lr="privy:session_transfer_token",Kp="privy:wallet",di=e=>`${Kp}:${e}`,pi="privy:connectors",ui="privy:connections";var at=1,Vr="0x1",Cs="https://api.moonpay.com/v1",bs="https://api.moonpay.com/v1",Es="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",xs="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";var mi=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)}},hi=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 Yp(){return typeof window<"u"&&window.localStorage?new hi:new mi}var K=Yp();import{isPossiblePhoneNumber as Jp}from"libphonenumber-js/min";var jr=()=>{let e=window;if(!e.ethereum)return!1;if(qr(window.ethereum,!0))return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(qr(t,!0))return!0}return!1},cr=()=>{let e=window;if(!e.ethereum)return!1;if(qr(window.ethereum,!1))return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(qr(t,!1))return!0}return!!window.ethereum.isZerion},qr=(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,Be=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Kr=()=>{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=>Jp(String(e),"US"),_s=(e,t)=>{let o=e.slice(0),r=[];for(;o.length;)r.push(o.splice(0,t));return r},Ft=(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}`},fi=e=>new Promise(t=>setTimeout(t,e)),Ss=(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 fi(o)}a||i(new Error("Exceeded max attempts before resolving function"))})},Yr=(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 yi=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),dr=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 i=[];jr()&&i.push("metamask"),Be()&&i.push("phantom"),o.ethereum&&o.ethereum.isBraveWallet&&i.push("brave"),r(i)}})}function Jr(e){return`eip155:${String(Number(e))}`}var Je=(e,t,o)=>{let r=Number(e),n=t.find(a=>a.id===r);if(!n)throw new B(`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]+"/"+Gr:n.rpcUrls.blast?.http[0]?i=n.rpcUrls.blast.http[0]+"/"+hs:i=n.rpcUrls.default?.http[0],!i)throw new B(`No RPC url found for ${e}`);return i};import su from"@coinbase/wallet-sdk";import{jsx as Rs,jsxs as Qp}from"react/jsx-runtime";var st=({style:e,...t})=>Qp("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:[Rs("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Rs("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 iu}from"eventemitter3";import{StaticJsonRpcProvider as Ws}from"@ethersproject/providers";import ru from"eventemitter3";var Zp=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],ks=e=>Zp.includes(e);import{ErrorCode as Xp}from"@ethersproject/logger";var Mo=class extends B{constructor(){super("Wallet timeout");this.type="wallet_error"}},Oo=class extends B{constructor(){super("User rejected connection");this.type="wallet_error"}},ct=e=>{if(e instanceof B)return e;if(e?.code&&e?.reason){let t=new Ie(e);return e.code===Xp.ACTION_REJECTED&&(t.details=_e.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Ie(e):new B("Unknown connector error",e)},lt=class extends Ke{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},Ie=class extends lt{constructor(o){let r=o;super(r.message,r.code,r.data);let n=Object.values(_e).find(i=>i.eipCode===r.code);this.details=n||_e.UNKNOWN_ERROR,r.code===-32002&&(r.message?.includes("already pending for origin")?r.message?.includes("wallet_requestPermissions")?this.details=_e.E32002_CONNECTION_ALREADY_PENDING:this.details=_e.E32002_REQUEST_ALREADY_PENDING:r.message?.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=_e.E32002_WALLET_LOCKED))}},eu={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}},tu={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}},ou={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}},_e={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...ou,...tu},xt={...eu,..._e};var nu=12e4,gi=(e=new Mo,t=nu)=>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 B(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),gi()]).catch(o=>{throw ct(o)})}},Bt=class extends Error{constructor(o,r,n){super(o);this.code=r,this.data=n}},Qr=class extends ru{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 Ws(Je(a,this.chains,n))}async handleSendTransaction(o){if(!o.params||!Array.isArray(o.params))throw new Bt(`Invalid params for ${o.method}`,4200);let r=o.params[0];if(!await Tt()||!this.address)throw new Bt("Disconnected",4900);return(await Ns(r)).transactionHash}handleSwitchEthereumChain(o){if(!o.params||!Array.isArray(o.params))throw new Bt(`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 Bt(`Invalid params for ${o.method}`,4200);this.chainId=Number(r),this.provider=new Ws(Je(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 Is(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:dr(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 dr(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(ks(o.method)){let r=await Tt();if(await Ls(),!r||!this.address)throw new Bt("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 Bt("Disconnected",4900)}}else return this.provider.send(o.method,o.params)}async connect(){let o=await Tt();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)}},Ht=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 au=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Ne=class extends iu{constructor(o,r){super();this.onAccountsChanged=o=>{o.length===0?this.onDisconnect():this.syncAccounts(o)};this.onChainChanged=o=>{this.wallets.forEach(r=>{r.chainId=Jr(o),this.walletClientType==="privy"&&K.put(di(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=>pt(i.address)===pt(o));return{address:pt(o),chainId:r,switchChain:async i=>{if(!n)throw new B("Wallet is not currently connected.");let a=this.wallets.find(g=>pt(g.address)===pt(o))?.chainId;if(!a)throw new B("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===Jr(l))return;let c=this.chains.find(g=>g.id===s);if(!c)throw new B(`Unsupported chainId: ${i}`);let E=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})};try{return await E()}catch(g){if(au(g,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??""]}]}),E();throw this.walletClientType==="rainbow"&&g.message?.includes("wallet_switchEthereumChain")?new B(`Rainbow does not support the chainId ${r}`):g}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:n,getEthereumProvider:async()=>{if(!await n())throw new B("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await n())throw new B("Wallet is not currently connected.");return new Ms(new dt(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await n())throw new B("Wallet is not currently connected.");return new Ht(this.proxyProvider)},sign:async i=>{if(!await n())throw new B("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=pt(n),a=[],l;if(this.walletClientType==="privy"){l=K.get(di(i))||Vr;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 ${Vr}`,c),l=Vr}let s=Jr(l);a.find(c=>pt(c.address)===i)||a.push(this.buildConnectedWallet(pt(n),s)),Zr(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=>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 lu=e=>{let t=`https://mainnet.infura.io/v3/${Gr}`,o=1;return e.makeWeb3Provider(t,o)},Xr,en=class extends Ne{constructor(o){super("coinbase_wallet",o);this.connectorType="coinbase_wallet";this.proxyProvider=new Z,this.subscribeListeners(),Xr||(Xr=new su({appName:"Privy",darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(lu(Xr)),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(){Xr.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 B("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([o[0]])}catch(o){throw ct(o)}}};import{jsx as Os}from"react/jsx-runtime";var Do=({...e})=>Os("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Os("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 tn=class extends Ne{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:[dr(o?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Do}}disconnect(){this.connected=!1}async promptConnection(){}};import{getAddress as Nw}from"@ethersproject/address";import{Web3Provider as Mw}from"@ethersproject/providers";import{isMobile as du}from"react-device-detect";import{jsx as Le,jsxs as cu}from"react/jsx-runtime";var Ce=({style:e,...t})=>cu("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:[Le("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),Le("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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"}),Le("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 on=class extends Ne{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:Ce}}disconnect(){console.warn("Metamask does not support programmatic disconnect.")}async promptConnection(){try{!du&&jr()&&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 B("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw ct(o)}}};import{jsx as Ds,jsxs as pu}from"react/jsx-runtime";var He=({style:e,...t})=>pu("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:[Ds("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),Ds("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 rn=class extends Ne{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:He}}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 B("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw ct(o)}}};import{EthereumProvider as Eu,OPTIONAL_EVENTS as xu,OPTIONAL_METHODS as Tu}from"@walletconnect/ethereum-provider";import Ci from"@walletconnect/qrcode-modal";import{isAndroid as Pu,isMobile as _u}from"react-device-detect";import{createContext as mu,useContext as hu,useEffect as vi,useRef as fu,useState as Fs}from"react";import{jsx as uu}from"react/jsx-runtime";function Us(e){return uu("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 yu,jsxs as gu}from"react/jsx-runtime";var Qe="LANDING",Bs=mu({ready:!1,app:null,currentScreen:Qe,lastScreen:Qe,navigate:T,navigateBack:T,resetNavigation:T,setModalData:T,outerClickRef:null}),Hs=e=>{let t=e.appConfig,o=e.authenticated,r=e.visible,[n,i]=Fs(e.initialScreen||Qe),[a,l]=Fs(e.initialScreen||Qe);vi(()=>{o||i(Qe)},[o]),vi(()=>{r||(l(Qe),i(Qe))},[r]),vi(()=>{e.initialScreen&&n===Qe&&(i(e.initialScreen),l(e.initialScreen))},[e.initialScreen]);let s=e.initialScreen&&n===Qe?e.initialScreen:n,c=fu(null),E={ready:!!t?.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:s,lastScreen:a,navigate:g=>{l(n),i(g)},navigateBack:()=>{i(a)},resetNavigation:()=>{e.setInitialScreen(null),l(Qe),i(Qe)},outerClickRef:c};return gu(Bs.Provider,{value:E,children:[(typeof t?.appearance?.logo=="string"||t?.appearance?.logo?.type==="img")&&yu(Us,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},w=()=>hu(Bs);import{jsx as Uo,jsxs as vu}from"react/jsx-runtime";var Fo=({style:e,...t})=>{let{app:o}=w();return vu("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 zs,isDesktop as wu,isMobileOnly as Cu}from"react-device-detect";var nn=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[o,r]of Object.entries($s))if(r.hostname===t)return{walletClientType:o,entry:r}};var $s={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"}}},Vs=(e,t="md")=>`https://registry.walletconnect.com/v2/logo/${t}/${e}`;function wi(e){return{name:e.displayName||"",universalLink:e.mobile.universal||"",deepLink:e.mobile.native||""}}function bu(e){let t="mobile";return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>wi(o))}function qs(){return bu($s)}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 Ks(e,t){return zs?e:js(e,wi(t))}var Ys="WALLETCONNECT_DEEPLINK_CHOICE";function Gs(e){let t=e.href.split("?")[0];K.put(Ys,{...e,href:t})}var pr=(e,t)=>{if(!e||wu){K.del(Ys);return}if(zs){Gs({name:"Unknown",href:t||"wc:"});return}else if(Cu){let o=js(t||"wc:",wi(e));Gs({name:e?.displayName||"",href:o})}};var ur=class extends Ne{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=nn(this.walletProvider.session?.peer.metadata.url);this.walletEntry=l?.entry,this.walletClientType=l?.walletClientType||"unknown",pr(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"?Ce:Vs(this.walletEntry.image_id)}:{name:yi(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,pr(void 0),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((o,r)=>{let n=()=>{r(new Oo)};this.onQrModalClosed=n,(async()=>{let a="",l=await Promise.race([this.walletProvider.enable(),gi()]);if(l.length>0&&(a=l[0]),!a||a==="")throw new B("Unable to retrieve address");if(this.walletProvider.session?.peer.metadata.url){let s=nn(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(ct(a));return}r(new B("Unknown error during connection"))}).finally(()=>Ci.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=Je(n.id,this.chains,this.rpcConfig);i&&(o[n.id]=i)}let r=await Eu.init({projectId:this.walletConnectCloudProjectId,chains:[1],optionalChains:this.chains.map(n=>n.id),optionalEvents:xu,optionalMethods:Tu,rpcMap:o,showQrModal:!1});return r.on("display_uri",n=>{if(Pu)window.open(n,"_self");else if(_u&&this.walletEntry){pr(this.walletEntry,n);let a=Ks(n,this.walletEntry);window.open(a,"_self","noopener,noreferrer")}else Ci.open(n,()=>{this.onQrModalClosed&&this.onQrModalClosed()},{mobileLinks:qs().map(i=>i.name)})}),r.on("connect",()=>{if(Ci.close(),r.session?.peer.metadata.url){let n=nn(r.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown",pr(this.walletEntry)}}),r}async enableProvider(){return this.walletProvider.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider.enable()}};var bi=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(r=>r.type=="wallet"&&r.address===Js(t)).length:!1},mr=class extends Su{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||(K.get(pi)&&(K.getKeys().forEach(o=>{o.startsWith("walletconnect")&&K.del(o)}),K.del(pi)),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}})),(Kr()||K.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 Qr(o,r,this.rpcConfig,this.chains),a=new tn(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 ur&&n.resetConnection(),n;let a=(()=>{switch(o){case"injected":switch(r){case"phantom":return Be()?new rn(this.chains):null;case"metamask":default:return cr()?new on(this.chains):null}case"coinbase_wallet":return new en(this.chains);case"wallet_connect_v2":return new ur(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=K.get(ui);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}));K.put(ui,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=Js(o),this.emit("walletsUpdated")}};function Zr(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 Au}from"ofetch";var Ru=[Br(),Hr()],ku=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal},an=class{constructor(t,o,r){this.appId=t,this.sdkVersion=si,this.client=o,this.defaults=r,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=Au.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=!Ru.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=ku(this.defaults.timeout))},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new Ur}})}async get(t,o){try{return await this.baseFetch(t,o)}catch(r){throw oe(r)}}async post(t,o,r){try{return await this.baseFetch(t,{method:"POST",...o?{body:o}:{},...r})}catch(n){throw oe(n)}}async delete(t,o){try{return await this.baseFetch(t,{method:"DELETE",...o})}catch(r){throw oe(r)}}};import hr from"js-cookie";function Qs(e){return e instanceof lo?"email":e instanceof po?"sms":e instanceof co?"siwe":e instanceof Io?"custom_auth":e instanceof Ot?e.meta.provider:null}import*as Zs from"jose";var ut=class{static parse(t){try{return new ut(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Zs.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,sn=class{constructor(){this.authenticateOnce=new Fe(async t=>this._authenticate(t)),this.linkOnce=new Fe(async t=>this._link(t)),this.refreshOnce=new Fe(this._refresh.bind(this)),this.destroyOnce=new Fe(this._destroy.bind(this)),this.forkSessionOnce=new Fe(this._forkSession.bind(this))}get token(){try{let t=K.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=K.get($r);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=K.get(lr);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=hr.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:i}=await t.authenticate();this.storeToken(o),this.storeRefreshToken(r);let a=Qs(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:Et(n),isNewUser:i}}catch(o){throw console.warn("Error authenticating session"),We(o)}}async _link(t){try{let o=await t.link();return Et(o)}catch(o){throw console.warn("Error linking account"),We(o)}}async _refresh(){if(!this.api)throw new C("Session has no API instance");if(!this.client)throw new C("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(Br(),a,{headers:i}),r&&this.clearForkedToken()}else if(r)n=await this.api.post(Hr(),{refresh_token:r}),this.clearForkedToken();else return null;return this.storeToken(n.token),this.storeRefreshToken(n.refresh_token),Et(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 We(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 C("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 We(o)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){if(K.put(Lo,t),!this.client?.useServerCookies){let o=ut.parse(t)?.expiration;hr.set(li,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else K.del(Lo),hr.remove(li)}storeRefreshToken(t){typeof t=="string"?(K.put($r,t),this.client?.useServerCookies||hr.set(ci,t,{sameSite:"Strict",secure:!0,expires:30})):(K.del($r),hr.remove(ci))}clearForkedToken(){K.del(lr)}};var Ei,fr=class{constructor(t){this.apiUrl=t.apiUrl||zr,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||gs,this.appId=t.appId,this.clientAnalyticsId=typeof window>"u"?null:Iu(),Ei||(Ei=new sn),this.session=Ei,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager(t,o,r){this.connectors||(this.connectors=new mr(t,o,r))}generateApi(){let t=new an(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 C("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new C("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 Et(o)}catch(o){throw We(o)}}async unlinkPhone(t){try{let o=await this.api.post(ls(),{phoneNumber:t});return Et(o)}catch(o){throw We(o)}}async unlinkWallet(t){try{let o=await this.api.post(as(),{address:t});return Et(o)}catch(o){throw We(o)}}async unlinkOAuth(t,o){try{let r=await this.api.post(cs(),{provider:t,subject:o});return Et(r)}catch(r){throw We(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 We(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,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 We(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()}};import"wicg-inert";import{disableBodyScroll as w1,clearAllBodyScrollLocks as C1}from"body-scroll-lock";import{useRef as b1,useCallback as E1}from"react";import{useEffect as np}from"react";import x1 from"react-dom";import Oa from"styled-components";import{createContext as Nu,useContext as Lu}from"react";var xi=Nu({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}),_=()=>Lu(xi);import{createContext as Mu,useContext as Ou}from"react";var Ze=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,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,unlinkApple:T,setActiveWallet:T,forkSession:T,createWallet:T,signMessage:T,sendTransaction:T,exportWallet:T,setWalletPassword:T}),V=()=>Ou(Ze);import Wi from"styled-components";import zt,{css as Si}from"styled-components";import Pi from"styled-components";import{Fragment as Uu,jsx as Ti,jsxs as Fu}from"react/jsx-runtime";var ln=({success:e,fail:t})=>Fu(Uu,{children:[Ti(uo,{className:e?"success":t?"fail":""}),Ti(_i,{className:e?"success":t?"fail":""})]}),uo=Pi.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
|
-
`,
|
|
45
|
+
`,_i=Pi(uo)`
|
|
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
|
-
`,
|
|
51
|
+
`,Gt=e=>Ti(Du,{color:e.color||"var(--privy-color-foreground-3)"}),Du=Pi(uo)`
|
|
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 mt,jsxs as cn}from"react/jsx-runtime";var dn=zt.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
|
-
`,j=({children:e,loading:t,disabled:o,loadingText:r="Loading...",...n})=>
|
|
83
|
-
${e=>e.hideAnimations&&
|
|
82
|
+
`,j=({children:e,loading:t,disabled:o,loadingText:r="Loading...",...n})=>mt(Xs,{disabled:t||o,...n,children:t?cn("span",{children:[mt(Gt,{}),r?mt("span",{children:r}):null]}):e}),W0=zt(j)`
|
|
83
|
+
${e=>e.hideAnimations&&Si`
|
|
84
84
|
&& {
|
|
85
85
|
transition: none;
|
|
86
86
|
}
|
|
87
87
|
`}
|
|
88
|
-
`,
|
|
88
|
+
`,pn=({children:e,loading:t,disabled:o,annotation:r,loadingText:n="Loading...",...i})=>cn(Xs,{as:"a",disabled:t||o,...i,children:[!!r&&mt("div",{style:{position:"absolute",top:"-1.5rem"},children:mt(Bu,{children:r})}),t?cn("span",{children:[mt(Gt,{}),n?mt("span",{children:n}):null]}):e]}),Bu=zt.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
|
+
`,Xs=zt(dn)`
|
|
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?Si`
|
|
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
|
+
`,el=({children:e,loading:t,disabled:o,loadingText:r="Loading...",...n})=>mt(Hu,{disabled:t||o,...n,children:t?cn("span",{children:[mt(Gt,{}),r?mt("span",{children:r}):null]}):e}),Hu=zt(dn)`
|
|
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
|
-
`,
|
|
169
|
+
`,fe=zt.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&&Si`
|
|
183
183
|
pointer-events: none;
|
|
184
184
|
`}
|
|
185
185
|
|
|
@@ -197,10 +197,10 @@ Resources:
|
|
|
197
197
|
cursor: not-allowed;
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
-
`,
|
|
200
|
+
`,un=zt.div`
|
|
201
201
|
/* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
|
|
202
202
|
height: 44px;
|
|
203
|
-
`,
|
|
203
|
+
`,mn=zt.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 Gu from"styled-components";var tl=Gu.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 Ge from"styled-components";var pe=Ge.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
|
-
`,
|
|
265
|
+
`,Ai=Ge.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
|
+
`,ol=Ge.div`
|
|
273
273
|
display: flex;
|
|
274
274
|
flex-direction: column;
|
|
275
275
|
align-items: center;
|
|
276
276
|
width: 100%;
|
|
277
|
-
|
|
277
|
+
`,$t=Ge(Ai)`
|
|
278
278
|
gap: 16px;
|
|
279
|
-
`,
|
|
279
|
+
`,Ri=Ge.div`
|
|
280
280
|
display: flex;
|
|
281
281
|
flex-direction: column;
|
|
282
282
|
width: 100%;
|
|
283
|
-
`,
|
|
283
|
+
`,Vt=Ge.div`
|
|
284
284
|
display: flex;
|
|
285
285
|
flex-direction: column;
|
|
286
286
|
gap: 8px;
|
|
287
287
|
min-height: 76px;
|
|
288
|
-
`,
|
|
288
|
+
`,D0=Ge.div`
|
|
289
289
|
display: flex;
|
|
290
290
|
flex-direction: column;
|
|
291
291
|
justify-content: space-between;
|
|
292
292
|
height: 100%;
|
|
293
|
-
`,
|
|
293
|
+
`,U0=Ge.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=Ge.div`
|
|
317
317
|
height: 16px;
|
|
318
|
-
`,
|
|
318
|
+
`,L=Ge.div`
|
|
319
319
|
height: 12px;
|
|
320
|
-
`,
|
|
320
|
+
`,rl=Ge.div`
|
|
321
321
|
position: relative;
|
|
322
|
-
`,
|
|
322
|
+
`,nl=Ge.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 il from"styled-components";import{Fragment as $u,jsx as Bo,jsxs as al}from"react/jsx-runtime";var zu=il.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
|
|
339
|
+
`;function hn(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:o}}=e.app,r=!!t,n=!!o,i=r&&n;return!r&&!n?null:al(zu,{children:["By logging in I agree to the"," ",n&&Bo("a",{href:o,target:"_blank",children:i?"Terms":"Terms of Service"}),i&&" & ",r&&Bo("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var H=({protectedByPrivy:e})=>Bo(J,{children:e?al($u,{children:[Bo(Do,{className:"hide-on-mobile"}),Bo("span",{className:"hide-on-mobile",children:Bo("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})})]}):null}),J=il.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 Vu,XMarkIcon as qu}from"@heroicons/react/24/outline";import ll from"styled-components";import{jsx as Xe,jsxs as Qu}from"react/jsx-runtime";var sl=()=>Xe("div",{}),ju=({backFn:e})=>Xe("div",{children:Xe(Vu,{height:"16px",width:"16px",strokeWidth:2,onClick:e})}),Ku=e=>Xe("div",{children:Xe("div",{children:Xe(qu,{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}=w();return Qu(Yu,{children:[e?Xe(ju,{backFn:e}):Xe(sl,{}),o&&Xe(Ju,{children:o}),i?.render.inDialog&&r?Xe(Ku,{onClose:t||(()=>n())}):Xe(sl,{})]})},Yu=ll.div`
|
|
369
369
|
padding-top: 16px;
|
|
370
370
|
display: flex;
|
|
371
371
|
align-items: center;
|
|
@@ -422,13 +422,14 @@ Resources:
|
|
|
422
422
|
height: 30px;
|
|
423
423
|
margin-bottom: 10px;
|
|
424
424
|
}
|
|
425
|
-
`,
|
|
425
|
+
`,Ju=ll.div`
|
|
426
426
|
overflow: hidden;
|
|
427
427
|
white-space: nowrap;
|
|
428
428
|
max-width: 100%;
|
|
429
429
|
text-overflow: ellipsis;
|
|
430
|
+
text-align: center;
|
|
430
431
|
color: var(--privy-color-foreground-2);
|
|
431
|
-
`;import{jsx as
|
|
432
|
+
`;import{jsx as cl}from"react/jsx-runtime";var dl=({style:e,...t})=>cl("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:cl("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 ki,jsx as ze,jsxs as fn}from"react/jsx-runtime";var pl=()=>{let{navigate:e,app:t}=w(),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 fn(ki,{children:[ze(S,{}),ze(R,{}),fn(Zu,{children:[ze(em,{children:fn("div",{children:[ze(tl,{}),ze(dl,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),fn(Xu,{children:[typeof o=="string"?ze("h3",{children:o}):ze(ki,{children:o}),typeof r=="string"?ze("p",{children:r}):ze(ki,{children:r})]}),t?.allowlistConfig.errorCtaLink?ze(fe,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):ze(fe,{onClick:()=>{e("LANDING")},children:n})]}),ze(J,{})]})},Zu=Wi.div`
|
|
432
433
|
display: flex;
|
|
433
434
|
flex-direction: column;
|
|
434
435
|
align-items: center;
|
|
@@ -436,11 +437,11 @@ Resources:
|
|
|
436
437
|
margin-left: 27px;
|
|
437
438
|
margin-right: 27px;
|
|
438
439
|
gap: 24px;
|
|
439
|
-
`,
|
|
440
|
+
`,Xu=Wi.div`
|
|
440
441
|
display: flex;
|
|
441
442
|
flex-direction: column;
|
|
442
443
|
gap: 8px;
|
|
443
|
-
`,
|
|
444
|
+
`,em=Wi.div`
|
|
444
445
|
display: flex;
|
|
445
446
|
flex-direction: column;
|
|
446
447
|
justify-content: center;
|
|
@@ -463,9 +464,9 @@ Resources:
|
|
|
463
464
|
left: -19px;
|
|
464
465
|
top: -19px;
|
|
465
466
|
}
|
|
466
|
-
`;import{EnvelopeIcon as
|
|
467
|
+
`;import{EnvelopeIcon as rm,PhoneIcon as nm}from"@heroicons/react/24/outline";import{useEffect as hl,useState as yn}from"react";import{isMobile as im}from"react-device-detect";import gr from"styled-components";import Ii from"styled-components";import{Fragment as om,jsx as yr,jsxs as ml}from"react/jsx-runtime";var $e=({title:e,description:t,children:o,...r})=>yr(ul,{...r,children:ml(om,{children:[yr("h3",{children:e}),typeof t=="string"?yr("p",{children:t}):t,o]})}),qt=Ii($e)`
|
|
467
468
|
margin-bottom: 24px;
|
|
468
|
-
`,
|
|
469
|
+
`,be=({title:e,description:t,icon:o,children:r,...n})=>ml(tm,{...n,children:[o||null,yr("h3",{children:e}),typeof t=="string"?yr("p",{children:t}):t,r]}),ul=Ii.div`
|
|
469
470
|
display: flex;
|
|
470
471
|
flex-direction: column;
|
|
471
472
|
justify-content: flex-start;
|
|
@@ -485,7 +486,7 @@ Resources:
|
|
|
485
486
|
color: var(--privy-color-foreground-2);
|
|
486
487
|
font-size: 14px;
|
|
487
488
|
}
|
|
488
|
-
`,
|
|
489
|
+
`,tm=Ii(ul)`
|
|
489
490
|
align-items: center;
|
|
490
491
|
text-align: center;
|
|
491
492
|
gap: 16px;
|
|
@@ -493,7 +494,7 @@ Resources:
|
|
|
493
494
|
h3 {
|
|
494
495
|
margin-bottom: 24px;
|
|
495
496
|
}
|
|
496
|
-
`;import{Fragment as
|
|
497
|
+
`;import{Fragment as Ni,jsx as ue,jsxs as jt}from"react/jsx-runtime";var Li=6,fl=new Array(Li).fill(""),am=1400;var gl=()=>{let{app:e,navigate:t,setModalData:o}=w(),{closePrivyModal:r,resendEmailCode:n,resendSmsCode:i,getAuthMeta:a,loginWithCode:l,updateWallets:s}=_(),{authenticated:c,user:E}=V(),[g,x]=yn(fl),[m,f]=yn(!1),[v,h]=yn(null),[P,b]=yn(null),M=a()?.email?0:1,I=e?.render.inDialog?Ye:0,k=e?.render.inDialog?I-500:0;hl(()=>{if(c&&m&&E)if(Ut(E,e?.embeddedWallets?.createOnLogin)){let z=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:ee=>console.error(ee),callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},k);return()=>clearTimeout(z)}else{s();let z=setTimeout(r,I);return()=>clearTimeout(z)}},[c,m,E]),hl(()=>{if(v&&P===0){let G=setTimeout(()=>{x(fl),h(null),document.querySelector("input[name=code-0]")?.focus()},am);return()=>clearTimeout(G)}},[v]);let W=G=>{let z=G.currentTarget.value.replace(" ","");if(z==="")return;if(isNaN(Number(z))){h("Code should be numeric"),b(1);return}h(null),b(null);let ee=Number(G.currentTarget.name?.charAt(5)),D=[...z||[""]].slice(0,Li-ee),de=[...g.slice(0,ee),...D,...g.slice(ee+D.length)];x(de);let $=D.length,te=Math.min(Math.max(ee+$,0),Li-1);isNaN(Number(G.currentTarget.value))||document.querySelector(`input[name=code-${te}]`)?.focus(),de.every(Oe=>Oe&&!isNaN(+Oe))&&(document.querySelector(`input[name=code-${te}]`)?.blur(),l(de.join("")).then(()=>f(!0)).catch(F=>{F?.status===422?h("Invalid or expired verification code"):h("Issue verifying code"),b(0)})),G.preventDefault()},U=G=>{P===1&&(h(null),b(null));let z=[...g.slice(0,G),"",...g.slice(G+1)];x(z),G>0&&document.querySelector(`input[name=code-${G-1}]`)?.focus()},X=M==0?ue(rm,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):ue(nm,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),O=M==0?jt("p",{children:["Please check ",ue(yl,{children:a()?.email})," for an email from privy.io and enter your code below."]}):jt("p",{children:["Please check ",ue(yl,{children:a()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return jt(Ni,{children:[ue(S,{},"header"),ue(R,{}),jt(sm,{children:[ue(be,{title:"Enter confirmation code",description:O,icon:X}),jt(ol,{children:[jt(lm,{children:[ue(cm,{fail:!!v,success:m,children:ue("span",{children:v||(m?"Success!":"")})}),ue("div",{children:g.map((G,z)=>ue("input",{name:`code-${z}`,type:"text",value:g[z],onChange:W,onKeyUp:ee=>{ee.key==="Backspace"&&U(z)},inputMode:"numeric",autoFocus:z===0,pattern:"[0-9]",className:`${m?"success":""} ${v?"fail":""}`,autoComplete:im?"one-time-code":"off"},z))})]}),ue(dm,{children:M==0?jt(Ni,{children:[ue("span",{children:"Didn't get an email?"}),ue("button",{onClick:n,children:"Resend Code"})]}):jt(Ni,{children:[ue("span",{children:"Didn't get a message?"}),ue("button",{onClick:i,children:"Resend Code"})]})})]})]}),ue(L,{}),ue(H,{protectedByPrivy:!0})]})},sm=gr.div`
|
|
497
498
|
display: flex;
|
|
498
499
|
flex-direction: column;
|
|
499
500
|
align-items: flex-start;
|
|
@@ -501,7 +502,7 @@ Resources:
|
|
|
501
502
|
margin: auto;
|
|
502
503
|
gap: 16px;
|
|
503
504
|
flex-grow: 1;
|
|
504
|
-
`,
|
|
505
|
+
`,lm=gr.div`
|
|
505
506
|
display: flex;
|
|
506
507
|
flex-direction: column;
|
|
507
508
|
width: 100%;
|
|
@@ -557,7 +558,7 @@ Resources:
|
|
|
557
558
|
transform: translate(1px, 0px);
|
|
558
559
|
}
|
|
559
560
|
}
|
|
560
|
-
|
|
561
|
+
`,cm=gr.div`
|
|
561
562
|
line-height: 20px;
|
|
562
563
|
height: 20px;
|
|
563
564
|
font-size: 13px;
|
|
@@ -565,7 +566,7 @@ Resources:
|
|
|
565
566
|
display: flex;
|
|
566
567
|
justify-content: flex-end;
|
|
567
568
|
width: 100%;
|
|
568
|
-
`,
|
|
569
|
+
`,dm=gr.div`
|
|
569
570
|
font-size: 13px;
|
|
570
571
|
color: var(--privy-color-foreground-3);
|
|
571
572
|
display: flex;
|
|
@@ -579,20 +580,20 @@ Resources:
|
|
|
579
580
|
> button {
|
|
580
581
|
text-decoration: underline;
|
|
581
582
|
}
|
|
582
|
-
`,
|
|
583
|
+
`,yl=gr.span`
|
|
583
584
|
font-weight: 500;
|
|
584
585
|
word-break: break-all;
|
|
585
|
-
`;import{isMobile as
|
|
586
|
+
`;import{isMobile as Mi}from"react-device-detect";import wl from"styled-components";import pm from"styled-components";var vl=pm.span`
|
|
586
587
|
@media (max-width: 440px) {
|
|
587
588
|
display: none;
|
|
588
589
|
}
|
|
589
|
-
`;import{jsx as
|
|
590
|
+
`;import{jsx as Ve,jsxs as Ho}from"react/jsx-runtime";var Kt=({connectOnly:e})=>{let{navigate:t}=w(),{initLoginWithWallet:o,connectWallet:r}=_();return Ho(um,{children:[Ho(gn,{onClick:()=>{cr()?e?(r("injected","metamask"),t("AWAITING_CONNECT_ONLY_CONNECTION")):(o("injected","metamask"),t("AWAITING_CONNECTION")):Mi?e?(r("wallet_connect_v2","metamask"),t("AWAITING_CONNECT_ONLY_CONNECTION")):(o("wallet_connect_v2","metamask"),t("AWAITING_CONNECTION")):t("INSTALL_METAMASK_SCREEN")},children:[Ve(Ce,{}),Ve("span",{children:"MetaMask"}),Ve("span",{children:cr()?"Connect":"Install"})]}),Ho(gn,{onClick:()=>{e?(r("coinbase_wallet","coinbase_wallet"),t("AWAITING_CONNECT_ONLY_CONNECTION")):(o("coinbase_wallet","coinbase_wallet"),t("AWAITING_CONNECTION"))},children:[Ve(st,{}),Ho("span",{children:["Coinbase",Ve(vl,{children:" Wallet"})]}),Ve("span",{children:"Connect"})]}),(Mi||Be())&&Ho(gn,{id:"privy-phantom-button",onClick:()=>{Be()?e?(r("injected","phantom"),t("AWAITING_CONNECT_ONLY_CONNECTION")):(o("injected","phantom"),t("AWAITING_CONNECTION")):t(Mi?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")},children:[Ve(He,{}),Ve("span",{children:"Phantom"}),Ve("span",{children:Be()?"Connect":"Install"})]}),Ho(gn,{onClick:()=>{e?(r("wallet_connect_v2","unknown"),t("AWAITING_CONNECT_ONLY_CONNECTION")):(o("wallet_connect_v2","unknown"),t("AWAITING_CONNECTION"))},children:[Ve(Fo,{}),Ve("span",{children:"WalletConnect"}),Ve("span",{children:"Connect"})]})]})},um=wl.div`
|
|
590
591
|
display: flex;
|
|
591
592
|
flex-direction: column;
|
|
592
593
|
align-items: flex-start;
|
|
593
594
|
gap: 8px;
|
|
594
595
|
width: 100%;
|
|
595
|
-
`,
|
|
596
|
+
`,gn=wl.button`
|
|
596
597
|
display: flex;
|
|
597
598
|
flex-direction: row;
|
|
598
599
|
align-items: center;
|
|
@@ -645,7 +646,7 @@ Resources:
|
|
|
645
646
|
display: none;
|
|
646
647
|
}
|
|
647
648
|
}
|
|
648
|
-
`;import
|
|
649
|
+
`;import mm from"styled-components";import{jsx as Cl,jsxs as fm}from"react/jsx-runtime";var Yt=()=>{let{navigate:e}=w();return fm(hm,{children:[Cl("span",{children:"Don\u2019t have a wallet? "}),Cl("button",{onClick:()=>{e("WALLET_EDUCATION")},children:"Create one now."})]})},hm=mm.div`
|
|
649
650
|
font-size: 13px;
|
|
650
651
|
color: var(--privy-color-foreground-3);
|
|
651
652
|
|
|
@@ -656,13 +657,13 @@ Resources:
|
|
|
656
657
|
@media (max-width: 440px) {
|
|
657
658
|
margin-top: 4px;
|
|
658
659
|
}
|
|
659
|
-
`;import{Fragment as
|
|
660
|
+
`;import{Fragment as ym,jsx as mo,jsxs as bl}from"react/jsx-runtime";var El=()=>{let{app:e}=w(),t=`Connect a wallet to ${e?.name}`;return bl(ym,{children:[mo(S,{},"header"),mo(R,{}),mo(qt,{title:"Connect your wallet",description:t}),bl(pe,{children:[mo(Kt,{connectOnly:!0}),mo(Yt,{})]}),mo(L,{}),mo(H,{protectedByPrivy:!0})]})};import Oi from"styled-components";import gm from"react";import{jsx as xl}from"react/jsx-runtime";var vn=()=>{let{app:e}=w(),t=e?.appearance?.logo,o=`${e?.name} logo`,r={maxHeight:"50px"},n="100%",i="auto";return t?typeof t=="string"?xl("div",{children:xl("img",{height:n,width:i,src:t,alt:o,style:r})}):t.type==="svg"||t.type==="img"?gm.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 bm,jsx as Pt,jsxs as Tl}from"react/jsx-runtime";var Pl=()=>{let{app:e}=w();return Tl(bm,{children:[Pt(S,{},"header"),e?.appearance.logo?Pt(Cm,{children:Pt(vn,{})}):null,Tl(wm,{children:[Pt(vm,{children:Pt("h4",{children:"Connect Wallet"})}),Pt(Kt,{connectOnly:!0}),Pt(Yt,{})]}),e&&Pt(hn,{app:e}),Pt(H,{protectedByPrivy:!0})]})},vm=Oi.div`
|
|
660
661
|
font-weight: 600;
|
|
661
662
|
color: 'var(--privy-color-foreground)';
|
|
662
663
|
display: flex;
|
|
663
664
|
justify-content: center;
|
|
664
665
|
align-items: center;
|
|
665
|
-
`,
|
|
666
|
+
`,wm=Oi.div`
|
|
666
667
|
display: flex;
|
|
667
668
|
flex-direction: column;
|
|
668
669
|
align-items: flex-start;
|
|
@@ -683,7 +684,7 @@ Resources:
|
|
|
683
684
|
border-radius: '0';
|
|
684
685
|
}
|
|
685
686
|
cursor: 'inherit';
|
|
686
|
-
`,
|
|
687
|
+
`,Cm=Oi.div`
|
|
687
688
|
display: flex;
|
|
688
689
|
flex-direction: column;
|
|
689
690
|
align-items: center;
|
|
@@ -692,7 +693,7 @@ Resources:
|
|
|
692
693
|
@media (max-width: 440px) {
|
|
693
694
|
padding: 10px 10px 20px;
|
|
694
695
|
}
|
|
695
|
-
`;import{useEffect as
|
|
696
|
+
`;import{useEffect as Rl,useState as kl}from"react";import Tm from"styled-components";import{useEffect as Di,useState as vr}from"react";import{isMobile as Ui}from"react-device-detect";import _l from"styled-components";import{Fragment as Al,jsx as ye,jsxs as Cn}from"react/jsx-runtime";var wn=2,wr={metamask:{name:"MetaMask",component:Ce},phantom:{name:"Phantom",component:He},coinbase_wallet:{name:"Coinbase Wallet",component:st},wallet_connect:{name:"WalletConnect",component:Fo},embedded:{name:"Privy Wallet",component:Do}},Fi=e=>e?.privyErrorCode==="linked_to_another_user"?xt.ERROR_USER_EXISTS:e instanceof Ie&&!e.details.default?e.details:e instanceof Mo?xt.ERROR_TIMED_OUT:e instanceof Oo?xt.ERROR_USER_REJECTED_CONNECTION:xt.ERROR_WALLET_CONNECTION,Sl=()=>{let[e,t]=vr(!1),[o,r]=vr(!1),[n,i]=vr(void 0),{app:a,navigate:l,navigateBack:s,lastScreen:c,currentScreen:E,setModalData:g}=w(),{getAuthFlow:x,walletConnectionStatus:m,closePrivyModal:f,loginWithWallet:v,updateWallets:h}=_(),{walletConnectors:P}=V(),[b,M]=vr(0),{user:I}=V(),[k]=vr(I?.linkedAccounts.length||0),W=Ui&&m?.connector?.connectorType==="wallet_connect_v2"||Ui&&m?.connector?.connectorType==="coinbase_wallet"||Ui&&m?.connector?.connectorType==="injected"&&m?.connector?.walletClientType==="phantom",U=m?.status==="connected";Di(()=>{let F=x();if(F&&W&&U&&!F.preparedMessage){F.buildSiweMessage();return}!F||W||!U||(async()=>{r(!0),i(void 0);try{m?.connector?.connectorType==="wallet_connect_v2"&&m?.connector?.walletClientType==="metamask"&&await fi(2500),await O()}catch(bt){console.warn("Auto-prompted signature failed",bt)}finally{r(!1)}})()},[b,U]),Di(()=>{if(I&&e){let F;if(Ut(I,a?.embeddedWallets?.createOnLogin)){let bt=a?.render.inDialog?Ye:0,we=a?.render.inDialog?bt-500:0;F=setTimeout(()=>{g({createWallet:{onSuccess:()=>{},onFailure:ir=>console.error(ir),callAuthOnSuccessOnClose:!0}}),l("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},we)}else h(),F=setTimeout(f,Ye);return()=>clearTimeout(F)}},[I,e]);let X=F=>{if(F?.privyErrorCode==="allowlist_rejected"){l("ALLOWLIST_REJECTION_SCREEN");return}i(Fi(F))};async function O(){try{if(await v(),!a?.render.inDialog)return f();t(!0)}catch(F){X(F)}finally{r(!1)}}Di(()=>{m?.connectError&&X(m?.connectError)},[m]);let G=m?.connector?.connectorType||"metamask",z=m?.connector?.walletClientType||"metamask",ee=m?.connector?.walletBranding.name||wr[z]?.name||"MetaMask",D=m?.connector?.walletBranding.icon||wr[z]?.component||(F=>ye(Ce,{...F})),de=e?`Successfully connected with ${ee}`:n?n.message:U?o&&W?"Signing":"Sign to verify":`Waiting for ${ee}`,$="Don\u2019t see your wallet modal? Check your other browser windows.";if(e){let F=I?.linkedAccounts.length||0;k===F?$="Wallet was already linked.":$="You\u2019re good to go!"}else b>=wn&&n?$="Unable to connect wallet":n?$=n.detail:U&&W?$="Sign the message in your wallet to verify it belongs to you.":z==="metamask"?$="For the best experience, connect only one wallet at a time.":G==="wallet_connect"?$="Open your mobile wallet app to continue":G==="coinbase_wallet"&&(Kr()||(bi(I)?$="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":$="Open the Coinbase app on your phone to continue."));let te=P?.walletConnectors?.find(F=>F.walletClientType==="coinbase_wallet"),Oe=z==="coinbase_wallet"&&(bi(I)||n===xt.ERROR_USER_EXISTS);return Cn(Al,{children:[ye(S,{backFn:E===c?void 0:s}),ye(R,{}),Cn(Em,{children:[ye(Bi,{walletLogo:D,success:e,fail:!!n}),Cn(Vt,{children:[ye("h3",{children:de}),ye("p",{children:$})]}),ye(un,{children:Oe?ye(fe,{onClick:()=>te&&te?.disconnect(),invisible:e,disabled:e,children:"Use a different wallet"}):n==xt.ERROR_USER_EXISTS&&E!==c?ye(fe,{onClick:s,children:"Use a different wallet"}):U&&!e&&W?ye(fe,{onClick:()=>{r(!0),O()},disabled:o,children:o?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&b<wn?ye(fe,{onClick:()=>{M(b+1),i(void 0),U?(r(!0),O()):m?.connectRetry()},invisible:e||!n?.retryable||b>=wn,disabled:!e&&(!n?.retryable||b>=wn),children:"Retry"}):null})]}),ye(J,{})]})},Em=_l.div`
|
|
696
697
|
display: flex;
|
|
697
698
|
flex-direction: column;
|
|
698
699
|
align-items: center;
|
|
@@ -700,7 +701,7 @@ Resources:
|
|
|
700
701
|
margin-left: 27px;
|
|
701
702
|
margin-right: 27px;
|
|
702
703
|
gap: 24px;
|
|
703
|
-
`,
|
|
704
|
+
`,xm=_l.div`
|
|
704
705
|
display: flex;
|
|
705
706
|
flex-direction: column;
|
|
706
707
|
justify-content: center;
|
|
@@ -723,7 +724,7 @@ Resources:
|
|
|
723
724
|
left: -19px;
|
|
724
725
|
top: -19px;
|
|
725
726
|
}
|
|
726
|
-
`,
|
|
727
|
+
`,Bi=e=>{let t=e.walletLogo;return ye(Al,{children:ye(xm,{children:Cn("div",{children:[ye(ln,{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 _m,jsx as ht,jsxs as Hi}from"react/jsx-runtime";var bn=2,Wl=()=>{let{navigateBack:e,lastScreen:t,currentScreen:o}=w(),{walletConnectionStatus:r,closePrivyModal:n}=_(),[i,a]=kl(void 0),[l,s]=kl(0),c=r?.status==="connected";Rl(()=>{if(c){let P=setTimeout(n,Ye);return()=>clearTimeout(P)}},[c]);let E=P=>{a(Fi(P))};Rl(()=>{r?.connectError&&E(r?.connectError)},[r]);let g=r?.connector?.connectorType||"metamask",x=r?.connector?.walletClientType||"metamask",m=r?.connector?.walletBranding.name||wr[x]?.name||"MetaMask",f=r?.connector?.walletBranding.icon||wr[x]?.component||(P=>ht(Ce,{...P})),v=c?`Successfully connected with ${m}`:i?i.message:`Waiting for ${m}`,h="Don\u2019t see your wallet modal? Check your other browser windows.";return c?h="You\u2019re good to go!":l>=bn&&i?h="Unable to connect wallet":i?h=i.detail:x==="metamask"?h="For the best experience, connect only one wallet at a time.":g==="wallet_connect_v2"?h="Open your mobile wallet app to continue":g==="coinbase_wallet"&&(h="Open the Coinbase app on your phone to continue."),Hi(_m,{children:[ht(S,{backFn:o===t?void 0:e}),ht(R,{}),Hi(Pm,{children:[ht(Bi,{walletLogo:f,success:c,fail:!!i}),Hi(Vt,{children:[ht("h3",{children:v}),ht("p",{children:h})]}),ht(un,{children:i==xt.ERROR_USER_EXISTS?ht(fe,{onClick:e,children:"Use a different wallet"}):!c&&i?.retryable&&l<bn?ht(fe,{onClick:()=>{s(l+1),a(void 0),r?.connectRetry()},invisible:c||!i?.retryable||l>=bn,disabled:!c&&(!i?.retryable||l>=bn),children:"Retry"}):null})]}),ht(J,{})]})},Pm=Tm.div`
|
|
727
728
|
display: flex;
|
|
728
729
|
flex-direction: column;
|
|
729
730
|
align-items: center;
|
|
@@ -731,7 +732,7 @@ Resources:
|
|
|
731
732
|
margin-left: 27px;
|
|
732
733
|
margin-right: 27px;
|
|
733
734
|
gap: 24px;
|
|
734
|
-
`;import{XCircleIcon as
|
|
735
|
+
`;import{XCircleIcon as Im}from"@heroicons/react/24/solid";import{useEffect as Nm,useMemo as Lm,useState as Mm}from"react";import Om from"styled-components";import En from"styled-components";import{jsx as Gi,jsxs as Wm}from"react/jsx-runtime";var Go=({children:e})=>Gi(Sm,{children:Wm(Am,{children:[e,Gi(Rm,{}),Gi(km,{})]})}),Sm=En.div`
|
|
735
736
|
height: 100%;
|
|
736
737
|
display: flex;
|
|
737
738
|
justify-content: center;
|
|
@@ -743,14 +744,14 @@ Resources:
|
|
|
743
744
|
@media all and (display-mode: standalone) {
|
|
744
745
|
margin-bottom: 30px;
|
|
745
746
|
}
|
|
746
|
-
`,
|
|
747
|
+
`,Am=En.div`
|
|
747
748
|
position: relative;
|
|
748
749
|
height: 140px;
|
|
749
750
|
width: 140px;
|
|
750
751
|
|
|
751
752
|
opacity: 1;
|
|
752
753
|
animation: fadein 200ms ease;
|
|
753
|
-
`,
|
|
754
|
+
`,Rm=En.div`
|
|
754
755
|
position: absolute;
|
|
755
756
|
top: 0;
|
|
756
757
|
right: 0;
|
|
@@ -763,7 +764,7 @@ Resources:
|
|
|
763
764
|
border: 4px solid var(--privy-color-accent-light);
|
|
764
765
|
border-radius: 50%;
|
|
765
766
|
}
|
|
766
|
-
`,
|
|
767
|
+
`,km=En.div`
|
|
767
768
|
position: absolute;
|
|
768
769
|
top: 0;
|
|
769
770
|
right: 0;
|
|
@@ -787,22 +788,22 @@ Resources:
|
|
|
787
788
|
transform: rotate(360deg);
|
|
788
789
|
}
|
|
789
790
|
}
|
|
790
|
-
`;var
|
|
791
|
+
`;var Il=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds"];var _t=class extends Error{constructor(o,r){super(r);this.type=o}};function zi(e){let t=e.type;return typeof t=="string"&&Il.includes(t)}function zo(e){return zi(e)&&e.type==="wallet_not_on_device"}function Nl(e){return zi(e)&&e.type==="invalid_recovery_pin"}function Ll(e){return!!(zi(e)&&e.type==="insufficient_funds"||e.code==="INSUFFICIENT_FUNDS")}function Ml(e){return e.code==="UNPREDICTABLE_GAS_LIMIT"}import{Fragment as Dl,jsx as Jt,jsxs as $i}from"react/jsx-runtime";var Ol=1,Ul=()=>{let{authenticated:e,user:t,getAccessToken:o}=V(),{closePrivyModal:r,createAnalyticsEvent:n,walletProxy:i}=_(),{navigate:a,data:l,setModalData:s,outerClickRef:c}=w(),E=Lm(()=>Date.now(),[]),[g,x]=Mm(!1),{onCompleteNavigateTo:m,onFailure:f}=l?.connectWallet,v=P=>{g||(x(!0),f(typeof P=="string"?new Error(P):P))};Nm(()=>{let P=Y(t),b;return!e||!P?v("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let I=await o();if(!I)return v("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:I,address:P.address});let k=(Date.now()-E)/1e3;m==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&k<Ol?b=setTimeout(()=>{a(m)},(Ol-k)*1e3):a(m)}catch(k){if(zo(k)&&P.recoveryMethod==="privy"){let W=await o();if(!W)return v("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:W}))?.address||v(new Error("Unable to recover wallet")),m?a(m):r({shouldCallAuthOnSuccess:!1}),n("embedded_wallet_recovery_completed",{walletAddress:P.address}),a(m)}catch{v("An error has occurred, please try again.")}}else zo(k)?(s({...l,recoverWallet:{privyWallet:P,onCompleteNavigateTo:m,onFailure:f}}),a("EMBEDDED_WALLET_RECOVERY_SCREEN")):v(k)}})(),()=>clearTimeout(b)):void 0},[e,t,i]);let h=()=>{r({shouldCallAuthOnSuccess:!1}),v("User exited before wallet could be connected")};return c&&(c.current=h),$i(Dl,{children:[Jt(S,{onClose:h}),Jt(R,{}),Jt(Dm,{children:g?$i(Dl,{children:[$i($t,{children:[Jt(Im,{fill:"var(--privy-color-error)",stroke:"white",strokeWidth:".25px",width:"64px",height:"64px"}),Jt(be,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),Jt(j,{onClick:()=>r({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):Jt(Go,{})}),Jt(L,{})]})},Dm=Om.div`
|
|
791
792
|
display: flex;
|
|
792
793
|
height: 100%;
|
|
793
794
|
flex-direction: column;
|
|
794
795
|
flex-grow: 1;
|
|
795
|
-
`;import{CheckCircleIcon as
|
|
796
|
+
`;import{CheckCircleIcon as Um}from"@heroicons/react/24/solid";import{useEffect as Fm}from"react";import{Fragment as Bm,jsx as $o,jsxs as Fl}from"react/jsx-runtime";var Bl=()=>{let{user:e}=V(),{closePrivyModal:t,isNewUserThisSession:o,updateWallets:r}=_(),{app:n,data:i,outerClickRef:a}=w(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,E=()=>{let g=Y(e);g?(r(),l(g),t({shouldCallAuthOnSuccess:c})):s(new Error("Failed to create wallet"))};return Fm(()=>{let g=setTimeout(E,vs);return()=>clearTimeout(g)},[]),a&&(a.current=E),Fl(Bm,{children:[$o(S,{onClose:E}),$o(R,{}),Fl($t,{children:[$o(Um,{fill:"var(--privy-color-accent)",stroke:"white",strokeWidth:".25px",width:"64px",height:"64px"}),$o(be,{title:o?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:o?"You\u2019ve successfully created an account.":"Your account is secured."})]}),$o(L,{}),$o(H,{protectedByPrivy:!0})]})};import{useEffect as $l,useRef as Gm,useState as Vi}from"react";import St from"styled-components";import{jsx as Se,jsxs as Hm}from"react/jsx-runtime";var Hl=({style:e,...t})=>Hm("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:[Se("rect",{x:"214.681",y:"51.6852",width:"40",height:"40",rx:"20",fill:"var(--privy-color-background-2)"}),Se("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)"}),Se("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"}),Se("rect",{x:"65.6426",y:"52.6852",width:"38",height:"38",rx:"19",stroke:"var(--privy-color-background-2","stroke-width":"2"}),Se("path",{d:"M103.162 71.6852H213.662",stroke:"var(--privy-color-background-2","stroke-width":"2","stroke-dasharray":"4 4"}),Se("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"}),Se("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)"}),Se("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)"}),Se("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"}),Se("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"}),Se("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"}),Se("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"}),Se("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"}),Se("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 Zm,jsx as re,jsxs as ft}from"react/jsx-runtime";var Vl=()=>{let[e,t]=Vi(null),{authenticated:o,user:r,getAccessToken:n}=V(),{closePrivyModal:i,createAnalyticsEvent:a}=_(),{data:l,outerClickRef:s}=w(),c=Y(r)?.address,{onFailure:E,onSuccess:g,origin:x,appId:m}=l.keyExport,f=h=>{i({shouldCallAuthOnSuccess:!1}),E(typeof h=="string"?new Error(h):h)},v=()=>{i({shouldCallAuthOnSuccess:!1}),g(),a("embedded_wallet_key_export_completed",{walletAddress:c})};return $l(()=>{let h=Y(r);if(!o||!h)return f("User must be authenticated before exporting their wallet");n().then(t,f)},[o,r]),s&&(s.current=v),ft(Zm,{children:[re(S,{onClose:v}),re(R,{}),ft(Vm,{children:[re(Hl,{}),ft(qm,{children:[re("h3",{children:"Transfer"}),ft(Jm,{children:[re($m,{style:{marginRight:6}}),Ft(c)]})]}),re("p",{children:"You can take your account with you to another site using an external wallet!"}),ft(jm,{children:[ft(Gl,{children:[re(zl,{children:"1"}),ft("span",{children:[re("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."]})]}),ft(Gl,{children:[re(zl,{children:"2"}),re("span",{children:"Copy this key into your other wallet"})]})]}),re("div",{style:{width:"100%"},children:e&&re(zm,{origin:x,appId:m,accessToken:e,address:c,dimensions:{height:"44px"}})}),ft(Qm,{children:[re("h4",{children:"WARNING"}),re("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),re(L,{}),re(H,{protectedByPrivy:!0})]})};function zm(e){let[t,o]=Vi(e.dimensions.width),[r,n]=Vi(void 0),i=Gm(null);return $l(()=>{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")})},[]),re("div",{ref:i,children:t&&ft(Km,{children:[re("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:Yr(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,...r})}),re(Ym,{children:"Loading..."})]})})}function $m(e){return re("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:re("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 Vm=St.div`
|
|
796
797
|
display: flex;
|
|
797
798
|
height: 100%;
|
|
798
799
|
flex-direction: column;
|
|
799
800
|
text-align: left;
|
|
800
|
-
`,
|
|
801
|
+
`,qm=St.div`
|
|
801
802
|
display: flex;
|
|
802
803
|
align-items: center;
|
|
803
804
|
justify-content: space-between;
|
|
804
805
|
margin-bottom: 8px;
|
|
805
|
-
`,
|
|
806
|
+
`,jm=St.div`
|
|
806
807
|
display: flex;
|
|
807
808
|
flex-direction: column;
|
|
808
809
|
gap: 24px;
|
|
@@ -810,7 +811,7 @@ Resources:
|
|
|
810
811
|
margin-top: 16px;
|
|
811
812
|
margin-left: 11px;
|
|
812
813
|
border-left: 1px solid var(--privy-color-foreground-4) !important;
|
|
813
|
-
`,
|
|
814
|
+
`,Gl=St.div`
|
|
814
815
|
display: flex;
|
|
815
816
|
align-items: top;
|
|
816
817
|
gap: 8px;
|
|
@@ -821,7 +822,7 @@ Resources:
|
|
|
821
822
|
text-decoration: underline;
|
|
822
823
|
}
|
|
823
824
|
}
|
|
824
|
-
`,
|
|
825
|
+
`,zl=St.div`
|
|
825
826
|
display: flex;
|
|
826
827
|
align-items: center;
|
|
827
828
|
justify-content: center;
|
|
@@ -835,10 +836,10 @@ Resources:
|
|
|
835
836
|
border-radius: 100%;
|
|
836
837
|
background: var(--privy-color-background);
|
|
837
838
|
color: var(--privy-color-accent);
|
|
838
|
-
`,
|
|
839
|
+
`,Km=St.div`
|
|
839
840
|
position: relative;
|
|
840
841
|
height: 44px;
|
|
841
|
-
`,
|
|
842
|
+
`,Ym=St.div`
|
|
842
843
|
position: absolute;
|
|
843
844
|
display: flex;
|
|
844
845
|
align-items: center;
|
|
@@ -850,7 +851,7 @@ Resources:
|
|
|
850
851
|
border-radius: var(--privy-border-radius-md);
|
|
851
852
|
background-color: var(--privy-color-background-2);
|
|
852
853
|
color: var(--privy-color-foreground-3);
|
|
853
|
-
`,
|
|
854
|
+
`,Jm=St.div`
|
|
854
855
|
display: flex;
|
|
855
856
|
align-items: center;
|
|
856
857
|
padding-top: 1px;
|
|
@@ -862,7 +863,7 @@ Resources:
|
|
|
862
863
|
border-radius: var(--privy-border-radius-md);
|
|
863
864
|
font-size: 12px;
|
|
864
865
|
font-weight: 500;
|
|
865
|
-
`,
|
|
866
|
+
`,Qm=St.div`
|
|
866
867
|
border: 2px solid var(--privy-color-background-2) !important;
|
|
867
868
|
border-radius: var(--privy-border-radius-md);
|
|
868
869
|
padding: 16px;
|
|
@@ -872,51 +873,192 @@ Resources:
|
|
|
872
873
|
&& > h4 {
|
|
873
874
|
color: var(--privy-color-error);
|
|
874
875
|
}
|
|
875
|
-
`;import{useEffect as
|
|
876
|
-
display:
|
|
877
|
-
align
|
|
878
|
-
|
|
876
|
+
`;import{useEffect as Oh,useMemo as Dh,useRef as Uh,useState as Yi}from"react";import{ArrowDownTrayIcon as gh,ArrowPathIcon as vh,DocumentDuplicateIcon as wh,ExclamationTriangleIcon as Ch,KeyIcon as bh,XCircleIcon as Eh}from"@heroicons/react/24/outline";import{CheckCircleIcon as tc}from"@heroicons/react/24/solid";import{useState as xh,useMemo as qi}from"react";import Ae,{css as Ki}from"styled-components";import Xm from"fast-password-entropy";import*as ql from"secure-password-utilities";import{DEFAULT_WORDLIST as eh}from"secure-password-utilities/wordlists";var th=95,oh=8,rh=3,nh=.3,ih=/[a-z]/,ah=/[A-Z]/,sh=/[0-9]/,lh="a-zA-Z0-9",jl="!@#$%^&*()\\-_+.",Kl=`${lh}${jl}`,ch=new RegExp(`[${jl}]`),dh=new RegExp(`[${Kl}]`),Yl=new RegExp(`^[${Kl}]{6,}$`),Jl=(e="")=>{let t=e.split("").filter(o=>!dh.test(o)).map(o=>o.replace(" ","SPACE"));return[...new Set(t)]},Vo=()=>ql.generatePassphrase(4,eh);function ph(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function uh(e){if(e.length<oh)return 0;let t=0;ih.test(e)&&(t+=1),ah.test(e)&&(t+=1),sh.test(e)&&(t+=1),ch.test(e)&&(t+=1);let o=t/rh;return Math.max(0,Math.min(1,o))}function mh(e){let t=uh(e),o=Xm(e)/th;return(t*nh+o)/2}function Ql(e=""){let t=mh(e);return{value:t,label:ph(t)}}import xn from"styled-components";import{jsx as Cr,jsxs as yh}from"react/jsx-runtime";var Zl=({className:e,checked:t,...o})=>Cr("label",{children:yh(hh,{className:e,children:[Cr(ec,{checked:t,...o}),Cr(fh,{checked:t,children:Cr(Xl,{viewBox:"0 0 24 24",children:Cr("polyline",{points:"20 6 9 17 4 12"})})})]})}),hh=xn.div`
|
|
877
|
+
display: inline-block;
|
|
878
|
+
vertical-align: middle;
|
|
879
|
+
`,Xl=xn.svg`
|
|
880
|
+
fill: none;
|
|
881
|
+
stroke: white;
|
|
882
|
+
stroke-width: 3px;
|
|
883
|
+
`,ec=xn.input.attrs({type:"checkbox"})`
|
|
884
|
+
border: 0;
|
|
885
|
+
clip: rect(0 0 0 0);
|
|
886
|
+
clippath: inset(50%);
|
|
887
|
+
height: 1px;
|
|
888
|
+
margin: -1px;
|
|
889
|
+
overflow: hidden;
|
|
890
|
+
padding: 0;
|
|
891
|
+
position: absolute;
|
|
892
|
+
white-space: nowrap;
|
|
893
|
+
width: 1px;
|
|
894
|
+
`,fh=xn.div`
|
|
895
|
+
display: inline-block;
|
|
896
|
+
width: 18px;
|
|
897
|
+
height: 18px;
|
|
898
|
+
transition: all 150ms;
|
|
899
|
+
cursor: pointer;
|
|
900
|
+
border-color: var(--privy-color-accent);
|
|
901
|
+
border-radius: 3px;
|
|
902
|
+
background: ${e=>e.checked?"var(--privy-color-accent)":"var(--privy-color-background)"};
|
|
879
903
|
|
|
880
904
|
&& {
|
|
881
|
-
|
|
905
|
+
/* This is necessary to override css reset for border width */
|
|
906
|
+
border-width: 1px;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
${ec}:focus + & {
|
|
910
|
+
box-shadow: 0 0 0 1px var(--privy-color-accent);
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
${Xl} {
|
|
914
|
+
visibility: ${e=>e.checked?"visible":"hidden"};
|
|
915
|
+
}
|
|
916
|
+
`;import{Fragment as ho,jsx as q,jsxs as Ee}from"react/jsx-runtime";var Tn=({buttonHideAnimations:e,buttonLoading:t,invalidState:o,errorMessage:r,hasSetPassword:n,loading:i,password:a,onSubmit:l,onClose:s,onPasswordChange:c,onPasswordGenerate:E})=>{let[g,x]=xh(!1),m=qi(()=>(a?.length||0)<6?"Password must be at least 6 characters":Yl.test(a||"")?null:`Invalid characters used ( ${Jl(a).join(" ")} )`,[a]),f=qi(()=>m?{value:0,label:"Weak"}:Ql(a),[a,m]),v=qi(()=>{let h=new Blob([a||""],{type:"text/plain"});return window.URL.createObjectURL(h)},[a]);return i?q(Mh,{children:q(Go,{})}):Ee(ho,{children:[q(S,{onClose:s,title:"Secure your account",closeable:!n}),q(R,{}),r||o?Ee(ho,{children:[Ee($t,{children:[q(Eh,{fill:"var(--privy-color-error)",stroke:"white",strokeWidth:".25px",width:"64px",height:"64px"}),q(be,{title:"Something went wrong",description:r})]}),q(j,{onClick:l,children:"Close"})]}):Ee(_h,{children:[Ee(Ih,{children:[n?q(Ch,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}):q(bh,{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?Ee(ho,{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(ho,{children:"Select a strong password to secure your account."})})]}),Ee(kh,{centered:n,children:[n?q(Rh,{children:a}):q(Ah,{value:a,onChange:h=>c(h.target.value)}),!n&&q(Wh,{onClick:E})]}),n?Ee(ho,{children:[Ee("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[Ee(rc,{onClick:()=>a&&navigator.clipboard.writeText(a),children:[q(wh,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]}),q(Lh,{href:v,download:"privy-wallet-recovery.txt",children:Ee(rc,{children:[q(gh,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})})]}),q(oc,{children:Ee(ji,{children:[q(Zl,{checked:g,onChange:h=>x(h.target.checked)}),q(ho,{children:"I understand that my password can\u2019t be recovered and I may lose my assets if I don\u2019t secure it."})]})})]}):Ee(ho,{children:[q(Nh,{value:f.value,label:f.label}),q(Ph,{error:m,children:m||`Password Strength: ${f.label}`}),Ee(oc,{children:[Ee(ji,{children:[q(tc,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account\u2019s crypto wallet."]}),Ee(ji,{children:[q(tc,{width:24,height:24,fill:"var(--privy-color-accent)"}),"You will only be asked to enter it when signing on to a new device."]})]})]}),q(Sh,{onClick:l,loading:t,disabled:!!m||n&&!g,hideAnimations:e,children:n?"Continue":"Set passcode"})]}),q(L,{}),q(H,{protectedByPrivy:!0})]})},Th=Ki`
|
|
917
|
+
font-size: 14px;
|
|
918
|
+
font-style: normal;
|
|
919
|
+
font-weight: 400;
|
|
920
|
+
line-height: 20px;
|
|
921
|
+
letter-spacing: -0.008px;
|
|
922
|
+
text-align: left;
|
|
923
|
+
transition: color 0.1s ease-in;
|
|
924
|
+
`,Ph=Ae.span`
|
|
925
|
+
${Th}
|
|
926
|
+
transition: color 0.1s ease-in;
|
|
927
|
+
color: ${({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
|
|
928
|
+
text-transform: ${({error:e})=>e?"":"capitalize"};
|
|
929
|
+
`,_h=Ae.div`
|
|
930
|
+
display: flex;
|
|
931
|
+
height: 100%;
|
|
932
|
+
flex-direction: column;
|
|
933
|
+
justify-content: space-between;
|
|
934
|
+
`,Sh=Ae(j)`
|
|
935
|
+
${e=>e.hideAnimations&&Ki`
|
|
936
|
+
&& {
|
|
937
|
+
transition: none;
|
|
938
|
+
}
|
|
939
|
+
`}
|
|
940
|
+
`,nc=Ki`
|
|
941
|
+
&& {
|
|
942
|
+
width: 100%;
|
|
943
|
+
border-width: 1px;
|
|
944
|
+
border-radius: var(--privy-border-radius-md);
|
|
945
|
+
border-color: var(--privy-color-foreground-3);
|
|
946
|
+
background: var(--privy-color-background);
|
|
947
|
+
color: var(--privy-color-foreground);
|
|
948
|
+
|
|
949
|
+
padding: 12px;
|
|
882
950
|
font-size: 14px;
|
|
883
|
-
|
|
884
|
-
font-weight:
|
|
885
|
-
|
|
951
|
+
font-style: normal;
|
|
952
|
+
font-weight: 300;
|
|
953
|
+
line-height: 22px; /* 137.5% */
|
|
954
|
+
letter-spacing: 0.16px;
|
|
955
|
+
}
|
|
956
|
+
`,Ah=Ae.input`
|
|
957
|
+
${nc}
|
|
958
|
+
`,Rh=Ae.div`
|
|
959
|
+
${nc}
|
|
960
|
+
`,kh=Ae.div`
|
|
961
|
+
position: relative;
|
|
962
|
+
width: 100%;
|
|
963
|
+
display: flex;
|
|
964
|
+
align-items: center;
|
|
965
|
+
justify-content: ${({centered:e})=>e?"center":"space-between"};
|
|
966
|
+
`,Wh=Ae(vh)`
|
|
967
|
+
position: absolute;
|
|
968
|
+
right: 12px;
|
|
969
|
+
height: 24px;
|
|
970
|
+
width: 24px;
|
|
971
|
+
stroke: var(--privy-color-accent);
|
|
972
|
+
cursor: pointer;
|
|
886
973
|
|
|
887
|
-
|
|
888
|
-
:
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
974
|
+
:active {
|
|
975
|
+
stroke: var(--privy-color-accent-light);
|
|
976
|
+
}
|
|
977
|
+
`,Ih=Ae.div`
|
|
978
|
+
display: flex;
|
|
979
|
+
flex-direction: column;
|
|
980
|
+
align-items: center;
|
|
981
|
+
justify-content: center;
|
|
982
|
+
margin: 20px 0;
|
|
983
|
+
gap: 4px;
|
|
894
984
|
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
985
|
+
& h3 {
|
|
986
|
+
font-size: 18px;
|
|
987
|
+
font-style: normal;
|
|
988
|
+
font-weight: 600;
|
|
989
|
+
line-height: 24px;
|
|
990
|
+
letter-spacing: -0.002px;
|
|
991
|
+
}
|
|
898
992
|
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
993
|
+
& p {
|
|
994
|
+
max-width: 300px;
|
|
995
|
+
font-size: 14px;
|
|
996
|
+
font-style: normal;
|
|
997
|
+
font-weight: 400;
|
|
998
|
+
line-height: 20px;
|
|
999
|
+
letter-spacing: -0.008px;
|
|
1000
|
+
}
|
|
1001
|
+
`,Nh=Ae.progress`
|
|
1002
|
+
height: 4px;
|
|
1003
|
+
width: 100%;
|
|
1004
|
+
margin: 8px 0;
|
|
903
1005
|
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
1006
|
+
/* border-radius: 9999px; */
|
|
1007
|
+
::-webkit-progress-bar {
|
|
1008
|
+
border-radius: 8px;
|
|
1009
|
+
background: var(--privy-color-foreground-4);
|
|
907
1010
|
}
|
|
908
1011
|
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
1012
|
+
::-webkit-progress-value {
|
|
1013
|
+
border-radius: 8px;
|
|
1014
|
+
transition: all 0.1s ease-out;
|
|
1015
|
+
background: ${({label:e})=>e==="Strong"&&"#78dca6"||e==="Medium"&&"var(--privy-color-warn)"||"var(--privy-color-error)"};
|
|
1016
|
+
}
|
|
1017
|
+
`,oc=Ae.div`
|
|
1018
|
+
display: flex;
|
|
1019
|
+
flex-direction: column;
|
|
1020
|
+
margin: 20px 0;
|
|
1021
|
+
gap: 10px;
|
|
1022
|
+
`,ji=Ae.div`
|
|
1023
|
+
display: flex;
|
|
1024
|
+
text-align: left;
|
|
1025
|
+
align-items: center;
|
|
1026
|
+
|
|
1027
|
+
gap: 8px;
|
|
1028
|
+
max-width: 300px;
|
|
1029
|
+
|
|
1030
|
+
font-size: 14px;
|
|
1031
|
+
font-style: normal;
|
|
1032
|
+
font-weight: 400;
|
|
1033
|
+
line-height: 20px;
|
|
1034
|
+
letter-spacing: -0.008px;
|
|
1035
|
+
|
|
1036
|
+
padding: 0 8px;
|
|
1037
|
+
color: var(--privy-color-foreground-2);
|
|
1038
|
+
`,Lh=Ae.a`
|
|
1039
|
+
flex: 1;
|
|
1040
|
+
width: 100%;
|
|
1041
|
+
`,rc=Ae(dn)`
|
|
1042
|
+
display: flex;
|
|
1043
|
+
flex: 1;
|
|
1044
|
+
gap: 4px;
|
|
1045
|
+
justify-content: center;
|
|
1046
|
+
|
|
1047
|
+
&& {
|
|
1048
|
+
background: var(--privy-color-background);
|
|
1049
|
+
border-radius: var(--privy-border-radius-md);
|
|
1050
|
+
border-color: var(--privy-color-foreground-3);
|
|
1051
|
+
border-width: 1px;
|
|
912
1052
|
}
|
|
913
|
-
|
|
1053
|
+
`,Mh=Ae.div`
|
|
1054
|
+
height: var(--privy-height-modal-full);
|
|
1055
|
+
`;import{jsx as Fh}from"react/jsx-runtime";var ic=()=>{let{app:e,navigate:t,data:o,outerClickRef:r}=w(),[n,i]=Yi(""),[a,l]=Yi(!1),[s,c]=Yi(e?.embeddedWallets.requireUserPasswordOnCreate?Vo():void 0),E=Uh(!1),{authenticated:g,getAccessToken:x,user:m}=V(),{walletProxy:f,refreshUser:v,closePrivyModal:h,createAnalyticsEvent:P,isNewUserThisSession:b}=_(),{onSuccess:M,onFailure:I,callAuthOnSuccessOnClose:k}=o.createWallet,W=e?.embeddedWallets.requireUserPasswordOnCreate===!1,U=!!(!n||E.current)&&W,X=Dh(()=>Y(m),[m]),O=new Fe(async()=>z());Oh(()=>{if(!g){t("LANDING"),I(new Error("User must be authenticated before creating a Privy wallet"));return}W&&!a&&!E.current&&(l(!0),O.execute().finally(()=>l(!1)))},[W,g]);let G=()=>{if(X){console.error(new Wo);return}I(new nt("User exited before creating a wallet")),h({shouldCallAuthOnSuccess:k})};r&&(r.current=()=>(G(),{closeModal:!X}));let z=async function(){let D=await x();if(D)try{P("embedded_wallet_creation_started");let de=await f?.create({accessToken:D,recoveryPassword:s});if(!de){let te=await v();if(de=Y(te),!de)throw new Error("Unable to create wallet")}P("embedded_wallet_creation_completed",{walletAddress:de.address}),i("");let $=await v();if(E.current=!0,W)if(b)t("EMBEDDED_WALLET_CREATED_SCREEN");else{let te=Y($);te&&(M(te),h({shouldCallAuthOnSuccess:k}))}}catch(de){if(E.current)return;i("An error has occurred, please try again."),console.warn(de)}};return Fh(Tn,{loading:U,invalidState:W&&!U,errorMessage:n,buttonHideAnimations:!Y&&a,buttonLoading:a||!f,hasSetPassword:!!X,password:s,onClose:G,onPasswordChange:c,onPasswordGenerate:()=>c(Vo()),onSubmit:()=>W?h({shouldCallAuthOnSuccess:k}):(l(!0),X?setTimeout(()=>{l(!1),t("EMBEDDED_WALLET_CREATED_SCREEN")},350):requestAnimationFrame(()=>O.execute().finally(()=>l(!1))))})};import{useEffect as Bh,useState as Pn}from"react";import{jsx as Hh}from"react/jsx-runtime";var ac=()=>{let[e,t]=Pn(null),[o,r]=Pn(!1),[n,i]=Pn(""),[a,l]=Pn(Vo()),{authenticated:s,getAccessToken:c,user:E}=V(),{walletProxy:g,refreshUser:x,closePrivyModal:m,createAnalyticsEvent:f}=_(),{navigate:v,data:h,outerClickRef:P}=w(),{onSuccess:b,onFailure:M}=h.createWallet,I=Y(E),k=!!e;Bh(()=>{s||(v("LANDING"),M(new Fr("User must be authenticated before setting a password on a Privy wallet")))},[s]);let W=()=>{if(k){console.error(new Wo);return}M(new nt("Exited before password was added to wallet")),m({shouldCallAuthOnSuccess:!1})};P&&(P.current=()=>(W(),{closeModal:!k}));let U=async()=>{let O=await c();if(O&&I?.address&&a&&g)try{if(f("embedded_wallet_set_password_started",{walletAddress:I.address}),!(await g.setRecoveryPassword({accessToken:O,address:I.address,recoveryPassword:a})).address){M(new nt("Error setting password on privy wallet")),f("embedded_wallet_set_password_failed",{walletAddress:I.address,reason:"error setting password"});return}let z=await x(),ee=Y(z);if(!ee){M(new nt("Error setting password on privy wallet")),f("embedded_wallet_set_password_failed",{walletAddress:I.address,reason:"wallet disconnected"});return}t(ee),f("embedded_wallet_set_password_completed",{walletAddress:I.address})}catch(G){console.warn(G),i("An error has occurred, please try again."),M(G instanceof Error?G:new Error("Error setting password on privy wallet")),f("embedded_wallet_set_password_failed",{walletAddress:I.address,reason:G})}};return Hh(Tn,{errorMessage:n,hasSetPassword:k,buttonLoading:o,onClose:W,buttonHideAnimations:!1,password:a,onPasswordGenerate:()=>l(Vo()),onPasswordChange:l,onSubmit:async()=>{k?(b(e),m({shouldCallAuthOnSuccess:!1})):(r(!0),await U(),r(!1))}})};import{UserCircleIcon as Gh}from"@heroicons/react/24/outline";import{LockClosedIcon as zh}from"@heroicons/react/24/solid";import{useEffect as $h}from"react";import{Fragment as Vh,jsx as At,jsxs as _n}from"react/jsx-runtime";var sc=()=>{let{user:e}=V(),{closePrivyModal:t,createAnalyticsEvent:o}=_(),{data:r,setModalData:n,navigate:i,outerClickRef:a}=w(),{onSuccess:l,onFailure:s}=r.setWalletPassword,c=()=>{s(new nt("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return $h(()=>{a&&(a.current=c)},[]),_n(Vh,{children:[At(S,{onClose:c}),At(R,{}),_n($t,{children:[_n(rl,{children:[At(Gh,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),At(nl,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:At(zh,{width:"12px",height:"12px",fill:"white"})})]}),_n(be,{title:"Secure Your Account",children:["Please set a password to secure your account.",At("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."})]})]}),At(j,{onClick:()=>{let g=Y(e);o("embedded_wallet_set_password_started",{walletAddress:g?.address}),n({createWallet:{onFailure:s,onSuccess:l,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),i("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),At(L,{}),At(H,{protectedByPrivy:!0})]})};import{useEffect as nf,useState as Zi}from"react";import Xi,{css as af}from"styled-components";import{useEffect as qh,useState as br}from"react";import Qi from"styled-components";import{jsx as lc}from"react/jsx-runtime";var cc=({style:e,...t})=>lc("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:lc("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99"})});import{jsx as dc}from"react/jsx-runtime";var Sn=({style:e,color:t,...o})=>dc("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:dc("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{Fragment as rf,jsx as fo,jsxs as An}from"react/jsx-runtime";var qo=6,jh=new Array(qo).fill("");function Kh(e){return e.replace(/\s+/g,"")}function Ji(e){return/^[a-zA-Z0-9]{1}$/.test(e)}function Yh(e){return/^[a-zA-Z]{1}$/.test(e)}function Jh(e){return/^[a-z]{1}$/.test(e)}function pc(e){return e.length===qo&&e.every(Ji)}function Qh(e,t){return e.reduce((o,r)=>o+Number(t(r)),0)}function Zh(){return crypto.getRandomValues(new Uint8Array(1))[0]}function Xh(){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",t=[];for(;t.length<qo;){let o=Zh();o>247||t.push(e.charAt(o%62))}return t.join("")}var mc=({onChange:e,disabled:t,readOnly:o,disableGeneration:r,errorReasonOverride:n})=>{let[i,a]=br(jh),[l,s]=br(null),[c,E]=br(null),g=f=>{let v=Kh(f.currentTarget.value);if(v==="")return;let h=Qh(i,Ji),P=v.split(""),b=!P.every(Ji),M=P.length+h>qo;if(b){s("Passcode can only be letters and numbers"),E(1);return}if(M){s("Passcode must be exactly 6 letters and numbers"),E(1);return}s(null),E(null);let I=Number(f.currentTarget.name?.charAt(4)),k=[...v||[""]].slice(0,qo-I),W=[...i.slice(0,I),...k,...i.slice(I+k.length)];a(W);let U=k.length,X=Math.min(Math.max(I+U,0),qo-1),O=document.querySelector(`input[name=pin-${X}]`),G=k[k.length-1]||"";Yh(G)&&(Jh(G)?O.autocapitalize="none":O.autocapitalize="on"),O?.focus(),pc(W)?(document.querySelector(`input[name=pin-${X}]`)?.blur(),e(W.join(""))):e(null),f.preventDefault()},x=f=>{c===1&&(s(null),E(null));let v=[...i.slice(0,f),"",...i.slice(f+1)];a(v),f>0&&document.querySelector(`input[name=pin-${f-1}]`)?.focus(),pc(v)?e(v.join("")):e(null)},m=o||r;return An(rf,{children:[An(ef,{children:[An("div",{children:[fo(uc,{fail:!!n||!!l,children:n||l||"Passcode can be letters and numbers"}),fo(uc,{children:"Passcodes are case sensitive."})]}),fo("div",{children:i.map((f,v)=>fo("input",{name:`pin-${v}`,type:"text",value:i[v],onChange:g,onKeyUp:h=>{h.key==="Backspace"&&x(v)},inputMode:"text",autoFocus:v===0,pattern:"[a-zA-Z0-9]",className:l?"fail":"",autoComplete:"off",disabled:t||o,autoCapitalize:"none"},v))})]}),!m&&fo(tf,{disabled:t,onClick:()=>{let f=Xh();a([...f]),e(f)}})]})},ef=Qi.div`
|
|
914
1056
|
display: flex;
|
|
915
1057
|
flex-direction: column;
|
|
916
1058
|
width: 100%;
|
|
917
1059
|
gap: 8px;
|
|
918
1060
|
|
|
919
|
-
${
|
|
1061
|
+
${Rn}[data-height='medium'] & {
|
|
920
1062
|
margin-top: 22px;
|
|
921
1063
|
}
|
|
922
1064
|
|
|
@@ -977,7 +1119,7 @@ Resources:
|
|
|
977
1119
|
transform: translate(1px, 0px);
|
|
978
1120
|
}
|
|
979
1121
|
}
|
|
980
|
-
|
|
1122
|
+
`,uc=Qi.div`
|
|
981
1123
|
line-height: 20px;
|
|
982
1124
|
height: 20px;
|
|
983
1125
|
font-size: 13px;
|
|
@@ -986,7 +1128,7 @@ Resources:
|
|
|
986
1128
|
width: 100%;
|
|
987
1129
|
|
|
988
1130
|
color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
|
|
989
|
-
`,
|
|
1131
|
+
`,tf=({onClick:e,disabled:t,...o})=>{let[r,n]=br(!1),[i,a]=br();return qh(()=>{t&&i&&clearTimeout(i),a(void 0)},[t]),An(of,{onClick:l=>{i&&clearTimeout(i),n(!0),e?.(l),a(setTimeout(()=>n(!1),1e3))},justGenerated:r,disabled:t,...o,children:[r?fo(Sn,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):fo(cc,{style:{height:"14px",width:"14px"}}),r?"Generated":"Generate"," passcode"]})},of=Qi.button`
|
|
990
1132
|
display: flex;
|
|
991
1133
|
align-items: center;
|
|
992
1134
|
gap: 6px;
|
|
@@ -1024,12 +1166,12 @@ Resources:
|
|
|
1024
1166
|
width: 14px;
|
|
1025
1167
|
height: 14px;
|
|
1026
1168
|
}
|
|
1027
|
-
`;import{Fragment as
|
|
1169
|
+
`;import{Fragment as df,jsx as Rt,jsxs as kn}from"react/jsx-runtime";var hc=()=>{let{authenticated:e,getAccessToken:t}=V(),{walletProxy:o,closePrivyModal:r,createAnalyticsEvent:n}=_(),{navigate:i,data:a,outerClickRef:l}=w(),[s,c]=Zi(void 0),[E,g]=Zi(""),[x,m]=Zi(!1),{privyWallet:f,onCompleteNavigateTo:v,onSuccess:h,onFailure:P}=a.recoverWallet,b=k=>{r({shouldCallAuthOnSuccess:!1}),P(typeof k=="string"?new Error(k):k)};return l&&(l.current=()=>b("User exited before their wallet could be recovered")),nf(()=>{if(!e||!f)return b("User must be authenticated and have a Privy wallet before it can be recovered")},[e]),kn(df,{children:[Rt(S,{onClose:()=>b("User exited before their wallet could be recovered")}),Rt(R,{}),kn(sf,{children:[kn("div",{children:[Rt($e,{title:"Load your account",description:"We haven't seen this device yet. To continue, please enter your passcode."}),Rt(mc,{onChange:k=>{k&&c(k)},disabled:x,errorReasonOverride:E,disableGeneration:!0})]}),kn(lf,{children:[Rt("h4",{children:"Why am I doing this?"}),Rt("p",{children:"When you created your account, you entered a passcode\u2014this helps secure your digital wallet and ensure only you can access it."})]}),Rt(cf,{loading:x||!o,disabled:!s,onClick:async()=>{m(!0);let k=await t();if(k&&f&&s!==null)try{n("embedded_wallet_recovery_started",{walletAddress:f.address}),await o?.recover({address:f.address,accessToken:k,recoveryPin:s}),g(""),v?i(v):r({shouldCallAuthOnSuccess:!1}),h?.(f),n("embedded_wallet_recovery_completed",{walletAddress:f.address})}catch(W){Nl(W)?g("Invalid recovery passcode, please try again."):g("An error has occurred, please try again.")}finally{m(!1)}else return b("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!f&&x,children:"Recover your account"})]}),Rt(L,{}),Rt(H,{protectedByPrivy:!0})]})},sf=Xi.div`
|
|
1028
1170
|
display: flex;
|
|
1029
1171
|
height: 100%;
|
|
1030
1172
|
flex-direction: column;
|
|
1031
1173
|
justify-content: space-between;
|
|
1032
|
-
`,
|
|
1174
|
+
`,lf=Xi.div`
|
|
1033
1175
|
display: flex;
|
|
1034
1176
|
flex-direction: column;
|
|
1035
1177
|
justify-content: flex-start;
|
|
@@ -1054,21 +1196,21 @@ Resources:
|
|
|
1054
1196
|
color: var(--privy-color-foreground-3);
|
|
1055
1197
|
font-size: 14px;
|
|
1056
1198
|
}
|
|
1057
|
-
`,
|
|
1058
|
-
${e=>e.hideAnimations&&
|
|
1199
|
+
`,cf=Xi(j)`
|
|
1200
|
+
${e=>e.hideAnimations&&af`
|
|
1059
1201
|
&& {
|
|
1060
1202
|
// Remove animations because the recoverWallet task on the iframe partially
|
|
1061
1203
|
// blocks the renderer, so the animation stutters and doesn't look good
|
|
1062
1204
|
transition: none;
|
|
1063
1205
|
}
|
|
1064
1206
|
`}
|
|
1065
|
-
`;import{
|
|
1207
|
+
`;import{EyeSlashIcon as uf,LinkIcon as mf,ClockIcon as hf}from"@heroicons/react/24/outline";import kt from"styled-components";import{jsx as ea,jsxs as pf}from"react/jsx-runtime";var Wn=({size:e=61,...t})=>ea("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:pf("g",{id:"moonpay_symbol_wht 2",children:[ea("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),ea("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 fc,jsx as xe,jsxs as yo}from"react/jsx-runtime";var ta=({title:e,desc:t,icon:o})=>yo(wf,{children:[xe(bf,{children:o}),yo(Cf,{children:[xe(gf,{children:e}),xe(vf,{children:t})]})]}),yc=({app:e,signedUrl:t,onContinue:o})=>yo(fc,{children:[yo(ff,{children:[xe(Wn,{size:"3.75rem"}),yo(yf,{children:[e?.name," uses ",xe("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),yo(Ef,{children:[xe(ta,{icon:xe(mf,{width:"1rem"}),title:"Purchase assets to fund your account",desc:yo(fc,{children:["Connect a payment method (",xe("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),xe(ta,{icon:xe(hf,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),xe(ta,{icon:xe(uf,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),xe(xf,{className:"mobile-only"})]}),xe(pe,{children:xe(pn,{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"})})]}),ff=kt.div`
|
|
1066
1208
|
display: flex;
|
|
1067
1209
|
flex-direction: column;
|
|
1068
1210
|
align-items: center;
|
|
1069
1211
|
justify-content: center;
|
|
1070
1212
|
padding-top: 2rem;
|
|
1071
|
-
`,
|
|
1213
|
+
`,yf=kt.span`
|
|
1072
1214
|
color: var(--privy-color-foreground);
|
|
1073
1215
|
text-align: center;
|
|
1074
1216
|
font-size: 1.125rem;
|
|
@@ -1077,64 +1219,64 @@ Resources:
|
|
|
1077
1219
|
margin: 1.5rem 0;
|
|
1078
1220
|
text-align: center;
|
|
1079
1221
|
max-width: 19.5rem;
|
|
1080
|
-
`,
|
|
1222
|
+
`,gf=kt.span`
|
|
1081
1223
|
color: var(--privy-color-foreground);
|
|
1082
1224
|
font-size: 0.875rem;
|
|
1083
1225
|
font-weight: 500;
|
|
1084
1226
|
line-height: 1.225rem;
|
|
1085
1227
|
width: 100%;
|
|
1086
|
-
`,
|
|
1228
|
+
`,vf=kt.span`
|
|
1087
1229
|
color: var(--privy-color-foreground-2);
|
|
1088
1230
|
font-size: 0.875rem;
|
|
1089
1231
|
font-weight: 400;
|
|
1090
1232
|
line-height: 1.225rem;
|
|
1091
|
-
`,
|
|
1233
|
+
`,wf=kt.div`
|
|
1092
1234
|
display: flex;
|
|
1093
1235
|
align-items: flex-start;
|
|
1094
1236
|
gap: 0.5rem;
|
|
1095
1237
|
align-self: stretch;
|
|
1096
|
-
`,
|
|
1238
|
+
`,Cf=kt.div`
|
|
1097
1239
|
display: flex;
|
|
1098
1240
|
flex-direction: column;
|
|
1099
1241
|
gap: 0.25rem;
|
|
1100
1242
|
align-items: flex-start;
|
|
1101
1243
|
text-align: left;
|
|
1102
1244
|
flex: 1 0 0;
|
|
1103
|
-
`,
|
|
1245
|
+
`,bf=kt.div`
|
|
1104
1246
|
padding-top: 2px;
|
|
1105
|
-
`,
|
|
1247
|
+
`,Ef=kt.div`
|
|
1106
1248
|
display: flex;
|
|
1107
1249
|
flex-direction: column;
|
|
1108
1250
|
gap: 1.25rem;
|
|
1109
1251
|
margin: 0 0.5rem;
|
|
1110
|
-
`,
|
|
1252
|
+
`,xf=kt.div`
|
|
1111
1253
|
margin: 30px 0;
|
|
1112
|
-
`;import{ofetch as
|
|
1254
|
+
`;import{ofetch as Tf}from"ofetch";import{useEffect as Pf,useRef as _f,useState as Sf}from"react";var In="moonpay",gc="sdk_fiat_on_ramp_completed_with_status";async function vc(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 Af(e,t){let o=t?bs:Cs,r=t?xs:Es;return Tf(`${o}/transactions/ext/${e}`,{query:{apiKey:r}})}function wc(e,t=!1){let[o,r]=Sf(null),{createAnalyticsEvent:n}=_(),i=_f(0);return Pf(()=>{let a=setInterval(async()=>{if(e)try{let[l]=await Af(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;r(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n(gc,{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(gc,{status:"serviceFailure",provider:In}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),o}import{Fragment as Rf,jsx as Nn,jsxs as kf}from"react/jsx-runtime";var Cc=()=>{let{app:e,data:t,navigate:o}=w(),{createAnalyticsEvent:r}=_(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:kf(Rf,{children:[Nn(S,{title:"Fund account"},"header"),Nn(R,{}),Nn(yc,{app:e,signedUrl:n,onContinue:()=>{r("sdk_fiat_on_ramp_started",{provider:In}),o("FIAT_ON_RAMP_STATUS_SCREEN")}}),Nn(H,{protectedByPrivy:!0})]})};import{ArrowsRightLeftIcon as Wf,CheckCircleIcon as If,XCircleIcon as Nf}from"@heroicons/react/24/solid";import{useMemo as Lf}from"react";import bc from"styled-components";import{Fragment as oa,jsx as ge,jsxs as go}from"react/jsx-runtime";var Ec=()=>{let{app:e,data:t}=w(),{closePrivyModal:o}=_(),{externalTransactionId:r}=t?.fiatOnRampStatus,n=wc(r||null,e.fiatOnRamp.useSandbox);return go(oa,{children:[ge(S,{title:"Fund account"},"header"),ge(R,{}),ge(Of,{status:n,onClickCta:o}),ge(H,{protectedByPrivy:!0})]})},Mf=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(oa,{children:[go("p",{children:["It looks like there was an issue with your payment. Please contact"," ",ge("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),ge("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:""}}},Of=({status:e,onClickCta:t})=>{let{title:o,body:r,cta:n}=Lf(()=>Mf(e),[e]);return go(oa,{children:[go(Hf,{style:{height:"100%",gap:0},children:[ge(Ff,{status:e}),go(Vt,{children:[ge("h3",{children:o}),ge(Bf,{children:r})]})]}),n&&ge(pe,{children:ge(j,{onClick:t,children:n})})]})},Df=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)",Uf=e=>{switch(e){case"serviceFailure":case"failed":return Nf;case"completed":return If;case"waitingAuthorization":return()=>ge(Wf,{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}},Ff=({status:e})=>{if(!e||e==="pending"){let r="var(--privy-color-foreground-4)";return go("div",{style:{position:"relative"},children:[ge(uo,{color:r,style:{position:"absolute"}}),ge(_i,{color:r}),ge(Wn,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=Uf(e),o=Df(e);return ge("div",{style:{borderColor:o,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&ge(t,{width:"4rem",height:"4rem",color:o})})},Bf=bc.p`
|
|
1113
1255
|
font-size: 1rem;
|
|
1114
1256
|
color: var(--privy-color-foreground-3);
|
|
1115
1257
|
margin-bottom: 1rem;
|
|
1116
1258
|
display: flex;
|
|
1117
1259
|
flex-direction: column;
|
|
1118
1260
|
gap: 1rem;
|
|
1119
|
-
`,
|
|
1261
|
+
`,Hf=bc.div`
|
|
1120
1262
|
display: flex;
|
|
1121
1263
|
flex-direction: column;
|
|
1122
1264
|
align-items: center;
|
|
1123
1265
|
justify-content: center;
|
|
1124
1266
|
margin-left: 1.75rem;
|
|
1125
1267
|
margin-right: 1.75rem;
|
|
1126
|
-
`;import{useState as
|
|
1268
|
+
`;import{useState as oy}from"react";import*as Wt from"react-device-detect";import gt from"styled-components";import ra from"styled-components";import{jsx as xc}from"react/jsx-runtime";var Tc=({style:e,...t})=>xc("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:xc("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 zf,jsxs as $f}from"react/jsx-runtime";var Ln=ra.div`
|
|
1127
1269
|
display: flex;
|
|
1128
1270
|
flex-direction: column;
|
|
1129
1271
|
justify-content: flex-start;
|
|
1130
1272
|
gap: 4px;
|
|
1131
|
-
`,
|
|
1273
|
+
`,vo=ra.div`
|
|
1132
1274
|
&&& {
|
|
1133
1275
|
margin-left: 7px; /* TODO: This is a total hack */
|
|
1134
1276
|
border-left: 2px solid var(--privy-color-foreground-4);
|
|
1135
1277
|
height: 12px;
|
|
1136
1278
|
}
|
|
1137
|
-
`,
|
|
1279
|
+
`,yt=({children:e})=>$f(Gf,{children:[zf(Tc,{style:{width:"16px",height:"16px"}}),e]}),Gf=ra.div`
|
|
1138
1280
|
display: flex;
|
|
1139
1281
|
justify-content: flex-start;
|
|
1140
1282
|
justify-items: center;
|
|
@@ -1152,7 +1294,7 @@ Resources:
|
|
|
1152
1294
|
margin-bottom: auto;
|
|
1153
1295
|
}
|
|
1154
1296
|
}
|
|
1155
|
-
`;import
|
|
1297
|
+
`;import Vf from"qrcode";import qf from"styled-components";import{Fragment as jo,jsx as Te,jsxs as Sc}from"react/jsx-runtime";var Me=7,na=(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},jf=e=>{let t=Vf.create(e,{errorCorrectionLevel:"high"}).modules,o=_s(Array.from(t.data),t.size);return o=na(o,0,0,Me,Me),o=na(o,o.length-Me,0,Me,Me),o=na(o,0,o.length-Me,Me,Me),o},Kf=({x:e,y:t,cellSize:o,bgColor:r,fgColor:n})=>Te(jo,{children:[0,1,2].map(i=>Te("circle",{r:o*(Me-i*2)/2,cx:e+o*Me/2,cy:t+o*Me/2,fill:i%2!==0?r:n},`finder-${e}-${t}-${i}`))}),Yf=({cellSize:e,matrixSize:t,bgColor:o,fgColor:r})=>{let n=[[0,0],[(t-Me)*e,0],[0,(t-Me)*e]];return Te(jo,{children:n.map(([i,a])=>Te(Kf,{x:i,y:a,cellSize:e,bgColor:o,fgColor:r}))})},Jf=({matrix:e,cellSize:t,color:o})=>Te(jo,{children:e.map((r,n)=>r.map((i,a)=>i?Te("circle",{r:t/2.5,cx:n*t+t/2,cy:a*t+t/2,fill:o},`circle-${n}-${a}`):Te(jo,{})))}),Pc=(e,t)=>e-e%t,Qf=({outputSize:e,cellSize:t,element:o,size:r,padding:n,bgColor:i})=>{if(!o)return Te(jo,{});let a=r||40,l=n||4,s=o,c=e/2-a/2-l;return Sc(jo,{children:[Te("rect",{x:Pc(c,t),y:Pc(c,t),width:a+l*2+(c%t?t+.5:.5),height:a+l*2+(c%t?t+.5:.5),fill:i}),Te(s,{x:e/2-a/2,y:e/2-a/2,height:a,width:a})]})},Zf=e=>{let t=e.outputSize,o=jf(e.url),r=t/o.length;return Sc("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[Te(Jf,{matrix:o,cellSize:r,color:e.fgColor}),Te(Yf,{cellSize:r,matrixSize:o.length,fgColor:e.fgColor,bgColor:e.bgColor}),Te(Qf,{outputSize:e.outputSize,cellSize:r,element:e.logo?.element,bgColor:e.bgColor})]})},Xf=qf.div`
|
|
1156
1298
|
display: flex;
|
|
1157
1299
|
justify-content: center;
|
|
1158
1300
|
align-items: center;
|
|
@@ -1167,7 +1309,7 @@ Resources:
|
|
|
1167
1309
|
border-color: ${e=>e.fgColor};
|
|
1168
1310
|
border-radius: var(--privy-border-radius-md);
|
|
1169
1311
|
}
|
|
1170
|
-
`,
|
|
1312
|
+
`,_c=e=>{let t=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",r=e.size||160;return Te(Xf,{size:r,bgColor:t,fgColor:o,children:Te(Zf,{url:e.url,logo:{element:e.squareLogoElement},outputSize:r,bgColor:t,fgColor:o})})};import{jsx as ey}from"react/jsx-runtime";var Ac=({size:e})=>ey(_c,{url:"https://coinbase-wallet.onelink.me/q5Sx/fdb9b250",squareLogoElement:st,size:e,fgColor:"#1F1F1F"});import{jsx as Rc}from"react/jsx-runtime";var kc=e=>Rc("svg",{width:"160",height:"160",viewBox:"0 0 160 160",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Rc("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 ve,jsxs as ty}from"react/jsx-runtime";var Wc=({style:e,...t})=>ty("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:[ve("rect",{x:"198.5",y:"133",width:"50",height:"50",rx:"25",fill:"#E1E7EF"}),ve(Ce,{x:"206",y:"140",width:"36",height:"36"}),ve("rect",{x:"192",y:"30",width:"50",height:"50",rx:"25",fill:"#0C5BFF"}),ve("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"}),ve("rect",{x:"39.5",y:"18",width:"50",height:"50",rx:"50",fill:"#AB9FF2"}),ve(He,{x:"44.5",y:"23",width:"40",height:"40"}),ve("rect",{x:"46.5",y:"124",width:"50",height:"50",rx:"25",fill:"#141414"}),ve("g",{clipPath:"url(#clip0_428_81)",children:ve("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"})}),ve("rect",{x:"103.5",y:"58",width:"78",height:"78",rx:"39",fill:"var(--privy-color-foreground-accent)"}),ve(kc,{x:"63",y:"17"}),ve("rect",{x:"103.5",y:"58",width:"78",height:"78",rx:"39",stroke:"#E1E7EF",strokeWidth:"2"}),ve("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"}),ve("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"}),ve("defs",{children:ve("clipPath",{id:"clip0_428_81",children:ve("rect",{width:"31.6667",height:"19.1667",fill:"white",transform:"translate(55.6667 139.833)"})})})]});import{Fragment as ia,jsx as A,jsxs as le}from"react/jsx-runtime";var aa=()=>{let{navigate:e}=w(),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/"),le(ca,{children:[A($e,{title:"Create a MetaMask wallet",description:"Follow the instructions below to get started."}),A(da,{children:A(Ce,{style:{width:"152px",height:"152px"}})}),le(Ln,{children:[A(yt,{children:le("div",{children:[A("span",{children:"Install the "}),A("a",{href:t,target:"_blank",children:"MetaMask browser extension"})]})}),A(vo,{}),A(yt,{children:"Set up your first wallet"}),A(vo,{}),A(yt,{children:"Store your recovery phrase in a safe place!"})]}),A(fe,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},sa=()=>{let{navigate:e}=w(),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/"),le(ca,{children:[A($e,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),A(da,{children:A(He,{style:{width:"152px",height:"152px"}})}),le(Ln,{children:[A(yt,{children:le("div",{children:[A("span",{children:"Install the "}),A("a",{href:t,target:"_blank",children:"Phantom browser extension"})]})}),A(vo,{}),A(yt,{children:"Set up your first wallet"}),A(vo,{}),A(yt,{children:"Store your recovery phrase in a safe place!"})]}),A(fe,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},la=()=>{let{navigate:e}=w();return le(ca,{children:[A($e,{title:"Create a Coinbase wallet",description:"Follow the instructions below to get started."}),A(da,{style:{marginTop:"-24px"},children:A(Ac,{size:200})}),le(Ln,{children:[A(yt,{children:"Scan the QR code with your camera"}),A(vo,{}),A(yt,{children:"Set up your first wallet"}),A(vo,{}),A(yt,{children:"Store your seed phrase in a safe place!"})]}),A(fe,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},Lc=()=>{let[e,t]=oy("WHAT_IS_A_WALLET"),{navigateBack:o}=w();return le(ia,{children:[A(S,{backFn:e==="WHAT_IS_A_WALLET"?o:e==="PICK_A_NEW_WALLET"?()=>t("WHAT_IS_A_WALLET"):()=>t("PICK_A_NEW_WALLET")},"header"),A(R,{}),le(ry,{children:[e==="WHAT_IS_A_WALLET"&&le(ia,{children:[A(ly,{children:A(Wc,{style:{width:"240px",height:"auto",borderRadius:"var(--privy-border-radius-sm)",marginBottom:"32px"}})}),le(be,{title:"Get started with a new wallet",children:[A("p",{children:"Wallets help you store, send, and receive digital assets and collectibles. They are also a new\xA0way\xA0to\xA0log\xA0in."}),A("p",{children:"Instead of creating new accounts and passwords for every app, you just connect your wallet and bring your\xA0data\xA0with\xA0you."})]}),A(ay,{children:A(sy,{onClick:()=>{t("PICK_A_NEW_WALLET")},children:"Create a wallet"})})]}),e==="PICK_A_NEW_WALLET"&&A(ia,{children:le(ny,{children:[A($e,{title:"Create a new wallet",description:"Select one of the wallet providers below to get started."}),le(iy,{children:[le(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:[A(Ce,{}),le(Nc,{children:[A("h4",{children:"MetaMask"}),A("p",{children:"Get a browser-based wallet"})]})]}),le(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:[A(st,{}),le(Nc,{children:[A("h4",{children:"Coinbase Wallet"}),A("p",{children:"Get a mobile app wallet"})]})]})]})]})}),e==="CREATE_COINBASE_WALLET"&&A(la,{}),e==="CREATE_METAMASK_WALLET"&&A(aa,{}),e==="CREATE_PHANTOM_WALLET"&&A(sa,{})]}),A(L,{}),le(J,{children:[A("span",{children:"Still not sure? "}),A("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"}),"."]})]})},ry=gt.div`
|
|
1171
1313
|
display: flex;
|
|
1172
1314
|
flex-direction: column;
|
|
1173
1315
|
height: 100%;
|
|
@@ -1178,19 +1320,19 @@ Resources:
|
|
|
1178
1320
|
display: none;
|
|
1179
1321
|
}
|
|
1180
1322
|
}
|
|
1181
|
-
`,
|
|
1323
|
+
`,ny=gt.div`
|
|
1182
1324
|
display: flex;
|
|
1183
1325
|
flex-direction: column;
|
|
1184
1326
|
align-items: flex-start;
|
|
1185
1327
|
justify-content: flex-start;
|
|
1186
1328
|
text-align: left;
|
|
1187
1329
|
gap: 20px;
|
|
1188
|
-
`,
|
|
1330
|
+
`,iy=gt.div`
|
|
1189
1331
|
display: flex;
|
|
1190
1332
|
flex-direction: column;
|
|
1191
1333
|
width: 100%;
|
|
1192
1334
|
gap: 8px;
|
|
1193
|
-
`,
|
|
1335
|
+
`,Ic=gt.button`
|
|
1194
1336
|
display: flex;
|
|
1195
1337
|
flex-direction: row;
|
|
1196
1338
|
align-items: center;
|
|
@@ -1223,24 +1365,24 @@ Resources:
|
|
|
1223
1365
|
:hover {
|
|
1224
1366
|
border: 1px solid var(--privy-color-accent-light);
|
|
1225
1367
|
}
|
|
1226
|
-
`,
|
|
1368
|
+
`,Nc=gt.div`
|
|
1227
1369
|
text-align: left;
|
|
1228
1370
|
|
|
1229
1371
|
p {
|
|
1230
1372
|
font-style: italic;
|
|
1231
1373
|
font-size: 12px;
|
|
1232
1374
|
}
|
|
1233
|
-
`,
|
|
1375
|
+
`,ay=gt.div`
|
|
1234
1376
|
margin-top: auto;
|
|
1235
1377
|
display: flex;
|
|
1236
1378
|
align-items: flex-end;
|
|
1237
1379
|
flex-grow: 1;
|
|
1238
1380
|
width: 100%;
|
|
1239
|
-
`,
|
|
1381
|
+
`,sy=gt(j)`
|
|
1240
1382
|
&& {
|
|
1241
1383
|
margin-top: 14px;
|
|
1242
1384
|
}
|
|
1243
|
-
`,
|
|
1385
|
+
`,ca=gt.div`
|
|
1244
1386
|
display: flex;
|
|
1245
1387
|
flex-direction: column;
|
|
1246
1388
|
align-items: center;
|
|
@@ -1252,17 +1394,17 @@ Resources:
|
|
|
1252
1394
|
> :first-child > svg {
|
|
1253
1395
|
margin-top: 20px;
|
|
1254
1396
|
}
|
|
1255
|
-
`,
|
|
1397
|
+
`,da=gt.div`
|
|
1256
1398
|
display: flex;
|
|
1257
1399
|
flex-direction: column;
|
|
1258
1400
|
align-items: center;
|
|
1259
1401
|
justify-content: center;
|
|
1260
1402
|
width: 100%;
|
|
1261
|
-
`,
|
|
1403
|
+
`,ly=gt.div`
|
|
1262
1404
|
display: flex;
|
|
1263
1405
|
justify-content: center;
|
|
1264
1406
|
flex-grow: 1;
|
|
1265
|
-
`;import{Fragment as
|
|
1407
|
+
`;import{Fragment as cy,jsx as Ko,jsxs as Mc}from"react/jsx-runtime";var Oc=()=>{let{navigateBack:e}=w();return Mc(cy,{children:[Ko(S,{backFn:e},"header"),Ko(R,{}),Ko(la,{}),Ko(L,{}),Mc(J,{children:[Ko("span",{children:"Still not sure? "}),Ko("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})};import{Fragment as dy,jsx as Yo,jsxs as Dc}from"react/jsx-runtime";var Uc=()=>{let{navigateBack:e}=w();return Dc(dy,{children:[Yo(S,{backFn:e},"header"),Yo(R,{}),Yo(aa,{}),Yo(L,{}),Dc(J,{children:[Yo("span",{children:"Still not sure? "}),Yo("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})};import{Fragment as py,jsx as Jo,jsxs as Fc}from"react/jsx-runtime";var Bc=()=>{let{navigateBack:e}=w();return Fc(py,{children:[Jo(S,{backFn:e},"header"),Jo(R,{}),Jo(sa,{}),Jo(L,{}),Fc(J,{children:[Jo("span",{children:"Still not sure? "}),Jo("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})};import{useState as Ay}from"react";import{isMobile as qc}from"react-device-detect";import Qo from"styled-components";import{EnvelopeIcon as uy}from"@heroicons/react/24/outline";import{useEffect as pa,useState as ua}from"react";import ha from"styled-components";import{Fragment as yy,jsx as wo,jsxs as ma}from"react/jsx-runtime";var Mn=e=>{let[t,o]=ua(""),[r,n]=ua(!1),[i,a]=ua(null),{isLinking:l,initLoginWithEmail:s,captchaData:c}=_(),{app:E,navigate:g}=w(),x=E?.loginMethods.wallet??!1;pa(()=>{document.querySelector("#email-input")?.focus()},[]);let m=Ts(t),f=()=>{n(!0),s(t,c.token).then(()=>{c.enabled&&c.remove(),g("AWAITING_PASSWORDLESS_CODE")}).catch(b=>{b?.status===422?a(b.message):b?.privyErrorCode==="allowlist_rejected"?g("ALLOWLIST_REJECTION_SCREEN"):(console.error(b),a("Issue submitting email")),n(!1)})},v="Get started without a wallet.";i?v=i:l?v="\u200B":x||(v="Get started quickly with email");let h=c.enabled&&!c.token&&!c.error,P=c.error!==void 0;return pa(()=>{c.error&&a("Issue verifying you are a human")},[c.error]),pa(()=>{c.ready&&c.execute()},[c.ready]),ma(yy,{children:[ma(my,{stacked:e.stacked,children:[ma(hy,{standalone:e.stacked,children:[wo(uy,{}),wo("input",{id:"email-input",type:"email",placeholder:"your@email.com",onChange:b=>o(b.target.value),onKeyUp:b=>{b.key==="Enter"&&f()},value:t,autoComplete:"email"})]}),e.stacked?null:wo(mn,{disabled:r||!m||h||P,onClick:f,children:r||h?wo(Gt,{}):"Submit"})]}),c.enabled&&wo("div",{id:"cf-turnstile"}),wo(fy,{fail:!!i,children:v}),e.stacked?wo(j,{loading:r||h,loadingText:null,disabled:r||!m||h||P,onClick:f,children:"Submit"}):null]})},my=ha.div`
|
|
1266
1408
|
width: 100%;
|
|
1267
1409
|
height: ${e=>e.stacked?"100%":"auto"};
|
|
1268
1410
|
|
|
@@ -1274,7 +1416,7 @@ Resources:
|
|
|
1274
1416
|
@media (max-width: 440px) {
|
|
1275
1417
|
margin-top: 20px;
|
|
1276
1418
|
}
|
|
1277
|
-
`,
|
|
1419
|
+
`,hy=ha.label`
|
|
1278
1420
|
display: flex;
|
|
1279
1421
|
flex-direction: row;
|
|
1280
1422
|
align-items: center;
|
|
@@ -1311,7 +1453,7 @@ Resources:
|
|
|
1311
1453
|
line-height: 24px;
|
|
1312
1454
|
}
|
|
1313
1455
|
}
|
|
1314
|
-
`,
|
|
1456
|
+
`,fy=ha.div`
|
|
1315
1457
|
line-height: 20px;
|
|
1316
1458
|
height: 20px;
|
|
1317
1459
|
font-size: 13px;
|
|
@@ -1324,7 +1466,7 @@ Resources:
|
|
|
1324
1466
|
> a {
|
|
1325
1467
|
text-decoration: underline;
|
|
1326
1468
|
}
|
|
1327
|
-
`;import{PhoneIcon as
|
|
1469
|
+
`;import{PhoneIcon as gy}from"@heroicons/react/24/outline";import{useEffect as fa,useState as ya}from"react";import va from"styled-components";import{Fragment as by,jsx as Co,jsxs as ga}from"react/jsx-runtime";var On=e=>{let[t,o]=ya(""),[r,n]=ya(!1),[i,a]=ya(null),{isLinking:l,initLoginWithSms:s,captchaData:c}=_(),{app:E,navigate:g}=w(),x=E?.loginMethods.wallet??!1;fa(()=>{document.querySelector("#phone-number-input")?.focus()},[]);let m=Ps(t),f=()=>{n(!0),s(t,c.token).then(()=>{c.enabled&&c.remove(),g("AWAITING_PASSWORDLESS_CODE")}).catch(b=>{b?.status===422?a(b.message):b?.privyErrorCode==="allowlist_rejected"?g("ALLOWLIST_REJECTION_SCREEN"):(console.error(b),a("Issue submitting phone number")),n(!1)})},v="Get started without a wallet.";i?v=i:l?v="\u200B":x||(v="Get started quickly with your phone");let h=c.enabled&&!c.token&&!c.error,P=c.error!==void 0;return fa(()=>{c.error&&a("Issue verifying you are a human")},[c.error]),fa(()=>{c.ready&&c.execute()},[c.ready]),ga(by,{children:[ga(vy,{stacked:e.stacked,children:[ga(wy,{standalone:e.stacked,children:[Co(gy,{}),Co("input",{id:"phone-number-input",type:"tel",placeholder:"555 555 5555",onChange:b=>{o(b.target.value)},onKeyUp:b=>{b.key==="Enter"&&f()},value:t,autoComplete:"tel"})]}),e.stacked?null:Co(mn,{disabled:r||!m||h||P,onClick:f,children:r||h?Co(Gt,{}):"Submit"})]}),c.enabled&&Co("div",{id:"cf-turnstile"}),Co(Cy,{fail:!!i,children:v}),e.stacked?Co(j,{loading:r||h,loadingText:null,disabled:r||!m||h||P,onClick:f,children:"Submit"}):null]})},vy=va.div`
|
|
1328
1470
|
display: flex;
|
|
1329
1471
|
border: 1px solid var(--privy-color-foreground-4);
|
|
1330
1472
|
width: 100%;
|
|
@@ -1338,7 +1480,7 @@ Resources:
|
|
|
1338
1480
|
@media (max-width: 440px) {
|
|
1339
1481
|
margin-top: 20px;
|
|
1340
1482
|
}
|
|
1341
|
-
`,
|
|
1483
|
+
`,wy=va.label`
|
|
1342
1484
|
display: flex;
|
|
1343
1485
|
flex-direction: row;
|
|
1344
1486
|
align-items: center;
|
|
@@ -1375,7 +1517,7 @@ Resources:
|
|
|
1375
1517
|
line-height: 24px;
|
|
1376
1518
|
}
|
|
1377
1519
|
}
|
|
1378
|
-
`,
|
|
1520
|
+
`,Cy=va.div`
|
|
1379
1521
|
line-height: 20px;
|
|
1380
1522
|
height: 20px;
|
|
1381
1523
|
font-size: 13px;
|
|
@@ -1388,12 +1530,12 @@ Resources:
|
|
|
1388
1530
|
> a {
|
|
1389
1531
|
text-decoration: underline;
|
|
1390
1532
|
}
|
|
1391
|
-
`;import{useState as
|
|
1533
|
+
`;import{useState as Py}from"react";import $c from"styled-components";import{jsx as Hc,jsxs as Ey}from"react/jsx-runtime";var Dn=({style:e,...t})=>Ey("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:[Hc("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"}),Hc("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 xy}from"react/jsx-runtime";var Un=({style:e,...t})=>xy("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 Gc}from"react/jsx-runtime";var Fn=({style:e,...t})=>Gc("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:Gc("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 Bn,jsxs as Ty}from"react/jsx-runtime";var Hn=({style:e,...t})=>Ty("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:[Bn("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"}),Bn("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"}),Bn("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"}),Bn("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 zc}from"react/jsx-runtime";var Gn=({style:e,...t})=>zc("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:zc("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 vt,jsxs as Sy}from"react/jsx-runtime";var Vc=({showGoogle:e,showTwitter:t,showDiscord:o,showGithub:r,showApple:n})=>{let[i,a]=Py(!1),{initLoginWithOAuth:l}=_(),{app:s}=w(),c=s?.appearance.palette.colorScheme;return Sy(_y,{children:[e&&vt(xr,{onClick:()=>{a(!0),l("google")},disabled:i,children:vt(Hn,{})}),t&&vt(xr,{onClick:()=>{a(!0),l("twitter")},disabled:i,children:vt(Gn,{})}),o&&vt(xr,{onClick:()=>{a(!0),l("discord")},disabled:i,children:vt(Un,{})}),r&&vt(xr,{onClick:()=>{a(!0),l("github")},disabled:i,children:vt(Fn,{style:{color:c==="light"?"#000":"#fff"}})}),n&&vt(xr,{onClick:()=>{a(!0),l("apple")},disabled:i,children:vt(Dn,{style:{color:c==="light"?"#000":"#fff"}})})]})},_y=$c.div`
|
|
1392
1534
|
display: flex;
|
|
1393
1535
|
justify-content: space-between;
|
|
1394
1536
|
width: 100%;
|
|
1395
1537
|
gap: 4px;
|
|
1396
|
-
`,
|
|
1538
|
+
`,xr=$c.button`
|
|
1397
1539
|
&& {
|
|
1398
1540
|
border-radius: var(--privy-border-radius-sm);
|
|
1399
1541
|
cursor: pointer;
|
|
@@ -1415,13 +1557,13 @@ Resources:
|
|
|
1415
1557
|
background-color: var(--privy-color-background-2);
|
|
1416
1558
|
}
|
|
1417
1559
|
}
|
|
1418
|
-
`;import{Fragment as
|
|
1560
|
+
`;import{Fragment as wa,jsx as ne,jsxs as bo}from"react/jsx-runtime";var Kc=()=>{let{app:e,outerClickRef:t}=w(),{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,E=e?.loginMethods.github??!1,g=e?.loginMethods.apple??!1,x=a&&e?.appearance.showWalletLoginFirst?0:1,[m,f]=Ay(x),v=m==0,h=m==1,P=a,b=n||i,M=P!==b,I=()=>{o.enabled&&o.remove(),r()};return t&&(t.current=I),bo(wa,{children:[ne(S,{onClose:I},"header"),e?.appearance.logo?ne(Ny,{hasOnlyOneSection:M,hasTerms:!!(e?.legal.privacyPolicyUrl||e?.legal.termsAndConditionsUrl),children:ne(vn,{})}):null,bo(Ly,{reverse:!e?.appearance.showWalletLoginFirst,children:[P&&ne(Ry,{active:v||M,connectOnly:!1,onClick:()=>{o.enabled&&o.remove(),f(0)},isOnlySection:!b}),b&&ne(ky,{active:h||M,onClick:()=>f(1),email:n,sms:i,google:l,twitter:s,twitterOAuthOnMobileEnabled:e?.loginConfig.twitterOAuthOnMobileEnabled??!1,discord:c,github:E,apple:g,isOnlySection:!P})]}),e&&ne(hn,{app:e}),ne(H,{protectedByPrivy:!0})]})};function Ry(e){return bo(Jc,{active:e.active,onClick:e.onClick,isOnlySection:e.isOnlySection,children:[ne(Yc,{active:e.active,children:ne("h4",{children:"Connect Wallet"})}),e.active&&bo(wa,{children:[ne(Kt,{connectOnly:e.connectOnly}),ne(Yt,{})]})]})}function ky(e){let t=!qc||e.twitterOAuthOnMobileEnabled&&qc,o=e.google||e.discord||e.github||e.twitter&&t||e.apple,r=e.email?"Email":"Phone";return bo(Jc,{active:e.active,onClick:e.onClick,isOnlySection:e.isOnlySection,children:[e.isOnlySection?null:ne(Yc,{active:e.active,children:ne("h4",{children:o?`${r} & Social`:r})}),e.active&&e.email&&ne(Mn,{}),e.active&&e.sms&&!e.email&&ne(On,{}),e.active&&o&&ne(Wy,{google:e.google,twitter:e.twitter&&t,discord:e.discord,github:e.github,apple:e.apple})]})}function Wy(e){return bo(wa,{children:[bo(Iy,{children:[ne(jc,{}),ne("p",{children:" Or "}),ne(jc,{})]}),ne(Vc,{showGoogle:e.google,showDiscord:e.discord,showGithub:e.github,showTwitter:e.twitter,showApple:e.apple})]})}var Yc=Qo.div`
|
|
1419
1561
|
font-weight: ${e=>e.active?600:500};
|
|
1420
1562
|
color: ${e=>e.active?"var(--privy-color-foreground)":"var(--privy-color-foreground-2)"};
|
|
1421
1563
|
display: flex;
|
|
1422
1564
|
justify-content: center;
|
|
1423
1565
|
align-items: center;
|
|
1424
|
-
`,
|
|
1566
|
+
`,Jc=Qo.div`
|
|
1425
1567
|
display: flex;
|
|
1426
1568
|
flex-direction: column;
|
|
1427
1569
|
align-items: flex-start;
|
|
@@ -1447,7 +1589,7 @@ Resources:
|
|
|
1447
1589
|
}
|
|
1448
1590
|
|
|
1449
1591
|
cursor: ${e=>e.active?"inherit":"pointer"};
|
|
1450
|
-
`,
|
|
1592
|
+
`,Iy=Qo.div`
|
|
1451
1593
|
display: flex;
|
|
1452
1594
|
justify-content: center;
|
|
1453
1595
|
align-items: center;
|
|
@@ -1456,13 +1598,13 @@ Resources:
|
|
|
1456
1598
|
&& > p {
|
|
1457
1599
|
color: var(--privy-color-foreground-3);
|
|
1458
1600
|
}
|
|
1459
|
-
`,
|
|
1601
|
+
`,jc=Qo.hr`
|
|
1460
1602
|
width: 50%;
|
|
1461
1603
|
&& {
|
|
1462
1604
|
border-top: 1px solid var(--privy-color-foreground-4);
|
|
1463
1605
|
margin: 0px 8px;
|
|
1464
1606
|
}
|
|
1465
|
-
`,
|
|
1607
|
+
`,Ny=Qo.div`
|
|
1466
1608
|
display: flex;
|
|
1467
1609
|
flex-direction: column;
|
|
1468
1610
|
align-items: center;
|
|
@@ -1473,9 +1615,9 @@ Resources:
|
|
|
1473
1615
|
@media (max-width: 440px) {
|
|
1474
1616
|
padding: 10px 10px 20px;
|
|
1475
1617
|
}
|
|
1476
|
-
`,
|
|
1618
|
+
`,Ly=Qo(pe)`
|
|
1477
1619
|
flex-direction: ${e=>e.reverse?"column-reverse":"column"};
|
|
1478
|
-
`;import{EnvelopeIcon as
|
|
1620
|
+
`;import{EnvelopeIcon as My}from"@heroicons/react/24/outline";import{Fragment as Oy,jsx as Qt,jsxs as Dy}from"react/jsx-runtime";var Qc=()=>{let{app:e}=w();return Dy(Oy,{children:[Qt(S,{},"header"),Qt(R,{}),Qt(be,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:Qt(My,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Qt(pe,{children:Qt(Mn,{stacked:!0})}),Qt(L,{}),Qt(H,{protectedByPrivy:!0})]})};import{PhoneIcon as Uy}from"@heroicons/react/24/outline";import{Fragment as Fy,jsx as Zt,jsxs as By}from"react/jsx-runtime";var Zc=()=>{let{app:e}=w();return By(Fy,{children:[Zt(S,{},"header"),Zt(R,{}),Zt(be,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:Zt(Uy,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),Zt(pe,{children:Zt(On,{stacked:!0})}),Zt(L,{}),Zt(H,{protectedByPrivy:!0})]})};import{Fragment as Hy,jsx as Eo,jsxs as Xc}from"react/jsx-runtime";var ed=()=>{let{linkingHint:e}=_(),{app:t}=w(),o=e?`Select the wallet with ${Ft(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return Xc(Hy,{children:[Eo(S,{},"header"),Eo(R,{}),Eo(qt,{title:`${e?"Reconnect":"Connect"} your wallet`,description:o}),Xc(pe,{children:[Eo(Kt,{connectOnly:!1}),Eo(Yt,{})]}),Eo(L,{}),Eo(H,{protectedByPrivy:!0})]})};import{jsx as td,jsxs as Gy}from"react/jsx-runtime";var od=({style:e,...t})=>Gy("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:[td("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),td("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 zy,jsx as Xt,jsxs as rd}from"react/jsx-runtime";var nd=()=>{let{closePrivyModal:e}=_(),{navigate:t}=w();return rd(zy,{children:[Xt(S,{},"header"),Xt(R,{}),Xt(od,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),Xt(qt,{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"}}),rd(pe,{children:[Xt(j,{onClick:()=>t("LANDING"),children:"Try again"}),Xt(el,{onClick:()=>e(),children:"Cancel"})]}),Xt(L,{}),Xt(H,{protectedByPrivy:!0})]})};import{useEffect as id,useState as ad}from"react";import ld from"styled-components";function Ca(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{Fragment as qy,jsx as It,jsxs as $n}from"react/jsx-runtime";var sd={google:{name:"Google",component:Hn},discord:{name:"Discord",component:Un},github:{name:"Github",component:Fn},twitter:{name:"Twitter",component:Gn},apple:{name:"Apple",component:Dn}},zn=()=>{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)},cd=()=>{let{user:e,authenticated:t}=V(),{app:o,setModalData:r,navigate:n,resetNavigation:i,data:a}=w(),{getAuthMeta:l,initLoginWithOAuth:s,loginWithOAuth:c,updateWallets:E,closePrivyModal:g}=_(),[x,m]=ad(!1),[f,v]=ad(void 0),h=l()?.provider||"google",P=sd[h].name,b=sd[h].component,M=o?.render.inDialog?Ye:0;id(()=>{c().then(()=>{zn(),m(!0)}).catch(W=>{let U={retryable:!1,message:"Authentication failed"};if(W?.privyErrorCode==="allowlist_rejected"){v(void 0),i(),n("ALLOWLIST_REJECTION_SCREEN"),zn();return}else W?.privyErrorCode==="linked_to_another_user"?U.detail="This account has already been linked to another user.":W?.privyErrorCode==="invalid_credentials"?(U.retryable=!0,U.detail="Something went wrong. Try again."):W.privyErrorCode==="oauth_user_denied"&&(U.detail=`Retry and check ${Ca(h)} to finish connecting your account.`,U.retryable=!0);zn(),v(U)}).finally(()=>{a?.finishOauthFlow?.onComplete?.()})},[]),id(()=>{if(t&&x&&e)if(Ut(e,o?.embeddedWallets?.createOnLogin)){let U=setTimeout(()=>{r({createWallet:{onSuccess:()=>{},onFailure:X=>console.error(X),callAuthOnSuccessOnClose:!0}}),n("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},M);return()=>clearTimeout(U)}else{let U=setTimeout(g,M);return E(),()=>clearTimeout(U)}},[t,x,e]);let I=x?`Successfully connected with ${P}`:f?f.message:`Verifying connection to ${P}`,k="";return x?k="You\u2019re good to go!":f?k=f.detail:k="Just a few moments more",$n(qy,{children:[It(S,{}),It(R,{}),$n($y,{children:[It(Vy,{children:$n("div",{children:[It(ln,{success:x,fail:!!f}),It(b,{style:{width:"38px",height:"38px"}})]})}),$n(Vt,{children:[It("h3",{children:I}),It("p",{children:k})]}),f&&f?.retryable?It(fe,{onClick:()=>{zn(),s(h),v(void 0)},disabled:!x&&!f?.retryable,children:"Retry"}):null]}),It(J,{})]})},$y=ld.div`
|
|
1479
1621
|
display: flex;
|
|
1480
1622
|
flex-direction: column;
|
|
1481
1623
|
align-items: center;
|
|
@@ -1483,7 +1625,7 @@ Resources:
|
|
|
1483
1625
|
margin-left: 27px;
|
|
1484
1626
|
margin-right: 27px;
|
|
1485
1627
|
gap: 24px;
|
|
1486
|
-
`,
|
|
1628
|
+
`,Vy=ld.div`
|
|
1487
1629
|
display: flex;
|
|
1488
1630
|
flex-direction: column;
|
|
1489
1631
|
justify-content: center;
|
|
@@ -1506,9 +1648,9 @@ Resources:
|
|
|
1506
1648
|
left: -19px;
|
|
1507
1649
|
top: -19px;
|
|
1508
1650
|
}
|
|
1509
|
-
`;import{useEffect as
|
|
1651
|
+
`;import{useEffect as Ky,useState as pd}from"react";import Yy from"styled-components";import{isMobile as jy}from"react-device-detect";var dd=(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(!Be()&&jy)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${r}?ref=${r}`};import{Fragment as Qy,jsx as Nt,jsxs as ud}from"react/jsx-runtime";var md=()=>{let{forkSession:e,ready:t,authenticated:o}=V(),[r,n]=pd(""),[i,a]=pd(!1);Ky(()=>{t&&o&&e().then(n)},[t,o]);let l=dd(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."),ud(Qy,{children:[Nt(S,{},"header"),Nt(R,{}),Nt(qt,{title:s.title,description:s.description}),ud(pe,{children:[Nt(Jy,{children:Nt(He,{style:{width:"72px",height:"72px"}})}),Nt(pn,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?Nt("p",{children:s.footnote}):null]}),Nt(L,{}),Nt(H,{protectedByPrivy:!0})]})},Jy=Yy(Ai)`
|
|
1510
1652
|
margin: 16px auto;
|
|
1511
|
-
`;import{StaticJsonRpcProvider as
|
|
1653
|
+
`;import{StaticJsonRpcProvider as Zg}from"@ethersproject/providers";import{useMemo as Jd,useEffect as Qd,useState as Po}from"react";import or from"styled-components";import Md from"styled-components";import fd from"styled-components";import{jsx as hd,jsxs as eg}from"react/jsx-runtime";var Vn=({label:e,children:t,valueStyles:o})=>eg(Zy,{children:[hd("div",{children:e}),hd(Xy,{style:{...o},children:t})]}),Zy=fd.div`
|
|
1512
1654
|
display: flex;
|
|
1513
1655
|
align-items: center;
|
|
1514
1656
|
justify-content: space-between;
|
|
@@ -1523,7 +1665,7 @@ Resources:
|
|
|
1523
1665
|
color: var(--privy-color-foreground-2);
|
|
1524
1666
|
text-align: right;
|
|
1525
1667
|
}
|
|
1526
|
-
`,
|
|
1668
|
+
`,Xy=fd.div`
|
|
1527
1669
|
font-size: 14px;
|
|
1528
1670
|
line-height: 100%;
|
|
1529
1671
|
display: flex;
|
|
@@ -1532,28 +1674,28 @@ Resources:
|
|
|
1532
1674
|
border-radius: var(--privy-border-radius-full);
|
|
1533
1675
|
background-color: var(--privy-color-background-2);
|
|
1534
1676
|
padding: 4px 8px;
|
|
1535
|
-
`;import{BigNumber as
|
|
1677
|
+
`;import{BigNumber as wd}from"@ethersproject/bignumber";import qn from"styled-components";import{BigNumber as tg}from"@ethersproject/bignumber";import{isHexString as og}from"@ethersproject/bytes";import{getNetwork as rg}from"@ethersproject/providers";import{formatEther as yd}from"@ethersproject/units";var Tr=(e,t)=>(t*parseFloat(yd(e))).toFixed(2),xo=(e,t=6)=>parseFloat(yd(e)).toFixed(t).replace(/0+$/,"").replace(/\.$/,""),gd=(e,t)=>{og(e)&&(e=Number(e));let o=rg(e);return`https://${o.name==="homestead"?"www":o.name}.etherscan.io/address/${t}`},Re=e=>tg.from(e);import{jsx as ba,jsxs as vd}from"react/jsx-runtime";var Cd=({weiQuantities:e,tokenPrice:t})=>{let o=e.map(Re).reduce((n,i)=>n.add(i),wd.from(0)),r=Tr(o.toHexString(),t);return ba(bd,{children:r==="0.00"?"<$0.01":`$${r}`})},Ea=({weiQuantities:e,tokenPrice:t})=>{let o=e.map(Re).reduce((n,i)=>n.add(i),wd.from(0)),r=Tr(o.toHexString(),t);return vd(bd,{children:[ba(ng,{children:"USD"}),r==="0.00"?vd(ag,{children:[ba(ig,{children:"<"}),"$0.01"]}):`$${r}`]})},bd=qn.span`
|
|
1536
1678
|
font-size: 14px;
|
|
1537
1679
|
line-height: 140%;
|
|
1538
1680
|
display: flex;
|
|
1539
1681
|
gap: 4px;
|
|
1540
1682
|
align-items: center;
|
|
1541
|
-
`,
|
|
1683
|
+
`,ng=qn.span`
|
|
1542
1684
|
font-size: 12px;
|
|
1543
1685
|
line-height: 12px;
|
|
1544
1686
|
color: var(--privy-color-foreground-3);
|
|
1545
|
-
`,
|
|
1687
|
+
`,ig=qn.span`
|
|
1546
1688
|
font-size: 10px;
|
|
1547
|
-
`,
|
|
1689
|
+
`,ag=qn.span`
|
|
1548
1690
|
display: flex;
|
|
1549
1691
|
align-items: center;
|
|
1550
|
-
`;import
|
|
1692
|
+
`;import xa from"styled-components";import{jsx as eo,jsxs as jn}from"react/jsx-runtime";var Ed=({transactionData:e,gas:t,tokenPrice:o})=>{let{nativeTokenSymbolForChainId:r}=_(),n=r(e.chainId)||"ETH";return jn(Ri,{style:{paddingBottom:"12px"},children:[jn(Td,{children:[eo(_d,{children:"Est. Fees"}),eo("div",{children:eo(Ea,{weiQuantities:[t],tokenPrice:o})})]}),eo(Pd,{children:`${xo(Re(t).toHexString())} ${n}`})]})},xd=({transactionData:e,gas:t,tokenPrice:o})=>{let{nativeTokenSymbolForChainId:r}=_(),n=r(e.chainId)||"ETH";return jn(Ri,{children:[jn(Td,{children:[eo(_d,{children:"Total (including fees)"}),eo("div",{children:eo(Ea,{weiQuantities:[e.value||0,t],tokenPrice:o})})]}),eo(Pd,{children:e.value?`${xo(Re(e.value).add(Re(t)).toHexString())} ${n}`:null})]})},Td=xa.div`
|
|
1551
1693
|
display: flex;
|
|
1552
1694
|
flex-direction: row;
|
|
1553
1695
|
justify-content: space-between;
|
|
1554
1696
|
align-items: center;
|
|
1555
1697
|
padding-top: 4px;
|
|
1556
|
-
`,
|
|
1698
|
+
`,Pd=xa.div`
|
|
1557
1699
|
display: flex;
|
|
1558
1700
|
flex-direction: row;
|
|
1559
1701
|
height: 12px;
|
|
@@ -1562,23 +1704,23 @@ Resources:
|
|
|
1562
1704
|
line-height: 12px;
|
|
1563
1705
|
color: var(--privy-color-foreground-3);
|
|
1564
1706
|
font-weight: 400;
|
|
1565
|
-
`,
|
|
1707
|
+
`,_d=xa.div`
|
|
1566
1708
|
font-size: 14px;
|
|
1567
1709
|
line-height: 22.4px;
|
|
1568
1710
|
font-weight: 400;
|
|
1569
|
-
`;import{ChevronDownIcon as
|
|
1711
|
+
`;import{ChevronDownIcon as sg}from"@heroicons/react/24/outline";import{useContext as To,useState as lg}from"react";import to from"styled-components";import{createContext as Sd,useContext as w7}from"react";var Zo=Sd(void 0);var Pr=Sd(void 0);import{Fragment as yg,jsx as et,jsxs as Ad}from"react/jsx-runtime";var Rd=({defaultValue:e,children:t})=>{let[o,r]=lg(e||null),n=i=>{r(o===i?null:i)};return et(Zo.Provider,{value:{activePanel:o,togglePanel:n},children:et(cg,{children:t})})},kd=({value:e,children:t})=>{let{activePanel:o,togglePanel:r}=To(Zo),n=o===e;return et(Pr.Provider,{value:{onToggle:()=>r(e),value:e},children:et(mg,{isActive:n,"data-open":n,children:t})})},Wd=({children:e})=>{let{activePanel:t}=To(Zo),{onToggle:o,value:r}=To(Pr),n=t===r;return Ad(yg,{children:[Ad(dg,{onClick:o,"data-open":n,children:[et(ug,{children:e}),et(fg,{isactive:n,children:et(sg,{height:"16px",width:"16px",strokeWidth:"2"})})]}),et(pg,{})]})},Id=({children:e})=>{let{activePanel:t}=To(Zo),{value:o}=To(Pr);return et(hg,{"data-open":t===o,children:et(Ld,{children:e})})},Nd=({children:e})=>{let{activePanel:t}=To(Zo),{value:o}=To(Pr);return et(Ld,{children:typeof e=="function"?e({isActive:t===o}):e})},cg=to.div`
|
|
1570
1712
|
display: flex;
|
|
1571
1713
|
flex-direction: column;
|
|
1572
1714
|
width: 100%;
|
|
1573
1715
|
gap: 8px;
|
|
1574
|
-
`,
|
|
1716
|
+
`,dg=to.div`
|
|
1575
1717
|
display: flex;
|
|
1576
1718
|
justify-content: space-between;
|
|
1577
1719
|
align-items: center;
|
|
1578
1720
|
width: 100%;
|
|
1579
1721
|
cursor: pointer;
|
|
1580
1722
|
padding-bottom: 8px;
|
|
1581
|
-
`,
|
|
1723
|
+
`,pg=to.div`
|
|
1582
1724
|
width: 100%;
|
|
1583
1725
|
|
|
1584
1726
|
&& {
|
|
@@ -1586,13 +1728,13 @@ Resources:
|
|
|
1586
1728
|
border-color: var(--privy-color-foreground-4);
|
|
1587
1729
|
}
|
|
1588
1730
|
padding-bottom: 12px;
|
|
1589
|
-
`,
|
|
1731
|
+
`,ug=to.div`
|
|
1590
1732
|
font-size: 14px;
|
|
1591
1733
|
font-weight: 500;
|
|
1592
1734
|
line-height: 19.6px;
|
|
1593
1735
|
width: 100%;
|
|
1594
1736
|
padding-right: 8px;
|
|
1595
|
-
`,
|
|
1737
|
+
`,mg=to.div`
|
|
1596
1738
|
display: flex;
|
|
1597
1739
|
flex-direction: column;
|
|
1598
1740
|
width: 100%;
|
|
@@ -1604,7 +1746,7 @@ Resources:
|
|
|
1604
1746
|
border-color: var(--privy-color-foreground-4);
|
|
1605
1747
|
border-radius: var(--privy-border-radius-md);
|
|
1606
1748
|
}
|
|
1607
|
-
`,
|
|
1749
|
+
`,hg=to.div`
|
|
1608
1750
|
position: relative;
|
|
1609
1751
|
overflow: hidden;
|
|
1610
1752
|
transition: max-height 0.35s ease-in-out;
|
|
@@ -1616,36 +1758,36 @@ Resources:
|
|
|
1616
1758
|
&[data-open='false'] {
|
|
1617
1759
|
max-height: 0;
|
|
1618
1760
|
}
|
|
1619
|
-
`,
|
|
1761
|
+
`,Ld=to.div`
|
|
1620
1762
|
display: flex;
|
|
1621
1763
|
flex-direction: column;
|
|
1622
1764
|
gap: 12px;
|
|
1623
1765
|
flex: 1 1 auto;
|
|
1624
1766
|
min-height: 1px;
|
|
1625
|
-
`,
|
|
1767
|
+
`,fg=to.div`
|
|
1626
1768
|
transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
|
|
1627
|
-
`;import
|
|
1769
|
+
`;import gg from"styled-components";import{jsx as wg}from"react/jsx-runtime";var Ta=({walletAddress:e,chainId:t=at})=>wg(vg,{href:gd(t,e),target:"_blank",children:Ft(e)}),vg=gg.a`
|
|
1628
1770
|
&:hover {
|
|
1629
1771
|
text-decoration: underline;
|
|
1630
1772
|
}
|
|
1631
|
-
`;import{Fragment as
|
|
1773
|
+
`;import{Fragment as Eg,jsx as ke,jsxs as Pa}from"react/jsx-runtime";var Kn=({from:e,to:t,txn:o,transactionInfo:r,tokenPrice:n,gas:i})=>{let a=o?.value||0;return ke(Rd,{children:Pa(kd,{value:"details",children:[ke(Wd,{children:Pa(Cg,{children:[ke("div",{children:r?.title||r?.actionDescription||"Details"}),n?ke(bg,{children:ke(Cd,{weiQuantities:[a],tokenPrice:n})}):null]})}),Pa(Id,{children:[ke(Vn,{label:"From",children:ke(Ta,{walletAddress:e,chainId:o.chainId||at})}),ke(Vn,{label:"To",children:ke(Ta,{walletAddress:t,chainId:o.chainId||at})}),r&&r.action&&ke(Vn,{label:"Action",children:r.action}),i&&n?ke(Ed,{transactionData:o,gas:i,tokenPrice:n}):null]}),ke(Nd,{children:({isActive:l})=>ke(Eg,{children:n&&ke(xd,{transactionData:o,displayFee:l,gas:i||"0x0",tokenPrice:n})})})]})})},Cg=Md.div`
|
|
1632
1774
|
display: flex;
|
|
1633
1775
|
flex-direction: row;
|
|
1634
1776
|
justify-content: space-between;
|
|
1635
|
-
`,
|
|
1777
|
+
`,bg=Md.div`
|
|
1636
1778
|
flex-shrink: 0;
|
|
1637
1779
|
padding-left: 8px;
|
|
1638
|
-
`;import
|
|
1780
|
+
`;import Sr from"styled-components";import{jsx as _r,jsxs as Ag}from"react/jsx-runtime";var _a=({description:e,contractInfo:t})=>Ag(xg,{children:[t.imgUrl&&_r(Tg,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&_r(Pg,{children:_r("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&_r(_g,{children:t.name}),_r(Sg,{children:e||t.actionText})]}),xg=Sr.div`
|
|
1639
1781
|
display: flex;
|
|
1640
1782
|
flex-direction: column;
|
|
1641
1783
|
align-items: center;
|
|
1642
1784
|
margin-bottom: 8px;
|
|
1643
|
-
`,
|
|
1785
|
+
`,Tg=Sr.img`
|
|
1644
1786
|
height: ${e=>e.size==="sm"?"65px":"140px"};
|
|
1645
1787
|
width: ${e=>e.size==="sm"?"65px":"140px"};
|
|
1646
1788
|
border-radius: 16px;
|
|
1647
1789
|
margin-bottom: 12px;
|
|
1648
|
-
`,
|
|
1790
|
+
`,Pg=Sr.div`
|
|
1649
1791
|
font-size: 12px;
|
|
1650
1792
|
line-height: 12px;
|
|
1651
1793
|
padding: 7px;
|
|
@@ -1658,7 +1800,7 @@ Resources:
|
|
|
1658
1800
|
text-decoration: underline;
|
|
1659
1801
|
}
|
|
1660
1802
|
}
|
|
1661
|
-
`,
|
|
1803
|
+
`,_g=Sr.div`
|
|
1662
1804
|
font-size: 18px;
|
|
1663
1805
|
line-height: 18px;
|
|
1664
1806
|
font-weight: 500;
|
|
@@ -1666,7 +1808,7 @@ Resources:
|
|
|
1666
1808
|
white-space: nowrap;
|
|
1667
1809
|
max-width: 275px;
|
|
1668
1810
|
text-overflow: ellipsis;
|
|
1669
|
-
`,
|
|
1811
|
+
`,Sg=Sr.div`
|
|
1670
1812
|
font-size: 16px;
|
|
1671
1813
|
line-height: 140%;
|
|
1672
1814
|
font-weight: 400;
|
|
@@ -1675,7 +1817,7 @@ Resources:
|
|
|
1675
1817
|
white-space: nowrap;
|
|
1676
1818
|
max-width: 275px;
|
|
1677
1819
|
text-overflow: ellipsis;
|
|
1678
|
-
`;import{WalletIcon as
|
|
1820
|
+
`;import{WalletIcon as Og}from"@heroicons/react/24/outline";import{useState as Aa,useEffect as Dg}from"react";import ka from"styled-components";import{VoidSigner as Wg}from"@ethersproject/abstract-signer";import{EtherscanProvider as tT}from"@ethersproject/providers";import{parseUnits as Od}from"@ethersproject/units";import{ofetch as Rg}from"ofetch";var Ar={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 Rr={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 Dd=[Ar.id,Rr.id],Sa=e=>({maxPriorityFee:Od(e.maxPriorityFee.toString(),"gwei").toHexString(),maxFee:Od(e.maxFee.toString(),"gwei").toHexString()}),kg=e=>({safeLow:Sa(e.safeLow),standard:Sa(e.standard),fast:Sa(e.fast)}),Ud=async e=>{let t="";switch(e){case Ar.id:t="https://gasstation.polygon.technology/v2";break;case Rr.id:t="https://gasstation-testnet.polygon.technology/v2";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return kg(await Rg(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 Ig(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 Yn(e,t,o){t.chainId=Number(t.chainId),Bd(t);let r=new Wg(e,o);if(delete t.gas,Dd.includes(t.chainId)&&(!t.maxPriorityFeePerGas||!t.maxFeePerGas))try{let{standard:i}=await Ud(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 Ig(n)}async function Jn(e,t,o,r,n){r=Object.assign({chainId:at},r),Bd(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 Mg(s)}async function Qn(e,t,o){let r=await o.getBalance(e),n=t.value||0,i=r.sub(Re(n)),a=!i.isNegative()&&!i.isZero();return{balance:r,hasSufficientFunds:a}}async function Fd(e,t){return delete e.from,await t.estimateGas(e)}function Bd(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let o of t){let r=e[o];if(!(typeof r>"u")&&!Ng(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 Ng(e){let t=typeof e=="number",o=typeof e=="bigint",r=typeof e=="string"&&Lg(e);return t||o||r}function Lg(e){return/^-?0x[a-f0-9]+$/i.test(e)}function Mg(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 Hd,jsxs as Ra}from"react/jsx-runtime";var Gd=({wallet:e,txn:t,provider:o})=>{let[r,n]=Aa(),[i,a]=Aa(!1),[l,s]=Aa(!1),{nativeTokenSymbolForChainId:c}=_(),E=c(t.chainId)||"ETH";return Dg(()=>{(async x=>{try{let{balance:m,hasSufficientFunds:f}=await Qn(x,t,o);s(!0),a(f===!1),n(m.toHexString())}catch(m){console.warn(`Failed to fetch wallet balance with error: ${m}`)}})(e.address)},[e,t]),Ra(Ug,{children:[Ra(Fg,{children:[Hd(Og,{strokeWidth:"2",width:"16px",height:"16px"}),Hd("div",{children:Ft(e?.address)})]}),Ra(Bg,{displayBalanceColor:l,hasFunds:!i,children:[r?xo(r):0," ",E," available"]})]})},Ug=ka.div`
|
|
1679
1821
|
display: flex;
|
|
1680
1822
|
flex-direction: row;
|
|
1681
1823
|
justify-content: space-between;
|
|
@@ -1688,12 +1830,12 @@ Resources:
|
|
|
1688
1830
|
border: 1px solid var(--privy-color-foreground-4);
|
|
1689
1831
|
border-radius: var(--privy-border-radius-md);
|
|
1690
1832
|
}
|
|
1691
|
-
`,
|
|
1833
|
+
`,Fg=ka.div`
|
|
1692
1834
|
display: flex;
|
|
1693
1835
|
flex-direction: row;
|
|
1694
1836
|
align-items: center;
|
|
1695
1837
|
gap: 8px;
|
|
1696
|
-
`,
|
|
1838
|
+
`,Bg=ka.div`
|
|
1697
1839
|
display: flex;
|
|
1698
1840
|
align-items: center;
|
|
1699
1841
|
justify-content: center;
|
|
@@ -1703,25 +1845,25 @@ Resources:
|
|
|
1703
1845
|
background-color: var(--privy-color-background-2);
|
|
1704
1846
|
padding: 5px 8px;
|
|
1705
1847
|
color: ${e=>e.displayBalanceColor?e.hasFunds?"var(--privy-color-success-dark)":"var(--privy-color-error)":"inherit"};
|
|
1706
|
-
`;import
|
|
1848
|
+
`;import Xn from"styled-components";import{StaticJsonRpcProvider as Hg}from"@ethersproject/providers";import{useState as kr,useEffect as zd,useMemo as Gg}from"react";var Zn=e=>{let{getUsdTokenPrice:t,chains:o,rpcConfig:r}=_(),[n,i]=kr(!1),[a,l]=kr(!1),[s,c]=kr(void 0),[E,g]=kr(void 0),[x,m]=kr(null),f=Gg(()=>new Hg(Je(e.chainId||at,o,r)),[e.chainId,o,r]);return zd(()=>{let v=e.chainId||at,h=o.find(b=>b.id===Number(v));if(!h)throw new B(`Unsupported chain: ${v}`);(async()=>{try{i(!0);let b=await t(h);b?g(b):c(new Error(`Unable to fetch token price on chain id ${h.id}`))}catch(b){c(b)}finally{i(!1)}})()},[e.chainId]),zd(()=>{(async()=>{try{l(!0);let h=await Fd(e,f);m(h.toBigInt())}catch(h){c(h)}finally{l(!1)}})()},[e]),{tokenPrice:E,estimatedGas:x,isLoading:n||a,error:s}};import{jsx as $d,jsxs as Vd}from"react/jsx-runtime";var qd=e=>{let{tokenPrice:t}=Zn(e.txn),{nativeTokenSymbolForChainId:o}=_(),r=o(e.txn.chainId)||"ETH",n="--",i=()=>{if(!t)return n;let l=e.txn.value||0,s=Tr(Re(l).toHexString(),t);return s==="0.00"?"<$0.01":`$${s}`},a=xo(Re(e.txn.value||0).toHexString());return Vd(zg,{children:[$d($g,{children:i()}),Vd(Vg,{children:[a," ",r]}),$d(qg,{children:e.description})]})},zg=Xn.div`
|
|
1707
1849
|
display: flex;
|
|
1708
1850
|
flex-direction: column;
|
|
1709
1851
|
align-items: center;
|
|
1710
1852
|
margin-bottom: 20px;
|
|
1711
|
-
|
|
1853
|
+
`,$g=Xn.h2`
|
|
1712
1854
|
&& {
|
|
1713
1855
|
font-size: 48px;
|
|
1714
1856
|
line-height: 48px;
|
|
1715
1857
|
margin: 8px auto;
|
|
1716
1858
|
}
|
|
1717
|
-
`,
|
|
1859
|
+
`,Vg=Xn.p`
|
|
1718
1860
|
margin-bottom: 12px;
|
|
1719
1861
|
&& {
|
|
1720
1862
|
font-size: 17px;
|
|
1721
1863
|
line-height: 17px;
|
|
1722
1864
|
color: var(--privy-color-foreground-3);
|
|
1723
1865
|
}
|
|
1724
|
-
|
|
1866
|
+
`,qg=Xn.div`
|
|
1725
1867
|
font-size: 16px;
|
|
1726
1868
|
line-height: 22.4px;
|
|
1727
1869
|
font-weight: 400;
|
|
@@ -1729,52 +1871,52 @@ Resources:
|
|
|
1729
1871
|
white-space: nowrap;
|
|
1730
1872
|
max-width: 275px;
|
|
1731
1873
|
text-overflow: ellipsis;
|
|
1732
|
-
`;function
|
|
1874
|
+
`;function jd(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{createContext as jg,useContext as Kg}from"react";var Wa=jg({wallets:[]});function Ia(){return Kg(Wa)}import Kd from"styled-components";import{Fragment as Qg,jsx as er,jsxs as Na}from"react/jsx-runtime";var Yd=({txn:e,receipt:t,transactionInfo:o,onClose:r,tokenPrice:n})=>Na(Qg,{children:[er(S,{onClose:r}),Na(Yg,{children:[Na("div",{children:[er($e,{title:"Transaction complete!",description:"You're all set."}),er(Kn,{tokenPrice:n,from:t.from,to:t.to,gas:t.gasUsed,txn:e,transactionInfo:o})]}),er("div",{children:er(Jg,{loading:!1,onClick:r,children:"All Done"})})]}),er(J,{})]}),Yg=Kd.div`
|
|
1733
1875
|
display: flex;
|
|
1734
1876
|
height: 100%;
|
|
1735
1877
|
flex-direction: column;
|
|
1736
1878
|
justify-content: space-between;
|
|
1737
1879
|
flex-grow: 1;
|
|
1738
|
-
`,
|
|
1880
|
+
`,Jg=Kd(j)`
|
|
1739
1881
|
margin-top: 24px;
|
|
1740
1882
|
transition: color 350ms ease, background-color 350ms ease;
|
|
1741
|
-
`;import{Fragment as
|
|
1883
|
+
`;import{Fragment as La,jsx as me,jsxs as tr}from"react/jsx-runtime";var Xg=({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(qd,{description:o.description||o.transactionInfo?.description||"",txn:e})})},Xd=()=>{let{authenticated:e,getAccessToken:t}=V(),{wallets:o}=Ia(),{walletProxy:r,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:l,nativeTokenSymbolForChainId:s}=_(),{app:c,navigate:E,data:g,outerClickRef:x,setModalData:m}=w(),{transactionRequest:f,onSuccess:v,onFailure:h,uiOptions:P,fundWalletConfig:b}=g.sendTransaction,[M,I]=Po(null),[k,W]=Po(""),[U,X]=Po(),[O,G]=Po(!1),[z,ee]=Po(!0),[D,de]=Po(!1),[$,te]=Po(f),{tokenPrice:Oe,estimatedGas:F}=Zn($),bt=s(f.chainId)||"ETH";Qd(()=>{e||(E("LANDING"),h(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let we=Jd(()=>o.find(tt=>tt.walletClientType==="privy"),[o]),ir=async()=>{if(!we)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:tt,externalTransactionId:ie}=await i(we.address,{config:b?.config||{}});m({fiatOnRampPrompt:{signedUrl:tt},fiatOnRampStatus:{externalTransactionId:ie}}),E("FIAT_ON_RAMP_PROMPT_SCREEN")},ao=Jd(()=>new Zg(Je($.chainId,l,a)),[$.chainId,a]);Qd(()=>{async function tt(){return!await t()||!r||!we?$:Yn(we.address,$,ao)}tt().then(ie=>{ee(!1),te(ie)},async ie=>{ee(!0);let De=!1;if(Ll(ie))De=!0;else if(Ml(ie))try{let{hasSufficientFunds:Ao}=await Qn(we.address,$,ao);De=Ao===!1}catch(Ao){console.warn(`Cannot accurately determine if wallet has sufficient funds with error: ${Ao}`)}let so="";De?(so="Wallet has insufficient funds for this transaction",c?.fiatOnRamp.enabled&&G(!0)):(so="There was an error preparing your transaction",console.error(ie)),W(so),X(new Ie(new lt(so,_e.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))})},[r]);let Lr=jd($),ni=Lr==="SEND"?`Send ${bt}`:"Review transaction",ar={modalTitle:P.header||P.modalTitle||ni,buttonText:P.buttonText||"Submit"},Lt=()=>{D||(M?v(M):h(U||new Ie(new lt("The user rejected the request",_e.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return x&&(x.current=Lt),Oe===void 0?tr(La,{children:[me(S,{title:ar.modalTitle,onClose:Lt}),me(R,{}),me(Zd,{children:me(Go,{})}),me(L,{})]}):M!==null?me(Yd,{txn:$,onClose:Lt,receipt:M,transactionInfo:P.transactionInfo,tokenPrice:Oe}):tr(La,{children:[me(S,{title:ar.modalTitle,onClose:Lt}),tr(Zd,{children:[tr(r1,{children:[me(Xg,{txn:$,txnFamily:Lr,uiOptions:P}),we?me(Kn,{from:we.address,to:$.to,txn:$,transactionInfo:P.transactionInfo,gas:F?Re(F).toHexString():void 0,tokenPrice:Oe}):null]}),tr(n1,{children:[me(e1,{children:k}),we?me(Gd,{txn:$,wallet:we,provider:ao}):null,tr(t1,{children:[O&&me(j,{onClick:ir,children:"Add Funds"}),me(o1,{disabled:z||D,loading:!r||D,loadingText:D?"Submitting (may take a few minutes)...":"Loading...",onClick:async()=>{de(!0);let tt=await t();if(tt&&!D&&we)try{let ie=await Jn(tt,we.address,r,$,ao);I(ie),W("")}catch(ie){let De="";ie.reason==="processing response error"?(console.warn({transaction:$,error:ie}),De="An error has occurred, please contact support."):De=ie.reason||"An error has occurred, please try again.",W(De),X(new Ie(new lt(De,_e.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}finally{de(!1)}},children:ar.buttonText})]})]})]}),me(J,{})]})},Zd=or.div`
|
|
1742
1884
|
display: flex;
|
|
1743
1885
|
height: 100%;
|
|
1744
1886
|
flex-direction: column;
|
|
1745
1887
|
justify-content: space-between;
|
|
1746
1888
|
flex-grow: 1;
|
|
1747
|
-
`,
|
|
1889
|
+
`,e1=or.div`
|
|
1748
1890
|
line-height: 15px;
|
|
1749
1891
|
font-size: 13px;
|
|
1750
1892
|
color: var(--privy-color-error);
|
|
1751
1893
|
width: 100%;
|
|
1752
1894
|
margin-top: 1px;
|
|
1753
|
-
`,
|
|
1895
|
+
`,t1=or.div`
|
|
1754
1896
|
display: flex;
|
|
1755
1897
|
direction: row;
|
|
1756
1898
|
justify-content: space-between;
|
|
1757
1899
|
align-items: center;
|
|
1758
1900
|
gap: 8px;
|
|
1759
|
-
`,
|
|
1901
|
+
`,o1=or(j)`
|
|
1760
1902
|
transition: color 350ms ease, background-color 350ms ease;
|
|
1761
|
-
`,
|
|
1903
|
+
`,r1=or.div`
|
|
1762
1904
|
height: 100%;
|
|
1763
1905
|
display: flex;
|
|
1764
1906
|
flex-direction: column;
|
|
1765
1907
|
justify-content: space-evenly;
|
|
1766
1908
|
flex-grow: 1;
|
|
1767
|
-
`,
|
|
1909
|
+
`,n1=or.div`
|
|
1768
1910
|
display: flex;
|
|
1769
1911
|
flex-direction: column;
|
|
1770
1912
|
gap: 8px;
|
|
1771
|
-
`;import{isHexString as
|
|
1913
|
+
`;import{isHexString as i1}from"@ethersproject/bytes";import{toUtf8String as a1}from"@ethersproject/strings";import{useEffect as s1,useState as Ma}from"react";import Wr,{css as l1}from"styled-components";import{Fragment as f1,jsx as wt,jsxs as ei}from"react/jsx-runtime";var c1=e=>{if(!i1(e))return e;try{return a1(e)}catch{return e}},ep=()=>{let{authenticated:e}=V(),{walletProxy:t,closePrivyModal:o}=_(),{navigate:r,data:n,outerClickRef:i}=w(),[a,l]=Ma(!1),[s,c]=Ma(""),[E,g]=Ma();s1(()=>{e||r("LANDING")},[e]);let{message:x,confirmAndSignMessage:m,onFailure:f,uiOptions:v}=n.signMessage,h=!t,P={title:v.title||"Sign message",description:v.description||"Signing this message will not cost you any fees.",buttonText:v.buttonText||"Sign and continue"},b=()=>{a||f(E||new Ie(new lt("The user rejected the request.",_e.E4001_USER_REJECTED_REQUEST.eipCode))),o({shouldCallAuthOnSuccess:!1})};return i&&(i.current=b),ei(f1,{children:[wt(S,{onClose:b}),wt(R,{}),ei(d1,{children:[ei("div",{children:[wt($e,{title:P.title,description:P.description}),wt(p1,{children:c1(x)}),wt(u1,{fail:!0,children:s})]}),wt(h1,{success:a,loading:h,disabled:a,onClick:async()=>{try{await m(),c(""),l(!0),setTimeout(()=>{o({shouldCallAuthOnSuccess:!1})},Ye)}catch{c("An error has occurred, please try again."),g(new Ie(new lt(s,_e.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:a?ei(m1,{children:[wt(Sn,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",wt("span",{children:"Success"})]}):P.buttonText})]}),wt(L,{}),wt(H,{protectedByPrivy:!0})]})},d1=Wr.div`
|
|
1772
1914
|
display: flex;
|
|
1773
1915
|
height: 100%;
|
|
1774
1916
|
flex-direction: column;
|
|
1775
1917
|
justify-content: space-between;
|
|
1776
1918
|
flex-grow: 1;
|
|
1777
|
-
`,
|
|
1919
|
+
`,p1=Wr.div`
|
|
1778
1920
|
background-color: var(--privy-color-background-2);
|
|
1779
1921
|
border-radius: var(--privy-border-radius-md);
|
|
1780
1922
|
padding: 12px;
|
|
@@ -1790,7 +1932,7 @@ Resources:
|
|
|
1790
1932
|
&::-webkit-scrollbar {
|
|
1791
1933
|
display: none; /* Safari and Chrome */
|
|
1792
1934
|
}
|
|
1793
|
-
`,
|
|
1935
|
+
`,u1=Wr.div`
|
|
1794
1936
|
line-height: 20px;
|
|
1795
1937
|
height: 20px;
|
|
1796
1938
|
font-size: 13px;
|
|
@@ -1799,20 +1941,20 @@ Resources:
|
|
|
1799
1941
|
justify-content: flex-start;
|
|
1800
1942
|
width: 100%;
|
|
1801
1943
|
margin-top: 4px;
|
|
1802
|
-
`,
|
|
1944
|
+
`,m1=Wr.span`
|
|
1803
1945
|
display: flex;
|
|
1804
1946
|
align-items: center;
|
|
1805
1947
|
gap: 8px;
|
|
1806
|
-
`,
|
|
1948
|
+
`,h1=Wr(j)`
|
|
1807
1949
|
transition: color 350ms ease, background-color 350ms ease;
|
|
1808
1950
|
|
|
1809
|
-
${e=>e.success&&
|
|
1951
|
+
${e=>e.success&&l1`
|
|
1810
1952
|
&&&& {
|
|
1811
1953
|
background-color: var(--privy-color-success);
|
|
1812
1954
|
color: #ffffff;
|
|
1813
1955
|
}
|
|
1814
1956
|
`}
|
|
1815
|
-
`;import
|
|
1957
|
+
`;import g1,{createGlobalStyle as v1}from"styled-components";var y1=`
|
|
1816
1958
|
*,
|
|
1817
1959
|
::before,
|
|
1818
1960
|
::after {
|
|
@@ -2042,7 +2184,7 @@ Resources:
|
|
|
2042
2184
|
[hidden] {
|
|
2043
2185
|
display: none;
|
|
2044
2186
|
}
|
|
2045
|
-
`,
|
|
2187
|
+
`,tp=y1;var op=v1`
|
|
2046
2188
|
:root {
|
|
2047
2189
|
// Borders
|
|
2048
2190
|
--privy-border-radius-sm: 6px;
|
|
@@ -2067,11 +2209,16 @@ Resources:
|
|
|
2067
2209
|
--privy-color-success: ${e=>e.theme.success};
|
|
2068
2210
|
--privy-color-success-dark: ${e=>e.theme.successDark};
|
|
2069
2211
|
--privy-color-error: ${e=>e.theme.error};
|
|
2212
|
+
--privy-color-warn: ${e=>e.theme.warn};
|
|
2213
|
+
|
|
2214
|
+
// Space
|
|
2215
|
+
--privy-height-modal-full: 620px;
|
|
2216
|
+
--privy-height-modal-compact: 480px;
|
|
2070
2217
|
};
|
|
2071
|
-
`,
|
|
2218
|
+
`,rp=g1.div`
|
|
2072
2219
|
// css normalize only the privy application to avoid conflicts
|
|
2073
2220
|
// with consuming application
|
|
2074
|
-
${
|
|
2221
|
+
${tp}
|
|
2075
2222
|
|
|
2076
2223
|
// Privy styles
|
|
2077
2224
|
color: var(--privy-color-foreground-2);
|
|
@@ -2130,7 +2277,7 @@ Resources:
|
|
|
2130
2277
|
opacity: 1;
|
|
2131
2278
|
}
|
|
2132
2279
|
}
|
|
2133
|
-
`;import{jsx as
|
|
2280
|
+
`;import{jsx as qe,jsxs as W1}from"react/jsx-runtime";var T1={["LANDING"]:Kc,["AWAITING_PASSWORDLESS_CODE"]:gl,["WALLET_EDUCATION"]:Lc,["AWAITING_CONNECTION"]:Sl,["AWAITING_CONNECT_ONLY_CONNECTION"]:Wl,["PHANTOM_INTERSTITIAL_SCREEN"]:md,["LOGIN_FAILED_SCREEN"]:nd,["AWAITING_OAUTH_SCREEN"]:cd,["ALLOWLIST_REJECTION_SCREEN"]:pl,["INSTALL_METAMASK_SCREEN"]:Uc,["INSTALL_PHANTOM_SCREEN"]:Bc,["INSTALL_COINBASE_WALLET_SCREEN"]:Oc,["LINK_EMAIL_SCREEN"]:Qc,["LINK_PHONE_SCREEN"]:Zc,["LINK_WALLET_SCREEN"]:ed,["CONNECT_ONLY_LANDING_SCREEN"]:Pl,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:El,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:ic,["EMBEDDED_WALLET_CREATED_SCREEN"]:Bl,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:Ul,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:hc,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:Vl,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:ep,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:Xd,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Cc,["FIAT_ON_RAMP_STATUS_SCREEN"]:Ec,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:sc,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:ac},P1={["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"},_1=(e,t,o)=>{if(e==="LANDING"&&t)return"compact";let r=P1[e];return r||(o?"medium":"full")},S1=()=>{let{ready:e}=V(),{isLinking:t}=_(),{ready:o,currentScreen:r,app:n}=w(),i=!!n?.loginMethods.wallet,a=!!(n?.loginMethods.email||n?.loginMethods.sms),s=_1(r,i!==a,t);if((!e||!o)&&r!=="AWAITING_OAUTH_SCREEN")return W1(Rn,{"data-height":s,children:[qe(S,{}),qe(R,{}),qe(k1,{children:qe(uo,{})}),qe(L,{}),qe(J,{})]});let c=T1[r];return c?qe(Rn,{"data-height":s,children:qe(c,{})}):null},ip=()=>{let{closePrivyModal:e}=_(),{app:t,outerClickRef:o}=w(),r=()=>{if(o?.current){let{closeModal:l}=o.current()||{closeModal:!0};l&&(e(),o.current=null)}else return e()},n=E1(l=>{l.key==="Escape"&&t?.render.inDialog&&r()},[t?.render.inDialog]);np(()=>(document.addEventListener("keydown",n,!1),()=>{document.removeEventListener("keydown",n,!1)}),[n]);let i=qe(rp,{onClick:l=>l.stopPropagation(),children:qe(S1,{})}),a=t?.render.inDialog?qe(R1,{id:"privy-dialog",onClick:()=>r(),children:i}):i;return x1.createPortal(a,t?.render.inParentNodeId&&document.getElementById(t.render.inParentNodeId)||document.body)},A1=({children:e,...t})=>{let o=b1(null);return np(()=>{document?.activeElement?.blur();let r=document?.getElementById("root")||document?.getElementById("__next");if(r)return r.setAttribute("inert","true"),w1(o?.current),()=>{let n=document?.getElementById("root")||document?.getElementById("__next");n&&(n.removeAttribute("inert"),C1())}},[t.open,t.onClose]),qe("dialog",{open:!0,role:"dialog",...t,ref:o,children:e})},R1=Oa(A1)`
|
|
2134
2281
|
position: fixed;
|
|
2135
2282
|
top: 0;
|
|
2136
2283
|
left: 0;
|
|
@@ -2145,7 +2292,7 @@ Resources:
|
|
|
2145
2292
|
z-index: 999999;
|
|
2146
2293
|
-webkit-backdrop-filter: blur(3px);
|
|
2147
2294
|
backdrop-filter: blur(3px);
|
|
2148
|
-
`,
|
|
2295
|
+
`,Rn=Oa.div`
|
|
2149
2296
|
display: flex;
|
|
2150
2297
|
flex-direction: column;
|
|
2151
2298
|
text-align: center;
|
|
@@ -2182,10 +2329,10 @@ Resources:
|
|
|
2182
2329
|
min-height: 0;
|
|
2183
2330
|
}
|
|
2184
2331
|
}
|
|
2185
|
-
`,
|
|
2332
|
+
`,k1=Oa.div`
|
|
2186
2333
|
display: flex;
|
|
2187
2334
|
flex-direction: column;
|
|
2188
2335
|
align-items: center;
|
|
2189
2336
|
justify-content: center;
|
|
2190
2337
|
height: 100%;
|
|
2191
|
-
`;import{useEffect as Wg}from"react";import{Fragment as Ng,jsx as Lg}from"react/jsx-runtime";var Ig=({onLoad:e})=>{let t=window;return Wg(()=>{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)},[]),Lg(Ng,{})},Fd=Ig;var Bd={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 Hd={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 Gd={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 zd={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 Vd={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 $d={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 qd={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 jd={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 Kd={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 Yd={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 Jd={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 Qd={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 Zd={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 Xd={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 ep={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 op={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 rp={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 np={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 Sr=[Bd,Hd,Jd,np,Xd,ep,tp,op,rp,qd,jd,Kd,Yd,Vd,$d,Qd,Zd,Gd,zd],ip=new Set(Sr.map(e=>e.id));import er from"tinycolor2";var ap="#FFFFFF",Mg="#000000",Og=ap,Dg="#1E1E1D";function Ug(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 eo(e,t){let o=Math.max(0,Math.min(1,e.toHsl().l+t));return er({...e.toHsl(),l:o})}function sp({backgroundTheme:e,accentHex:t,successHex:o="#51BA81",errorHex:r="#EC6351",whiteHex:n=ap,blackHex:i=Mg}){let a;switch(e){case"light":a=Og;break;case"dark":a=Dg;break;default:a=e;break}let l=er(a),s=er(t),c=er(o),_=er(r),m=Ug(l.getLuminance()),C=eo(l,m==="light"?-.04:.11),b=eo(l,m==="light"?-.88:.87),f=eo(l,m==="light"?-.77:.75),w=eo(l,m==="light"?-.43:.45).desaturate(m==="light"?60:20),y=eo(l,m==="light"?-.08:.25).desaturate(m==="light"?60:20),x=eo(s,.15),g=eo(s,-.06),F=er(s.getLuminance()>.5?i:n),I=eo(c,-.16);return{colorScheme:m,background:l.toHslString(),background2:C.toHslString(),foreground:b.toHslString(),foreground2:f.toHslString(),foreground3:w.toHslString(),foreground4:y.toHslString(),accent:s.toHslString(),accentLight:x.toHslString(),accentDark:g.toHslString(),foregroundAccent:F.toHslString(),success:c.toHslString(),successDark:I.toHslString(),error:_.toHslString()}}var to={appearance:{theme:"light",accentColor:"#676FFF"},walletConnectCloudProjectId:ls,rpcConfig:{rpcUrls:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};function Jn(e,t){let o,r,n,i,a,l,s,c;if(t?.loginMethods?(o=t.loginMethods.includes("email"),r=t.loginMethods.includes("sms"),n=t.loginMethods.includes("wallet"),i=t.loginMethods.includes("google"),a=t.loginMethods.includes("twitter"),l=t.loginMethods.includes("discord"),s=t.loginMethods.includes("github"),c=t.loginMethods.includes("apple")):(o=e.emailAuth,r=e.smsAuth,n=e.walletAuth,i=e.googleOAuth,a=e.twitterOAuth,l=e.discordOAuth,s=e.githubOAuth,c=e.appleOAuth),o&&r&&(console.warn("Enabling both email and SMS passwordless is not currently supported. Disabling SMS."),r=!1),!o&&!r&&[i,a,l,s,c].some(C=>C))throw new Error("To enable social logins you must also enable either SMS or Email login");if(![o,r,n,i,a,l,s,c].some(C=>C))throw new Error("You must enable at least one login method");let _=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:sp({backgroundTheme:t?.appearance?.theme??to.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??to.appearance.accentColor}),showWalletLoginFirst:t?.appearance?.showWalletLoginFirst??e.showWalletLoginFirst},loginMethods:{wallet:n,email:o,sms:r,google:i,twitter:a,discord:l,github:s,apple:c},legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??to.walletConnectCloudProjectId,rpcConfig:t?.rpcConfig??to.rpcConfig,chains:Fg(t?.additionalChains),captchaEnabled:e.captchaEnabled??to.captchaEnabled,embeddedWallets:{...e.embeddedWalletConfig,..._?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1,noPromptOnSignature:!0}:{},...t?.embeddedWallets},customAuth:_?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??to.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??to._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??to._render.inParentNodeId}}}function lp(e,t){return e?.appearance?.logo&&typeof e.appearance.logo=="object"&&(e.appearance.logo="component"),{...e,legacyCreateEmbeddedWalletFlag:t}}function Fg(e){return!e||e.length===0?Sr.map(o=>o):Sr.concat(e.filter(o=>!ip.has(o.id)))}import{useRef as Bg,useEffect as Hg}from"react";var Qn=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 jg}from"react/jsx-runtime";var Gg=function(e){return()=>`id-${e++}`}(0);function zg(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function tr(e){return e.error!==void 0}var xo=new Qn,ka=new Map,Vg=(e,t)=>typeof t=="bigint"?t.toString():t,$g=(e,t)=>`${e}${JSON.stringify(t,Vg)}`;function or(e,t,o){let r=o.contentWindow;if(!r)throw new Error("iframe not initialized");let n=$g(e,t);if(e==="privy:wallet:create"){let a=ka.get(n);if(a)return a}let i=new Promise((a,l)=>{let s=Gg();xo.enqueue(s,{resolve:a,reject:l}),r.postMessage({id:s,event:e,data:t},"*")}).finally(()=>{ka.delete(n)});return ka.set(n,i),i}function qg(e){switch(e.event){case"privy:iframe:ready":let t=xo.dequeue(e.event,e.id);return tr(e)?t.reject(new Tt(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let o=xo.dequeue(e.event,e.id);return tr(e)?o.reject(new Tt(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let r=xo.dequeue(e.event,e.id);return tr(e)?r.reject(new Tt(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:recover":let n=xo.dequeue(e.event,e.id);return tr(e)?n.reject(new Tt(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=xo.dequeue(e.event,e.id);return tr(e)?i.reject(new Tt(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=xo.dequeue(e.event,e.id);return tr(e)?a.reject(new Tt(e.error.type,e.error.message)):a.resolve(e.data);default:console.warn("Unsupported wallet proxy method:",e)}}function cp(e){let t=Bg(null);return Hg(()=>{let o=t.current;if(!o)return;function r(s){s&&s.origin===e.origin&&zg(s.data)&&qg(s.data)}let n={create(s){return or("privy:wallet:create",s,o)},connect(s){return or("privy:wallet:connect",s,o)},recover(s){return or("privy:wallet:recover",s,o)},rpc(s){return or("privy:wallet:rpc",s,o)},setRecoveryPassword(s){return or("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 Cs(()=>or("privy:iframe:ready",{},o),{abortSignal:l.signal}).then(i,a),()=>{window.removeEventListener("message",r),l.abort()}},[t.current]),jg("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},src:zr(e.origin,`/apps/${e.appId}/embedded-wallets`)})}import{createContext as Kg,useContext as Yg,useEffect as Jg}from"react";var dp={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]}},Wa=Kg(void 0),Qg=()=>Yg(Wa);function oo(e,t){if(!t)return;let r=Qg().current[e];return Jg(()=>{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 ro,jsxs as up}from"react/jsx-runtime";function e1(e){return typeof e=="string"&&e.length===25}var Ar;function Et(){if(!Ar){let e=q.get(Ro);return Promise.resolve(e||null)}return Ar.getAccessToken()}var mp,Ps=(e,t)=>mp(e,t),hp,_s=(e,t)=>hp(e,t),fp,Ss=()=>fp(),t1=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;q.put(ar,t);let o=new URL(window.location.href);o.searchParams.delete("privy_token"),window.history.pushState({},"",o)},o1=({config:e,...t})=>{if(!e1(t.appId))throw new E("Cannot initialize the Privy provider with an invalid Privy app ID");Ar||(Ar=new mr({appId:t.appId,apiUrl:t.apiUrl||Dr}));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."),ro(r1,{...t,config:o,client:Ar})},r1=e=>{let t=e.client,[o,r]=J(!1),[n,i]=J(!1),[a,l]=J(!1),[s,c]=J(null),[_,m]=J(!1),[C,b]=J([]),f=pp(C),[w,y]=J(!1),[x,g]=J(null),[F,I]=J(!1),[k,M]=J({status:"disconnected",connectError:null,connector:null,connectRetry:T}),[B,oe]=J(null),[O,V]=J(null),[z,Q]=J({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,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserPasswordOnCreate:!1},fiatOnRampEnabled:!1,captchaEnabled:!1}),[L,me]=J(()=>{let d=lp(e.config,e.createPrivyWalletOnLogin);return t.createAnalyticsEvent("sdk_initialize",d),Jn(z,e.config)}),[D,ce]=J(!0),[he,H]=J({}),[wt,Ce]=J(null),[rr,no]=J(null),[Rr,Xn]=J(!1),[nr,It]=J(),[Ze,re]=J(),[Oe,io]=J(),[To,Na]=J(!1),ne=pp(dp),_e=d=>{d&&g(d),r(!0),t.createAnalyticsEvent("modal_open",{initialScreen:d})},kr=d=>{L.embeddedWallets.createOnLogin!=="off"&&ce(!0),_e(d)};vt(()=>{if(!O||!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(O,p)}},[O,s]),vt(()=>{O&&rr?.(O)},[O]),vt(()=>{(async()=>{if(!L.customAuth?.enabled)return;ce(!0);let{getCustomAccessToken:p,isLoading:u}=L.customAuth;if(!(!n||u))try{let h=await p();if(!h){await Po.logout();return}if(a)return;t.startAuthFlow(new So(h));let{user:N,isNewUser:fe}=await t.authenticate();N||await Po.logout(),c(N||null),y(fe||!1),l(!0),Na(!0)}catch(h){console.warn(h),a&&await Po.logout()}})()},[L.customAuth?.enabled,L.customAuth?.getCustomAccessToken,L.customAuth?.isLoading,n,a]),vt(()=>{To&&O&&s&&Ot(s,e.config?.embeddedWallets?.createOnLogin)&&(Na(!1),Da(s,3e4).catch(console.error))},[To&&O&&s]),vt(()=>{async function d(){let p=await t.getServerConfig();Q(p);let u=Jn(p,e.config);me(u),p.customApiUrl&&t.updateApiUrl(p.customApiUrl),t.initializeConnectorManager(u.walletConnectCloudProjectId,u.rpcConfig,u.chains),t.connectors?.initialize();let h=yp();t1();let N=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!N),N&&le(ne,"login","onComplete",N,!1,!0),c(N)),h||(i(!0),wt?.()),h&&N&&m(!0),gp()}n||d()},[t,wt,n]),vt(()=>{let d=Jn(z,e.config);me(d)},[e.config]);let yp=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_oauth_code"),u=d.get("privy_oauth_state"),h=d.get("privy_oauth_provider");return p&&u&&h?(t.startAuthFlow(new Lt(h,p,u)),kr("AWAITING_OAUTH_SCREEN"),H({finishOauthFlow:{onComplete:()=>{i(!0),wt?.()}}}),!0):!1},ei=async(d,p,u)=>{let h=await t.connectors?.createWalletConnector(d,p)||null;La(h,u)};async function La(d,p){if(!d)return M({status:"disconnected",connectError:new G("Unable to connect to wallet."),connector:null,connectRetry:T}),p?.(null);M({connector:d,status:"connecting",connectError:null,connectRetry:()=>La(d,p)});try{let u=await d.connect({showPrompt:!0});return M(h=>({...h,status:"connected",connectError:null,connectRetry:T})),u&&!F&&le(ne,"connectWallet","onSuccess",u),p?.(u)}catch(u){return u instanceof qe?(console.warn(u.cause?u.cause:u.message),F||le(ne,"connectWallet","onError",u.privyErrorCode||"generic_connect_wallet_error")):(console.warn(u),F||le(ne,"connectWallet","onError","unknown_connect_wallet_error")),M(h=>({...h,status:"disconnected",connectError:u})),p?.(null)}}let ti=d=>{d!==null&&t.startAuthFlow(new so(d))},gp=()=>{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"&&!Fe()&&kr("LOGIN_FAILED_SCREEN"),!t.connectors)throw new E("Connector not initialized");_e("AWAITING_CONNECTION");let h=new URL(window.location.href);h.searchParams.delete("privy_connector"),h.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",h),ei(p,u,ti)};vt(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let Ma=()=>{m(!0),_e("LINK_WALLET_SCREEN")},vp=d=>{if(!a||!s)return!1;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address)return!0;return!1},wp=async d=>{if(!t.connectors)throw new E("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;M(u=>({...u,connector:p,status:"connected",connectError:null,connectRetry:T})),ti(d),kr("AWAITING_CONNECTION")},Cp=async(d,p)=>{if(!t.connectors)throw new E("Connector not initialized");await ei(d,p,ti)},Oa=async(d,p)=>{if(!L.fiatOnRamp.enabled)throw new E("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:u,externalTransactionId:h}=await ec(t,d,p?.config??{},L.appearance.palette,L.fiatOnRamp.useSandbox);return{signedUrl:u,externalTransactionId:h}}else throw new E("Unsupported fund provider. Currently supported option is `moonpay`.")},Wr=()=>{b(d=>{let p=t.connectors?.wallets.map(u=>({...u,linked:vp(u),loginOrLink:async()=>{if(!await u.isConnected())throw new E("Wallet is not connected");if(u.connectorType==="embedded"&&u.walletClientType==="privy")throw new E("Cannot link or login with embedded wallet");wp(u)},fund:async h=>{let{signedUrl:N,externalTransactionId:fe}=await Oa(u.address,h);H({fiatOnRampPrompt:{signedUrl:N},fiatOnRampStatus:{externalTransactionId:fe}}),_e("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new E("User is not authenticated.");if(u.connectorType==="embedded"&&u.walletClientType==="privy")throw new E("Cannot unlink an embedded wallet");let h=await t.unlinkWallet(u.address);c(h)}}))||[];return qr(d,p)?d:p})};vt(()=>{Wr()},[s?.linkedAccounts,a,n]),vt(()=>{if(n){if(!t.connectors)throw new E("Connector not initialized");Wr(),t.connectors.on("walletsUpdated",Wr)}},[n]);let bp=()=>{_e(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};vt(()=>{if(!C[0])return;let d=C[0],p=f.current.find(h=>h.address===d.address),u=s?.linkedAccounts.find(h=>h.type==="wallet"&&h.address===d.address);if(!p&&u){let h=Object.assign({},s);h.wallet=u&&{address:u.address,chainType:u.chainType,chainId:u.chainId,walletClient:u.walletClient,walletClientType:u.walletClientType,connectorType:u.connectorType},c(h)}f.current=C},[C]);let Da=async(d,p)=>{if(K(d))throw le(ne,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[h,N]=await Promise.all([$e.initializeWalletProxy(p),Et()]);if(!h&&e.config?.customAuth?.enabled)throw le(ne,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!h||!N||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((fe,De)=>{ce(!0),H({createWallet:{onSuccess:et=>{le(ne,"createWallet","onSuccess",et),fe(et)},onFailure:et=>{le(ne,"createWallet","onError","unknown_embedded_wallet_error"),De(et)},callAuthOnSuccessOnClose:!1}}),_e("EMBEDDED_WALLET_SCREEN")});{await h.create({accessToken:N});let fe=await $e.refreshUser(),De=K(fe);if(!De)throw le(ne,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return le(ne,"createWallet","onSuccess",De),De}},Po={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:bp,linkWallet:Ma,linkEmail:()=>{if(s?.email)throw new E("User already has an email linked to their account.");m(!0),_e("LINK_EMAIL_SCREEN")},linkPhone:()=>{if(s?.phone)throw new E("User already has a phone number linked to their account.");m(!0),_e("LINK_PHONE_SCREEN")},linkGoogle:async()=>{if(s?.google)throw new E("User already has a Google account linked to their account.");await $e.initLoginWithOAuth("google")},linkTwitter:async()=>{if(s?.twitter)throw new E("User already has a Twitter account linked to their account.");await $e.initLoginWithOAuth("twitter")},linkDiscord:async()=>{if(s?.discord)throw new E("User already has a Discord account linked to their account.");await $e.initLoginWithOAuth("discord")},linkGithub:async()=>{if(s?.github)throw new E("User already has a Github account linked to their account.");await $e.initLoginWithOAuth("github")},linkApple:async()=>{await $e.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}I(!0),kr()},logout:async()=>{await t.logout(),c(null),l(!1),g(null),le(ne,"logout","onSuccess"),m(!1),r(!1)},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(h=>h.address===d?.address));return!d||!p?new Z:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new Ia(new at(new Z));let d=C.find(u=>s.wallet&&u.address===s.wallet.address),p=t.connectors?.walletConnectors.find(u=>u.wallets.find(h=>h.address===d?.address));return!d||!p?new Ia(new at(new Z)):new Ia(new at(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Ft(new Z);let d=C.find(u=>s.wallet&&u.address===s.wallet.address),p=t.connectors?.walletConnectors.find(u=>u.wallets.find(h=>h.address===d?.address));return!d||!p?new Ft(new Z):new Ft(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},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},setActiveWallet:async d=>{let p=C.find(h=>Zn(h.address)===Zn(d)),u=s?.linkedAccounts.find(h=>h.type==="wallet"&&Zn(h.address)===Zn(d));if(!p||!await p.isConnected())oe(d),Ma();else if(!p.linked)p.loginOrLink();else{let h=Object.assign({},s);h.wallet=u&&{address:u.address,chainType:u.chainType,chainId:u.chainId,walletClient:u.walletClient,walletClientType:u.walletClientType,connectorType:u.connectorType},c(h)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw le(ne,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return Da(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=K(s);if(!u||!O){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}ce(!0);let h={onSuccess:d,onFailure:p,callAuthOnSuccessOnClose:!1},N={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_SPLASH_SCREEN",onFailure:p};H({setWalletPassword:h,connectWallet:N}),_e("EMBEDDED_WALLET_CONNECTING_SCREEN")}),signMessage:(d,p)=>new Promise((u,h)=>{if(!a||!s){h(new Error("User must be authenticated before signing with a Privy wallet"));return}let N=K(s);if(!N){h(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){h(new Error("Message must be a non-empty string"));return}ce(!0);let fe=async()=>{a||h(new Error("User must be authenticated before signing with a Privy wallet"));let De=await Et();if(O&&De)try{if(!await $e.recoverEmbeddedWallet()){h(new Error("Unable to connect to wallet"));return}t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:N.address});let{response:et}=await O.rpc({accessToken:De,address:N.address,request:{method:"personal_sign",params:[d,N.address]}}),Nt=et.data;u(Nt),t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:N.address})}catch(Xe){h(Xe)}};if(L.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),fe();else{let Xe={message:d,confirmAndSignMessage:fe,onFailure:Nt=>{h(Nt)},uiOptions:p||{}},et={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:h};H({signMessage:Xe,connectWallet:et}),_e("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:(d,p,u)=>new Promise(async(h,N)=>{if(!a||!s){N(new Error("User must be authenticated before signing with a Privy wallet"));return}let fe=K(s);if(!fe){N(new Error("Must have a Privy wallet before signing"));return}ce(!0);let De=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Xe=Object.assign({},d,{chainId:d.chainId||De.chainId}),et=async()=>{let Nt=await Et();if(!Nt||!O){N(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await $e.recoverEmbeddedWallet()){N(new Error("Unable to connect to wallet"));return}let Ua=new Zg(Ke(Xe.chainId,L.chains,L.rpcConfig)),xp=await Vn(fe.address,Xe,Ua),Tp=await $n(Nt,fe.address,O,xp,Ua);h(Tp)}catch(Ir){N(Ir)}};if(L.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),et();else{let Nt={transactionRequest:Xe,onSuccess:h,onFailure:N,uiOptions:p||{},fundWalletConfig:u},Ir={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:N};H({connectWallet:Ir,sendTransaction:Nt}),_e("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(!K(s)){p(new Error("Must have a Privy wallet before exporting"));return}ce(!0);let h={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},N={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};H({keyExport:N,connectWallet:h}),_e("EMBEDDED_WALLET_CONNECTING_SCREEN")})};mp=Po.signMessage,hp=Po.sendTransaction;let $e=(()=>({isNewUserThisSession:w,isLinking:_,linkingHint:B,walletConnectionStatus:k,rpcConfig:L.rpcConfig,chains:L.chains,nativeTokenSymbolForChainId:d=>L.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,captchaData:{ready:Rr,enabled:L.captchaEnabled,execute:()=>{let d=window.turnstile;if(!d)return;let p=d.render("#cf-turnstile",{sitekey:cs,action:L.id,callback:It,"error-callback":re,"expired-callback":()=>{try{d.reset(Oe),re(void 0),It(void 0)}catch{re("expired_and_failed_reset")}},"unsupported-callback":()=>{console.warn("Browser does not support Turnstile.")}});p||console.warn("Failed to render challenge."),io(p)},remove:()=>{let d=window.turnstile;!d?.remove||!Oe||(d.remove(Oe),io(void 0),re(void 0),It(void 0))},token:nr,error:Ze},initializeWalletProxy:async d=>{if(O)return O;let p=new Promise(N=>{no(()=>fe=>N(fe))}),u=new Promise(N=>setTimeout(()=>N(null),d)),h=await Promise.race([p,u]);return no(null),h},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0})=>{let p=n&&a&&s;d.shouldCallAuthOnSuccess&&p?(le(ne,"login","onComplete",s,w,!1),e.onSuccess?.(s,w)):F&&le(ne,"login","onError","exited_auth_flow"),t.authFlow=void 0,oe(null),g(null),I(!1),m(!1),y(!1),r(!1),t.createAnalyticsEvent("modal_closed")},connectWallet:ei,initLoginWithWallet:Cp,loginWithWallet:async()=>{if(!n)throw new ir;if(!(t.authFlow instanceof so))throw new E("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(ne,"login","onError",u.privyErrorCode||"generic_connect_wallet_error"),u}c(d||s||null),y(p||!1),l(!0)},initLoginWithOAuth:async d=>{t.startAuthFlow(new Lt(d));let p=await t.authFlow.getAuthorizationUrl();p&&p.url&&window.location.assign(p.url)},loginWithOAuth:async()=>{if(!(t.authFlow instanceof Lt))throw new E("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(ne,"login","onError",u.privyErrorCode||"unknown_auth_error"),u}c(d),y(p||!1),l(!0)},initLoginWithEmail:async(d,p)=>{let u=new ao(d,p);t.startAuthFlow(u);try{await u.sendCodeEmail()}catch(h){throw le(ne,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}},initLoginWithSms:async(d,p)=>{let u=new lo(d,p);t.startAuthFlow(u);try{await u.sendSmsCode()}catch(h){throw le(ne,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(!n)throw new ir;if(t.authFlow instanceof ao)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof lo)t.authFlow.meta.smsCode=d.trim();else throw new E("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:O,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(N=>N.type==="wallet"&&N.walletClientType==="privy"),h=await Et();if(!h||!O||!u){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}ce(!0);try{await O.connect({accessToken:h,address:u.address}),d(!0)}catch(N){Uo(N)&&u.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:u.address}),(await O.recover({address:u.address,accessToken:h})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:u.address}),d(!0)):Uo(N)?(H({recoverWallet:{privyWallet:u,onFailure:p,onSuccess:()=>d(!0)}}),_e("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(N)}}),getFiatOnRampConfig:Oa,updateWallets:()=>Wr()}))();fp=$e.recoverEmbeddedWallet;let Ep=Xg(()=>({wallets:C}),[C]);return ro(Je.Provider,{value:Po,children:ro(Wa.Provider,{value:ne,children:up(Ta.Provider,{value:Ep,children:[e.children,up(vi.Provider,{value:$e,children:[ro(Md,{theme:{...L.appearance.palette||{}}}),ro(Ls,{appConfig:L,data:he,setModalData:H,setInitialScreen:g,initialScreen:x,visible:o,authenticated:a,children:o?ro(Ud,{}):null}),D&&z.id?ro(cp,{appId:e.appId,origin:t.apiUrl,onLoad:V,onLoadFailed:()=>null}):null]}),L.captchaEnabled&&ro(Fd,{onLoad:()=>Xn(!0)})]})})})};import{useContext as n1}from"react";function i1(e){let{login:t}=n1(Je);return oo("login",e),{login:t}}import{useContext as a1}from"react";function s1(e){let{logout:t}=a1(Je);return oo("logout",e),{logout:t}}import{useContext as l1}from"react";function c1(e){let{connectWallet:t}=l1(Je);return oo("connectWallet",e),{connectWallet:t}}import{useContext as d1}from"react";function p1(e){let{createWallet:t}=d1(Je);return oo("createWallet",e),{createWallet:t}}export{at as AsExternalProvider,pr as ConnectorManager,mr as PrivyClient,o1 as PrivyProvider,Z as PrivyProxyProvider,Sr as SUPPORTED_CHAINS,oi as VERSION,Ne as WalletConnector,Et as getAccessToken,c1 as useConnectWallet,p1 as useCreateWallet,i1 as useLogin,s1 as useLogout,$ as usePrivy,Pa as useWallets};
|
|
2338
|
+
`;import{useEffect as I1}from"react";import{Fragment as L1,jsx as M1}from"react/jsx-runtime";var N1=({onLoad:e})=>{let t=window;return I1(()=>{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)},[]),M1(L1,{})},ap=N1;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,Ar,Rr,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",O1="#000000",D1=Pp,U1="#1E1E1D";function F1(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 oo(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:i=Pp,blackHex:a=O1}){let l;switch(e){case"light":l=D1;break;case"dark":l=U1;break;default:l=e;break}let s=_o(l),c=_o(t),E=_o(o),g=_o(r),x=_o(n),m=F1(s.getLuminance()),f=oo(s,m==="light"?-.04:.11),v=oo(s,m==="light"?-.88:.87),h=oo(s,m==="light"?-.77:.75),P=oo(s,m==="light"?-.43:.45).desaturate(m==="light"?60:20),b=oo(s,m==="light"?-.08:.25).desaturate(m==="light"?60:20),M=oo(c,.15),I=oo(c,-.06),k=_o(c.getLuminance()>.5?a:i),W=oo(E,-.16);return{colorScheme:m,background:s.toHslString(),background2:f.toHslString(),foreground:v.toHslString(),foreground2:h.toHslString(),foreground3:P.toHslString(),foreground4:b.toHslString(),accent:c.toHslString(),accentLight:M.toHslString(),accentDark:I.toHslString(),foregroundAccent:k.toHslString(),success:E.toHslString(),successDark:W.toHslString(),error:x.toHslString(),warn:g.toHslString()}}var ro={appearance:{theme:"light",accentColor:"#676FFF"},walletConnectCloudProjectId:fs,rpcConfig:{rpcUrls:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};function ti(e,t){let o,r,n,i,a,l,s,c;if(t?.loginMethods?(o=t.loginMethods.includes("email"),r=t.loginMethods.includes("sms"),n=t.loginMethods.includes("wallet"),i=t.loginMethods.includes("google"),a=t.loginMethods.includes("twitter"),l=t.loginMethods.includes("discord"),s=t.loginMethods.includes("github"),c=t.loginMethods.includes("apple")):(o=e.emailAuth,r=e.smsAuth,n=e.walletAuth,i=e.googleOAuth,a=e.twitterOAuth,l=e.discordOAuth,s=e.githubOAuth,c=e.appleOAuth),o&&r&&(console.warn("Enabling both email and SMS passwordless is not currently supported. Disabling SMS."),r=!1),!o&&!r&&[i,a,l,s,c].some(x=>x))throw new Error("To enable social logins you must also enable either SMS or Email login");if(![o,r,n,i,a,l,s,c].some(x=>x))throw new Error("You must enable at least one login method");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??ro.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??ro.appearance.accentColor}),showWalletLoginFirst:t?.appearance?.showWalletLoginFirst??e.showWalletLoginFirst},loginMethods:{wallet:n,email:o,sms:r,google:i,twitter:a,discord:l,github:s,apple:c},legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??ro.walletConnectCloudProjectId,rpcConfig:t?.rpcConfig??ro.rpcConfig,chains:B1(t?.additionalChains),captchaEnabled:e.captchaEnabled??ro.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??ro.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??ro._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??ro._render.inParentNodeId}}}function Sp(e,t){return e?.appearance?.logo&&typeof e.appearance.logo=="object"&&(e.appearance.logo="component"),{...e,legacyCreateEmbeddedWalletFlag:t}}function B1(e){return!e||e.length===0?Ir.map(o=>o):Ir.concat(e.filter(o=>!Tp.has(o.id)))}import{useRef as H1,useEffect as G1}from"react";var oi=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 K1}from"react/jsx-runtime";var z1=function(e){return()=>`id-${e++}`}(0);function $1(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function rr(e){return e.error!==void 0}var So=new oi,Da=new Map,V1=(e,t)=>typeof t=="bigint"?t.toString():t,q1=(e,t)=>`${e}${JSON.stringify(t,V1)}`;function nr(e,t,o){let r=o.contentWindow;if(!r)throw new Error("iframe not initialized");let n=q1(e,t);if(e==="privy:wallet:create"){let a=Da.get(n);if(a)return a}let i=new Promise((a,l)=>{let s=z1();So.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 j1(e){switch(e.event){case"privy:iframe:ready":let t=So.dequeue(e.event,e.id);return rr(e)?t.reject(new _t(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 _t(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 _t(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 _t(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=So.dequeue(e.event,e.id);return rr(e)?i.reject(new _t(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=So.dequeue(e.event,e.id);return rr(e)?a.reject(new _t(e.error.type,e.error.message)):a.resolve(e.data);default:console.warn("Unsupported wallet proxy method:",e)}}function Ap(e){let t=H1(null);return G1(()=>{let o=t.current;if(!o)return;function r(s){s&&s.origin===e.origin&&$1(s.data)&&j1(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 Ss(()=>nr("privy:iframe:ready",{},o),{abortSignal:l.signal}).then(i,a),()=>{window.removeEventListener("message",r),l.abort()}},[t.current]),K1("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},src:Yr(e.origin,`/apps/${e.appId}/embedded-wallets`)})}import{createContext as Y1,useContext as J1,useEffect as Q1}from"react";var Rp={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]}},Ua=Y1(void 0),Z1=()=>J1(Ua);function no(e,t){if(!t)return;let r=Z1().current[e];return Q1(()=>{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 ce(e,t,o,...r){for(let n of e.current[t][o])n(...r)}import{jsx as io,jsxs as Wp}from"react/jsx-runtime";function tv(e){return typeof e=="string"&&e.length===25}var Nr;function Tt(){if(!Nr){let e=K.get(Lo);return Promise.resolve(e||null)}return Nr.getAccessToken()}var Ip,Is=(e,t)=>Ip(e,t),Np,Ns=(e,t)=>Np(e,t),Lp,Ls=()=>Lp(),ov=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;K.put(lr,t);let o=new URL(window.location.href);o.searchParams.delete("privy_token"),window.history.pushState({},"",o)},rv=({config:e,...t})=>{if(!tv(t.appId))throw new C("Cannot initialize the Privy provider with an invalid Privy app ID");Nr||(Nr=new fr({appId:t.appId,apiUrl:t.apiUrl||zr}));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."),io(nv,{...t,config:o,client:Nr})},nv=e=>{let t=e.client,[o,r]=Q(!1),[n,i]=Q(!1),[a,l]=Q(!1),[s,c]=Q(null),[E,g]=Q(!1),[x,m]=Q([]),f=kp(x),[v,h]=Q(!1),[P,b]=Q(null),[M,I]=Q(!1),[k,W]=Q({status:"disconnected",connectError:null,connector:null,connectRetry:T}),[U,X]=Q(null),[O,G]=Q(null),[z,ee]=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,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserPasswordOnCreate:!1},fiatOnRampEnabled:!1,captchaEnabled:!1}),[D,de]=Q(()=>{let d=Sp(e.config,e.createPrivyWalletOnLogin);return t.createAnalyticsEvent("sdk_initialize",d),ti(z,e.config)}),[$,te]=Q(!0),[Oe,F]=Q({}),[bt,we]=Q(null),[ir,ao]=Q(null),[Lr,ni]=Q(!1),[ar,Lt]=Q(),[tt,ie]=Q(),[De,so]=Q(),[Ao,Ba]=Q(!1),ae=kp(Rp),Pe=d=>{d&&b(d),r(!0),t.createAnalyticsEvent("modal_open",{initialScreen:d})},Mr=d=>{D.embeddedWallets.createOnLogin!=="off"&&te(!0),Pe(d)};Ct(()=>{if(!O||!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(O,p)}},[O,s]),Ct(()=>{O&&ir?.(O)},[O]),Ct(()=>{(async()=>{if(!D.customAuth?.enabled)return;te(!0);let{getCustomAccessToken:p,isLoading:u}=D.customAuth;if(!(!n||u))try{let y=await p();if(!y){await Ro.logout();return}if(a)return;t.startAuthFlow(new Io(y));let{user:N,isNewUser:he}=await t.authenticate();N||await Ro.logout(),c(N||null),h(he||!1),l(!0),Ba(!0)}catch(y){console.warn(y),a&&await Ro.logout()}})()},[D.customAuth?.enabled,D.customAuth?.getCustomAccessToken,D.customAuth?.isLoading,n,a]),Ct(()=>{Ao&&O&&s&&Ut(s,e.config?.embeddedWallets?.createOnLogin)&&(Ba(!1),$a(s,3e4).catch(console.error))},[Ao&&O&&s]),Ct(()=>{async function d(){let p=await t.getServerConfig();ee(p);let u=ti(p,e.config);de(u),p.customApiUrl&&t.updateApiUrl(p.customApiUrl),t.initializeConnectorManager(u.walletConnectCloudProjectId,u.rpcConfig,u.chains),t.connectors?.initialize();let y=Mp();ov();let N=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!N),N&&ce(ae,"login","onComplete",N,!1,!0),c(N)),y||(i(!0),bt?.()),y&&N&&g(!0),Op()}n||d()},[t,bt,n]),Ct(()=>{let d=ti(z,e.config);de(d)},[e.config]);let Mp=()=>{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 Ot(y,p,u)),Mr("AWAITING_OAUTH_SCREEN"),F({finishOauthFlow:{onComplete:()=>{i(!0),bt?.()}}}),!0):!1},ii=async(d,p,u)=>{let y=await t.connectors?.createWalletConnector(d,p)||null;Ha(y,u)};async function Ha(d,p){if(!d)return W({status:"disconnected",connectError:new B("Unable to connect to wallet."),connector:null,connectRetry:T}),p?.(null);W({connector:d,status:"connecting",connectError:null,connectRetry:()=>Ha(d,p)});try{let u=await d.connect({showPrompt:!0});return W(y=>({...y,status:"connected",connectError:null,connectRetry:T})),u&&!M&&ce(ae,"connectWallet","onSuccess",u),p?.(u)}catch(u){return u instanceof Ke?(console.warn(u.cause?u.cause:u.message),M||ce(ae,"connectWallet","onError",u.privyErrorCode||"generic_connect_wallet_error")):(console.warn(u),M||ce(ae,"connectWallet","onError","unknown_connect_wallet_error")),W(y=>({...y,status:"disconnected",connectError:u})),p?.(null)}}let ai=d=>{d!==null&&t.startAuthFlow(new co(d))},Op=()=>{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"&&!Be()&&Mr("LOGIN_FAILED_SCREEN"),!t.connectors)throw new C("Connector not initialized");Pe("AWAITING_CONNECTION");let y=new URL(window.location.href);y.searchParams.delete("privy_connector"),y.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",y),ii(p,u,ai)};Ct(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let Ga=()=>{g(!0),Pe("LINK_WALLET_SCREEN")},Dp=d=>{if(!a||!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 C("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;W(u=>({...u,connector:p,status:"connected",connectError:null,connectRetry:T})),ai(d),Mr("AWAITING_CONNECTION")},Fp=async(d,p)=>{if(!t.connectors)throw new C("Connector not initialized");await ii(d,p,ai)},za=async(d,p)=>{if(!D.fiatOnRamp.enabled)throw new C("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:u,externalTransactionId:y}=await vc(t,d,p?.config??{},D.appearance.palette,D.fiatOnRamp.useSandbox);return{signedUrl:u,externalTransactionId:y}}else throw new C("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 C("Wallet is not connected");if(u.connectorType==="embedded"&&u.walletClientType==="privy")throw new C("Cannot link or login with embedded wallet");Up(u)},fund:async y=>{let{signedUrl:N,externalTransactionId:he}=await za(u.address,y);F({fiatOnRampPrompt:{signedUrl:N},fiatOnRampStatus:{externalTransactionId:he}}),Pe("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new C("User is not authenticated.");if(u.connectorType==="embedded"&&u.walletClientType==="privy")throw new C("Cannot unlink an embedded wallet");let y=await t.unlinkWallet(u.address);c(y)}}))||[];return Zr(d,p)?d:p})};Ct(()=>{Or()},[s?.linkedAccounts,a,n]),Ct(()=>{if(n){if(!t.connectors)throw new C("Connector not initialized");Or(),t.connectors.on("walletsUpdated",Or)}},[n]);let Bp=()=>{Pe(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Ct(()=>{if(!x[0])return;let d=x[0],p=f.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)}f.current=x},[x]);let $a=async(d,p)=>{if(Y(d))throw ce(ae,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[y,N]=await Promise.all([je.initializeWalletProxy(p),Tt()]);if(!y&&e.config?.customAuth?.enabled)throw ce(ae,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!y||!N||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((he,Ue)=>{te(!0),F({createWallet:{onSuccess:rt=>{ce(ae,"createWallet","onSuccess",rt),he(rt)},onFailure:rt=>{ce(ae,"createWallet","onError","unknown_embedded_wallet_error"),Ue(rt)},callAuthOnSuccessOnClose:!1}}),Pe("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await y.create({accessToken:N});let he=await je.refreshUser(),Ue=Y(he);if(!Ue)throw ce(ae,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return ce(ae,"createWallet","onSuccess",Ue),Ue}},Ro={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:Bp,linkWallet:Ga,linkEmail:()=>{if(s?.email)throw new C("User already has an email linked to their account.");g(!0),Pe("LINK_EMAIL_SCREEN")},linkPhone:()=>{if(s?.phone)throw new C("User already has a phone number linked to their account.");g(!0),Pe("LINK_PHONE_SCREEN")},linkGoogle:async()=>{if(s?.google)throw new C("User already has a Google account linked to their account.");await je.initLoginWithOAuth("google")},linkTwitter:async()=>{if(s?.twitter)throw new C("User already has a Twitter account linked to their account.");await je.initLoginWithOAuth("twitter")},linkDiscord:async()=>{if(s?.discord)throw new C("User already has a Discord account linked to their account.");await je.initLoginWithOAuth("discord")},linkGithub:async()=>{if(s?.github)throw new C("User already has a Github account linked to their account.");await je.initLoginWithOAuth("github")},linkApple:async()=>{await je.initLoginWithOAuth("apple")},login:async()=>{if(n||(await new Promise(d=>{we(()=>d)}),we(null)),a){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}I(!0),Mr()},logout:async()=>{await t.logout(),c(null),l(!1),b(null),ce(ae,"logout","onSuccess"),g(!1),r(!1)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new Z;let d=x.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 Fa(new dt(new Z));let d=x.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 Fa(new dt(new Z)):new Fa(new dt(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Ht(new Z);let d=x.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 Ht(new Z):new Ht(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},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},setActiveWallet:async d=>{let p=x.find(y=>ri(y.address)===ri(d)),u=s?.linkedAccounts.find(y=>y.type==="wallet"&&ri(y.address)===ri(d));if(!p||!await p.isConnected())X(d),Ga();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(!a||!s)throw ce(ae,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return $a(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||!O){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}te(!0);let y={onSuccess:d,onFailure:p,callAuthOnSuccessOnClose:!1},N={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:p};F({setWalletPassword:y,connectWallet:N}),Pe("EMBEDDED_WALLET_CONNECTING_SCREEN")}),signMessage:(d,p)=>new Promise((u,y)=>{if(!a||!s){y(new Error("User must be authenticated before signing with a Privy wallet"));return}let N=Y(s);if(!N){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}te(!0);let he=async()=>{a||y(new Error("User must be authenticated before signing with a Privy wallet"));let Ue=await Tt();if(O&&Ue)try{if(!await je.recoverEmbeddedWallet()){y(new Error("Unable to connect to wallet"));return}t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:N.address});let{response:rt}=await O.rpc({accessToken:Ue,address:N.address,request:{method:"personal_sign",params:[d,N.address]}}),Mt=rt.data;u(Mt),t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:N.address})}catch(ot){y(ot)}};if(D.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),he();else{let ot={message:d,confirmAndSignMessage:he,onFailure:Mt=>{y(Mt)},uiOptions:p||{}},rt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:y};F({signMessage:ot,connectWallet:rt}),Pe("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:(d,p,u)=>new Promise(async(y,N)=>{if(!a||!s){N(new Error("User must be authenticated before signing with a Privy wallet"));return}let he=Y(s);if(!he){N(new Error("Must have a Privy wallet before signing"));return}te(!0);let Ue=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,ot=Object.assign({},d,{chainId:d.chainId||Ue.chainId}),rt=async()=>{let Mt=await Tt();if(!Mt||!O){N(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await je.recoverEmbeddedWallet()){N(new Error("Unable to connect to wallet"));return}let Va=new X1(Je(ot.chainId,D.chains,D.rpcConfig)),Gp=await Yn(he.address,ot,Va),zp=await Jn(Mt,he.address,O,Gp,Va);y(zp)}catch(Dr){N(Dr)}};if(D.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),rt();else{let Mt={transactionRequest:ot,onSuccess:y,onFailure:N,uiOptions:p||{},fundWalletConfig:u},Dr={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:N};F({connectWallet:Dr,sendTransaction:Mt}),Pe("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}te(!0);let y={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},N={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};F({keyExport:N,connectWallet:y}),Pe("EMBEDDED_WALLET_CONNECTING_SCREEN")})};Ip=Ro.signMessage,Np=Ro.sendTransaction;let je=(()=>({isNewUserThisSession:v,isLinking:E,linkingHint:U,walletConnectionStatus:k,rpcConfig:D.rpcConfig,chains:D.chains,nativeTokenSymbolForChainId:d=>D.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,captchaData:{ready:Lr,enabled:D.captchaEnabled,execute:()=>{let d=window.turnstile;if(!d)return;let p=d.render("#cf-turnstile",{sitekey:ys,action:D.id,callback:Lt,"error-callback":ie,"expired-callback":()=>{try{d.reset(De),ie(void 0),Lt(void 0)}catch{ie("expired_and_failed_reset")}},"unsupported-callback":()=>{console.warn("Browser does not support Turnstile.")}});p||console.warn("Failed to render challenge."),so(p)},remove:()=>{let d=window.turnstile;!d?.remove||!De||(d.remove(De),so(void 0),ie(void 0),Lt(void 0))},token:ar,error:tt},initializeWalletProxy:async d=>{if(O)return O;let p=new Promise(N=>{ao(()=>he=>N(he))}),u=new Promise(N=>setTimeout(()=>N(null),d)),y=await Promise.race([p,u]);return ao(null),y},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0})=>{let p=n&&a&&s;d.shouldCallAuthOnSuccess&&p?(ce(ae,"login","onComplete",s,v,!1),e.onSuccess?.(s,v)):M&&ce(ae,"login","onError","exited_auth_flow"),t.authFlow=void 0,X(null),b(null),I(!1),g(!1),h(!1),r(!1),t.createAnalyticsEvent("modal_closed")},connectWallet:ii,initLoginWithWallet:Fp,loginWithWallet:async()=>{if(!n)throw new sr;if(!(t.authFlow instanceof co))throw new C("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 ce(ae,"login","onError",u.privyErrorCode||"generic_connect_wallet_error"),u}c(d||s||null),h(p||!1),l(!0)},initLoginWithOAuth:async d=>{t.startAuthFlow(new Ot(d));let p=await t.authFlow.getAuthorizationUrl();p&&p.url&&window.location.assign(p.url)},loginWithOAuth:async()=>{if(!(t.authFlow instanceof Ot))throw new C("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 ce(ae,"login","onError",u.privyErrorCode||"unknown_auth_error"),u}c(d),h(p||!1),l(!0)},initLoginWithEmail:async(d,p)=>{let u=new lo(d,p);t.startAuthFlow(u);try{await u.sendCodeEmail()}catch(y){throw ce(ae,"login","onError",y.privyErrorCode||"unknown_auth_error"),y}},initLoginWithSms:async(d,p)=>{let u=new po(d,p);t.startAuthFlow(u);try{await u.sendSmsCode()}catch(y){throw ce(ae,"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 lo)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof po)t.authFlow.meta.smsCode=d.trim();else throw new C("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),h(u||!1),l(!0)},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:O,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(N=>N.type==="wallet"&&N.walletClientType==="privy"),y=await Tt();if(!y||!O||!u){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}te(!0);try{await O.connect({accessToken:y,address:u.address}),d(!0)}catch(N){zo(N)&&u.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:u.address}),(await O.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(N)?(F({recoverWallet:{privyWallet:u,onFailure:p,onSuccess:()=>d(!0)}}),Pe("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(N)}}),getFiatOnRampConfig:za,updateWallets:()=>Or()}))();Lp=je.recoverEmbeddedWallet;let Hp=ev(()=>({wallets:x}),[x]);return io(Ze.Provider,{value:Ro,children:io(Ua.Provider,{value:ae,children:Wp(Wa.Provider,{value:Hp,children:[e.children,Wp(xi.Provider,{value:je,children:[io(op,{theme:{...D.appearance.palette||{}}}),io(Hs,{appConfig:D,data:Oe,setModalData:F,setInitialScreen:b,initialScreen:P,visible:o,authenticated:a,children:o?io(ip,{}):null}),$&&z.id?io(Ap,{appId:e.appId,origin:t.apiUrl,onLoad:G,onLoadFailed:()=>null}):null]}),D.captchaEnabled&&io(ap,{onLoad:()=>ni(!0)})]})})})};import{useContext as iv}from"react";function av(e){let{login:t}=iv(Ze);return no("login",e),{login:t}}import{useContext as sv}from"react";function lv(e){let{logout:t}=sv(Ze);return no("logout",e),{logout:t}}import{useContext as cv}from"react";function dv(e){let{connectWallet:t}=cv(Ze);return no("connectWallet",e),{connectWallet:t}}import{useContext as pv}from"react";function uv(e){let{createWallet:t}=pv(Ze);return no("createWallet",e),{createWallet:t}}export{dt as AsExternalProvider,mr as ConnectorManager,fr as PrivyClient,rv as PrivyProvider,Z as PrivyProxyProvider,Ir as SUPPORTED_CHAINS,si as VERSION,Ne as WalletConnector,Tt as getAccessToken,dv as useConnectWallet,uv as useCreateWallet,av as useLogin,lv as useLogout,V as usePrivy,Ia as useWallets};
|