@privy-io/react-auth 1.94.1 → 1.94.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +0,0 @@
1
- import{useRef as e,useState as t,useCallback as a}from"react";import{http as n,createPublicClient as r}from"viem";import{P as i,u as o,j as s,w as l}from"./privy-context-2XTbQLV9.mjs";import{U as c,A as p,a4 as d}from"./useWallets-2CoAaSEx.mjs";import{u,g as _,M as m}from"./getEmbeddedConnectedWallet-CrtphMZJ.mjs";import{createSmartAccountClient as g}from"permissionless";import{toLightSmartAccount as b,toBiconomySmartAccount as h,toEcdsaKernelSmartAccount as y,toSafeSmartAccount as v}from"permissionless/accounts";import{createPimlicoClient as f}from"permissionless/clients/pimlico";import{toCoinbaseSmartAccount as I,entryPoint06Address as S,entryPoint07Address as k}from"viem/account-abstraction";import T,{z as w}from"zod";import A from"bs58";import{ethers as E}from"ethers";import{parsePhoneNumber as P}from"libphonenumber-js/max";let j;var O=((j=O||{}).OAUTH_ACCOUNT_SUSPENDED="oauth_account_suspended",j.MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",j.MISSING_OR_INVALID_PRIVY_CLIENT_ID="missing_or_invalid_privy_client_id",j.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",j.MISSING_OR_INVALID_TOKEN="missing_or_invalid_token",j.MISSING_OR_INVALID_MFA="missing_or_invalid_mfa",j.EXPIRED_OR_INVALID_MFA_TOKEN="expired_or_invalid_mfa_token",j.INVALID_DATA="invalid_data",j.INVALID_CREDENTIALS="invalid_credentials",j.INVALID_CAPTCHA="invalid_captcha",j.LINKED_TO_ANOTHER_USER="linked_to_another_user",j.ALLOWLIST_REJECTED="allowlist_rejected",j.CANNOT_UNLINK_EMBEDDED_WALLET="cannot_unlink_embedded_wallet",j.CANNOT_UNLINK_SOLE_ACCOUNT="cannot_unlink_sole_account",j.CANNOT_LINK_MORE_OF_TYPE="cannot_link_more_of_type",j.LINKED_ACCOUNT_NOT_FOUND="linked_account_not_found",j.TOO_MANY_REQUESTS="too_many_requests",j.INVALID_ORIGIN="invalid_origin",j.MISSING_ORIGIN="missing_origin",j.INVALID_NATIVE_APP_ID="invalid_native_app_id",j.TOKEN_ALREADY_USED="token_already_used",j.ALREADY_LOGGED_OUT="already_logged_out",j.NOT_SUPPORTED="not_supported",j.USER_UNSUBSCRIBED="user_unsubscribed",j.MAX_APPS_REACHED="max_apps_reached",j.USER_LIMIT_REACHED="max_accounts_reached",j.DEVICE_REVOKED="device_revoked",j.WALLET_PASSWORD_EXISTS="wallet_password_exists",j.OAUTH_STATE_MISMATCH="oauth_state_mismatch",j.MAX_DENYLIST_ENTRIES_REACHED="max_denylist_entries_reached",j.DISALLOWED_LOGIN_METHOD="disallowed_login_method",j.DISALLOWED_PLUS_EMAIL="disallowed_plus_email",j.DISALLOWED_RECOVERY_METHOD="disallowed_recovery_method",j.LEGACY_DASHBOARD_LOGIN_CONFIGURATION="legacy_dashboard_login_configuration",j.CANNOT_SET_PASSWORD="cannot_set_password",j.INVALID_PKCE_PARAMETERS="invalid_pkce_parameters",j.INVALID_APP_URL_SCHEME_CONFIGURATION="invalid_app_url_scheme_configuration",j.CROSS_APP_CONNECTION_NOT_ALLOWED="cross_app_connection_not_allowed",j.USER_DOES_NOT_EXIST="user_does_not_exist",j.ACCOUNT_TRANSFER_REQUIRED="account_transfer_required",j.USER_HAS_NOT_DELEGATED_WALLET="user_has_not_delegated_wallet",j.FEATURE_NOT_ENABLED="feature_not_enabled",j),C=class extends Error{toString(){return`${this.constructor.name}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(e,t,a,n){super(t),this.code=a,this.status=e,this.responseData=n}},N=class extends C{constructor(e,t){super(400,e,t||"invalid_data")}},R=class extends C{constructor(e,t){super(401,e,t)}},D=class extends C{constructor(e,t){super(422,e,t)}};function x(e,t){return Object.keys(t).forEach((function(a){"default"===a||"__esModule"===a||Object.prototype.hasOwnProperty.call(e,a)||Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[a]}})})),e}function L(e,t,a,n){Object.defineProperty(e,t,{get:a,set:n,enumerable:!0,configurable:!0})}w.object({error:w.string(),cause:w.string().optional(),code:w.nativeEnum(O).optional()});var W={},U={};L(U,"AnalyticsEvent",(()=>M));let M={path:"/api/v1/analytics_events",method:"POST"};var F={};L(F,"AppConfig",(()=>G));let G={path:"/api/v1/apps/:app_id",method:"GET"};var V={};L(V,"CoinbaseOnRampInit",(()=>q)),L(V,"CoinbaseOnRampStatus",(()=>B));let q={path:"/api/v1/funding/coinbase_on_ramp/init",method:"POST"},B={path:"/api/v1/funding/coinbase_on_ramp/status",method:"GET"};var K={};L(K,"GetCrossAppConnections",(()=>$));let $={path:"/api/v1/apps/:app_id/cross-app/connections",method:"GET"};var H={};L(H,"CustomJWTAuthenticate",(()=>z));let z={path:"/api/v1/custom_jwt_account/authenticate",method:"POST"};var Y={};L(Y,"FarcasterInit",(()=>J)),L(Y,"FarcasterAuthenticate",(()=>Q)),L(Y,"FarcasterLink",(()=>X)),L(Y,"FarcasterUnlink",(()=>Z)),L(Y,"FarcasterStatus",(()=>ee));let J={path:"/api/v1/farcaster/init",method:"POST"},Q={path:"/api/v1/farcaster/authenticate",method:"POST"},X={path:"/api/v1/farcaster/link",method:"POST"},Z={path:"/api/v1/farcaster/unlink",method:"POST"},ee={path:"/api/v1/farcaster/status",method:"GET"};var te={};L(te,"FarcasterSignerInit",(()=>ae)),L(te,"FarcasterSignerStatus",(()=>ne));let ae={path:"/api/v1/farcaster/signer/init",method:"POST"},ne={path:"/api/v1/farcaster/signer/status",method:"POST"};var re={};L(re,"GuestAuthenticate",(()=>ie));let ie={path:"/api/v1/guest/authenticate",method:"POST"};var oe={};L(oe,"MfaPasskeyInit",(()=>se)),L(oe,"MfaPasskeyVerify",(()=>le)),L(oe,"MfaPasskeyEnrollment",(()=>ce));let se={path:"/api/v1/mfa/passkeys/init",method:"POST"},le={path:"/api/v1/mfa/passkeys/verify",method:"POST"},ce={path:"/api/v1/mfa/passkeys/enrollment",method:"POST"};var pe={};L(pe,"MfaPasswordlessSmsEnroll",(()=>de)),L(pe,"MfaPasswordlessSmsVerify",(()=>ue)),L(pe,"MfaPasswordlessSmsInit",(()=>_e)),L(pe,"MfaPasswordlessSmsUnenroll",(()=>me));let de={path:"/api/v1/mfa/passwordless_sms/enroll",method:"POST"},ue={path:"/api/v1/mfa/passwordless_sms/verify",method:"POST"},_e={path:"/api/v1/mfa/passwordless_sms/init",method:"POST"},me={path:"/api/v1/mfa/passwordless_sms/unenroll",method:"POST"};var ge={};L(ge,"MfaTotpEnroll",(()=>be)),L(ge,"MfaTotpVerify",(()=>he)),L(ge,"MfaTotpInit",(()=>ye)),L(ge,"MfaTotpUnenroll",(()=>ve));let be={path:"/api/v1/mfa/totp/enroll",method:"POST"},he={path:"/api/v1/mfa/totp/verify",method:"POST"},ye={path:"/api/v1/mfa/totp/init",method:"POST"},ve={path:"/api/v1/mfa/totp/unenroll",method:"POST"};var fe={};L(fe,"OAuthAuthenticate",(()=>Ie)),L(fe,"OAuthInit",(()=>Se)),L(fe,"OAuthLink",(()=>ke)),L(fe,"OAuthUnlink",(()=>Te));let Ie={path:"/api/v1/oauth/authenticate",method:"POST"},Se={path:"/api/v1/oauth/init",method:"POST"},ke={path:"/api/v1/oauth/link",method:"POST"},Te={path:"/api/v1/oauth/unlink",method:"POST"};var we={};L(we,"OAuthProviderAuthorize",(()=>Ae)),L(we,"OAuthProviderVerify",(()=>Ee));let Ae={path:"/oauth/authorization_code",method:"POST"},Ee={path:"/oauth/verify",method:"POST"};var Pe={};L(Pe,"PasskeyLink",(()=>je)),L(Pe,"PasskeyAuthenticate",(()=>Oe)),L(Pe,"PasskeyAuthenticateInit",(()=>Ce)),L(Pe,"PasskeyLinkInit",(()=>Ne)),L(Pe,"PasskeyUnlink",(()=>Re));let je={path:"/api/v1/passkeys/link",method:"POST"},Oe={path:"/api/v1/passkeys/authenticate",method:"POST"},Ce={path:"/api/v1/passkeys/authenticate/init",method:"POST"},Ne={path:"/api/v1/passkeys/link/init",method:"POST"},Re={path:"/api/v1/passkeys/unlink",method:"POST"};var De={};L(De,"PasswordlessAuthenticate",(()=>xe)),L(De,"PasswordlessInit",(()=>Le)),L(De,"PasswordlessLink",(()=>We)),L(De,"PasswordlessUnlink",(()=>Ue)),L(De,"PasswordlessUpdate",(()=>Me));let xe={path:"/api/v1/passwordless/authenticate",method:"POST"},Le={path:"/api/v1/passwordless/init",method:"POST"},We={path:"/api/v1/passwordless/link",method:"POST"},Ue={path:"/api/v1/passwordless/unlink",method:"POST"},Me={path:"/api/v1/passwordless/update",method:"POST"};var Fe={};L(Fe,"PasswordlessSmsAuthenticate",(()=>Ge)),L(Fe,"PasswordlessSmsInit",(()=>Ve)),L(Fe,"PasswordlessSmsLink",(()=>qe)),L(Fe,"PasswordlessSmsUnlink",(()=>Be)),L(Fe,"PasswordlessSmsUpdate",(()=>Ke));let Ge={path:"/api/v1/passwordless_sms/authenticate",method:"POST"},Ve={path:"/api/v1/passwordless_sms/init",method:"POST"},qe={path:"/api/v1/passwordless_sms/link",method:"POST"},Be={path:"/api/v1/passwordless_sms/unlink",method:"POST"},Ke={path:"/api/v1/passwordless_sms/update",method:"POST"};var $e={};L($e,"RecoveryKeyMaterial",(()=>He)),L($e,"RecoveryOAuthInit",(()=>ze)),L($e,"RecoveryOAuthAuthenticate",(()=>Ye)),L($e,"RecoveryOAuthInitICloud",(()=>Je)),L($e,"RecoveryOAuthCallbackICloudExpo",(()=>Qe)),L($e,"RecoveryConfigurationICloud",(()=>Xe));let He={path:"/api/v1/embedded_wallets/:address/recovery/key_material",method:"POST"},ze={path:"/api/v1/recovery/oauth/init",method:"POST"},Ye={path:"/api/v1/recovery/oauth/authenticate",method:"POST"},Je={path:"/api/v1/recovery/oauth/init_icloud",method:"POST"},Qe={path:"/api/v1/recovery/oauth/callback_icloud/:app_id/expo_ios",method:"GET"},Xe={path:"/api/v1/recovery/configuration_icloud",method:"POST"};var Ze={};L(Ze,"getPathWithParams",(()=>et));let et=(e,t)=>t?Object.entries(t).reduce(((e,[t,a])=>e.replace(`:${t}`,`${a}`)),e):e;var tt={};L(tt,"RefreshSession",(()=>at)),L(tt,"Logout",(()=>nt));let at={path:"/api/v1/sessions",method:"POST"},nt={path:"/api/v1/sessions/logout",method:"POST"};var rt={};L(rt,"GetSmartWalletConfig",(()=>it)),L(rt,"PostSmartWalletConfig",(()=>ot));let it={path:"/api/v1/apps/:app_id/smart_wallets",method:"GET"},ot={path:"/api/v1/apps/:app_id/smart_wallets",method:"POST"};var st={};L(st,"SiweInit",(()=>lt)),L(st,"SiweAuthenticate",(()=>ct)),L(st,"SiweLink",(()=>pt)),L(st,"SiweLinkSmartWallet",(()=>dt)),L(st,"SiweUnlink",(()=>ut));let lt={path:"/api/v1/siwe/init",method:"POST"},ct={path:"/api/v1/siwe/authenticate",method:"POST"},pt={path:"/api/v1/siwe/link",method:"POST"},dt={path:"/api/v1/siwe/link_smart_wallet",method:"POST"},ut={path:"/api/v1/siwe/unlink",method:"POST"};var _t={};L(_t,"SiwsInit",(()=>mt)),L(_t,"SiwsAuthenticate",(()=>gt)),L(_t,"SiwsLink",(()=>bt)),L(_t,"SiwsUnlink",(()=>ht));let mt={path:"/api/v1/siws/init",method:"POST"},gt={path:"/api/v1/siws/authenticate",method:"POST"},bt={path:"/api/v1/siws/link",method:"POST"},ht={path:"/api/v1/siws/unlink",method:"POST"};var yt={};L(yt,"AcceptTermsOnUser",(()=>vt));let vt={path:"/api/v1/users/me/accept_terms",method:"POST"};var ft={};L(ft,"TelegramAuthenticate",(()=>It)),L(ft,"TelegramLink",(()=>St)),L(ft,"TelegramUnlink",(()=>kt));let It={path:"/api/v1/telegram/authenticate",method:"POST"},St={path:"/api/v1/telegram/link",method:"POST"},kt={path:"/api/v1/telegram/unlink",method:"POST"};x(W,U),x(W,F),x(W,V),x(W,K),x(W,H),x(W,Y),x(W,te),x(W,re),x(W,oe),x(W,pe),x(W,ge),x(W,fe),x(W,we),x(W,Pe),x(W,De),x(W,Fe),x(W,$e),x(W,Ze),x(W,tt),x(W,rt),x(W,st),x(W,_t),x(W,yt),x(W,ft);var Tt={},wt={};L(wt,"AnalyticsEventInput",(()=>At));let At=w.object({event_name:w.string().max(255),client_id:w.string().max(255).nullable(),payload:w.record(w.any()).optional()});var Et={};L(Et,"AccountIdFromPath",(()=>Mt)),L(Et,"AppIdFromPath",(()=>Ft)),L(Et,"Pagination",(()=>Gt));var Pt={};L(Pt,"UserId",(()=>jt)),L(Pt,"Email",(()=>Ot)),L(Pt,"PasswordlessCode",(()=>Ct)),L(Pt,"WalletAddress",(()=>Nt)),L(Pt,"normalizeEthereumAddress",(()=>Wt)),L(Pt,"SolanaWalletAddress",(()=>Rt)),L(Pt,"PhoneNumber",(()=>Dt)),L(Pt,"normalizePhoneNumber",(()=>xt)),L(Pt,"isValidAddress",(()=>Lt)),L(Pt,"AuthenticateMode",(()=>Ut));let jt=w.string({required_error:"Privy DID must be included",invalid_type_error:"Privy DID is not a valid string"}).min(1).transform((e=>e.replace("did:privy:",""))),Ot=w.string({required_error:"Email address must be provided",invalid_type_error:"Email address must be a valid string"}).email("Invalid email address").transform((e=>e.toLowerCase())),Ct=w.string({required_error:"Verification code must be provided",invalid_type_error:"Invalid verification code"}).length(6,"Verification code must have 6 digits."),Nt=w.string({required_error:"Ethereum address must be provided",invalid_type_error:"Invalid Ethereum address"}).transform(((e,t)=>Wt(e)||(t.addIssue({code:w.ZodIssueCode.custom,message:"Invalid Ethereum address"}),w.NEVER))),Rt=w.string({required_error:"Solana address must be provided",invalid_type_error:"Invalid Solana address"}).trim().transform(((e,t)=>{try{A.decode(e)}catch(e){return t.addIssue({code:w.ZodIssueCode.custom,message:"Invalid Solana address"}),w.NEVER}return e})),Dt=w.string({required_error:"Phone number must be included",invalid_type_error:"Phone number is not a valid string"}).refine((e=>{try{return void 0!==xt(e)}catch(e){return!1}}),{message:"Phone number is not valid"}).transform((e=>xt(e)||""));function xt(e){let t=P(e,"US");if(t?.isPossible())return t.formatInternational()}function Lt(e){return!!Wt(e)}function Wt(e){if("string"==typeof e)try{return E.utils.getAddress(e.trim())}catch(e){}}let Ut=w.object({mode:w.enum(["no-signup","login-or-sign-up"]).optional()}),Mt=w.object({account_id:w.string({required_error:"Account ID must be provided",invalid_type_error:"Account ID is not a valid string"}).min(1)}),Ft=w.object({app_id:w.string({required_error:"App ID must be provided",invalid_type_error:"App ID is not a valid string"}).min(1)}).transform((({app_id:e})=>({app_id:e,appId:e}))).catch((({error:e})=>{throw new N(e.message,O.MISSING_OR_INVALID_PRIVY_APP_ID)})),Gt=w.object({cursor:jt.optional(),limit:w.coerce.number().max(100,{message:"Query limit can be at maximum 100 records."}).optional()});var Vt={};L(Vt,"AppResponseSchema",(()=>Jt));var qt={};L(qt,"EmbeddedWalletConfigSchema",(()=>Kt)),L(qt,"TelegramAuthConfigSchema",(()=>$t)),L(qt,"FundingMethodEnum",(()=>Ht)),L(qt,"FundingMethodArraySchema",(()=>zt)),L(qt,"FundingConfigSchema",(()=>Yt));let Bt=T.object({chain:T.string(),asset:T.enum(["native-currency","USDC"]).optional()}),Kt=T.object({create_on_login:T.enum(["users-without-wallets","all-users","off"]),user_owned_recovery_options:T.array(T.enum(["user-passcode","google-drive","icloud"])),require_user_owned_recovery_on_create:T.boolean().optional(),require_user_password_on_create:T.boolean().optional()}),$t=T.object({bot_id:T.string(),bot_name:T.string(),link_enabled:T.boolean(),seamless_auth_enabled:T.boolean()}),Ht=T.enum(["moonpay","coinbase-onramp","external"]),zt=T.array(Ht),Yt=T.object({default_recommended_currency:Bt,default_recommended_amount:T.string(),methods:zt,prompt_funding_on_wallet_creation:T.boolean(),cross_chain_bridging_enabled:T.boolean()}),Jt=w.object({id:w.string(),name:w.string(),logo_url:w.string().nullable(),icon_url:w.string().nullable(),terms_and_conditions_url:w.string().nullable(),privacy_policy_url:w.string().nullable(),require_users_accept_terms:w.boolean().nullable(),theme:w.string(),accent_color:w.string().nullable(),show_wallet_login_first:w.boolean(),allowed_domains:w.array(w.string()),allowed_native_app_ids:w.array(w.string()),allowed_native_app_url_schemes:w.array(w.string()),wallet_auth:w.boolean(),email_auth:w.boolean(),sms_auth:w.boolean(),google_oauth:w.boolean(),twitter_oauth:w.boolean(),discord_oauth:w.boolean(),github_oauth:w.boolean(),spotify_oauth:w.boolean(),instagram_oauth:w.boolean(),tiktok_oauth:w.boolean(),linkedin_oauth:w.boolean(),apple_oauth:w.boolean(),farcaster_auth:w.boolean(),passkey_auth:w.boolean(),telegram_auth:w.boolean(),guest_auth:w.boolean(),solana_wallet_auth:w.boolean(),disable_plus_emails:w.boolean(),allowlist_enabled:w.boolean(),allowlist_config:w.object({error_title:w.string().nullable(),error_detail:w.string().nullable(),cta_text:w.string().nullable(),cta_link:w.string().nullable()}),wallet_connect_cloud_project_id:w.string().nullable(),custom_api_url:w.string().nullable(),embedded_wallet_config:Kt,enforce_wallet_uis:w.boolean(),legacy_wallet_ui_config:w.boolean(),fiat_on_ramp_enabled:w.boolean(),captcha_enabled:w.boolean(),twitter_oauth_on_mobile_enabled:w.boolean(),mfa_methods:w.array(w.enum(["sms","totp","passkey"])),captcha_site_key:w.string().optional(),verification_key:w.string(),telegram_auth_config:$t.optional(),funding_config:Yt.optional(),max_linked_wallets_per_user:w.number().nullable(),farcaster_link_wallets_enabled:w.boolean()});var Qt={};L(Qt,"CoinbaseOnRampInitInput",(()=>na)),L(Qt,"CoinbaseOnRampInitResponse",(()=>ra)),L(Qt,"CoinbaseOnRampStatusResponse",(()=>ia));let Xt=w.enum(["ethereum","bitcoin","base","avacchain","optimism","solana","polygon","arbitrum","stellar"]),Zt=w.enum(["eth","ETH","USDC"]).transform((e=>e.toUpperCase())),ea=w.enum(["SOL"]).transform((e=>e.toUpperCase())),ta=w.object({addresses:w.array(w.object({address:Nt,blockchains:w.array(Xt)})).max(1).min(1),assets:w.array(Zt).optional()}),aa=w.object({addresses:w.array(w.object({address:Rt,blockchains:w.array(Xt)})).max(1).min(1),assets:w.array(ea).optional()}),na=w.union([ta,aa]),ra=w.object({app_id:w.string(),session_token:w.string(),channel_id:w.string(),partner_user_id:w.string()}),ia=w.object({status:w.enum(["pending","success","failure"])});var oa={};L(oa,"CrossAppConnectionsResponse",(()=>sa));let sa=w.object({connections:w.array(w.object({provider_app_id:w.string(),provider_app_name:w.string(),provider_app_icon_url:w.string().url().nullable(),provider_app_custom_api_url:w.string().url().nullable(),read_only:w.boolean()}))});var la={};L(la,"AuthenticateJwtInput",(()=>ca));let ca=T.object({token:T.string().optional()});var pa={};L(pa,"VerifyEmailInput",(()=>ua)),L(pa,"AuthenticateEmailInput",(()=>_a)),L(pa,"InitEmailInput",(()=>ma)),L(pa,"UnlinkEmailInput",(()=>ga)),L(pa,"UpdateEmailInput",(()=>ba)),L(pa,"TransferEmailInput",(()=>ha));let da=w.object({nonce:w.string()}),ua=w.object({code:Ct,email:Ot}),_a=ua.merge(Ut),ma=w.object({email:Ot,token:w.string().optional()}),ga=w.object({address:Ot}),ba=w.object({oldAddress:Ot,newAddress:Ot,code:Ct}),ha=da.extend({email:Ot});var ya={};L(ya,"JsonWebKey",(()=>va)),L(ya,"JsonWebKeySet",(()=>fa));let va=w.object({kty:w.string(),use:w.enum(["sig","enc"]).optional(),key_ops:w.array(w.enum(["sign","verify","encrypt","decrypt","wrapKey","unwrapKey","deriveKey","deriveBits"])).optional(),alg:w.enum(["RS256"]),kid:w.string().optional(),x5u:w.string().optional(),x5c:w.array(w.string()).optional(),x5t:w.string().optional(),"x5t#S256":w.string().optional(),n:w.string().optional(),e:w.string().optional(),d:w.string().optional()}),fa=w.object({keys:w.array(va)});var Ia={};L(Ia,"FarcasterConnectInitResponse",(()=>Sa)),L(Ia,"FarcasterConnectStatusCompletedResponse",(()=>ka)),L(Ia,"FarcasterConnectStatusPendingResponse",(()=>Ta)),L(Ia,"FarcasterAuthenticateInput",(()=>wa)),L(Ia,"FarcasterLinkInput",(()=>Aa)),L(Ia,"FarcasterInitInput",(()=>Ea)),L(Ia,"FarcasterUnlinkInput",(()=>Pa)),L(Ia,"TransferFarcasterInput",(()=>ja));let Sa=w.object({channel_token:w.string(),connect_uri:w.string()}),ka=w.object({state:w.literal("completed"),nonce:w.string(),message:w.string(),signature:w.string(),fid:w.number(),username:w.string(),display_name:w.string(),bio:w.string(),pfp_url:w.string()}),Ta=w.object({state:w.literal("pending"),nonce:w.string()}),wa=w.object({channel_token:w.string(),message:w.string(),signature:w.string(),fid:w.number()}).merge(Ut),Aa=w.object({channel_token:w.string(),message:w.string(),signature:w.string(),fid:w.number()}),Ea=w.object({token:w.string().optional(),redirect_url:w.string().url().optional(),relying_party:w.string().optional()}),Pa=w.object({fid:w.number()}),ja=da.extend({farcaster_id:w.string(),farcaster_embedded_address:w.string()});var Oa={};L(Oa,"FarcasterSignerInitInput",(()=>Ca)),L(Oa,"FarcasterSignerInitResponse",(()=>Na)),L(Oa,"FarcasterSignerStatusResponse",(()=>Ra));let Ca=w.object({ed25519_public_key:w.string().refine((e=>e.startsWith("0x")&&66===e.length)),deadline:w.bigint().optional().default((()=>BigInt(Math.floor(Date.now()/1e3)+3600)))}),Na=w.discriminatedUnion("status",[w.object({public_key:w.string(),status:w.literal("pending_approval"),signer_approval_url:w.string()}),w.object({public_key:w.string(),status:w.literal("approved"),fid:w.bigint()}),w.object({public_key:w.string(),status:w.literal("revoked"),fid:w.bigint()})]),Ra=w.discriminatedUnion("status",[w.object({public_key:w.string(),status:w.literal("pending_approval")}),w.object({public_key:w.string(),status:w.literal("approved"),fid:w.bigint()}),w.object({public_key:w.string(),status:w.literal("revoked"),fid:w.bigint()})]);var Da={};L(Da,"AuthenticateGuestInput",(()=>xa));let xa=w.object({guest_credential:w.string().length(43)}).strict();var La={};L(La,"EmailIdTokenEntry",(()=>Gn)),L(La,"PhoneIdTokenEntry",(()=>Vn)),L(La,"EthereumIdTokenEntry",(()=>qn)),L(La,"SolanaIdTokenEntry",(()=>Bn)),L(La,"FarcasterIdTokenEntry",(()=>Kn)),L(La,"PasskeyIdTokenEntry",(()=>$n)),L(La,"TelegramIdTokenEntry",(()=>Hn)),L(La,"EthereumEmbeddedWalletIdTokenEntry",(()=>zn)),L(La,"SolanaEmbeddedWalletIdTokenEntry",(()=>Yn)),L(La,"GoogleOauthIdTokenEntry",(()=>Jn)),L(La,"TwitterOauthIdTokenEntry",(()=>Qn)),L(La,"DiscordOauthIdTokenEntry",(()=>Xn)),L(La,"GithubOauthIdTokenEntry",(()=>Zn)),L(La,"LinkedInOauthIdTokenEntry",(()=>er)),L(La,"SpotifyOauthIdTokenEntry",(()=>tr)),L(La,"InstagramOauthIdTokenEntry",(()=>ar)),L(La,"TiktokOauthIdTokenEntry",(()=>nr)),L(La,"AppleOauthIdTokenEntry",(()=>rr)),L(La,"CustomJwtIdTokenEntry",(()=>ir)),L(La,"CrossAppIdTokenEntry",(()=>or)),L(La,"SmartWalletIdTokenEntry",(()=>sr));var Wa={};L(Wa,"EmailAccount",(()=>Za)),L(Wa,"PhoneAccount",(()=>en)),L(Wa,"BaseWalletAccount",(()=>tn)),L(Wa,"EthereumAccount",(()=>an)),L(Wa,"SmartWalletAccount",(()=>nn)),L(Wa,"SolanaAccount",(()=>rn)),L(Wa,"FarcasterAccount",(()=>on)),L(Wa,"PasskeyAccount",(()=>sn)),L(Wa,"TelegramAccount",(()=>ln)),L(Wa,"EthereumEmbeddedWalletAccount",(()=>dn)),L(Wa,"SolanaEmbeddedWalletAccount",(()=>un)),L(Wa,"BitcoinSegwitEmbeddedWalletAccount",(()=>_n)),L(Wa,"BitcoinTaprootEmbeddedWalletAccount",(()=>mn)),L(Wa,"GoogleOauthAccount",(()=>gn)),L(Wa,"TwitterOauthAccount",(()=>bn)),L(Wa,"DiscordOauthAccount",(()=>hn)),L(Wa,"GithubOauthAccount",(()=>yn)),L(Wa,"LinkedInOauthAccount",(()=>vn)),L(Wa,"SpotifyOauthAccount",(()=>fn)),L(Wa,"InstagramOauthAccount",(()=>In)),L(Wa,"TiktokOauthAccount",(()=>Sn)),L(Wa,"AppleOauthAccount",(()=>kn)),L(Wa,"CustomJwtAccount",(()=>Tn)),L(Wa,"CrossAppEmbeddedWallet",(()=>wn)),L(Wa,"CrossAppSmartWallet",(()=>An)),L(Wa,"CrossAppAccount",(()=>En)),L(Wa,"LinkedAccount",(()=>Pn)),L(Wa,"SmsMfaMethod",(()=>jn)),L(Wa,"TotpMfaMethod",(()=>On)),L(Wa,"PasskeyMfaMethod",(()=>Cn)),L(Wa,"LinkedMfaMethod",(()=>Nn)),L(Wa,"CustomMetadata",(()=>Rn)),L(Wa,"OAuthTokens",(()=>Dn)),L(Wa,"User",(()=>xn)),L(Wa,"SessionUpdateActionEnum",(()=>Ln)),L(Wa,"AuthenticatedUser",(()=>Wn)),L(Wa,"LoggedOutUser",(()=>Un)),L(Wa,"MaybeUser",(()=>Mn));var Ua={};L(Ua,"SmartWalletProvider",(()=>Ka)),L(Ua,"AlchemyPaymasterContextSchema",(()=>Ha)),L(Ua,"SmartWalletNetworkConfigurationInputSchema",(()=>Ya)),L(Ua,"SmartWalletConfigurationSchema",(()=>Ja)),L(Ua,"SmartWalletConfigurationInputSchema",(()=>Qa)),L(Ua,"SmartWalletConfigurationResponseSchema",(()=>Xa)),L(Ua,"SAFE",(()=>Ma)),L(Ua,"KERNEL",(()=>Fa)),L(Ua,"LIGHT_ACCOUNT",(()=>Va)),L(Ua,"BICONOMY",(()=>Ga)),L(Ua,"COINBASE_SMART_WALLET",(()=>qa)),L(Ua,"SUPPORTED_SMART_WALLET_TYPES",(()=>Ba));let Ma="safe",Fa="kernel",Ga="biconomy",Va="light_account",qa="coinbase_smart_wallet",Ba=[Ma,Fa,Ga,Va,qa],Ka=w.enum(Ba,{invalid_type_error:"Please specify a supported provider.",required_error:"Please specify a supported provider."}),$a=w.string().regex(/^eip155:\d+$/,"Chain ID must be an eip155 chain ID"),Ha=w.object({policy_id:w.string().uuid()}),za=w.object({chain_id:$a,bundler_url:w.string(),paymaster_url:w.string().optional(),rpc_url:w.string().optional(),chain_name:w.string().optional(),paymaster_context:Ha.optional()}),Ya=w.object({chain_id:$a,bundler_url:w.string().optional(),paymaster_url:w.string().optional(),rpc_url:w.string().optional(),chain_name:w.string().optional(),paymaster_context:Ha.optional()}),Ja=w.discriminatedUnion("enabled",[w.object({enabled:w.literal(!1)}),w.object({enabled:w.literal(!0),smart_wallet_type:Ka,configured_networks:w.array(za).min(1)})]),Qa=w.discriminatedUnion("enabled",[w.object({enabled:w.literal(!1)}),w.object({enabled:w.literal(!0),smart_wallet_type:Ka,configured_networks:w.array(Ya).min(1)})]),Xa=Ja,Za=w.object({type:w.literal("email"),address:w.string(),verified_at:w.number(),first_verified_at:w.number().nullable(),latest_verified_at:w.number().nullable()}),en=w.object({type:w.literal("phone"),phoneNumber:w.string(),verified_at:w.number(),first_verified_at:w.number().nullable(),latest_verified_at:w.number().nullable()}),tn=w.object({type:w.enum(["wallet","smart_wallet"]),address:w.string(),chain_type:w.enum(["solana","ethereum"])}),an=w.object({type:w.literal("wallet"),address:w.string(),chain_id:w.string().optional(),chain_type:w.literal("ethereum"),wallet_client:w.literal("unknown"),wallet_client_type:w.string().optional(),connector_type:w.string().optional(),verified_at:w.number(),first_verified_at:w.number().nullable(),latest_verified_at:w.number().nullable()}),nn=w.object({type:w.literal("smart_wallet"),address:w.string(),smart_wallet_type:Ka,verified_at:w.number(),first_verified_at:w.number().nullable(),latest_verified_at:w.number().nullable()}),rn=w.object({type:w.literal("wallet"),address:w.string(),chain_type:w.literal("solana"),wallet_client:w.literal("unknown"),wallet_client_type:w.string().optional(),connector_type:w.string().optional(),verified_at:w.number(),first_verified_at:w.number().nullable(),latest_verified_at:w.number().nullable()}),on=w.object({type:w.literal("farcaster"),fid:w.number(),owner_address:Nt,username:w.string().optional(),display_name:w.string().optional(),bio:w.string().optional(),profile_picture:w.string().optional(),profile_picture_url:w.string().optional(),homepage_url:w.string().optional(),verified_at:w.number(),first_verified_at:w.number().nullable(),latest_verified_at:w.number().nullable(),signer_public_key:w.string().optional()}),sn=w.object({type:w.literal("passkey"),created_with_browser:w.string().optional(),created_with_os:w.string().optional(),created_with_device:w.string().optional(),credential_id:w.string(),authenticator_name:w.string().optional(),enrolled_in_mfa:w.boolean(),verified_at:w.number(),first_verified_at:w.number().nullable(),latest_verified_at:w.number().nullable()}),ln=w.object({type:w.literal("telegram"),telegram_user_id:w.string(),first_name:w.string().nullish(),last_name:w.string().nullish(),username:w.string().nullish(),photo_url:w.string().nullish(),verified_at:w.number(),first_verified_at:w.number().nullable(),latest_verified_at:w.number().nullable()}).transform((e=>({...e,telegramUserId:e.telegram_user_id,firstName:e.first_name}))),cn=w.enum(["privy","user-passcode","google-drive","icloud"]),pn=w.object({type:w.literal("wallet"),address:w.string(),imported:w.boolean().default(!1),delegated:w.boolean().default(!1),wallet_index:w.number(),chain_id:w.string(),chain_type:w.string(),wallet_client:w.literal("privy"),wallet_client_type:w.literal("privy"),connector_type:w.literal("embedded"),recovery_method:cn,verified_at:w.number(),first_verified_at:w.number().nullable(),latest_verified_at:w.number().nullable()}),dn=pn.merge(w.object({chain_type:w.literal("ethereum")})),un=pn.merge(w.object({chain_type:w.literal("solana"),public_key:w.string()})),_n=pn.merge(w.object({chain_type:w.literal("bitcoin-segwit"),public_key:w.string()})),mn=pn.merge(w.object({chain_type:w.literal("bitcoin-taproot"),public_key:w.string()})),gn=w.object({type:w.literal("google_oauth"),subject:w.string(),email:w.string(),name:w.string().nullable(),verified_at:w.number(),first_verified_at:w.number().nullable(),latest_verified_at:w.number().nullable()}),bn=w.object({type:w.literal("twitter_oauth"),subject:w.string(),username:w.string().nullable(),name:w.string().nullable(),profile_picture_url:w.string().nullable(),verified_at:w.number(),first_verified_at:w.number().nullable(),latest_verified_at:w.number().nullable()}),hn=w.object({type:w.literal("discord_oauth"),subject:w.string(),username:w.string().nullable(),email:w.string().nullable(),verified_at:w.number(),first_verified_at:w.number().nullable(),latest_verified_at:w.number().nullable()}),yn=w.object({type:w.literal("github_oauth"),subject:w.string(),username:w.string().nullable(),name:w.string().nullable(),email:w.string().nullable(),verified_at:w.number(),first_verified_at:w.number().nullable(),latest_verified_at:w.number().nullable()}),vn=w.object({type:w.literal("linkedin_oauth"),subject:w.string(),name:w.string().optional(),email:w.string().nullable(),vanity_name:w.string().optional(),verified_at:w.number(),first_verified_at:w.number().nullable(),latest_verified_at:w.number().nullable()}),fn=w.object({type:w.literal("spotify_oauth"),subject:w.string(),email:w.string().nullable(),name:w.string().nullable(),verified_at:w.number(),first_verified_at:w.number().nullable(),latest_verified_at:w.number().nullable()}),In=w.object({type:w.literal("instagram_oauth"),subject:w.string(),username:w.string().nullable(),verified_at:w.number(),first_verified_at:w.number().nullable(),latest_verified_at:w.number().nullable()}),Sn=w.object({type:w.literal("tiktok_oauth"),subject:w.string(),username:w.string().nullable(),name:w.string().nullable(),verified_at:w.number(),first_verified_at:w.number().nullable(),latest_verified_at:w.number().nullable()}),kn=w.object({type:w.literal("apple_oauth"),subject:w.string(),email:w.string().nullable(),verified_at:w.number(),first_verified_at:w.number().nullable(),latest_verified_at:w.number().nullable()}),Tn=w.object({type:w.literal("custom_auth"),custom_user_id:w.string(),verified_at:w.number(),first_verified_at:w.number().nullable(),latest_verified_at:w.number().nullable()}),wn=w.object({address:w.string()}),An=w.object({address:w.string()}),En=w.object({type:w.literal("cross_app"),subject:w.string(),provider_app_id:w.string(),embedded_wallets:w.array(wn),smart_wallets:w.array(An),verified_at:w.number(),first_verified_at:w.number().nullable(),latest_verified_at:w.number().nullable()}),Pn=w.union([Za,en,an,rn,nn,dn,un,_n,mn,gn,bn,hn,yn,fn,In,Sn,vn,kn,Tn,on,sn,ln,En]),jn=w.object({type:w.literal("sms"),verified_at:w.number()}),On=w.object({type:w.literal("totp"),verified_at:w.number()}),Cn=w.object({type:w.literal("passkey"),verified_at:w.number()}),Nn=w.union([jn,On,Cn]),Rn=w.record(w.string(),w.union([w.string(),w.number(),w.boolean()])),Dn=w.object({provider:w.string(),access_token:w.string(),access_token_expires_in_seconds:w.number().optional(),refresh_token:w.string().optional(),refresh_token_expires_in_seconds:w.number().optional(),scopes:w.array(w.string()).optional()}),xn=w.object({id:w.string(),linked_accounts:w.array(Pn),mfa_methods:w.array(Nn),created_at:w.number(),has_accepted_terms:w.boolean(),is_guest:w.boolean(),custom_metadata:Rn.optional()}),Ln=w.enum(["set","ignore","clear"]),Wn=w.object({user:xn,token:w.string().min(1).nullable(),privy_access_token:w.string().min(1).nullable(),refresh_token:w.string().min(1).nullable(),identity_token:w.string().min(1).optional(),is_new_user:w.boolean().optional(),oauth_tokens:Dn.optional(),oauth_provider_tokens:w.object({provider:w.string(),access_token:w.string(),access_token_expires_in_seconds:w.number().optional(),refresh_token:w.string().optional(),scopes:w.array(w.string()).optional()}).optional(),session_update_action:Ln}),Un=w.object({user:w.null(),token:w.null(),refresh_token:w.null(),session_update_action:w.literal(Ln.Values.clear)}),Mn=w.union([Wn,Un]),Fn={lv:w.number().nullable()},Gn=Za.pick({type:!0,address:!0}).extend(Fn),Vn=en.pick({type:!0,phoneNumber:!0}).extend(Fn).transform((({phoneNumber:e,...t})=>({phone_number:e,...t}))),qn=an.pick({type:!0,address:!0,chain_type:!0,wallet_client_type:!0}).extend(Fn),Bn=rn.pick({type:!0,address:!0,chain_type:!0,wallet_client_type:!0}).extend(Fn),Kn=on.pick({type:!0,fid:!0,username:!0,owner_address:!0}).extend(Fn).transform((({owner_address:e,...t})=>({oa:e,...t}))),$n=sn.pick({type:!0,credential_id:!0}).extend(Fn),Hn=w.object({type:w.literal("telegram"),telegram_user_id:w.string(),username:w.string().nullish(),lv:w.number().nullable()}),zn=dn.pick({type:!0,address:!0,chain_type:!0,wallet_client_type:!0}).extend(Fn),Yn=un.pick({type:!0,address:!0,chain_type:!0,wallet_client_type:!0}).extend(Fn),Jn=gn.pick({type:!0,subject:!0,email:!0}).extend(Fn),Qn=bn.pick({type:!0,subject:!0,username:!0}).extend(Fn),Xn=hn.pick({type:!0,subject:!0,username:!0}).extend(Fn),Zn=yn.pick({type:!0,subject:!0,username:!0}).extend(Fn),er=vn.pick({type:!0,subject:!0,email:!0}).extend(Fn),tr=fn.pick({type:!0,subject:!0,email:!0}).extend(Fn),ar=In.pick({type:!0,subject:!0,username:!0}).extend(Fn),nr=Sn.pick({type:!0,subject:!0,username:!0}).extend(Fn),rr=kn.pick({type:!0,subject:!0,email:!0}).extend(Fn),ir=Tn.pick({type:!0,custom_user_id:!0}).extend(Fn),or=En.pick({type:!0,subject:!0,provider_app_id:!0,embedded_wallets:!0,smart_wallets:!0}).extend(Fn),sr=nn.pick({type:!0,smart_wallet_type:!0,address:!0}).extend(Fn);var lr={};L(lr,"MfaVerifyResponse",(()=>cr)),L(lr,"MfaSmsInitInput",(()=>ur)),L(lr,"MfaSmsAuthenticateEnrollInput",(()=>_r)),L(lr,"MfaSmsEnrollInput",(()=>mr)),L(lr,"MfaSmsVerifyInput",(()=>gr)),L(lr,"MfaTotpInput",(()=>br)),L(lr,"ResponseTotpInitMfa",(()=>hr));let cr=T.object({token:T.string()}).strict(),pr=T.object({action:T.literal("verify")}).strict(),dr=T.object({action:T.literal("enroll"),phoneNumber:Dt}).strict(),ur=T.union([pr,dr]),_r=T.object({action:T.literal("enroll").optional(),code:Ct,phoneNumber:Dt}).strict(),mr=T.object({code:Ct,phoneNumber:Dt}).strict(),gr=T.object({code:Ct}).strict(),br=T.object({code:Ct}).strict(),hr=T.object({totpSecret:T.string(),totpAuthUrl:T.string()}).strict();var yr={};L(yr,"MfaPasskeyInitInput",(()=>Or)),L(yr,"ResponsePasskeyInitMfa",(()=>Cr)),L(yr,"MfaPasskeyVerifyInput",(()=>Nr)),L(yr,"MfaEnrollmentPasskeyInput",(()=>Rr));var vr={};L(vr,"PasskeyAuthenticatorVerifyOptions",(()=>fr)),L(vr,"PasskeyAuthenticatorEnrollmentOptions",(()=>Ir)),L(vr,"PasskeyAuthenticatorVerifyResponse",(()=>Sr)),L(vr,"PasskeyAuthenticatorEnrollmentResponse",(()=>kr)),L(vr,"PasskeyInitInput",(()=>Tr)),L(vr,"ResponsePasskeyInitAuthenticate",(()=>wr)),L(vr,"ResponsePasskeyInitLink",(()=>Ar)),L(vr,"PasskeyLinkInput",(()=>Er)),L(vr,"PasskeyAuthenticateInput",(()=>Pr)),L(vr,"UnlinkPasskeyInput",(()=>jr));let fr=T.object({challenge:T.string(),timeout:T.number().optional(),rp_id:T.string().optional(),allow_credentials:T.array(T.object({id:T.string(),type:T.string(),transports:T.array(T.string()).optional()})).optional(),user_verification:T.string().optional(),extensions:T.object({app_id:T.string().optional(),cred_props:T.boolean().optional(),hmac_create_secret:T.boolean().optional()}).optional()}),Ir=T.object({rp:T.object({name:T.string(),id:T.string().optional()}),user:T.object({id:T.string(),name:T.string(),display_name:T.string()}),challenge:T.string(),pub_key_cred_params:T.array(T.object({alg:T.number(),type:T.literal("public-key")})),timeout:T.number().optional(),exclude_credentials:T.array(T.object({id:T.string(),type:T.string(),transports:T.array(T.string()).optional()})).optional(),authenticator_selection:T.object({authenticator_attachment:T.string().optional(),require_resident_key:T.boolean().optional(),resident_key:T.string().optional(),user_verification:T.string().optional()}).optional(),attestation:T.string().optional(),extensions:T.object({app_id:T.string().optional(),cred_props:T.object({rk:T.boolean().optional()}).optional(),hmac_create_secret:T.boolean().optional()}).optional()}),Sr=T.object({id:T.string(),raw_id:T.string(),response:T.object({client_data_json:T.string(),authenticator_data:T.string(),signature:T.string(),user_handle:T.string().optional()}),authenticator_attachment:T.string().optional(),client_extension_results:T.object({app_id:T.boolean().optional(),cred_props:T.object({rk:T.boolean().optional()}).optional(),hmac_create_secret:T.boolean().optional()}),type:T.literal("public-key")}),kr=T.object({id:T.string(),raw_id:T.string(),response:T.object({client_data_json:T.string(),attestation_object:T.string(),authenticator_data:T.string().optional(),transports:T.array(T.any()).optional(),public_key_algorithm:T.number().optional(),public_key:T.string().optional()}),authenticator_attachment:T.string().optional(),client_extension_results:T.object({app_id:T.boolean().optional(),cred_props:T.object({rk:T.boolean().optional()}).optional(),hmac_create_secret:T.boolean().optional()}),type:T.literal("public-key")}),Tr=T.object({relying_party:T.string().url().optional(),token:T.string().optional()}).strict(),wr=T.object({relying_party:T.string().url().optional(),options:fr}).strict(),Ar=T.object({relying_party:T.string().url().optional(),options:Ir}).strict(),Er=T.object({relying_party:T.string().url().optional(),authenticator_response:kr}).strict(),Pr=T.object({relying_party:T.string().url().optional(),challenge:T.string(),authenticator_response:Sr}).strict(),jr=T.object({credential_id:T.string()}),Or=T.object({relying_party:T.string().url().optional()}).strict(),Cr=T.object({options:fr}).strict(),Nr=T.object({authenticator_response:Sr,relying_party:T.string().url().optional()}).strict(),Rr=T.object({credential_ids:T.array(T.string())});var Dr={};L(Dr,"ExternalOAuthProvider",(()=>Lr)),L(Dr,"OAuthProvider",(()=>Wr)),L(Dr,"AuthenticateOauthInput",(()=>Ur)),L(Dr,"OAuthInitInput",(()=>Mr)),L(Dr,"LinkOAuthInput",(()=>Fr)),L(Dr,"OAuthUnlinkInput",(()=>Gr)),L(Dr,"OAuthInitResponse",(()=>Vr)),L(Dr,"OAuthLinkResponse",(()=>qr)),L(Dr,"TransferOAuthInput",(()=>Br)),L(Dr,"SUPPORTED_OAUTH_PROVIDERS",(()=>xr));let xr=["google","discord","twitter","github","spotify","instagram","tiktok","linkedin","apple"],Lr=w.enum(xr,{invalid_type_error:"Please specify a supported provider.",required_error:"Please specify a supported provider."}),Wr=Lr.or(w.custom((e=>"string"==typeof e&&/^privy:[a-z0-9]{25}$/i.test(e)),{message:"Please specify a supported provider."})),Ur=w.object({authorization_code:w.string(),state_code:w.string(),code_verifier:w.string().min(43).max(128).optional(),code_type:w.enum(["raw"]).optional()}).merge(Ut).catch((()=>{throw new R("Please specify authorization_code and state_code.",O.INVALID_CREDENTIALS)})),Mr=w.object({redirect_to:w.string({required_error:"Please provide a redirect_to value."}),provider:Wr,token:w.string().optional(),state_code:w.string().optional(),code_challenge:w.string().optional()}),Fr=w.object({authorization_code:w.string(),state_code:w.string(),code_verifier:w.string().min(43).max(128).optional(),code_type:w.enum(["raw"]).optional()}),Gr=w.object({subject:w.string(),provider:Wr}),Vr=w.object({url:w.string()}),qr=xn.extend({oauth_tokens:Dn.optional()}),Br=da.extend({userInfo:w.object({subject:w.string(),name:w.string().optional(),username:w.string().optional(),profilePictureUrl:w.string().optional(),email:w.string().optional(),vanityName:w.string().optional()})});var Kr={};L(Kr,"AuthorizationCodeInput",(()=>$r));let $r=w.object({redirect_to:w.string(),state:w.string(),code_challenge:w.string()});var Hr={};L(Hr,"EmptyObject",(()=>zr)),L(Hr,"SuccessObject",(()=>Yr));let zr=w.record(w.string(),w.never()),Yr=w.object({success:w.boolean()});var Jr={};L(Jr,"RecoveryKeyMaterialInput",(()=>Qr)),L(Jr,"RecoveryKeyMaterialResponse",(()=>Xr)),L(Jr,"OAuthAuthenticateRecoveryResponse",(()=>Zr)),L(Jr,"OAuthInitRecoveryInput",(()=>ei)),L(Jr,"OAuthInitICloudRecoveryInput",(()=>ti)),L(Jr,"OAuthCallbackICloudExpoInput",(()=>ai)),L(Jr,"OAuthCallbackICloudExpoResponse",(()=>ni)),L(Jr,"RecoveryConfigurationICloudInput",(()=>ri)),L(Jr,"RecoveryConfigurationICloudResponse",(()=>ii));let Qr=w.object({chain_type:w.string().optional()}),Xr=w.object({recovery_type:w.enum(["user_passcode_derived_recovery_key","privy_passcode_derived_recovery_key","privy_generated_recovery_key","google_drive_recovery_secret","icloud_recovery_secret"]),recovery_key_derivation_salt:w.string(),recovery_code:w.string(),recovery_key:w.string(),file_id:w.string(),icloud_record_name:w.string()}),Zr=w.object({access_token:w.string()}),ei=w.object({redirect_to:w.string({required_error:"Please provide a redirect_to value."}),token:w.string().optional(),state_code:w.string().optional(),code_challenge:w.string().optional()}),ti=w.object({client_type:w.enum(["web","expo-ios"])}),ai=w.object({ckWebAuthToken:w.string()}).transform((e=>({ckWebAuthToken:e.ckWebAuthToken}))).catch((()=>{throw new R("Missing ckWebAuthToken.",O.INVALID_DATA)})),ni=zr,ri=w.object({client_type:w.enum(["web","expo-ios"])}),ii=w.object({api_token:w.string(),container_identifier:w.string(),environment:w.string()});var oi={};L(oi,"SiweInput",(()=>si)),L(oi,"SmartWalletSiweInput",(()=>li)),L(oi,"AuthenticateSiweInput",(()=>ci)),L(oi,"SiweAddressInput",(()=>pi)),L(oi,"SiweInitInput",(()=>di)),L(oi,"SiweNonce",(()=>ui)),L(oi,"TransferSiweInput",(()=>_i));let si=w.object({message:w.string({invalid_type_error:"Invalid SIWE message"}),signature:w.string({invalid_type_error:"Invalid SIWE signature"}),chainId:w.string().max(41).nullable().default(null),walletClientType:w.string().max(64).nullable().default(null),connectorType:w.string().max(64).nullable().default(null)}),li=w.object({message:w.string({invalid_type_error:"Invalid SIWE message"}),signature:w.string({invalid_type_error:"Invalid SIWE signature"}),smart_wallet_type:Ka}),ci=si.merge(Ut),pi=w.object({address:Nt}),di=w.object({address:Nt,token:w.string().optional()}),ui=w.object({nonce:w.string(),address:w.string(),expires_at:w.string()}),_i=da.extend({address:Nt,chainId:w.string().max(41).nullable().default(null),walletClientType:w.string().max(64).nullable().default(null),connectorType:w.string().max(64).nullable().default(null)});var mi={};L(mi,"SiwsInput",(()=>gi)),L(mi,"AuthenticateSiwsInput",(()=>bi)),L(mi,"SiwsAddressInput",(()=>hi)),L(mi,"SiwsInitInput",(()=>yi)),L(mi,"SiwsNonce",(()=>vi));let gi=w.object({message:w.string({invalid_type_error:"Invalid SIWS message"}),signature:w.string({invalid_type_error:"Invalid SIWS signature"}),walletClientType:w.string().max(64).nullable().default(null),connectorType:w.string().max(64).nullable().default(null)}),bi=gi.merge(Ut),hi=w.object({address:Rt}),yi=w.object({address:Rt,token:w.string().optional()}),vi=w.object({nonce:w.string(),address:w.string(),expires_at:w.string()});var fi={};L(fi,"VerifyPhoneInput",(()=>Ii)),L(fi,"AuthenticatePhoneInput",(()=>Si)),L(fi,"PasswordlessSmsPhoneInput",(()=>ki)),L(fi,"UnlinkPhoneInput",(()=>Ti)),L(fi,"UpdatePhoneInput",(()=>wi)),L(fi,"TransferPhoneInput",(()=>Ai));let Ii=w.object({code:Ct.catch((()=>{throw new D("Invalid SMS verification code",O.INVALID_CREDENTIALS)})),phoneNumber:Dt.catch((()=>{throw new D("Invalid phone number",O.INVALID_CREDENTIALS)}))}),Si=Ii.merge(Ut),ki=w.object({phoneNumber:Dt.catch((()=>{throw new D("Invalid phone number",O.INVALID_DATA)})),token:w.string().optional()}),Ti=w.object({phoneNumber:Dt}),wi=w.object({old_phone_number:Dt,new_phone_number:Dt,code:Ct}),Ai=da.extend({phoneNumber:Dt});var Ei={};L(Ei,"TelegramAuthenticateInput",(()=>ji)),L(Ei,"TelegramLinkInput",(()=>Oi)),L(Ei,"TelegramUnlinkInput",(()=>Ci)),L(Ei,"TransferTelegramInput",(()=>Ni));let Pi=T.object({id:T.number(),first_name:T.string(),auth_date:T.number(),hash:T.string(),username:T.string().optional(),last_name:T.string().optional(),photo_url:T.string().optional()}),ji=T.object({captcha_token:T.string().optional(),telegram_auth_result:Pi.optional(),telegram_web_app_data:T.object({query_id:T.string().optional(),auth_date:T.number(),hash:T.string(),user:T.string(),chat_instance:T.string().optional(),chat_type:T.string().optional(),start_param:T.string().optional()}).optional()}).merge(Ut),Oi=ji.omit({telegram_web_app_data:!0}).required({telegram_auth_result:!0}),Ci=T.object({telegram_user_id:T.string()}),Ni=da.extend({telegram_auth_result:Pi});var Ri={};L(Ri,"RefreshTokenInput",(()=>Di)),L(Ri,"OptionalRefreshTokenInput",(()=>xi)),L(Ri,"ForkedToken",(()=>Li));let Di=w.object({refresh_token:w.string()}),xi=Di.partial(),Li=w.object({token:w.string(),refresh_token:w.string(),new_session_refresh_token:w.string()});var Wi={};L(Wi,"DelegatedActionsConsentInput",(()=>Ui));let Ui=w.object({encrypted_tee_share:w.string(),app_share:w.string(),delegated_addresses:w.array(w.object({chain_type:w.union([w.literal("solana"),w.literal("ethereum")]),address:w.string(),wallet_index:w.number().default(0)}))});var Mi={};L(Mi,"WalletApiSignTransactionRpcInput",(()=>Gi)),L(Mi,"WalletApiSignMessageRpcInput",(()=>Vi)),L(Mi,"WalletApiRpcInput",(()=>qi)),L(Mi,"WalletApiSignTransactionRpcResponse",(()=>Bi)),L(Mi,"WalletApiSignMessageRpcResponse",(()=>Ki)),L(Mi,"WalletApiRpcResponse",(()=>$i)),L(Mi,"WalletApiRegisterAuthorizationKeyInput",(()=>Hi));let Fi=w.object({address:w.string(),chain_type:w.union([w.literal("solana"),w.literal("ethereum")])}),Gi=w.object({method:w.literal("signTransaction"),params:w.object({transaction:w.string(),encoding:w.literal("base64")})}).merge(Fi),Vi=w.object({method:w.literal("signMessage"),params:w.object({message:w.string(),encoding:w.literal("base64")})}).merge(Fi),qi=w.discriminatedUnion("method",[Gi,Vi]),Bi=w.object({method:w.literal("signTransaction"),data:w.object({signed_transaction:w.string(),encoding:w.literal("base64")})}),Ki=w.object({method:w.literal("signMessage"),data:w.object({signature:w.string(),encoding:w.literal("base64")})}),$i=w.discriminatedUnion("method",[Bi,Ki]),Hi=w.object({public_key:w.string()});x(Tt,wt),x(Tt,Et),x(Tt,Vt),x(Tt,qt),x(Tt,Qt),x(Tt,Pt),x(Tt,oa),x(Tt,la),x(Tt,pa),x(Tt,ya),x(Tt,Ia),x(Tt,Oa),x(Tt,Da),x(Tt,La),x(Tt,lr),x(Tt,yr),x(Tt,Dr),x(Tt,Kr),x(Tt,Hr),x(Tt,vr),x(Tt,Jr),x(Tt,oi),x(Tt,mi),x(Tt,fi),x(Tt,Ua),x(Tt,Ei),x(Tt,Ri),x(Tt,Wa),x(Tt,Wi),x(Tt,Mi);let zi={address:S,version:"0.6"},Yi={address:k,version:"0.7"},Ji=({owner:e,smartWalletType:t,publicClient:a})=>{switch(t){case Ma:return v({client:a,entryPoint:Yi,owners:[e],version:"1.4.1"});case Fa:return y({client:a,version:"0.3.1",entryPoint:Yi,owners:[e]});case Ga:return h({client:a,owners:[e],entryPoint:zi});case Va:return b({client:a,entryPoint:zi,owner:e,version:"1.1.0"});case qa: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 I({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}.`)}},Qi=["rpc.zerodev.app","public.pimlico.io","api.pimlico.io"];const Xi=({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}))),Zi=async({chain:e,paymasterContext:t,embeddedWallet:a,user:o,smartWalletsConfig:s,rpcConfig:l,privyAppId:p})=>{if(!s?.enabled||!o||!a)return;let d=await a.getEthereumProvider(),u=s?.configuredNetworks.find((t=>t.chainId===`eip155:${e.id}`));if(!u)throw new i(`The chain ${e.name} (eip155:${e.id}) must be configured in the smart wallet configuration in your dashboard`);let _=o.smartWallet?.smartWalletType??s.smartWalletType,m=c(e,l,p),b=r({chain:e,transport:n(m)}),h=t??u.paymasterContext,y=await(async({owner:e,smartWalletType:t,chain:a,publicClient:r,bundlerUrl:i,paymasterUrl:o,paymasterContext:s})=>{let l=await Ji({owner:e,smartWalletType:t,publicClient:r}),c=f({transport:n(i),entryPoint:l.entryPoint}),p=o?f({transport:n(o),entryPoint:l.entryPoint}):void 0;return g({account:l,chain:a,paymaster:p,paymasterContext:s,bundlerTransport:n(i),userOperation:{estimateFeesPerGas:async()=>{if(Qi.some((e=>i.includes(e))))return await c.getUserOperationGasPrice().then((e=>e.fast));{let e=await r.estimateFeesPerGas();return{...e,maxFeePerGas:150n*e.maxFeePerGas/100n,maxPriorityFeePerGas:150n*e.maxPriorityFeePerGas/100n}}}}})})({owner:d,smartWalletType:_,chain:e,publicClient:b,paymasterContext:h,...u});if(!y)throw new i(`Failed to create smart wallet client for chain ${e.name} (eip155:${e.id})`);return y},eo=({clientConfig:n,smartWalletsConfig:r})=>{let{noPromptOnSignature:c,openPrivyModal:g,appId:b}=o(),h=p(),{setModalData:y}=u(),{user:v}=s(),{chains:f}=p(),{chainId:I,clients:S,setChainId:k,chainIdState:T}=(()=>{let a=e(),[n,r]=t();return{clients:e({}),setChainId:e=>{a.current=e,r(e)},chainId:a,chainIdState:n}})(),w=f.find((e=>e.id===T)),{wallets:A}=d(),E=a((async()=>I.current),[I]),P=a((async({id:e})=>{if(!S.current[e]){let t=_(A),a=await Zi({chain:f.find((t=>t.id===e)),embeddedWallet:t,user:v,paymasterContext:n?.paymasterContext,smartWalletsConfig:r,rpcConfig:h.rpcConfig,privyAppId:b});a&&(S.current[e]=a)}k(e)}),[f,n,A,v,r]);return{wrapSmartAccountClient:e=>{S.current[e.chain.id]=e,T||k(e.chain.id);return{...e,sendTransaction:async e=>{let t=void 0===h.embeddedWallets.showWalletUIs?h.embeddedWallets.noPromptOnSignature:!h.embeddedWallets.showWalletUIs,a=S.current[I.current];if(!a)throw new i(`Smart wallet client for chain (eip155:${I.current}) not found`);if(t)return c.current=!0,await a.sendTransaction(e).finally((()=>c.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,i)=>{c.current=!0;let{entropyId:o,entropyIdVerifier:s}=l(v);y({connectWallet:{entropyId:o,entropyIdVerifier:s,onCompleteNavigateTo:m.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN,onFailure:()=>{}},sendTransaction:{transactionRequests:Xi({calls:n,chain:a.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:o,entropyIdVerifier:s,transactingWallet:{address:a.account.address,walletIndex:null},getIsSponsored:r,onConfirm:()=>a.sendTransaction(e),onSuccess:e=>t(e.hash),onFailure:i,uiOptions:{}}}),g(m.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{c.current=!1}))},signMessage:async({message:e})=>{let t=void 0===h.embeddedWallets.showWalletUIs?h.embeddedWallets.noPromptOnSignature:!h.embeddedWallets.showWalletUIs,a=S.current[I.current];if(!a)throw new i(`Smart wallet client for chain (eip155:${I.current}) not found`);return t?(c.current=!0,await a.signMessage({message:e}).finally((()=>c.current=!1))):new Promise((async(t,n)=>{let{entropyId:r,entropyIdVerifier:i}=l(v);c.current=!0,y({connectWallet:{entropyId:r,entropyIdVerifier:i,onCompleteNavigateTo:m.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>a.signMessage({message:e}),onSuccess:e=>t(e),onFailure:n,uiOptions:{}}}),g(m.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{c.current=!1}))},signTypedData:async e=>{let t=void 0===h.embeddedWallets.showWalletUIs?h.embeddedWallets.noPromptOnSignature:!h.embeddedWallets.showWalletUIs,a=S.current[I.current];if(!a)throw new i(`Smart wallet client for chain (eip155:${I.current}) not found`);return t?(c.current=!0,await a.signTypedData(e).finally((()=>c.current=!1))):new Promise((async(t,n)=>{c.current=!0;let{entropyId:r,entropyIdVerifier:i}=l(v);y({connectWallet:{entropyId:r,entropyIdVerifier:i,onCompleteNavigateTo:m.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>a.signTypedData(e),onSuccess:e=>t(e),onFailure:n,uiOptions:{}}}),g(m.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{c.current=!1}))},getChainId:E,chain:w,switchChain:P}}}};export{Xi as c,Zi as g,eo as u};