@privy-io/expo 0.68.1 → 0.69.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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWGWDSLNNjs = require('./chunk-WGWDSLNN.js');var _chunkQTVIWU3Njs = require('./chunk-QTVIWU3N.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var f=()=>{let e=_chunkWGWDSLNNjs.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=_chunkWGWDSLNNjs.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=_chunkWGWDSLNNjs.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 _chunkVOWICGFQjs = require('./chunk-VOWICGFQ.js');var _chunkQTVIWU3Njs = require('./chunk-QTVIWU3N.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var f=()=>{let e=_chunkVOWICGFQjs.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=_chunkVOWICGFQjs.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=_chunkVOWICGFQjs.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
@@ -1,6 +1,7 @@
1
1
  import * as Privy from '@privy-io/js-sdk-core';
2
- import Privy__default, { EmbeddedWalletConfig, UnsignedTransactionRequest, OnNeedsRecovery, MfaMethod, PrivyEmbeddedWalletProvider, PrivyEmbeddedSolanaWalletProvider, EmbeddedBitcoinWalletProvider, GenerateAuthorizationSignatureInput, GenerateAuthorizationSignatureOutput, Storage, Chain, OAuthProviderID, Logger } from '@privy-io/js-sdk-core';
2
+ import Privy__default, { EmbeddedWalletConfig, DepositConfig, GenerateDepositAddressInput, DepositAddressQuote, GetDepositInput, DepositAddressOrder, WaitForDepositInput, DepositAddressPollingResult, WaitForCompletionInput, UnsignedTransactionRequest, OnNeedsRecovery, MfaMethod, PrivyEmbeddedWalletProvider, PrivyEmbeddedSolanaWalletProvider, EmbeddedBitcoinWalletProvider, GenerateAuthorizationSignatureInput, GenerateAuthorizationSignatureOutput, Storage, Chain, OAuthProviderID, Logger } from '@privy-io/js-sdk-core';
3
3
  export * from '@privy-io/js-sdk-core';
4
+ export { DepositAddressOrder, DepositAddressPollingResult, DepositAddressQuote, DepositConfig, GenerateDepositAddressInput, GetDepositInput, WaitForCompletionInput, WaitForDepositInput } from '@privy-io/js-sdk-core';
4
5
  import React from 'react';
5
6
  import { E as ErrorCallback, A as AuthLinkSuccessCallback, G as GenerateSiweMessage, S as SiweFlowState, a as AuthSuccessCallback, O as OtpLinkHookOptions, b as OtpLinkHookResult, c as OtpLoginHookOptions, d as OtpLoginHookResult, F as FarcasterFlowState, L as LinkFarcasterInput, e as SubmitFarcasterOptions, f as LoginWithFarcasterInput, g as EmbeddedWalletState, h as EmbeddedSolanaWalletState, i as OtpFlowState, j as OAuthFlowState, W as WalletRecoveryCallbacks, k as SolanaWalletRecoveryCallbacks, R as RecoveryFlowState, P as PasskeyFlowState } from './predicates-f4e23818.js';
6
7
  export { Y as CreateEthereumEmbeddedWalletOpts, X as CreateOrRecoverEmbeddedWalletProps, _ as CreateSolanaEmbeddedWalletOpts, a1 as CustomAuthFlowState, a5 as EmbeddedSolanaWalletActions, a6 as EmbeddedSolanaWalletStatus, p as EmbeddedWallet, a3 as EmbeddedWalletActions, a4 as EmbeddedWalletStatus, n as LinkedAccountWithMetadata, a2 as MfaConfig, M as PrivyAppleOauthAccount, s as PrivyBitcoinSegwitEmbeddedWalletAccount, t as PrivyBitcoinTaprootEmbeddedWalletAccount, V as PrivyCrossAppWalletAccount, N as PrivyCustomJwtAccount, C as PrivyDiscordOauthAccount, v as PrivyEmailAccount, o as PrivyEmbeddedWalletAccount, x as PrivyEthereumAccount, q as PrivyEthereumEmbeddedWalletAccount, Q as PrivyFarcasterAccount, D as PrivyGithubOauthAccount, z as PrivyGoogleOauthAccount, I as PrivyInstagramOauthAccount, m as PrivyLinkedAccount, K as PrivyLinkedInOauthAccount, T as PrivyPasskeyAccount, w as PrivyPhoneAccount, u as PrivySmartWalletAccount, y as PrivySolanaAccount, r as PrivySolanaEmbeddedWalletAccount, H as PrivySpotifyOauthAccount, U as PrivyTelegramAccount, J as PrivyTiktokOauthAccount, B as PrivyTwitterOauthAccount, l as PrivyUser, Z as RecoverEthereumEmbeddedWalletOpts, $ as RecoverSolanaEmbeddedWalletOpts, a0 as SetRecoveryProps, ad as hasError, a7 as isConnected, a9 as isConnecting, ac as isCreating, aa as isDisconnected, ab as isNotCreated, a8 as isReconnecting, ae as needsRecovery } from './predicates-f4e23818.js';
@@ -355,6 +356,21 @@ interface UseHeadlessDelegatedActionsInterface {
355
356
  */
356
357
  declare const useHeadlessDelegatedActions: () => UseHeadlessDelegatedActionsInterface;
357
358
 
359
+ interface UseDepositAddressInterface {
360
+ /** Fetches the deposit config from the server. */
361
+ getConfig: () => Promise<DepositConfig>;
362
+ /** Generates a deposit address. Resolves a refund address automatically if not provided. */
363
+ generateDepositAddress: (opts: GenerateDepositAddressInput) => Promise<DepositAddressQuote>;
364
+ /** Fetches enriched deposit details by order ID. */
365
+ getDeposit: (opts: GetDepositInput) => Promise<DepositAddressOrder>;
366
+ /** Polls until funds are received at the deposit address. */
367
+ waitForDeposit: (opts: WaitForDepositInput) => Promise<DepositAddressPollingResult>;
368
+ /** Polls until the deposit reaches a terminal status. */
369
+ waitForCompletion: (opts: WaitForCompletionInput) => Promise<DepositAddressPollingResult>;
370
+ }
371
+ /** @experimental This interface may change at any time. */
372
+ declare const useDepositAddress: () => UseDepositAddressInterface;
373
+
358
374
  interface SessionSigner {
359
375
  signerId: string;
360
376
  policyIds: string[];
@@ -1037,6 +1053,31 @@ declare function useMfaEnrollment(): {
1037
1053
  };
1038
1054
  };
1039
1055
 
1056
+ interface UseUnlinkPasskey {
1057
+ /**
1058
+ * Unlink a specific passkey account from the current user by credential ID.
1059
+ * Requires MFA verification. The user must have at least one other linked account.
1060
+ *
1061
+ * @param opts.credentialId The passkey credential ID to unlink
1062
+ * @param opts.removeAsMfa If true, also removes the passkey as an MFA method
1063
+ */
1064
+ unlink(opts: {
1065
+ credentialId: string;
1066
+ removeAsMfa?: boolean;
1067
+ }): Promise<void>;
1068
+ }
1069
+ /**
1070
+ * Use this hook to unlink a specific passkey from the current user by credential ID.
1071
+ *
1072
+ * @returns unlink - deletes a passkey account by credential ID
1073
+ *
1074
+ * @example
1075
+ * const {unlink} = useUnlinkPasskey();
1076
+ *
1077
+ * await unlink({credentialId: 'cred-id-123'});
1078
+ */
1079
+ declare function useUnlinkPasskey(): UseUnlinkPasskey;
1080
+
1040
1081
  type UseEmbeddedWallet = {
1041
1082
  /**
1042
1083
  * Callback function triggered when wallet creation is successful.
@@ -1713,4 +1754,4 @@ declare const useMigrateWallets: () => {
1713
1754
  }>;
1714
1755
  };
1715
1756
 
1716
- 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, UseGetEncryptedAuthorizationKeyInterface, 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, useGetEncryptedAuthorizationKey, 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, useSign7702Authorization, useSignMessageWithCrossApp, useSignTypedDataWithCrossApp, useSigners, useUnlinkEmail, useUnlinkFarcaster, useUnlinkOAuth, useUnlinkWallet, useUpdateEmail, useUpdatePhone };
1757
+ 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, UseDepositAddressInterface, UseGetEncryptedAuthorizationKeyInterface, 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, UseUnlinkPasskey, UseUnlinkWallet, UseUnlinkWalletOptions, UseUpdateEmailInterface, UseUpdatePhoneInterface, createPrivyClient, getAccessToken, useAcceptTerms, useAuthorizationSignature, useCreateGuestAccount, useDepositAddress, useEmbeddedBitcoinWallet, useEmbeddedEthereumWallet, useEmbeddedSolanaWallet, useEmbeddedWallet, useEmbeddedWalletStateChange, useGetEncryptedAuthorizationKey, 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, useSign7702Authorization, useSignMessageWithCrossApp, useSignTypedDataWithCrossApp, useSigners, useUnlinkEmail, useUnlinkFarcaster, useUnlinkOAuth, useUnlinkPasskey, 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 _chunkEDE5XF7Zjs = require('./chunk-EDE5XF7Z.js');var _chunkWGWDSLNNjs = require('./chunk-WGWDSLNN.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 jt=({loading:t,error:e,unauthenticated:o,children:i})=>{let{isReady:u,error:p}=_chunkWGWDSLNNjs.X.call(void 0, ),d=_chunkWGWDSLNNjs.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 _chunkEDE5XF7Zjs.a.call(void 0, t)}function F(t){let{state:e,start:o}=_chunkEDE5XF7Zjs.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, _chunkWGWDSLNNjs.ba),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=_chunkWGWDSLNNjs.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, _chunkWGWDSLNNjs.ba),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 = jt; exports.PrivyContext = _chunkWGWDSLNNjs.ba; exports.PrivyProvider = _chunkWGWDSLNNjs.da; exports.SecureStorageAdapter = _chunkQTVIWU3Njs.g; exports.createPrivyClient = _chunkWGWDSLNNjs.i; exports.getAccessToken = _chunkWGWDSLNNjs.ca; 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 = _chunkWGWDSLNNjs.Y; exports.useAuthorizationSignature = _chunkWGWDSLNNjs.Z; exports.useCreateGuestAccount = _chunkWGWDSLNNjs.N; exports.useEmbeddedBitcoinWallet = _chunkWGWDSLNNjs.W; exports.useEmbeddedEthereumWallet = _chunkWGWDSLNNjs.U; exports.useEmbeddedSolanaWallet = _chunkWGWDSLNNjs.V; exports.useEmbeddedWallet = _chunkWGWDSLNNjs.K; exports.useEmbeddedWalletStateChange = _chunkWGWDSLNNjs.L; exports.useGetEncryptedAuthorizationKey = _chunkWGWDSLNNjs._; exports.useHeadlessDelegatedActions = _chunkWGWDSLNNjs.y; exports.useIdentityToken = _chunkWGWDSLNNjs.M; exports.useLinkEmail = _chunkWGWDSLNNjs.p; exports.useLinkSMS = _chunkWGWDSLNNjs.s; exports.useLinkWithCrossApp = _chunkWGWDSLNNjs.E; exports.useLinkWithFarcaster = _chunkWGWDSLNNjs.u; exports.useLinkWithOAuth = F; exports.useLinkWithSiwe = _chunkWGWDSLNNjs.j; exports.useLinkWithSiws = _chunkWGWDSLNNjs.m; exports.useLoginWithCrossApp = _chunkWGWDSLNNjs.D; exports.useLoginWithEmail = _chunkWGWDSLNNjs.r; exports.useLoginWithFarcaster = _chunkWGWDSLNNjs.w; exports.useLoginWithFarcasterV2 = _chunkWGWDSLNNjs.x; exports.useLoginWithOAuth = _chunkEDE5XF7Zjs.b; exports.useLoginWithSMS = _chunkWGWDSLNNjs.t; exports.useLoginWithSiwe = _chunkWGWDSLNNjs.k; exports.useLoginWithSiws = _chunkWGWDSLNNjs.n; exports.useMfa = _chunkWGWDSLNNjs.S; exports.useMfaEnrollment = _chunkWGWDSLNNjs.T; exports.useMigrateWallets = _chunkWGWDSLNNjs.aa; exports.useOAuthFlow = T; exports.useOAuthTokens = b; exports.useOnNeedsRecovery = _chunkWGWDSLNNjs.f; exports.usePrivy = _chunkWGWDSLNNjs.X; exports.usePrivyClient = _chunkWGWDSLNNjs.l; exports.useRecoverEmbeddedWallet = _chunkWGWDSLNNjs.J; exports.useRegisterMfaListener = _chunkWGWDSLNNjs.O; exports.useSendTransactionWithCrossApp = _chunkWGWDSLNNjs.H; exports.useSessionSigners = _chunkWGWDSLNNjs.z; exports.useSetEmbeddedWalletRecovery = _chunkWGWDSLNNjs.I; exports.useSign7702Authorization = _chunkWGWDSLNNjs.$; exports.useSignMessageWithCrossApp = _chunkWGWDSLNNjs.F; exports.useSignTypedDataWithCrossApp = _chunkWGWDSLNNjs.G; exports.useSigners = _chunkWGWDSLNNjs.A; exports.useUnlinkEmail = _chunkWGWDSLNNjs.q; exports.useUnlinkFarcaster = _chunkWGWDSLNNjs.v; exports.useUnlinkOAuth = H; exports.useUnlinkWallet = _chunkWGWDSLNNjs.o; exports.useUpdateEmail = _chunkWGWDSLNNjs.B; exports.useUpdatePhone = _chunkWGWDSLNNjs.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 _chunkWWEQQ7TOjs = require('./chunk-WWEQQ7TO.js');var _chunkVOWICGFQjs = require('./chunk-VOWICGFQ.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 Et=({loading:t,error:e,unauthenticated:o,children:i})=>{let{isReady:u,error:p}=_chunkVOWICGFQjs.Z.call(void 0, ),d=_chunkVOWICGFQjs.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 _chunkWWEQQ7TOjs.a.call(void 0, t)}function F(t){let{state:e,start:o}=_chunkWWEQQ7TOjs.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, _chunkVOWICGFQjs.da),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=_chunkVOWICGFQjs.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, _chunkVOWICGFQjs.da),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 = Et; exports.PrivyContext = _chunkVOWICGFQjs.da; exports.PrivyProvider = _chunkVOWICGFQjs.fa; exports.SecureStorageAdapter = _chunkQTVIWU3Njs.g; exports.createPrivyClient = _chunkVOWICGFQjs.i; exports.getAccessToken = _chunkVOWICGFQjs.ea; 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 = _chunkVOWICGFQjs._; exports.useAuthorizationSignature = _chunkVOWICGFQjs.$; exports.useCreateGuestAccount = _chunkVOWICGFQjs.O; exports.useDepositAddress = _chunkVOWICGFQjs.z; exports.useEmbeddedBitcoinWallet = _chunkVOWICGFQjs.Y; exports.useEmbeddedEthereumWallet = _chunkVOWICGFQjs.W; exports.useEmbeddedSolanaWallet = _chunkVOWICGFQjs.X; exports.useEmbeddedWallet = _chunkVOWICGFQjs.L; exports.useEmbeddedWalletStateChange = _chunkVOWICGFQjs.M; exports.useGetEncryptedAuthorizationKey = _chunkVOWICGFQjs.aa; exports.useHeadlessDelegatedActions = _chunkVOWICGFQjs.y; exports.useIdentityToken = _chunkVOWICGFQjs.N; exports.useLinkEmail = _chunkVOWICGFQjs.p; exports.useLinkSMS = _chunkVOWICGFQjs.s; exports.useLinkWithCrossApp = _chunkVOWICGFQjs.F; exports.useLinkWithFarcaster = _chunkVOWICGFQjs.u; exports.useLinkWithOAuth = F; exports.useLinkWithSiwe = _chunkVOWICGFQjs.j; exports.useLinkWithSiws = _chunkVOWICGFQjs.m; exports.useLoginWithCrossApp = _chunkVOWICGFQjs.E; exports.useLoginWithEmail = _chunkVOWICGFQjs.r; exports.useLoginWithFarcaster = _chunkVOWICGFQjs.w; exports.useLoginWithFarcasterV2 = _chunkVOWICGFQjs.x; exports.useLoginWithOAuth = _chunkWWEQQ7TOjs.b; exports.useLoginWithSMS = _chunkVOWICGFQjs.t; exports.useLoginWithSiwe = _chunkVOWICGFQjs.k; exports.useLoginWithSiws = _chunkVOWICGFQjs.n; exports.useMfa = _chunkVOWICGFQjs.T; exports.useMfaEnrollment = _chunkVOWICGFQjs.U; exports.useMigrateWallets = _chunkVOWICGFQjs.ca; exports.useOAuthFlow = T; exports.useOAuthTokens = b; exports.useOnNeedsRecovery = _chunkVOWICGFQjs.f; exports.usePrivy = _chunkVOWICGFQjs.Z; exports.usePrivyClient = _chunkVOWICGFQjs.l; exports.useRecoverEmbeddedWallet = _chunkVOWICGFQjs.K; exports.useRegisterMfaListener = _chunkVOWICGFQjs.P; exports.useSendTransactionWithCrossApp = _chunkVOWICGFQjs.I; exports.useSessionSigners = _chunkVOWICGFQjs.A; exports.useSetEmbeddedWalletRecovery = _chunkVOWICGFQjs.J; exports.useSign7702Authorization = _chunkVOWICGFQjs.ba; exports.useSignMessageWithCrossApp = _chunkVOWICGFQjs.G; exports.useSignTypedDataWithCrossApp = _chunkVOWICGFQjs.H; exports.useSigners = _chunkVOWICGFQjs.B; exports.useUnlinkEmail = _chunkVOWICGFQjs.q; exports.useUnlinkFarcaster = _chunkVOWICGFQjs.v; exports.useUnlinkOAuth = H; exports.useUnlinkPasskey = _chunkVOWICGFQjs.V; exports.useUnlinkWallet = _chunkVOWICGFQjs.o; exports.useUpdateEmail = _chunkVOWICGFQjs.C; exports.useUpdatePhone = _chunkVOWICGFQjs.D;
package/dist/passkey.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var _chunkWGWDSLNNjs = require('./chunk-WGWDSLNN.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, _chunkWGWDSLNNjs.ba),c=_react.useCallback.call(void 0, o=>{var r;let a=_chunkWGWDSLNNjs.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(!_chunkWGWDSLNNjs.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 _chunkWGWDSLNNjs.P.call(void 0, _chunkWGWDSLNNjs.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, _chunkWGWDSLNNjs.ba),c=_react.useCallback.call(void 0, o=>{var r;let a=_chunkWGWDSLNNjs.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(_chunkWGWDSLNNjs.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 _chunkWGWDSLNNjs.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=_chunkWGWDSLNNjs.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, _chunkWGWDSLNNjs.ba),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=_chunkWGWDSLNNjs.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(_chunkWGWDSLNNjs.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 _chunkWGWDSLNNjs.P.call(void 0, _chunkWGWDSLNNjs.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 _chunkVOWICGFQjs = require('./chunk-VOWICGFQ.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, _chunkVOWICGFQjs.da),c=_react.useCallback.call(void 0, o=>{var r;let a=_chunkVOWICGFQjs.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(!_chunkVOWICGFQjs.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 _chunkVOWICGFQjs.Q.call(void 0, _chunkVOWICGFQjs.S.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, _chunkVOWICGFQjs.da),c=_react.useCallback.call(void 0, o=>{var r;let a=_chunkVOWICGFQjs.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(_chunkVOWICGFQjs.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 _chunkVOWICGFQjs.R.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=_chunkVOWICGFQjs.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, _chunkVOWICGFQjs.da),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=_chunkVOWICGFQjs.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(_chunkVOWICGFQjs.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 _chunkVOWICGFQjs.Q.call(void 0, _chunkVOWICGFQjs.S.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 _chunkWGWDSLNNjs = require('./chunk-WGWDSLNN.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=_chunkWGWDSLNNjs.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, _chunkWGWDSLNNjs.ba),n=_chunkWGWDSLNNjs.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, _chunkWGWDSLNNjs.ba),a=_chunkWGWDSLNNjs.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, _chunkWGWDSLNNjs.ba),{config:a}=v();return _react.useCallback.call(void 0, n=>_chunkQTVIWU3Njs.d.call(void 0, void 0,[n],function*({chainId:r}){let o=_chunkWGWDSLNNjs.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 _chunkVOWICGFQjs = require('./chunk-VOWICGFQ.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=_chunkVOWICGFQjs.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, _chunkVOWICGFQjs.da),n=_chunkVOWICGFQjs.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, _chunkVOWICGFQjs.da),a=_chunkVOWICGFQjs.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, _chunkVOWICGFQjs.da),{config:a}=v();return _react.useCallback.call(void 0, n=>_chunkQTVIWU3Njs.d.call(void 0, void 0,[n],function*({chainId:r}){let o=_chunkVOWICGFQjs.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;