@privy-io/react-auth 2.19.3 → 2.21.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.
- package/dist/cjs/abstract-smart-wallets.js +1 -1
- package/dist/cjs/extended-chains.js +1 -1
- package/dist/cjs/farcaster.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/privy-provider-NikYcweE.js +29 -0
- package/dist/cjs/smart-wallets-mWRMk0wI.js +1 -0
- package/dist/cjs/smart-wallets.js +1 -1
- package/dist/cjs/solana.js +1 -1
- package/dist/cjs/ui.js +1 -1
- package/dist/cjs/use-sign-with-user-signer-pdwGPuUl.js +1 -0
- package/dist/cjs/{useActiveWallet-C3sUASyl.js → useActiveWallet-D0kSB8pr.js} +1 -1
- package/dist/cjs/{useFundWallet-CjIOl8K5.js → useFundWallet-BLnL9YuU.js} +1 -1
- package/dist/dts/extended-chains.d.mts +3 -3
- package/dist/dts/extended-chains.d.ts +3 -3
- package/dist/dts/farcaster.d.mts +37 -7
- package/dist/dts/farcaster.d.ts +37 -7
- package/dist/dts/index.d.mts +19 -6
- package/dist/dts/index.d.ts +19 -6
- package/dist/dts/smart-wallets.d.mts +3 -2
- package/dist/dts/smart-wallets.d.ts +3 -2
- package/dist/dts/solana.d.mts +4 -4
- package/dist/dts/solana.d.ts +4 -4
- package/dist/dts/{types-ZqHmGCwO.d.mts → types-DYBA51G_.d.mts} +17 -2
- package/dist/dts/{types-ZqHmGCwO.d.ts → types-DYBA51G_.d.ts} +17 -2
- package/dist/dts/ui.d.mts +1 -1
- package/dist/dts/ui.d.ts +1 -1
- package/dist/dts/{useSolanaWallets-idhSZbQC.d.mts → useSolanaWallets-BiSasRT6.d.mts} +1 -1
- package/dist/dts/{useSolanaWallets-idhSZbQC.d.ts → useSolanaWallets-BiSasRT6.d.ts} +1 -1
- package/dist/esm/abstract-smart-wallets.mjs +1 -1
- package/dist/esm/extended-chains.mjs +1 -1
- package/dist/esm/farcaster.mjs +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/privy-provider-NPBEALzA.mjs +29 -0
- package/dist/esm/smart-wallets-JbwIgnkS.mjs +1 -0
- package/dist/esm/smart-wallets.mjs +1 -1
- package/dist/esm/solana.mjs +1 -1
- package/dist/esm/ui.mjs +2 -2
- package/dist/esm/use-sign-with-user-signer-CyFzXla-.mjs +1 -0
- package/dist/esm/{useActiveWallet-BJC5_xsQ.mjs → useActiveWallet-MSI4YjRM.mjs} +1 -1
- package/dist/esm/{useFundWallet-C-F8T0D8.mjs → useFundWallet-Cv33RFig.mjs} +1 -1
- package/package.json +6 -6
- package/dist/cjs/privy-provider-BxMgsOWd.js +0 -29
- package/dist/cjs/smart-wallets-B_hWSx5K.js +0 -1
- package/dist/cjs/use-sign-with-user-signer-BQ_24mRh.js +0 -1
- package/dist/esm/privy-provider-DhzPL6wG.mjs +0 -29
- package/dist/esm/smart-wallets-CYZi_N_3.mjs +0 -1
- package/dist/esm/use-sign-with-user-signer-DnNPDfxp.mjs +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useRef as e,useState as t,useCallback as r}from"react";import{http as n,createPublicClient as a}from"viem";import{u as i,g as s,c as o}from"./use-sign-with-user-signer-DnNPDfxp.mjs";import{x as l,o as c,e as d,w as u,a as p,b1 as m,b0 as y,a$ as g}from"./privy-provider-DhzPL6wG.mjs";import{P as h}from"./paths-DCwuPDUk.mjs";import{u as f}from"./internal-context-qdNgTV5f.mjs";import{g as w}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{createSmartAccountClient as P}from"permissionless";import{toThirdwebSmartAccount as I,toLightSmartAccount as v,toBiconomySmartAccount as F,toKernelSmartAccount as W,toSafeSmartAccount as x}from"permissionless/accounts";import{createPimlicoClient as G}from"permissionless/clients/pimlico";import{toCoinbaseSmartAccount as C,entryPoint06Address as T,entryPoint07Address as U}from"viem/account-abstraction";import{THIRDWEB as M,COINBASE_SMART_WALLET as b,LIGHT_ACCOUNT as O,BICONOMY as S,KERNEL as A,SAFE as D}from"@privy-io/js-sdk-core";let V={address:T,version:"0.6"},N={address:U,version:"0.7"},_=({owner:e,smartWalletType:t,publicClient:r})=>{switch(t){case D:return x({client:r,entryPoint:N,owners:[e],version:"1.4.1"});case A:return W({client:r,version:"0.3.1",entryPoint:N,useMetaFactory:"optional",owners:[e]});case S:return F({client:r,owners:[e],entryPoint:V});case O:return v({client:r,entryPoint:V,owner:e,version:"1.1.0"});case b:return async function({client:e,owner:t}){let[r]=await t.request({method:"eth_accounts"});if(!r)throw Error("Unable to request embedded owner for eth_accounts");return await C({client:e,version:"1",owners:[{type:"local",source:"privy",address:r,sign:async({hash:e})=>await t.request({method:"secp256k1_sign",params:[e]})}]})}({client:r,owner:e});case M:return I({client:r,entryPoint:N,owner:e});default:throw Error(`Invalid smart account type: ${t}.`)}};const $=({calls:e,chain:t,maxPriorityFeePerGas:r,maxFeePerGas:n,nonce:a})=>e.map((e=>({to:e.to||void 0,data:e.data,value:e.value,chainId:t.id,nonce:a,maxFeePerGas:n,maxPriorityFeePerGas:r}))),B=async({chain:e,paymasterContext:t,account:r,signer:i,user:s,smartWalletsConfig:o,rpcConfig:c,privyAppId:d})=>{if(!(o?.enabled&&s&&r&&i))return;let u=o?.configuredNetworks.find((t=>t.chainId===`eip155:${e.id}`));if(!u)throw new h(`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,m=l(e,c,d),y=a({chain:e,transport:n(m)}),g=t??u.paymasterContext,f=await(async({owner:e,smartWalletType:t,chain:r,publicClient:a,bundlerUrl:i,paymasterUrl:s,paymasterContext:o})=>{let l=await _({owner:e,smartWalletType:t,publicClient:a}),c=G({transport:n(i),entryPoint:l.entryPoint}),d=s?G({transport:n(s),entryPoint:l.entryPoint}):void 0;return P({account:l,chain:r,paymaster:d,paymasterContext:o,bundlerTransport:n(i),userOperation:{estimateFeesPerGas:async()=>{if(["public.pimlico.io","api.pimlico.io"].some((e=>i.includes(e))))return await c.getUserOperationGasPrice().then((e=>e.fast));if(["rpc.zerodev.app"].some((e=>i.includes(e))))return(await c.request({method:"zd_getUserOperationGasPrice",params:[]})).fast;if(["g.alchemy.com"].some((e=>i.includes(e)))){let[e,t]=await Promise.all([a.getBlock({blockTag:"latest"}),c.request({method:"rundler_maxPriorityFeePerGas",params:[]})]);if(!e.baseFeePerGas||!t)throw Error("Failed to get block or maxPriorityFeePerGasEstimate");return{maxFeePerGas:150n*e.baseFeePerGas/100n+BigInt(t.toString()),maxPriorityFeePerGas:BigInt(t.toString())}}{let e=await a.estimateFeesPerGas(),t=i.includes("api.developer.coinbase.com")?175n:150n;return{...e,maxFeePerGas:e.maxFeePerGas*t/100n,maxPriorityFeePerGas:e.maxPriorityFeePerGas*t/100n}}}}})})({owner:i,smartWalletType:p,chain:e,publicClient:y,paymasterContext:g,...u});if(!f)throw new h(`Failed to create smart wallet client for chain ${e.name} (eip155:${e.id})`);return f},q=({clientConfig:n,smartWalletsConfig:a})=>{let{hideWalletUIs:l,openPrivyModal:P,appId:I,isHeadlessSigning:v}=f(),F=c(),{setModalData:W}=d(),{user:x}=i(),{chains:G}=c(),{chainId:C,clients:T,setChainId:U,chainIdState:M}=(()=>{let r=e(),[n,a]=t();return{clients:e({}),setChainId:e=>{r.current=e,a(e)},chainId:r,chainIdState:n}})(),b=G.find((e=>e.id===M)),{wallets:O}=u(),S=s(x),A=w(O),D=!!S&&o(S),V=r((async()=>C.current),[C]),N=r((async({id:e})=>{if(!T.current[e]){let t=await B({chain:G.find((t=>t.id===e)),account:S,signer:await(A?.getEthereumProvider()),user:x,paymasterContext:n?.paymasterContext,smartWalletsConfig:a,rpcConfig:F.rpcConfig,privyAppId:I});t&&(T.current[e]=t)}U(e)}),[G,n,O,x,a]);return{wrapSmartAccountClient:e=>{T.current[e.chain.id]=e,M||U(e.chain.id);return{...e,sendTransaction:async(e,t)=>{let r=T.current[C.current];if(!r)throw new h(`Smart wallet client for chain (eip155:${C.current}) not found`);if(delete e.account,v({showWalletUIs:t?.uiOptions?.showWalletUIs}))return l.current=!0,await r.sendTransaction(e).finally((()=>l.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 a=async()=>{let{paymasterAndData:t,paymasterData:a,maxFeePerGas:i,maxPriorityFeePerGas:s}=await r.prepareUserOperation({calls:n,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return 0===Number(i)&&0===Number(s)||Number(t??a??0)>0};return new Promise((async(i,s)=>{l.current=!0;let{entropyId:o,entropyIdVerifier:c}=p(x);W({connectWallet:{recoveryMethod:S.recoveryMethod,connectingWalletAddress:S.address,isUnifiedWallet:D,entropyId:o,entropyIdVerifier:c,onCompleteNavigateTo:m,onFailure:()=>{}},sendTransaction:{transactionRequests:$({calls:n,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),transactingWalletIndex:0,transactingWalletAddress:r.account.address,entropyId:o,entropyIdVerifier:c,getIsSponsored:a,signOnly:!1,onConfirm:()=>r.sendTransaction(e),onSuccess:e=>i(e.hash),onFailure:s,uiOptions:t?.uiOptions??{}}}),P(y)})).finally((()=>{l.current=!1}))},signMessage:async(e,t)=>{let r=T.current[C.current];if(!r)throw new h(`Smart wallet client for chain (eip155:${C.current}) not found`);return v({showWalletUIs:t?.uiOptions?.showWalletUIs})?(l.current=!0,await r.signMessage(e).finally((()=>l.current=!1))):new Promise((async(n,a)=>{let{entropyId:i,entropyIdVerifier:s}=p(x);l.current=!0,W({connectWallet:{recoveryMethod:S.recoveryMethod,connectingWalletAddress:S.address,isUnifiedWallet:D,entropyId:i,entropyIdVerifier:s,onCompleteNavigateTo:g,onFailure:()=>{}},signMessage:{method:"personal_sign",data:"string"==typeof e.message?e.message:e.message.raw.toString(),confirmAndSign:()=>r.signMessage(e),onSuccess:e=>n(e),onFailure:a,uiOptions:t?.uiOptions??{}}}),P(y)})).finally((()=>{l.current=!1}))},signTypedData:async(e,t)=>{let r=T.current[C.current];if(!r)throw new h(`Smart wallet client for chain (eip155:${C.current}) not found`);return delete e.account,v({showWalletUIs:t?.uiOptions?.showWalletUIs})?(l.current=!0,await r.signTypedData(e).finally((()=>l.current=!1))):new Promise((async(n,a)=>{l.current=!0;let{entropyId:i,entropyIdVerifier:s}=p(x);W({connectWallet:{recoveryMethod:S.recoveryMethod,connectingWalletAddress:S.address,isUnifiedWallet:D,entropyId:i,entropyIdVerifier:s,onCompleteNavigateTo:g,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>r.signTypedData(e),onSuccess:e=>n(e),onFailure:a,uiOptions:t?.uiOptions??{}}}),P(y)})).finally((()=>{l.current=!1}))},getChainId:V,chain:b,switchChain:N}}}},j=()=>{let{hideWalletUIs:e,openPrivyModal:t,isHeadlessSigning:r}=f(),{setModalData:n}=d(),{user:a}=i(),l=s(a),c=!!l&&o(l);return{wrapSmartAccountClientWithUIs:i=>({...i,sendTransaction:async(s,o)=>{if(r({showWalletUIs:o?.uiOptions?.showWalletUIs}))return e.current=!0,await i.sendTransaction(s).finally((()=>e.current=!1));let d=[];"calls"in s&&void 0!==s.calls?d=[...s.calls]:"to"in s&&(d=[{to:s.to,value:s.value||BigInt(0),data:s.data||"0x"}]);let u=async()=>{if(!i.paymaster)return!1;let{paymasterData:e,paymasterAndData:t}=await i.prepareUserOperation({calls:d,maxFeePerGas:s.maxFeePerGas,maxPriorityFeePerGas:s.maxPriorityFeePerGas,nonce:s.nonce?BigInt(s.nonce):void 0});return Number(t??e??0)>0};return new Promise((async(r,g)=>{e.current=!0;let{entropyId:h,entropyIdVerifier:f}=p(a);n({connectWallet:{recoveryMethod:l.recoveryMethod,connectingWalletAddress:l.address,isUnifiedWallet:c,entropyId:h,entropyIdVerifier:f,onCompleteNavigateTo:m,onFailure:()=>{}},sendTransaction:{transactionRequests:$({calls:d,chain:i.chain,maxPriorityFeePerGas:s.maxPriorityFeePerGas,maxFeePerGas:s.maxFeePerGas,nonce:s.nonce?BigInt(s.nonce):void 0}),transactingWalletIndex:0,transactingWalletAddress:i.account.address,entropyId:h,entropyIdVerifier:f,getIsSponsored:u,signOnly:!1,onConfirm:()=>i.sendTransaction(s),onSuccess:e=>r(e.hash),onFailure:g,uiOptions:o?.uiOptions??{}}}),t(y)})).finally((()=>{e.current=!1}))},signMessage:async(s,o)=>r({showWalletUIs:o?.uiOptions?.showWalletUIs})?(e.current=!0,await i.signMessage(s).finally((()=>e.current=!1))):new Promise((async(r,d)=>{let{entropyId:u,entropyIdVerifier:m}=p(a);e.current=!0,n({connectWallet:{recoveryMethod:l.recoveryMethod,connectingWalletAddress:l.address,isUnifiedWallet:c,entropyId:u,entropyIdVerifier:m,onCompleteNavigateTo:g,onFailure:()=>{}},signMessage:{method:"personal_sign",data:"string"==typeof s.message?s.message:s.message.raw.toString(),confirmAndSign:()=>i.signMessage(s),onSuccess:e=>r(e),onFailure:d,uiOptions:o?.uiOptions??{}}}),t(y)})).finally((()=>{e.current=!1})),signTypedData:async(s,o)=>r({showWalletUIs:o?.uiOptions?.showWalletUIs})?(e.current=!0,await i.signTypedData(s).finally((()=>e.current=!1))):new Promise((async(r,d)=>{e.current=!0;let{entropyId:u,entropyIdVerifier:m}=p(a);n({connectWallet:{recoveryMethod:l.recoveryMethod,connectingWalletAddress:l.address,isUnifiedWallet:c,entropyId:u,entropyIdVerifier:m,onCompleteNavigateTo:g,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:s,confirmAndSign:()=>i.signTypedData(s),onSuccess:e=>r(e),onFailure:d,uiOptions:o?.uiOptions??{}}}),t(y)})).finally((()=>{e.current=!1}))})}};export{q as a,$ as c,B as g,j as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getAddress as e}from"viem";import{createContext as t,useContext as i,useMemo as a}from"react";import{a as r,u as s}from"./internal-context-qdNgTV5f.mjs";function l(e){return e?new Date(1e3*e):null}function n(e,t){return e.slice().sort(((e,t)=>(e.firstVerifiedAt??e.verifiedAt).getTime()-(t.firstVerifiedAt??t.verifiedAt).getTime())).find((e=>e.type===t))}const d=e=>e?u(e).find((e=>0===e.walletIndex))??null:null,u=e=>e?f(e,"ethereum"):[],f=(e,t)=>e.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&!e.imported&&e.chainType===t)),o=e=>e?f(e,"solana"):[],m=e=>e?o(e).find((e=>0===e.walletIndex))??null:null,p=e=>e?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType&&e.imported&&"ethereum"===e.chainType))||null,c=e=>e?.linkedAccounts.find((e=>"wallet"===e.type&&e.imported&&"privy"===e.walletClientType&&"solana"===e.chainType))||null;let _=(t,i)=>t===i||!(!t.startsWith("0x")||!i.startsWith("0x"))&&e(t)===e(i);const y=(e,t)=>e?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType&&_(e.address,t)))||null,h=(e,t)=>e.find((e=>_(e.address,t)))||null,v=e=>d(e)??m(e);function b(e){if(!e)return null;let t=function(e){let t=[];for(let i of e){let e=i.type;switch(i.type){case"wallet":let a={id:i.id,address:i.address,type:i.type,imported:i.imported,delegated:i.delegated,verifiedAt:l(i.verified_at),firstVerifiedAt:l(i.first_verified_at),latestVerifiedAt:l(i.latest_verified_at),chainType:i.chain_type,walletClientType:i.wallet_client_type,connectorType:i.connector_type,recoveryMethod:i.recovery_method,walletIndex:i.wallet_index};t.push(a);break;case"smart_wallet":let r={address:i.address,type:i.type,verifiedAt:l(i.verified_at),firstVerifiedAt:l(i.first_verified_at),latestVerifiedAt:l(i.latest_verified_at),smartWalletType:i.smart_wallet_type};t.push(r);break;case"cross_app":let s={type:i.type,subject:i.subject,embeddedWallets:i.embedded_wallets,smartWallets:i.smart_wallets,providerApp:{id:i.provider_app_id},verifiedAt:l(i.verified_at),firstVerifiedAt:l(i.first_verified_at),latestVerifiedAt:l(i.latest_verified_at)};t.push(s);break;case"email":let n={address:i.address,type:i.type,verifiedAt:l(i.verified_at),firstVerifiedAt:l(i.first_verified_at),latestVerifiedAt:l(i.latest_verified_at)};t.push(n);break;case"phone":let d={number:i.phoneNumber,type:i.type,verifiedAt:l(i.verified_at),firstVerifiedAt:l(i.first_verified_at),latestVerifiedAt:l(i.latest_verified_at)};t.push(d);break;case"google_oauth":let u={subject:i.subject,email:i.email,name:i.name,type:i.type,verifiedAt:l(i.verified_at),firstVerifiedAt:l(i.first_verified_at),latestVerifiedAt:l(i.latest_verified_at)};t.push(u);break;case"spotify_oauth":let f={subject:i.subject,email:i.email,name:i.name,type:i.type,verifiedAt:l(i.verified_at),firstVerifiedAt:l(i.first_verified_at),latestVerifiedAt:l(i.latest_verified_at)};t.push(f);break;case"instagram_oauth":let o={subject:i.subject,username:i.username,type:i.type,verifiedAt:l(i.verified_at),firstVerifiedAt:l(i.first_verified_at),latestVerifiedAt:l(i.latest_verified_at)};t.push(o);break;case"twitter_oauth":let m={subject:i.subject,username:i.username,name:i.name,type:i.type,profilePictureUrl:i.profile_picture_url,verifiedAt:l(i.verified_at),firstVerifiedAt:l(i.first_verified_at),latestVerifiedAt:l(i.latest_verified_at)};t.push(m);break;case"discord_oauth":let p={subject:i.subject,username:i.username,email:i.email,type:i.type,verifiedAt:l(i.verified_at),firstVerifiedAt:l(i.first_verified_at),latestVerifiedAt:l(i.latest_verified_at)};t.push(p);break;case"github_oauth":let c={subject:i.subject,username:i.username,name:i.name,email:i.email,type:i.type,verifiedAt:l(i.verified_at),firstVerifiedAt:l(i.first_verified_at),latestVerifiedAt:l(i.latest_verified_at)};t.push(c);break;case"tiktok_oauth":let _={subject:i.subject,username:i.username,name:i.name,type:i.type,verifiedAt:l(i.verified_at),firstVerifiedAt:l(i.first_verified_at),latestVerifiedAt:l(i.latest_verified_at)};t.push(_);break;case"line_oauth":let y={subject:i.subject,name:i.name,email:i.email,profilePictureUrl:i.profile_picture_url,type:i.type,verifiedAt:l(i.verified_at),firstVerifiedAt:l(i.first_verified_at),latestVerifiedAt:l(i.latest_verified_at)};t.push(y);break;case"linkedin_oauth":let h={subject:i.subject,name:i.name,email:i.email,vanityName:i.vanity_name,type:i.type,verifiedAt:l(i.verified_at),firstVerifiedAt:l(i.first_verified_at),latestVerifiedAt:l(i.latest_verified_at)};t.push(h);break;case"apple_oauth":let v={subject:i.subject,email:i.email,type:i.type,verifiedAt:l(i.verified_at),firstVerifiedAt:l(i.first_verified_at),latestVerifiedAt:l(i.latest_verified_at)};t.push(v);break;case"custom_auth":t.push({type:i.type,customUserId:i.custom_user_id,verifiedAt:l(i.verified_at),firstVerifiedAt:l(i.first_verified_at),latestVerifiedAt:l(i.latest_verified_at)});break;case"farcaster":let b={type:i.type,fid:i.fid,ownerAddress:i.owner_address,displayName:i.display_name,username:i.username,bio:i.bio,pfp:i.profile_picture_url,url:i.homepage_url,verifiedAt:l(i.verified_at),firstVerifiedAt:l(i.first_verified_at),latestVerifiedAt:l(i.latest_verified_at),signerPublicKey:i.signer_public_key};t.push(b);break;case"passkey":let A={type:i.type,enrolledInMfa:i.enrolled_in_mfa,credentialId:i.credential_id,authenticatorName:i.authenticator_name,createdWithDevice:i.created_with_device,createdWithOs:i.created_with_os,createdWithBrowser:i.created_with_browser,verifiedAt:l(i.verified_at),firstVerifiedAt:l(i.first_verified_at),latestVerifiedAt:l(i.latest_verified_at)};t.push(A);break;case"telegram":let k={type:i.type,telegramUserId:i.telegram_user_id,firstName:i.first_name,lastName:i.last_name,username:i.username,photoUrl:i.photo_url,verifiedAt:l(i.first_verified_at),firstVerifiedAt:l(i.first_verified_at),latestVerifiedAt:l(i.latest_verified_at)};t.push(k);break;default:console.warn(`Unrecognized account type: ${e}. Please consider upgrading the Privy SDK.`)}}return t}(e.linked_accounts),i=n(t,"wallet"),a=n(t,"smart_wallet"),r=n(t,"email"),s=n(t,"phone"),d=n(t,"google_oauth"),u=n(t,"twitter_oauth"),f=n(t,"discord_oauth"),o=n(t,"github_oauth"),m=n(t,"spotify_oauth"),p=n(t,"instagram_oauth"),c=n(t,"tiktok_oauth"),_=n(t,"line_oauth"),y=n(t,"linkedin_oauth"),h=n(t,"apple_oauth"),v=n(t,"farcaster"),b=n(t,"telegram"),A=e.mfa_methods.map((({type:e,verified_at:t})=>({type:e,verifiedAt:l(t)})));return{id:e.id,createdAt:l(e.created_at),linkedAccounts:t,email:r&&{address:r?.address},phone:s&&{number:s?.number},wallet:i&&{id:i.id,address:i.address,chainType:i.chainType,walletClientType:i.walletClientType,connectorType:i.connectorType,recoveryMethod:i.recoveryMethod,imported:i.imported,delegated:i.delegated,walletIndex:i.walletIndex},smartWallet:a&&{address:a.address,smartWalletType:a.smartWalletType},google:d&&{subject:d.subject,email:d.email,name:d.name},twitter:u&&{subject:u.subject,username:u.username,name:u.name,profilePictureUrl:u.profilePictureUrl},discord:f&&{subject:f.subject,username:f.username,email:f.email},github:o&&{subject:o.subject,username:o.username,name:o.name,email:o.email},spotify:m&&{subject:m.subject,email:m.email,name:m.name},instagram:p&&{subject:p.subject,username:p.username},tiktok:c&&{subject:c.subject,username:c.username,name:c.name},line:_&&{subject:_.subject,name:_.name,email:_.email,profilePictureUrl:_.profilePictureUrl},linkedin:y&&{subject:y.subject,name:y.name,email:y.email,vanityName:y.vanityName},apple:h&&{subject:h.subject,email:h.email},farcaster:v&&{fid:v.fid,ownerAddress:v.ownerAddress,displayName:v.displayName,username:v.username,bio:v.bio,pfp:v.pfp,url:v.url,signerPublicKey:v.signerPublicKey},telegram:b&&{telegramUserId:b.telegramUserId,firstName:b.firstName,lastName:b.lastName,username:b.username,photoUrl:b.photoUrl},delegatedWallets:[],mfaMethods:A.map((e=>e.type)),hasAcceptedTerms:e.has_accepted_terms??!1,isGuest:e.is_guest,customMetadata:e.custom_metadata}}const A=e=>!!e.id&&"privy-v2"===e.recoveryMethod,k=/*#__PURE__*/t({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:r,login:r,connectOrCreateWallet:r,linkEmail:r,linkPhone:r,linkFarcaster:r,linkWallet:r,startCrossAppAuthFlow:r,linkGoogle:r,linkTwitter:r,linkDiscord:r,linkGithub:r,linkSpotify:r,linkInstagram:r,linkTelegram:r,linkTiktok:r,linkLine:r,linkLinkedIn:r,linkApple:r,linkPasskey:r,updateEmail:r,updatePhone:r,logout:r,getAccessToken:r,unlinkEmail:r,unlinkPhone:r,unlinkWallet:r,unlinkGoogle:r,unlinkTwitter:r,unlinkDiscord:r,unlinkGithub:r,unlinkSpotify:r,unlinkInstagram:r,unlinkTiktok:r,unlinkLine:r,unlinkLinkedIn:r,unlinkApple:r,unlinkCrossAppAccount:r,unlinkFarcaster:r,unlinkTelegram:r,unlinkPasskey:r,signMessage:r,signTypedData:r,enrollInMfa:r,initEnrollmentWithSms:r,initEnrollmentWithTotp:r,initEnrollmentWithPasskey:r,promptMfa:r,init:r,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:r,submitEnrollmentWithPasskey:r,unenroll:r,submit:r,cancel:r,sendTransaction:r,signTransaction:r,exportWallet:r,setWalletPassword:r,setWalletRecovery:r,requestFarcasterSignerFromWarpcast:r,getFarcasterSignerPublicKey:r,signFarcasterMessage:r,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:r,sendTransactionWithCrossAppWallet:r,isModalOpen:!1,mfaMethods:[]}),g=()=>i(k),w=()=>{let{getAccessToken:e}=g(),{walletProxy:t}=s();return a((()=>({signWithUserSigner:async({message:i})=>{if(!t)throw Error("Wallet proxy not initialized");let a=await e();if(!a)throw Error("User must be authenticated");let{signature:r}=await t.signWithUserSigner({accessToken:a,message:i});return{signature:r}}})),[t,e])};export{k as P,w as a,y as b,A as c,o as d,c as e,f,d as g,v as h,b as i,m as j,p as k,u as l,h as m,g as u};
|