@privy-io/react-auth 2.6.1 → 2.6.3-beta-20250317161825

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/cjs/abstract-smart-wallets.js +1 -1
  2. package/dist/cjs/farcaster.js +1 -1
  3. package/dist/cjs/index.js +1 -22
  4. package/dist/cjs/internal-context-DnNBb-wU.js +1 -0
  5. package/dist/cjs/privy-provider-BIdMjwqY.js +27 -0
  6. package/dist/cjs/smart-wallets-CywBn0wn.js +1 -0
  7. package/dist/cjs/smart-wallets.js +1 -1
  8. package/dist/cjs/solana.js +1 -1
  9. package/dist/cjs/ui.js +2 -2
  10. package/dist/cjs/useActiveWallet-BtSE1VCp.js +1 -0
  11. package/dist/cjs/useFundWallet-BpTkTUcM.js +1 -0
  12. package/dist/dts/farcaster.d.mts +1 -1
  13. package/dist/dts/farcaster.d.ts +1 -1
  14. package/dist/dts/index.d.mts +46 -8
  15. package/dist/dts/index.d.ts +46 -8
  16. package/dist/dts/smart-wallets.d.mts +1 -1
  17. package/dist/dts/smart-wallets.d.ts +1 -1
  18. package/dist/dts/solana.d.mts +6 -6
  19. package/dist/dts/solana.d.ts +6 -6
  20. package/dist/dts/{types-cJoXquFV.d.mts → types-CcosPsy6.d.mts} +1 -1
  21. package/dist/dts/{types-cJoXquFV.d.ts → types-CcosPsy6.d.ts} +1 -1
  22. package/dist/dts/ui.d.mts +1 -1
  23. package/dist/dts/ui.d.ts +1 -1
  24. package/dist/dts/{useSolanaWallets-C6q1MrJz.d.mts → useSolanaWallets-BHduxJmW.d.mts} +1 -1
  25. package/dist/dts/{useSolanaWallets-C6q1MrJz.d.ts → useSolanaWallets-BHduxJmW.d.ts} +1 -1
  26. package/dist/esm/abstract-smart-wallets.mjs +1 -1
  27. package/dist/esm/farcaster.mjs +1 -1
  28. package/dist/esm/index.mjs +1 -22
  29. package/dist/esm/internal-context-CoqVC99F.mjs +1 -0
  30. package/dist/esm/privy-provider-Bp97ChwU.mjs +27 -0
  31. package/dist/esm/smart-wallets-PZZ9Ymcr.mjs +1 -0
  32. package/dist/esm/smart-wallets.mjs +1 -1
  33. package/dist/esm/solana.mjs +1 -1
  34. package/dist/esm/ui.mjs +2 -2
  35. package/dist/esm/useActiveWallet-B6BiD25e.mjs +1 -0
  36. package/dist/esm/useFundWallet-D2w0bL1K.mjs +1 -0
  37. package/package.json +4 -4
  38. package/dist/cjs/getPublicClient-hVv5ZSWd.js +0 -1
  39. package/dist/cjs/importWallet-CqIkwxB-.js +0 -1
  40. package/dist/cjs/internal-context-DV3MljLU.js +0 -1
  41. package/dist/cjs/paths-BGBZ-6Nl.js +0 -1
  42. package/dist/cjs/prepareFundingModalData-BCNQSbXb.js +0 -1
  43. package/dist/cjs/smart-wallets-BJE1oUqH.js +0 -1
  44. package/dist/cjs/useActiveWallet-CLPPplpC.js +0 -6
  45. package/dist/cjs/useFundWallet-BLEO3WzQ.js +0 -1
  46. package/dist/cjs/useWallets-Dmyb5a0t.js +0 -1
  47. package/dist/esm/getPublicClient-wHgCncHx.mjs +0 -1
  48. package/dist/esm/importWallet-CJLTGjPg.mjs +0 -1
  49. package/dist/esm/internal-context-mSHyF0Gq.mjs +0 -1
  50. package/dist/esm/paths-Q47X90aK.mjs +0 -1
  51. package/dist/esm/prepareFundingModalData-due26ueW.mjs +0 -1
  52. package/dist/esm/smart-wallets-dP5AzE1-.mjs +0 -1
  53. package/dist/esm/useActiveWallet-C8nSK6cE.mjs +0 -6
  54. package/dist/esm/useFundWallet-DR5oafbj.mjs +0 -1
  55. package/dist/esm/useWallets-DTpjk5Rk.mjs +0 -1
@@ -1 +1 @@
1
- "use strict";var e=require("@abstract-foundation/agw-client"),n=require("viem"),r=require("viem/accounts"),t=require("viem/chains"),a=require("./useWallets-Dmyb5a0t.js"),s=require("./internal-context-DV3MljLU.js"),i=require("./getPublicClient-hVv5ZSWd.js"),o=require("./getEmbeddedConnectedWallet-DTU4T9TJ.js"),c=require("./smart-wallets-BJE1oUqH.js");require("viem/utils"),require("react/jsx-runtime"),require("react"),require("tinycolor2"),require("ofetch"),require("permissionless"),require("permissionless/accounts"),require("permissionless/clients/pimlico"),require("viem/account-abstraction"),require("@privy-io/js-sdk-core"),exports.useAbstractSmartWallets=function(){let{user:l}=a.usePrivyContext(),{hideWalletUIs:d,openPrivyModal:u,chains:E,appId:p,rpcConfig:y}=s.usePrivyInternal(),{wallets:g}=a.useWallets(),{setModalData:m}=a.usePrivyModal(),T=async(a=t.abstractTestnet.id)=>{let s=o.getEmbeddedConnectedWallet(g);if(!s)throw Error("No connected wallet found");let c="string"==typeof a?n.hexToNumber(a):a;if(![t.abstractTestnet.id,2741].includes(c))throw Error("Error, only Abstract chains are supported");let l=E.find((e=>e.id===c));if(!l)throw Error("Chain not configured");await s.switchChain(l.id);let d=await s.getEthereumProvider(),u=n.createWalletClient({account:s.address,transport:n.custom(d)}),m=r.toAccount({address:s.address,signMessage:u.signMessage,signTransaction:u.signTransaction,signTypedData:u.signTypedData});return await e.createAbstractClient({chain:l,transport:n.http(i.getJsonRpcEndpointFromChain(l,y,p)),publicTransport:n.http(i.getJsonRpcEndpointFromChain(l,y,p)),signer:m})};return{signMessage:async({message:e},n)=>{let r=await T(n);return new Promise((async(n,t)=>{let{entropyId:s,entropyIdVerifier:i}=a.getEntropyDetailsFromUser(l);d.current=!0,m({connectWallet:{entropyId:s,entropyIdVerifier:i,onCompleteNavigateTo:a.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>r.signMessage({message:e}),onSuccess:e=>n(e),onFailure:t,uiOptions:{isCancellable:!0}}}),u(a.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{d.current=!1}))},signTypedData:async(e,n)=>{let r=await T(n);return new Promise((async(n,t)=>{d.current=!0;let{entropyId:s,entropyIdVerifier:i}=a.getEntropyDetailsFromUser(l);m({connectWallet:{entropyId:s,entropyIdVerifier:i,onCompleteNavigateTo:a.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>r.signTypedData(e),onSuccess:e=>n(e),onFailure:t,uiOptions:{isCancellable:!0}}}),u(a.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{d.current=!1}))},sendTransaction:async e=>{let n=await T(e.chainId),r=[],t="calls"in e&&void 0!==e.calls;return r=t?[...e.calls]:[e],new Promise((async(s,i)=>{d.current=!0;let{entropyId:o,entropyIdVerifier:E}=a.getEntropyDetailsFromUser(l);m({connectWallet:{entropyId:o,entropyIdVerifier:E,onCompleteNavigateTo:a.ModalScreen.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN,onFailure:()=>{}},sendTransaction:{transactionRequests:c.callsToTransactionRequests({calls:r,chain:n.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:o,entropyIdVerifier:E,transactingWallet:{address:n.account.address,walletIndex:null},signOnly:!1,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:()=>t?n.sendTransactionBatch(e):n.sendTransaction(e),onSuccess:e=>s(e.hash),onFailure:i,uiOptions:{isCancellable:!0}}}),u(a.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{d.current=!1}))},signTransaction:async e=>{let n=await T(e.chainId),r=[],t="calls"in e&&void 0!==e.calls;return r=t?[...e.calls]:[e],new Promise((async(s,i)=>{d.current=!0;let{entropyId:o,entropyIdVerifier:E}=a.getEntropyDetailsFromUser(l);m({connectWallet:{entropyId:o,entropyIdVerifier:E,onCompleteNavigateTo:a.ModalScreen.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN,onFailure:()=>{}},sendTransaction:{transactionRequests:c.callsToTransactionRequests({calls:r,chain:n.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:o,entropyIdVerifier:E,transactingWallet:{address:n.account.address,walletIndex:null},signOnly:!0,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:()=>{if(!t)return n.signTransaction(e);throw Error("Batch transactions not supported for signing")},onSuccess:e=>s(e.hash),onFailure:i,uiOptions:{isCancellable:!0}}}),u(a.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{d.current=!1}))}}};
1
+ "use strict";var e=require("@abstract-foundation/agw-client"),r=require("viem"),n=require("viem/accounts"),o=require("viem/chains"),i=require("./privy-provider-BIdMjwqY.js"),t=require("./internal-context-DnNBb-wU.js"),c=require("./getEmbeddedConnectedWallet-DTU4T9TJ.js"),a=require("./smart-wallets-CywBn0wn.js");require("react/jsx-runtime"),require("mipd"),require("react"),require("react-device-detect"),require("viem/utils"),require("jose"),require("uuid"),require("eventemitter3"),require("@coinbase/wallet-sdk"),require("@privy-io/js-sdk-core"),require("@marsidev/react-turnstile"),require("styled-components"),require("tinycolor2"),require("@heroicons/react/24/outline/ArrowLeftIcon"),require("@heroicons/react/24/outline/ArrowRightIcon"),require("@heroicons/react/24/outline/QuestionMarkCircleIcon"),require("@heroicons/react/24/outline/XMarkIcon"),require("@heroicons/react/24/outline/CheckIcon"),require("@heroicons/react/24/outline/Square2StackIcon"),require("@heroicons/react/24/outline/WalletIcon"),require("zustand"),require("@walletconnect/ethereum-provider"),require("@heroicons/react/24/outline/UserCircleIcon"),require("@heroicons/react/24/outline/EnvelopeIcon"),require("@heroicons/react/20/solid/CheckIcon"),require("@heroicons/react/24/outline/PhoneIcon"),require("@heroicons/react/24/outline/ExclamationTriangleIcon"),require("@heroicons/react/24/outline/ExclamationCircleIcon"),require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon"),require("@heroicons/react/24/solid/DocumentCheckIcon"),require("@heroicons/react/24/solid/XCircleIcon"),require("fast-password-entropy"),require("secure-password-utilities"),require("secure-password-utilities/wordlists"),require("@heroicons/react/24/outline/LockClosedIcon"),require("@heroicons/react/24/outline/PencilSquareIcon"),require("@heroicons/react/24/solid/CheckCircleIcon"),require("@heroicons/react/24/outline/ArrowPathIcon"),require("@heroicons/react/24/outline/EyeIcon"),require("@heroicons/react/24/outline/EyeSlashIcon"),require("@heroicons/react/24/outline/KeyIcon"),require("@heroicons/react/24/outline/ArrowDownTrayIcon"),require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon"),require("@heroicons/react/24/outline/DocumentDuplicateIcon"),require("@heroicons/react/24/solid/LockClosedIcon"),require("@heroicons/react/24/outline/ShieldCheckIcon"),require("qrcode"),require("@heroicons/react/24/outline/FingerPrintIcon"),require("@heroicons/react/24/outline/ChevronRightIcon"),require("@heroicons/react/24/outline/DevicePhoneMobileIcon"),require("@heroicons/react/24/outline/ChevronDownIcon"),require("@heroicons/react/24/outline/CalendarIcon"),require("@headlessui/react"),require("@heroicons/react/24/outline/CheckCircleIcon"),require("@heroicons/react/24/outline/InformationCircleIcon"),require("@heroicons/react/24/outline/CreditCardIcon"),require("@heroicons/react/24/outline/QrCodeIcon"),require("@heroicons/react/24/solid/ArrowsRightLeftIcon"),require("@heroicons/react/24/outline/GlobeAltIcon"),require("ofetch"),require("@heroicons/react/24/outline"),require("@heroicons/react/24/outline/ClipboardDocumentIcon"),require("@heroicons/react/24/outline/CloudArrowUpIcon"),require("@heroicons/react/24/outline/NoSymbolIcon"),require("@heroicons/react/24/outline/ClockIcon"),require("@heroicons/react/24/outline/TrashIcon"),require("@heroicons/react/24/solid/CheckBadgeIcon"),require("@heroicons/react/24/solid/IdentificationIcon"),require("@heroicons/react/24/outline/MinusCircleIcon"),require("@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon"),require("@heroicons/react/24/solid/ShieldCheckIcon"),require("js-cookie"),require("permissionless"),require("permissionless/accounts"),require("permissionless/clients/pimlico"),require("viem/account-abstraction"),exports.useAbstractSmartWallets=function(){let{user:s}=i.usePrivyContext(),{hideWalletUIs:l,openPrivyModal:u,chains:d,appId:h,rpcConfig:q}=t.usePrivyInternal(),{wallets:p}=i.useWallets(),{setModalData:I}=i.usePrivyModal(),y=i.getPrivyEthereumWallet(s),g=async(t=o.abstractTestnet.id)=>{let a=c.getEmbeddedConnectedWallet(p);if(!a)throw Error("No connected wallet found");let s="string"==typeof t?r.hexToNumber(t):t;if(![o.abstractTestnet.id,2741].includes(s))throw Error("Error, only Abstract chains are supported");let l=d.find((e=>e.id===s));if(!l)throw Error("Chain not configured");await a.switchChain(l.id);let u=await a.getEthereumProvider(),I=r.createWalletClient({account:a.address,transport:r.custom(u)}),y=n.toAccount({address:a.address,signMessage:I.signMessage,signTransaction:I.signTransaction,signTypedData:I.signTypedData});return await e.createAbstractClient({chain:l,transport:r.http(i.getJsonRpcEndpointFromChain(l,q,h)),publicTransport:r.http(i.getJsonRpcEndpointFromChain(l,q,h)),signer:y})};return{signMessage:async({message:e},r)=>{let n=await g(r);return new Promise((async(r,o)=>{let{entropyId:t,entropyIdVerifier:c}=i.getEntropyDetailsForUser(s);l.current=!0,I({connectWallet:{recoveryMethod:y.recoveryMethod,connectingWalletAddress:y.address,entropyId:t,entropyIdVerifier:c,onCompleteNavigateTo:i.SignRequestScreen,onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>n.signMessage({message:e}),onSuccess:e=>r(e),onFailure:o,uiOptions:{isCancellable:!0}}}),u(i.EmbeddedWalletConnectingScreen)})).finally((()=>{l.current=!1}))},signTypedData:async(e,r)=>{let n=await g(r);return new Promise((async(r,o)=>{l.current=!0;let{entropyId:t,entropyIdVerifier:c}=i.getEntropyDetailsForUser(s);I({connectWallet:{recoveryMethod:y.recoveryMethod,connectingWalletAddress:y.address,entropyId:t,entropyIdVerifier:c,onCompleteNavigateTo:i.SignRequestScreen,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>n.signTypedData(e),onSuccess:e=>r(e),onFailure:o,uiOptions:{isCancellable:!0}}}),u(i.EmbeddedWalletConnectingScreen)})).finally((()=>{l.current=!1}))},sendTransaction:async e=>{let r=await g(e.chainId),n=[],o="calls"in e&&void 0!==e.calls;return n=o?[...e.calls]:[e],new Promise((async(t,c)=>{l.current=!0;let{entropyId:d,entropyIdVerifier:h}=i.getEntropyDetailsForUser(s);I({connectWallet:{recoveryMethod:y.recoveryMethod,connectingWalletAddress:y.address,entropyId:d,entropyIdVerifier:h,onCompleteNavigateTo:i.SendTransactionScreen,onFailure:()=>{}},sendTransaction:{transactionRequests:a.callsToTransactionRequests({calls:n,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:d,entropyIdVerifier:h,transactingWalletAddress:r.account.address,transactingWalletIndex:void 0,signOnly:!1,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:()=>o?r.sendTransactionBatch(e):r.sendTransaction(e),onSuccess:e=>t(e.hash),onFailure:c,uiOptions:{isCancellable:!0}}}),u(i.EmbeddedWalletConnectingScreen)})).finally((()=>{l.current=!1}))},signTransaction:async e=>{let r=await g(e.chainId),n=[],o="calls"in e&&void 0!==e.calls;return n=o?[...e.calls]:[e],new Promise((async(t,c)=>{l.current=!0;let{entropyId:d,entropyIdVerifier:h}=i.getEntropyDetailsForUser(s);I({connectWallet:{recoveryMethod:y.recoveryMethod,connectingWalletAddress:y.address,entropyId:d,entropyIdVerifier:h,onCompleteNavigateTo:i.SendTransactionScreen,onFailure:()=>{}},sendTransaction:{transactionRequests:a.callsToTransactionRequests({calls:n,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:d,entropyIdVerifier:h,transactingWalletAddress:r.account.address,transactingWalletIndex:void 0,signOnly:!0,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:()=>{if(!o)return r.signTransaction(e);throw Error("Batch transactions not supported for signing")},onSuccess:e=>t(e.hash),onFailure:c,uiOptions:{isCancellable:!0}}}),u(i.EmbeddedWalletConnectingScreen)})).finally((()=>{l.current=!1}))}}};
@@ -1 +1 @@
1
- "use strict";var t=require("react"),e=require("./internal-context-DV3MljLU.js"),r=require("./paths-BGBZ-6Nl.js");require("ofetch");class i{async init(){if(!this.api)throw new e.PrivyClientError("Auth flow has no API instance");let{nonce:t}=await this.api.post(r.initFarcasterV2Path,{});return{nonce:t}}async authenticate(){if(!this.message||!this.signature||!this.fid)throw new e.PrivyClientError("Auth flow has no message, signature, or fid");if(!this.api)throw new e.PrivyClientError("Auth flow has no API instance");try{let t=await this.api.post(r.authenticateFarcasterV2Path,{message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new e.PrivyClientError("No response from authentication");return t}catch(t){throw e.formatApiError(t)}}async link(){throw Error("Not implemented")}setAuthData({message:t,signature:e,fid:r}){this.message=t,this.signature=e,this.fid=r}constructor(){this.meta={}}}exports.useLoginToFrame=()=>{let{client:r,setAuthenticated:a,setUser:s}=e.usePrivyInternal();return{initLoginToFrame:t.useCallback((async()=>{let t=new i;if(!r)throw new e.PrivyClientError("Must initialize Privy client first.");return r.startAuthFlow(t),await t.init()}),[r]),loginToFrame:t.useCallback((async({message:t,signature:n})=>{if(!r)throw new e.PrivyClientError("Must initialize Privy client first.");if(!(r.authFlow instanceof i))throw new e.PrivyClientError("Must initialize Farcaster frame flow first.");let o=(t=>{let e=t.match(/farcaster:\/\/fid\/(\d+)/);return e&&e[1]?parseInt(e[1],10):null})(t);if(!o)throw new e.PrivyClientError("Invalid message format; could not parse Farcaster ID.");r.authFlow.setAuthData({message:t,signature:n,fid:o});let{user:h}=await r.authenticate();return h&&(s(h),a(!0)),h}),[r,s,a])}};
1
+ "use strict";var t=require("react"),e=require("./internal-context-DnNBb-wU.js");require("ofetch");class r{async init(){if(!this.api)throw new e.PrivyClientError("Auth flow has no API instance");let{nonce:t}=await this.api.post(e.initFarcasterV2Path,{});return{nonce:t}}async authenticate(){if(!this.message||!this.signature||!this.fid)throw new e.PrivyClientError("Auth flow has no message, signature, or fid");if(!this.api)throw new e.PrivyClientError("Auth flow has no API instance");try{let t=await this.api.post(e.authenticateFarcasterV2Path,{message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new e.PrivyClientError("No response from authentication");return t}catch(t){throw e.formatApiError(t)}}async link(){throw Error("Not implemented")}setAuthData({message:t,signature:e,fid:r}){this.message=t,this.signature=e,this.fid=r}constructor(){this.meta={}}}exports.useLoginToFrame=()=>{let{client:i,setAuthenticated:a,setUser:s}=e.usePrivyInternal();return{initLoginToFrame:t.useCallback((async()=>{let t=new r;if(!i)throw new e.PrivyClientError("Must initialize Privy client first.");return i.startAuthFlow(t),await t.init()}),[i]),loginToFrame:t.useCallback((async({message:t,signature:n})=>{if(!i)throw new e.PrivyClientError("Must initialize Privy client first.");if(!(i.authFlow instanceof r))throw new e.PrivyClientError("Must initialize Farcaster frame flow first.");let o=(t=>{let e=t.match(/farcaster:\/\/fid\/(\d+)/);return e&&e[1]?parseInt(e[1],10):null})(t);if(!o)throw new e.PrivyClientError("Invalid message format; could not parse Farcaster ID.");i.authFlow.setAuthData({message:t,signature:n,fid:o});let{user:h}=await i.authenticate();return h&&(s(h),a(!0)),h}),[i,s,a])}};