@privy-io/react-auth 1.84.0 → 1.85.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.
@@ -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.85.0";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",vt="privy-refresh-token",Wt="privy:id_token",Ot="privy-id-token",It="privy-session",Ut="privy:session_transfer_token",De="privy:wallet",Lt="privy:caid",Mt=t=>`privy:guest:${t}`,Rt=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 v={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 W=[j,K,le,v,oe,se,ie,ae,V,X,$,Z,B,q,z,ne,ee,te,Y,G,pe,de,ce,Q,re,J],Qn=new Set(W.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){super(i,r,l);this.type=o;this.status=s}},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)},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 M(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 ve=n?.externalWallets?.walletConnect?.enabled??!0;n?.loginMethods&&n.loginMethodsAndOrder&&s("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let We=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}),Me=!!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,...Re}=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:We,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:Me,captchaEnabled:t.captchaEnabled??d.captchaEnabled,captchaSiteKey:t.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:n?.externalWallets?.coinbaseWallet?.connectionOptions??d.externalWallets.coinbaseWallet.connectionOptions},walletConnect:{enabled:ve},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"},...Re,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:W.find(h=>h.id===a.id)??a)}else i=W.concat(t??[]);let r=n?i[0]:v,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=M(xe,void 0,!1),R=at({appConfig:rt,isServerConfigLoaded:!1}),Uo=({children:t,legacyCreateEmbeddedWalletFlag:n,client:o,clientConfig:s})=>{let[i,r]=it(null),l=st(()=>M(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(R.Provider,{value:{appConfig:l,isServerConfigLoaded:!!i},children:t})},Lo=()=>{let{appConfig:t}=Pe(R);return t},Mo=()=>{let{isServerConfigLoaded:t}=Pe(R);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,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}),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,vt as y,Wt as z,Ot as A,It as B,Ut as C,Lt as D,Mt as E,Rt 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,v as da,oe as ea,se as fa,ie as ga,ae as ha,le as ia,pe as ja,W as ka,Qn as la,rt as ma,Uo as na,Lo as oa,Mo 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,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-M7S3ORHS.js";import{R as l,aa as w,ba as C,ca as E}from"./chunk-CMFOSIZZ.js";import{c as p,f as U}from"./chunk-BWEW65KO.js";import{ka as f,ta as j,u as a,va as q}from"./chunk-KD3IIYQS.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,U as getEmbeddedConnectedWallet,G as useConnectCoinbaseSmartWallet,C as useConnectWallet,D as useCreateWallet,H as useCrossAppAccounts,R as useCustomAuth,S as useExperimentalFarcasterSigner,T as useFarcasterSigner,E as useFundWallet,K 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,O as useModalStatus,Q as useOAuthTokens,j as usePrivy,k as useRegisterMfaListener,I as useSendTransaction,J as useSetWalletPassword,L as useSetWalletRecovery,M as useSignMessage,N as useSignTypedData,F as useSolanaWallets,P 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,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-QTSNS7VF.js";import{R as l,aa as w,ba as C,ca as E}from"./chunk-LEABMTNM.js";import{c as p,f as V}from"./chunk-3AGMJGHJ.js";import{ka as f,ta as j,u as a,va as q}from"./chunk-XKAIXCX7.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 +1 @@
1
- import{b as v,d as I,e as _,f as F}from"./chunk-BWEW65KO.js";import{g as x,oa as D,ra as E,ta as A,va as N}from"./chunk-KD3IIYQS.js";import{createContext as X,useContext as Z,useEffect as O,useState as H}from"react";import{createSmartAccountClient as U}from"permissionless";import{toBiconomySmartAccount as k,toEcdsaKernelSmartAccount as $,toLightSmartAccount as q,toSafeSmartAccount as Q}from"permissionless/accounts";import{createPimlicoClient as V}from"permissionless/clients/pimlico";import{createPublicClient as M,http as W}from"viem";import{entryPoint06Address as Y,entryPoint07Address as j}from"viem/account-abstraction";var K=({calls:r,chain:t,maxPriorityFeePerGas:a,maxFeePerGas:n,nonce:d})=>r.map(s=>({to:s.to||void 0,data:s.data,value:s.value,chainId:t.id,nonce:d,maxFeePerGas:n,maxPriorityFeePerGas:a})),R=()=>{let{chains:r,noPromptOnSignature:t,openPrivyModal:a}=E(),{setModalData:n}=v();return{getSmartWalletClient:async(d,s,o)=>{let P=I(r),u=_(o.chainId),l=P.find(e=>e.id===u);if(!l)throw new Error(`Error finding chain object for smart wallet network ${o.chainId} in app config. Please ensure you have a chain object for ${o.chainId} in app config.`);let S=await d.getEthereumProvider(),{sendTransaction:g,signMessage:T,signTypedData:p,...y}=await J({owner:S,smartWalletType:s,chain:l,...o});return{...y,sendTransaction:async e=>{if(t.current)return await g(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 C=async()=>{if(!y.paymaster)return!1;let{paymasterAndData:f,paymasterData:w}=await y.prepareUserOperation({calls:m,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return Number(f??w??0)>0};return new Promise(async(f,w)=>{t.current=!0,n({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:()=>{}},sendTransaction:{transactionRequests:K({calls:m,chain:l,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),rootWallet:{address:y.account.address},transactingWallet:{address:y.account.address,walletIndex:null},getIsSponsored:C,onConfirm:()=>g(e),onSuccess:B=>f(B.hash),onFailure:w,uiOptions:{}}}),a("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1})},signMessage:async({message:e})=>t.current?await T({message:e}):new Promise(async(m,C)=>{t.current=!0,n({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>T({message:e}),onSuccess:f=>m(f),onFailure:C,uiOptions:{}}}),a("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1}),signTypedData:async e=>t.current?await p(e):new Promise(async(m,C)=>{t.current=!0,n({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>p(e),onSuccess:f=>m(f),onFailure:C,uiOptions:{}}}),a("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1})}}}},G={address:Y,version:"0.6"},b={address:j,version:"0.7"},z=({owner:r,smartWalletType:t,chain:a})=>{let n=M({chain:a,transport:W()});switch(t){case"safe":return Q({client:n,entryPoint:b,owners:[r],version:"1.4.1"});case"kernel":return $({client:n,version:"0.3.1",entryPoint:b,owners:[r]});case"biconomy":return k({client:n,owners:[r],entryPoint:G});case"light_account":return q({client:n,entryPoint:G,owner:r,version:"1.1.0"});default:throw new Error(`Invalid smart account type: ${t}.`)}},J=async({owner:r,smartWalletType:t,chain:a,bundlerUrl:n,paymasterUrl:d})=>{let s=M({chain:a,transport:W()}),o=await z({owner:r,smartWalletType:t,chain:a}),u=!!d?V({transport:W(d),entryPoint:o.entryPoint}):void 0;return U({account:o,chain:a,paymaster:u,bundlerTransport:W(n),userOperation:{estimateFeesPerGas:async()=>{let l=await s.estimateFeesPerGas();return{...l,maxFeePerGas:l.maxFeePerGas*115n/100n,maxPriorityFeePerGas:l.maxPriorityFeePerGas*115n/100n}}}})};import{jsx as ne}from"react/jsx-runtime";var L=X({client:void 0}),ee=({children:r})=>{let[t,a]=H(null),{getSmartWalletClient:n}=R(),{generateSiweMessage:d,linkSmartWallet:s,client:o,noPromptOnSignature:P}=E(),{defaultChain:u}=D(),{wallets:l}=N(),{user:S}=A(),[g,T]=H(),p=F(l);return O(()=>{!t&&o&&(async()=>{try{if(!o){console.warn("No client found");return}let c=await o.getSmartWalletsConfig();a(c)}catch(c){console.warn("Error generating smart wallet config: ",c)}})()},[!!o]),O(()=>{(async()=>{if(!t?.enabled||!S||!p){T(void 0);return}if(g)return;let c=t.configuredNetworks.find(i=>i.chainId===`eip155:${u.id}`);if(!c)throw new x(`The defaultChain ${u.name} (eip155:${u.id}) must be configured in the smart wallet configuration in your dashboard`);if(S.smartWallet)try{let i=await n(p,S.smartWallet.smartWalletType,c);T(i);return}catch(i){console.error("Error loading smart wallet:",i);return}try{let i=await n(p,t.smartWalletType,c),h=await d({address:i.account.address,chainId:c.chainId});P.current=!0;let e=await i.signMessage({message:h});await s({signature:e,message:h,smartWalletType:t.smartWalletType}),T(i)}catch(i){console.error("Error creating smart wallet:",i)}finally{P.current=!1}})()},[!!t?.enabled,!!S?.smartWallet,!!p]),ne(L.Provider,{value:{client:g},children:r})},te=()=>Z(L);export{ee as SmartWalletsProvider,te as useSmartWallets};
1
+ import{b as v,d as N,e as F,f as G}from"./chunk-3AGMJGHJ.js";import{g as A,oa as E,ra as W,ta as I,va as _}from"./chunk-XKAIXCX7.js";import{createContext as Z,useContext as ee,useEffect as H,useState as L}from"react";import{createSmartAccountClient as k}from"permissionless";import{toBiconomySmartAccount as $,toEcdsaKernelSmartAccount as q,toLightSmartAccount as Q,toSafeSmartAccount as V}from"permissionless/accounts";import{createPimlicoClient as Y}from"permissionless/clients/pimlico";import{createPublicClient as O,http as h}from"viem";import{entryPoint06Address as j,entryPoint07Address as K}from"viem/account-abstraction";var z=({calls:o,chain:t,maxPriorityFeePerGas:r,maxFeePerGas:n,nonce:s})=>o.map(l=>({to:l.to||void 0,data:l.data,value:l.value,chainId:t.id,nonce:s,maxFeePerGas:n,maxPriorityFeePerGas:r})),R=()=>{let{chains:o,noPromptOnSignature:t,openPrivyModal:r}=W(),n=E(),{setModalData:s}=v();return{getSmartWalletClient:async(l,c,d)=>{let p=N(o),y=F(d.chainId),m=p.find(e=>e.id===y);if(!m)throw new Error(`Error finding chain object for smart wallet network ${d.chainId} in app config. Please ensure you have a chain object for ${d.chainId} in app config.`);let g=await l.getEthereumProvider(),{sendTransaction:T,signMessage:f,signTypedData:C,...a}=await X({owner:g,smartWalletType:c,chain:m,...d});return{...a,sendTransaction:async e=>{if(n.embeddedWallets.noPromptOnSignature||t.current)return await T(e);let u=[];"calls"in e&&typeof e.calls<"u"?u=[...e.calls]:"to"in e&&(u=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let P=async()=>{if(!a.paymaster)return!1;let{paymasterAndData:S,paymasterData:x}=await a.prepareUserOperation({calls:u,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return Number(S??x??0)>0};return new Promise(async(S,x)=>{t.current=!0,s({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:()=>{}},sendTransaction:{transactionRequests:z({calls:u,chain:m,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:P,onConfirm:()=>T(e),onSuccess:U=>S(U.hash),onFailure:x,uiOptions:{}}}),r("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1})},signMessage:async({message:e})=>n.embeddedWallets.noPromptOnSignature||t.current?await f({message:e}):new Promise(async(u,P)=>{t.current=!0,s({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>f({message:e}),onSuccess:S=>u(S),onFailure:P,uiOptions:{}}}),r("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1}),signTypedData:async e=>t.current?await C(e):new Promise(async(u,P)=>{t.current=!0,s({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>C(e),onSuccess:S=>u(S),onFailure:P,uiOptions:{}}}),r("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1})}}}},b={address:j,version:"0.6"},M={address:K,version:"0.7"},J=({owner:o,smartWalletType:t,chain:r})=>{let n=O({chain:r,transport:h()});switch(t){case"safe":return V({client:n,entryPoint:M,owners:[o],version:"1.4.1"});case"kernel":return q({client:n,version:"0.3.1",entryPoint:M,owners:[o]});case"biconomy":return $({client:n,owners:[o],entryPoint:b});case"light_account":return Q({client:n,entryPoint:b,owner:o,version:"1.1.0"});default:throw new Error(`Invalid smart account type: ${t}.`)}},X=async({owner:o,smartWalletType:t,chain:r,bundlerUrl:n,paymasterUrl:s})=>{let l=O({chain:r,transport:h()}),c=await J({owner:o,smartWalletType:t,chain:r}),p=!!s?Y({transport:h(s),entryPoint:c.entryPoint}):void 0;return k({account:c,chain:r,paymaster:p,bundlerTransport:h(n),userOperation:{estimateFeesPerGas:async()=>{let y=await l.estimateFeesPerGas();return{...y,maxFeePerGas:y.maxFeePerGas*115n/100n,maxPriorityFeePerGas:y.maxPriorityFeePerGas*115n/100n}}}})};import{jsx as ae}from"react/jsx-runtime";var B=Z({client:void 0}),te=({children:o})=>{let[t,r]=L(null),{getSmartWalletClient:n}=R(),{generateSiweMessage:s,linkSmartWallet:l,client:c,noPromptOnSignature:d}=W(),{defaultChain:p}=E(),{wallets:y}=_(),{user:m}=I(),[g,T]=L(),f=G(y);return H(()=>{!t&&c&&(async()=>{try{if(!c){console.warn("No client found");return}let a=await c.getSmartWalletsConfig();r(a)}catch(a){console.warn("Error generating smart wallet config: ",a)}})()},[!!c]),H(()=>{(async()=>{if(!t?.enabled||!m||!f){T(void 0);return}if(g)return;let a=t.configuredNetworks.find(i=>i.chainId===`eip155:${p.id}`);if(!a)throw new A(`The defaultChain ${p.name} (eip155:${p.id}) must be configured in the smart wallet configuration in your dashboard`);if(m.smartWallet)try{let i=await n(f,m.smartWallet.smartWalletType,a);T(i);return}catch(i){console.error("Error loading smart wallet:",i);return}try{let i=await n(f,t.smartWalletType,a),w=await s({address:i.account.address,chainId:a.chainId});d.current=!0;let D=await i.signMessage({message:w});await l({signature:D,message:w,smartWalletType:t.smartWalletType}),T(i)}catch(i){console.error("Error creating smart wallet:",i)}finally{d.current=!1}})()},[!!t?.enabled,!!m?.smartWallet,!!f]),ae(B.Provider,{value:{client:g},children:o})},ne=()=>ee(B);export{te as SmartWalletsProvider,ne as useSmartWallets};
@@ -1 +1 @@
1
- import{e as o,x as t}from"./chunk-M7S3ORHS.js";import"./chunk-CMFOSIZZ.js";import"./chunk-BWEW65KO.js";import"./chunk-KD3IIYQS.js";import{useStandardWalletAdapters as n}from"@solana/wallet-standard-wallet-adapter-react";function l(e){return n([]).map(a=>new o(a,e?.shouldAutoConnect||!0))}export{o as SolanaAdapterConnector,l as useSolanaWalletConnectors,t as useSolanaWallets};
1
+ import{e as a,x as m}from"./chunk-QTSNS7VF.js";import"./chunk-LEABMTNM.js";import"./chunk-3AGMJGHJ.js";import"./chunk-XKAIXCX7.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,P 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-CMFOSIZZ.js";import{oa as Q,ra as R,ta as g,va as w}from"./chunk-KD3IIYQS.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,P 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-LEABMTNM.js";import{oa as Q,ra as R,ta as g,va as w}from"./chunk-XKAIXCX7.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, R as RpcConfig, P as PrivyProxyProvider, E as Embedded1193Provider, a as WalletClientType, b as ConnectedWalletMetadata, c as ConnectorType, d as WalletListEntry, e as ExternalWalletsConfig, f as BaseConnectedWallet, S as SolanaWalletConnector, g as EIP1193Provider, U as User, O as OAuthTokens, h as OAuthProviderType, M as MoonpaySignRequest, i as MoonpaySignResponse, j as SmartWalletConfig, k as PrivyServerConfig, l as PrivyFarcasterSignerInitResponse, m as PrivyClientConfig, n as ConnectWalletModalOptions, L as LoginModalOptions, o as CreateWalletOptions, p as Wallet, q as SetWalletRecoveryOptions, r as SignMessageModalUIOptions, s as SignTypedDataParams, t as MfaMethod, u as UnsignedTransactionRequest, v as SendTransactionModalUIOptions, F as FundWalletConfig, T as TransactionReceipt, w as ConnectedWallet, x as PrivyIframeErrorTypesType, y as PrivyErrorCode, z as LoginMethod, A as LinkedAccountWithMetadata, D as UserRecoveryMethod, G as FundingMethod, H as LoginWithCode, I as OtpFlowState, J as UnsignedTransactionRequestWithChainId, K as CustomAuthFlowState } from './types-cbc2ff3a.js';
4
- export { a9 as Apple, aj as AppleOAuthWithMetadata, N as AsExternalProvider, ay as ConnectedSolanaWallet, ar as ContractUIOptions, ac as CrossAppAccount, am as CrossAppAccountWithMetadata, a6 as Discord, af as DiscordOAuthWithMetadata, ao as Email, a1 as EmailWithMetadata, av as Farcaster, ak as FarcasterWithMetadata, a7 as Github, ag as GithubOAuthWithMetadata, a4 as Google, ad as GoogleOAuthWithMetadata, a8 as LinkedIn, ai as LinkedInOAuthWithMetadata, ax as LoginMethodOrderOption, V as MessageTypes, X as MoonpayConfig, Y as MoonpayCurrencyCode, at as MoonpayFundingConfig, Z as MoonpayPaymentMethod, as as NativeFundingConfig, a0 as NonEmptyArray, aw as Passkey, an as PasskeyWithMetadata, ap as Phone, a2 as PhoneWithMetadata, au as PriceDisplayOptions, _ as Quantity, ab as Telegram, al as TelegramWithMetadata, aa as Tiktok, ah as TiktokOAuthWithMetadata, $ as TransactionLog, aq as TransactionUIOptions, a5 as Twitter, ae as TwitterOAuthWithMetadata, Q as TypedMessage, a3 as WalletWithMetadata } from './types-cbc2ff3a.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, n as PrivyClientConfig, o as ConnectWalletModalOptions, L as LoginModalOptions, p as CreateWalletOptions, q as Wallet, r as SetWalletRecoveryOptions, s as SignMessageModalUIOptions, t as SignTypedDataParams, u as MfaMethod, v as UnsignedTransactionRequest, w as SendTransactionModalUIOptions, F as FundWalletConfig, T as TransactionReceipt, x as ConnectedWallet, y as PrivyIframeErrorTypesType, z as PrivyErrorCode, A as LoginMethod, D as LinkedAccountWithMetadata, G as UserRecoveryMethod, H as FundingMethod, I as LoginWithCode, J as OtpFlowState, K as UnsignedTransactionRequestWithChainId, N as CustomAuthFlowState } from './types-fcce0fc5.js';
4
+ export { aa as Apple, ak as AppleOAuthWithMetadata, Q as AsExternalProvider, az as ConnectedSolanaWallet, as as ContractUIOptions, ad as CrossAppAccount, an as CrossAppAccountWithMetadata, a7 as Discord, ag as DiscordOAuthWithMetadata, ap as Email, a2 as EmailWithMetadata, aw as Farcaster, al as FarcasterWithMetadata, a8 as Github, ah as GithubOAuthWithMetadata, a5 as Google, ae as GoogleOAuthWithMetadata, a9 as LinkedIn, aj as LinkedInOAuthWithMetadata, ay as LoginMethodOrderOption, X as MessageTypes, Y as MoonpayConfig, Z as MoonpayCurrencyCode, au as MoonpayFundingConfig, _ as MoonpayPaymentMethod, at as NativeFundingConfig, a1 as NonEmptyArray, ax as Passkey, ao as PasskeyWithMetadata, aq as Phone, a3 as PhoneWithMetadata, av as PriceDisplayOptions, $ as Quantity, ac as Telegram, am as TelegramWithMetadata, ab as Tiktok, ai as TiktokOAuthWithMetadata, a0 as TransactionLog, ar as TransactionUIOptions, a6 as Twitter, af as TwitterOAuthWithMetadata, V as TypedMessage, a4 as WalletWithMetadata } from './types-fcce0fc5.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';
@@ -9,12 +9,16 @@ import { Store, EIP6963ProviderDetail } from 'mipd';
9
9
  import { Web3Provider, TransactionResponse } from '@ethersproject/providers';
10
10
  import * as _simplewebauthn_types from '@simplewebauthn/types';
11
11
  import { PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/types';
12
+ import * as _solana_wallet_adapter_base from '@solana/wallet-adapter-base';
13
+ import { SendTransactionOptions } from '@solana/wallet-adapter-base';
14
+ import * as _solana_web3_js from '@solana/web3.js';
15
+ import { Connection } from '@solana/web3.js';
12
16
  import { AbstractProvider } from 'web3-core';
17
+ import { SupportedSolanaTransaction, SolanaTransactionReceipt } from './solana.js';
18
+ export { UseSolanaWalletsInterface, useSolanaWallets } from './solana.js';
13
19
  import { SmartWalletType, PrivyCoinbaseOnRampInitInput, PrivyCoinbaseOnRampInitResponse, PrivyCoinbaseOnRampStatusResponse } from '@privy-io/public-api';
14
20
  import { FetchOptions } from 'ofetch';
15
- export { U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-56085db4.js';
16
21
  import '@metamask/eth-sig-util';
17
- import '@solana/wallet-adapter-base';
18
22
  import 'libphonenumber-js/min';
19
23
  import 'viem';
20
24
 
@@ -613,6 +617,7 @@ declare class PrivyClient {
613
617
  getSmartWalletsConfig(): Promise<SmartWalletConfig>;
614
618
  getServerConfig(): Promise<PrivyServerConfig>;
615
619
  getUsdTokenPrice(chain: Chain): Promise<number | undefined>;
620
+ getUsdPriceForSol(): Promise<number | undefined>;
616
621
  requestFarcasterSignerStatus(publicKey: string): Promise<PrivyFarcasterSignerInitResponse>;
617
622
  /**
618
623
  * Get a short-lived token to start a new Privy session from the existing authenticated session.
@@ -1217,7 +1222,7 @@ interface PrivyInterface {
1217
1222
  /**
1218
1223
  * Prompts a user to send a transaction using their embedded wallet.
1219
1224
  *
1220
- * This method will error if the user is not authenticated or does not have an embedded wallet.
1225
+ * This method will error if the user is not authenticated or does not have an ethereum embedded wallet.
1221
1226
  *
1222
1227
  * If no `chainId` is specified as part of the {@link UnsignedTransactionRequest}, Privy will default
1223
1228
  * to the embedded wallet's current chain ID.
@@ -1235,6 +1240,21 @@ interface PrivyInterface {
1235
1240
  * @returns Promise for the transaction's {@link TransactionReceipt}
1236
1241
  */
1237
1242
  sendTransaction: (data: UnsignedTransactionRequest, uiOptions?: SendTransactionModalUIOptions, fundWalletConfig?: FundWalletConfig, address?: string) => Promise<TransactionReceipt>;
1243
+ /**
1244
+ * Prompts a user to send a transaction using their embedded wallet.
1245
+ *
1246
+ * This method will error if the user is not authenticated or does not have a solana embedded wallet.
1247
+ *
1248
+ * If the `config.embeddedWallets.noPromptOnSignature` property is set to true, the wallet will attempt to send
1249
+ * the transaction without prompting the user. Otherwise (the default), Privy will show the user a modal to have
1250
+ * them confirm the transaction. This can be customized via the {@link SendTransactionModalUIOptions}.
1251
+ *
1252
+ * @param transaction {SupportedSolanaTransaction} transaction to be sent
1253
+ * @param connection {Connection} connection to the Solana network
1254
+ * @param uiOptions {@link SendTransactionModalUIOptions} (optional) UI options to customize the transaction request modal
1255
+ * @param transactionOptions {@link SendTransactionOptions} (optional) Transaction options to customize the transaction request
1256
+ */
1257
+ sendSolanaTransaction: (transaction: SupportedSolanaTransaction, connection: Connection, uiOptions?: SendTransactionModalUIOptions, transactionOptions?: SendTransactionOptions) => Promise<SolanaTransactionReceipt>;
1238
1258
  /**
1239
1259
  * Shows the user a Privy modal, from which they can copy their embedded wallet's private
1240
1260
  * key or seed phrase for easy export to another wallet client (e.g. MetaMask). The private key is loaded
@@ -1608,6 +1628,20 @@ interface PrivyEvents {
1608
1628
  * */
1609
1629
  onError?: CallbackError;
1610
1630
  };
1631
+ sendSolanaTransaction: {
1632
+ /**
1633
+ * Callback that will execute once a successful `sendSolanaTransaction` completes.
1634
+ * This will not run in the case of a wallet-based authentication or link flow.
1635
+ * @param response - the response (type SolanaTransactionReceipt https://solana-labs.github.io/solana-web3.js/types/ParsedTransactionMeta.html) from the successful transaction
1636
+ */
1637
+ onSuccess?: (response: SolanaTransactionReceipt) => void;
1638
+ /**
1639
+ * Callback that will execute in the case of a non-successful sendTransaction.
1640
+ *
1641
+ * @param error {@link PrivyErrorCode} - the corresponding error code
1642
+ * */
1643
+ onError?: CallbackError;
1644
+ };
1611
1645
  accessToken: {
1612
1646
  /**
1613
1647
  * Callback that will execute when a user's access token is granted.
@@ -2132,6 +2166,22 @@ declare function useSendTransaction(callbacks?: PrivyEvents['sendTransaction']):
2132
2166
  sendTransaction: (data: UnsignedTransactionRequest, uiOptions?: SendTransactionModalUIOptions, fundWalletConfig?: FundWalletConfig, address?: string) => Promise<TransactionReceipt>;
2133
2167
  };
2134
2168
 
2169
+ /**
2170
+ * Use this hook to send a transaction using the embedded wallet and to attach callbacks for success and errors.
2171
+ * Transactions sent from the embedded wallet using transaction functions from non-Privy libraries
2172
+ * will not trigger the callbacks.
2173
+ *
2174
+ * @param callbacks.onSuccess {@link PrivyEvents} callback to execute for a successful transaction sent
2175
+ * @param callbacks.onError {@link PrivyEvents} callback to execute if there is an error during `sendSolanaTransaction`
2176
+ * @returns sendSolanaTransaction - prompts the user send a transaction using their embedded wallet
2177
+ */
2178
+ declare function useSendSolanaTransaction(callbacks?: PrivyEvents['sendSolanaTransaction']): {
2179
+ /**
2180
+ * Prompts a user to send a transaction using their embedded wallet.
2181
+ */
2182
+ sendSolanaTransaction: (transaction: SupportedSolanaTransaction, connection: _solana_web3_js.Connection, uiOptions?: SendTransactionModalUIOptions, transactionOptions?: _solana_wallet_adapter_base.SendTransactionOptions) => Promise<SolanaTransactionReceipt>;
2183
+ };
2184
+
2135
2185
  /**
2136
2186
  * Use this hook to set a password on the embedded wallet, and to attach callbacks
2137
2187
  * for successful `password set`s, and `password set` errors.
@@ -2346,4 +2396,4 @@ declare const LoginModal: ({ open }: {
2346
2396
  open: boolean;
2347
2397
  }) => react_jsx_runtime.JSX.Element;
2348
2398
 
2349
- 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, 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, useSendTransaction, useSetWalletPassword, useSetWalletRecovery, useSignMessage, useSignTypedData, useToken, useWallets };
2399
+ 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, 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 };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkM7S3ORHSjs = require('./chunk-M7S3ORHS.js');var _chunkCMFOSIZZjs = require('./chunk-CMFOSIZZ.js');var _chunkBWEW65KOjs = require('./chunk-BWEW65KO.js');var _chunkKD3IIYQSjs = require('./chunk-KD3IIYQS.js');exports.AsExternalProvider = _chunkM7S3ORHSjs.c; exports.Captcha = _chunkM7S3ORHSjs.h; exports.ConnectorManager = _chunkM7S3ORHSjs.f; exports.EthereumWalletConnector = _chunkM7S3ORHSjs.d; exports.LoginModal = _chunkM7S3ORHSjs.o; exports.PrivyClient = _chunkM7S3ORHSjs.g; exports.PrivyProvider = _chunkM7S3ORHSjs.q; exports.PrivyProxyProvider = _chunkM7S3ORHSjs.b; exports.SUPPORTED_CHAINS = _chunkKD3IIYQSjs.ka; exports.VERSION = _chunkKD3IIYQSjs.u; exports.WalletConnector = _chunkM7S3ORHSjs.a; exports.addRpcUrlOverrideToChain = _chunkBWEW65KOjs.c; exports.errorIndicatesMaxMfaRetries = _chunkM7S3ORHSjs.l; exports.errorIndicatesMfaTimeout = _chunkM7S3ORHSjs.j; exports.errorIndicatesMfaVerificationFailed = _chunkM7S3ORHSjs.k; exports.getAccessToken = _chunkM7S3ORHSjs.p; exports.getEmbeddedConnectedWallet = _chunkBWEW65KOjs.f; exports.useConnectCoinbaseSmartWallet = _chunkM7S3ORHSjs.y; exports.useConnectWallet = _chunkCMFOSIZZjs.ba; exports.useCreateWallet = _chunkM7S3ORHSjs.w; exports.useCrossAppAccounts = _chunkM7S3ORHSjs.z; exports.useCustomAuth = _chunkM7S3ORHSjs.J; exports.useExperimentalFarcasterSigner = _chunkM7S3ORHSjs.K; exports.useFarcasterSigner = _chunkM7S3ORHSjs.L; exports.useFundWallet = _chunkCMFOSIZZjs.ca; exports.useGuestAccounts = _chunkM7S3ORHSjs.C; exports.useLinkAccount = _chunkM7S3ORHSjs.v; exports.useLinkWithSiwe = _chunkM7S3ORHSjs.u; exports.useLogin = _chunkCMFOSIZZjs.aa; exports.useLoginWithEmail = _chunkM7S3ORHSjs.s; exports.useLoginWithOAuth = _chunkM7S3ORHSjs.r; exports.useLoginWithSms = _chunkM7S3ORHSjs.t; exports.useLogout = _chunkCMFOSIZZjs.R; exports.useMfa = _chunkM7S3ORHSjs.m; exports.useMfaEnrollment = _chunkM7S3ORHSjs.n; exports.useModalStatus = _chunkM7S3ORHSjs.G; exports.useOAuthTokens = _chunkM7S3ORHSjs.I; exports.usePrivy = _chunkKD3IIYQSjs.ta; exports.useRegisterMfaListener = _chunkM7S3ORHSjs.i; exports.useSendTransaction = _chunkM7S3ORHSjs.A; exports.useSetWalletPassword = _chunkM7S3ORHSjs.B; exports.useSetWalletRecovery = _chunkM7S3ORHSjs.D; exports.useSignMessage = _chunkM7S3ORHSjs.E; exports.useSignTypedData = _chunkM7S3ORHSjs.F; exports.useSolanaWallets = _chunkM7S3ORHSjs.x; exports.useToken = _chunkM7S3ORHSjs.H; exports.useWallets = _chunkKD3IIYQSjs.va;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQTSNS7VFjs = require('./chunk-QTSNS7VF.js');var _chunkLEABMTNMjs = require('./chunk-LEABMTNM.js');var _chunk3AGMJGHJjs = require('./chunk-3AGMJGHJ.js');var _chunkXKAIXCX7js = require('./chunk-XKAIXCX7.js');exports.AsExternalProvider = _chunkQTSNS7VFjs.c; exports.Captcha = _chunkQTSNS7VFjs.h; exports.ConnectorManager = _chunkQTSNS7VFjs.f; exports.EthereumWalletConnector = _chunkQTSNS7VFjs.d; exports.LoginModal = _chunkQTSNS7VFjs.o; exports.PrivyClient = _chunkQTSNS7VFjs.g; exports.PrivyProvider = _chunkQTSNS7VFjs.q; exports.PrivyProxyProvider = _chunkQTSNS7VFjs.b; exports.SUPPORTED_CHAINS = _chunkXKAIXCX7js.ka; exports.VERSION = _chunkXKAIXCX7js.u; exports.WalletConnector = _chunkQTSNS7VFjs.a; exports.addRpcUrlOverrideToChain = _chunk3AGMJGHJjs.c; exports.errorIndicatesMaxMfaRetries = _chunkQTSNS7VFjs.l; exports.errorIndicatesMfaTimeout = _chunkQTSNS7VFjs.j; exports.errorIndicatesMfaVerificationFailed = _chunkQTSNS7VFjs.k; exports.getAccessToken = _chunkQTSNS7VFjs.p; exports.getEmbeddedConnectedWallet = _chunk3AGMJGHJjs.f; exports.useConnectCoinbaseSmartWallet = _chunkQTSNS7VFjs.y; exports.useConnectWallet = _chunkLEABMTNMjs.ba; exports.useCreateWallet = _chunkQTSNS7VFjs.w; exports.useCrossAppAccounts = _chunkQTSNS7VFjs.z; exports.useCustomAuth = _chunkQTSNS7VFjs.K; exports.useExperimentalFarcasterSigner = _chunkQTSNS7VFjs.L; exports.useFarcasterSigner = _chunkQTSNS7VFjs.M; exports.useFundWallet = _chunkLEABMTNMjs.ca; exports.useGuestAccounts = _chunkQTSNS7VFjs.D; exports.useLinkAccount = _chunkQTSNS7VFjs.v; exports.useLinkWithSiwe = _chunkQTSNS7VFjs.u; exports.useLogin = _chunkLEABMTNMjs.aa; exports.useLoginWithEmail = _chunkQTSNS7VFjs.s; exports.useLoginWithOAuth = _chunkQTSNS7VFjs.r; exports.useLoginWithSms = _chunkQTSNS7VFjs.t; exports.useLogout = _chunkLEABMTNMjs.R; exports.useMfa = _chunkQTSNS7VFjs.m; exports.useMfaEnrollment = _chunkQTSNS7VFjs.n; exports.useModalStatus = _chunkQTSNS7VFjs.H; exports.useOAuthTokens = _chunkQTSNS7VFjs.J; exports.usePrivy = _chunkXKAIXCX7js.ta; exports.useRegisterMfaListener = _chunkQTSNS7VFjs.i; exports.useSendSolanaTransaction = _chunkQTSNS7VFjs.B; exports.useSendTransaction = _chunkQTSNS7VFjs.A; exports.useSetWalletPassword = _chunkQTSNS7VFjs.C; exports.useSetWalletRecovery = _chunkQTSNS7VFjs.E; exports.useSignMessage = _chunkQTSNS7VFjs.F; exports.useSignTypedData = _chunkQTSNS7VFjs.G; exports.useSolanaWallets = _chunkQTSNS7VFjs.x; exports.useToken = _chunkQTSNS7VFjs.I; exports.useWallets = _chunkXKAIXCX7js.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 _chunkBWEW65KOjs = require('./chunk-BWEW65KO.js');var _chunkKD3IIYQSjs = require('./chunk-KD3IIYQS.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 K=({calls:r,chain:t,maxPriorityFeePerGas:a,maxFeePerGas:n,nonce:d})=>r.map(s=>({to:s.to||void 0,data:s.data,value:s.value,chainId:t.id,nonce:d,maxFeePerGas:n,maxPriorityFeePerGas:a})),R=()=>{let{chains:r,noPromptOnSignature:t,openPrivyModal:a}=_chunkKD3IIYQSjs.ra.call(void 0, ),{setModalData:n}=_chunkBWEW65KOjs.b.call(void 0, );return{getSmartWalletClient:async(d,s,o)=>{let P=_chunkBWEW65KOjs.d.call(void 0, r),u=_chunkBWEW65KOjs.e.call(void 0, o.chainId),l=P.find(e=>e.id===u);if(!l)throw new Error(`Error finding chain object for smart wallet network ${o.chainId} in app config. Please ensure you have a chain object for ${o.chainId} in app config.`);let S=await d.getEthereumProvider(),{sendTransaction:g,signMessage:T,signTypedData:p,...y}=await J({owner:S,smartWalletType:s,chain:l,...o});return{...y,sendTransaction:async e=>{if(t.current)return await g(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 C=async()=>{if(!y.paymaster)return!1;let{paymasterAndData:f,paymasterData:w}=await y.prepareUserOperation({calls:m,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return Number(_nullishCoalesce(_nullishCoalesce(f, () => (w)), () => (0)))>0};return new Promise(async(f,w)=>{t.current=!0,n({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:()=>{}},sendTransaction:{transactionRequests:K({calls:m,chain:l,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),rootWallet:{address:y.account.address},transactingWallet:{address:y.account.address,walletIndex:null},getIsSponsored:C,onConfirm:()=>g(e),onSuccess:B=>f(B.hash),onFailure:w,uiOptions:{}}}),a("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1})},signMessage:async({message:e})=>t.current?await T({message:e}):new Promise(async(m,C)=>{t.current=!0,n({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>T({message:e}),onSuccess:f=>m(f),onFailure:C,uiOptions:{}}}),a("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1}),signTypedData:async e=>t.current?await p(e):new Promise(async(m,C)=>{t.current=!0,n({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>p(e),onSuccess:f=>m(f),onFailure:C,uiOptions:{}}}),a("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1})}}}},G={address:_accountabstraction.entryPoint06Address,version:"0.6"},b={address:_accountabstraction.entryPoint07Address,version:"0.7"},z=({owner:r,smartWalletType:t,chain:a})=>{let n=_viem.createPublicClient.call(void 0, {chain:a,transport:_viem.http.call(void 0, )});switch(t){case"safe":return _accounts.toSafeSmartAccount.call(void 0, {client:n,entryPoint:b,owners:[r],version:"1.4.1"});case"kernel":return _accounts.toEcdsaKernelSmartAccount.call(void 0, {client:n,version:"0.3.1",entryPoint:b,owners:[r]});case"biconomy":return _accounts.toBiconomySmartAccount.call(void 0, {client:n,owners:[r],entryPoint:G});case"light_account":return _accounts.toLightSmartAccount.call(void 0, {client:n,entryPoint:G,owner:r,version:"1.1.0"});default:throw new Error(`Invalid smart account type: ${t}.`)}},J=async({owner:r,smartWalletType:t,chain:a,bundlerUrl:n,paymasterUrl:d})=>{let s=_viem.createPublicClient.call(void 0, {chain:a,transport:_viem.http.call(void 0, )}),o=await z({owner:r,smartWalletType:t,chain:a}),u=!!d?_pimlico.createPimlicoClient.call(void 0, {transport:_viem.http.call(void 0, d),entryPoint:o.entryPoint}):void 0;return _permissionless.createSmartAccountClient.call(void 0, {account:o,chain:a,paymaster:u,bundlerTransport:_viem.http.call(void 0, n),userOperation:{estimateFeesPerGas:async()=>{let l=await s.estimateFeesPerGas();return{...l,maxFeePerGas:l.maxFeePerGas*115n/100n,maxPriorityFeePerGas:l.maxPriorityFeePerGas*115n/100n}}}})};var _jsxruntime = require('react/jsx-runtime');var L=_react.createContext.call(void 0, {client:void 0}),ee= exports.SmartWalletsProvider =({children:r})=>{let[t,a]=_react.useState.call(void 0, null),{getSmartWalletClient:n}=R(),{generateSiweMessage:d,linkSmartWallet:s,client:o,noPromptOnSignature:P}=_chunkKD3IIYQSjs.ra.call(void 0, ),{defaultChain:u}=_chunkKD3IIYQSjs.oa.call(void 0, ),{wallets:l}=_chunkKD3IIYQSjs.va.call(void 0, ),{user:S}=_chunkKD3IIYQSjs.ta.call(void 0, ),[g,T]=_react.useState.call(void 0, ),p=_chunkBWEW65KOjs.f.call(void 0, l);return _react.useEffect.call(void 0, ()=>{!t&&o&&(async()=>{try{if(!o){console.warn("No client found");return}let c=await o.getSmartWalletsConfig();a(c)}catch(c){console.warn("Error generating smart wallet config: ",c)}})()},[!!o]),_react.useEffect.call(void 0, ()=>{(async()=>{if(!_optionalChain([t, 'optionalAccess', _2 => _2.enabled])||!S||!p){T(void 0);return}if(g)return;let c=t.configuredNetworks.find(i=>i.chainId===`eip155:${u.id}`);if(!c)throw new (0, _chunkKD3IIYQSjs.g)(`The defaultChain ${u.name} (eip155:${u.id}) must be configured in the smart wallet configuration in your dashboard`);if(S.smartWallet)try{let i=await n(p,S.smartWallet.smartWalletType,c);T(i);return}catch(i){console.error("Error loading smart wallet:",i);return}try{let i=await n(p,t.smartWalletType,c),h=await d({address:i.account.address,chainId:c.chainId});P.current=!0;let e=await i.signMessage({message:h});await s({signature:e,message:h,smartWalletType:t.smartWalletType}),T(i)}catch(i){console.error("Error creating smart wallet:",i)}finally{P.current=!1}})()},[!!_optionalChain([t, 'optionalAccess', _3 => _3.enabled]),!!_optionalChain([S, 'optionalAccess', _4 => _4.smartWallet]),!!p]),_jsxruntime.jsx.call(void 0, L.Provider,{value:{client:g},children:r})},te= exports.useSmartWallets =()=>_react.useContext.call(void 0, L);exports.SmartWalletsProvider = ee; exports.useSmartWallets = te;
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 _chunk3AGMJGHJjs = require('./chunk-3AGMJGHJ.js');var _chunkXKAIXCX7js = require('./chunk-XKAIXCX7.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 z=({calls:o,chain:t,maxPriorityFeePerGas:r,maxFeePerGas:n,nonce:s})=>o.map(l=>({to:l.to||void 0,data:l.data,value:l.value,chainId:t.id,nonce:s,maxFeePerGas:n,maxPriorityFeePerGas:r})),R=()=>{let{chains:o,noPromptOnSignature:t,openPrivyModal:r}=_chunkXKAIXCX7js.ra.call(void 0, ),n=_chunkXKAIXCX7js.oa.call(void 0, ),{setModalData:s}=_chunk3AGMJGHJjs.b.call(void 0, );return{getSmartWalletClient:async(l,c,d)=>{let p=_chunk3AGMJGHJjs.d.call(void 0, o),y=_chunk3AGMJGHJjs.e.call(void 0, d.chainId),m=p.find(e=>e.id===y);if(!m)throw new Error(`Error finding chain object for smart wallet network ${d.chainId} in app config. Please ensure you have a chain object for ${d.chainId} in app config.`);let g=await l.getEthereumProvider(),{sendTransaction:T,signMessage:f,signTypedData:C,...a}=await X({owner:g,smartWalletType:c,chain:m,...d});return{...a,sendTransaction:async e=>{if(n.embeddedWallets.noPromptOnSignature||t.current)return await T(e);let u=[];"calls"in e&&typeof e.calls<"u"?u=[...e.calls]:"to"in e&&(u=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let P=async()=>{if(!a.paymaster)return!1;let{paymasterAndData:S,paymasterData:x}=await a.prepareUserOperation({calls:u,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return Number(_nullishCoalesce(_nullishCoalesce(S, () => (x)), () => (0)))>0};return new Promise(async(S,x)=>{t.current=!0,s({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:()=>{}},sendTransaction:{transactionRequests:z({calls:u,chain:m,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:P,onConfirm:()=>T(e),onSuccess:U=>S(U.hash),onFailure:x,uiOptions:{}}}),r("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1})},signMessage:async({message:e})=>n.embeddedWallets.noPromptOnSignature||t.current?await f({message:e}):new Promise(async(u,P)=>{t.current=!0,s({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>f({message:e}),onSuccess:S=>u(S),onFailure:P,uiOptions:{}}}),r("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1}),signTypedData:async e=>t.current?await C(e):new Promise(async(u,P)=>{t.current=!0,s({connectWallet:{onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>C(e),onSuccess:S=>u(S),onFailure:P,uiOptions:{}}}),r("EMBEDDED_WALLET_CONNECTING_SCREEN")}).finally(()=>{t.current=!1})}}}},b={address:_accountabstraction.entryPoint06Address,version:"0.6"},M={address:_accountabstraction.entryPoint07Address,version:"0.7"},J=({owner:o,smartWalletType:t,chain:r})=>{let n=_viem.createPublicClient.call(void 0, {chain:r,transport:_viem.http.call(void 0, )});switch(t){case"safe":return _accounts.toSafeSmartAccount.call(void 0, {client:n,entryPoint:M,owners:[o],version:"1.4.1"});case"kernel":return _accounts.toEcdsaKernelSmartAccount.call(void 0, {client:n,version:"0.3.1",entryPoint:M,owners:[o]});case"biconomy":return _accounts.toBiconomySmartAccount.call(void 0, {client:n,owners:[o],entryPoint:b});case"light_account":return _accounts.toLightSmartAccount.call(void 0, {client:n,entryPoint:b,owner:o,version:"1.1.0"});default:throw new Error(`Invalid smart account type: ${t}.`)}},X=async({owner:o,smartWalletType:t,chain:r,bundlerUrl:n,paymasterUrl:s})=>{let l=_viem.createPublicClient.call(void 0, {chain:r,transport:_viem.http.call(void 0, )}),c=await J({owner:o,smartWalletType:t,chain:r}),p=!!s?_pimlico.createPimlicoClient.call(void 0, {transport:_viem.http.call(void 0, s),entryPoint:c.entryPoint}):void 0;return _permissionless.createSmartAccountClient.call(void 0, {account:c,chain:r,paymaster:p,bundlerTransport:_viem.http.call(void 0, n),userOperation:{estimateFeesPerGas:async()=>{let y=await l.estimateFeesPerGas();return{...y,maxFeePerGas:y.maxFeePerGas*115n/100n,maxPriorityFeePerGas:y.maxPriorityFeePerGas*115n/100n}}}})};var _jsxruntime = require('react/jsx-runtime');var B=_react.createContext.call(void 0, {client:void 0}),te= exports.SmartWalletsProvider =({children:o})=>{let[t,r]=_react.useState.call(void 0, null),{getSmartWalletClient:n}=R(),{generateSiweMessage:s,linkSmartWallet:l,client:c,noPromptOnSignature:d}=_chunkXKAIXCX7js.ra.call(void 0, ),{defaultChain:p}=_chunkXKAIXCX7js.oa.call(void 0, ),{wallets:y}=_chunkXKAIXCX7js.va.call(void 0, ),{user:m}=_chunkXKAIXCX7js.ta.call(void 0, ),[g,T]=_react.useState.call(void 0, ),f=_chunk3AGMJGHJjs.f.call(void 0, y);return _react.useEffect.call(void 0, ()=>{!t&&c&&(async()=>{try{if(!c){console.warn("No client found");return}let a=await c.getSmartWalletsConfig();r(a)}catch(a){console.warn("Error generating smart wallet config: ",a)}})()},[!!c]),_react.useEffect.call(void 0, ()=>{(async()=>{if(!_optionalChain([t, 'optionalAccess', _2 => _2.enabled])||!m||!f){T(void 0);return}if(g)return;let a=t.configuredNetworks.find(i=>i.chainId===`eip155:${p.id}`);if(!a)throw new (0, _chunkXKAIXCX7js.g)(`The defaultChain ${p.name} (eip155:${p.id}) must be configured in the smart wallet configuration in your dashboard`);if(m.smartWallet)try{let i=await n(f,m.smartWallet.smartWalletType,a);T(i);return}catch(i){console.error("Error loading smart wallet:",i);return}try{let i=await n(f,t.smartWalletType,a),w=await s({address:i.account.address,chainId:a.chainId});d.current=!0;let D=await i.signMessage({message:w});await l({signature:D,message:w,smartWalletType:t.smartWalletType}),T(i)}catch(i){console.error("Error creating smart wallet:",i)}finally{d.current=!1}})()},[!!_optionalChain([t, 'optionalAccess', _3 => _3.enabled]),!!_optionalChain([m, 'optionalAccess', _4 => _4.smartWallet]),!!f]),_jsxruntime.jsx.call(void 0, B.Provider,{value:{client:g},children:o})},ne= exports.useSmartWallets =()=>_react.useContext.call(void 0, B);exports.SmartWalletsProvider = te; exports.useSmartWallets = ne;
package/dist/solana.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { S as SolanaWalletConnector } from './types-cbc2ff3a.js';
2
- export { ay as ConnectedSolanaWallet } from './types-cbc2ff3a.js';
3
- export { U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-56085db4.js';
1
+ import { az as ConnectedSolanaWallet, q as Wallet } from './types-fcce0fc5.js';
2
+ export { S as SolanaAdapterConnector, aA as toSolanaWalletConnectors } from './types-fcce0fc5.js';
3
+ import { Transaction, VersionedTransaction, ParsedTransactionWithMeta } from '@solana/web3.js';
4
4
  import '@metamask/eth-sig-util';
5
5
  import '@ethersproject/providers';
6
6
  import 'eventemitter3';
@@ -11,15 +11,45 @@ import 'react';
11
11
  import 'viem';
12
12
  import 'web3-core';
13
13
 
14
- interface UseSolanaWalletConnectorsProps {
15
- shouldAutoConnect?: boolean;
16
- }
14
+ type SupportedSolanaTransaction = Transaction | VersionedTransaction;
15
+ type SolanaTransactionReceipt = {
16
+ signature: string;
17
+ parsedTransaction: ParsedTransactionWithMeta | null;
18
+ fees: bigint;
19
+ };
20
+
17
21
  /**
18
- * Detects available Solana wallet connectors that support the Wallet Standard.
22
+ * Hook to create and interact with Solana wallets. This currently only supports an embedded Solana wallet and no
23
+ * external wallets.
19
24
  *
20
- * @param shouldAutoConnect boolean Whether to automatically connect to the wallet. This is true by default and will not prompt the user loudly for connection. However, some legacy
21
- * adapters may still auto-connect loudly, so this flag can be used to disable that behavior.
25
+ * @returns wallets {ConnectedSolanaWallet[]} an array of connected Solana wallets
26
+ * @returns createWallet {() => Promise<Wallet>} an method to create an embedded Solana wallet.
22
27
  */
23
- declare function useSolanaWalletConnectors(props?: UseSolanaWalletConnectorsProps): SolanaWalletConnector[];
28
+ interface UseSolanaWalletsInterface {
29
+ /**
30
+ * An array of the connected Solana wallets for the user. Currently, this will only contain the embedded
31
+ * Solana wallet if the user has created one.
32
+ */
33
+ wallets: ConnectedSolanaWallet[];
34
+ /**
35
+ * Method to create an embedded Solana wallet for a user. This method will throw an error if the user already has an
36
+ * embedded Solana or Ethereum wallet. Currently, only embedded Solana wallets with automatic recovery are supported.
37
+ * @returns wallet {Wallet} the Solana linked account for the user.
38
+ */
39
+ createWallet: () => Promise<Wallet>;
40
+ /**
41
+ * Shows the user a Privy modal, from which they can copy their embedded solana wallet's private
42
+ * key for easy export to another wallet client (e.g. Phantom, Backpack). The private key is loaded
43
+ * on an iframe running on a separate domain from your app, meaning your app cannot access it.
44
+ *
45
+ * This method will error if the user is not authenticated or does not have an embedded solana wallet.
46
+ * @param options {@link {address: string}} (optional) wallet address to export the private key for
47
+ * @returns Promise that resolves once the user exits the modal
48
+ */
49
+ exportWallet: (options?: {
50
+ address: string;
51
+ }) => Promise<void>;
52
+ }
53
+ declare const useSolanaWallets: () => UseSolanaWalletsInterface;
24
54
 
25
- export { SolanaWalletConnector as SolanaAdapterConnector, useSolanaWalletConnectors };
55
+ export { ConnectedSolanaWallet, SolanaTransactionReceipt, SupportedSolanaTransaction, UseSolanaWalletsInterface, useSolanaWallets };
package/dist/solana.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunkM7S3ORHSjs = require('./chunk-M7S3ORHS.js');require('./chunk-CMFOSIZZ.js');require('./chunk-BWEW65KO.js');require('./chunk-KD3IIYQS.js');var _walletstandardwalletadapterreact = require('@solana/wallet-standard-wallet-adapter-react');function l(e){return _walletstandardwalletadapterreact.useStandardWalletAdapters.call(void 0, []).map(a=>new (0, _chunkM7S3ORHSjs.e)(a,_optionalChain([e, 'optionalAccess', _ => _.shouldAutoConnect])||!0))}exports.SolanaAdapterConnector = _chunkM7S3ORHSjs.e; exports.useSolanaWalletConnectors = l; exports.useSolanaWallets = _chunkM7S3ORHSjs.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 _chunkQTSNS7VFjs = require('./chunk-QTSNS7VF.js');require('./chunk-LEABMTNM.js');require('./chunk-3AGMJGHJ.js');require('./chunk-XKAIXCX7.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, _chunkQTSNS7VFjs.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, _chunkQTSNS7VFjs.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, _chunkQTSNS7VFjs.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 = _chunkQTSNS7VFjs.e; exports.toSolanaWalletConnectors = u; exports.useSolanaWallets = _chunkQTSNS7VFjs.x;
@@ -635,6 +635,37 @@ declare class SolanaWalletConnector extends WalletConnector {
635
635
  unsubscribeListeners(): void;
636
636
  }
637
637
 
638
+ interface SolanaWalletConnectorsOptions {
639
+ shouldAutoConnect?: boolean;
640
+ }
641
+ /**
642
+ * Plugin object to add solana support to the Privy SDK
643
+ */
644
+ type SolanaWalletConnectorsConfig = {
645
+ /**
646
+ * Creates listeners for when solana wallets are registered or unregistered
647
+ */
648
+ onMount: () => void;
649
+ /**
650
+ * Remove listener registered by `onMount`
651
+ */
652
+ onUnmount: () => void;
653
+ /**
654
+ * Get all Wallets that have been registered, converted to `SolanaWalletConnectors`.
655
+ */
656
+ get: () => SolanaWalletConnector[];
657
+ };
658
+ /**
659
+ * Wraps the wallet detection logic found in `@solana/wallet-standard-wallet-adapter-base`
660
+ * and `@wallet-standard-app`. Returns a `SolanaWalletConnectors` object to be used with the `PrivyProvider`.
661
+ *
662
+ * @param {SolanaWalletConnectorsOptions} args Configuration object
663
+ * @param {boolean} args.shouldAutoConnect Whether to automatically connect to the wallet.
664
+ * Defaults to `true` and should not prompt the user loudly for connection. However, some legacy
665
+ * adapters may still auto-connect loudly, so this flag can be used to disable that behavior.
666
+ */
667
+ declare const toSolanaWalletConnectors: (args?: SolanaWalletConnectorsOptions) => SolanaWalletConnectorsConfig;
668
+
638
669
  interface SolanaProvider {
639
670
  request: (request: {
640
671
  method: string;
@@ -703,7 +734,7 @@ type CoinbaseWalletClientType = (typeof COINBASE_WALLET_CLIENT_TYPES)[number];
703
734
  type WalletConnectWalletClientType = (typeof WALLET_CONNECT_WALLET_CLIENT_TYPES)[number];
704
735
  declare const UNKNOWN_WALLET_CLIENT_TYPES: readonly ["unknown"];
705
736
  type UnknownWalletClientType = (typeof UNKNOWN_WALLET_CLIENT_TYPES)[number];
706
- declare const SOLANA_WALLET_CLIENT_TYPES: readonly ["phantom", "solflare"];
737
+ declare const SOLANA_WALLET_CLIENT_TYPES: readonly ["phantom", "solflare", "glow"];
707
738
  type SolanaWalletClientType = (typeof SOLANA_WALLET_CLIENT_TYPES)[number];
708
739
  type WalletClientType = InjectedWalletClientType | CoinbaseWalletClientType | WalletConnectWalletClientType | EmbeddedWalletClientType | UnknownWalletClientType | SolanaWalletClientType;
709
740
  declare const SUPPORTED_CONNECTOR_TYPES: string[];
@@ -1402,7 +1433,7 @@ type ExternalWalletsConfig = {
1402
1433
  enabled: boolean;
1403
1434
  };
1404
1435
  solana?: {
1405
- connectors?: SolanaWalletConnector[];
1436
+ connectors?: SolanaWalletConnectorsConfig;
1406
1437
  };
1407
1438
  };
1408
1439
  interface PrivyClientConfig {
@@ -2145,4 +2176,4 @@ type EthereumRpcResponseType = eth_signTransactionResponse | eth_populateTransac
2145
2176
  type SolanaRpcRequestType = solana_signMessage;
2146
2177
  type SolanaRpcResponseType = solana_signMessageResponse;
2147
2178
 
2148
- export { TransactionLog as $, LinkedAccountWithMetadata as A, BaseConnectedEthereumWallet as B, Chain as C, UserRecoveryMethod as D, Embedded1193Provider as E, FundWalletConfig as F, FundingMethod as G, LoginWithCode as H, OtpFlowState as I, UnsignedTransactionRequestWithChainId as J, CustomAuthFlowState as K, LoginModalOptions as L, MoonpaySignRequest as M, AsExternalProvider as N, OAuthTokens as O, PrivyProxyProvider as P, TypedMessage as Q, RpcConfig as R, SolanaWalletConnector as S, TransactionReceipt as T, User as U, MessageTypes as V, WalletConnector as W, MoonpayConfig as X, MoonpayCurrencyCode as Y, MoonpayPaymentMethod as Z, Quantity as _, WalletClientType as a, NonEmptyArray as a0, EmailWithMetadata as a1, PhoneWithMetadata as a2, WalletWithMetadata as a3, Google as a4, Twitter as a5, Discord as a6, Github as a7, LinkedIn as a8, Apple as a9, Tiktok as aa, Telegram as ab, CrossAppAccount as ac, GoogleOAuthWithMetadata as ad, TwitterOAuthWithMetadata as ae, DiscordOAuthWithMetadata as af, GithubOAuthWithMetadata as ag, TiktokOAuthWithMetadata as ah, LinkedInOAuthWithMetadata as ai, AppleOAuthWithMetadata as aj, FarcasterWithMetadata as ak, TelegramWithMetadata as al, CrossAppAccountWithMetadata as am, PasskeyWithMetadata as an, Email as ao, Phone as ap, TransactionUIOptions as aq, ContractUIOptions as ar, NativeFundingConfig as as, MoonpayFundingConfig as at, PriceDisplayOptions as au, Farcaster as av, Passkey as aw, LoginMethodOrderOption as ax, ConnectedSolanaWallet as ay, RuntimeLoginOverridableOptions as az, ConnectedWalletMetadata as b, ConnectorType as c, WalletListEntry as d, ExternalWalletsConfig as e, BaseConnectedWallet as f, EIP1193Provider as g, OAuthProviderType as h, MoonpaySignResponse as i, SmartWalletConfig as j, PrivyServerConfig as k, PrivyFarcasterSignerInitResponse as l, PrivyClientConfig as m, ConnectWalletModalOptions as n, CreateWalletOptions as o, Wallet as p, SetWalletRecoveryOptions as q, SignMessageModalUIOptions as r, SignTypedDataParams as s, MfaMethod as t, UnsignedTransactionRequest as u, SendTransactionModalUIOptions as v, ConnectedWallet as w, PrivyIframeErrorTypesType as x, PrivyErrorCode as y, LoginMethod as z };
2179
+ export { Quantity as $, LoginMethod as A, BaseConnectedEthereumWallet as B, Chain as C, LinkedAccountWithMetadata as D, Embedded1193Provider as E, FundWalletConfig as F, UserRecoveryMethod as G, FundingMethod as H, LoginWithCode as I, OtpFlowState as J, UnsignedTransactionRequestWithChainId as K, LoginModalOptions as L, MoonpaySignRequest as M, CustomAuthFlowState as N, OAuthTokens as O, PrivyProxyProvider as P, AsExternalProvider as Q, RuntimeLoginOverridableOptions as R, SolanaWalletConnector as S, TransactionReceipt as T, User as U, TypedMessage as V, WalletConnector as W, MessageTypes as X, MoonpayConfig as Y, MoonpayCurrencyCode as Z, MoonpayPaymentMethod as _, RpcConfig as a, TransactionLog as a0, NonEmptyArray as a1, EmailWithMetadata as a2, PhoneWithMetadata as a3, WalletWithMetadata as a4, Google as a5, Twitter as a6, Discord as a7, Github as a8, LinkedIn as a9, toSolanaWalletConnectors as aA, Apple as aa, Tiktok as ab, Telegram as ac, CrossAppAccount as ad, GoogleOAuthWithMetadata as ae, TwitterOAuthWithMetadata as af, DiscordOAuthWithMetadata as ag, GithubOAuthWithMetadata as ah, TiktokOAuthWithMetadata as ai, LinkedInOAuthWithMetadata as aj, AppleOAuthWithMetadata as ak, FarcasterWithMetadata as al, TelegramWithMetadata as am, CrossAppAccountWithMetadata as an, PasskeyWithMetadata as ao, Email as ap, Phone as aq, TransactionUIOptions as ar, ContractUIOptions as as, NativeFundingConfig as at, MoonpayFundingConfig as au, PriceDisplayOptions as av, Farcaster as aw, Passkey as ax, LoginMethodOrderOption as ay, ConnectedSolanaWallet 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, CreateWalletOptions as p, Wallet as q, SetWalletRecoveryOptions as r, SignMessageModalUIOptions as s, SignTypedDataParams as t, MfaMethod as u, UnsignedTransactionRequest as v, SendTransactionModalUIOptions as w, ConnectedWallet as x, PrivyIframeErrorTypesType as y, PrivyErrorCode 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 { az as RuntimeLoginOverridableOptions } from './types-cbc2ff3a.js';
2
+ import { R as RuntimeLoginOverridableOptions } from './types-fcce0fc5.js';
3
3
  import '@metamask/eth-sig-util';
4
4
  import '@ethersproject/providers';
5
5
  import 'eventemitter3';