@privy-io/react-auth 1.92.7 → 1.93.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/cjs/abstract-smart-wallets.js +1 -1
  2. package/dist/cjs/{getEmbeddedConnectedWallet-DS-w3DHv.js → getEmbeddedConnectedWallet-DGCba9eL.js} +1 -1
  3. package/dist/cjs/index.js +124 -124
  4. package/dist/cjs/privy-context-Ds_CALAJ.js +1 -0
  5. package/dist/cjs/{smart-wallets-Di4AUVjR.js → smart-wallets-C-wtePWG.js} +1 -1
  6. package/dist/cjs/smart-wallets.js +1 -1
  7. package/dist/cjs/solana.js +1 -1
  8. package/dist/cjs/ui.js +1 -1
  9. package/dist/cjs/{useFundWallet-CmI_P32R.js → useFundWallet-CW-_1LDw.js} +5 -5
  10. package/dist/cjs/{useSolanaWallets-CQuWnY1r.js → useSolanaWallets-DYHtxLmi.js} +1 -1
  11. package/dist/cjs/{useWallets-Br4RRclA.js → useWallets-CZUj7ALT.js} +1 -1
  12. package/dist/dts/index.d.mts +10 -30
  13. package/dist/dts/index.d.ts +10 -30
  14. package/dist/dts/smart-wallets.d.mts +1 -1
  15. package/dist/dts/smart-wallets.d.ts +1 -1
  16. package/dist/dts/{solana-BRQvrG8A.d.ts → solana-CWtzrK1j.d.mts} +1 -1
  17. package/dist/dts/{solana-BRQvrG8A.d.mts → solana-CWtzrK1j.d.ts} +1 -1
  18. package/dist/dts/solana.d.mts +2 -2
  19. package/dist/dts/solana.d.ts +2 -2
  20. package/dist/dts/{types-fS_ewT7E.d.mts → types-fObwliWo.d.mts} +304 -81
  21. package/dist/dts/{types-fS_ewT7E.d.ts → types-fObwliWo.d.ts} +304 -81
  22. package/dist/dts/ui.d.mts +1 -1
  23. package/dist/dts/ui.d.ts +1 -1
  24. package/dist/esm/abstract-smart-wallets.mjs +1 -1
  25. package/dist/esm/{getEmbeddedConnectedWallet-2FJQV-TA.mjs → getEmbeddedConnectedWallet-CeIDxPC5.mjs} +1 -1
  26. package/dist/esm/index.mjs +318 -318
  27. package/dist/esm/privy-context-BeqkgOHo.mjs +1 -0
  28. package/dist/esm/{smart-wallets-C0eP6Grh.mjs → smart-wallets-vjWIsaaC.mjs} +1 -1
  29. package/dist/esm/smart-wallets.mjs +1 -1
  30. package/dist/esm/solana.mjs +1 -1
  31. package/dist/esm/ui.mjs +1 -1
  32. package/dist/esm/{useFundWallet-DfRcsTFv.mjs → useFundWallet-BLErEIDU.mjs} +18 -18
  33. package/dist/esm/{useSolanaWallets-Cn7Eb8fU.mjs → useSolanaWallets-DiqA_tT8.mjs} +1 -1
  34. package/dist/esm/{useWallets-0pQT6tND.mjs → useWallets-C0_t04LR.mjs} +1 -1
  35. package/package.json +6 -7
  36. package/dist/cjs/privy-context-6Fn5d7Hw.js +0 -1
  37. package/dist/esm/privy-context-BXjG69vB.mjs +0 -1
@@ -0,0 +1 @@
1
+ import{FetchError as e}from"ofetch";import{createContext as t,useContext as n}from"react";var a;class i extends Error{toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(e,t,n){super(e),t instanceof Error&&(this.cause=t),this.privyErrorCode=n}}class s extends i{constructor(e,t,n,a,i,s){super(n,a,i),this.type=e,this.status=t,this.data=s}}class r extends i{constructor(e,t,n){super(e,t,n),this.type="client_error"}}class l extends r{constructor(){super("Request timed out",void 0,"client_request_timeout")}}class o extends i{constructor(e,t,n){super(e,t,n),this.type="connector_error"}}const _=t=>{if(t instanceof i)return t;if(!(t instanceof e))return d(t);if(!t.response)return new s("api_error",null,t.message,t);let{type:n,message:a,error:r,code:l}=t.data;return new s(n||"ApiError",t.response.status,a||r,t,l,t.data)},d=e=>e instanceof i?e:e instanceof Error?new r(e.message,e):new r(`Internal error: ${e}`);var u;(a=u||(u={})).OAUTH_ACCOUNT_SUSPENDED="oauth_account_suspended",a.MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",a.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",a.MISSING_OR_INVALID_TOKEN="missing_or_invalid_token",a.INVALID_DATA="invalid_data",a.INVALID_CAPTCHA="invalid_captcha",a.LINKED_TO_ANOTHER_USER="linked_to_another_user",a.CANNOT_LINK_MORE_OF_TYPE="cannot_link_more_of_type",a.FAILED_TO_LINK_ACCOUNT="failed_to_link_account",a.FAILED_TO_UPDATE_ACCOUNT="failed_to_update_account",a.USER_EXITED_UPDATE_FLOW="exited_update_flow",a.ALLOWLIST_REJECTED="allowlist_rejected",a.OAUTH_USER_DENIED="oauth_user_denied",a.OAUTH_UNEXPECTED="oauth_unexpected",a.UNKNOWN_AUTH_ERROR="unknown_auth_error",a.USER_EXITED_AUTH_FLOW="exited_auth_flow",a.USER_EXITED_LINK_FLOW="exited_link_flow",a.USER_EXITED_SET_PASSWORD_FLOW="user_exited_set_password_flow",a.MUST_BE_AUTHENTICATED="must_be_authenticated",a.UNKNOWN_CONNECT_WALLET_ERROR="unknown_connect_wallet_error",a.GENERIC_CONNECT_WALLET_ERROR="generic_connect_wallet_error",a.CLIENT_REQUEST_TIMEOUT="client_request_timeout",a.INVALID_CREDENTIALS="invalid_credentials",a.MISSING_MFA_CREDENTIALS="missing_or_invalid_mfa",a.UNKNOWN_MFA_ERROR="unknown_mfa_error",a.EMBEDDED_WALLET_ALREADY_EXISTS="embedded_wallet_already_exists",a.EMBEDDED_WALLET_NOT_FOUND="embedded_wallet_not_found",a.EMBEDDED_WALLET_CREATE_ERROR="embedded_wallet_create_error",a.UNKNOWN_EMBEDDED_WALLET_ERROR="unknown_embedded_wallet_error",a.EMBEDDED_WALLET_PASSWORD_UNCONFIRMED="embedded_wallet_password_unconfirmed",a.EMBEDDED_WALLET_PASSWORD_ALREADY_EXISTS="embedded_wallet_password_already_exists",a.EMBEDDED_WALLET_RECOVERY_ALREADY_EXISTS="embedded_wallet_recovery_already_exists",a.TRANSACTION_FAILURE="transaction_failure",a.UNSUPPORTED_CHAIN_ID="unsupported_chain_id",a.NOT_SUPPORTED="not_supported",a.CAPTCHA_TIMEOUT="captcha_timeout",a.INVALID_MESSAGE="invalid_message",a.UNABLE_TO_SIGN="unable_to_sign",a.CAPTCHA_FAILURE="captcha_failure",a.CAPTCHA_DISABLED="captcha_disabled",a.SESSION_STORAGE_UNAVAILABLE="session_storage_unavailable",a.TOO_MANY_REQUESTS="too_many_requests",a.USER_LIMIT_REACHED="max_accounts_reached",a.DISALLOWED_LOGIN_METHOD="disallowed_login_method",a.DISALLOWED_PLUS_EMAIL="disallowed_plus_email",a.PASSKEY_NOT_ALLOWED="passkey_not_allowed",a.USER_DOES_NOT_EXIST="user_does_not_exist",a.INSUFFICIENT_BALANCE="insufficient_balance",a.ACCOUNT_TRANSFER_REQUIRED="account_transfer_required";class c extends r{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}}class E extends r{constructor(e="Embedded wallet error",t){super(e,t,"unknown_embedded_wallet_error")}}class A extends r{constructor(e="User must be authenticated"){super(e,void 0,"must_be_authenticated")}}class p extends r{constructor(e){super("This application is in development mode and must be upgraded to production to log in new users.",e,"max_accounts_reached")}}const S=()=>{throw Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")},T=e=>()=>{throw Error(e.trim())},h=t({isNewUserThisSession:!1,walletConnectionStatus:null,connectors:[],solanaWallets:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,client:null,appId:"notAdded",customAuthStatus:{status:"not-enabled"},noPromptOnSignature:{current:!1},nativeTokenSymbolForChainId:S,initializeWalletProxy:S,getAuthMeta:S,getAuthFlow:S,closePrivyModal:S,openPrivyModal:S,connectWallet:S,initLoginWithWallet:S,loginWithWallet:S,initLoginWithFarcaster:S,loginWithFarcaster:S,loginWithCode:S,initLoginWithEmail:S,initLoginWithSms:S,initUpdateEmail:S,initUpdatePhone:S,resendEmailCode:S,resendSmsCode:S,initLoginWithHeadlessOAuth:S,loginWithHeadlessOAuth:S,crossAppAuthFlow:S,initLoginWithOAuth:S,recoveryOAuthFlow:S,loginWithOAuth:S,passkeyAuthState:{status:"initial"},setPasskeyAuthState:S,initLoginWithPasskey:S,loginWithPasskey:S,initLinkWithPasskey:S,linkWithPasskey:S,refreshUser:S,loginWithGuestAccountFlow:S,walletProxy:null,createAnalyticsEvent:S,acceptTerms:S,getUsdTokenPrice:S,getUsdPriceForSol:S,recoverEmbeddedEthereumWallet:S,getMoonpaySignedUrl:S,initCoinbaseOnRamp:S,getCoinbaseOnRampStatus:S,updateWallets:S,fundWallet:S,fundSolanaWallet:S,setReadyToTrue:S,requestFarcasterSignerStatus:S,initLoginWithTelegram:S,loginWithTelegram:S,generateSiweMessage:S,generateSiweMessageForSmartWallet:S,linkWithSiwe:S,linkSmartWallet:S,delegateWallet:S,revokeDelegatedWallets:S,embeddedSolanaWallet:null,createEmbeddedSolanaWallet:S,recoverEmbeddedSolanaWallet:S,exportSolanaWallet:S,solanaSignMessage:S,connectCoinbaseSmartWallet:S,initiateAccountTransfer:S,emailOtpState:{status:"initial"},setEmailOtpState:S,smsOtpState:{status:"initial"},setSmsOtpState:S,siweState:{status:"initial"},setSiweState:S,oAuthState:{status:"initial"},setOAuthState:S,isHeadlessOAuthLoading:!1}),m=()=>n(h),W=t({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:S,login:S,connectOrCreateWallet:S,linkEmail:S,linkPhone:S,linkFarcaster:S,linkWallet:S,startCrossAppAuthFlow:S,linkGoogle:S,linkTwitter:S,linkDiscord:S,linkGithub:S,linkSpotify:S,linkInstagram:S,linkTelegram:S,linkTiktok:S,linkLinkedIn:S,linkApple:S,linkPasskey:S,updateEmail:S,updatePhone:S,logout:S,getAccessToken:S,getEthereumProvider:S,getEthersProvider:S,getWeb3jsProvider:S,unlinkEmail:S,unlinkPhone:S,unlinkWallet:S,unlinkGoogle:S,unlinkTwitter:S,unlinkDiscord:S,unlinkGithub:S,unlinkSpotify:S,unlinkInstagram:S,unlinkTiktok:S,unlinkLinkedIn:S,unlinkApple:S,unlinkCrossAppAccount:S,unlinkFarcaster:S,unlinkTelegram:S,unlinkPasskey:S,setActiveWallet:S,forkSession:S,createWallet:S,importWallet:S,signMessage:S,signTypedData:S,enrollInMfa:S,initEnrollmentWithSms:S,initEnrollmentWithTotp:S,initEnrollmentWithPasskey:S,promptMfa:S,init:S,submitEnrollmentWithSms:S,submitEnrollmentWithTotp:S,submitEnrollmentWithPasskey:S,unenroll:S,submit:S,cancel:S,sendTransaction:S,sendSolanaTransaction:S,exportWallet:S,setWalletPassword:S,setWalletRecovery:S,requestFarcasterSignerFromWarpcast:S,getFarcasterSignerPublicKey:S,signFarcasterMessage:S,createGuestAccount:S,signMessageWithCrossAppWallet:S,signTypedDataWithCrossAppWallet:S,sendTransactionWithCrossAppWallet:S,isModalOpen:!1,mfaMethods:[]}),g=()=>n(W);export{h as I,r as P,u as a,i as b,o as c,l as d,d as e,_ as f,s as g,g as h,p as i,E as j,A as k,W as l,c as m,S as n,T as o,m as u};
@@ -1 +1 @@
1
- import{useRef as e,useState as t,useCallback as a}from"react";import{http as n,createPublicClient as r}from"viem";import{Q as i,z as s,a3 as o}from"./useWallets-0pQT6tND.mjs";import{P as l,u as c,h as d}from"./privy-context-BXjG69vB.mjs";import{u as m,g as u,M as p}from"./getEmbeddedConnectedWallet-2FJQV-TA.mjs";import{createSmartAccountClient as y}from"permissionless";import{toLightSmartAccount as h,toBiconomySmartAccount as w,toEcdsaKernelSmartAccount as f,toSafeSmartAccount as g}from"permissionless/accounts";import{createPimlicoClient as E}from"permissionless/clients/pimlico";import{toCoinbaseSmartAccount as P,entryPoint06Address as C,entryPoint07Address as W}from"viem/account-abstraction";let T={address:C,version:"0.6"},v={address:W,version:"0.7"},I=({owner:e,smartWalletType:t,publicClient:a})=>{switch(t){case"safe":return g({client:a,entryPoint:v,owners:[e],version:"1.4.1"});case"kernel":return f({client:a,version:"0.3.1",entryPoint:v,owners:[e]});case"biconomy":return w({client:a,owners:[e],entryPoint:T});case"light_account":return h({client:a,entryPoint:T,owner:e,version:"1.1.0"});case"coinbase_smart_wallet":return async function({client:e,owner:t}){let[a]=await t.request({method:"eth_accounts"});if(!a)throw Error("Unable to request embedded owner for eth_accounts");return await P({client:e,owners:[{type:"local",source:"privy",address:a,sign:async({hash:e})=>await t.request({method:"secp256k1_sign",params:[e]})}]})}({client:a,owner:e});default:throw Error(`Invalid smart account type: ${t}.`)}},_=["rpc.zerodev.app","public.pimlico.io","api.pimlico.io"];const b=async({owner:e,smartWalletType:t,chain:a,publicClient:r,bundlerUrl:i,paymasterUrl:s,paymasterContext:o})=>{let l=await I({owner:e,smartWalletType:t,publicClient:r}),c=E({transport:n(i),entryPoint:l.entryPoint}),d=s?E({transport:n(s),entryPoint:l.entryPoint}):void 0;return y({account:l,chain:a,paymaster:d,paymasterContext:o,bundlerTransport:n(i),userOperation:{estimateFeesPerGas:async()=>{if(_.some((e=>i.includes(e))))return await c.getUserOperationGasPrice().then((e=>e.fast));{let e=await r.estimateFeesPerGas();return{...e,maxFeePerGas:125n*e.maxFeePerGas/100n,maxPriorityFeePerGas:125n*e.maxPriorityFeePerGas/100n}}}}})};const S=({calls:e,chain:t,maxPriorityFeePerGas:a,maxFeePerGas:n,nonce:r})=>e.map((e=>({to:e.to||void 0,data:e.data,value:e.value,chainId:t.id,nonce:r,maxFeePerGas:n,maxPriorityFeePerGas:a}))),x=async({chain:e,paymasterContext:t,embeddedWallet:a,user:s,smartWalletsConfig:o,rpcConfig:c,privyAppId:d})=>{if(!o?.enabled||!s||!a)return;let m=await a.getEthereumProvider(),u=o?.configuredNetworks.find((t=>t.chainId===`eip155:${e.id}`));if(!u)throw new l(`The chain ${e.name} (eip155:${e.id}) must be configured in the smart wallet configuration in your dashboard`);let p=s.smartWallet?.smartWalletType??o.smartWalletType,y=i(e,c,d),h=r({chain:e,transport:n(y)}),w=t??u.paymasterContext,f=await b({owner:m,smartWalletType:p,chain:e,publicClient:h,paymasterContext:w,...u});if(!f)throw new l(`Failed to create smart wallet client for chain ${e.name} (eip155:${e.id})`);return f},D=({clientConfig:n,smartWalletsConfig:r})=>{let{noPromptOnSignature:i,openPrivyModal:y,appId:h}=c(),w=s(),{setModalData:f}=m(),{user:g}=d(),{chains:E}=s(),{chainId:P,clients:C,setChainId:W,chainIdState:T}=(()=>{let a=e(),[n,r]=t();return{clients:e({}),setChainId:e=>{a.current=e,r(e)},chainId:a,chainIdState:n}})(),v=E.find((e=>e.id===T)),{wallets:I}=o(),_=a((async()=>P.current),[P]),b=a((async({id:e})=>{if(!C.current[e]){let t=u(I),a=await x({chain:E.find((t=>t.id===e)),embeddedWallet:t,user:g,paymasterContext:n?.paymasterContext,smartWalletsConfig:r,rpcConfig:w.rpcConfig,privyAppId:h});a&&(C.current[e]=a)}W(e)}),[E,n,I,g,r]);return{wrapSmartAccountClient:e=>{C.current[e.chain.id]=e,T||W(e.chain.id);return{...e,sendTransaction:async e=>{let t=void 0===w.embeddedWallets.showWalletUIs?w.embeddedWallets.noPromptOnSignature:!w.embeddedWallets.showWalletUIs,a=C.current[P.current];if(!a)throw new l(`Smart wallet client for chain (eip155:${P.current}) not found`);if(t)return i.current=!0,await a.sendTransaction(e).finally((()=>i.current=!1));let n=[];"calls"in e&&void 0!==e.calls?n=[...e.calls]:"to"in e&&(n=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let r=async()=>{if(!a.paymaster)return!1;let{paymasterAndData:t,paymasterData:r}=await a.prepareUserOperation({calls:n,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return Number(t??r??0)>0};return new Promise((async(t,s)=>{i.current=!0,f({connectWallet:{onCompleteNavigateTo:p.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN,onFailure:()=>{}},sendTransaction:{transactionRequests:S({calls:n,chain:a.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),rootWallet:{address:a.account.address},transactingWallet:{address:a.account.address,walletIndex:null},getIsSponsored:r,onConfirm:()=>a.sendTransaction(e),onSuccess:e=>t(e.hash),onFailure:s,uiOptions:{}}}),y(p.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{i.current=!1}))},signMessage:async({message:e})=>{let t=void 0===w.embeddedWallets.showWalletUIs?w.embeddedWallets.noPromptOnSignature:!w.embeddedWallets.showWalletUIs,a=C.current[P.current];if(!a)throw new l(`Smart wallet client for chain (eip155:${P.current}) not found`);return t?(i.current=!0,await a.signMessage({message:e}).finally((()=>i.current=!1))):new Promise((async(t,n)=>{i.current=!0,f({connectWallet:{onCompleteNavigateTo:p.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>a.signMessage({message:e}),onSuccess:e=>t(e),onFailure:n,uiOptions:{}}}),y(p.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{i.current=!1}))},signTypedData:async e=>{let t=void 0===w.embeddedWallets.showWalletUIs?w.embeddedWallets.noPromptOnSignature:!w.embeddedWallets.showWalletUIs,a=C.current[P.current];if(!a)throw new l(`Smart wallet client for chain (eip155:${P.current}) not found`);return t?(i.current=!0,await a.signTypedData(e).finally((()=>i.current=!1))):new Promise((async(t,n)=>{i.current=!0,f({connectWallet:{onCompleteNavigateTo:p.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>a.signTypedData(e),onSuccess:e=>t(e),onFailure:n,uiOptions:{}}}),y(p.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{i.current=!1}))},getChainId:_,chain:v,switchChain:b}}}};export{S as c,x as g,D as u};
1
+ import{useRef as e,useState as t,useCallback as a}from"react";import{http as n,createPublicClient as r}from"viem";import{Q as i,z as s,a3 as o}from"./useWallets-C0_t04LR.mjs";import{P as l,u as c,h as d}from"./privy-context-BeqkgOHo.mjs";import{u as m,g as u,M as p}from"./getEmbeddedConnectedWallet-CeIDxPC5.mjs";import{createSmartAccountClient as y}from"permissionless";import{toLightSmartAccount as h,toBiconomySmartAccount as w,toEcdsaKernelSmartAccount as f,toSafeSmartAccount as g}from"permissionless/accounts";import{createPimlicoClient as E}from"permissionless/clients/pimlico";import{toCoinbaseSmartAccount as P,entryPoint06Address as C,entryPoint07Address as W}from"viem/account-abstraction";let T={address:C,version:"0.6"},v={address:W,version:"0.7"},I=({owner:e,smartWalletType:t,publicClient:a})=>{switch(t){case"safe":return g({client:a,entryPoint:v,owners:[e],version:"1.4.1"});case"kernel":return f({client:a,version:"0.3.1",entryPoint:v,owners:[e]});case"biconomy":return w({client:a,owners:[e],entryPoint:T});case"light_account":return h({client:a,entryPoint:T,owner:e,version:"1.1.0"});case"coinbase_smart_wallet":return async function({client:e,owner:t}){let[a]=await t.request({method:"eth_accounts"});if(!a)throw Error("Unable to request embedded owner for eth_accounts");return await P({client:e,owners:[{type:"local",source:"privy",address:a,sign:async({hash:e})=>await t.request({method:"secp256k1_sign",params:[e]})}]})}({client:a,owner:e});default:throw Error(`Invalid smart account type: ${t}.`)}},_=["rpc.zerodev.app","public.pimlico.io","api.pimlico.io"];const b=async({owner:e,smartWalletType:t,chain:a,publicClient:r,bundlerUrl:i,paymasterUrl:s,paymasterContext:o})=>{let l=await I({owner:e,smartWalletType:t,publicClient:r}),c=E({transport:n(i),entryPoint:l.entryPoint}),d=s?E({transport:n(s),entryPoint:l.entryPoint}):void 0;return y({account:l,chain:a,paymaster:d,paymasterContext:o,bundlerTransport:n(i),userOperation:{estimateFeesPerGas:async()=>{if(_.some((e=>i.includes(e))))return await c.getUserOperationGasPrice().then((e=>e.fast));{let e=await r.estimateFeesPerGas();return{...e,maxFeePerGas:125n*e.maxFeePerGas/100n,maxPriorityFeePerGas:125n*e.maxPriorityFeePerGas/100n}}}}})};const S=({calls:e,chain:t,maxPriorityFeePerGas:a,maxFeePerGas:n,nonce:r})=>e.map((e=>({to:e.to||void 0,data:e.data,value:e.value,chainId:t.id,nonce:r,maxFeePerGas:n,maxPriorityFeePerGas:a}))),x=async({chain:e,paymasterContext:t,embeddedWallet:a,user:s,smartWalletsConfig:o,rpcConfig:c,privyAppId:d})=>{if(!o?.enabled||!s||!a)return;let m=await a.getEthereumProvider(),u=o?.configuredNetworks.find((t=>t.chainId===`eip155:${e.id}`));if(!u)throw new l(`The chain ${e.name} (eip155:${e.id}) must be configured in the smart wallet configuration in your dashboard`);let p=s.smartWallet?.smartWalletType??o.smartWalletType,y=i(e,c,d),h=r({chain:e,transport:n(y)}),w=t??u.paymasterContext,f=await b({owner:m,smartWalletType:p,chain:e,publicClient:h,paymasterContext:w,...u});if(!f)throw new l(`Failed to create smart wallet client for chain ${e.name} (eip155:${e.id})`);return f},D=({clientConfig:n,smartWalletsConfig:r})=>{let{noPromptOnSignature:i,openPrivyModal:y,appId:h}=c(),w=s(),{setModalData:f}=m(),{user:g}=d(),{chains:E}=s(),{chainId:P,clients:C,setChainId:W,chainIdState:T}=(()=>{let a=e(),[n,r]=t();return{clients:e({}),setChainId:e=>{a.current=e,r(e)},chainId:a,chainIdState:n}})(),v=E.find((e=>e.id===T)),{wallets:I}=o(),_=a((async()=>P.current),[P]),b=a((async({id:e})=>{if(!C.current[e]){let t=u(I),a=await x({chain:E.find((t=>t.id===e)),embeddedWallet:t,user:g,paymasterContext:n?.paymasterContext,smartWalletsConfig:r,rpcConfig:w.rpcConfig,privyAppId:h});a&&(C.current[e]=a)}W(e)}),[E,n,I,g,r]);return{wrapSmartAccountClient:e=>{C.current[e.chain.id]=e,T||W(e.chain.id);return{...e,sendTransaction:async e=>{let t=void 0===w.embeddedWallets.showWalletUIs?w.embeddedWallets.noPromptOnSignature:!w.embeddedWallets.showWalletUIs,a=C.current[P.current];if(!a)throw new l(`Smart wallet client for chain (eip155:${P.current}) not found`);if(t)return i.current=!0,await a.sendTransaction(e).finally((()=>i.current=!1));let n=[];"calls"in e&&void 0!==e.calls?n=[...e.calls]:"to"in e&&(n=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let r=async()=>{if(!a.paymaster)return!1;let{paymasterAndData:t,paymasterData:r}=await a.prepareUserOperation({calls:n,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return Number(t??r??0)>0};return new Promise((async(t,s)=>{i.current=!0,f({connectWallet:{onCompleteNavigateTo:p.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN,onFailure:()=>{}},sendTransaction:{transactionRequests:S({calls:n,chain:a.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),rootWallet:{address:a.account.address},transactingWallet:{address:a.account.address,walletIndex:null},getIsSponsored:r,onConfirm:()=>a.sendTransaction(e),onSuccess:e=>t(e.hash),onFailure:s,uiOptions:{}}}),y(p.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{i.current=!1}))},signMessage:async({message:e})=>{let t=void 0===w.embeddedWallets.showWalletUIs?w.embeddedWallets.noPromptOnSignature:!w.embeddedWallets.showWalletUIs,a=C.current[P.current];if(!a)throw new l(`Smart wallet client for chain (eip155:${P.current}) not found`);return t?(i.current=!0,await a.signMessage({message:e}).finally((()=>i.current=!1))):new Promise((async(t,n)=>{i.current=!0,f({connectWallet:{onCompleteNavigateTo:p.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>a.signMessage({message:e}),onSuccess:e=>t(e),onFailure:n,uiOptions:{}}}),y(p.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{i.current=!1}))},signTypedData:async e=>{let t=void 0===w.embeddedWallets.showWalletUIs?w.embeddedWallets.noPromptOnSignature:!w.embeddedWallets.showWalletUIs,a=C.current[P.current];if(!a)throw new l(`Smart wallet client for chain (eip155:${P.current}) not found`);return t?(i.current=!0,await a.signTypedData(e).finally((()=>i.current=!1))):new Promise((async(t,n)=>{i.current=!0,f({connectWallet:{onCompleteNavigateTo:p.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>a.signTypedData(e),onSuccess:e=>t(e),onFailure:n,uiOptions:{}}}),y(p.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{i.current=!1}))},getChainId:_,chain:v,switchChain:b}}}};export{S as c,x as g,D as u};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useContext as t,useState as i,useEffect as r,createContext as n}from"react";import{z as a,a3 as o}from"./useWallets-0pQT6tND.mjs";import{u as l,h as c,P as s}from"./privy-context-BXjG69vB.mjs";import{g as d}from"./getEmbeddedConnectedWallet-2FJQV-TA.mjs";import{g as m,u as f}from"./smart-wallets-C0eP6Grh.mjs";import"@ethersproject/providers";import"tinycolor2";import"ofetch";import"viem";import"permissionless";import"permissionless/accounts";import"permissionless/clients/pimlico";import"viem/account-abstraction";let g=n({client:void 0});const p=({config:t,children:i})=>e(w,{children:e(y,{config:t,children:e(C,{children:i})})}),u=()=>{let{client:e}=t(g);return{client:e}};let h=n({config:void 0}),v=()=>{let{config:e}=t(h);return{config:e}},w=({children:t})=>{let[n,a]=i(void 0),{client:o}=l();return r((()=>{!n&&o&&(async()=>{try{if(!o)return void console.warn("No client found");let e=await o.getSmartWalletsConfig();a(e)}catch(e){console.warn("Error generating smart wallet config: ",e)}})()}),[!!o]),e(h.Provider,{value:{config:n},children:t})},y=({config:t,children:n})=>{let{config:f}=v(),{appId:g}=l(),{chains:p,defaultChain:u,rpcConfig:h}=a(),{wallets:w}=o(),{user:y}=c(),[C,b]=i(),P=d(w);return r((()=>{(async()=>{if(!f?.enabled)return;let e=f.configuredNetworks.find((e=>e.chainId===`eip155:${u.id}`))?u:p.find((e=>f.configuredNetworks.map((e=>e.chainId)).includes(`eip155:${e.id}`)));if(!e)throw new s("Could not find smart wallets chain configurations for any Privy client configured chains. Please configure smart wallets for your chains in the Privy dashboard.");b(await m({chain:e,privyAppId:g,paymasterContext:t?.paymasterContext,rpcConfig:h,embeddedWallet:P,user:y,smartWalletsConfig:f}))})()}),[!!f?.enabled,!!y?.smartWallet,!!P]),e(W.Provider,{value:{client:C,config:t},children:n})},W=n({client:void 0,config:void 0}),C=({children:i})=>{let{client:n,config:a}=(()=>{let{client:e,config:i}=t(W);return{client:e,config:i}})(),{config:o}=v(),{wrapSmartAccountClient:s}=f({clientConfig:a,smartWalletsConfig:o}),{user:d}=c(),{generateSiweMessageForSmartWallet:m,linkSmartWallet:p,noPromptOnSignature:u}=l();return r((()=>{(async()=>{if(n&&!d?.smartWallet&&o?.enabled)try{let e=await m({address:n.account.address,chainId:`eip155:${n.chain.id}`});u.current=!0;let t=await n.signMessage({message:e});await p({signature:t,message:e,smartWalletType:o.smartWalletType})}catch(e){console.error("Error creating smart wallet:",e)}finally{u.current=!1}})()}),[!!n,!!d?.smartWallet,!!o?.enabled]),e(g.Provider,{value:{client:d?.smartWallet&&n?s(n):void 0},children:i})};export{p as SmartWalletsProvider,u as useSmartWallets};
1
+ import{jsx as e}from"react/jsx-runtime";import{useContext as t,useState as i,useEffect as r,createContext as n}from"react";import{z as a,a3 as o}from"./useWallets-C0_t04LR.mjs";import{u as l,h as c,P as s}from"./privy-context-BeqkgOHo.mjs";import{g as d}from"./getEmbeddedConnectedWallet-CeIDxPC5.mjs";import{g as m,u as f}from"./smart-wallets-vjWIsaaC.mjs";import"@ethersproject/providers";import"tinycolor2";import"ofetch";import"viem";import"permissionless";import"permissionless/accounts";import"permissionless/clients/pimlico";import"viem/account-abstraction";let g=n({client:void 0});const p=({config:t,children:i})=>e(w,{children:e(y,{config:t,children:e(C,{children:i})})}),u=()=>{let{client:e}=t(g);return{client:e}};let h=n({config:void 0}),v=()=>{let{config:e}=t(h);return{config:e}},w=({children:t})=>{let[n,a]=i(void 0),{client:o}=l();return r((()=>{!n&&o&&(async()=>{try{if(!o)return void console.warn("No client found");let e=await o.getSmartWalletsConfig();a(e)}catch(e){console.warn("Error generating smart wallet config: ",e)}})()}),[!!o]),e(h.Provider,{value:{config:n},children:t})},y=({config:t,children:n})=>{let{config:f}=v(),{appId:g}=l(),{chains:p,defaultChain:u,rpcConfig:h}=a(),{wallets:w}=o(),{user:y}=c(),[C,b]=i(),P=d(w);return r((()=>{(async()=>{if(!f?.enabled)return;let e=f.configuredNetworks.find((e=>e.chainId===`eip155:${u.id}`))?u:p.find((e=>f.configuredNetworks.map((e=>e.chainId)).includes(`eip155:${e.id}`)));if(!e)throw new s("Could not find smart wallets chain configurations for any Privy client configured chains. Please configure smart wallets for your chains in the Privy dashboard.");b(await m({chain:e,privyAppId:g,paymasterContext:t?.paymasterContext,rpcConfig:h,embeddedWallet:P,user:y,smartWalletsConfig:f}))})()}),[!!f?.enabled,!!y?.smartWallet,!!P]),e(W.Provider,{value:{client:C,config:t},children:n})},W=n({client:void 0,config:void 0}),C=({children:i})=>{let{client:n,config:a}=(()=>{let{client:e,config:i}=t(W);return{client:e,config:i}})(),{config:o}=v(),{wrapSmartAccountClient:s}=f({clientConfig:a,smartWalletsConfig:o}),{user:d}=c(),{generateSiweMessageForSmartWallet:m,linkSmartWallet:p,noPromptOnSignature:u}=l();return r((()=>{(async()=>{if(n&&d&&!d?.smartWallet&&o?.enabled)try{let e=await m({address:n.account.address,chainId:`eip155:${n.chain.id}`});u.current=!0;let t=await n.signMessage({message:e});await p({signature:t,message:e,smartWalletType:o.smartWalletType})}catch(e){console.error("Error creating smart wallet:",e)}finally{u.current=!1}})()}),[!!n,!!d?.smartWallet,!!o?.enabled]),e(g.Provider,{value:{client:d?.smartWallet&&n?s(n):void 0},children:i})};export{p as SmartWalletsProvider,u as useSmartWallets};
@@ -1 +1 @@
1
- import{isWalletAdapterCompatibleStandardWallet as t}from"@solana/wallet-adapter-base";import{StandardWalletAdapter as e}from"@solana/wallet-standard-wallet-adapter-base";import{getWallets as a}from"@wallet-standard/app";import{S as o}from"./useSolanaWallets-Cn7Eb8fU.mjs";export{u as useSolanaWallets}from"./useSolanaWallets-Cn7Eb8fU.mjs";import{u as r}from"./events-context-D3j6WwDa.mjs";import{u as l}from"./privy-context-BXjG69vB.mjs";import"eventemitter3";import"@ethersproject/logger";import"@ethersproject/address";import"react";import"ofetch";const n=t=>{let e,{get:r,on:l}=a(),n=t?.shouldAutoConnect??!0,p=s(r()),m=p.map((t=>new o(t,n))),i=[];return{_setOnConnectorsUpdated:t=>{e=t},onMount:()=>{i.push(l("register",((...t)=>{m=(p=p.concat(...s(t))).map((t=>new o(t,n))),e?.(m)})),l("unregister",((...t)=>{m=(p=p.filter((e=>t.some((t=>e.wallet===t))))).map((t=>new o(t,n))),e?.(m)})))},onUnmount:()=>{let t=i.pop();for(;t;)t(),t=i.pop()},get:()=>m}};let s=a=>a.filter(t).map((t=>new e({wallet:t})));const p=t=>{r("fundSolanaWallet",t);let{fundSolanaWallet:e}=l();return{fundWallet:e}};export{o as SolanaAdapterConnector,n as toSolanaWalletConnectors,p as useFundWallet};
1
+ import{isWalletAdapterCompatibleStandardWallet as t}from"@solana/wallet-adapter-base";import{StandardWalletAdapter as e}from"@solana/wallet-standard-wallet-adapter-base";import{getWallets as a}from"@wallet-standard/app";import{S as o}from"./useSolanaWallets-DiqA_tT8.mjs";export{u as useSolanaWallets}from"./useSolanaWallets-DiqA_tT8.mjs";import{u as r}from"./events-context-D3j6WwDa.mjs";import{u as l}from"./privy-context-BeqkgOHo.mjs";import"eventemitter3";import"@ethersproject/logger";import"@ethersproject/address";import"react";import"ofetch";const n=t=>{let e,{get:r,on:l}=a(),n=t?.shouldAutoConnect??!0,p=s(r()),m=p.map((t=>new o(t,n))),i=[];return{_setOnConnectorsUpdated:t=>{e=t},onMount:()=>{i.push(l("register",((...t)=>{m=(p=p.concat(...s(t))).map((t=>new o(t,n))),e?.(m)})),l("unregister",((...t)=>{m=(p=p.filter((e=>t.some((t=>e.wallet===t))))).map((t=>new o(t,n))),e?.(m)})))},onUnmount:()=>{let t=i.pop();for(;t;)t(),t=i.pop()},get:()=>m}};let s=a=>a.filter(t).map((t=>new e({wallet:t})));const p=t=>{r("fundSolanaWallet",t);let{fundSolanaWallet:e}=l();return{fundWallet:e}};export{o as SolanaAdapterConnector,n as toSolanaWalletConnectors,p as useFundWallet};
package/dist/esm/ui.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import{h as i,u as n}from"./privy-context-BXjG69vB.mjs";import{f as l,u as o,x as a,o as s,W as d,k as c,d as h,q as p,b as C,v as u,w as g,B as f}from"./useFundWallet-DfRcsTFv.mjs";import{E as w,a3 as m,z as v}from"./useWallets-0pQT6tND.mjs";import{styled as x,css as y}from"styled-components";import k from"@heroicons/react/24/outline/CheckIcon";import*as _ from"react";import{useState as b,useContext as M,createContext as L,useRef as z}from"react";import{useMergeRefs as H,useTransitionStyles as V,FloatingPortal as F,FloatingFocusManager as Z,useFloating as B,autoUpdate as U,offset as S,flip as A,shift as O,useInteractions as j,useClick as R,useDismiss as P,useRole as G}from"@floating-ui/react";import{g as T}from"./events-context-D3j6WwDa.mjs";import"ofetch";import"@heroicons/react/24/outline/Square2StackIcon";import"@ethersproject/bignumber";import"@ethersproject/units";import"viem";import"@ethersproject/providers";import"tinycolor2";import"@ethersproject/address";const W=t=>e("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:e("path",{d:"M9.99999 10.8333C12.3012 10.8333 14.1667 8.96785 14.1667 6.66667C14.1667 4.36548 12.3012 2.5 9.99999 2.5C7.69881 2.5 5.83333 4.36548 5.83333 6.66667C5.83333 8.96785 7.69881 10.8333 9.99999 10.8333ZM9.99999 10.8333C11.7681 10.8333 13.4638 11.5357 14.714 12.786C15.9643 14.0362 16.6667 15.7319 16.6667 17.5M9.99999 10.8333C8.23188 10.8333 6.53619 11.5357 5.28595 12.786C4.03571 14.0362 3.33333 15.7319 3.33333 17.5",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})}),$=x.button`
1
+ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import{h as i,u as n}from"./privy-context-BeqkgOHo.mjs";import{f as l,u as o,x as a,o as s,W as d,k as c,d as h,q as p,b as C,v as u,w as g,B as f}from"./useFundWallet-BLErEIDU.mjs";import{E as w,a3 as m,z as v}from"./useWallets-C0_t04LR.mjs";import{styled as x,css as y}from"styled-components";import k from"@heroicons/react/24/outline/CheckIcon";import*as _ from"react";import{useState as b,useContext as M,createContext as L,useRef as z}from"react";import{useMergeRefs as H,useTransitionStyles as V,FloatingPortal as F,FloatingFocusManager as Z,useFloating as B,autoUpdate as U,offset as S,flip as A,shift as O,useInteractions as j,useClick as R,useDismiss as P,useRole as G}from"@floating-ui/react";import{g as T}from"./events-context-D3j6WwDa.mjs";import"ofetch";import"@heroicons/react/24/outline/Square2StackIcon";import"@ethersproject/bignumber";import"@ethersproject/units";import"viem";import"@ethersproject/providers";import"tinycolor2";import"@ethersproject/address";const W=t=>e("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:e("path",{d:"M9.99999 10.8333C12.3012 10.8333 14.1667 8.96785 14.1667 6.66667C14.1667 4.36548 12.3012 2.5 9.99999 2.5C7.69881 2.5 5.83333 4.36548 5.83333 6.66667C5.83333 8.96785 7.69881 10.8333 9.99999 10.8333ZM9.99999 10.8333C11.7681 10.8333 13.4638 11.5357 14.714 12.786C15.9643 14.0362 16.6667 15.7319 16.6667 17.5M9.99999 10.8333C8.23188 10.8333 6.53619 11.5357 5.28595 12.786C4.03571 14.0362 3.33333 15.7319 3.33333 17.5",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})}),$=x.button`
2
2
  --size: ${({$size:e})=>`${e}px`};
3
3
 
4
4
  -webkit-font-smoothing: antialiased;
@@ -1,4 +1,4 @@
1
- import{useState as r,useEffect as e,createContext as o,useContext as t,useMemo as a,useCallback as c}from"react";import{jsx as i,jsxs as l,Fragment as n}from"react/jsx-runtime";import{styled as s,keyframes as d,css as h}from"styled-components";import{E as v,z as p,ao as u,Q as m}from"./useWallets-0pQT6tND.mjs";import{u as g}from"./events-context-D3j6WwDa.mjs";import{l as y,u as f,h as b}from"./privy-context-BXjG69vB.mjs";import w from"@heroicons/react/24/outline/Square2StackIcon";import{BigNumber as x}from"@ethersproject/bignumber";import{formatEther as $}from"@ethersproject/units";import{createPublicClient as V,http as Z}from"viem";let M=r=>x.from(r);function P(r){if("number"==typeof r||"bigint"==typeof r||"string"==typeof r)return r;if("function"==typeof r.toHexString)return r.toHexString();throw Error(`Expected numeric value but received ${r}`)}function k(r){let e={};return void 0!==r.to&&(e.to=r.to),void 0!==r.data&&(e.data=r.data),void 0!==r.chainId&&(e.chainId=r.chainId),void 0!==r.type&&(e.type=r.type),void 0!==r.accessList&&(e.accessList=r.accessList),void 0!==r.nonce&&(e.nonce=M(r.nonce).toNumber()),void 0!==r.gasLimit&&(e.gasLimit=M(r.gasLimit)),void 0!==r.gasPrice&&(e.gasPrice=M(r.gasPrice)),void 0!==r.value&&(e.value=M(r.value)),void 0!==r.maxFeePerGas&&(e.maxFeePerGas=M(r.maxFeePerGas)),void 0!==r.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=M(r.maxPriorityFeePerGas)),e}class L{get(r){let e=localStorage.getItem(r);return null===e?void 0:JSON.parse(e)}put(r,e){void 0!==e?localStorage.setItem(r,JSON.stringify(e)):this.del(r)}del(r){localStorage.removeItem(r)}getKeys(){return Object.entries(localStorage).map((([r])=>r))}}function T(){try{let r="privy:__session_storage__test",e=new L;return e.put(r,"blobby"),e.del(r),!0}catch(r){return!1}}var C="undefined"!=typeof window&&window.localStorage?new L:new class{get(r){return this._cache[r]}put(r,e){void 0!==e?this._cache[r]=e:this.del(r)}del(r){delete this._cache[r]}getKeys(){return Object.keys(this._cache)}constructor(){this._cache={}}};const S=o=>{let[t,a]=r("auto");return e((()=>{let r=new ResizeObserver((r=>{a(r[0]?.contentRect.height??"auto")}));return o.current&&r.observe(o.current),()=>{o.current&&r.unobserve(o.current)}}),[o.current]),t},_=({success:r,fail:e})=>l(n,{children:[i(I,{className:r?"success":e?"fail":""}),i(N,{className:r?"success":e?"fail":""})]}),I=s.span`
1
+ import{useState as r,useEffect as e,createContext as o,useContext as t,useMemo as a,useCallback as c}from"react";import{jsx as i,jsxs as l,Fragment as n}from"react/jsx-runtime";import{styled as s,keyframes as d,css as h}from"styled-components";import{E as v,z as p,ao as u,Q as m}from"./useWallets-C0_t04LR.mjs";import{u as g}from"./events-context-D3j6WwDa.mjs";import{l as y,u as f}from"./privy-context-BeqkgOHo.mjs";import b from"@heroicons/react/24/outline/Square2StackIcon";import{BigNumber as w}from"@ethersproject/bignumber";import{formatEther as x}from"@ethersproject/units";import{createPublicClient as $,http as V}from"viem";let Z=r=>w.from(r);function M(r){if("number"==typeof r||"bigint"==typeof r||"string"==typeof r)return r;if("function"==typeof r.toHexString)return r.toHexString();throw Error(`Expected numeric value but received ${r}`)}function P(r){let e={};return void 0!==r.to&&(e.to=r.to),void 0!==r.data&&(e.data=r.data),void 0!==r.chainId&&(e.chainId=r.chainId),void 0!==r.type&&(e.type=r.type),void 0!==r.accessList&&(e.accessList=r.accessList),void 0!==r.nonce&&(e.nonce=Z(r.nonce).toNumber()),void 0!==r.gasLimit&&(e.gasLimit=Z(r.gasLimit)),void 0!==r.gasPrice&&(e.gasPrice=Z(r.gasPrice)),void 0!==r.value&&(e.value=Z(r.value)),void 0!==r.maxFeePerGas&&(e.maxFeePerGas=Z(r.maxFeePerGas)),void 0!==r.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=Z(r.maxPriorityFeePerGas)),e}class k{get(r){let e=localStorage.getItem(r);return null===e?void 0:JSON.parse(e)}put(r,e){void 0!==e?localStorage.setItem(r,JSON.stringify(e)):this.del(r)}del(r){localStorage.removeItem(r)}getKeys(){return Object.entries(localStorage).map((([r])=>r))}}function L(){try{let r="privy:__session_storage__test",e=new k;return e.put(r,"blobby"),e.del(r),!0}catch(r){return!1}}var T="undefined"!=typeof window&&window.localStorage?new k:new class{get(r){return this._cache[r]}put(r,e){void 0!==e?this._cache[r]=e:this.del(r)}del(r){delete this._cache[r]}getKeys(){return Object.keys(this._cache)}constructor(){this._cache={}}};const C=o=>{let[t,a]=r("auto");return e((()=>{let r=new ResizeObserver((r=>{a(r[0]?.contentRect.height??"auto")}));return o.current&&r.observe(o.current),()=>{o.current&&r.unobserve(o.current)}}),[o.current]),t},S=({success:r,fail:e})=>l(n,{children:[i(_,{className:r?"success":e?"fail":""}),i(I,{className:r?"success":e?"fail":""})]}),_=s.span`
2
2
  && {
3
3
  width: 82px;
4
4
  height: 82px;
@@ -31,13 +31,13 @@ import{useState as r,useEffect as e,createContext as o,useContext as t,useMemo a
31
31
  border-color: var(--privy-color-error);
32
32
  border-bottom-color: var(--privy-color-error);
33
33
  }
34
- `,N=s(I)`
34
+ `,I=s(_)`
35
35
  && {
36
36
  border-bottom-color: ${r=>r.color??"var(--privy-color-accent)"};
37
37
  animation: none;
38
38
  opacity: 0.5;
39
39
  }
40
- `,H=r=>i(F,{color:r.color||"var(--privy-color-foreground-3)"});let F=s(I)`
40
+ `,N=r=>i(H,{color:r.color||"var(--privy-color-foreground-3)"});let H=s(_)`
41
41
  && {
42
42
  height: 1rem;
43
43
  width: 1rem;
@@ -47,7 +47,7 @@ import{useState as r,useEffect as e,createContext as o,useContext as t,useMemo a
47
47
  /* Override default Loader to match button transitions */
48
48
  transition: border-color 200ms ease;
49
49
  }
50
- `;function j(r){return i("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 460 40",...r,children:i("g",{fill:r.color||"var(--privy-color-foreground)",children:i("path",{d:"M0 15.4v15.38h4.64V19.96h3.58c2.47 0 3.63-.01 3.77-.02 1-.08 1.49-.15 2.18-.3a9.45 9.45 0 0 0 4.6-2.37c1.66-1.57 2.64-3.87 2.81-6.56.02-.3.02-1.19 0-1.49-.1-1.77-.56-3.35-1.36-4.72A8.84 8.84 0 0 0 15.14.57c-.93-.3-1.75-.43-3.09-.54C11.9.02 10.2 0 5.93 0H0ZM10.85 4c1.85.05 3.1.45 4.16 1.3.22.17.54.49.69.68a5.97 5.97 0 0 1 1.19 3.13c.04.35.04 1.36 0 1.71-.08.68-.23 1.3-.44 1.85a4.8 4.8 0 0 1-1.09 1.68A5.63 5.63 0 0 1 12 15.92c-.6.08-.4.08-4.01.09H4.64V3.98h2.9c1.6 0 3.08 0 3.31.02ZM187.65 5.71v5.72h-.27l-.09-.14a15.9 15.9 0 0 0-1.21-1.73c-.43-.5-1-.95-1.7-1.36-.54-.3-1.05-.5-1.73-.63a8.98 8.98 0 0 0-1.7-.17 8.84 8.84 0 0 0-7.8 4.03 12.95 12.95 0 0 0-2.03 6.39c-.07.98-.06 2.15.02 3.13.2 2.47.87 4.53 2.02 6.25a8.98 8.98 0 0 0 10.22 3.65 6.5 6.5 0 0 0 2.8-1.93c.41-.51.84-1.1 1.1-1.55l.1-.17h.37v3.58h4.38V0h-4.48Zm-5.24 5.54c1.3.14 2.3.6 3.17 1.48.9.9 1.5 2.09 1.85 3.64.36 1.6.39 3.72.06 5.43a8.13 8.13 0 0 1-1.54 3.62 5.1 5.1 0 0 1-3.93 1.96 6.13 6.13 0 0 1-2.32-.31 5.87 5.87 0 0 1-3.33-3.5c-.39-1-.62-2.05-.72-3.32-.03-.32-.04-1.35-.02-1.73.08-1.56.4-2.91.96-4.05a6.2 6.2 0 0 1 1.06-1.58 5.08 5.08 0 0 1 3.6-1.66c.25-.02.9 0 1.16.02ZM210.07 15.39l.01 15.38h4.38l.01-3.57h.37l.09.15c.24.44.84 1.26 1.21 1.7a6.79 6.79 0 0 0 2.57 1.75 9.3 9.3 0 0 0 6.86-.49 9.28 9.28 0 0 0 4.05-4.07A13.05 13.05 0 0 0 231 21.6c.21-1.73.18-3.7-.09-5.32a13.03 13.03 0 0 0-1.5-4.3 9.1 9.1 0 0 0-3.75-3.63 9.15 9.15 0 0 0-4.43-.96 7.46 7.46 0 0 0-2.8.5A7.07 7.07 0 0 0 216 9.7c-.4.52-.82 1.12-1.1 1.59l-.07.14h-.27V0h-4.5Zm11.13-4.14c1.07.1 1.94.44 2.7 1.04a6.1 6.1 0 0 1 1.64 1.98c.43.84.78 2 .94 3.11.15 1.16.16 2.4.02 3.54a9.34 9.34 0 0 1-1.39 4.03 5.33 5.33 0 0 1-2.69 2.15c-.9.3-2.04.38-3.06.2a5.14 5.14 0 0 1-3.45-2.37 6.03 6.03 0 0 1-.45-.8c-.5-1.03-.8-2.2-.92-3.58-.04-.49-.06-.89-.05-1.53.01-.76.05-1.23.13-1.85.38-2.53 1.47-4.38 3.15-5.31a5.46 5.46 0 0 1 2.3-.63 10 10 0 0 1 1.13.02ZM69.05 2.17l-.01 2.77V7.7h-3.36v3.6h3.36v6.8l.01 7.15c.06 1.4.4 2.44 1.1 3.37a5.8 5.8 0 0 0 2.97 2.07c.91.3 1.83.42 2.9.38a8.71 8.71 0 0 0 2.66-.48l-.8-3.7-.38.06a4.96 4.96 0 0 1-2.43-.06c-.33-.1-.56-.25-.8-.49-.4-.41-.6-.88-.7-1.67-.02-.2-.02-.62-.03-6.82v-6.6h4.73V7.7h-4.73V2.16h-4.49ZM133.34 2.17V7.7h-3.39v3.6h3.38v6.9l.01 7.17a5.66 5.66 0 0 0 2.36 4.49c.85.6 2.03 1.03 3.26 1.17.85.1 2.03.05 2.81-.1.3-.06.75-.18 1-.26l.2-.06v-.05l-.81-3.67-.37.06a4.99 4.99 0 0 1-1.8.09c-.85-.13-1.32-.4-1.7-.97a2.63 2.63 0 0 1-.39-1.04c-.06-.4-.06 0-.06-7.1V11.3h4.7V7.7h-4.7l-.01-2.77V2.16h-4.49ZM293.41 2.36a14.56 14.56 0 0 0-13.7 16.07 14.59 14.59 0 0 0 21.86 11.08 14.5 14.5 0 0 0 7.11-14.07 14.61 14.61 0 0 0-6.53-10.73 14.49 14.49 0 0 0-8.74-2.35ZM350.8 2.36a10.17 10.17 0 0 0-7.56 4.2c-.16.2-.45.63-.58.83l-.05.1h-.47l-.01-4.36h-7.36v36.4h7.82V27.27h.49l.05.07a11.3 11.3 0 0 0 7.49 4.15 10.52 10.52 0 0 0 9.38-4.1c1.66-2.1 2.73-4.9 3.07-8.06.1-.87.13-1.4.13-2.37 0-.8 0-1.1-.07-1.76a15.95 15.95 0 0 0-3.23-8.72 12.8 12.8 0 0 0-1.85-1.84 10.49 10.49 0 0 0-7.26-2.28Zm-.94 6.05c1.27.15 2.33.65 3.2 1.5.98.96 1.67 2.31 2.03 4 .34 1.57.38 3.68.12 5.39a9.78 9.78 0 0 1-1.04 3.25c-.14.25-.44.69-.6.89a5.35 5.35 0 0 1-4.31 2.07 5.25 5.25 0 0 1-4.41-1.9 7.35 7.35 0 0 1-1.26-2.32 14.09 14.09 0 0 1-.62-4.83c.05-1.98.38-3.53 1.02-4.85a5.63 5.63 0 0 1 2.5-2.65c.66-.34 1.3-.5 2.14-.58.18-.02 1.04 0 1.23.03ZM363.63 3.1l-.01 3.2v3.16h1.43c1.26.01 1.44.02 1.54.04.42.09.66.28.79.62.08.23.08.08.08 2.96a911.57 911.57 0 0 1 .03 10.18v7.54h7.82v-7.4l.01-7.83c.03-.94.11-1.63.27-2.28.46-1.9 1.54-2.93 3.35-3.23.52-.08.2-.08 5-.08h4.4V3.08h-3.1c-3.48 0-3.91.01-4.67.1-1.83.2-3.04.79-3.96 1.88-.5.6-.9 1.32-1.26 2.26l-.06.17h-.46V3.09h-5.6c-4.46 0-5.6 0-5.6.02ZM390.8 16.95V30.8h3.87l3.86-.01V3.09h-7.73ZM400.6 3.1l-.01.4v.38l4.66 13.4 4.69 13.47.02.05h10.3l.03-.05 4.67-13.45 4.67-13.4V3.1h-7.43l-6.7 19.26h-.5l-3.28-9.5-3.31-9.64-.05-.12h-3.88l-3.88.01ZM430.98 3.1c-.01 0-.02.19-.02.4v.39l5.08 14.59c2.8 8.02 5.08 14.6 5.08 14.61.01.02-.22.02-4.8.02h-4.82v6.42h4.95c5.09 0 5.23 0 5.87-.06 3.15-.28 5.29-1.63 6.63-4.15.28-.55.44-.95.87-2.16L459 6.78l1-2.89v-.8h-7.43l-6.69 19.26h-.5l-3.27-9.46-3.31-9.64-.06-.16h-3.88l-3.88.01ZM36.57 7.36c-1.36.1-2.6.6-3.62 1.45a5.65 5.65 0 0 0-1.67 2.42l-.05.13H31V7.7h-4.35v23.08h4.5v-7.3c0-8 0-7.34.08-7.82a4.89 4.89 0 0 1 2.06-3.18c.83-.58 1.74-.89 2.87-.98a11.87 11.87 0 0 1 2.8.25H39v-4.3l-.21-.02c-.61-.07-1.74-.1-2.22-.07ZM51.08 7.41c-2.33.12-4.3.84-5.95 2.16a9.89 9.89 0 0 0-2.03 2.2 12.5 12.5 0 0 0-2 5.78 18.04 18.04 0 0 0 0 3.65 12.13 12.13 0 0 0 2.26 6.05 9.74 9.74 0 0 0 5 3.52c2.11.64 4.7.64 6.8 0a9.78 9.78 0 0 0 4.88-3.37c1.38-1.78 2.19-4 2.4-6.58.13-1.46.06-3.06-.18-4.42a11.24 11.24 0 0 0-3.58-6.6 10 10 0 0 0-5.75-2.35c-.56-.06-1.31-.07-1.85-.04Zm1.42 3.78c.88.1 1.62.34 2.28.75a6.13 6.13 0 0 1 1.99 2.15 10.31 10.31 0 0 1 1.2 5c.02 1.23-.12 2.44-.42 3.51a7.14 7.14 0 0 1-1.81 3.32c-.61.6-1.2.98-1.95 1.24a6 6 0 0 1-2 .3 5.7 5.7 0 0 1-2.72-.6 5 5 0 0 1-1.28-.94A7.1 7.1 0 0 1 46 22.73c-.57-1.99-.6-4.46-.08-6.5a7.24 7.24 0 0 1 2.03-3.67 5.13 5.13 0 0 1 3.35-1.4 11 11 0 0 1 1.2.03ZM92.05 7.4c-.96.06-1.56.15-2.3.33a9.62 9.62 0 0 0-6.09 4.66 13.5 13.5 0 0 0-1.71 7c0 .83 0 1.04.06 1.6.16 1.77.58 3.32 1.29 4.7A9.72 9.72 0 0 0 90.28 31c1.84.37 4.08.32 5.85-.13a9.07 9.07 0 0 0 5.02-3.1A7.64 7.64 0 0 0 102.5 25l-2.11-.39-2.11-.38-.08.13a4.72 4.72 0 0 1-2.35 2.55 6.3 6.3 0 0 1-2.23.58c-.29.03-1.13.03-1.44 0a6.35 6.35 0 0 1-3.02-1.04 5.93 5.93 0 0 1-2.02-2.43 8.44 8.44 0 0 1-.72-3.18v-.26h16.38v-.81c0-1.83-.06-2.76-.25-3.87-.2-1.22-.53-2.24-1.05-3.28a8.9 8.9 0 0 0-2.66-3.26 10.1 10.1 0 0 0-5.34-1.94 18.3 18.3 0 0 0-1.46-.03Zm1.3 3.75c1.2.13 2.19.55 3.05 1.3a5.8 5.8 0 0 1 1.78 2.96c.13.51.21 1.17.21 1.66v.15H86.43v-.12c.08-.97.3-1.78.72-2.61.5-1 1.2-1.8 2.14-2.42a5.32 5.32 0 0 1 2.9-.95c.2-.01.97 0 1.17.03ZM116.79 7.41c-2 .1-3.73.65-5.22 1.65a10.7 10.7 0 0 0-4.25 6.06 16.1 16.1 0 0 0-.5 5.8c.2 2.17.84 4.13 1.88 5.76.58.9 1.32 1.73 2.15 2.4a9.37 9.37 0 0 0 3.6 1.8 12.06 12.06 0 0 0 3.92.34 10.2 10.2 0 0 0 3.84-.95 8.31 8.31 0 0 0 4.76-6.75l.01-.04h-4.37l-.05.16a4.87 4.87 0 0 1-4.24 3.75c-.59.07-1.32.06-1.93-.05a5.47 5.47 0 0 1-3.5-2.27c-.56-.75-1-1.73-1.26-2.79a13.8 13.8 0 0 1-.16-5.24 7.77 7.77 0 0 1 2.1-4.3 5.48 5.48 0 0 1 2.15-1.3 6.4 6.4 0 0 1 3.89.1c.59.21 1.03.5 1.5.96a5.32 5.32 0 0 1 1.46 2.5l.04.15h4.37v-.06a8.22 8.22 0 0 0-5.31-6.94 10.98 10.98 0 0 0-4.88-.74ZM156.2 7.41a9.87 9.87 0 0 0-6 2.29 11.02 11.02 0 0 0-3.41 5.43c-.52 1.78-.68 3.9-.48 5.97.17 1.8.63 3.38 1.37 4.8a9.68 9.68 0 0 0 5.91 4.86c1.65.48 3.63.61 5.53.36 3.72-.49 6.55-2.62 7.56-5.69.12-.39.13-.42.1-.43-.02 0-4.13-.75-4.19-.75-.03 0-.04 0-.1.16-.18.42-.45.9-.72 1.22-.16.2-.49.53-.7.7-.67.54-1.5.9-2.43 1.08-.48.08-.83.11-1.41.11-.64 0-1.07-.04-1.6-.15a5.76 5.76 0 0 1-3.93-2.83 8 8 0 0 1-.99-3.79v-.16h16.38v-1.11l-.02-1.43c-.1-2.25-.53-4-1.35-5.59a9.24 9.24 0 0 0-6.18-4.75c-1.04-.26-2.2-.36-3.33-.3Zm1.45 3.74a5.35 5.35 0 0 1 3.66 1.94 6.1 6.1 0 0 1 1.38 4.01v.12h-11.97v-.06c0-.02 0-.14.02-.25a6.6 6.6 0 0 1 2.15-4.32 5.73 5.73 0 0 1 3.5-1.46c.25-.02 1 0 1.26.02ZM233.58 7.82l8.37 23.22a49.22 49.22 0 0 1-.67 1.9 5.36 5.36 0 0 1-1.14 1.8c-.41.4-.82.58-1.48.69-.27.04-1.03.03-1.35 0a8.05 8.05 0 0 1-1.1-.23l-1.08 3.67c0 .02.32.14.66.22.83.21 1.57.29 2.56.28.56-.01.8-.03 1.24-.1 2.71-.4 4.66-2.09 5.86-5.08l9.64-26.44c0-.02-4.82-.06-4.83-.05l-2.93 8.96-2.91 8.94h-.24l-.22-.65-2.91-8.95-2.7-8.3H233.53ZM293.05 35.8c-1.18.04-1.93.09-2.8.16-2.52.24-4.53.69-5.43 1.23-.7.41-.76.86-.2 1.28.88.66 3.29 1.19 6.36 1.4a48.55 48.55 0 0 0 5.75.05c3.47-.19 6.24-.78 7.11-1.5.22-.19.3-.34.3-.53 0-.1 0-.12-.04-.22-.35-.69-2.32-1.3-5.25-1.63a41.09 41.09 0 0 0-5.8-.24Zm0 0"})})})}let z=s.div`
50
+ `;function F(r){return i("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 460 40",...r,children:i("g",{fill:r.color||"var(--privy-color-foreground)",children:i("path",{d:"M0 15.4v15.38h4.64V19.96h3.58c2.47 0 3.63-.01 3.77-.02 1-.08 1.49-.15 2.18-.3a9.45 9.45 0 0 0 4.6-2.37c1.66-1.57 2.64-3.87 2.81-6.56.02-.3.02-1.19 0-1.49-.1-1.77-.56-3.35-1.36-4.72A8.84 8.84 0 0 0 15.14.57c-.93-.3-1.75-.43-3.09-.54C11.9.02 10.2 0 5.93 0H0ZM10.85 4c1.85.05 3.1.45 4.16 1.3.22.17.54.49.69.68a5.97 5.97 0 0 1 1.19 3.13c.04.35.04 1.36 0 1.71-.08.68-.23 1.3-.44 1.85a4.8 4.8 0 0 1-1.09 1.68A5.63 5.63 0 0 1 12 15.92c-.6.08-.4.08-4.01.09H4.64V3.98h2.9c1.6 0 3.08 0 3.31.02ZM187.65 5.71v5.72h-.27l-.09-.14a15.9 15.9 0 0 0-1.21-1.73c-.43-.5-1-.95-1.7-1.36-.54-.3-1.05-.5-1.73-.63a8.98 8.98 0 0 0-1.7-.17 8.84 8.84 0 0 0-7.8 4.03 12.95 12.95 0 0 0-2.03 6.39c-.07.98-.06 2.15.02 3.13.2 2.47.87 4.53 2.02 6.25a8.98 8.98 0 0 0 10.22 3.65 6.5 6.5 0 0 0 2.8-1.93c.41-.51.84-1.1 1.1-1.55l.1-.17h.37v3.58h4.38V0h-4.48Zm-5.24 5.54c1.3.14 2.3.6 3.17 1.48.9.9 1.5 2.09 1.85 3.64.36 1.6.39 3.72.06 5.43a8.13 8.13 0 0 1-1.54 3.62 5.1 5.1 0 0 1-3.93 1.96 6.13 6.13 0 0 1-2.32-.31 5.87 5.87 0 0 1-3.33-3.5c-.39-1-.62-2.05-.72-3.32-.03-.32-.04-1.35-.02-1.73.08-1.56.4-2.91.96-4.05a6.2 6.2 0 0 1 1.06-1.58 5.08 5.08 0 0 1 3.6-1.66c.25-.02.9 0 1.16.02ZM210.07 15.39l.01 15.38h4.38l.01-3.57h.37l.09.15c.24.44.84 1.26 1.21 1.7a6.79 6.79 0 0 0 2.57 1.75 9.3 9.3 0 0 0 6.86-.49 9.28 9.28 0 0 0 4.05-4.07A13.05 13.05 0 0 0 231 21.6c.21-1.73.18-3.7-.09-5.32a13.03 13.03 0 0 0-1.5-4.3 9.1 9.1 0 0 0-3.75-3.63 9.15 9.15 0 0 0-4.43-.96 7.46 7.46 0 0 0-2.8.5A7.07 7.07 0 0 0 216 9.7c-.4.52-.82 1.12-1.1 1.59l-.07.14h-.27V0h-4.5Zm11.13-4.14c1.07.1 1.94.44 2.7 1.04a6.1 6.1 0 0 1 1.64 1.98c.43.84.78 2 .94 3.11.15 1.16.16 2.4.02 3.54a9.34 9.34 0 0 1-1.39 4.03 5.33 5.33 0 0 1-2.69 2.15c-.9.3-2.04.38-3.06.2a5.14 5.14 0 0 1-3.45-2.37 6.03 6.03 0 0 1-.45-.8c-.5-1.03-.8-2.2-.92-3.58-.04-.49-.06-.89-.05-1.53.01-.76.05-1.23.13-1.85.38-2.53 1.47-4.38 3.15-5.31a5.46 5.46 0 0 1 2.3-.63 10 10 0 0 1 1.13.02ZM69.05 2.17l-.01 2.77V7.7h-3.36v3.6h3.36v6.8l.01 7.15c.06 1.4.4 2.44 1.1 3.37a5.8 5.8 0 0 0 2.97 2.07c.91.3 1.83.42 2.9.38a8.71 8.71 0 0 0 2.66-.48l-.8-3.7-.38.06a4.96 4.96 0 0 1-2.43-.06c-.33-.1-.56-.25-.8-.49-.4-.41-.6-.88-.7-1.67-.02-.2-.02-.62-.03-6.82v-6.6h4.73V7.7h-4.73V2.16h-4.49ZM133.34 2.17V7.7h-3.39v3.6h3.38v6.9l.01 7.17a5.66 5.66 0 0 0 2.36 4.49c.85.6 2.03 1.03 3.26 1.17.85.1 2.03.05 2.81-.1.3-.06.75-.18 1-.26l.2-.06v-.05l-.81-3.67-.37.06a4.99 4.99 0 0 1-1.8.09c-.85-.13-1.32-.4-1.7-.97a2.63 2.63 0 0 1-.39-1.04c-.06-.4-.06 0-.06-7.1V11.3h4.7V7.7h-4.7l-.01-2.77V2.16h-4.49ZM293.41 2.36a14.56 14.56 0 0 0-13.7 16.07 14.59 14.59 0 0 0 21.86 11.08 14.5 14.5 0 0 0 7.11-14.07 14.61 14.61 0 0 0-6.53-10.73 14.49 14.49 0 0 0-8.74-2.35ZM350.8 2.36a10.17 10.17 0 0 0-7.56 4.2c-.16.2-.45.63-.58.83l-.05.1h-.47l-.01-4.36h-7.36v36.4h7.82V27.27h.49l.05.07a11.3 11.3 0 0 0 7.49 4.15 10.52 10.52 0 0 0 9.38-4.1c1.66-2.1 2.73-4.9 3.07-8.06.1-.87.13-1.4.13-2.37 0-.8 0-1.1-.07-1.76a15.95 15.95 0 0 0-3.23-8.72 12.8 12.8 0 0 0-1.85-1.84 10.49 10.49 0 0 0-7.26-2.28Zm-.94 6.05c1.27.15 2.33.65 3.2 1.5.98.96 1.67 2.31 2.03 4 .34 1.57.38 3.68.12 5.39a9.78 9.78 0 0 1-1.04 3.25c-.14.25-.44.69-.6.89a5.35 5.35 0 0 1-4.31 2.07 5.25 5.25 0 0 1-4.41-1.9 7.35 7.35 0 0 1-1.26-2.32 14.09 14.09 0 0 1-.62-4.83c.05-1.98.38-3.53 1.02-4.85a5.63 5.63 0 0 1 2.5-2.65c.66-.34 1.3-.5 2.14-.58.18-.02 1.04 0 1.23.03ZM363.63 3.1l-.01 3.2v3.16h1.43c1.26.01 1.44.02 1.54.04.42.09.66.28.79.62.08.23.08.08.08 2.96a911.57 911.57 0 0 1 .03 10.18v7.54h7.82v-7.4l.01-7.83c.03-.94.11-1.63.27-2.28.46-1.9 1.54-2.93 3.35-3.23.52-.08.2-.08 5-.08h4.4V3.08h-3.1c-3.48 0-3.91.01-4.67.1-1.83.2-3.04.79-3.96 1.88-.5.6-.9 1.32-1.26 2.26l-.06.17h-.46V3.09h-5.6c-4.46 0-5.6 0-5.6.02ZM390.8 16.95V30.8h3.87l3.86-.01V3.09h-7.73ZM400.6 3.1l-.01.4v.38l4.66 13.4 4.69 13.47.02.05h10.3l.03-.05 4.67-13.45 4.67-13.4V3.1h-7.43l-6.7 19.26h-.5l-3.28-9.5-3.31-9.64-.05-.12h-3.88l-3.88.01ZM430.98 3.1c-.01 0-.02.19-.02.4v.39l5.08 14.59c2.8 8.02 5.08 14.6 5.08 14.61.01.02-.22.02-4.8.02h-4.82v6.42h4.95c5.09 0 5.23 0 5.87-.06 3.15-.28 5.29-1.63 6.63-4.15.28-.55.44-.95.87-2.16L459 6.78l1-2.89v-.8h-7.43l-6.69 19.26h-.5l-3.27-9.46-3.31-9.64-.06-.16h-3.88l-3.88.01ZM36.57 7.36c-1.36.1-2.6.6-3.62 1.45a5.65 5.65 0 0 0-1.67 2.42l-.05.13H31V7.7h-4.35v23.08h4.5v-7.3c0-8 0-7.34.08-7.82a4.89 4.89 0 0 1 2.06-3.18c.83-.58 1.74-.89 2.87-.98a11.87 11.87 0 0 1 2.8.25H39v-4.3l-.21-.02c-.61-.07-1.74-.1-2.22-.07ZM51.08 7.41c-2.33.12-4.3.84-5.95 2.16a9.89 9.89 0 0 0-2.03 2.2 12.5 12.5 0 0 0-2 5.78 18.04 18.04 0 0 0 0 3.65 12.13 12.13 0 0 0 2.26 6.05 9.74 9.74 0 0 0 5 3.52c2.11.64 4.7.64 6.8 0a9.78 9.78 0 0 0 4.88-3.37c1.38-1.78 2.19-4 2.4-6.58.13-1.46.06-3.06-.18-4.42a11.24 11.24 0 0 0-3.58-6.6 10 10 0 0 0-5.75-2.35c-.56-.06-1.31-.07-1.85-.04Zm1.42 3.78c.88.1 1.62.34 2.28.75a6.13 6.13 0 0 1 1.99 2.15 10.31 10.31 0 0 1 1.2 5c.02 1.23-.12 2.44-.42 3.51a7.14 7.14 0 0 1-1.81 3.32c-.61.6-1.2.98-1.95 1.24a6 6 0 0 1-2 .3 5.7 5.7 0 0 1-2.72-.6 5 5 0 0 1-1.28-.94A7.1 7.1 0 0 1 46 22.73c-.57-1.99-.6-4.46-.08-6.5a7.24 7.24 0 0 1 2.03-3.67 5.13 5.13 0 0 1 3.35-1.4 11 11 0 0 1 1.2.03ZM92.05 7.4c-.96.06-1.56.15-2.3.33a9.62 9.62 0 0 0-6.09 4.66 13.5 13.5 0 0 0-1.71 7c0 .83 0 1.04.06 1.6.16 1.77.58 3.32 1.29 4.7A9.72 9.72 0 0 0 90.28 31c1.84.37 4.08.32 5.85-.13a9.07 9.07 0 0 0 5.02-3.1A7.64 7.64 0 0 0 102.5 25l-2.11-.39-2.11-.38-.08.13a4.72 4.72 0 0 1-2.35 2.55 6.3 6.3 0 0 1-2.23.58c-.29.03-1.13.03-1.44 0a6.35 6.35 0 0 1-3.02-1.04 5.93 5.93 0 0 1-2.02-2.43 8.44 8.44 0 0 1-.72-3.18v-.26h16.38v-.81c0-1.83-.06-2.76-.25-3.87-.2-1.22-.53-2.24-1.05-3.28a8.9 8.9 0 0 0-2.66-3.26 10.1 10.1 0 0 0-5.34-1.94 18.3 18.3 0 0 0-1.46-.03Zm1.3 3.75c1.2.13 2.19.55 3.05 1.3a5.8 5.8 0 0 1 1.78 2.96c.13.51.21 1.17.21 1.66v.15H86.43v-.12c.08-.97.3-1.78.72-2.61.5-1 1.2-1.8 2.14-2.42a5.32 5.32 0 0 1 2.9-.95c.2-.01.97 0 1.17.03ZM116.79 7.41c-2 .1-3.73.65-5.22 1.65a10.7 10.7 0 0 0-4.25 6.06 16.1 16.1 0 0 0-.5 5.8c.2 2.17.84 4.13 1.88 5.76.58.9 1.32 1.73 2.15 2.4a9.37 9.37 0 0 0 3.6 1.8 12.06 12.06 0 0 0 3.92.34 10.2 10.2 0 0 0 3.84-.95 8.31 8.31 0 0 0 4.76-6.75l.01-.04h-4.37l-.05.16a4.87 4.87 0 0 1-4.24 3.75c-.59.07-1.32.06-1.93-.05a5.47 5.47 0 0 1-3.5-2.27c-.56-.75-1-1.73-1.26-2.79a13.8 13.8 0 0 1-.16-5.24 7.77 7.77 0 0 1 2.1-4.3 5.48 5.48 0 0 1 2.15-1.3 6.4 6.4 0 0 1 3.89.1c.59.21 1.03.5 1.5.96a5.32 5.32 0 0 1 1.46 2.5l.04.15h4.37v-.06a8.22 8.22 0 0 0-5.31-6.94 10.98 10.98 0 0 0-4.88-.74ZM156.2 7.41a9.87 9.87 0 0 0-6 2.29 11.02 11.02 0 0 0-3.41 5.43c-.52 1.78-.68 3.9-.48 5.97.17 1.8.63 3.38 1.37 4.8a9.68 9.68 0 0 0 5.91 4.86c1.65.48 3.63.61 5.53.36 3.72-.49 6.55-2.62 7.56-5.69.12-.39.13-.42.1-.43-.02 0-4.13-.75-4.19-.75-.03 0-.04 0-.1.16-.18.42-.45.9-.72 1.22-.16.2-.49.53-.7.7-.67.54-1.5.9-2.43 1.08-.48.08-.83.11-1.41.11-.64 0-1.07-.04-1.6-.15a5.76 5.76 0 0 1-3.93-2.83 8 8 0 0 1-.99-3.79v-.16h16.38v-1.11l-.02-1.43c-.1-2.25-.53-4-1.35-5.59a9.24 9.24 0 0 0-6.18-4.75c-1.04-.26-2.2-.36-3.33-.3Zm1.45 3.74a5.35 5.35 0 0 1 3.66 1.94 6.1 6.1 0 0 1 1.38 4.01v.12h-11.97v-.06c0-.02 0-.14.02-.25a6.6 6.6 0 0 1 2.15-4.32 5.73 5.73 0 0 1 3.5-1.46c.25-.02 1 0 1.26.02ZM233.58 7.82l8.37 23.22a49.22 49.22 0 0 1-.67 1.9 5.36 5.36 0 0 1-1.14 1.8c-.41.4-.82.58-1.48.69-.27.04-1.03.03-1.35 0a8.05 8.05 0 0 1-1.1-.23l-1.08 3.67c0 .02.32.14.66.22.83.21 1.57.29 2.56.28.56-.01.8-.03 1.24-.1 2.71-.4 4.66-2.09 5.86-5.08l9.64-26.44c0-.02-4.82-.06-4.83-.05l-2.93 8.96-2.91 8.94h-.24l-.22-.65-2.91-8.95-2.7-8.3H233.53ZM293.05 35.8c-1.18.04-1.93.09-2.8.16-2.52.24-4.53.69-5.43 1.23-.7.41-.76.86-.2 1.28.88.66 3.29 1.19 6.36 1.4a48.55 48.55 0 0 0 5.75.05c3.47-.19 6.24-.78 7.11-1.5.22-.19.3-.34.3-.53 0-.1 0-.12-.04-.22-.35-.69-2.32-1.3-5.25-1.63a41.09 41.09 0 0 0-5.8-.24Zm0 0"})})})}let j=s.div`
51
51
  margin-top: 16px;
52
52
  font-size: 13px;
53
53
  text-align: center;
@@ -56,7 +56,7 @@ import{useState as r,useEffect as e,createContext as o,useContext as t,useMemo a
56
56
  && > a {
57
57
  color: var(--privy-color-accent);
58
58
  }
59
- `;function A(r){let{legal:{privacyPolicyUrl:e,termsAndConditionsUrl:o,requireUsersAcceptTerms:t}}=r.app;if(t&&!r.alwaysShowImplicitConsent||!o&&!e)return i(z,{});let a=!(!e||!o);return l(z,{children:["By logging in I agree to the"," ",o&&i("a",{href:o,target:"_blank",children:a?"Terms":"Terms of Service"}),a&&" & ",e&&i("a",{href:e,target:"_blank",children:"Privacy Policy"})]})}const W=()=>i(B,{children:i("a",{href:"https://www.privy.io/",target:"_blank",children:i(j,{height:13,width:150})})}),B=s.div`
59
+ `;function z(r){let{legal:{privacyPolicyUrl:e,termsAndConditionsUrl:o,requireUsersAcceptTerms:t}}=r.app;if(t&&!r.alwaysShowImplicitConsent||!o&&!e)return i(j,{});let a=!(!e||!o);return l(j,{children:["By logging in I agree to the"," ",o&&i("a",{href:o,target:"_blank",children:a?"Terms":"Terms of Service"}),a&&" & ",e&&i("a",{href:e,target:"_blank",children:"Privacy Policy"})]})}const A=()=>i(W,{children:i("a",{href:"https://www.privy.io/",target:"_blank",children:i(F,{height:13,width:150})})}),W=s.div`
60
60
  display: flex;
61
61
  align-items: center;
62
62
  justify-content: center;
@@ -77,7 +77,7 @@ import{useState as r,useEffect as e,createContext as o,useContext as t,useMemo a
77
77
  @media all and (display-mode: standalone) {
78
78
  padding-bottom: 30px;
79
79
  }
80
- `,G=({address:r,showCopyIcon:e,url:o,className:t})=>o?i("a",{title:r,className:t,href:`${o}/address/${r}`,target:"_blank",children:v(r)}):l("button",{title:r,className:t,onClick:()=>navigator.clipboard.writeText(r).catch(console.error),children:[v(r),e&&i(O,{})]});let O=s(w)`
80
+ `,B=({address:r,showCopyIcon:e,url:o,className:t})=>o?i("a",{title:r,className:t,href:`${o}/address/${r}`,target:"_blank",children:v(r)}):l("button",{title:r,className:t,onClick:()=>navigator.clipboard.writeText(r).catch(console.error),children:[v(r),e&&i(G,{})]});let G=s(b)`
81
81
  && {
82
82
  display: inline;
83
83
  }
@@ -86,7 +86,7 @@ import{useState as r,useEffect as e,createContext as o,useContext as t,useMemo a
86
86
  width: 0.875rem;
87
87
  margin-left: 0.125rem;
88
88
  color: var(--privy-color-foreground-3);
89
- `,U=d`
89
+ `,O=d`
90
90
  from, to {
91
91
  background: var(--privy-color-foreground-4);
92
92
  color: var(--privy-color-foreground-4);
@@ -96,13 +96,13 @@ import{useState as r,useEffect as e,createContext as o,useContext as t,useMemo a
96
96
  background: var(--privy-color-foreground-accent);
97
97
  color: var(--privy-color-foreground-accent);
98
98
  }
99
- `;const E=h`
99
+ `;const U=h`
100
100
  ${r=>r.$isLoading?h`
101
101
  width: 35%;
102
- animation: ${U} 2s linear infinite;
102
+ animation: ${O} 2s linear infinite;
103
103
  border-radius: var(--privy-border-radius-sm);
104
104
  `:""}
105
- `,R=({children:r,color:e,isLoading:o,isPulsing:t,className:a})=>i(q,{$color:e,$isLoading:o,$isPulsing:t,className:a,children:r});let q=s.span`
105
+ `,E=({children:r,color:e,isLoading:o,isPulsing:t,className:a})=>i(R,{$color:e,$isLoading:o,$isPulsing:t,className:a,children:r});let R=s.span`
106
106
  padding: 0.125rem 0.5rem;
107
107
  font-size: 0.75rem;
108
108
  font-weight: 500;
@@ -125,23 +125,23 @@ import{useState as r,useEffect as e,createContext as o,useContext as t,useMemo a
125
125
  `};
126
126
  `}}
127
127
 
128
- ${E}
129
- `,D=o({});const J=({children:o})=>{let t=p(),[a,c]=r({});return g("login",{onComplete:(r,e,o,a,i)=>{i&&"passkey"!==i.type&&"cross_app"!==i.type&&("wallet"!==i.type||"privy"!==i.walletClientType)&&(C.put(K(t.id),i.type),"wallet"===i.type?(C.put(Q(t.id),i.walletClientType),C.put(X(t.id),i.chainType),c({accountType:i.type,walletClientType:i.walletClientType,chainType:i.chainType})):(C.del(Q(t.id)),C.del(X(t.id)),c({accountType:i.type})))}}),e((()=>{if(!t.id)return;let r=C.get(K(t.id)),e=C.get(Q(t.id)),o=C.get(X(t.id));r&&c("wallet"===r?{accountType:r,walletClientType:e,chainType:o}:{accountType:r})}),[t.id]),i(D.Provider,{value:a,children:o})};let K=r=>`privy:${r}:recent-login-method`,Q=r=>`privy:${r}:recent-login-wallet-client`,X=r=>`privy:${r}:recent-login-chain-type`;const Y=()=>t(D);function rr(r){let{logout:e}=t(y);return g("logout",r),{logout:e}}const er=s.div`
128
+ ${U}
129
+ `,q=o({});const D=({children:o})=>{let t=p(),[a,c]=r({});return g("login",{onComplete:(r,e,o,a,i)=>{i&&"passkey"!==i.type&&"cross_app"!==i.type&&("wallet"!==i.type||"privy"!==i.walletClientType)&&(T.put(J(t.id),i.type),"wallet"===i.type?(T.put(K(t.id),i.walletClientType),T.put(Q(t.id),i.chainType),c({accountType:i.type,walletClientType:i.walletClientType,chainType:i.chainType})):(T.del(K(t.id)),T.del(Q(t.id)),c({accountType:i.type})))}}),e((()=>{if(!t.id)return;let r=T.get(J(t.id)),e=T.get(K(t.id)),o=T.get(Q(t.id));r&&c("wallet"===r?{accountType:r,walletClientType:e,chainType:o}:{accountType:r})}),[t.id]),i(q.Provider,{value:a,children:o})};let J=r=>`privy:${r}:recent-login-method`,K=r=>`privy:${r}:recent-login-wallet-client`,Q=r=>`privy:${r}:recent-login-chain-type`;const X=()=>t(q);function Y(r){let{logout:e}=t(y);return g("logout",r),{logout:e}}const rr=s.div`
130
130
  display: flex;
131
131
  flex-direction: column;
132
- `,or=s.span`
132
+ `,er=s.span`
133
133
  text-align: left;
134
134
  font-size: 0.75rem;
135
135
  font-weight: 500;
136
136
  line-height: 1.125rem; /* 150% */
137
137
 
138
138
  color: var(--privy-color-error);
139
- `,tr=s.span`
139
+ `,or=s.span`
140
140
  color: var(--privy-color-foreground-3);
141
141
  font-size: 0.75rem;
142
142
  font-weight: 500;
143
143
  line-height: 1.125rem; /* 150% */
144
- `,ar=h`
144
+ `,tr=h`
145
145
  && {
146
146
  border-width: 1px;
147
147
  padding: 0.5rem 1rem;
@@ -156,6 +156,6 @@ import{useState as r,useEffect as e,createContext as o,useContext as t,useMemo a
156
156
  align-items: center;
157
157
 
158
158
  ${r=>"error"===r.$state?"border-color: var(--privy-color-error);":""}
159
- `,cr=s.div`
160
- ${ar}
161
- `,ir=({errMsg:r,balance:e,address:o,isLoading:t,className:a,title:c,isPulsing:s,showIcon:d,statusColor:h="green"})=>{let v;return v=h||(r?"red":"green"),l(n,{children:[l(cr,{className:a,$state:r?"error":void 0,children:[l(er,{children:[i(tr,{children:c||"Pay with"}),i(G,{address:o,showCopyIcon:d||!!r})]}),void 0!==e&&i(R,{isLoading:t,isPulsing:s,color:v,children:e})]}),r&&i(or,{style:{marginTop:"0.25rem"},children:r})]})},lr=({color:r,...e})=>i("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...e,children:i("g",{children:i("path",{fill:r||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});let nr=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2}),sr=r=>nr.format(r);const dr=(r,e)=>{let o=sr(e*parseFloat(r));return"$0.00"!==o?o:"<$0.01"},hr=(r,e)=>{let o=sr(e*parseFloat($(r)));return"$0.00"===o?"<$0.01":o},vr=(r,e,o=6,t=!1)=>{let a=parseFloat($(r)).toFixed(o).replace(/0+$/,"").replace(/\.$/,"");return t?`${a} ${e}`:`${"0"===a?"<0.001":a} ${e}`},pr=r=>r.map(M).reduce(((r,e)=>r.add(e)),x.from(0)).toHexString(),ur=(r,e)=>{let{chains:o}=f(),t=`https://etherscan.io/address/${e}`,a=`${u(r,o)}/address/${e}`;if(!a)return t;try{new URL(a)}catch{return t}return a};function mr({rpcConfig:o,appId:t,address:i,chain:l}){let{chains:n}=f(),[s,d]=r(0n),[h,v]=r(!1),p=a((()=>{let r=l||n[0];if(r)return V({chain:l,transport:Z(m(r,o,t))})}),[l,o,t]),u=c((async()=>{if(!i||!p)return;v(!0);let r=await p.getBalance({address:i}).catch(console.error);return r?(d(r),v(!1),r):void 0}),[p,i,d]);return e((()=>{u().catch(console.error)}),[]),{balance:s,isLoading:h,reloadBalance:u}}function gr(r){let{login:e}=t(y);return g("login",r),{login:e}}function yr(r){let{connectWallet:e}=t(y);return g("connectWallet",r),{connectWallet:e}}const fr=r=>{g("fundWallet",r);let{fundWallet:e}=b();return{fundWallet:e}};export{G as A,H as B,_ as C,or as E,I as L,B as M,J as R,A as T,ir as W,C as a,W as b,R as c,rr as d,T as e,lr as f,E as g,cr as h,M as i,ar as j,vr as k,dr as l,hr as m,N as n,mr as o,ur as p,S as q,k as r,pr as s,P as t,Y as u,gr as v,yr as w,fr as x};
159
+ `,ar=s.div`
160
+ ${tr}
161
+ `,cr=({errMsg:r,balance:e,address:o,isLoading:t,className:a,title:c,isPulsing:s,showIcon:d,statusColor:h="green"})=>{let v;return v=h||(r?"red":"green"),l(n,{children:[l(ar,{className:a,$state:r?"error":void 0,children:[l(rr,{children:[i(or,{children:c||"Pay with"}),i(B,{address:o,showCopyIcon:d||!!r})]}),void 0!==e&&i(E,{isLoading:t,isPulsing:s,color:v,children:e})]}),r&&i(er,{style:{marginTop:"0.25rem"},children:r})]})},ir=({color:r,...e})=>i("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...e,children:i("g",{children:i("path",{fill:r||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});let lr=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2}),nr=r=>lr.format(r);const sr=(r,e)=>{let o=nr(e*parseFloat(r));return"$0.00"!==o?o:"<$0.01"},dr=(r,e)=>{let o=nr(e*parseFloat(x(r)));return"$0.00"===o?"<$0.01":o},hr=(r,e,o=6,t=!1)=>{let a=parseFloat(x(r)).toFixed(o).replace(/0+$/,"").replace(/\.$/,"");return t?`${a} ${e}`:`${"0"===a?"<0.001":a} ${e}`},vr=r=>r.map(Z).reduce(((r,e)=>r.add(e)),w.from(0)).toHexString(),pr=(r,e)=>{let{chains:o}=f(),t=`https://etherscan.io/address/${e}`,a=`${u(r,o)}/address/${e}`;if(!a)return t;try{new URL(a)}catch{return t}return a};function ur({rpcConfig:o,appId:t,address:i,chain:l}){let{chains:n}=f(),[s,d]=r(0n),[h,v]=r(!1),p=a((()=>{let r=l||n[0];if(r)return $({chain:l,transport:V(m(r,o,t))})}),[l,o,t]),u=c((async()=>{if(!i||!p)return;v(!0);let r=await p.getBalance({address:i}).catch(console.error);return r?(d(r),v(!1),r):void 0}),[p,i,d]);return e((()=>{u().catch(console.error)}),[]),{balance:s,isLoading:h,reloadBalance:u}}function mr(r){let{login:e}=t(y);return g("login",r),{login:e}}function gr(r){let{connectWallet:e}=t(y);return g("connectWallet",r),{connectWallet:e}}const yr=r=>{g("fundWallet",r);let{fundWallet:e}=f();return{fundWallet:e}};export{B as A,N as B,S as C,er as E,_ as L,W as M,D as R,z as T,cr as W,T as a,A as b,E as c,Y as d,L as e,ir as f,U as g,ar as h,Z as i,tr as j,hr as k,sr as l,dr as m,I as n,ur as o,pr as p,C as q,P as r,vr as s,M as t,X as u,mr as v,gr as w,yr as x};
@@ -1 +1 @@
1
- import{c as e,b as t,o as a,u as s,h as n,P as r}from"./privy-context-BXjG69vB.mjs";import i from"eventemitter3";import{ErrorCode as o}from"@ethersproject/logger";import{a as l}from"./events-context-D3j6WwDa.mjs";var d,c;(c=d||(d={})).MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",c.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",c.INVALID_DATA="invalid_data",c.LINKED_TO_ANOTHER_USER="linked_to_another_user",c.ALLOWLIST_REJECTED="allowlist_rejected",c.OAUTH_USER_DENIED="oauth_user_denied",c.UNKNOWN_AUTH_ERROR="unknown_auth_error",c.USER_EXITED_AUTH_FLOW="exited_auth_flow",c.MUST_BE_AUTHENTICATED="must_be_authenticated",c.UNKNOWN_CONNECT_WALLET_ERROR="unknown_connect_wallet_error",c.GENERIC_CONNECT_WALLET_ERROR="generic_connect_wallet_error",c.CLIENT_REQUEST_TIMEOUT="client_request_timeout",c.INVALID_CREDENTIALS="invalid_credentials";class _ extends Error{toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(e,t,a){super(e),t instanceof Error&&(this.cause=t),this.privyErrorCode=a}}class E extends _{constructor(e,t,a){super(e),this.type="provider_error",this.code=t,this.data=a}}let u={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1},E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don’t see your wallet? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don’t see your wallet? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don’t see your wallet? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}};class h extends E{constructor(e){super(e.message,e.code,e.data);let t=Object.values(u).find((t=>t.eipCode===e.code));this.details=t||u.UNKNOWN_ERROR,-32002===e.code&&(e.message?.includes("already pending for origin")?e.message?.includes("wallet_requestPermissions")?this.details=u.E32002_CONNECTION_ALREADY_PENDING:this.details=u.E32002_REQUEST_ALREADY_PENDING:e.message?.includes("Already processing")&&e.message.includes("eth_requestAccounts")&&(this.details=u.E32002_WALLET_LOCKED))}}class p extends e{constructor(){super("Wallet timeout"),this.type="wallet_error"}}class y extends e{constructor(){super("User rejected connection"),this.type="wallet_error"}}const T=t=>{if(t instanceof e)return t;if(t?.code&&t?.reason){let e=new g(t);return t.code===o.ACTION_REJECTED&&(e.details=u.E4001_USER_REJECTED_REQUEST),e}return t?.code?new g(t):new e("Unknown connector error",t)};class m extends t{constructor(e,t,a){super(e),this.type="provider_error",this.code=t,this.data=a}}class g extends m{constructor(e){super(e.message,e.code,e.data);let t=Object.values(u).find((t=>t.eipCode===e.code));this.details=t||u.UNKNOWN_ERROR,-32002===e.code&&(e.message?.includes("already pending for origin")?e.message?.includes("wallet_requestPermissions")?this.details=u.E32002_CONNECTION_ALREADY_PENDING:this.details=u.E32002_REQUEST_ALREADY_PENDING:e.message?.includes("Already processing")&&e.message.includes("eth_requestAccounts")&&(this.details=u.E32002_WALLET_LOCKED))}}const w={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0},ERROR_USER_LIMIT_REACHED:{message:"Unable to link",detail:"You've reached the maximum number of linked wallets.",retryable:!1},...u};class C extends i{constructor(e){super(),this.walletClientType=e,this.connected=!1,this.initialized=!1}}const R=["metamask","phantom","brave_wallet","rainbow","uniswap_wallet_extension","uniswap_extension","rabby_wallet","bybit_wallet","crypto.com_wallet_extension","coinbase_wallet","coinbase_smart_wallet","metamask","trust","safe","rainbow","uniswap","zerion","argent","spot","omni","cryptocom","blockchain","safepal","bitkeep","zengo","1inch","binance","exodus","mew_wallet","alphawallet","keyring_pro","mathwallet","unstoppable","obvious","ambire","internet_money_wallet","coin98","abc_wallet","arculus_wallet","haha","cling_wallet","broearn","copiosa","burrito_wallet","enjin_wallet","plasma_wallet","avacus","bee","pitaka","pltwallet","minerva","kryptogo","prema","slingshot","kriptonio","timeless","secux","bitizen","blocto","okx_wallet","safemoon","rabby_wallet","bybit_wallet","privy","unknown","phantom","solflare","glow"];function N(e){return"solana"===e.chainType}function A(e){return"solana"===e.type}class b extends C{get isInstalled(){return"Installed"===this.adapter.readyState}buildConnectedWallet(e,t){let s,n,r;if("Installed"!==e.readyState||!e.publicKey)throw Error("Wallet is not connected.");return"signMessage"in e&&(s=async(...t)=>{if(!e.connected)throw Error("Wallet is not connected.");return await e.signMessage(t[0])}),"sendTransaction"in e&&(n=async(...t)=>await e.sendTransaction(t[0],t[1],t[2])),"signTransaction"in e&&(r=async t=>await e.signTransaction(t)),{type:"solana",address:e.publicKey.toBase58(),meta:t,imported:!1,connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:async()=>e.connected,disconnect:()=>{try{e.disconnect()}catch(e){console.error("Wallet does not support programmatic disconnect")}},getProvider:a(`${this.walletClientType||""} wallet does not support 'getProvider'`),signMessage:s??a(`${this.walletClientType||""} wallet does not support 'signMessage'`),sendTransaction:n??a(`${this.walletClientType||""} wallet does not support 'sendTransaction'`),signTransaction:r??a(`${this.walletClientType||""} wallet does not support 'signTransaction'`)}}async syncAccounts(){if("Installed"===this.adapter.readyState&&this.adapter.publicKey){let e={name:this.walletBranding.name,icon:"string"==typeof this.walletBranding.icon?this.walletBranding.icon:void 0,id:this.walletBranding.id};this.wallets.find((e=>this.adapter.publicKey&&e.address===this.adapter.publicKey.toBase58()))||(this.wallets=[this.buildConnectedWallet(this.adapter,e)],this.emit("walletsUpdated"))}else this.wallets.length>0&&(this.wallets=[],this.emit("walletsUpdated"))}get walletBranding(){return{id:this.adapter.name,name:this.adapter.name,icon:this.adapter.icon}}async initialize(){this.subscribeListeners(),await this.syncAccounts(),this.shouldAutoConnect&&await this.adapter.autoConnect().catch(console.error),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}async getConnectedWallet(){return this.wallets.sort(((e,t)=>t.connectedAt-e.connectedAt))[0]||null}async isConnected(){return this.adapter.connected&&["Installed"].includes(this.adapter.readyState)}subscribeListeners(){this.adapter.addListener("disconnect",this.onDisconnect),this.adapter.addListener("connect",this.onConnect),this.adapter.addListener("error",this.onError),this.adapter.addListener("readyStateChange",this.onReadyStateChange)}unsubscribeListeners(){this.adapter.removeAllListeners()}constructor(e,t){super(function(e){return R.includes(e)}(e.name.toLowerCase())?e.name.toLowerCase():"unknown"),this.chainType="solana",this.connectorType="solana_adapter",this.disconnect=()=>{this.adapter.disconnect().then((()=>this.onDisconnect())).catch((e=>console.error("Error disconnecting",e)))},this.promptConnection=async()=>{try{await this.adapter.connect()}catch(e){throw T(e)}},this.onDisconnect=()=>{this.syncAccounts()},this.onConnect=e=>{this.syncAccounts()},this.onError=e=>{this.syncAccounts()},this.onReadyStateChange=e=>{"Installed"!==e&&(this.connected=!1),this.syncAccounts()},this.adapter=e,this.shouldAutoConnect=t,this.wallets=[]}}const D=()=>{let{embeddedSolanaWallet:e,exportSolanaWallet:t,createEmbeddedSolanaWallet:a,solanaWallets:i,delegateWallet:o}=s(),{user:d}=n();return{createWallet:a,exportWallet:t,delegateWalletAction:async()=>{let e=l(d);if(!e)throw new r("User must have a solana wallet in order to delegate actions");return await o({address:e.address,chainType:"solana"})},wallets:i.concat(e?[e]:[])}};export{w as C,g as P,h as R,b as S,y as U,p as W,C as a,m as b,A as c,T as f,N as i,u as n,D as u};
1
+ import{c as e,b as t,o as a,u as s,h as n,P as r}from"./privy-context-BeqkgOHo.mjs";import i from"eventemitter3";import{ErrorCode as o}from"@ethersproject/logger";import{a as l}from"./events-context-D3j6WwDa.mjs";var d,c;(c=d||(d={})).MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",c.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",c.INVALID_DATA="invalid_data",c.LINKED_TO_ANOTHER_USER="linked_to_another_user",c.ALLOWLIST_REJECTED="allowlist_rejected",c.OAUTH_USER_DENIED="oauth_user_denied",c.UNKNOWN_AUTH_ERROR="unknown_auth_error",c.USER_EXITED_AUTH_FLOW="exited_auth_flow",c.MUST_BE_AUTHENTICATED="must_be_authenticated",c.UNKNOWN_CONNECT_WALLET_ERROR="unknown_connect_wallet_error",c.GENERIC_CONNECT_WALLET_ERROR="generic_connect_wallet_error",c.CLIENT_REQUEST_TIMEOUT="client_request_timeout",c.INVALID_CREDENTIALS="invalid_credentials";class _ extends Error{toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(e,t,a){super(e),t instanceof Error&&(this.cause=t),this.privyErrorCode=a}}class E extends _{constructor(e,t,a){super(e),this.type="provider_error",this.code=t,this.data=a}}let u={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1},E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don’t see your wallet? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don’t see your wallet? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don’t see your wallet? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}};class h extends E{constructor(e){super(e.message,e.code,e.data);let t=Object.values(u).find((t=>t.eipCode===e.code));this.details=t||u.UNKNOWN_ERROR,-32002===e.code&&(e.message?.includes("already pending for origin")?e.message?.includes("wallet_requestPermissions")?this.details=u.E32002_CONNECTION_ALREADY_PENDING:this.details=u.E32002_REQUEST_ALREADY_PENDING:e.message?.includes("Already processing")&&e.message.includes("eth_requestAccounts")&&(this.details=u.E32002_WALLET_LOCKED))}}class p extends e{constructor(){super("Wallet timeout"),this.type="wallet_error"}}class y extends e{constructor(){super("User rejected connection"),this.type="wallet_error"}}const T=t=>{if(t instanceof e)return t;if(t?.code&&t?.reason){let e=new g(t);return t.code===o.ACTION_REJECTED&&(e.details=u.E4001_USER_REJECTED_REQUEST),e}return t?.code?new g(t):new e("Unknown connector error",t)};class m extends t{constructor(e,t,a){super(e),this.type="provider_error",this.code=t,this.data=a}}class g extends m{constructor(e){super(e.message,e.code,e.data);let t=Object.values(u).find((t=>t.eipCode===e.code));this.details=t||u.UNKNOWN_ERROR,-32002===e.code&&(e.message?.includes("already pending for origin")?e.message?.includes("wallet_requestPermissions")?this.details=u.E32002_CONNECTION_ALREADY_PENDING:this.details=u.E32002_REQUEST_ALREADY_PENDING:e.message?.includes("Already processing")&&e.message.includes("eth_requestAccounts")&&(this.details=u.E32002_WALLET_LOCKED))}}const w={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0},ERROR_USER_LIMIT_REACHED:{message:"Unable to link",detail:"You've reached the maximum number of linked wallets.",retryable:!1},...u};class C extends i{constructor(e){super(),this.walletClientType=e,this.connected=!1,this.initialized=!1}}const R=["metamask","phantom","brave_wallet","rainbow","uniswap_wallet_extension","uniswap_extension","rabby_wallet","bybit_wallet","crypto.com_wallet_extension","coinbase_wallet","coinbase_smart_wallet","metamask","trust","safe","rainbow","uniswap","zerion","argent","spot","omni","cryptocom","blockchain","safepal","bitkeep","zengo","1inch","binance","exodus","mew_wallet","alphawallet","keyring_pro","mathwallet","unstoppable","obvious","ambire","internet_money_wallet","coin98","abc_wallet","arculus_wallet","haha","cling_wallet","broearn","copiosa","burrito_wallet","enjin_wallet","plasma_wallet","avacus","bee","pitaka","pltwallet","minerva","kryptogo","prema","slingshot","kriptonio","timeless","secux","bitizen","blocto","okx_wallet","safemoon","rabby_wallet","bybit_wallet","privy","unknown","phantom","solflare","glow"];function N(e){return"solana"===e.chainType}function A(e){return"solana"===e.type}class b extends C{get isInstalled(){return"Installed"===this.adapter.readyState}buildConnectedWallet(e,t){let s,n,r;if("Installed"!==e.readyState||!e.publicKey)throw Error("Wallet is not connected.");return"signMessage"in e&&(s=async(...t)=>{if(!e.connected)throw Error("Wallet is not connected.");return await e.signMessage(t[0])}),"sendTransaction"in e&&(n=async(...t)=>await e.sendTransaction(t[0],t[1],t[2])),"signTransaction"in e&&(r=async t=>await e.signTransaction(t)),{type:"solana",address:e.publicKey.toBase58(),meta:t,imported:!1,connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:async()=>e.connected,disconnect:()=>{try{e.disconnect()}catch(e){console.error("Wallet does not support programmatic disconnect")}},getProvider:a(`${this.walletClientType||""} wallet does not support 'getProvider'`),signMessage:s??a(`${this.walletClientType||""} wallet does not support 'signMessage'`),sendTransaction:n??a(`${this.walletClientType||""} wallet does not support 'sendTransaction'`),signTransaction:r??a(`${this.walletClientType||""} wallet does not support 'signTransaction'`)}}async syncAccounts(){if("Installed"===this.adapter.readyState&&this.adapter.publicKey){let e={name:this.walletBranding.name,icon:"string"==typeof this.walletBranding.icon?this.walletBranding.icon:void 0,id:this.walletBranding.id};this.wallets.find((e=>this.adapter.publicKey&&e.address===this.adapter.publicKey.toBase58()))||(this.wallets=[this.buildConnectedWallet(this.adapter,e)],this.emit("walletsUpdated"))}else this.wallets.length>0&&(this.wallets=[],this.emit("walletsUpdated"))}get walletBranding(){return{id:this.adapter.name,name:this.adapter.name,icon:this.adapter.icon}}async initialize(){this.subscribeListeners(),await this.syncAccounts(),this.shouldAutoConnect&&await this.adapter.autoConnect().catch(console.error),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}async getConnectedWallet(){return this.wallets.sort(((e,t)=>t.connectedAt-e.connectedAt))[0]||null}async isConnected(){return this.adapter.connected&&["Installed"].includes(this.adapter.readyState)}subscribeListeners(){this.adapter.addListener("disconnect",this.onDisconnect),this.adapter.addListener("connect",this.onConnect),this.adapter.addListener("error",this.onError),this.adapter.addListener("readyStateChange",this.onReadyStateChange)}unsubscribeListeners(){this.adapter.removeAllListeners()}constructor(e,t){super(function(e){return R.includes(e)}(e.name.toLowerCase())?e.name.toLowerCase():"unknown"),this.chainType="solana",this.connectorType="solana_adapter",this.disconnect=()=>{this.adapter.disconnect().then((()=>this.onDisconnect())).catch((e=>console.error("Error disconnecting",e)))},this.promptConnection=async()=>{try{await this.adapter.connect()}catch(e){throw T(e)}},this.onDisconnect=()=>{this.syncAccounts()},this.onConnect=e=>{this.syncAccounts()},this.onError=e=>{this.syncAccounts()},this.onReadyStateChange=e=>{"Installed"!==e&&(this.connected=!1),this.syncAccounts()},this.adapter=e,this.shouldAutoConnect=t,this.wallets=[]}}const D=()=>{let{embeddedSolanaWallet:e,exportSolanaWallet:t,createEmbeddedSolanaWallet:a,solanaWallets:i,delegateWallet:o}=s(),{user:d}=n();return{createWallet:a,exportWallet:t,delegateWalletAction:async()=>{let e=l(d);if(!e)throw new r("User must have a solana wallet in order to delegate actions");return await o({address:e.address,chainType:"solana"})},wallets:i.concat(e?[e]:[])}};export{w as C,g as P,h as R,b as S,y as U,p as W,C as a,m as b,A as c,T as f,N as i,u as n,D as u};
@@ -1 +1 @@
1
- import{StaticJsonRpcProvider as e}from"@ethersproject/providers";import{c as t}from"./privy-context-BXjG69vB.mjs";import{jsx as a}from"react/jsx-runtime";import{useState as r,useMemo as n,useEffect as l,useContext as i,createContext as o}from"react";import s from"tinycolor2";const p=e=>e.isApexWallet?"Apex Wallet":e.isAvalanche?"Core Wallet":e.isBackpack?"Backpack":e.isBifrost?"Bifrost Wallet":e.isBitKeep?"BitKeep":e.isBitski?"Bitski":e.isBlockWallet?"BlockWallet":e.isBraveWallet?"Brave Wallet":e.isClover?"Clover":e.isCoin98?"Coin98 Wallet":e.isCoinbaseWallet?"Coinbase Wallet":e.isDawn?"Dawn Wallet":e.isDefiant?"Defiant":e.isDesig?"Desig Wallet":e.isEnkrypt?"Enkrypt":e.isExodus?"Exodus":e.isFordefi?"Fordefi":e.isFrame?"Frame":e.isFrontier?"Frontier Wallet":e.isGamestop?"GameStop Wallet":e.isHaqqWallet?"HAQQ Wallet":e.isHyperPay?"HyperPay Wallet":e.isImToken?"ImToken":e.isHaloWallet?"Halo Wallet":e.isKuCoinWallet?"KuCoin Wallet":e.isMathWallet?"MathWallet":e.isNovaWallet?"Nova Wallet":e.isOkxWallet||e.isOKExWallet?"OKX Wallet":e.isOneInchIOSWallet||e.isOneInchAndroidWallet?"1inch Wallet":e.isOneKey?"OneKey Wallet":e.isOpera?"Opera":e.isPhantom?"Phantom":e.isPortal?"Ripio Portal":e.isRabby?"Rabby Wallet":e.isRainbow?"Rainbow":e.isSafePal?"SafePal Wallet":e.isStatus?"Status":e.isSubWallet?"SubWallet":e.isTalisman?"Talisman":e.isTally||e.isTaho?"Taho":e.isTokenPocket?"TokenPocket":e.isTokenary?"Tokenary":e.isTrust||e.isTrustWallet?"Trust Wallet":e.isTTWallet?"TTWallet":e.isXDEFI?"XDEFI Wallet":e.isZeal?"Zeal":e.isZerion?"Zerion":e.isMetaMask?"MetaMask":void 0,c=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||"MetaMask"!==p(e))return!1;if(e.providers)for(let t of e.providers)if(!c(t))return!1;return!0},u=()=>{if("phantom"in window){let e=window;if(e?.phantom?.ethereum?.isPhantom&&e?.phantom?.ethereum?.chainId)return!0}return!1},h=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers)for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0;return!1},d=(e,t)=>{let a=[],r=[];for(let[n,l]of e.entries())n<t?a.push(l):r.push(l);return[a,r]},m=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),f=(e,t)=>{let a=e.slice(0),r=[];for(;a.length;)r.push(a.splice(0,t));return r},g=(e,t=3,a=4,r="ethereum")=>{if(!e)return"";let n="ethereum"===r?2:0;return t+a+n+3>=e.length?e:`${e.slice(0,n+t)}...${e.slice(e.length-a,e.length)}`},y=(e,t=3,a=4)=>g(e,t,a,"solana"),b=e=>new Promise((t=>setTimeout(t,e)));function w(e,{interval:t=100,timeout:a=5e3}={}){return new Promise(((r,n)=>{let l,i=0,o=()=>{i>=a?n("Max attempts reached without result"):(l=e(),i+=t,null==l?setTimeout(o,t):r(l))};o()}))}const v=(e,t={})=>{let a=t.delayMs||150,r=t.maxAttempts||270;return new Promise((async(n,l)=>{let i=!1,o=0;for(;!i&&o<r;){if(t.abortSignal?.aborted)return;e().then((e=>{i=!0,n(e)}),((...e)=>{i=!0,l(...e)})),o+=1,await b(a)}i||l(Error("Exceeded max attempts before resolving function"))}))},C=(e,t,a={},r={})=>{let n=new URL(t,e);for(let[e,t]of Object.entries(a))void 0!==t&&n.searchParams.set(e,t);let l=Object.entries(r);if(l.length>0){let e=new URLSearchParams;for(let[t,a]of l)e.append(t,a);n.hash=e.toString()}return n.href},k=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),E=e=>"string"==typeof e?e:"0x"+e.toString(16);async function W({store:e,walletList:t,externalWalletConfig:a,walletChainType:r,timeout:n=3e3}){let l=!1,i=window;return new Promise((o=>{function s(){if(l)return;l=!0,window.removeEventListener("ethereum#initialized",s);let n=e.getProviders();console.debug("Detected injected providers:",n.map((e=>e.info)));let i=[];for(let e of n)t.includes("coinbase_wallet")&&"com.coinbase.wallet"===e.info.rdns||"solana-only"===r&&"app.phantom"===e.info.rdns||i.push({type:e.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:e});if("solana-only"!==r)for(let e of function(){let e=window,t=e.ethereum;if(!t)return[];let a=[];if(t.providers?.length)for(let e of t.providers)e&&a.push(e);return a.push(e.ethereum),a}()){let t=p(e);if(!n.some((e=>e.info.name===t))){if(c(e,!0)&&!i.find((e=>"metamask"===e.type))){i.push({type:"metamask",legacyInjectedProvider:e});continue}if("Phantom"===t&&!i.find((e=>"phantom"===e.type))){i.push({type:"phantom",legacyInjectedProvider:e});continue}if("Coinbase Wallet"===t&&!i.find((e=>"coinbase_wallet"===e.type&&"smartWalletOnly"!==a.coinbaseWallet?.connectionOptions))){i.push({type:"coinbase_wallet",legacyInjectedProvider:e});continue}i.find((e=>"unknown_browser_extension"===e.type))||i.push({type:"unknown_browser_extension",legacyInjectedProvider:e})}}o(i)}i.ethereum?s():(window.addEventListener("ethereum#initialized",s,{once:!0}),setTimeout((()=>{s()}),n))}))}function S(e){return`eip155:${String(Number(e))}`}const x=(e,a,r,n)=>{let l=Number(e),i=a.find((e=>e.id===l));if(!i)throw new t(`Unsupported chainId ${e}`,4901);return U(i,r,n)},U=(e,a,r)=>{let n,l=e.id,i=Number(e.id);if(e.rpcUrls.privyWalletOverride&&e.rpcUrls.privyWalletOverride.http[0])n=e.rpcUrls.privyWalletOverride.http[0];else if(a.rpcUrls&&a.rpcUrls[i])n=a.rpcUrls[i];else if(e.rpcUrls.privy?.http[0]){let t=new URL(e.rpcUrls.privy.http[0]);t.searchParams.append("privyAppId",r),n=t.toString()}else n=e.rpcUrls.public?.http[0]?e.rpcUrls.public.http[0]:e.rpcUrls.default?.http[0];if(!n)throw new t(`No RPC url found for ${l}`);return n},O=(e,a)=>{let r=Number(e),n=a.find((e=>e.id===r));if(!n)throw new t(`Unsupported chainId ${e}`,4901);return n.blockExplorers?.default.url},A=(a,r,n,l)=>{let i=Number(a),o=r.find((e=>e.id===i));if(!o)throw new t(`Unsupported chainId ${a}`,4901);return new e(o.rpcUrls.privyWalletOverride&&o.rpcUrls.privyWalletOverride.http[0]?o.rpcUrls.privyWalletOverride.http[0]:n.rpcUrls&&n.rpcUrls[i]?n.rpcUrls[i]:o.rpcUrls.privy?.http[0]?{url:o.rpcUrls.privy.http[0],headers:{"privy-app-id":l.appId}}:o.rpcUrls.public?.http[0]?o.rpcUrls.public.http[0]:o.rpcUrls.default?.http[0])},M=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},a=e.types.EIP712Domain??Object.entries(e.domain).map((([e,a])=>{if(null!=a&&"string"==typeof e&&e in t)return{name:e,type:t[e]}})).filter((e=>void 0!==e));return{...e,types:{...e.types,EIP712Domain:a}}};function T(e,{min:t,max:a}){return Math.min(Math.max(e,t),a)}const F="https://auth.privy.io",P=2e4,L=1400,H=2500,_=4e3,D="1.92.7",I="privy:token",j="privy-token",B="privy:refresh_token",z="privy-refresh-token",R="privy:id_token",K="privy-id-token",$="privy-session",q="privy:session_transfer_token",Z="privy:caid",N=e=>`privy:guest:${e}`,G=e=>`privy:cross-app:${e}`,X="privy:state_code",Y="privy:code_verifier",J="privy:headless_oauth",V="privy:oauth_disable_signup",Q=e=>`privy:wallet:${e}`,ee="privy:connectors",te="privy:connections",ae=12e4,re=1,ne="0x1",le=3e4,ie="https://api.moonpay.com/v1",oe="https://api.moonpay.com/v1",se="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",pe="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",ce="deprecated",ue={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-mainnet.rpc.privy.systems"]},alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}},he={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0},de={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"}}},me={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},fe={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-mainnet.rpc.privy.systems"]},blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}}},ge={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0},ye={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},be={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1},we={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://mainnet.rpc.privy.systems"]},alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}},ve={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-mainnet.rpc.privy.systems"]},alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}},Ce={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0},ke={id:137,name:"Polygon Mainnet",network:"polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}},Ee={id:80002,name:"Polygon Amoy",network:"polygon-amoy",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0},We={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{privy:{http:["https://sepolia.rpc.privy.systems"]},alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0},Se={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}},xe=[ue,he,We,we,ve,Ce,ke,Ee,ye,{id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0},{id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}},{id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}},fe,ge,{id:80085,network:"berachain-artio",name:"Berachain Artio",nativeCurrency:{name:"BERA",symbol:"BERA",decimals:18},rpcUrls:{default:{http:["https://berachain-artio.rpc.privy.systems"]},public:{http:["https://berachain-artio.rpc.privy.systems"]}},blockExplorers:{default:{name:"Beratrail",url:"https://artio.beratrail.io"}},testnet:!0},{id:42,network:"lukso",name:"LUKSO",nativeCurrency:{name:"LUKSO",symbol:"LYX",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.lukso.network"],webSocket:["wss://ws-rpc.mainnet.lukso.network"]}},blockExplorers:{default:{name:"LUKSO Mainnet Explorer",url:"https://explorer.execution.mainnet.lukso.network"}}},be,{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},de,me,Se,{id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0},{id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0},{id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}},{id:690,name:"Redstone",network:"redstone",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.redstonechain.com"]},public:{http:["https://rpc.redstonechain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.redstone.xyz/"}}},{id:17069,name:"Garnet Holesky",network:"garnet-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.garnetchain.com"]},public:{http:["https://rpc.garnetchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.garnetchain.com"}}}],Ue=new Set(xe.map((e=>e.id))),Oe={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:"34357d3c125c2bcf2ce2bc3309d98715",rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"all"}},embeddedWallets:{extendedCalldataDecoding:!1},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};let Ae=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","universal_profile","bybit_wallet","wallet_connect","detected_wallets","detected_solana_wallets","detected_ethereum_wallets","rabby_wallet","safe"]),Me=e=>Ae.has(e),Te=(e,t,a)=>a.indexOf(e)===t;const Fe=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(Me).filter(Te):e?e.filter(Me).filter(Te):Oe.appearance.walletList;function Pe(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}function Le(e){let t=e.filter((e=>!Ue.has(e.id)));return xe.concat(t)}function He(e,t){return{...e,rpcUrls:{...e.rpcUrls,privy:{http:[t]}}}}let _e="#FFFFFF";function De(e,t){let a=Math.max(0,Math.min(1,e.toHsl().l+t));return s({...e.toHsl(),l:a})}function Ie({backgroundTheme:e,accentHex:t}){let a;switch(e){case"light":a=_e;break;case"dark":a="#1E1E1D";break;default:a=e}let r=s(a),n=s(t),l=s("#51BA81"),i=s("#FFB74D"),o=s("#EC6351"),p=function(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}(r.getLuminance()),c=De(r,"light"===p?-.04:.11),u=De(r,"light"===p?-.88:.87),h=De(r,"light"===p?-.7:.75),d=De(r,"light"===p?-.43:.45).desaturate("light"===p?60:20),m=De(r,"light"===p?-.08:.25).desaturate("light"===p?60:20),f=De(n,.15),g=De(n,-.06),y=De(o,.3),b=De(i,.3),w=s(n.getLuminance()>.5?"#040217":_e),v=De(l,-.16),C=De(l,.4);return{colorScheme:p,background:r.toHslString(),background2:c.toHslString(),foreground:u.toHslString(),foreground2:h.toHslString(),foreground3:d.toHslString(),foreground4:m.toHslString(),accent:n.toHslString(),accentLight:f.toHslString(),accentDark:g.toHslString(),foregroundAccent:w.toHslString(),success:l.toHslString(),successDark:v.toHslString(),successLight:C.toHslString(),error:o.toHslString(),errorLight:y.toHslString(),warn:i.toHslString(),warnLight:b.toHslString()}}function je(e,t,a){let r,n,l,i,o,s,p,c,u,h,d,m,f,g,y,b,w=a?console.warn:()=>{};t?.loginMethods?(r=t.loginMethods.includes("email"),n=t.loginMethods.includes("sms"),i=t.loginMethods.includes("wallet"),o=t.loginMethods.includes("google"),s=t.loginMethods.includes("twitter"),p=t.loginMethods.includes("discord"),u=t.loginMethods.includes("spotify"),h=t.loginMethods.includes("instagram"),c=t.loginMethods.includes("tiktok"),m=t.loginMethods.includes("github"),d=t.loginMethods.includes("linkedin"),f=t.loginMethods.includes("apple"),g=t.loginMethods.includes("farcaster"),y=t.loginMethods.includes("telegram")):(r=e.emailAuth,n=e.smsAuth,i=e.walletAuth||e.solanaWalletAuth,o=e.googleOAuth,s=e.twitterOAuth,p=e.discordOAuth,m=e.githubOAuth,u=e.spotifyOAuth,h=e.instagramOAuth,c=e.tiktokOAuth,d=e.linkedinOAuth,f=e.appleOAuth,g=e.farcasterAuth,y=e.telegramAuth),"undefined"!=typeof window&&"function"!=typeof window.PublicKeyCredential?l=!1:e.passkeyAuth&&(l=!0);let v=[r,n].filter(Boolean),C=[o,s,p,m,u,h,c,d,f,g,y].filter(Boolean),k=[i].filter(Boolean);if(v.length+C.length+k.length===0)throw Error("You must enable at least one login method");let E=void 0!==t?.appearance?.showWalletLoginFirst?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;E&&0===k.length?(w("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),E=!1):E||C.length+v.length!==0||(w("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),E=!0);let W=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&w("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let S=Fe({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),x=(({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],a=[];for(let a of(e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`"),e.primary.slice(1)))t.includes(a)?console.warn(`Duplicated login method: ${a}`):t.push(a);for(let r of e.overflow??[])t.includes(r)||a.includes(r)?console.warn(`Duplicated login method: ${r}`):a.push(r);return{primary:t,overflow:a}})({input:t?.loginMethodsAndOrder}),U=t?.intl?.defaultCountry??"US",{chains:O,defaultChain:A}=function({additionalChains:e,supportedChains:t,defaultChainFromConfig:a,hasRpcConfigDefined:r}){let n;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(0===t.length)throw Error("`supportedChains` must contain at least one chain");t.filter((e=>e.rpcUrls.privyWalletOverride)).length>0&&r&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),n=t.map((e=>{if(e.rpcUrls.privyWalletOverride)return e;let t=xe.find((t=>t.id===e.id)),a=t?.rpcUrls.privy?.http[0];return a?He(e,a):e}))}else n=xe.concat(e??[]);let l=t?n[0]:we,i=a??l;if(!n.find((e=>e.id===i.id)))throw Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:i}}({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),M=!!t?.defaultChain,T=t?.customAuth?.getCustomAccessToken&&!1!==t?.customAuth?.enabled,F=!(e.enforceWalletUis??1);if(b=e.legacyWalletUiConfig??1?T?t?.embeddedWallets?.noPromptOnSignature??!0:t?.embeddedWallets?.noPromptOnSignature??F:F,!1===t?.embeddedWallets?.waitForTransactionConfirmation&&!0!==b)throw Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:P,...L}=t?.embeddedWallets??{};return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,landingHeader:t?.appearance?.landingHeader??Oe.appearance.landingHeader,loginMessage:"string"==typeof t?.appearance?.loginMessage?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,palette:Ie({backgroundTheme:t?.appearance?.theme??Oe.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Oe.appearance.accentColor}),loginGroupPriority:E?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:S,walletChainType:t?.appearance?.walletChainType??(({evmWalletAuth:e,solanaWalletAuth:t})=>e&&t?"ethereum-and-solana":e?"ethereum-only":t?"solana-only":"ethereum-only")({evmWalletAuth:e.walletAuth??!1,solanaWalletAuth:e.solanaWalletAuth??!1})},loginMethods:{wallet:i,email:r,sms:n,passkey:l,google:o,twitter:s,discord:p,github:m,spotify:u,instagram:h,tiktok:c,linkedin:d,apple:f,farcaster:g,telegram:y},disablePlusEmails:e.disablePlusEmails,loginMethodsAndOrder:x,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Oe.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Oe.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Oe.rpcConfig.rpcTimeouts},chains:O,defaultChain:A,intl:{defaultCountry:U},shouldEnforceDefaultChainOnConnect:M,captchaEnabled:e.captchaEnabled??Oe.captchaEnabled,captchaSiteKey:e.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??Oe.externalWallets.coinbaseWallet.connectionOptions},walletConnect:{enabled:W},solana:{connectors:t?.externalWallets?.solana?.connectors}},embeddedWallets:{...e.embeddedWalletConfig,..."boolean"==typeof P?{requireUserOwnedRecoveryOnCreate:P}:{},...T?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...L,noPromptOnSignature:b,showWalletUIs:t?.embeddedWallets?.showWalletUIs,extendedCalldataDecoding:t?.embeddedWallets?.extendedCalldataDecoding},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:T?{enabled:!0,...t.customAuth}:void 0,loginConfig:{telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{standalone:t?._render?.standalone??Oe._render.standalone},fundingConfig:e.fundingConfig,fundingMethodConfig:{...t?.fundingMethodConfig??Oe.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??Oe.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??t?.fiatOnRamp?.useSandbox??Oe.fundingMethodConfig.moonpay.useSandbox}}}}let Be={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,disablePlusEmails:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""};const ze=je(Be,void 0,!1);let Re=o({appConfig:ze,isServerConfigLoaded:!1});const Ke=({children:e,legacyCreateEmbeddedWalletFlag:t,client:i,clientConfig:o})=>{let[s,p]=r(null),c=n((()=>je(s??Be,o,!!s)),[s,o]);return l((()=>{if(!s)return;let e=function(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:a,additionalChains:r,supportedChains:n,defaultChain:l,externalWallets:i,...o}=e;return{...o,...r?{additionalChains:r.map((e=>e.id))}:void 0,...n?{supportedChains:n.map((e=>e.id))}:void 0,...l?{defaultChain:l.id}:void 0,...i?{walletConnect:i.walletConnect,coinbaseWallet:i.coinbaseWallet,solana:{connectors:i.solana?.connectors?.get().map((e=>e.walletClientType))}}:void 0,legacyCreateEmbeddedWalletFlag:t}}(o,t),a=function(e,t=0){let a=3735928559^t,r=1103547991^t;for(let t,n=0;n<e.length;n++)a=Math.imul(a^(t=e.charCodeAt(n)),2654435761),r=Math.imul(r^t,1597334677);return a=Math.imul(a^a>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),4294967296*(2097151&(r=Math.imul(r^r>>>16,2246822507)^Math.imul(a^a>>>13,3266489909)))+(a>>>0)}(JSON.stringify(e)).toString(),r=`privy:sent:${s.id}:${a}`;localStorage.getItem(r)||(i.createAnalyticsEvent({eventName:"sdk_initialize",payload:e}),localStorage.setItem(r,"t"))}),[o,t,s]),l((()=>{s||(async()=>{try{let e=await i.getServerConfig();e.customApiUrl&&i.updateApiUrl(e.customApiUrl),p(e)}catch(e){console.warn("Error generating app config: ",e)}})()}),[]),a(Re.Provider,{value:{appConfig:c,isServerConfigLoaded:!!s},children:e})},$e=()=>{let{appConfig:e}=i(Re);return e},qe=()=>{let{isServerConfigLoaded:e}=i(Re);return e},Ze=o(null);function Ne(){let e=i(Ze);if(null===e)throw Error("`useWallets` was called outside the PrivyProvider component");return e}export{we as $,L as A,h as B,Y as C,ae as D,g as E,q as F,b as G,J as H,R as I,H as J,C as K,f as L,T as M,Le as N,V as O,re as P,U as Q,B as R,X as S,I as T,ue as U,D as V,le as W,de as X,fe as Y,ye as Z,be as _,A as a,ve as a0,ke as a1,Se as a2,Ne as a3,_ as a4,y as a5,oe as a6,ie as a7,pe as a8,se as a9,m as aa,d as ab,We as ac,Ce as ad,Ee as ae,ge as af,me as ag,he as ah,Ke as ai,qe as aj,Ze as ak,xe as al,Pe as am,He as an,O as ao,ze as ap,M as b,Q as c,ne as d,Ue as e,S as f,N as g,x as h,v as i,ee as j,W as k,u as l,te as m,G as n,$ as o,w as p,ce as q,j as r,k as s,E as t,z as u,K as v,F as w,P as x,Z as y,$e as z};
1
+ import{StaticJsonRpcProvider as e}from"@ethersproject/providers";import{c as t}from"./privy-context-BeqkgOHo.mjs";import{jsx as a}from"react/jsx-runtime";import{useState as r,useMemo as n,useEffect as l,useContext as i,createContext as o}from"react";import s from"tinycolor2";const p=e=>e.isApexWallet?"Apex Wallet":e.isAvalanche?"Core Wallet":e.isBackpack?"Backpack":e.isBifrost?"Bifrost Wallet":e.isBitKeep?"BitKeep":e.isBitski?"Bitski":e.isBlockWallet?"BlockWallet":e.isBraveWallet?"Brave Wallet":e.isClover?"Clover":e.isCoin98?"Coin98 Wallet":e.isCoinbaseWallet?"Coinbase Wallet":e.isDawn?"Dawn Wallet":e.isDefiant?"Defiant":e.isDesig?"Desig Wallet":e.isEnkrypt?"Enkrypt":e.isExodus?"Exodus":e.isFordefi?"Fordefi":e.isFrame?"Frame":e.isFrontier?"Frontier Wallet":e.isGamestop?"GameStop Wallet":e.isHaqqWallet?"HAQQ Wallet":e.isHyperPay?"HyperPay Wallet":e.isImToken?"ImToken":e.isHaloWallet?"Halo Wallet":e.isKuCoinWallet?"KuCoin Wallet":e.isMathWallet?"MathWallet":e.isNovaWallet?"Nova Wallet":e.isOkxWallet||e.isOKExWallet?"OKX Wallet":e.isOneInchIOSWallet||e.isOneInchAndroidWallet?"1inch Wallet":e.isOneKey?"OneKey Wallet":e.isOpera?"Opera":e.isPhantom?"Phantom":e.isPortal?"Ripio Portal":e.isRabby?"Rabby Wallet":e.isRainbow?"Rainbow":e.isSafePal?"SafePal Wallet":e.isStatus?"Status":e.isSubWallet?"SubWallet":e.isTalisman?"Talisman":e.isTally||e.isTaho?"Taho":e.isTokenPocket?"TokenPocket":e.isTokenary?"Tokenary":e.isTrust||e.isTrustWallet?"Trust Wallet":e.isTTWallet?"TTWallet":e.isXDEFI?"XDEFI Wallet":e.isZeal?"Zeal":e.isZerion?"Zerion":e.isMetaMask?"MetaMask":void 0,c=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||"MetaMask"!==p(e))return!1;if(e.providers)for(let t of e.providers)if(!c(t))return!1;return!0},u=()=>{if("phantom"in window){let e=window;if(e?.phantom?.ethereum?.isPhantom&&e?.phantom?.ethereum?.chainId)return!0}return!1},h=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers)for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0;return!1},d=(e,t)=>{let a=[],r=[];for(let[n,l]of e.entries())n<t?a.push(l):r.push(l);return[a,r]},m=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),f=(e,t)=>{let a=e.slice(0),r=[];for(;a.length;)r.push(a.splice(0,t));return r},g=(e,t=3,a=4,r="ethereum")=>{if(!e)return"";let n="ethereum"===r?2:0;return t+a+n+3>=e.length?e:`${e.slice(0,n+t)}...${e.slice(e.length-a,e.length)}`},y=(e,t=3,a=4)=>g(e,t,a,"solana"),b=e=>new Promise((t=>setTimeout(t,e)));function w(e,{interval:t=100,timeout:a=5e3}={}){return new Promise(((r,n)=>{let l,i=0,o=()=>{i>=a?n("Max attempts reached without result"):(l=e(),i+=t,null==l?setTimeout(o,t):r(l))};o()}))}const v=(e,t={})=>{let a=t.delayMs||150,r=t.maxAttempts||270;return new Promise((async(n,l)=>{let i=!1,o=0;for(;!i&&o<r;){if(t.abortSignal?.aborted)return;e().then((e=>{i=!0,n(e)}),((...e)=>{i=!0,l(...e)})),o+=1,await b(a)}i||l(Error("Exceeded max attempts before resolving function"))}))},C=(e,t,a={},r={})=>{let n=new URL(t,e);for(let[e,t]of Object.entries(a))void 0!==t&&n.searchParams.set(e,t);let l=Object.entries(r);if(l.length>0){let e=new URLSearchParams;for(let[t,a]of l)e.append(t,a);n.hash=e.toString()}return n.href},k=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),E=e=>"string"==typeof e?e:"0x"+e.toString(16);async function W({store:e,walletList:t,externalWalletConfig:a,walletChainType:r,timeout:n=3e3}){let l=!1,i=window;return new Promise((o=>{function s(){if(l)return;l=!0,window.removeEventListener("ethereum#initialized",s);let n=e.getProviders();console.debug("Detected injected providers:",n.map((e=>e.info)));let i=[];for(let e of n)t.includes("coinbase_wallet")&&"com.coinbase.wallet"===e.info.rdns||"solana-only"===r&&"app.phantom"===e.info.rdns||i.push({type:e.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:e});if("solana-only"!==r)for(let e of function(){let e=window,t=e.ethereum;if(!t)return[];let a=[];if(t.providers?.length)for(let e of t.providers)e&&a.push(e);return a.push(e.ethereum),a}()){let t=p(e);if(!n.some((e=>e.info.name===t))){if(c(e,!0)&&!i.find((e=>"metamask"===e.type))){i.push({type:"metamask",legacyInjectedProvider:e});continue}if("Phantom"===t&&!i.find((e=>"phantom"===e.type))){i.push({type:"phantom",legacyInjectedProvider:e});continue}if("Coinbase Wallet"===t&&!i.find((e=>"coinbase_wallet"===e.type&&"smartWalletOnly"!==a.coinbaseWallet?.connectionOptions))){i.push({type:"coinbase_wallet",legacyInjectedProvider:e});continue}i.find((e=>"unknown_browser_extension"===e.type))||i.push({type:"unknown_browser_extension",legacyInjectedProvider:e})}}o(i)}i.ethereum?s():(window.addEventListener("ethereum#initialized",s,{once:!0}),setTimeout((()=>{s()}),n))}))}function S(e){return`eip155:${String(Number(e))}`}const x=(e,a,r,n)=>{let l=Number(e),i=a.find((e=>e.id===l));if(!i)throw new t(`Unsupported chainId ${e}`,4901);return U(i,r,n)},U=(e,a,r)=>{let n,l=e.id,i=Number(e.id);if(e.rpcUrls.privyWalletOverride&&e.rpcUrls.privyWalletOverride.http[0])n=e.rpcUrls.privyWalletOverride.http[0];else if(a.rpcUrls&&a.rpcUrls[i])n=a.rpcUrls[i];else if(e.rpcUrls.privy?.http[0]){let t=new URL(e.rpcUrls.privy.http[0]);t.searchParams.append("privyAppId",r),n=t.toString()}else n=e.rpcUrls.public?.http[0]?e.rpcUrls.public.http[0]:e.rpcUrls.default?.http[0];if(!n)throw new t(`No RPC url found for ${l}`);return n},O=(e,a)=>{let r=Number(e),n=a.find((e=>e.id===r));if(!n)throw new t(`Unsupported chainId ${e}`,4901);return n.blockExplorers?.default.url},A=(a,r,n,l)=>{let i=Number(a),o=r.find((e=>e.id===i));if(!o)throw new t(`Unsupported chainId ${a}`,4901);return new e(o.rpcUrls.privyWalletOverride&&o.rpcUrls.privyWalletOverride.http[0]?o.rpcUrls.privyWalletOverride.http[0]:n.rpcUrls&&n.rpcUrls[i]?n.rpcUrls[i]:o.rpcUrls.privy?.http[0]?{url:o.rpcUrls.privy.http[0],headers:{"privy-app-id":l.appId}}:o.rpcUrls.public?.http[0]?o.rpcUrls.public.http[0]:o.rpcUrls.default?.http[0])},M=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},a=e.types.EIP712Domain??Object.entries(e.domain).map((([e,a])=>{if(null!=a&&"string"==typeof e&&e in t)return{name:e,type:t[e]}})).filter((e=>void 0!==e));return{...e,types:{...e.types,EIP712Domain:a}}};function T(e,{min:t,max:a}){return Math.min(Math.max(e,t),a)}const F="https://auth.privy.io",P=2e4,L=1400,H=2500,_=4e3,D="1.93.0",I="privy:token",j="privy-token",B="privy:refresh_token",z="privy-refresh-token",R="privy:id_token",K="privy-id-token",$="privy-session",q="privy:session_transfer_token",Z="privy:caid",N=e=>`privy:guest:${e}`,G=e=>`privy:cross-app:${e}`,X="privy:state_code",Y="privy:code_verifier",J="privy:headless_oauth",V="privy:oauth_disable_signup",Q=e=>`privy:wallet:${e}`,ee="privy:connectors",te="privy:connections",ae=12e4,re=1,ne="0x1",le=3e4,ie="https://api.moonpay.com/v1",oe="https://api.moonpay.com/v1",se="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",pe="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",ce="deprecated",ue={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-mainnet.rpc.privy.systems"]},alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}},he={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0},de={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"}}},me={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},fe={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-mainnet.rpc.privy.systems"]},blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}}},ge={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0},ye={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},be={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1},we={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://mainnet.rpc.privy.systems"]},alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}},ve={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-mainnet.rpc.privy.systems"]},alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}},Ce={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0},ke={id:137,name:"Polygon Mainnet",network:"polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}},Ee={id:80002,name:"Polygon Amoy",network:"polygon-amoy",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0},We={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{privy:{http:["https://sepolia.rpc.privy.systems"]},alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0},Se={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}},xe=[ue,he,We,we,ve,Ce,ke,Ee,ye,{id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0},{id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}},{id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}},fe,ge,{id:80085,network:"berachain-artio",name:"Berachain Artio",nativeCurrency:{name:"BERA",symbol:"BERA",decimals:18},rpcUrls:{default:{http:["https://berachain-artio.rpc.privy.systems"]},public:{http:["https://berachain-artio.rpc.privy.systems"]}},blockExplorers:{default:{name:"Beratrail",url:"https://artio.beratrail.io"}},testnet:!0},{id:42,network:"lukso",name:"LUKSO",nativeCurrency:{name:"LUKSO",symbol:"LYX",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.lukso.network"],webSocket:["wss://ws-rpc.mainnet.lukso.network"]}},blockExplorers:{default:{name:"LUKSO Mainnet Explorer",url:"https://explorer.execution.mainnet.lukso.network"}}},be,{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},de,me,Se,{id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0},{id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0},{id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}},{id:690,name:"Redstone",network:"redstone",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.redstonechain.com"]},public:{http:["https://rpc.redstonechain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.redstone.xyz/"}}},{id:17069,name:"Garnet Holesky",network:"garnet-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.garnetchain.com"]},public:{http:["https://rpc.garnetchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.garnetchain.com"}}}],Ue=new Set(xe.map((e=>e.id))),Oe={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:"34357d3c125c2bcf2ce2bc3309d98715",rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"all"}},embeddedWallets:{extendedCalldataDecoding:!1},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};let Ae=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","universal_profile","bybit_wallet","wallet_connect","detected_wallets","detected_solana_wallets","detected_ethereum_wallets","rabby_wallet","safe"]),Me=e=>Ae.has(e),Te=(e,t,a)=>a.indexOf(e)===t;const Fe=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(Me).filter(Te):e?e.filter(Me).filter(Te):Oe.appearance.walletList;function Pe(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}function Le(e){let t=e.filter((e=>!Ue.has(e.id)));return xe.concat(t)}function He(e,t){return{...e,rpcUrls:{...e.rpcUrls,privy:{http:[t]}}}}let _e="#FFFFFF";function De(e,t){let a=Math.max(0,Math.min(1,e.toHsl().l+t));return s({...e.toHsl(),l:a})}function Ie({backgroundTheme:e,accentHex:t}){let a;switch(e){case"light":a=_e;break;case"dark":a="#1E1E1D";break;default:a=e}let r=s(a),n=s(t),l=s("#51BA81"),i=s("#FFB74D"),o=s("#EC6351"),p=function(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}(r.getLuminance()),c=De(r,"light"===p?-.04:.11),u=De(r,"light"===p?-.88:.87),h=De(r,"light"===p?-.7:.75),d=De(r,"light"===p?-.43:.45).desaturate("light"===p?60:20),m=De(r,"light"===p?-.08:.25).desaturate("light"===p?60:20),f=De(n,.15),g=De(n,-.06),y=De(o,.3),b=De(i,.3),w=s(n.getLuminance()>.5?"#040217":_e),v=De(l,-.16),C=De(l,.4);return{colorScheme:p,background:r.toHslString(),background2:c.toHslString(),foreground:u.toHslString(),foreground2:h.toHslString(),foreground3:d.toHslString(),foreground4:m.toHslString(),accent:n.toHslString(),accentLight:f.toHslString(),accentDark:g.toHslString(),foregroundAccent:w.toHslString(),success:l.toHslString(),successDark:v.toHslString(),successLight:C.toHslString(),error:o.toHslString(),errorLight:y.toHslString(),warn:i.toHslString(),warnLight:b.toHslString()}}function je(e,t,a){let r,n,l,i,o,s,p,c,u,h,d,m,f,g,y,b,w=a?console.warn:()=>{};t?.loginMethods?(r=t.loginMethods.includes("email"),n=t.loginMethods.includes("sms"),i=t.loginMethods.includes("wallet"),o=t.loginMethods.includes("google"),s=t.loginMethods.includes("twitter"),p=t.loginMethods.includes("discord"),u=t.loginMethods.includes("spotify"),h=t.loginMethods.includes("instagram"),c=t.loginMethods.includes("tiktok"),m=t.loginMethods.includes("github"),d=t.loginMethods.includes("linkedin"),f=t.loginMethods.includes("apple"),g=t.loginMethods.includes("farcaster"),y=t.loginMethods.includes("telegram")):(r=e.emailAuth,n=e.smsAuth,i=e.walletAuth||e.solanaWalletAuth,o=e.googleOAuth,s=e.twitterOAuth,p=e.discordOAuth,m=e.githubOAuth,u=e.spotifyOAuth,h=e.instagramOAuth,c=e.tiktokOAuth,d=e.linkedinOAuth,f=e.appleOAuth,g=e.farcasterAuth,y=e.telegramAuth),"undefined"!=typeof window&&"function"!=typeof window.PublicKeyCredential?l=!1:e.passkeyAuth&&(l=!0);let v=[r,n].filter(Boolean),C=[o,s,p,m,u,h,c,d,f,g,y].filter(Boolean),k=[i].filter(Boolean);if(v.length+C.length+k.length===0)throw Error("You must enable at least one login method");let E=void 0!==t?.appearance?.showWalletLoginFirst?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;E&&0===k.length?(w("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),E=!1):E||C.length+v.length!==0||(w("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),E=!0);let W=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&w("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let S=Fe({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),x=(({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],a=[];for(let a of(e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`"),e.primary.slice(1)))t.includes(a)?console.warn(`Duplicated login method: ${a}`):t.push(a);for(let r of e.overflow??[])t.includes(r)||a.includes(r)?console.warn(`Duplicated login method: ${r}`):a.push(r);return{primary:t,overflow:a}})({input:t?.loginMethodsAndOrder}),U=t?.intl?.defaultCountry??"US",{chains:O,defaultChain:A}=function({additionalChains:e,supportedChains:t,defaultChainFromConfig:a,hasRpcConfigDefined:r}){let n;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(0===t.length)throw Error("`supportedChains` must contain at least one chain");t.filter((e=>e.rpcUrls.privyWalletOverride)).length>0&&r&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),n=t.map((e=>{if(e.rpcUrls.privyWalletOverride)return e;let t=xe.find((t=>t.id===e.id)),a=t?.rpcUrls.privy?.http[0];return a?He(e,a):e}))}else n=xe.concat(e??[]);let l=t?n[0]:we,i=a??l;if(!n.find((e=>e.id===i.id)))throw Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:i}}({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),M=!!t?.defaultChain,T=t?.customAuth?.getCustomAccessToken&&!1!==t?.customAuth?.enabled,F=!(e.enforceWalletUis??1);if(b=e.legacyWalletUiConfig??1?T?t?.embeddedWallets?.noPromptOnSignature??!0:t?.embeddedWallets?.noPromptOnSignature??F:F,!1===t?.embeddedWallets?.waitForTransactionConfirmation&&!0!==b)throw Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:P,...L}=t?.embeddedWallets??{};return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,landingHeader:t?.appearance?.landingHeader??Oe.appearance.landingHeader,loginMessage:"string"==typeof t?.appearance?.loginMessage?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,palette:Ie({backgroundTheme:t?.appearance?.theme??Oe.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Oe.appearance.accentColor}),loginGroupPriority:E?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:S,walletChainType:t?.appearance?.walletChainType??(({evmWalletAuth:e,solanaWalletAuth:t})=>e&&t?"ethereum-and-solana":e?"ethereum-only":t?"solana-only":"ethereum-only")({evmWalletAuth:e.walletAuth??!1,solanaWalletAuth:e.solanaWalletAuth??!1})},loginMethods:{wallet:i,email:r,sms:n,passkey:l,google:o,twitter:s,discord:p,github:m,spotify:u,instagram:h,tiktok:c,linkedin:d,apple:f,farcaster:g,telegram:y},disablePlusEmails:e.disablePlusEmails,loginMethodsAndOrder:x,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Oe.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Oe.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Oe.rpcConfig.rpcTimeouts},chains:O,defaultChain:A,intl:{defaultCountry:U},shouldEnforceDefaultChainOnConnect:M,captchaEnabled:e.captchaEnabled??Oe.captchaEnabled,captchaSiteKey:e.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??Oe.externalWallets.coinbaseWallet.connectionOptions},walletConnect:{enabled:W},solana:{connectors:t?.externalWallets?.solana?.connectors}},embeddedWallets:{...e.embeddedWalletConfig,..."boolean"==typeof P?{requireUserOwnedRecoveryOnCreate:P}:{},...T?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...L,noPromptOnSignature:b,showWalletUIs:t?.embeddedWallets?.showWalletUIs,extendedCalldataDecoding:t?.embeddedWallets?.extendedCalldataDecoding},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:T?{enabled:!0,...t.customAuth}:void 0,loginConfig:{telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{standalone:t?._render?.standalone??Oe._render.standalone},fundingConfig:e.fundingConfig,fundingMethodConfig:{...t?.fundingMethodConfig??Oe.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??Oe.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??t?.fiatOnRamp?.useSandbox??Oe.fundingMethodConfig.moonpay.useSandbox}}}}let Be={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,disablePlusEmails:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""};const ze=je(Be,void 0,!1);let Re=o({appConfig:ze,isServerConfigLoaded:!1});const Ke=({children:e,legacyCreateEmbeddedWalletFlag:t,client:i,clientConfig:o})=>{let[s,p]=r(null),c=n((()=>je(s??Be,o,!!s)),[s,o]);return l((()=>{if(!s)return;let e=function(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:a,additionalChains:r,supportedChains:n,defaultChain:l,externalWallets:i,...o}=e;return{...o,...r?{additionalChains:r.map((e=>e.id))}:void 0,...n?{supportedChains:n.map((e=>e.id))}:void 0,...l?{defaultChain:l.id}:void 0,...i?{walletConnect:i.walletConnect,coinbaseWallet:i.coinbaseWallet,solana:{connectors:i.solana?.connectors?.get().map((e=>e.walletClientType))}}:void 0,legacyCreateEmbeddedWalletFlag:t}}(o,t),a=function(e,t=0){let a=3735928559^t,r=1103547991^t;for(let t,n=0;n<e.length;n++)a=Math.imul(a^(t=e.charCodeAt(n)),2654435761),r=Math.imul(r^t,1597334677);return a=Math.imul(a^a>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),4294967296*(2097151&(r=Math.imul(r^r>>>16,2246822507)^Math.imul(a^a>>>13,3266489909)))+(a>>>0)}(JSON.stringify(e)).toString(),r=`privy:sent:${s.id}:${a}`;localStorage.getItem(r)||(i.createAnalyticsEvent({eventName:"sdk_initialize",payload:e}),localStorage.setItem(r,"t"))}),[o,t,s]),l((()=>{s||(async()=>{try{let e=await i.getServerConfig();e.customApiUrl&&i.updateApiUrl(e.customApiUrl),p(e)}catch(e){console.warn("Error generating app config: ",e)}})()}),[]),a(Re.Provider,{value:{appConfig:c,isServerConfigLoaded:!!s},children:e})},$e=()=>{let{appConfig:e}=i(Re);return e},qe=()=>{let{isServerConfigLoaded:e}=i(Re);return e},Ze=o(null);function Ne(){let e=i(Ze);if(null===e)throw Error("`useWallets` was called outside the PrivyProvider component");return e}export{we as $,L as A,h as B,Y as C,ae as D,g as E,q as F,b as G,J as H,R as I,H as J,C as K,f as L,T as M,Le as N,V as O,re as P,U as Q,B as R,X as S,I as T,ue as U,D as V,le as W,de as X,fe as Y,ye as Z,be as _,A as a,ve as a0,ke as a1,Se as a2,Ne as a3,_ as a4,y as a5,oe as a6,ie as a7,pe as a8,se as a9,m as aa,d as ab,We as ac,Ce as ad,Ee as ae,ge as af,me as ag,he as ah,Ke as ai,qe as aj,Ze as ak,xe as al,Pe as am,He as an,O as ao,ze as ap,M as b,Q as c,ne as d,Ue as e,S as f,N as g,x as h,v as i,ee as j,W as k,u as l,te as m,G as n,$ as o,w as p,ce as q,j as r,k as s,E as t,z as u,K as v,F as w,P as x,Z as y,$e as z};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@privy-io/react-auth",
3
- "version": "1.92.7",
3
+ "version": "1.93.0",
4
4
  "description": "React client for the Privy Auth API",
5
5
  "keywords": [
6
6
  "authentication",
@@ -93,8 +93,7 @@
93
93
  "lint": "npx eslint",
94
94
  "stories": "cd storybook && vite --port=5702",
95
95
  "test": "jest --testMatch \"**/*(?!.*integration).test.ts(x)?\"",
96
- "test-integration": "jest --testMatch \"**/test/integration/**/*.test.ts(x)?\"",
97
- "test:ci": "npm run test"
96
+ "test-integration": "jest --testMatch \"**/test/integration/**/*.test.ts(x)?\""
98
97
  },
99
98
  "browserslist": [
100
99
  "defaults",
@@ -118,7 +117,7 @@
118
117
  "@heroicons/react": "^2.1.1",
119
118
  "@marsidev/react-turnstile": "^0.4.1",
120
119
  "@metamask/eth-sig-util": "^6.0.0",
121
- "@privy-io/js-sdk-core": "0.30.4",
120
+ "@privy-io/js-sdk-core": "0.32.0",
122
121
  "@simplewebauthn/browser": "^9.0.1",
123
122
  "@solana/wallet-adapter-base": "^0.9.23",
124
123
  "@solana/wallet-standard-wallet-adapter-base": "^1.1.2",
@@ -151,14 +150,14 @@
151
150
  "web3-core-helpers": "^1.8.0"
152
151
  },
153
152
  "devDependencies": {
154
- "@abstract-foundation/agw-client": "0.0.1-beta.11",
153
+ "@abstract-foundation/agw-client": "^0.0.1-beta.14",
155
154
  "@babel/core": "^7.25.2",
156
155
  "@babel/preset-env": "^7.25.3",
157
156
  "@babel/preset-react": "^7.24.7",
158
157
  "@babel/preset-typescript": "^7.24.7",
159
158
  "@jest/globals": "^29.7.0",
160
159
  "@privy-io/eslint-config-custom": "*",
161
- "@privy-io/public-api": "2.12.0",
160
+ "@privy-io/public-api": "2.12.2",
162
161
  "@rollup/plugin-commonjs": "^26.0.1",
163
162
  "@rollup/plugin-node-resolve": "^15.2.3",
164
163
  "@rollup/plugin-replace": "^5.0.5",
@@ -199,7 +198,7 @@
199
198
  "vite": "^5.4.0"
200
199
  },
201
200
  "peerDependencies": {
202
- "@abstract-foundation/agw-client": "0.0.1-beta.11",
201
+ "@abstract-foundation/agw-client": "^0.0.1-beta.14",
203
202
  "@solana/web3.js": "^1.95.3",
204
203
  "react": "^18 || ^19",
205
204
  "react-dom": "^18 || ^19"