@privy-io/react-auth 1.86.0 → 1.87.0-beta-20240920184838

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.
@@ -0,0 +1 @@
1
+ var L=(t,n,o)=>{if(!n.has(t))throw TypeError("Cannot "+o)};var ut=(t,n,o)=>(L(t,n,"read from private field"),o?o.call(t):n.get(t)),ht=(t,n,o)=>{if(n.has(t))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(t):n.set(t,o)},gt=(t,n,o,s)=>(L(t,n,"write to private field"),s?s.call(t,o):n.set(t,o),o);var yt=(t,n,o)=>(L(t,n,"access private method"),o);var F="1.87.0-beta-20240920184838";var H="34357d3c125c2bcf2ce2bc3309d98715",_t="https://auth.privy.io",Ct=2e4,St=1400,At=2500,wt=4e3,Tt=F;var kt="privy:token",Pt="privy-token",xt="privy:refresh_token",Wt="privy-refresh-token",vt="privy:id_token",Ot="privy-id-token",It="privy-session",Ut="privy:session_transfer_token",De="privy:wallet",Lt="privy:caid",Rt=t=>`privy:guest:${t}`,Mt=t=>`privy:cross-app:${t}`,Nt="privy:state_code",Dt="privy:code_verifier",Ft="privy:headless_oauth",Ht="privy:oauth_disable_signup",jt=t=>`${De}:${t}`,Kt="privy:connectors",Yt="privy:connections";var Gt=12e4,Bt=1,qt="0x1",zt=3e4,Vt="https://api.moonpay.com/v1",Xt="https://api.moonpay.com/v1",$t="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Zt="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";var Jt="deprecated";var j={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"}}};var K={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};var Y={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}};var G={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0};var B={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"}}};var q={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};var z={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};var V={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1};var X={id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0};var $={id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}};var Z={id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}};var J={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"}}};var Q={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"}}};var ee={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};var te={id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0};var ne={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"}}};var W={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"}}};var oe={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"}}};var se={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};var ie={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"}}};var ae={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};var re={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/"}}};var le={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};var pe={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"}}};var ce={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};var de={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};var v=[j,K,le,W,oe,se,ie,ae,V,X,$,Z,B,q,z,ne,ee,te,Y,G,pe,de,ce,Q,re,J],Qn=new Set(v.map(t=>t.id));import{createContext as Fe,useContext as He}from"react";var e=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var je=Fe({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:e,login:e,connectOrCreateWallet:e,linkEmail:e,linkPhone:e,linkFarcaster:e,linkWallet:e,startCrossAppAuthFlow:e,linkGoogle:e,linkTwitter:e,linkDiscord:e,linkGithub:e,linkSpotify:e,linkInstagram:e,linkTelegram:e,linkTiktok:e,linkLinkedIn:e,linkApple:e,linkPasskey:e,updateEmail:e,updatePhone:e,logout:e,getAccessToken:e,getEthereumProvider:e,getEthersProvider:e,getWeb3jsProvider:e,unlinkEmail:e,unlinkPhone:e,unlinkWallet:e,unlinkGoogle:e,unlinkTwitter:e,unlinkDiscord:e,unlinkGithub:e,unlinkSpotify:e,unlinkInstagram:e,unlinkTiktok:e,unlinkLinkedIn:e,unlinkApple:e,unlinkCrossAppAccount:e,unlinkFarcaster:e,unlinkTelegram:e,unlinkPasskey:e,setActiveWallet:e,forkSession:e,createWallet:e,importWallet:e,signMessage:e,signTypedData:e,enrollInMfa:e,initEnrollmentWithSms:e,initEnrollmentWithTotp:e,initEnrollmentWithPasskey:e,promptMfa:e,init:e,submitEnrollmentWithSms:e,submitEnrollmentWithTotp:e,submitEnrollmentWithPasskey:e,unenroll:e,submit:e,cancel:e,sendTransaction:e,sendSolanaTransaction:e,exportWallet:e,setWalletPassword:e,setWalletRecovery:e,requestFarcasterSignerFromWarpcast:e,getFarcasterSignerPublicKey:e,signFarcasterMessage:e,createGuestAccount:e,initLoginWithEmail:e,initLoginWithSms:e,otpState:{status:"initial"},loginWithCode:e,fundWallet:e,initLoginWithHeadlessOAuth:e,loginWithHeadlessOAuth:e,generateSiweMessage:e,linkWithSiwe:e,signMessageWithCrossAppWallet:e,signTypedDataWithCrossAppWallet:e,sendTransactionWithCrossAppWallet:e,isHeadlessOAuthLoading:!1,isModalOpen:!1,mfaMethods:[]}),so=()=>He(je);import{createContext as Ke,useContext as Ye}from"react";var Ge=Ke(null);function ro(){let t=Ye(Ge);if(t===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return t}import{FetchError as Be}from"ofetch";var g=class extends Error{constructor(o,s,i){super(o);s instanceof Error&&(this.cause=s),this.privyErrorCode=i}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},O=class extends g{constructor(o,s,i,r,l,p){super(i,r,l);this.type=o;this.status=s,this.data=p}},u=class extends g{constructor(o,s,i){super(o,s,i);this.type="client_error"}},me=class extends u{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var ue=class extends g{constructor(o,s,i){super(o,s,i);this.type="connector_error"}},co=t=>{if(t instanceof g)return t;if(!(t instanceof Be))return qe(t);if(!t.response)return new O("api_error",null,t.message,t);let{type:n,message:o,error:s,code:i}=t.data;return new O(n||"ApiError",t.response.status,o||s,t,i,t.data)},qe=t=>t instanceof g?t:t instanceof Error?new u(t.message,t):new u(`Internal error: ${t}`);var he=class extends u{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},ge=class extends u{constructor(n="Embedded wallet error",o){super(n,o,"unknown_embedded_wallet_error")}},ye=class extends u{constructor(n="User must be authenticated"){super(n,void 0,"must_be_authenticated")}};var fe=class extends u{constructor(n){super("This application is in development mode and must be upgraded to production to log in new users.",n,"max_accounts_reached")}};import{useContext as Pe,useEffect as ke,useMemo as st,useState as it}from"react";import{createContext as at}from"react";var d={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:H,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"all"}},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};var be=({input:t})=>{if(!t||!t.primary[0])return;let n=[t.primary[0]],o=[];t.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`");for(let s of t.primary.slice(1))n.includes(s)?console.warn(`Duplicated login method: ${s}`):n.push(s);for(let s of t.overflow??[])!n.includes(s)&&!o.includes(s)?o.push(s):console.warn(`Duplicated login method: ${s}`);return{primary:n,overflow:o}};var ze=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets","rabby_wallet","safe"]),Ee=t=>ze.has(t),_e=(t,n,o)=>o.indexOf(t)===n,Ce=({input:t,overrides:n})=>n?n.primary.concat(n.overflow??[]).filter(Ee).filter(_e):t?t.filter(Ee).filter(_e):d.appearance.walletList;import y from"tinycolor2";var Se="#FFFFFF",Ve="#040217",Xe=Se,$e="#1E1E1D";function Ze(t){return t<.8&&t>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),t>.5?"light":"dark"}function m(t,n){let o=Math.max(0,Math.min(1,t.toHsl().l+n));return y({...t.toHsl(),l:o})}var Je="#51BA81",Qe="#FFB74D",et="#EC6351",tt=Se,nt=Ve;function Ae({backgroundTheme:t,accentHex:n}){let o;switch(t){case"light":o=Xe;break;case"dark":o=$e;break;default:o=t;break}let s=y(o),i=y(n),r=y(Je),l=y(Qe),p=y(et),a=Ze(s.getLuminance()),c=m(s,a==="light"?-.04:.11),h=m(s,a==="light"?-.88:.87),f=m(s,a==="light"?-.7:.75),b=m(s,a==="light"?-.43:.45).desaturate(a==="light"?60:20),E=m(s,a==="light"?-.08:.25).desaturate(a==="light"?60:20),_=m(i,.15),C=m(i,-.06),S=m(p,.3),A=m(l,.3),w=y(i.getLuminance()>.5?nt:tt),P=m(r,-.16),x=m(r,.4);return{colorScheme:a,background:s.toHslString(),background2:c.toHslString(),foreground:h.toHslString(),foreground2:f.toHslString(),foreground3:b.toHslString(),foreground4:E.toHslString(),accent:i.toHslString(),accentLight:_.toHslString(),accentDark:C.toHslString(),foregroundAccent:w.toHslString(),success:r.toHslString(),successDark:P.toHslString(),successLight:x.toHslString(),error:p.toHslString(),errorLight:S.toHslString(),warn:l.toHslString(),warnLight:A.toHslString()}}function R(t,n,o){let s=o?console.warn:()=>{},i,r,l,p,a,c,h,f,b,E,_,C,S,A,w;n?.loginMethods?(i=n.loginMethods.includes("email"),r=n.loginMethods.includes("sms"),p=n.loginMethods.includes("wallet"),a=n.loginMethods.includes("google"),c=n.loginMethods.includes("twitter"),h=n.loginMethods.includes("discord"),b=n.loginMethods.includes("spotify"),E=n.loginMethods.includes("instagram"),f=n.loginMethods.includes("tiktok"),C=n.loginMethods.includes("github"),_=n.loginMethods.includes("linkedin"),S=n.loginMethods.includes("apple"),A=n.loginMethods.includes("farcaster"),w=n.loginMethods.includes("telegram")):(i=t.emailAuth,r=t.smsAuth,p=t.walletAuth,a=t.googleOAuth,c=t.twitterOAuth,h=t.discordOAuth,C=t.githubOAuth,b=t.spotifyOAuth,E=t.instagramOAuth,f=t.tiktokOAuth,_=t.linkedinOAuth,S=t.appleOAuth,A=t.farcasterAuth,w=t.telegramAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?l=!1:t.passkeyAuth&&(l=!0);let P=[i,r].filter(Boolean),x=[a,c,h,C,b,E,f,_,S,A,w].filter(Boolean),I=[p].filter(Boolean);if(P.length+x.length+I.length===0)throw new Error("You must enable at least one login method");let T=n?.appearance?.showWalletLoginFirst!==void 0?n?.appearance?.showWalletLoginFirst:t.showWalletLoginFirst;T&&I.length===0?(s("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),T=!1):!T&&x.length+P.length===0&&(s("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),T=!0);let We=n?.externalWallets?.walletConnect?.enabled??!0;n?.loginMethods&&n.loginMethodsAndOrder&&s("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let ve=Ce({input:n?.appearance?.walletList,overrides:n?.loginMethodsAndOrder}),Oe=be({input:n?.loginMethodsAndOrder}),Ie=n?.intl?.defaultCountry??"US",{chains:Ue,defaultChain:Le}=ot({additionalChains:n?.additionalChains,supportedChains:n?.supportedChains,defaultChainFromConfig:n?.defaultChain,hasRpcConfigDefined:Object.keys(n?.rpcConfig?.rpcUrls??{}).length>0}),Re=!!n?.defaultChain,U=n?.customAuth?.getCustomAccessToken&&n?.customAuth?.enabled!==!1,k,N=!(t.enforceWalletUis??!0);if(t.legacyWalletUiConfig??!0?U?k=n?.embeddedWallets?.noPromptOnSignature??!0:k=n?.embeddedWallets?.noPromptOnSignature??N:k=N,n?.embeddedWallets?.waitForTransactionConfirmation===!1&&k!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:D,...Me}=n?.embeddedWallets??{};return{id:t.id,name:t.name,allowlistConfig:t.allowlistConfig,legacyWalletUiConfig:t.legacyWalletUiConfig,appearance:{logo:n?.appearance?.logo??t.logoUrl,landingHeader:n?.appearance?.landingHeader??d.appearance.landingHeader,loginMessage:typeof n?.appearance?.loginMessage=="string"?n?.appearance?.loginMessage.slice(0,100):n?.appearance?.loginMessage,palette:Ae({backgroundTheme:n?.appearance?.theme??d.appearance.theme,accentHex:n?.appearance?.accentColor??t.accentColor??d.appearance.accentColor}),loginGroupPriority:T?"web3-first":"web2-first",hideDirectWeb2Inputs:!!n?.appearance?.hideDirectWeb2Inputs,walletList:ve,walletChainType:n?.appearance?.walletChainType??"ethereum-only"},loginMethods:{wallet:p,email:i,sms:r,passkey:l,google:a,twitter:c,discord:h,github:C,spotify:b,instagram:E,tiktok:f,linkedin:_,apple:S,farcaster:A,telegram:w},loginMethodsAndOrder:Oe,legal:{termsAndConditionsUrl:n?.legal?.termsAndConditionsUrl??t.termsAndConditionsUrl,privacyPolicyUrl:n?.legal?.privacyPolicyUrl??t.privacyPolicyUrl,requireUsersAcceptTerms:t.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:n?.walletConnectCloudProjectId??t.walletConnectCloudProjectId??d.walletConnectCloudProjectId,rpcConfig:{rpcUrls:n?.rpcConfig?.rpcUrls??d.rpcConfig.rpcUrls,rpcTimeouts:n?.rpcConfig?.rpcTimeouts??d.rpcConfig.rpcTimeouts},chains:Ue,defaultChain:Le,intl:{defaultCountry:Ie},shouldEnforceDefaultChainOnConnect:Re,captchaEnabled:t.captchaEnabled??d.captchaEnabled,captchaSiteKey:t.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:n?.externalWallets?.coinbaseWallet?.connectionOptions??d.externalWallets.coinbaseWallet.connectionOptions},walletConnect:{enabled:We},solana:{connectors:n?.externalWallets?.solana?.connectors}},embeddedWallets:{...t.embeddedWalletConfig,...typeof D=="boolean"?{requireUserOwnedRecoveryOnCreate:D}:{},...U?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...Me,noPromptOnSignature:k},mfa:{methods:t.mfaMethods??[],noPromptOnMfaRequired:n?.mfa?.noPromptOnMfaRequired??!1},customAuth:U?{enabled:!0,...n.customAuth}:void 0,loginConfig:{telegramAuthConfiguration:t.telegramAuthConfiguration},headless:!!n?.headless,render:{standalone:n?._render?.standalone??d._render.standalone},fundingConfig:t.fundingConfig,fundingMethodConfig:{...n?.fundingMethodConfig??d.fundingMethodConfig,moonpay:{...n?.fundingMethodConfig?.moonpay??d.fundingMethodConfig.moonpay,useSandbox:n?.fundingMethodConfig?.moonpay.useSandbox??n?.fiatOnRamp?.useSandbox??d.fundingMethodConfig.moonpay.useSandbox}}}}function we(t,n){if(!t)return{legacyCreateEmbeddedWalletFlag:n};let{appearance:o,additionalChains:s,supportedChains:i,defaultChain:r,externalWallets:l,...p}=t;return{...p,...s?{additionalChains:s.map(c=>c.id)}:void 0,...i?{supportedChains:i.map(c=>c.id)}:void 0,...r?{defaultChain:r.id}:void 0,...l?{walletConnect:l.walletConnect,coinbaseWallet:l.coinbaseWallet,solana:{connectors:l.solana?.connectors?.get().map(c=>c.walletClientType)}}:void 0,legacyCreateEmbeddedWalletFlag:n}}function ot({additionalChains:t,supportedChains:n,defaultChainFromConfig:o,hasRpcConfigDefined:s}){let i;if(t&&n&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),n){if(n.length===0)throw new Error("`supportedChains` must contain at least one chain");n.filter(a=>a.rpcUrls.privyWalletOverride).length>0&&s&&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`."),i=n.map(a=>a.rpcUrls.privyWalletOverride?a:v.find(h=>h.id===a.id)??a)}else i=v.concat(t??[]);let r=n?i[0]:W,l=o??r;if(!i.find(p=>p.id===l.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:i,defaultChain:l}}var Te=function(t,n=0){let o=3735928559^n,s=1103547991^n;for(let i=0,r;i<t.length;i++)r=t.charCodeAt(i),o=Math.imul(o^r,2654435761),s=Math.imul(s^r,1597334677);return o=Math.imul(o^o>>>16,2246822507),o^=Math.imul(s^s>>>13,3266489909),s=Math.imul(s^s>>>16,2246822507),s^=Math.imul(o^o>>>13,3266489909),4294967296*(2097151&s)+(o>>>0)};import{jsx as lt}from"react/jsx-runtime";var xe={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},rt=R(xe,void 0,!1),M=at({appConfig:rt,isServerConfigLoaded:!1}),Uo=({children:t,legacyCreateEmbeddedWalletFlag:n,client:o,clientConfig:s})=>{let[i,r]=it(null),l=st(()=>R(i??xe,s,!!i),[i,s]);return ke(()=>{if(!i)return;let p=we(s,n),a=Te(JSON.stringify(p)).toString(),c=`privy:sent:${i.id}:${a}`;localStorage.getItem(c)||(o.createAnalyticsEvent({eventName:"sdk_initialize",payload:p}),localStorage.setItem(c,"t"))},[s,n,i]),ke(()=>{i||(async()=>{try{let a=await o.getServerConfig();a.customApiUrl&&o.updateApiUrl(a.customApiUrl),r(a)}catch(a){console.warn("Error generating app config: ",a)}})()},[]),lt(M.Provider,{value:{appConfig:l,isServerConfigLoaded:!!i},children:t})},Lo=()=>{let{appConfig:t}=Pe(M);return t},Ro=()=>{let{isServerConfigLoaded:t}=Pe(M);return t};import{createContext as pt,useContext as ct}from"react";var dt=pt({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:e,initializeWalletProxy:e,getAuthMeta:e,getAuthFlow:e,closePrivyModal:e,openPrivyModal:e,connectWallet:e,initLoginWithWallet:e,loginWithWallet:e,initLoginWithFarcaster:e,loginWithFarcaster:e,loginWithCode:e,initLoginWithEmail:e,initLoginWithSms:e,initUpdateEmail:e,initUpdatePhone:e,resendEmailCode:e,resendSmsCode:e,initLoginWithHeadlessOAuth:e,loginWithHeadlessOAuth:e,crossAppAuthFlow:e,initLoginWithOAuth:e,recoveryOAuthFlow:e,loginWithOAuth:e,passkeyAuthState:{status:"initial"},setPasskeyAuthState:e,initLoginWithPasskey:e,loginWithPasskey:e,initLinkWithPasskey:e,linkWithPasskey:e,refreshUser:e,loginWithGuestAccountFlow:e,walletProxy:null,createAnalyticsEvent:e,acceptTerms:e,getUsdTokenPrice:e,getUsdPriceForSol:e,recoverEmbeddedEthereumWallet:e,getMoonpaySignedUrl:e,initCoinbaseOnRamp:e,getCoinbaseOnRampStatus:e,updateWallets:e,fundWallet:e,setReadyToTrue:e,requestFarcasterSignerStatus:e,initLoginWithTelegram:e,loginWithTelegram:e,generateSiweMessage:e,linkWithSiwe:e,linkSmartWallet:e,embeddedSolanaWallet:null,createEmbeddedSolanaWallet:e,recoverEmbeddedSolanaWallet:e,exportSolanaWallet:e,solanaSignMessage:e,connectCoinbaseSmartWallet:e,initiateAccountTransfer:e}),Ho=()=>ct(dt);export{ut as a,ht as b,gt as c,yt as d,g as e,O as f,u as g,me as h,ue as i,co as j,qe as k,he as l,ge as m,ye as n,fe as o,_t as p,Ct as q,St as r,At as s,wt as t,Tt as u,kt as v,Pt as w,xt as x,Wt as y,vt as z,Ot as A,It as B,Ut as C,Lt as D,Rt as E,Mt as F,Nt as G,Dt as H,Ft as I,Ht as J,jt as K,Kt as L,Yt as M,Gt as N,Bt as O,qt as P,zt as Q,Vt as R,Xt as S,$t as T,Zt as U,Jt as V,e as W,j as X,K as Y,Y as Z,G as _,B as $,q as aa,V as ba,ee as ca,W as da,oe as ea,se as fa,ie as ga,ae as ha,le as ia,pe as ja,v as ka,Qn as la,rt as ma,Uo as na,Lo as oa,Ro as pa,dt as qa,Ho as ra,je as sa,so as ta,Ge as ua,ro as va};
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{A as I,B as J,C as K,D as L,E as M,F as N,G as O,H as P,I as Q,J as R,K as S,L as T,M as U,a as b,b as c,c as d,d as e,f as g,g as h,h as i,i as k,j as m,k as n,l as o,m as r,n as s,o as t,p as u,q as v,r as x,s as y,t as z,u as A,v as B,w as D,x as F,y as G,z as H}from"./chunk-7M4DBJFW.js";import{R as l,aa as w,ba as C,ca as E}from"./chunk-QVSCWGK3.js";import{c as p,f as V}from"./chunk-TIACG3L3.js";import{ka as f,ta as j,u as a,va as q}from"./chunk-Z4PCJGI3.js";export{d as AsExternalProvider,i as Captcha,g as ConnectorManager,e as EthereumWalletConnector,t as LoginModal,h as PrivyClient,v as PrivyProvider,c as PrivyProxyProvider,f as SUPPORTED_CHAINS,a as VERSION,b as WalletConnector,p as addRpcUrlOverrideToChain,o as errorIndicatesMaxMfaRetries,m as errorIndicatesMfaTimeout,n as errorIndicatesMfaVerificationFailed,u as getAccessToken,V as getEmbeddedConnectedWallet,G as useConnectCoinbaseSmartWallet,C as useConnectWallet,D as useCreateWallet,H as useCrossAppAccounts,S as useCustomAuth,T as useExperimentalFarcasterSigner,U as useFarcasterSigner,E as useFundWallet,L as useGuestAccounts,B as useLinkAccount,A as useLinkWithSiwe,w as useLogin,y as useLoginWithEmail,x as useLoginWithOAuth,z as useLoginWithSms,l as useLogout,r as useMfa,s as useMfaEnrollment,P as useModalStatus,R as useOAuthTokens,j as usePrivy,k as useRegisterMfaListener,J as useSendSolanaTransaction,I as useSendTransaction,K as useSetWalletPassword,M as useSetWalletRecovery,N as useSignMessage,O as useSignTypedData,F as useSolanaWallets,Q as useToken,q as useWallets};
1
+ import{A as I,B as J,C as K,D as L,E as M,F as N,G as O,H as P,I as Q,J as R,K as S,L as T,M as U,N as V,a as b,b as c,c as d,d as e,f as g,g as h,h as i,i as k,j as m,k as n,l as o,m as r,n as s,o as t,p as u,q as v,r as x,s as y,t as z,u as A,v as B,w as C,x as E,y as G,z as H}from"./chunk-E7B7OFUX.js";import{R as l,aa as w,ba as D,ca as F}from"./chunk-4RGQ4R3M.js";import{c as p,f as W}from"./chunk-4ODVFLKF.js";import{ka as f,ta as j,u as a,va as q}from"./chunk-VGM5FGSZ.js";export{d as AsExternalProvider,i as Captcha,g as ConnectorManager,e as EthereumWalletConnector,t as LoginModal,h as PrivyClient,v as PrivyProvider,c as PrivyProxyProvider,f as SUPPORTED_CHAINS,a as VERSION,b as WalletConnector,p as addRpcUrlOverrideToChain,o as errorIndicatesMaxMfaRetries,m as errorIndicatesMfaTimeout,n as errorIndicatesMfaVerificationFailed,u as getAccessToken,W as getEmbeddedConnectedWallet,H as useConnectCoinbaseSmartWallet,D as useConnectWallet,E as useCreateWallet,I as useCrossAppAccounts,T as useCustomAuth,U as useExperimentalFarcasterSigner,V as useFarcasterSigner,F as useFundWallet,M as useGuestAccounts,C as useLinkAccount,B as useLinkWithSiwe,w as useLogin,y as useLoginWithEmail,x as useLoginWithOAuth,z as useLoginWithPasskey,A as useLoginWithSms,l as useLogout,r as useMfa,s as useMfaEnrollment,Q as useModalStatus,S as useOAuthTokens,j as usePrivy,k as useRegisterMfaListener,K as useSendSolanaTransaction,J as useSendTransaction,L as useSetWalletPassword,N as useSetWalletRecovery,O as useSignMessage,P as useSignTypedData,G as useSolanaWallets,R as useToken,q as useWallets};
@@ -1 +1 @@
1
- import{b as I,d as _,e as G,f as b}from"./chunk-TIACG3L3.js";import{g as A,oa as E,ra as h,ta as N,va as F}from"./chunk-Z4PCJGI3.js";import{createContext as ee,useContext as te,useEffect as L,useState as B}from"react";import{createSmartAccountClient as $}from"permissionless";import{toBiconomySmartAccount as q,toEcdsaKernelSmartAccount as Q,toLightSmartAccount as V,toSafeSmartAccount as Y}from"permissionless/accounts";import{createPimlicoClient as j}from"permissionless/clients/pimlico";import{createPublicClient as O,http as x}from"viem";import{entryPoint06Address as K,entryPoint07Address as z}from"viem/account-abstraction";var J=({calls:r,chain:t,maxPriorityFeePerGas:n,maxFeePerGas:o,nonce:l})=>r.map(c=>({to:c.to||void 0,data:c.data,value:c.value,chainId:t.id,nonce:l,maxFeePerGas:o,maxPriorityFeePerGas:n})),H=()=>{let{chains:r,noPromptOnSignature:t,openPrivyModal:n}=h(),o=E(),{setModalData:l}=I();return{getSmartWalletClient:async(c,P,i,T)=>{let u=_(r),p=G(i.chainId),d=u.find(e=>e.id===p);if(!d)throw new Error(`Error finding chain object for smart wallet network ${i.chainId} in app config. Please ensure you have a chain object for ${i.chainId} in app config.`);let C=await c.getEthereumProvider(),{sendTransaction:S,signMessage:y,signTypedData:W,...a}=await Z({owner:C,smartWalletType:P,chain:d,paymasterContext:T,...i});return{...a,sendTransaction:async e=>{if(o.embeddedWallets.noPromptOnSignature||t.current)return await S(e);let m=[];"calls"in e&&typeof e.calls<"u"?m=[...e.calls]:"to"in e&&(m=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let g=async()=>{if(!a.paymaster)return!1;let{paymasterAndData:f,paymasterData:v}=await a.prepareUserOperation({calls:m,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return Number(f??v??0)>0};return new Promise(async(f,v)=>{t.current=!0,l({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:()=>{}},sendTransaction:{transactionRequests:J({calls:m,chain:d,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:g,onConfirm:()=>S(e),onSuccess:k=>f(k.hash),onFailure:v,uiOptions:{}}}),n("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1})},signMessage:async({message:e})=>o.embeddedWallets.noPromptOnSignature||t.current?await y({message:e}):new Promise(async(m,g)=>{t.current=!0,l({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>y({message:e}),onSuccess:f=>m(f),onFailure:g,uiOptions:{}}}),n("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1}),signTypedData:async e=>t.current?await W(e):new Promise(async(m,g)=>{t.current=!0,l({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>W(e),onSuccess:f=>m(f),onFailure:g,uiOptions:{}}}),n("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1})}}}},R={address:K,version:"0.6"},M={address:z,version:"0.7"},X=({owner:r,smartWalletType:t,chain:n})=>{let o=O({chain:n,transport:x()});switch(t){case"safe":return Y({client:o,entryPoint:M,owners:[r],version:"1.4.1"});case"kernel":return Q({client:o,version:"0.3.1",entryPoint:M,owners:[r]});case"biconomy":return q({client:o,owners:[r],entryPoint:R});case"light_account":return V({client:o,entryPoint:R,owner:r,version:"1.1.0"});default:throw new Error(`Invalid smart account type: ${t}.`)}},Z=async({owner:r,smartWalletType:t,chain:n,bundlerUrl:o,paymasterUrl:l,paymasterContext:c})=>{let P=O({chain:n,transport:x()}),i=await X({owner:r,smartWalletType:t,chain:n}),u=!!l?j({transport:x(l),entryPoint:i.entryPoint}):void 0;return $({account:i,chain:n,paymaster:u,paymasterContext:c,bundlerTransport:x(o),userOperation:{estimateFeesPerGas:async()=>{let p=await P.estimateFeesPerGas();return{...p,maxFeePerGas:p.maxFeePerGas*115n/100n,maxPriorityFeePerGas:p.maxPriorityFeePerGas*115n/100n}}}})};import{jsx as re}from"react/jsx-runtime";var U=ee({client:void 0}),ne=({config:r,children:t})=>{let[n,o]=B(null),{getSmartWalletClient:l}=H(),{generateSiweMessage:c,linkSmartWallet:P,client:i,noPromptOnSignature:T}=h(),{defaultChain:u}=E(),{wallets:p}=F(),{user:d}=N(),[C,S]=B(),y=b(p);return L(()=>{!n&&i&&(async()=>{try{if(!i){console.warn("No client found");return}let a=await i.getSmartWalletsConfig();o(a)}catch(a){console.warn("Error generating smart wallet config: ",a)}})()},[!!i]),L(()=>{(async()=>{if(!n?.enabled||!d||!y){S(void 0);return}if(C)return;let a=n.configuredNetworks.find(s=>s.chainId===`eip155:${u.id}`);if(!a)throw new A(`The defaultChain ${u.name} (eip155:${u.id}) must be configured in the smart wallet configuration in your dashboard`);if(d.smartWallet)try{let s=await l(y,d.smartWallet.smartWalletType,a,r?.paymasterContext);S(s);return}catch(s){console.error("Error loading smart wallet:",s);return}try{let s=await l(y,n.smartWalletType,a,r?.paymasterContext),w=await c({address:s.account.address,chainId:a.chainId});T.current=!0;let D=await s.signMessage({message:w});await P({signature:D,message:w,smartWalletType:n.smartWalletType}),S(s)}catch(s){console.error("Error creating smart wallet:",s)}finally{T.current=!1}})()},[!!n?.enabled,!!d?.smartWallet,!!y]),re(U.Provider,{value:{client:C},children:t})},ae=()=>te(U);export{ne as SmartWalletsProvider,ae as useSmartWallets};
1
+ import{b as I,d as _,e as G,f as b}from"./chunk-4ODVFLKF.js";import{g as A,oa as E,ra as h,ta as N,va as F}from"./chunk-VGM5FGSZ.js";import{createContext as ee,useContext as te,useEffect as L,useState as B}from"react";import{createSmartAccountClient as $}from"permissionless";import{toBiconomySmartAccount as q,toEcdsaKernelSmartAccount as Q,toLightSmartAccount as V,toSafeSmartAccount as Y}from"permissionless/accounts";import{createPimlicoClient as j}from"permissionless/clients/pimlico";import{createPublicClient as O,http as x}from"viem";import{entryPoint06Address as K,entryPoint07Address as z}from"viem/account-abstraction";var J=({calls:r,chain:t,maxPriorityFeePerGas:n,maxFeePerGas:o,nonce:l})=>r.map(c=>({to:c.to||void 0,data:c.data,value:c.value,chainId:t.id,nonce:l,maxFeePerGas:o,maxPriorityFeePerGas:n})),H=()=>{let{chains:r,noPromptOnSignature:t,openPrivyModal:n}=h(),o=E(),{setModalData:l}=I();return{getSmartWalletClient:async(c,P,i,T)=>{let u=_(r),p=G(i.chainId),d=u.find(e=>e.id===p);if(!d)throw new Error(`Error finding chain object for smart wallet network ${i.chainId} in app config. Please ensure you have a chain object for ${i.chainId} in app config.`);let C=await c.getEthereumProvider(),{sendTransaction:S,signMessage:y,signTypedData:W,...a}=await Z({owner:C,smartWalletType:P,chain:d,paymasterContext:T,...i});return{...a,sendTransaction:async e=>{if(o.embeddedWallets.noPromptOnSignature||t.current)return await S(e);let m=[];"calls"in e&&typeof e.calls<"u"?m=[...e.calls]:"to"in e&&(m=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let g=async()=>{if(!a.paymaster)return!1;let{paymasterAndData:f,paymasterData:v}=await a.prepareUserOperation({calls:m,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return Number(f??v??0)>0};return new Promise(async(f,v)=>{t.current=!0,l({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:()=>{}},sendTransaction:{transactionRequests:J({calls:m,chain:d,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:g,onConfirm:()=>S(e),onSuccess:k=>f(k.hash),onFailure:v,uiOptions:{}}}),n("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1})},signMessage:async({message:e})=>o.embeddedWallets.noPromptOnSignature||t.current?await y({message:e}):new Promise(async(m,g)=>{t.current=!0,l({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>y({message:e}),onSuccess:f=>m(f),onFailure:g,uiOptions:{}}}),n("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1}),signTypedData:async e=>t.current?await W(e):new Promise(async(m,g)=>{t.current=!0,l({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>W(e),onSuccess:f=>m(f),onFailure:g,uiOptions:{}}}),n("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1})}}}},R={address:K,version:"0.6"},M={address:z,version:"0.7"},X=({owner:r,smartWalletType:t,chain:n})=>{let o=O({chain:n,transport:x()});switch(t){case"safe":return Y({client:o,entryPoint:M,owners:[r],version:"1.4.1"});case"kernel":return Q({client:o,version:"0.3.1",entryPoint:M,owners:[r]});case"biconomy":return q({client:o,owners:[r],entryPoint:R});case"light_account":return V({client:o,entryPoint:R,owner:r,version:"1.1.0"});default:throw new Error(`Invalid smart account type: ${t}.`)}},Z=async({owner:r,smartWalletType:t,chain:n,bundlerUrl:o,paymasterUrl:l,paymasterContext:c})=>{let P=O({chain:n,transport:x()}),i=await X({owner:r,smartWalletType:t,chain:n}),u=!!l?j({transport:x(l),entryPoint:i.entryPoint}):void 0;return $({account:i,chain:n,paymaster:u,paymasterContext:c,bundlerTransport:x(o),userOperation:{estimateFeesPerGas:async()=>{let p=await P.estimateFeesPerGas();return{...p,maxFeePerGas:p.maxFeePerGas*115n/100n,maxPriorityFeePerGas:p.maxPriorityFeePerGas*115n/100n}}}})};import{jsx as re}from"react/jsx-runtime";var U=ee({client:void 0}),ne=({config:r,children:t})=>{let[n,o]=B(null),{getSmartWalletClient:l}=H(),{generateSiweMessage:c,linkSmartWallet:P,client:i,noPromptOnSignature:T}=h(),{defaultChain:u}=E(),{wallets:p}=F(),{user:d}=N(),[C,S]=B(),y=b(p);return L(()=>{!n&&i&&(async()=>{try{if(!i){console.warn("No client found");return}let a=await i.getSmartWalletsConfig();o(a)}catch(a){console.warn("Error generating smart wallet config: ",a)}})()},[!!i]),L(()=>{(async()=>{if(!n?.enabled||!d||!y){S(void 0);return}if(C)return;let a=n.configuredNetworks.find(s=>s.chainId===`eip155:${u.id}`);if(!a)throw new A(`The defaultChain ${u.name} (eip155:${u.id}) must be configured in the smart wallet configuration in your dashboard`);if(d.smartWallet)try{let s=await l(y,d.smartWallet.smartWalletType,a,r?.paymasterContext);S(s);return}catch(s){console.error("Error loading smart wallet:",s);return}try{let s=await l(y,n.smartWalletType,a,r?.paymasterContext),w=await c({address:s.account.address,chainId:a.chainId});T.current=!0;let D=await s.signMessage({message:w});await P({signature:D,message:w,smartWalletType:n.smartWalletType}),S(s)}catch(s){console.error("Error creating smart wallet:",s)}finally{T.current=!1}})()},[!!n?.enabled,!!d?.smartWallet,!!y]),re(U.Provider,{value:{client:C},children:t})},ae=()=>te(U);export{ne as SmartWalletsProvider,ae as useSmartWallets};
@@ -1 +1 @@
1
- import{e as a,x as m}from"./chunk-7M4DBJFW.js";import"./chunk-QVSCWGK3.js";import"./chunk-TIACG3L3.js";import"./chunk-Z4PCJGI3.js";import{isWalletAdapterCompatibleStandardWallet as C}from"@solana/wallet-adapter-base";import{StandardWalletAdapter as S}from"@solana/wallet-standard-wallet-adapter-base";import{getWallets as f}from"@wallet-standard/app";var u=l=>{let{get:r,on:c}=f(),p=l?.shouldAutoConnect??!0,t=i(r()),e=t.map(o=>new a(o,p)),s=[],d;return{_setOnConnectorsUpdated:o=>{d=o},onMount:()=>{s.push(c("register",(...o)=>{t=t.concat(...i(o)),e=t.map(n=>new a(n,p)),d?.(e)}),c("unregister",(...o)=>{t=t.filter(n=>o.some(W=>n.wallet===W)),e=t.map(n=>new a(n,p)),d?.(e)}))},onUnmount:()=>{let o=s.pop();for(;o;)o(),o=s.pop()},get:()=>e}},i=l=>l.filter(C).map(r=>new S({wallet:r}));export{a as SolanaAdapterConnector,u as toSolanaWalletConnectors,m as useSolanaWallets};
1
+ import{e as a,y as m}from"./chunk-E7B7OFUX.js";import"./chunk-4RGQ4R3M.js";import"./chunk-4ODVFLKF.js";import"./chunk-VGM5FGSZ.js";import{isWalletAdapterCompatibleStandardWallet as C}from"@solana/wallet-adapter-base";import{StandardWalletAdapter as S}from"@solana/wallet-standard-wallet-adapter-base";import{getWallets as f}from"@wallet-standard/app";var u=l=>{let{get:r,on:c}=f(),p=l?.shouldAutoConnect??!0,t=i(r()),e=t.map(o=>new a(o,p)),s=[],d;return{_setOnConnectorsUpdated:o=>{d=o},onMount:()=>{s.push(c("register",(...o)=>{t=t.concat(...i(o)),e=t.map(n=>new a(n,p)),d?.(e)}),c("unregister",(...o)=>{t=t.filter(n=>o.some(W=>n.wallet===W)),e=t.map(n=>new a(n,p)),d?.(e)}))},onUnmount:()=>{let o=s.pop();for(;o;)o(),o=s.pop()},get:()=>e}},i=l=>l.filter(C).map(r=>new S({wallet:r}));export{a as SolanaAdapterConnector,u as toSolanaWalletConnectors,m as useSolanaWallets};
package/dist/esm/ui.js CHANGED
@@ -1,4 +1,4 @@
1
- import{D as q,K as j,Q as e1,R as t1,V as o1,W as r1,Z as n1,aa as i1,ba as s1,ca as l1,h as I,r as Y,v as J}from"./chunk-QVSCWGK3.js";import{oa as Q,ra as R,ta as g,va as w}from"./chunk-Z4PCJGI3.js";import{jsx as a1}from"react/jsx-runtime";var p1=e=>a1("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:a1("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"})});import P2 from"styled-components";var H=P2.button`
1
+ import{D as q,K as j,Q as e1,R as t1,V as o1,W as r1,Z as n1,aa as i1,ba as s1,ca as l1,h as I,r as Y,v as J}from"./chunk-4RGQ4R3M.js";import{oa as Q,ra as R,ta as g,va as w}from"./chunk-VGM5FGSZ.js";import{jsx as a1}from"react/jsx-runtime";var p1=e=>a1("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:a1("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"})});import P2 from"styled-components";var H=P2.button`
2
2
  --size: ${({$size:e})=>`${e}px`};
3
3
 
4
4
  -webkit-font-smoothing: antialiased;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import react__default, { MouseEvent } from 'react';
3
- import { C as Chain, W as WalletConnector, B as BaseConnectedEthereumWallet, a as RpcConfig, P as PrivyProxyProvider, E as Embedded1193Provider, b as WalletClientType, c as ConnectedWalletMetadata, d as ConnectorType, e as WalletListEntry, f as ExternalWalletsConfig, g as BaseConnectedWallet, S as SolanaWalletConnector, h as EIP1193Provider, U as User, O as OAuthTokens, i as OAuthProviderType, M as MoonpaySignRequest, j as MoonpaySignResponse, k as SmartWalletConfig, l as PrivyServerConfig, m as PrivyFarcasterSignerInitResponse, L as LoginMethod, T as TelegramAuthResult, n as PrivyClientConfig, o as ConnectWalletModalOptions, p as LoginModalOptions, q as CreateWalletOptions, r as Wallet, s as SetWalletRecoveryOptions, t as SignMessageModalUIOptions, u as SignTypedDataParams, v as MfaMethod, w as UnsignedTransactionRequest, x as SendTransactionModalUIOptions, F as FundWalletConfig, y as TransactionReceipt, z as ConnectedWallet, A as PrivyIframeErrorTypesType, D as PrivyErrorCode, G as LinkedAccountWithMetadata, H as UserRecoveryMethod, I as FundingMethod, J as LoginWithCode, K as OtpFlowState, N as UnsignedTransactionRequestWithChainId, Q as CustomAuthFlowState } from './types-2f8e9783.js';
4
- export { ab as Apple, al as AppleOAuthWithMetadata, V as AsExternalProvider, aA as ConnectedSolanaWallet, at as ContractUIOptions, ae as CrossAppAccount, ao as CrossAppAccountWithMetadata, a8 as Discord, ah as DiscordOAuthWithMetadata, aq as Email, a3 as EmailWithMetadata, ax as Farcaster, am as FarcasterWithMetadata, a9 as Github, ai as GithubOAuthWithMetadata, a6 as Google, af as GoogleOAuthWithMetadata, aa as LinkedIn, ak as LinkedInOAuthWithMetadata, az as LoginMethodOrderOption, Y as MessageTypes, Z as MoonpayConfig, _ as MoonpayCurrencyCode, av as MoonpayFundingConfig, $ as MoonpayPaymentMethod, au as NativeFundingConfig, a2 as NonEmptyArray, ay as Passkey, ap as PasskeyWithMetadata, ar as Phone, a4 as PhoneWithMetadata, aw as PriceDisplayOptions, a0 as Quantity, ad as Telegram, an as TelegramWithMetadata, ac as Tiktok, aj as TiktokOAuthWithMetadata, a1 as TransactionLog, as as TransactionUIOptions, a7 as Twitter, ag as TwitterOAuthWithMetadata, X as TypedMessage, a5 as WalletWithMetadata } from './types-2f8e9783.js';
3
+ import { C as Chain, W as WalletConnector, B as BaseConnectedEthereumWallet, a as RpcConfig, P as PrivyProxyProvider, E as Embedded1193Provider, b as WalletClientType, c as ConnectedWalletMetadata, d as ConnectorType, e as WalletListEntry, f as ExternalWalletsConfig, g as BaseConnectedWallet, S as SolanaWalletConnector, h as EIP1193Provider, U as User, O as OAuthTokens, i as OAuthProviderType, M as MoonpaySignRequest, j as MoonpaySignResponse, k as SmartWalletConfig, l as PrivyServerConfig, m as PrivyFarcasterSignerInitResponse, L as LoginMethod, T as TelegramAuthResult, n as PrivyClientConfig, o as ConnectWalletModalOptions, p as LoginModalOptions, q as CreateWalletOptions, r as Wallet, s as SetWalletRecoveryOptions, t as SignMessageModalUIOptions, u as SignTypedDataParams, v as MfaMethod, w as UnsignedTransactionRequest, x as SendTransactionModalUIOptions, F as FundWalletConfig, y as TransactionReceipt, z as ConnectedWallet, A as PrivyIframeErrorTypesType, D as PrivyErrorCode, G as LinkedAccountWithMetadata, H as UserRecoveryMethod, I as FundingMethod, J as LoginWithCode, K as PasskeyFlowState, N as OtpFlowState, Q as UnsignedTransactionRequestWithChainId, V as CustomAuthFlowState } from './types-eaea6708.js';
4
+ export { ac as Apple, am as AppleOAuthWithMetadata, X as AsExternalProvider, aB as ConnectedSolanaWallet, au as ContractUIOptions, af as CrossAppAccount, ap as CrossAppAccountWithMetadata, a9 as Discord, ai as DiscordOAuthWithMetadata, ar as Email, a4 as EmailWithMetadata, ay as Farcaster, an as FarcasterWithMetadata, aa as Github, aj as GithubOAuthWithMetadata, a7 as Google, ag as GoogleOAuthWithMetadata, ab as LinkedIn, al as LinkedInOAuthWithMetadata, aA as LoginMethodOrderOption, Z as MessageTypes, _ as MoonpayConfig, $ as MoonpayCurrencyCode, aw as MoonpayFundingConfig, a0 as MoonpayPaymentMethod, av as NativeFundingConfig, a3 as NonEmptyArray, az as Passkey, aq as PasskeyWithMetadata, as as Phone, a5 as PhoneWithMetadata, ax as PriceDisplayOptions, a1 as Quantity, ae as Telegram, ao as TelegramWithMetadata, ad as Tiktok, ak as TiktokOAuthWithMetadata, a2 as TransactionLog, at as TransactionUIOptions, a8 as Twitter, ah as TwitterOAuthWithMetadata, Y as TypedMessage, a6 as WalletWithMetadata } from './types-eaea6708.js';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { TurnstileProps } from '@marsidev/react-turnstile';
7
7
  import EventEmitter from 'eventemitter3';
@@ -654,7 +654,7 @@ declare class PrivyClient {
654
654
  /**
655
655
  *
656
656
  */
657
- sendAccountTransferRequest({ nonce, account, accountType, chainId, walletClientType, connectorType, telegramAuthResult, }: {
657
+ sendAccountTransferRequest({ nonce, account, accountType, chainId, walletClientType, connectorType, telegramAuthResult, farcasterEmbeddedAddress, }: {
658
658
  nonce: string;
659
659
  account: string;
660
660
  accountType: LoginMethod;
@@ -662,6 +662,7 @@ declare class PrivyClient {
662
662
  walletClientType?: string;
663
663
  connectorType?: string;
664
664
  telegramAuthResult?: TelegramAuthResult;
665
+ farcasterEmbeddedAddress?: string;
665
666
  }): Promise<User>;
666
667
  /**
667
668
  * Headless method to link a new wallet via the Sign-In with Solana spec.
@@ -1822,6 +1823,27 @@ type UseLoginWithEmail = {
1822
1823
  */
1823
1824
  declare const useLoginWithEmail: () => UseLoginWithEmail;
1824
1825
 
1826
+ type UseLoginWithPasskey = {
1827
+ /**
1828
+ * Logs in a user with a passkey without using any Privy UIs.
1829
+ *
1830
+ * @returns a Promise that resolves if the passkey is valid, or rejects if there was an error.
1831
+ */
1832
+ loginWithPasskey: () => Promise<void>;
1833
+ /**
1834
+ * State of the passkey flow.
1835
+ */
1836
+ state: PasskeyFlowState;
1837
+ };
1838
+ /**
1839
+ * @experimental
1840
+ *
1841
+ * Use this hook to log the user in with passkey, without using any Privy UIs.
1842
+ *
1843
+ * @returns loginWithPasskey - {@link loginWithPasskey} - logs a user in with a passkey
1844
+ */
1845
+ declare const useLoginWithPasskey: (callbacks?: PrivyEvents["login"]) => UseLoginWithPasskey;
1846
+
1825
1847
  type SendCodeToSms = {
1826
1848
  phoneNumber: string;
1827
1849
  };
@@ -2410,4 +2432,4 @@ declare const LoginModal: ({ open }: {
2410
2432
  open: boolean;
2411
2433
  }) => react_jsx_runtime.JSX.Element;
2412
2434
 
2413
- export { CallbackError, Captcha, ConnectWalletModalOptions, ConnectedWallet, ConnectorManager, CustomAuthFlowState, EIP1193Provider, EthereumWalletConnector, FundWalletConfig, LoginModal, LoginModalOptions, LoginWithCode, MfaMethod, OAuthProviderType, OAuthTokens, PrivyClient, PrivyClientConfig, PrivyEvents, PrivyInterface, PrivyProvider, PrivyProviderProps, PrivyProxyProvider, DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, SendCodeToEmail, SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, SolanaTransactionReceipt, SupportedSolanaTransaction, TransactionReceipt, UnsignedTransactionRequest, UseConnectCoinbaseSmartWalletInterface, UseCustomAuth, UseFundWalletInterface, UseLoginWithEmail, UseLoginWithSms, UseOAuthTokens, UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, addRpcUrlOverrideToChain, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getAccessToken, getEmbeddedConnectedWallet, useConnectCoinbaseSmartWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useExperimentalFarcasterSigner, useFarcasterSigner, useFundWallet, useGuestAccounts, useLinkAccount, useLinkWithSiwe, useLogin, useLoginWithEmail, useLoginWithOAuth, useLoginWithSms, useLogout, useMfa, useMfaEnrollment, useModalStatus, useOAuthTokens, usePrivy, useRegisterMfaListener, useSendSolanaTransaction, useSendTransaction, useSetWalletPassword, useSetWalletRecovery, useSignMessage, useSignTypedData, useToken, useWallets };
2435
+ export { CallbackError, Captcha, ConnectWalletModalOptions, ConnectedWallet, ConnectorManager, CustomAuthFlowState, EIP1193Provider, EthereumWalletConnector, FundWalletConfig, LoginModal, LoginModalOptions, LoginWithCode, MfaMethod, OAuthProviderType, OAuthTokens, PasskeyFlowState, PrivyClient, PrivyClientConfig, PrivyEvents, PrivyInterface, PrivyProvider, PrivyProviderProps, PrivyProxyProvider, DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, SendCodeToEmail, SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, SolanaTransactionReceipt, SupportedSolanaTransaction, TransactionReceipt, UnsignedTransactionRequest, UseConnectCoinbaseSmartWalletInterface, UseCustomAuth, UseFundWalletInterface, UseLoginWithEmail, UseLoginWithPasskey, UseLoginWithSms, UseOAuthTokens, UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, addRpcUrlOverrideToChain, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getAccessToken, getEmbeddedConnectedWallet, useConnectCoinbaseSmartWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useExperimentalFarcasterSigner, useFarcasterSigner, useFundWallet, useGuestAccounts, useLinkAccount, useLinkWithSiwe, useLogin, useLoginWithEmail, useLoginWithOAuth, useLoginWithPasskey, useLoginWithSms, useLogout, useMfa, useMfaEnrollment, useModalStatus, useOAuthTokens, usePrivy, useRegisterMfaListener, useSendSolanaTransaction, useSendTransaction, useSetWalletPassword, useSetWalletRecovery, useSignMessage, useSignTypedData, useToken, useWallets };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7M4DBJFWjs = require('./chunk-7M4DBJFW.js');var _chunkQVSCWGK3js = require('./chunk-QVSCWGK3.js');var _chunkTIACG3L3js = require('./chunk-TIACG3L3.js');var _chunkZ4PCJGI3js = require('./chunk-Z4PCJGI3.js');exports.AsExternalProvider = _chunk7M4DBJFWjs.c; exports.Captcha = _chunk7M4DBJFWjs.h; exports.ConnectorManager = _chunk7M4DBJFWjs.f; exports.EthereumWalletConnector = _chunk7M4DBJFWjs.d; exports.LoginModal = _chunk7M4DBJFWjs.o; exports.PrivyClient = _chunk7M4DBJFWjs.g; exports.PrivyProvider = _chunk7M4DBJFWjs.q; exports.PrivyProxyProvider = _chunk7M4DBJFWjs.b; exports.SUPPORTED_CHAINS = _chunkZ4PCJGI3js.ka; exports.VERSION = _chunkZ4PCJGI3js.u; exports.WalletConnector = _chunk7M4DBJFWjs.a; exports.addRpcUrlOverrideToChain = _chunkTIACG3L3js.c; exports.errorIndicatesMaxMfaRetries = _chunk7M4DBJFWjs.l; exports.errorIndicatesMfaTimeout = _chunk7M4DBJFWjs.j; exports.errorIndicatesMfaVerificationFailed = _chunk7M4DBJFWjs.k; exports.getAccessToken = _chunk7M4DBJFWjs.p; exports.getEmbeddedConnectedWallet = _chunkTIACG3L3js.f; exports.useConnectCoinbaseSmartWallet = _chunk7M4DBJFWjs.y; exports.useConnectWallet = _chunkQVSCWGK3js.ba; exports.useCreateWallet = _chunk7M4DBJFWjs.w; exports.useCrossAppAccounts = _chunk7M4DBJFWjs.z; exports.useCustomAuth = _chunk7M4DBJFWjs.K; exports.useExperimentalFarcasterSigner = _chunk7M4DBJFWjs.L; exports.useFarcasterSigner = _chunk7M4DBJFWjs.M; exports.useFundWallet = _chunkQVSCWGK3js.ca; exports.useGuestAccounts = _chunk7M4DBJFWjs.D; exports.useLinkAccount = _chunk7M4DBJFWjs.v; exports.useLinkWithSiwe = _chunk7M4DBJFWjs.u; exports.useLogin = _chunkQVSCWGK3js.aa; exports.useLoginWithEmail = _chunk7M4DBJFWjs.s; exports.useLoginWithOAuth = _chunk7M4DBJFWjs.r; exports.useLoginWithSms = _chunk7M4DBJFWjs.t; exports.useLogout = _chunkQVSCWGK3js.R; exports.useMfa = _chunk7M4DBJFWjs.m; exports.useMfaEnrollment = _chunk7M4DBJFWjs.n; exports.useModalStatus = _chunk7M4DBJFWjs.H; exports.useOAuthTokens = _chunk7M4DBJFWjs.J; exports.usePrivy = _chunkZ4PCJGI3js.ta; exports.useRegisterMfaListener = _chunk7M4DBJFWjs.i; exports.useSendSolanaTransaction = _chunk7M4DBJFWjs.B; exports.useSendTransaction = _chunk7M4DBJFWjs.A; exports.useSetWalletPassword = _chunk7M4DBJFWjs.C; exports.useSetWalletRecovery = _chunk7M4DBJFWjs.E; exports.useSignMessage = _chunk7M4DBJFWjs.F; exports.useSignTypedData = _chunk7M4DBJFWjs.G; exports.useSolanaWallets = _chunk7M4DBJFWjs.x; exports.useToken = _chunk7M4DBJFWjs.I; exports.useWallets = _chunkZ4PCJGI3js.va;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkE7B7OFUXjs = require('./chunk-E7B7OFUX.js');var _chunk4RGQ4R3Mjs = require('./chunk-4RGQ4R3M.js');var _chunk4ODVFLKFjs = require('./chunk-4ODVFLKF.js');var _chunkVGM5FGSZjs = require('./chunk-VGM5FGSZ.js');exports.AsExternalProvider = _chunkE7B7OFUXjs.c; exports.Captcha = _chunkE7B7OFUXjs.h; exports.ConnectorManager = _chunkE7B7OFUXjs.f; exports.EthereumWalletConnector = _chunkE7B7OFUXjs.d; exports.LoginModal = _chunkE7B7OFUXjs.o; exports.PrivyClient = _chunkE7B7OFUXjs.g; exports.PrivyProvider = _chunkE7B7OFUXjs.q; exports.PrivyProxyProvider = _chunkE7B7OFUXjs.b; exports.SUPPORTED_CHAINS = _chunkVGM5FGSZjs.ka; exports.VERSION = _chunkVGM5FGSZjs.u; exports.WalletConnector = _chunkE7B7OFUXjs.a; exports.addRpcUrlOverrideToChain = _chunk4ODVFLKFjs.c; exports.errorIndicatesMaxMfaRetries = _chunkE7B7OFUXjs.l; exports.errorIndicatesMfaTimeout = _chunkE7B7OFUXjs.j; exports.errorIndicatesMfaVerificationFailed = _chunkE7B7OFUXjs.k; exports.getAccessToken = _chunkE7B7OFUXjs.p; exports.getEmbeddedConnectedWallet = _chunk4ODVFLKFjs.f; exports.useConnectCoinbaseSmartWallet = _chunkE7B7OFUXjs.z; exports.useConnectWallet = _chunk4RGQ4R3Mjs.ba; exports.useCreateWallet = _chunkE7B7OFUXjs.x; exports.useCrossAppAccounts = _chunkE7B7OFUXjs.A; exports.useCustomAuth = _chunkE7B7OFUXjs.L; exports.useExperimentalFarcasterSigner = _chunkE7B7OFUXjs.M; exports.useFarcasterSigner = _chunkE7B7OFUXjs.N; exports.useFundWallet = _chunk4RGQ4R3Mjs.ca; exports.useGuestAccounts = _chunkE7B7OFUXjs.E; exports.useLinkAccount = _chunkE7B7OFUXjs.w; exports.useLinkWithSiwe = _chunkE7B7OFUXjs.v; exports.useLogin = _chunk4RGQ4R3Mjs.aa; exports.useLoginWithEmail = _chunkE7B7OFUXjs.s; exports.useLoginWithOAuth = _chunkE7B7OFUXjs.r; exports.useLoginWithPasskey = _chunkE7B7OFUXjs.t; exports.useLoginWithSms = _chunkE7B7OFUXjs.u; exports.useLogout = _chunk4RGQ4R3Mjs.R; exports.useMfa = _chunkE7B7OFUXjs.m; exports.useMfaEnrollment = _chunkE7B7OFUXjs.n; exports.useModalStatus = _chunkE7B7OFUXjs.I; exports.useOAuthTokens = _chunkE7B7OFUXjs.K; exports.usePrivy = _chunkVGM5FGSZjs.ta; exports.useRegisterMfaListener = _chunkE7B7OFUXjs.i; exports.useSendSolanaTransaction = _chunkE7B7OFUXjs.C; exports.useSendTransaction = _chunkE7B7OFUXjs.B; exports.useSetWalletPassword = _chunkE7B7OFUXjs.D; exports.useSetWalletRecovery = _chunkE7B7OFUXjs.F; exports.useSignMessage = _chunkE7B7OFUXjs.G; exports.useSignTypedData = _chunkE7B7OFUXjs.H; exports.useSolanaWallets = _chunkE7B7OFUXjs.y; exports.useToken = _chunkE7B7OFUXjs.J; exports.useWallets = _chunkVGM5FGSZjs.va;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkTIACG3L3js = require('./chunk-TIACG3L3.js');var _chunkZ4PCJGI3js = require('./chunk-Z4PCJGI3.js');var _react = require('react');var _permissionless = require('permissionless');var _accounts = require('permissionless/accounts');var _pimlico = require('permissionless/clients/pimlico');var _viem = require('viem');var _accountabstraction = require('viem/account-abstraction');var J=({calls:r,chain:t,maxPriorityFeePerGas:n,maxFeePerGas:o,nonce:l})=>r.map(c=>({to:c.to||void 0,data:c.data,value:c.value,chainId:t.id,nonce:l,maxFeePerGas:o,maxPriorityFeePerGas:n})),H=()=>{let{chains:r,noPromptOnSignature:t,openPrivyModal:n}=_chunkZ4PCJGI3js.ra.call(void 0, ),o=_chunkZ4PCJGI3js.oa.call(void 0, ),{setModalData:l}=_chunkTIACG3L3js.b.call(void 0, );return{getSmartWalletClient:async(c,P,i,T)=>{let u=_chunkTIACG3L3js.d.call(void 0, r),p=_chunkTIACG3L3js.e.call(void 0, i.chainId),d=u.find(e=>e.id===p);if(!d)throw new Error(`Error finding chain object for smart wallet network ${i.chainId} in app config. Please ensure you have a chain object for ${i.chainId} in app config.`);let C=await c.getEthereumProvider(),{sendTransaction:S,signMessage:y,signTypedData:W,...a}=await Z({owner:C,smartWalletType:P,chain:d,paymasterContext:T,...i});return{...a,sendTransaction:async e=>{if(o.embeddedWallets.noPromptOnSignature||t.current)return await S(e);let m=[];"calls"in e&&typeof e.calls<"u"?m=[...e.calls]:"to"in e&&(m=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let g=async()=>{if(!a.paymaster)return!1;let{paymasterAndData:f,paymasterData:v}=await a.prepareUserOperation({calls:m,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return Number(_nullishCoalesce(_nullishCoalesce(f, () => (v)), () => (0)))>0};return new Promise(async(f,v)=>{t.current=!0,l({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:()=>{}},sendTransaction:{transactionRequests:J({calls:m,chain:d,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:g,onConfirm:()=>S(e),onSuccess:k=>f(k.hash),onFailure:v,uiOptions:{}}}),n("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1})},signMessage:async({message:e})=>o.embeddedWallets.noPromptOnSignature||t.current?await y({message:e}):new Promise(async(m,g)=>{t.current=!0,l({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>y({message:e}),onSuccess:f=>m(f),onFailure:g,uiOptions:{}}}),n("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1}),signTypedData:async e=>t.current?await W(e):new Promise(async(m,g)=>{t.current=!0,l({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>W(e),onSuccess:f=>m(f),onFailure:g,uiOptions:{}}}),n("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1})}}}},R={address:_accountabstraction.entryPoint06Address,version:"0.6"},M={address:_accountabstraction.entryPoint07Address,version:"0.7"},X=({owner:r,smartWalletType:t,chain:n})=>{let o=_viem.createPublicClient.call(void 0, {chain:n,transport:_viem.http.call(void 0, )});switch(t){case"safe":return _accounts.toSafeSmartAccount.call(void 0, {client:o,entryPoint:M,owners:[r],version:"1.4.1"});case"kernel":return _accounts.toEcdsaKernelSmartAccount.call(void 0, {client:o,version:"0.3.1",entryPoint:M,owners:[r]});case"biconomy":return _accounts.toBiconomySmartAccount.call(void 0, {client:o,owners:[r],entryPoint:R});case"light_account":return _accounts.toLightSmartAccount.call(void 0, {client:o,entryPoint:R,owner:r,version:"1.1.0"});default:throw new Error(`Invalid smart account type: ${t}.`)}},Z=async({owner:r,smartWalletType:t,chain:n,bundlerUrl:o,paymasterUrl:l,paymasterContext:c})=>{let P=_viem.createPublicClient.call(void 0, {chain:n,transport:_viem.http.call(void 0, )}),i=await X({owner:r,smartWalletType:t,chain:n}),u=!!l?_pimlico.createPimlicoClient.call(void 0, {transport:_viem.http.call(void 0, l),entryPoint:i.entryPoint}):void 0;return _permissionless.createSmartAccountClient.call(void 0, {account:i,chain:n,paymaster:u,paymasterContext:c,bundlerTransport:_viem.http.call(void 0, o),userOperation:{estimateFeesPerGas:async()=>{let p=await P.estimateFeesPerGas();return{...p,maxFeePerGas:p.maxFeePerGas*115n/100n,maxPriorityFeePerGas:p.maxPriorityFeePerGas*115n/100n}}}})};var _jsxruntime = require('react/jsx-runtime');var U=_react.createContext.call(void 0, {client:void 0}),ne= exports.SmartWalletsProvider =({config:r,children:t})=>{let[n,o]=_react.useState.call(void 0, null),{getSmartWalletClient:l}=H(),{generateSiweMessage:c,linkSmartWallet:P,client:i,noPromptOnSignature:T}=_chunkZ4PCJGI3js.ra.call(void 0, ),{defaultChain:u}=_chunkZ4PCJGI3js.oa.call(void 0, ),{wallets:p}=_chunkZ4PCJGI3js.va.call(void 0, ),{user:d}=_chunkZ4PCJGI3js.ta.call(void 0, ),[C,S]=_react.useState.call(void 0, ),y=_chunkTIACG3L3js.f.call(void 0, p);return _react.useEffect.call(void 0, ()=>{!n&&i&&(async()=>{try{if(!i){console.warn("No client found");return}let a=await i.getSmartWalletsConfig();o(a)}catch(a){console.warn("Error generating smart wallet config: ",a)}})()},[!!i]),_react.useEffect.call(void 0, ()=>{(async()=>{if(!_optionalChain([n, 'optionalAccess', _2 => _2.enabled])||!d||!y){S(void 0);return}if(C)return;let a=n.configuredNetworks.find(s=>s.chainId===`eip155:${u.id}`);if(!a)throw new (0, _chunkZ4PCJGI3js.g)(`The defaultChain ${u.name} (eip155:${u.id}) must be configured in the smart wallet configuration in your dashboard`);if(d.smartWallet)try{let s=await l(y,d.smartWallet.smartWalletType,a,_optionalChain([r, 'optionalAccess', _3 => _3.paymasterContext]));S(s);return}catch(s){console.error("Error loading smart wallet:",s);return}try{let s=await l(y,n.smartWalletType,a,_optionalChain([r, 'optionalAccess', _4 => _4.paymasterContext])),w=await c({address:s.account.address,chainId:a.chainId});T.current=!0;let D=await s.signMessage({message:w});await P({signature:D,message:w,smartWalletType:n.smartWalletType}),S(s)}catch(s){console.error("Error creating smart wallet:",s)}finally{T.current=!1}})()},[!!_optionalChain([n, 'optionalAccess', _5 => _5.enabled]),!!_optionalChain([d, 'optionalAccess', _6 => _6.smartWallet]),!!y]),_jsxruntime.jsx.call(void 0, U.Provider,{value:{client:C},children:t})},ae= exports.useSmartWallets =()=>_react.useContext.call(void 0, U);exports.SmartWalletsProvider = ne; exports.useSmartWallets = ae;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk4ODVFLKFjs = require('./chunk-4ODVFLKF.js');var _chunkVGM5FGSZjs = require('./chunk-VGM5FGSZ.js');var _react = require('react');var _permissionless = require('permissionless');var _accounts = require('permissionless/accounts');var _pimlico = require('permissionless/clients/pimlico');var _viem = require('viem');var _accountabstraction = require('viem/account-abstraction');var J=({calls:r,chain:t,maxPriorityFeePerGas:n,maxFeePerGas:o,nonce:l})=>r.map(c=>({to:c.to||void 0,data:c.data,value:c.value,chainId:t.id,nonce:l,maxFeePerGas:o,maxPriorityFeePerGas:n})),H=()=>{let{chains:r,noPromptOnSignature:t,openPrivyModal:n}=_chunkVGM5FGSZjs.ra.call(void 0, ),o=_chunkVGM5FGSZjs.oa.call(void 0, ),{setModalData:l}=_chunk4ODVFLKFjs.b.call(void 0, );return{getSmartWalletClient:async(c,P,i,T)=>{let u=_chunk4ODVFLKFjs.d.call(void 0, r),p=_chunk4ODVFLKFjs.e.call(void 0, i.chainId),d=u.find(e=>e.id===p);if(!d)throw new Error(`Error finding chain object for smart wallet network ${i.chainId} in app config. Please ensure you have a chain object for ${i.chainId} in app config.`);let C=await c.getEthereumProvider(),{sendTransaction:S,signMessage:y,signTypedData:W,...a}=await Z({owner:C,smartWalletType:P,chain:d,paymasterContext:T,...i});return{...a,sendTransaction:async e=>{if(o.embeddedWallets.noPromptOnSignature||t.current)return await S(e);let m=[];"calls"in e&&typeof e.calls<"u"?m=[...e.calls]:"to"in e&&(m=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let g=async()=>{if(!a.paymaster)return!1;let{paymasterAndData:f,paymasterData:v}=await a.prepareUserOperation({calls:m,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return Number(_nullishCoalesce(_nullishCoalesce(f, () => (v)), () => (0)))>0};return new Promise(async(f,v)=>{t.current=!0,l({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:()=>{}},sendTransaction:{transactionRequests:J({calls:m,chain:d,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:g,onConfirm:()=>S(e),onSuccess:k=>f(k.hash),onFailure:v,uiOptions:{}}}),n("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1})},signMessage:async({message:e})=>o.embeddedWallets.noPromptOnSignature||t.current?await y({message:e}):new Promise(async(m,g)=>{t.current=!0,l({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>y({message:e}),onSuccess:f=>m(f),onFailure:g,uiOptions:{}}}),n("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1}),signTypedData:async e=>t.current?await W(e):new Promise(async(m,g)=>{t.current=!0,l({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>W(e),onSuccess:f=>m(f),onFailure:g,uiOptions:{}}}),n("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1})}}}},R={address:_accountabstraction.entryPoint06Address,version:"0.6"},M={address:_accountabstraction.entryPoint07Address,version:"0.7"},X=({owner:r,smartWalletType:t,chain:n})=>{let o=_viem.createPublicClient.call(void 0, {chain:n,transport:_viem.http.call(void 0, )});switch(t){case"safe":return _accounts.toSafeSmartAccount.call(void 0, {client:o,entryPoint:M,owners:[r],version:"1.4.1"});case"kernel":return _accounts.toEcdsaKernelSmartAccount.call(void 0, {client:o,version:"0.3.1",entryPoint:M,owners:[r]});case"biconomy":return _accounts.toBiconomySmartAccount.call(void 0, {client:o,owners:[r],entryPoint:R});case"light_account":return _accounts.toLightSmartAccount.call(void 0, {client:o,entryPoint:R,owner:r,version:"1.1.0"});default:throw new Error(`Invalid smart account type: ${t}.`)}},Z=async({owner:r,smartWalletType:t,chain:n,bundlerUrl:o,paymasterUrl:l,paymasterContext:c})=>{let P=_viem.createPublicClient.call(void 0, {chain:n,transport:_viem.http.call(void 0, )}),i=await X({owner:r,smartWalletType:t,chain:n}),u=!!l?_pimlico.createPimlicoClient.call(void 0, {transport:_viem.http.call(void 0, l),entryPoint:i.entryPoint}):void 0;return _permissionless.createSmartAccountClient.call(void 0, {account:i,chain:n,paymaster:u,paymasterContext:c,bundlerTransport:_viem.http.call(void 0, o),userOperation:{estimateFeesPerGas:async()=>{let p=await P.estimateFeesPerGas();return{...p,maxFeePerGas:p.maxFeePerGas*115n/100n,maxPriorityFeePerGas:p.maxPriorityFeePerGas*115n/100n}}}})};var _jsxruntime = require('react/jsx-runtime');var U=_react.createContext.call(void 0, {client:void 0}),ne= exports.SmartWalletsProvider =({config:r,children:t})=>{let[n,o]=_react.useState.call(void 0, null),{getSmartWalletClient:l}=H(),{generateSiweMessage:c,linkSmartWallet:P,client:i,noPromptOnSignature:T}=_chunkVGM5FGSZjs.ra.call(void 0, ),{defaultChain:u}=_chunkVGM5FGSZjs.oa.call(void 0, ),{wallets:p}=_chunkVGM5FGSZjs.va.call(void 0, ),{user:d}=_chunkVGM5FGSZjs.ta.call(void 0, ),[C,S]=_react.useState.call(void 0, ),y=_chunk4ODVFLKFjs.f.call(void 0, p);return _react.useEffect.call(void 0, ()=>{!n&&i&&(async()=>{try{if(!i){console.warn("No client found");return}let a=await i.getSmartWalletsConfig();o(a)}catch(a){console.warn("Error generating smart wallet config: ",a)}})()},[!!i]),_react.useEffect.call(void 0, ()=>{(async()=>{if(!_optionalChain([n, 'optionalAccess', _2 => _2.enabled])||!d||!y){S(void 0);return}if(C)return;let a=n.configuredNetworks.find(s=>s.chainId===`eip155:${u.id}`);if(!a)throw new (0, _chunkVGM5FGSZjs.g)(`The defaultChain ${u.name} (eip155:${u.id}) must be configured in the smart wallet configuration in your dashboard`);if(d.smartWallet)try{let s=await l(y,d.smartWallet.smartWalletType,a,_optionalChain([r, 'optionalAccess', _3 => _3.paymasterContext]));S(s);return}catch(s){console.error("Error loading smart wallet:",s);return}try{let s=await l(y,n.smartWalletType,a,_optionalChain([r, 'optionalAccess', _4 => _4.paymasterContext])),w=await c({address:s.account.address,chainId:a.chainId});T.current=!0;let D=await s.signMessage({message:w});await P({signature:D,message:w,smartWalletType:n.smartWalletType}),S(s)}catch(s){console.error("Error creating smart wallet:",s)}finally{T.current=!1}})()},[!!_optionalChain([n, 'optionalAccess', _5 => _5.enabled]),!!_optionalChain([d, 'optionalAccess', _6 => _6.smartWallet]),!!y]),_jsxruntime.jsx.call(void 0, U.Provider,{value:{client:C},children:t})},ae= exports.useSmartWallets =()=>_react.useContext.call(void 0, U);exports.SmartWalletsProvider = ne; exports.useSmartWallets = ae;
package/dist/solana.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { aA as ConnectedSolanaWallet, r as Wallet } from './types-2f8e9783.js';
2
- export { S as SolanaAdapterConnector, aB as toSolanaWalletConnectors } from './types-2f8e9783.js';
1
+ import { aB as ConnectedSolanaWallet, r as Wallet } from './types-eaea6708.js';
2
+ export { S as SolanaAdapterConnector, aC as toSolanaWalletConnectors } from './types-eaea6708.js';
3
3
  import { Transaction, VersionedTransaction, ParsedTransactionWithMeta } from '@solana/web3.js';
4
4
  import '@metamask/eth-sig-util';
5
5
  import '@ethersproject/providers';
package/dist/solana.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk7M4DBJFWjs = require('./chunk-7M4DBJFW.js');require('./chunk-QVSCWGK3.js');require('./chunk-TIACG3L3.js');require('./chunk-Z4PCJGI3.js');var _walletadapterbase = require('@solana/wallet-adapter-base');var _walletstandardwalletadapterbase = require('@solana/wallet-standard-wallet-adapter-base');var _app = require('@wallet-standard/app');var u=l=>{let{get:r,on:c}=_app.getWallets.call(void 0, ),p=_nullishCoalesce(_optionalChain([l, 'optionalAccess', _ => _.shouldAutoConnect]), () => (!0)),t=i(r()),e=t.map(o=>new (0, _chunk7M4DBJFWjs.e)(o,p)),s=[],d;return{_setOnConnectorsUpdated:o=>{d=o},onMount:()=>{s.push(c("register",(...o)=>{t=t.concat(...i(o)),e=t.map(n=>new (0, _chunk7M4DBJFWjs.e)(n,p)),_optionalChain([d, 'optionalCall', _2 => _2(e)])}),c("unregister",(...o)=>{t=t.filter(n=>o.some(W=>n.wallet===W)),e=t.map(n=>new (0, _chunk7M4DBJFWjs.e)(n,p)),_optionalChain([d, 'optionalCall', _3 => _3(e)])}))},onUnmount:()=>{let o=s.pop();for(;o;)o(),o=s.pop()},get:()=>e}},i=l=>l.filter(_walletadapterbase.isWalletAdapterCompatibleStandardWallet).map(r=>new (0, _walletstandardwalletadapterbase.StandardWalletAdapter)({wallet:r}));exports.SolanaAdapterConnector = _chunk7M4DBJFWjs.e; exports.toSolanaWalletConnectors = u; exports.useSolanaWallets = _chunk7M4DBJFWjs.x;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkE7B7OFUXjs = require('./chunk-E7B7OFUX.js');require('./chunk-4RGQ4R3M.js');require('./chunk-4ODVFLKF.js');require('./chunk-VGM5FGSZ.js');var _walletadapterbase = require('@solana/wallet-adapter-base');var _walletstandardwalletadapterbase = require('@solana/wallet-standard-wallet-adapter-base');var _app = require('@wallet-standard/app');var u=l=>{let{get:r,on:c}=_app.getWallets.call(void 0, ),p=_nullishCoalesce(_optionalChain([l, 'optionalAccess', _ => _.shouldAutoConnect]), () => (!0)),t=i(r()),e=t.map(o=>new (0, _chunkE7B7OFUXjs.e)(o,p)),s=[],d;return{_setOnConnectorsUpdated:o=>{d=o},onMount:()=>{s.push(c("register",(...o)=>{t=t.concat(...i(o)),e=t.map(n=>new (0, _chunkE7B7OFUXjs.e)(n,p)),_optionalChain([d, 'optionalCall', _2 => _2(e)])}),c("unregister",(...o)=>{t=t.filter(n=>o.some(W=>n.wallet===W)),e=t.map(n=>new (0, _chunkE7B7OFUXjs.e)(n,p)),_optionalChain([d, 'optionalCall', _3 => _3(e)])}))},onUnmount:()=>{let o=s.pop();for(;o;)o(),o=s.pop()},get:()=>e}},i=l=>l.filter(_walletadapterbase.isWalletAdapterCompatibleStandardWallet).map(r=>new (0, _walletstandardwalletadapterbase.StandardWalletAdapter)({wallet:r}));exports.SolanaAdapterConnector = _chunkE7B7OFUXjs.e; exports.toSolanaWalletConnectors = u; exports.useSolanaWallets = _chunkE7B7OFUXjs.y;
@@ -1826,6 +1826,20 @@ type OtpFlowState = {
1826
1826
  } | {
1827
1827
  status: 'done';
1828
1828
  };
1829
+ type PasskeyFlowState = {
1830
+ status: 'initial';
1831
+ } | {
1832
+ status: 'error';
1833
+ error: Error | null;
1834
+ } | {
1835
+ status: 'generating-challenge';
1836
+ } | {
1837
+ status: 'awaiting-passkey';
1838
+ } | {
1839
+ status: 'submitting-response';
1840
+ } | {
1841
+ status: 'done';
1842
+ };
1829
1843
  /**
1830
1844
  * UI configuration object for the embedded wallet's Sign Message screen
1831
1845
  */
@@ -2191,4 +2205,4 @@ type EthereumRpcResponseType = eth_signTransactionResponse | eth_populateTransac
2191
2205
  type SolanaRpcRequestType = solana_signMessage;
2192
2206
  type SolanaRpcResponseType = solana_signMessageResponse;
2193
2207
 
2194
- export { MoonpayPaymentMethod as $, PrivyIframeErrorTypesType as A, BaseConnectedEthereumWallet as B, Chain as C, PrivyErrorCode as D, Embedded1193Provider as E, FundWalletConfig as F, LinkedAccountWithMetadata as G, UserRecoveryMethod as H, FundingMethod as I, LoginWithCode as J, OtpFlowState as K, LoginMethod as L, MoonpaySignRequest as M, UnsignedTransactionRequestWithChainId as N, OAuthTokens as O, PrivyProxyProvider as P, CustomAuthFlowState as Q, RuntimeLoginOverridableOptions as R, SolanaWalletConnector as S, TelegramAuthResult as T, User as U, AsExternalProvider as V, WalletConnector as W, TypedMessage as X, MessageTypes as Y, MoonpayConfig as Z, MoonpayCurrencyCode as _, RpcConfig as a, Quantity as a0, TransactionLog as a1, NonEmptyArray as a2, EmailWithMetadata as a3, PhoneWithMetadata as a4, WalletWithMetadata as a5, Google as a6, Twitter as a7, Discord as a8, Github as a9, ConnectedSolanaWallet as aA, toSolanaWalletConnectors as aB, LinkedIn as aa, Apple as ab, Tiktok as ac, Telegram as ad, CrossAppAccount as ae, GoogleOAuthWithMetadata as af, TwitterOAuthWithMetadata as ag, DiscordOAuthWithMetadata as ah, GithubOAuthWithMetadata as ai, TiktokOAuthWithMetadata as aj, LinkedInOAuthWithMetadata as ak, AppleOAuthWithMetadata as al, FarcasterWithMetadata as am, TelegramWithMetadata as an, CrossAppAccountWithMetadata as ao, PasskeyWithMetadata as ap, Email as aq, Phone as ar, TransactionUIOptions as as, ContractUIOptions as at, NativeFundingConfig as au, MoonpayFundingConfig as av, PriceDisplayOptions as aw, Farcaster as ax, Passkey as ay, LoginMethodOrderOption as az, WalletClientType as b, ConnectedWalletMetadata as c, ConnectorType as d, WalletListEntry as e, ExternalWalletsConfig as f, BaseConnectedWallet as g, EIP1193Provider as h, OAuthProviderType as i, MoonpaySignResponse as j, SmartWalletConfig as k, PrivyServerConfig as l, PrivyFarcasterSignerInitResponse as m, PrivyClientConfig as n, ConnectWalletModalOptions as o, LoginModalOptions as p, CreateWalletOptions as q, Wallet as r, SetWalletRecoveryOptions as s, SignMessageModalUIOptions as t, SignTypedDataParams as u, MfaMethod as v, UnsignedTransactionRequest as w, SendTransactionModalUIOptions as x, TransactionReceipt as y, ConnectedWallet as z };
2208
+ export { MoonpayCurrencyCode as $, PrivyIframeErrorTypesType as A, BaseConnectedEthereumWallet as B, Chain as C, PrivyErrorCode as D, Embedded1193Provider as E, FundWalletConfig as F, LinkedAccountWithMetadata as G, UserRecoveryMethod as H, FundingMethod as I, LoginWithCode as J, PasskeyFlowState as K, LoginMethod as L, MoonpaySignRequest as M, OtpFlowState as N, OAuthTokens as O, PrivyProxyProvider as P, UnsignedTransactionRequestWithChainId as Q, RuntimeLoginOverridableOptions as R, SolanaWalletConnector as S, TelegramAuthResult as T, User as U, CustomAuthFlowState as V, WalletConnector as W, AsExternalProvider as X, TypedMessage as Y, MessageTypes as Z, MoonpayConfig as _, RpcConfig as a, MoonpayPaymentMethod as a0, Quantity as a1, TransactionLog as a2, NonEmptyArray as a3, EmailWithMetadata as a4, PhoneWithMetadata as a5, WalletWithMetadata as a6, Google as a7, Twitter as a8, Discord as a9, LoginMethodOrderOption as aA, ConnectedSolanaWallet as aB, toSolanaWalletConnectors as aC, Github as aa, LinkedIn as ab, Apple as ac, Tiktok as ad, Telegram as ae, CrossAppAccount as af, GoogleOAuthWithMetadata as ag, TwitterOAuthWithMetadata as ah, DiscordOAuthWithMetadata as ai, GithubOAuthWithMetadata as aj, TiktokOAuthWithMetadata as ak, LinkedInOAuthWithMetadata as al, AppleOAuthWithMetadata as am, FarcasterWithMetadata as an, TelegramWithMetadata as ao, CrossAppAccountWithMetadata as ap, PasskeyWithMetadata as aq, Email as ar, Phone as as, TransactionUIOptions as at, ContractUIOptions as au, NativeFundingConfig as av, MoonpayFundingConfig as aw, PriceDisplayOptions as ax, Farcaster as ay, Passkey as az, WalletClientType as b, ConnectedWalletMetadata as c, ConnectorType as d, WalletListEntry as e, ExternalWalletsConfig as f, BaseConnectedWallet as g, EIP1193Provider as h, OAuthProviderType as i, MoonpaySignResponse as j, SmartWalletConfig as k, PrivyServerConfig as l, PrivyFarcasterSignerInitResponse as m, PrivyClientConfig as n, ConnectWalletModalOptions as o, LoginModalOptions as p, CreateWalletOptions as q, Wallet as r, SetWalletRecoveryOptions as s, SignMessageModalUIOptions as t, SignTypedDataParams as u, MfaMethod as v, UnsignedTransactionRequest as w, SendTransactionModalUIOptions as x, TransactionReceipt as y, ConnectedWallet as z };
package/dist/ui.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { R as RuntimeLoginOverridableOptions } from './types-2f8e9783.js';
2
+ import { R as RuntimeLoginOverridableOptions } from './types-eaea6708.js';
3
3
  import '@metamask/eth-sig-util';
4
4
  import '@ethersproject/providers';
5
5
  import 'eventemitter3';