@privy-io/expo 0.63.13 → 0.64.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJJRTTYNPjs = require('./chunk-JJRTTYNP.js');var _chunkQTVIWU3Njs = require('./chunk-QTVIWU3N.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var f=()=>{let e=_chunkJJRTTYNPjs.l.call(void 0, );return _react.useMemo.call(void 0, ()=>({createWallet(n){return _chunkQTVIWU3Njs.d.call(void 0, this,null,function*(){let s=yield _jssdkcore.create.call(void 0, e,{request:{chain_type:n.chainType}}),{user:o}=yield e.user.get();return{user:o,wallet:s}})}}),[e])};var C=()=>{let e=_chunkJJRTTYNPjs.l.call(void 0, );return _react.useMemo.call(void 0, ()=>({signRawHash(k){return _chunkQTVIWU3Njs.d.call(void 0, this,arguments,function*({address:n,chainType:s,hash:o}){let l=_chunkJJRTTYNPjs.b.call(void 0, );if(!l)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_before_logged_in",error:"User must be authenticated before signing a raw hash"});let p=l.linked_accounts.filter(_jssdkcore.isEmbeddedWalletAccount).filter(_jssdkcore.isUnifiedWallet).filter(t=>t.chain_type===s).find(t=>t.address===n);if(!p)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"No embedded wallet found for the given address and chain type"});let r=yield _jssdkcore.rawSign.call(void 0, e,(...t)=>e.embeddedWallet.signWithUserSigner(...t),{wallet_id:p.id,params:{hash:o}});if(r.data&&"signature"in r.data&&r.data.encoding==="hex")return{signature:r.data.signature};throw new Error("Failed to sign")})}}),[e])};exports.useCreateWallet = f; exports.useSignRawHash = C;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHXIVVEZ6js = require('./chunk-HXIVVEZ6.js');var _chunkQTVIWU3Njs = require('./chunk-QTVIWU3N.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var f=()=>{let e=_chunkHXIVVEZ6js.l.call(void 0, );return _react.useMemo.call(void 0, ()=>({createWallet(n){return _chunkQTVIWU3Njs.d.call(void 0, this,null,function*(){let s=yield _jssdkcore.create.call(void 0, e,{request:{chain_type:n.chainType}}),{user:o}=yield e.user.get();return{user:o,wallet:s}})}}),[e])};var C=()=>{let e=_chunkHXIVVEZ6js.l.call(void 0, );return _react.useMemo.call(void 0, ()=>({signRawHash(k){return _chunkQTVIWU3Njs.d.call(void 0, this,arguments,function*({address:n,chainType:s,hash:o}){let l=_chunkHXIVVEZ6js.b.call(void 0, );if(!l)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_before_logged_in",error:"User must be authenticated before signing a raw hash"});let p=l.linked_accounts.filter(_jssdkcore.isEmbeddedWalletAccount).filter(_jssdkcore.isUnifiedWallet).filter(t=>t.chain_type===s).find(t=>t.address===n);if(!p)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"No embedded wallet found for the given address and chain type"});let r=yield _jssdkcore.rawSign.call(void 0, e,(...t)=>e.embeddedWallet.signWithUserSigner(...t),{wallet_id:p.id,params:{hash:o}});if(r.data&&"signature"in r.data&&r.data.encoding==="hex")return{signature:r.data.signature};throw new Error("Failed to sign")})}}),[e])};exports.useCreateWallet = f; exports.useSignRawHash = C;
package/dist/index.d.ts CHANGED
@@ -1239,6 +1239,23 @@ interface UsePrivy {
1239
1239
  */
1240
1240
  declare const usePrivy: () => UsePrivy;
1241
1241
 
1242
+ /**
1243
+ * Hook for accepting the app's terms and conditions and privacy policy on
1244
+ * behalf of the current user.
1245
+ *
1246
+ * Use this in whitelabel integrations where the user has accepted your terms
1247
+ * outside of the Privy UI (e.g. a custom checkbox during signup).
1248
+ *
1249
+ * @example
1250
+ * const {acceptTerms} = useAcceptTerms();
1251
+ * const {user} = await acceptTerms(); // marks user.has_accepted_terms as true
1252
+ */
1253
+ declare function useAcceptTerms(): {
1254
+ acceptTerms: () => Promise<{
1255
+ user: User;
1256
+ }>;
1257
+ };
1258
+
1242
1259
  interface UseAuthorizationSignatureInterface {
1243
1260
  /**
1244
1261
  * Generate an authorization signature for an API request with the user's authorization key.
@@ -1641,4 +1658,4 @@ declare const useMigrateWallets: () => {
1641
1658
  }>;
1642
1659
  };
1643
1660
 
1644
- export { AddSessionSignersInput, AddSessionSignersOutput, AddSignersInput, AddSignersOutput, AuthBoundary, ConnectedEthereumWallet, CustomAuthProviderConfig, EmbeddedSolanaWalletState, EmbeddedWalletState, FarcasterV2State, LinkWithCrossAppInput, LinkWithCrossAppOutput, LinkWithEmailHookResult, LinkWithEmailOptions, LinkWithOAuthInput, LinkWithSMSHookResult, LinkWithSMSOptions, LoginWithCrossAppInput, LoginWithCrossAppOutput, LoginWithEmailHookResult, LoginWithEmailOptions, LoginWithFarcasterV2Input, LoginWithOAuthInput, LoginWithSMSHookResult, LoginWithSMSOptions, OAuthFlowHookResult, OAuthFlowState, OAuthTokens, OtpFlowState, PrivyAuthGuardProps, PrivyConfig, PrivyContext, PrivyOptions, PrivyProvider, PrivyProviderProps, RecoveryFlowState, RemoveSessionSignersInput, RemoveSessionSignersOutput, RemoveSignersInput, RemoveSignersOutput, SecureStorageAdapter, SendEmailCodeInput, SendPhoneCodeInput, SendTransactionWithCrossAppInput, SendTransactionWithCrossAppOutput, SignMessageWithCrossAppInput, SignMessageWithCrossAppOutput, SignTypedDataWithCrossAppInput, SignTypedDataWithCrossAppOutput, UnlinkOAuthInput, UpdateEmailInput, UpdatePhoneInput, UseCreateGuestAccount, UseCreateGuestAccountOptions, UseHeadlessDelegatedActionsInterface, UseLinkWithCrossAppInterface, UseLinkWithFarcaster, UseLinkWithFarcasterOptions, UseLinkWithOAuth, UseLinkWithSiwe, UseLinkWithSiweOptions, UseLinkWithSiwsInterface, UseLoginWithCrossAppInterface, UseLoginWithFarcaster, UseLoginWithFarcasterOptions, UseLoginWithFarcasterV2, UseLoginWithOAuth, UseLoginWithSiwe, UseLoginWithSiweOptions, UseLoginWithSiwsInterface, UseMfa, UseMfaEnrollment, UseOAuthTokens, UseOAuthTokensOptions, UseOnEmbeddedWalletStateChange, UseRecoverEmbeddedWallet, UseSendTransactionWithCrossAppInterface, UseSessionSignersInterface, UseSetEmbeddedWalletRecovery, UseSignMessageWithCrossAppInterface, UseSignTypedDataWithCrossAppInterface, UseSignersInterface, UseUnlinkEmailOptions, UseUnlinkFarcaster, UseUnlinkFarcasterOptions, UseUnlinkOAuth, UseUnlinkWallet, UseUnlinkWalletOptions, UseUpdateEmailInterface, UseUpdatePhoneInterface, createPrivyClient, getAccessToken, useAuthorizationSignature, useCreateGuestAccount, useEmbeddedBitcoinWallet, useEmbeddedEthereumWallet, useEmbeddedSolanaWallet, useEmbeddedWallet, useEmbeddedWalletStateChange, useHeadlessDelegatedActions, useIdentityToken, useLinkEmail, useLinkSMS, useLinkWithCrossApp, useLinkWithFarcaster, useLinkWithOAuth, useLinkWithSiwe, useLinkWithSiws, useLoginWithCrossApp, useLoginWithEmail, useLoginWithFarcaster, useLoginWithFarcasterV2, useLoginWithOAuth, useLoginWithSMS, useLoginWithSiwe, useLoginWithSiws, useMfa, useMfaEnrollment, useMigrateWallets, useOAuthFlow, useOAuthTokens, useOnNeedsRecovery, usePrivy, usePrivyClient, useRecoverEmbeddedWallet, useRegisterMfaListener, useSendTransactionWithCrossApp, useSessionSigners, useSetEmbeddedWalletRecovery, useSignMessageWithCrossApp, useSignTypedDataWithCrossApp, useSigners, useUnlinkEmail, useUnlinkFarcaster, useUnlinkOAuth, useUnlinkWallet, useUpdateEmail, useUpdatePhone };
1661
+ export { AddSessionSignersInput, AddSessionSignersOutput, AddSignersInput, AddSignersOutput, AuthBoundary, ConnectedEthereumWallet, CustomAuthProviderConfig, EmbeddedSolanaWalletState, EmbeddedWalletState, FarcasterV2State, LinkWithCrossAppInput, LinkWithCrossAppOutput, LinkWithEmailHookResult, LinkWithEmailOptions, LinkWithOAuthInput, LinkWithSMSHookResult, LinkWithSMSOptions, LoginWithCrossAppInput, LoginWithCrossAppOutput, LoginWithEmailHookResult, LoginWithEmailOptions, LoginWithFarcasterV2Input, LoginWithOAuthInput, LoginWithSMSHookResult, LoginWithSMSOptions, OAuthFlowHookResult, OAuthFlowState, OAuthTokens, OtpFlowState, PrivyAuthGuardProps, PrivyConfig, PrivyContext, PrivyOptions, PrivyProvider, PrivyProviderProps, RecoveryFlowState, RemoveSessionSignersInput, RemoveSessionSignersOutput, RemoveSignersInput, RemoveSignersOutput, SecureStorageAdapter, SendEmailCodeInput, SendPhoneCodeInput, SendTransactionWithCrossAppInput, SendTransactionWithCrossAppOutput, SignMessageWithCrossAppInput, SignMessageWithCrossAppOutput, SignTypedDataWithCrossAppInput, SignTypedDataWithCrossAppOutput, UnlinkOAuthInput, UpdateEmailInput, UpdatePhoneInput, UseCreateGuestAccount, UseCreateGuestAccountOptions, UseHeadlessDelegatedActionsInterface, UseLinkWithCrossAppInterface, UseLinkWithFarcaster, UseLinkWithFarcasterOptions, UseLinkWithOAuth, UseLinkWithSiwe, UseLinkWithSiweOptions, UseLinkWithSiwsInterface, UseLoginWithCrossAppInterface, UseLoginWithFarcaster, UseLoginWithFarcasterOptions, UseLoginWithFarcasterV2, UseLoginWithOAuth, UseLoginWithSiwe, UseLoginWithSiweOptions, UseLoginWithSiwsInterface, UseMfa, UseMfaEnrollment, UseOAuthTokens, UseOAuthTokensOptions, UseOnEmbeddedWalletStateChange, UseRecoverEmbeddedWallet, UseSendTransactionWithCrossAppInterface, UseSessionSignersInterface, UseSetEmbeddedWalletRecovery, UseSignMessageWithCrossAppInterface, UseSignTypedDataWithCrossAppInterface, UseSignersInterface, UseUnlinkEmailOptions, UseUnlinkFarcaster, UseUnlinkFarcasterOptions, UseUnlinkOAuth, UseUnlinkWallet, UseUnlinkWalletOptions, UseUpdateEmailInterface, UseUpdatePhoneInterface, createPrivyClient, getAccessToken, useAcceptTerms, useAuthorizationSignature, useCreateGuestAccount, useEmbeddedBitcoinWallet, useEmbeddedEthereumWallet, useEmbeddedSolanaWallet, useEmbeddedWallet, useEmbeddedWalletStateChange, useHeadlessDelegatedActions, useIdentityToken, useLinkEmail, useLinkSMS, useLinkWithCrossApp, useLinkWithFarcaster, useLinkWithOAuth, useLinkWithSiwe, useLinkWithSiws, useLoginWithCrossApp, useLoginWithEmail, useLoginWithFarcaster, useLoginWithFarcasterV2, useLoginWithOAuth, useLoginWithSMS, useLoginWithSiwe, useLoginWithSiws, useMfa, useMfaEnrollment, useMigrateWallets, useOAuthFlow, useOAuthTokens, useOnNeedsRecovery, usePrivy, usePrivyClient, useRecoverEmbeddedWallet, useRegisterMfaListener, useSendTransactionWithCrossApp, useSessionSigners, useSetEmbeddedWalletRecovery, useSignMessageWithCrossApp, useSignTypedDataWithCrossApp, useSigners, useUnlinkEmail, useUnlinkFarcaster, useUnlinkOAuth, useUnlinkWallet, useUpdateEmail, useUpdatePhone };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var _chunkTHGXZQVXjs = require('./chunk-THGXZQVX.js');var _chunkJJRTTYNPjs = require('./chunk-JJRTTYNP.js');var _chunkQTVIWU3Njs = require('./chunk-QTVIWU3N.js');var _jssdkcore = require('@privy-io/js-sdk-core'); _createStarExport(_jssdkcore);var _react = require('react'); var _react2 = _interopRequireDefault(_react);var St=({loading:t,error:e,unauthenticated:o,children:i})=>{let{isReady:u,error:p}=_chunkJJRTTYNPjs.X.call(void 0, ),d=_chunkJJRTTYNPjs.e.call(void 0, );if(!u)return _react2.default.createElement(_react2.default.Fragment,null,t);if(p&&e){let n=typeof e=="function"?e(p):e;return _react2.default.createElement(_react2.default.Fragment,null,n)}return d?_react2.default.createElement(_react2.default.Fragment,null,i):_react2.default.createElement(_react2.default.Fragment,null,o)};function T(t){return _chunkTHGXZQVXjs.a.call(void 0, t)}function F(t){let{state:e,start:o}=_chunkTHGXZQVXjs.a.call(void 0, _chunkQTVIWU3Njs.b.call(void 0, _chunkQTVIWU3Njs.a.call(void 0, {},t),{action:"link"}));return{state:e,link:o}}var H=t=>{let{client:e}=_react.useContext.call(void 0, _chunkJJRTTYNPjs._),o=_react.useRef.call(void 0, t);return _react.useEffect.call(void 0, ()=>{o.current=t},[t]),{unlinkOAuth:_react.useCallback.call(void 0, d=>_chunkQTVIWU3Njs.d.call(void 0, void 0,[d],function*({provider:u,subject:p}){var n,a,s,c;try{let{user:h}=yield e.auth.oauth.unlink(u,p);return(a=(n=o.current)==null?void 0:n.onSuccess)==null||a.call(n,h),h}catch(h){let m=_chunkJJRTTYNPjs.g.call(void 0, h);throw(c=(s=o.current)==null?void 0:s.onError)==null||c.call(s,m),m}}),[e.auth.oauth])}};var b=t=>{let{client:e}=_react.useContext.call(void 0, _chunkJJRTTYNPjs._),o=_react.useRef.call(void 0, t.onOAuthTokenGrant);o.current=t.onOAuthTokenGrant,_react.useEffect.call(void 0, ()=>{let{unsubscribe:i}=e.addOAuthTokensListener(u=>{o.current(u)});return i},[e])};exports.AuthBoundary = St; exports.PrivyContext = _chunkJJRTTYNPjs._; exports.PrivyProvider = _chunkJJRTTYNPjs.aa; exports.SecureStorageAdapter = _chunkQTVIWU3Njs.g; exports.createPrivyClient = _chunkJJRTTYNPjs.i; exports.getAccessToken = _chunkJJRTTYNPjs.$; exports.hasError = _chunkQSWCX5XIjs.g; exports.isConnected = _chunkQSWCX5XIjs.a; exports.isConnecting = _chunkQSWCX5XIjs.c; exports.isCreating = _chunkQSWCX5XIjs.f; exports.isDisconnected = _chunkQSWCX5XIjs.d; exports.isNotCreated = _chunkQSWCX5XIjs.e; exports.isReconnecting = _chunkQSWCX5XIjs.b; exports.needsRecovery = _chunkQSWCX5XIjs.h; exports.useAuthorizationSignature = _chunkJJRTTYNPjs.Y; exports.useCreateGuestAccount = _chunkJJRTTYNPjs.N; exports.useEmbeddedBitcoinWallet = _chunkJJRTTYNPjs.W; exports.useEmbeddedEthereumWallet = _chunkJJRTTYNPjs.U; exports.useEmbeddedSolanaWallet = _chunkJJRTTYNPjs.V; exports.useEmbeddedWallet = _chunkJJRTTYNPjs.K; exports.useEmbeddedWalletStateChange = _chunkJJRTTYNPjs.L; exports.useHeadlessDelegatedActions = _chunkJJRTTYNPjs.y; exports.useIdentityToken = _chunkJJRTTYNPjs.M; exports.useLinkEmail = _chunkJJRTTYNPjs.p; exports.useLinkSMS = _chunkJJRTTYNPjs.s; exports.useLinkWithCrossApp = _chunkJJRTTYNPjs.E; exports.useLinkWithFarcaster = _chunkJJRTTYNPjs.u; exports.useLinkWithOAuth = F; exports.useLinkWithSiwe = _chunkJJRTTYNPjs.j; exports.useLinkWithSiws = _chunkJJRTTYNPjs.m; exports.useLoginWithCrossApp = _chunkJJRTTYNPjs.D; exports.useLoginWithEmail = _chunkJJRTTYNPjs.r; exports.useLoginWithFarcaster = _chunkJJRTTYNPjs.w; exports.useLoginWithFarcasterV2 = _chunkJJRTTYNPjs.x; exports.useLoginWithOAuth = _chunkTHGXZQVXjs.b; exports.useLoginWithSMS = _chunkJJRTTYNPjs.t; exports.useLoginWithSiwe = _chunkJJRTTYNPjs.k; exports.useLoginWithSiws = _chunkJJRTTYNPjs.n; exports.useMfa = _chunkJJRTTYNPjs.S; exports.useMfaEnrollment = _chunkJJRTTYNPjs.T; exports.useMigrateWallets = _chunkJJRTTYNPjs.Z; exports.useOAuthFlow = T; exports.useOAuthTokens = b; exports.useOnNeedsRecovery = _chunkJJRTTYNPjs.f; exports.usePrivy = _chunkJJRTTYNPjs.X; exports.usePrivyClient = _chunkJJRTTYNPjs.l; exports.useRecoverEmbeddedWallet = _chunkJJRTTYNPjs.J; exports.useRegisterMfaListener = _chunkJJRTTYNPjs.O; exports.useSendTransactionWithCrossApp = _chunkJJRTTYNPjs.H; exports.useSessionSigners = _chunkJJRTTYNPjs.z; exports.useSetEmbeddedWalletRecovery = _chunkJJRTTYNPjs.I; exports.useSignMessageWithCrossApp = _chunkJJRTTYNPjs.F; exports.useSignTypedDataWithCrossApp = _chunkJJRTTYNPjs.G; exports.useSigners = _chunkJJRTTYNPjs.A; exports.useUnlinkEmail = _chunkJJRTTYNPjs.q; exports.useUnlinkFarcaster = _chunkJJRTTYNPjs.v; exports.useUnlinkOAuth = H; exports.useUnlinkWallet = _chunkJJRTTYNPjs.o; exports.useUpdateEmail = _chunkJJRTTYNPjs.B; exports.useUpdatePhone = _chunkJJRTTYNPjs.C;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var _chunkQCIAFL2Djs = require('./chunk-QCIAFL2D.js');var _chunkHXIVVEZ6js = require('./chunk-HXIVVEZ6.js');var _chunkQTVIWU3Njs = require('./chunk-QTVIWU3N.js');var _jssdkcore = require('@privy-io/js-sdk-core'); _createStarExport(_jssdkcore);var _react = require('react'); var _react2 = _interopRequireDefault(_react);var bt=({loading:t,error:e,unauthenticated:o,children:i})=>{let{isReady:u,error:p}=_chunkHXIVVEZ6js.X.call(void 0, ),d=_chunkHXIVVEZ6js.e.call(void 0, );if(!u)return _react2.default.createElement(_react2.default.Fragment,null,t);if(p&&e){let n=typeof e=="function"?e(p):e;return _react2.default.createElement(_react2.default.Fragment,null,n)}return d?_react2.default.createElement(_react2.default.Fragment,null,i):_react2.default.createElement(_react2.default.Fragment,null,o)};function T(t){return _chunkQCIAFL2Djs.a.call(void 0, t)}function F(t){let{state:e,start:o}=_chunkQCIAFL2Djs.a.call(void 0, _chunkQTVIWU3Njs.b.call(void 0, _chunkQTVIWU3Njs.a.call(void 0, {},t),{action:"link"}));return{state:e,link:o}}var H=t=>{let{client:e}=_react.useContext.call(void 0, _chunkHXIVVEZ6js.$),o=_react.useRef.call(void 0, t);return _react.useEffect.call(void 0, ()=>{o.current=t},[t]),{unlinkOAuth:_react.useCallback.call(void 0, d=>_chunkQTVIWU3Njs.d.call(void 0, void 0,[d],function*({provider:u,subject:p}){var n,a,s,c;try{let{user:h}=yield e.auth.oauth.unlink(u,p);return(a=(n=o.current)==null?void 0:n.onSuccess)==null||a.call(n,h),h}catch(h){let m=_chunkHXIVVEZ6js.g.call(void 0, h);throw(c=(s=o.current)==null?void 0:s.onError)==null||c.call(s,m),m}}),[e.auth.oauth])}};var b=t=>{let{client:e}=_react.useContext.call(void 0, _chunkHXIVVEZ6js.$),o=_react.useRef.call(void 0, t.onOAuthTokenGrant);o.current=t.onOAuthTokenGrant,_react.useEffect.call(void 0, ()=>{let{unsubscribe:i}=e.addOAuthTokensListener(u=>{o.current(u)});return i},[e])};exports.AuthBoundary = bt; exports.PrivyContext = _chunkHXIVVEZ6js.$; exports.PrivyProvider = _chunkHXIVVEZ6js.ba; exports.SecureStorageAdapter = _chunkQTVIWU3Njs.g; exports.createPrivyClient = _chunkHXIVVEZ6js.i; exports.getAccessToken = _chunkHXIVVEZ6js.aa; exports.hasError = _chunkQSWCX5XIjs.g; exports.isConnected = _chunkQSWCX5XIjs.a; exports.isConnecting = _chunkQSWCX5XIjs.c; exports.isCreating = _chunkQSWCX5XIjs.f; exports.isDisconnected = _chunkQSWCX5XIjs.d; exports.isNotCreated = _chunkQSWCX5XIjs.e; exports.isReconnecting = _chunkQSWCX5XIjs.b; exports.needsRecovery = _chunkQSWCX5XIjs.h; exports.useAcceptTerms = _chunkHXIVVEZ6js.Y; exports.useAuthorizationSignature = _chunkHXIVVEZ6js.Z; exports.useCreateGuestAccount = _chunkHXIVVEZ6js.N; exports.useEmbeddedBitcoinWallet = _chunkHXIVVEZ6js.W; exports.useEmbeddedEthereumWallet = _chunkHXIVVEZ6js.U; exports.useEmbeddedSolanaWallet = _chunkHXIVVEZ6js.V; exports.useEmbeddedWallet = _chunkHXIVVEZ6js.K; exports.useEmbeddedWalletStateChange = _chunkHXIVVEZ6js.L; exports.useHeadlessDelegatedActions = _chunkHXIVVEZ6js.y; exports.useIdentityToken = _chunkHXIVVEZ6js.M; exports.useLinkEmail = _chunkHXIVVEZ6js.p; exports.useLinkSMS = _chunkHXIVVEZ6js.s; exports.useLinkWithCrossApp = _chunkHXIVVEZ6js.E; exports.useLinkWithFarcaster = _chunkHXIVVEZ6js.u; exports.useLinkWithOAuth = F; exports.useLinkWithSiwe = _chunkHXIVVEZ6js.j; exports.useLinkWithSiws = _chunkHXIVVEZ6js.m; exports.useLoginWithCrossApp = _chunkHXIVVEZ6js.D; exports.useLoginWithEmail = _chunkHXIVVEZ6js.r; exports.useLoginWithFarcaster = _chunkHXIVVEZ6js.w; exports.useLoginWithFarcasterV2 = _chunkHXIVVEZ6js.x; exports.useLoginWithOAuth = _chunkQCIAFL2Djs.b; exports.useLoginWithSMS = _chunkHXIVVEZ6js.t; exports.useLoginWithSiwe = _chunkHXIVVEZ6js.k; exports.useLoginWithSiws = _chunkHXIVVEZ6js.n; exports.useMfa = _chunkHXIVVEZ6js.S; exports.useMfaEnrollment = _chunkHXIVVEZ6js.T; exports.useMigrateWallets = _chunkHXIVVEZ6js._; exports.useOAuthFlow = T; exports.useOAuthTokens = b; exports.useOnNeedsRecovery = _chunkHXIVVEZ6js.f; exports.usePrivy = _chunkHXIVVEZ6js.X; exports.usePrivyClient = _chunkHXIVVEZ6js.l; exports.useRecoverEmbeddedWallet = _chunkHXIVVEZ6js.J; exports.useRegisterMfaListener = _chunkHXIVVEZ6js.O; exports.useSendTransactionWithCrossApp = _chunkHXIVVEZ6js.H; exports.useSessionSigners = _chunkHXIVVEZ6js.z; exports.useSetEmbeddedWalletRecovery = _chunkHXIVVEZ6js.I; exports.useSignMessageWithCrossApp = _chunkHXIVVEZ6js.F; exports.useSignTypedDataWithCrossApp = _chunkHXIVVEZ6js.G; exports.useSigners = _chunkHXIVVEZ6js.A; exports.useUnlinkEmail = _chunkHXIVVEZ6js.q; exports.useUnlinkFarcaster = _chunkHXIVVEZ6js.v; exports.useUnlinkOAuth = H; exports.useUnlinkWallet = _chunkHXIVVEZ6js.o; exports.useUpdateEmail = _chunkHXIVVEZ6js.B; exports.useUpdatePhone = _chunkHXIVVEZ6js.C;
package/dist/passkey.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var _chunkJJRTTYNPjs = require('./chunk-JJRTTYNP.js');var _chunkQTVIWU3Njs = require('./chunk-QTVIWU3N.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var X=e=>{let{client:n,passkeyState:h,setPasskeyState:s}=_react.useContext.call(void 0, _chunkJJRTTYNPjs._),c=_react.useCallback.call(void 0, o=>{var r;let a=_chunkJJRTTYNPjs.g.call(void 0, o);return s({status:"error",error:a}),(r=e==null?void 0:e.onError)==null||r.call(e,a),a},[e==null?void 0:e.onError]);return{linkWithPasskey:_react.useCallback.call(void 0, a=>_chunkQTVIWU3Njs.d.call(void 0, void 0,[a],function*({relyingParty:o}){var r;try{if(!_chunkJJRTTYNPjs.b.call(void 0, ))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_passkey_before_logged_in",error:"Must be logged in to link a passkey."});s({status:"generating-challenege"});let{options:u}=yield n.auth.passkey.generateRegistrationOptions(o);s({status:"awaiting-passkey"});let k=yield _chunkJJRTTYNPjs.P.call(void 0, _chunkJJRTTYNPjs.R.call(void 0, u));s({status:"submitting-response"});let{user:y}=yield n.auth.passkey.linkWithPasskey(k,o);return s({status:"done"}),(r=e==null?void 0:e.onSuccess)==null||r.call(e,y),y}catch(t){throw c(t)}}),[n,c,e==null?void 0:e.onSuccess]),state:h}};var ne=e=>{let{client:n,passkeyState:h,setPasskeyState:s}=_react.useContext.call(void 0, _chunkJJRTTYNPjs._),c=_react.useCallback.call(void 0, o=>{var r;let a=_chunkJJRTTYNPjs.g.call(void 0, o);return s({status:"error",error:a}),(r=e==null?void 0:e.onError)==null||r.call(e,a),a},[e==null?void 0:e.onError]);return{loginWithPasskey:_react.useCallback.call(void 0, a=>_chunkQTVIWU3Njs.d.call(void 0, void 0,[a],function*({relyingParty:o}){var r,t,u,k;try{if(_chunkJJRTTYNPjs.b.call(void 0, ))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_passkey_while_already_logged_in",error:"Already logged in, use `useLinkWithPasskey` if you are trying to link a passkey to an existing account"});s({status:"generating-challenege"});let{options:i}=yield n.auth.passkey.generateAuthenticationOptions(o);s({status:"awaiting-passkey"});let P=yield _chunkJJRTTYNPjs.Q.call(void 0, {challenge:i.challenge,rpId:i.rp_id,extensions:{appid:(r=i.extensions)==null?void 0:r.app_id,credProps:(t=i.extensions)==null?void 0:t.cred_props,hmacCreateSecret:(u=i.extensions)==null?void 0:u.hmac_create_secret},timeout:i.timeout,allowCredentials:i.allow_credentials,userVerification:i.user_verification});s({status:"submitting-response"});let w=_chunkJJRTTYNPjs.a.call(void 0, ),_=yield n.auth.passkey.loginWithPasskey(P,i.challenge,o,{embedded:w==null?void 0:w.embedded});return s({status:"done"}),(k=e==null?void 0:e.onSuccess)==null||k.call(e,_.user,_.is_new_user),_.user}catch(y){throw c(y)}}),[n,c,e==null?void 0:e.onSuccess]),state:h}};var me=e=>{let{client:n,passkeyState:h,setPasskeyState:s}=_react.useContext.call(void 0, _chunkJJRTTYNPjs._),c=_react.useRef.call(void 0, e);_react.useEffect.call(void 0, ()=>{c.current=e},[e]);let f=_react.useCallback.call(void 0, a=>{var t,u;let r=_chunkJJRTTYNPjs.g.call(void 0, a);return s({status:"error",error:r}),(u=(t=c.current)==null?void 0:t.onError)==null||u.call(t,r),r},[s]);return{signupWithPasskey:_react.useCallback.call(void 0, r=>_chunkQTVIWU3Njs.d.call(void 0, void 0,[r],function*({relyingParty:a}){var t,u;try{if(_chunkJJRTTYNPjs.b.call(void 0, ))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_passkey_while_already_logged_in",error:"Already logged in, use `useLinkWithPasskey` if you are trying to link a passkey to an existing account"});s({status:"generating-challenege"});let{options:y}=yield n.auth.passkey.generateSignupOptions(a);s({status:"awaiting-passkey"});let i=yield _chunkJJRTTYNPjs.P.call(void 0, _chunkJJRTTYNPjs.R.call(void 0, y));s({status:"submitting-response"});let P=yield n.auth.passkey.signupWithPasskey(i,a);return s({status:"done"}),(u=(t=c.current)==null?void 0:t.onSuccess)==null||u.call(t,P.user,P.is_new_user),{user:P.user}}catch(k){throw f(k)}}),[n.auth.passkey,f,s]),state:h}};exports.hasError = _chunkQSWCX5XIjs.g; exports.isConnected = _chunkQSWCX5XIjs.a; exports.isConnecting = _chunkQSWCX5XIjs.c; exports.isCreating = _chunkQSWCX5XIjs.f; exports.isDisconnected = _chunkQSWCX5XIjs.d; exports.isNotCreated = _chunkQSWCX5XIjs.e; exports.isReconnecting = _chunkQSWCX5XIjs.b; exports.needsRecovery = _chunkQSWCX5XIjs.h; exports.useLinkWithPasskey = X; exports.useLoginWithPasskey = ne; exports.useSignupWithPasskey = me;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var _chunkHXIVVEZ6js = require('./chunk-HXIVVEZ6.js');var _chunkQTVIWU3Njs = require('./chunk-QTVIWU3N.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var X=e=>{let{client:n,passkeyState:h,setPasskeyState:s}=_react.useContext.call(void 0, _chunkHXIVVEZ6js.$),c=_react.useCallback.call(void 0, o=>{var r;let a=_chunkHXIVVEZ6js.g.call(void 0, o);return s({status:"error",error:a}),(r=e==null?void 0:e.onError)==null||r.call(e,a),a},[e==null?void 0:e.onError]);return{linkWithPasskey:_react.useCallback.call(void 0, a=>_chunkQTVIWU3Njs.d.call(void 0, void 0,[a],function*({relyingParty:o}){var r;try{if(!_chunkHXIVVEZ6js.b.call(void 0, ))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_passkey_before_logged_in",error:"Must be logged in to link a passkey."});s({status:"generating-challenege"});let{options:u}=yield n.auth.passkey.generateRegistrationOptions(o);s({status:"awaiting-passkey"});let k=yield _chunkHXIVVEZ6js.P.call(void 0, _chunkHXIVVEZ6js.R.call(void 0, u));s({status:"submitting-response"});let{user:y}=yield n.auth.passkey.linkWithPasskey(k,o);return s({status:"done"}),(r=e==null?void 0:e.onSuccess)==null||r.call(e,y),y}catch(t){throw c(t)}}),[n,c,e==null?void 0:e.onSuccess]),state:h}};var ne=e=>{let{client:n,passkeyState:h,setPasskeyState:s}=_react.useContext.call(void 0, _chunkHXIVVEZ6js.$),c=_react.useCallback.call(void 0, o=>{var r;let a=_chunkHXIVVEZ6js.g.call(void 0, o);return s({status:"error",error:a}),(r=e==null?void 0:e.onError)==null||r.call(e,a),a},[e==null?void 0:e.onError]);return{loginWithPasskey:_react.useCallback.call(void 0, a=>_chunkQTVIWU3Njs.d.call(void 0, void 0,[a],function*({relyingParty:o}){var r,t,u,k;try{if(_chunkHXIVVEZ6js.b.call(void 0, ))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_passkey_while_already_logged_in",error:"Already logged in, use `useLinkWithPasskey` if you are trying to link a passkey to an existing account"});s({status:"generating-challenege"});let{options:i}=yield n.auth.passkey.generateAuthenticationOptions(o);s({status:"awaiting-passkey"});let P=yield _chunkHXIVVEZ6js.Q.call(void 0, {challenge:i.challenge,rpId:i.rp_id,extensions:{appid:(r=i.extensions)==null?void 0:r.app_id,credProps:(t=i.extensions)==null?void 0:t.cred_props,hmacCreateSecret:(u=i.extensions)==null?void 0:u.hmac_create_secret},timeout:i.timeout,allowCredentials:i.allow_credentials,userVerification:i.user_verification});s({status:"submitting-response"});let w=_chunkHXIVVEZ6js.a.call(void 0, ),_=yield n.auth.passkey.loginWithPasskey(P,i.challenge,o,{embedded:w==null?void 0:w.embedded});return s({status:"done"}),(k=e==null?void 0:e.onSuccess)==null||k.call(e,_.user,_.is_new_user),_.user}catch(y){throw c(y)}}),[n,c,e==null?void 0:e.onSuccess]),state:h}};var me=e=>{let{client:n,passkeyState:h,setPasskeyState:s}=_react.useContext.call(void 0, _chunkHXIVVEZ6js.$),c=_react.useRef.call(void 0, e);_react.useEffect.call(void 0, ()=>{c.current=e},[e]);let f=_react.useCallback.call(void 0, a=>{var t,u;let r=_chunkHXIVVEZ6js.g.call(void 0, a);return s({status:"error",error:r}),(u=(t=c.current)==null?void 0:t.onError)==null||u.call(t,r),r},[s]);return{signupWithPasskey:_react.useCallback.call(void 0, r=>_chunkQTVIWU3Njs.d.call(void 0, void 0,[r],function*({relyingParty:a}){var t,u;try{if(_chunkHXIVVEZ6js.b.call(void 0, ))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_passkey_while_already_logged_in",error:"Already logged in, use `useLinkWithPasskey` if you are trying to link a passkey to an existing account"});s({status:"generating-challenege"});let{options:y}=yield n.auth.passkey.generateSignupOptions(a);s({status:"awaiting-passkey"});let i=yield _chunkHXIVVEZ6js.P.call(void 0, _chunkHXIVVEZ6js.R.call(void 0, y));s({status:"submitting-response"});let P=yield n.auth.passkey.signupWithPasskey(i,a);return s({status:"done"}),(u=(t=c.current)==null?void 0:t.onSuccess)==null||u.call(t,P.user,P.is_new_user),{user:P.user}}catch(k){throw f(k)}}),[n.auth.passkey,f,s]),state:h}};exports.hasError = _chunkQSWCX5XIjs.g; exports.isConnected = _chunkQSWCX5XIjs.a; exports.isConnecting = _chunkQSWCX5XIjs.c; exports.isCreating = _chunkQSWCX5XIjs.f; exports.isDisconnected = _chunkQSWCX5XIjs.d; exports.isNotCreated = _chunkQSWCX5XIjs.e; exports.isReconnecting = _chunkQSWCX5XIjs.b; exports.needsRecovery = _chunkQSWCX5XIjs.h; exports.useLinkWithPasskey = X; exports.useLoginWithPasskey = ne; exports.useSignupWithPasskey = me;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var _chunkJJRTTYNPjs = require('./chunk-JJRTTYNP.js');var _chunkQTVIWU3Njs = require('./chunk-QTVIWU3N.js');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _jssdkcore = require('@privy-io/js-sdk-core');var _viem = require('viem');var _smartwallets = require('@privy-io/js-sdk-core/smart-wallets');var W=l=>_chunkQTVIWU3Njs.d.call(void 0, void 0,[l],function*({chain:t,privyAppId:e,user:a,embeddedWallet:r,smartWalletsConfig:n,client:o}){if(!(n!=null&&n.enabled)||!r||!_chunkQSWCX5XIjs.a.call(void 0, r))return;let f=yield o.embeddedWallet.getProvider(r.account),i=n==null?void 0:n.configured_networks.find($=>$.chain_id===`eip155:${t.id}`);if(!i)throw new (0, _jssdkcore.PrivyClientError)({code:"chain_not_supported",error:`The chain ${t.name} (eip155:${t.id}) must be configured in the smart wallet configuration in your dashboard`});let s=_jssdkcore.getUserSmartWallet.call(void 0, a),y=s?s.smart_wallet_type:n.smart_wallet_type,w=s?s.smart_wallet_version:n.smart_wallet_version,N=_jssdkcore.getJsonRpcEndpointFromChain.call(void 0, t,{rpcUrls:[]},e),O=_viem.createPublicClient.call(void 0, {chain:t,transport:_viem.http.call(void 0, N)}),P=yield _smartwallets.signerToSmartAccountClient.call(void 0, {owner:f,smartWalletType:y,smartWalletVersion:w,chain:t,publicClient:O,paymasterContext:j(i.paymaster_url,i.paymaster_context),bundlerUrl:i.bundler_url,paymasterUrl:i.paymaster_url});if(!P)throw new (0, _jssdkcore.PrivyClientError)({code:"smart_wallet_client_error",error:`Failed to create smart wallet client for chain ${t.name} (eip155:${t.id})`});return P}),B=/paymaster\.biconomy\.io\/api/i;function D(t){return B.test(t)}var Y={mode:"SPONSORED",calculateGasLimits:!0,expiryDuration:300,sponsorshipInfo:{webhookData:{},smartAccountInfo:{name:"BICONOMY",version:"2.0.0"}}},j=(t,e)=>{if(t&&D(t))return Y;if(e&&e.policy_id)return{policyId:e.policy_id}};var J=({children:t})=>_react2.default.createElement(z,null,_react2.default.createElement(H,null,_react2.default.createElement(K,null,t))),T=_react.createContext.call(void 0, {config:void 0}),v=()=>{let{config:t}=_react.useContext.call(void 0, T);return{config:t}},k=_react.createContext.call(void 0, {smartWalletClient:void 0}),V=()=>{let{smartWalletClient:t}=_react.useContext.call(void 0, k);return{smartWalletClient:t}},U=_react.createContext.call(void 0, {client:void 0}),q= exports.useSmartWallets =()=>{let{client:t}=_react.useContext.call(void 0, U),e=Q();return{client:t,getClientForChain:e}},z=({children:t})=>{let[e,a]=_react.useState.call(void 0, void 0),r=_chunkJJRTTYNPjs.l.call(void 0, );return _react.useEffect.call(void 0, ()=>{!e&&r&&(()=>_chunkQTVIWU3Njs.d.call(void 0, void 0,null,function*(){try{if(!r){console.warn("No client found");return}let o=yield r.app.getSmartWalletConfig();a(o)}catch(o){console.warn("Error generating smart wallet config: ",o)}}))()},[r,e]),_react2.default.createElement(T.Provider,{value:{config:e}},t)},H=({children:t})=>{let{config:e}=v(),{client:a,wallet:r}=_react.useContext.call(void 0, _chunkJJRTTYNPjs._),n=_chunkJJRTTYNPjs.d.call(void 0, ),[o,l]=_react.useState.call(void 0, );return _react.useEffect.call(void 0, ()=>{(()=>_chunkQTVIWU3Njs.d.call(void 0, void 0,null,function*(){if(!n&&o&&l(void 0),!(e!=null&&e.enabled)||!n||r.status!=="connected"||n&&o&&r.status==="connected")return;let i=a.embeddedWallet.chains.find(y=>e.configured_networks.map(w=>w.chain_id).includes(`eip155:${y.id}`));if(!i)throw new (0, _jssdkcore.PrivyClientError)({error:"Could not find smart wallets chain configurations for any Privy client configured chains. Please configure smart wallets for your chains in the Privy dashboard.",code:"chain_not_supported"});let s=yield W({chain:i,privyAppId:a.app.appId,user:n,embeddedWallet:r,smartWalletsConfig:e,client:a});if(!s)throw new (0, _jssdkcore.PrivyClientError)({error:"Could not create smart wallet client",code:"smart_wallet_client_error"});l(s)}))()},[!!(e!=null&&e.enabled),!!a,!!n,r.status]),_react2.default.createElement(k.Provider,{value:{smartWalletClient:o}},t)},K=({children:t})=>{let{client:e}=_react.useContext.call(void 0, _chunkJJRTTYNPjs._),a=_chunkJJRTTYNPjs.d.call(void 0, ),{smartWalletClient:r}=V(),{config:n}=v();return _react.useEffect.call(void 0, ()=>{(()=>_chunkQTVIWU3Njs.d.call(void 0, void 0,null,function*(){if(!(!r||!a||_jssdkcore.getUserSmartWallet.call(void 0, a)||!(n!=null&&n.enabled)))try{let{message:l}=yield e.auth.smartWallet.init({address:r.account.address,chainId:`eip155:${r.chain.id}`}),d=yield r.signMessage({message:l});yield e.auth.smartWallet.link(l,d,n.smart_wallet_type,n.smart_wallet_version)}catch(l){console.error("Error creating smart wallet:",l)}}))()},[!!r,!!a,!!_jssdkcore.getUserSmartWallet.call(void 0, a),n]),_react2.default.createElement(U.Provider,{value:{client:_jssdkcore.getUserSmartWallet.call(void 0, a)?r:void 0}},t)},Q=()=>{let{client:t,wallet:e}=_react.useContext.call(void 0, _chunkJJRTTYNPjs._),{config:a}=v();return _react.useCallback.call(void 0, n=>_chunkQTVIWU3Njs.d.call(void 0, void 0,[n],function*({chainId:r}){let o=_chunkJJRTTYNPjs.b.call(void 0, );if(!o)throw new (0, _jssdkcore.PrivyClientError)({error:"Must be logged in to get a smart wallet client",code:"smart_wallet_client_error"});if(!a||!a.enabled)throw new (0, _jssdkcore.PrivyClientError)({error:"Must have smart wallets enabled to get a smart wallet client",code:"smart_wallet_client_error"});let d=t.embeddedWallet.chains.find(i=>i.id===r);if(!d)throw new (0, _jssdkcore.PrivyClientError)({error:`Could not find chain with id: ${r}`,code:"chain_not_supported"});let f=yield W({chain:d,privyAppId:t.app.appId,user:o,embeddedWallet:e,smartWalletsConfig:a,client:t});if(!f)throw new (0, _jssdkcore.PrivyClientError)({error:`Could not create smart wallet client for chain ${r}`,code:"smart_wallet_client_error"});return f}),[a,e,t])};exports.SmartWalletsProvider = J; exports.useSmartWallets = q;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var _chunkHXIVVEZ6js = require('./chunk-HXIVVEZ6.js');var _chunkQTVIWU3Njs = require('./chunk-QTVIWU3N.js');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _jssdkcore = require('@privy-io/js-sdk-core');var _viem = require('viem');var _smartwallets = require('@privy-io/js-sdk-core/smart-wallets');var W=l=>_chunkQTVIWU3Njs.d.call(void 0, void 0,[l],function*({chain:t,privyAppId:e,user:a,embeddedWallet:r,smartWalletsConfig:n,client:o}){if(!(n!=null&&n.enabled)||!r||!_chunkQSWCX5XIjs.a.call(void 0, r))return;let f=yield o.embeddedWallet.getProvider(r.account),i=n==null?void 0:n.configured_networks.find($=>$.chain_id===`eip155:${t.id}`);if(!i)throw new (0, _jssdkcore.PrivyClientError)({code:"chain_not_supported",error:`The chain ${t.name} (eip155:${t.id}) must be configured in the smart wallet configuration in your dashboard`});let s=_jssdkcore.getUserSmartWallet.call(void 0, a),y=s?s.smart_wallet_type:n.smart_wallet_type,w=s?s.smart_wallet_version:n.smart_wallet_version,N=_jssdkcore.getJsonRpcEndpointFromChain.call(void 0, t,{rpcUrls:[]},e),O=_viem.createPublicClient.call(void 0, {chain:t,transport:_viem.http.call(void 0, N)}),P=yield _smartwallets.signerToSmartAccountClient.call(void 0, {owner:f,smartWalletType:y,smartWalletVersion:w,chain:t,publicClient:O,paymasterContext:j(i.paymaster_url,i.paymaster_context),bundlerUrl:i.bundler_url,paymasterUrl:i.paymaster_url});if(!P)throw new (0, _jssdkcore.PrivyClientError)({code:"smart_wallet_client_error",error:`Failed to create smart wallet client for chain ${t.name} (eip155:${t.id})`});return P}),B=/paymaster\.biconomy\.io\/api/i;function D(t){return B.test(t)}var Y={mode:"SPONSORED",calculateGasLimits:!0,expiryDuration:300,sponsorshipInfo:{webhookData:{},smartAccountInfo:{name:"BICONOMY",version:"2.0.0"}}},j=(t,e)=>{if(t&&D(t))return Y;if(e&&e.policy_id)return{policyId:e.policy_id}};var J=({children:t})=>_react2.default.createElement(z,null,_react2.default.createElement(H,null,_react2.default.createElement(K,null,t))),T=_react.createContext.call(void 0, {config:void 0}),v=()=>{let{config:t}=_react.useContext.call(void 0, T);return{config:t}},k=_react.createContext.call(void 0, {smartWalletClient:void 0}),V=()=>{let{smartWalletClient:t}=_react.useContext.call(void 0, k);return{smartWalletClient:t}},U=_react.createContext.call(void 0, {client:void 0}),q= exports.useSmartWallets =()=>{let{client:t}=_react.useContext.call(void 0, U),e=Q();return{client:t,getClientForChain:e}},z=({children:t})=>{let[e,a]=_react.useState.call(void 0, void 0),r=_chunkHXIVVEZ6js.l.call(void 0, );return _react.useEffect.call(void 0, ()=>{!e&&r&&(()=>_chunkQTVIWU3Njs.d.call(void 0, void 0,null,function*(){try{if(!r){console.warn("No client found");return}let o=yield r.app.getSmartWalletConfig();a(o)}catch(o){console.warn("Error generating smart wallet config: ",o)}}))()},[r,e]),_react2.default.createElement(T.Provider,{value:{config:e}},t)},H=({children:t})=>{let{config:e}=v(),{client:a,wallet:r}=_react.useContext.call(void 0, _chunkHXIVVEZ6js.$),n=_chunkHXIVVEZ6js.d.call(void 0, ),[o,l]=_react.useState.call(void 0, );return _react.useEffect.call(void 0, ()=>{(()=>_chunkQTVIWU3Njs.d.call(void 0, void 0,null,function*(){if(!n&&o&&l(void 0),!(e!=null&&e.enabled)||!n||r.status!=="connected"||n&&o&&r.status==="connected")return;let i=a.embeddedWallet.chains.find(y=>e.configured_networks.map(w=>w.chain_id).includes(`eip155:${y.id}`));if(!i)throw new (0, _jssdkcore.PrivyClientError)({error:"Could not find smart wallets chain configurations for any Privy client configured chains. Please configure smart wallets for your chains in the Privy dashboard.",code:"chain_not_supported"});let s=yield W({chain:i,privyAppId:a.app.appId,user:n,embeddedWallet:r,smartWalletsConfig:e,client:a});if(!s)throw new (0, _jssdkcore.PrivyClientError)({error:"Could not create smart wallet client",code:"smart_wallet_client_error"});l(s)}))()},[!!(e!=null&&e.enabled),!!a,!!n,r.status]),_react2.default.createElement(k.Provider,{value:{smartWalletClient:o}},t)},K=({children:t})=>{let{client:e}=_react.useContext.call(void 0, _chunkHXIVVEZ6js.$),a=_chunkHXIVVEZ6js.d.call(void 0, ),{smartWalletClient:r}=V(),{config:n}=v();return _react.useEffect.call(void 0, ()=>{(()=>_chunkQTVIWU3Njs.d.call(void 0, void 0,null,function*(){if(!(!r||!a||_jssdkcore.getUserSmartWallet.call(void 0, a)||!(n!=null&&n.enabled)))try{let{message:l}=yield e.auth.smartWallet.init({address:r.account.address,chainId:`eip155:${r.chain.id}`}),d=yield r.signMessage({message:l});yield e.auth.smartWallet.link(l,d,n.smart_wallet_type,n.smart_wallet_version)}catch(l){console.error("Error creating smart wallet:",l)}}))()},[!!r,!!a,!!_jssdkcore.getUserSmartWallet.call(void 0, a),n]),_react2.default.createElement(U.Provider,{value:{client:_jssdkcore.getUserSmartWallet.call(void 0, a)?r:void 0}},t)},Q=()=>{let{client:t,wallet:e}=_react.useContext.call(void 0, _chunkHXIVVEZ6js.$),{config:a}=v();return _react.useCallback.call(void 0, n=>_chunkQTVIWU3Njs.d.call(void 0, void 0,[n],function*({chainId:r}){let o=_chunkHXIVVEZ6js.b.call(void 0, );if(!o)throw new (0, _jssdkcore.PrivyClientError)({error:"Must be logged in to get a smart wallet client",code:"smart_wallet_client_error"});if(!a||!a.enabled)throw new (0, _jssdkcore.PrivyClientError)({error:"Must have smart wallets enabled to get a smart wallet client",code:"smart_wallet_client_error"});let d=t.embeddedWallet.chains.find(i=>i.id===r);if(!d)throw new (0, _jssdkcore.PrivyClientError)({error:`Could not find chain with id: ${r}`,code:"chain_not_supported"});let f=yield W({chain:d,privyAppId:t.app.appId,user:o,embeddedWallet:e,smartWalletsConfig:a,client:t});if(!f)throw new (0, _jssdkcore.PrivyClientError)({error:`Could not create smart wallet client for chain ${r}`,code:"smart_wallet_client_error"});return f}),[a,e,t])};exports.SmartWalletsProvider = J; exports.useSmartWallets = q;