@privy-io/expo 0.78.1 → 0.78.3
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.
- package/dist/cards.js +2 -2
- package/dist/{chunk-WCCFBSK7.js → chunk-2INMFYSV.js} +1 -1
- package/dist/chunk-APBCP6B2.js +12 -0
- package/dist/{chunk-XPHUZG6U.js → chunk-MFUJ4B5H.js} +1 -1
- package/dist/esm/cards.js +1 -1
- package/dist/esm/{chunk-WCCFBSK7.js → chunk-2INMFYSV.js} +1 -1
- package/dist/esm/chunk-APBCP6B2.js +12 -0
- package/dist/esm/{chunk-XPHUZG6U.js → chunk-MFUJ4B5H.js} +1 -1
- package/dist/esm/extended-chains.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/passkey.js +1 -1
- package/dist/esm/smart-wallets.js +1 -1
- package/dist/esm/ui.js +1 -1
- package/dist/extended-chains.js +1 -1
- package/dist/index.d.ts +68 -31
- package/dist/index.js +1 -1
- package/dist/passkey.js +1 -1
- package/dist/smart-wallets.js +1 -1
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-7VW6NBHO.js +0 -12
- package/dist/esm/chunk-7VW6NBHO.js +0 -12
package/dist/extended-chains.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkAPBCP6B2js = require('./chunk-APBCP6B2.js');require('./chunk-F7DR7TVR.js');require('./chunk-3HF374LL.js');var _chunkC5WYSLQFjs = require('./chunk-C5WYSLQF.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var f=()=>{let e=_chunkAPBCP6B2js.o.call(void 0, );return _react.useMemo.call(void 0, ()=>({createWallet(n){return _chunkC5WYSLQFjs.e.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=_chunkAPBCP6B2js.o.call(void 0, );return _react.useMemo.call(void 0, ()=>({signRawHash(k){return _chunkC5WYSLQFjs.e.call(void 0, this,arguments,function*({address:n,chainType:s,hash:o}){let l=_chunkAPBCP6B2js.d.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,12 +1,12 @@
|
|
|
1
1
|
import * as Privy from '@privy-io/js-sdk-core';
|
|
2
|
-
import Privy__default, { EmbeddedWalletConfig, DepositConfig, GenerateDepositAddressInput, DepositAddressQuote, GetDepositInput, DepositAddressOrder, WaitForDepositInput, DepositAddressPollingResult, WaitForCompletionInput, CreateCryptoDepositAccountInput, CreateCryptoDepositAccountResponse, CryptoDepositAccountQuoteInput, CryptoDepositAccountQuote, GetCryptoDepositAccountOrderInput, GetCryptoDepositAccountOrderResponse, GetCryptoDepositAccountNextOrderInput, GetCryptoDepositAccountNextOrderResponse, UnsignedTransactionRequest, OnNeedsRecovery, MfaMethod, SessionSignerInput, PrivyEmbeddedWalletProvider, PrivyEmbeddedSolanaWalletProvider, EmbeddedBitcoinWalletProvider, GenerateAuthorizationSignatureInput, GenerateAuthorizationSignatureOutput, UpdateWalletInput, Storage, Chain, OAuthProviderID, PrivyPlugin, Logger } from '@privy-io/js-sdk-core';
|
|
2
|
+
import Privy__default, { EmbeddedWalletConfig, DepositConfig, GenerateDepositAddressInput, DepositAddressQuote, GetDepositInput, DepositAddressOrder, WaitForDepositInput, DepositAddressPollingResult, WaitForCompletionInput, CreateCryptoDepositAccountInput, CreateCryptoDepositAccountResponse, CryptoDepositAccountQuoteInput, CryptoDepositAccountQuote, GetCryptoDepositAccountOrderInput, GetCryptoDepositAccountOrderResponse, GetCryptoDepositAccountNextOrderInput, GetCryptoDepositAccountNextOrderResponse, UnsignedTransactionRequest, OnNeedsRecovery, MfaMethod, OnMfaEnrollmentRequired, OnMfaVerificationRequired, SessionSignerInput, PrivyEmbeddedWalletProvider, PrivyEmbeddedSolanaWalletProvider, EmbeddedBitcoinWalletProvider, GenerateAuthorizationSignatureInput, GenerateAuthorizationSignatureOutput, UpdateWalletInput, Storage, Chain, OAuthProviderID, PrivyPlugin, Logger } from '@privy-io/js-sdk-core';
|
|
3
3
|
export * from '@privy-io/js-sdk-core';
|
|
4
4
|
export { CreateCryptoDepositAccountInput, CreateCryptoDepositAccountResponse, CryptoDepositAccountQuote, CryptoDepositAccountQuoteInput, DataSuffixPlugin, DepositAddressOrder, DepositAddressPollingResult, DepositAddressQuote, DepositConfig, GenerateDepositAddressInput, GetCryptoDepositAccountNextOrderInput, GetCryptoDepositAccountNextOrderResponse, GetCryptoDepositAccountOrderInput, GetCryptoDepositAccountOrderResponse, GetDepositInput, WaitForCompletionInput, WaitForDepositInput, createDataSuffixPlugin as dataSuffix } from '@privy-io/js-sdk-core';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { E as ErrorCallback, a6 as AuthLinkSuccessCallback, a7 as GenerateSiweMessage, a8 as SiweFlowState, A as AuthSuccessCallback, a9 as OtpLinkHookOptions, aa as OtpLinkHookResult, ab as OtpLoginHookOptions, ac as OtpLoginHookResult, ad as FarcasterFlowState, ae as LinkFarcasterInput, af as SubmitFarcasterOptions, ag as LoginWithFarcasterInput, V as EmbeddedWalletState, d as PublicKeyCredentialRequestOptionsJSON, Y as EmbeddedSolanaWalletState, ah as OtpFlowState, O as OAuthFlowState, ai as WalletRecoveryCallbacks, aj as SolanaWalletRecoveryCallbacks, N as RecoveryFlowState, c as PasskeyFlowState } from './types-6515eff0.js';
|
|
7
7
|
export { I as CreateEthereumEmbeddedWalletOpts, H as CreateOrRecoverEmbeddedWalletProps, J as CreateSolanaEmbeddedWalletOpts, Q as CustomAuthFlowState, X as EmbeddedSolanaWalletActions, Z as EmbeddedSolanaWalletStatus, h as EmbeddedWallet, U as EmbeddedWalletActions, W as EmbeddedWalletStatus, L as LinkedAccountWithMetadata, T as MfaConfig, z as PrivyAppleOauthAccount, k as PrivyBitcoinSegwitEmbeddedWalletAccount, l as PrivyBitcoinTaprootEmbeddedWalletAccount, G as PrivyCrossAppWalletAccount, B as PrivyCustomJwtAccount, t as PrivyDiscordOauthAccount, n as PrivyEmailAccount, g as PrivyEmbeddedWalletAccount, p as PrivyEthereumAccount, i as PrivyEthereumEmbeddedWalletAccount, C as PrivyFarcasterAccount, u as PrivyGithubOauthAccount, r as PrivyGoogleOauthAccount, w as PrivyInstagramOauthAccount, f as PrivyLinkedAccount, y as PrivyLinkedInOauthAccount, D as PrivyPasskeyAccount, o as PrivyPhoneAccount, m as PrivySmartWalletAccount, q as PrivySolanaAccount, j as PrivySolanaEmbeddedWalletAccount, v as PrivySpotifyOauthAccount, F as PrivyTelegramAccount, x as PrivyTiktokOauthAccount, s as PrivyTwitterOauthAccount, e as PrivyUser, R as RecoverEthereumEmbeddedWalletOpts, K as RecoverSolanaEmbeddedWalletOpts, M as SetRecoveryProps, a4 as hasError, _ as isConnected, a0 as isConnecting, a3 as isCreating, a1 as isDisconnected, a2 as isNotCreated, $ as isReconnecting, a5 as needsRecovery } from './types-6515eff0.js';
|
|
8
8
|
import * as _privy_io_api_types from '@privy-io/api-types';
|
|
9
|
-
import { User, LinkedAccountEthereumEmbeddedWallet, LinkedAccountSolanaEmbeddedWallet, TransferRequestBody, Wallets, LinkedAccountEmbeddedWallet, AuthenticatedUser } from '@privy-io/api-types';
|
|
9
|
+
import { User, LinkedAccountEthereumEmbeddedWallet, LinkedAccountSolanaEmbeddedWallet, TransferRequestBody, Wallets, SwapRequestBody, LinkedAccountEmbeddedWallet, AuthenticatedUser } from '@privy-io/api-types';
|
|
10
10
|
export { LinkedAccount, LinkedAccountBitcoinSegwitEmbeddedWallet, LinkedAccountBitcoinTaprootEmbeddedWallet, LinkedAccountEmbeddedWallet, LinkedAccountEthereumEmbeddedWallet, LinkedAccountSmartWallet, LinkedAccountSolanaEmbeddedWallet, User } from '@privy-io/api-types';
|
|
11
11
|
import { TypedDataDefinition, SignedAuthorization } from 'viem';
|
|
12
12
|
import { EncryptedAuthorizationKeyResponse } from '@privy-io/routes';
|
|
@@ -807,42 +807,44 @@ interface UseCreateGuestAccount {
|
|
|
807
807
|
declare const useCreateGuestAccount: (opts?: UseCreateGuestAccountOptions) => UseCreateGuestAccount;
|
|
808
808
|
|
|
809
809
|
/**
|
|
810
|
-
*
|
|
811
|
-
*
|
|
812
|
-
*
|
|
813
|
-
*
|
|
814
|
-
*
|
|
815
|
-
*
|
|
816
|
-
* @param callbacks
|
|
817
|
-
*
|
|
818
|
-
*
|
|
819
|
-
*
|
|
820
|
-
* MFA has been completed.
|
|
810
|
+
* Register handlers for MFA errors.
|
|
811
|
+
* Mount one owner per enrollment or verification handler;
|
|
812
|
+
* competing hook instances throw a configuration error.
|
|
813
|
+
*
|
|
814
|
+
* @param callbacks.onMfaRequired Opens verification UI when the wallet proxy requests MFA.
|
|
815
|
+
* This notification does not complete verification or register a verification error handler.
|
|
816
|
+
* @param callbacks.onMfaVerificationRequired Handles a verification requirement.
|
|
817
|
+
* Await verification before returning, or reject to cancel or fail the wallet operation.
|
|
818
|
+
* @param callbacks.onMfaEnrollmentRequired Handles an enrollment requirement.
|
|
819
|
+
* Return `{user}` with the updated user after enrollment, or reject to cancel or fail.
|
|
821
820
|
*
|
|
822
821
|
* @example
|
|
823
|
-
*
|
|
824
|
-
*
|
|
822
|
+
* import {useMfa, usePrivy, useRegisterMfaListener} from '@privy-io/expo';
|
|
823
|
+
* import {useMfaEnrollmentUI} from '@privy-io/expo/ui';
|
|
824
|
+
*
|
|
825
|
+
* const {prompt} = useMfa();
|
|
826
|
+
* const {init: initEnrollment} = useMfaEnrollmentUI();
|
|
827
|
+
* const {refreshUser} = usePrivy();
|
|
825
828
|
*
|
|
826
|
-
* // Prompt user to select from their enabled MFA methods
|
|
827
829
|
* useRegisterMfaListener({
|
|
828
|
-
* onMfaRequired:
|
|
829
|
-
* setMfaMethods(methods)
|
|
830
|
+
* onMfaRequired: (methods) => {
|
|
831
|
+
* setMfaMethods(methods);
|
|
830
832
|
* setIsMfaDialogOpen(true);
|
|
831
833
|
* },
|
|
834
|
+
* onMfaVerificationRequired: async () => {
|
|
835
|
+
* await prompt();
|
|
836
|
+
* },
|
|
837
|
+
* onMfaEnrollmentRequired: async () => {
|
|
838
|
+
* await initEnrollment({mfaMethods: ['totp', 'sms']});
|
|
839
|
+
* return await refreshUser();
|
|
840
|
+
* },
|
|
832
841
|
* });
|
|
833
|
-
*
|
|
834
|
-
* // Within MFA modal allow the user to select an MFA method
|
|
835
|
-
* <MFAModal
|
|
836
|
-
* mfaMethods={mfaMethods}
|
|
837
|
-
* isOpen={isMfaDialogOpen}
|
|
838
|
-
* setIsOpen={setIsMfaDialogOpen}
|
|
839
|
-
* />
|
|
840
|
-
*
|
|
841
|
-
* See `useMfa` for how to execute the MFA flow within Privy in your App.
|
|
842
842
|
*/
|
|
843
|
-
declare
|
|
844
|
-
onMfaRequired
|
|
845
|
-
|
|
843
|
+
declare const useRegisterMfaListener: ({ onMfaRequired, onMfaEnrollmentRequired, onMfaVerificationRequired, }: {
|
|
844
|
+
onMfaRequired?: (mfaMethods: MfaMethod[]) => void | Promise<void>;
|
|
845
|
+
onMfaEnrollmentRequired?: OnMfaEnrollmentRequired;
|
|
846
|
+
onMfaVerificationRequired?: OnMfaVerificationRequired;
|
|
847
|
+
}) => void;
|
|
846
848
|
|
|
847
849
|
interface UseMfa {
|
|
848
850
|
init(args: {
|
|
@@ -1427,6 +1429,41 @@ interface UseTransferInterface {
|
|
|
1427
1429
|
}
|
|
1428
1430
|
declare const useTransfer: () => UseTransferInterface;
|
|
1429
1431
|
|
|
1432
|
+
interface UseSwapInterface {
|
|
1433
|
+
/**
|
|
1434
|
+
* Initiates a Wallet API token swap. Resolves as soon as the swap action is
|
|
1435
|
+
* created — the returned action's `status` is `'pending'`. This does not wait for the
|
|
1436
|
+
* swap to reach a terminal status.
|
|
1437
|
+
* @param walletId The ID of the wallet to swap from.
|
|
1438
|
+
* @param params The swap request parameters.
|
|
1439
|
+
* @returns The created swap action.
|
|
1440
|
+
*/
|
|
1441
|
+
swap: (walletId: string, params: SwapRequestBody) => Promise<Wallets.Actions.SwapActionResponse>;
|
|
1442
|
+
}
|
|
1443
|
+
declare const useSwap: () => UseSwapInterface;
|
|
1444
|
+
|
|
1445
|
+
interface UseEarnInterface {
|
|
1446
|
+
/**
|
|
1447
|
+
* Initiates a Wallet API earn deposit. Resolves as soon as the deposit action is
|
|
1448
|
+
* created — the returned action's `status` is `'pending'`. This does not wait for the
|
|
1449
|
+
* deposit to reach a terminal status.
|
|
1450
|
+
* @param walletId The ID of the wallet to deposit from.
|
|
1451
|
+
* @param params The earn deposit request parameters.
|
|
1452
|
+
* @returns The created earn deposit action.
|
|
1453
|
+
*/
|
|
1454
|
+
deposit: (walletId: string, params: Wallets.Actions.EarnDepositRequestBody) => Promise<Wallets.Actions.EarnDepositActionResponse>;
|
|
1455
|
+
/**
|
|
1456
|
+
* Initiates a Wallet API earn withdrawal. Resolves as soon as the withdraw action is
|
|
1457
|
+
* created — the returned action's `status` is `'pending'`. This does not wait for the
|
|
1458
|
+
* withdrawal to reach a terminal status.
|
|
1459
|
+
* @param walletId The ID of the wallet to withdraw to.
|
|
1460
|
+
* @param params The earn withdraw request parameters.
|
|
1461
|
+
* @returns The created earn withdraw action.
|
|
1462
|
+
*/
|
|
1463
|
+
withdraw: (walletId: string, params: Wallets.Actions.EarnWithdrawRequestBody) => Promise<Wallets.Actions.EarnWithdrawActionResponse>;
|
|
1464
|
+
}
|
|
1465
|
+
declare const useEarn: () => UseEarnInterface;
|
|
1466
|
+
|
|
1430
1467
|
/** Methods for updating a wallet through the Wallet API. */
|
|
1431
1468
|
interface UseUpdateWalletInterface {
|
|
1432
1469
|
/**
|
|
@@ -1897,4 +1934,4 @@ declare const useMigrateWallets: () => {
|
|
|
1897
1934
|
}>;
|
|
1898
1935
|
};
|
|
1899
1936
|
|
|
1900
|
-
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, UseHeadlessCryptoDepositInterface, UseHeadlessDelegatedActionsInterface, UseImportWallet, 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, UseStoredUsers, UseSwitchUser, UseTransferInterface, UseUnlinkEmailOptions, UseUnlinkFarcaster, UseUnlinkFarcasterOptions, UseUnlinkOAuth, UseUnlinkPasskey, UseUnlinkWallet, UseUnlinkWalletOptions, UseUpdateEmailInterface, UseUpdatePhoneInterface, UseUpdateWalletInterface, UseWalletActionsInterface, createPrivyClient, getAccessToken, useAcceptTerms, useAuthorizationSignature, useCreateGuestAccount, useDepositAddress, useEmbeddedBitcoinWallet, useEmbeddedEthereumWallet, useEmbeddedSolanaWallet, useEmbeddedWallet, useEmbeddedWalletStateChange, useGetEncryptedAuthorizationKey, useHeadlessCryptoDeposit, useHeadlessDelegatedActions, useIdentityToken, useImportWallet, 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, useStoredUsers, useSwitchUser, useTransfer, useUnlinkEmail, useUnlinkFarcaster, useUnlinkOAuth, useUnlinkPasskey, useUnlinkWallet, useUpdateEmail, useUpdatePhone, useUpdateWallet, useWalletActions };
|
|
1937
|
+
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, UseEarnInterface, UseGetEncryptedAuthorizationKeyInterface, UseHeadlessCryptoDepositInterface, UseHeadlessDelegatedActionsInterface, UseImportWallet, 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, UseStoredUsers, UseSwapInterface, UseSwitchUser, UseTransferInterface, UseUnlinkEmailOptions, UseUnlinkFarcaster, UseUnlinkFarcasterOptions, UseUnlinkOAuth, UseUnlinkPasskey, UseUnlinkWallet, UseUnlinkWalletOptions, UseUpdateEmailInterface, UseUpdatePhoneInterface, UseUpdateWalletInterface, UseWalletActionsInterface, createPrivyClient, getAccessToken, useAcceptTerms, useAuthorizationSignature, useCreateGuestAccount, useDepositAddress, useEarn, useEmbeddedBitcoinWallet, useEmbeddedEthereumWallet, useEmbeddedSolanaWallet, useEmbeddedWallet, useEmbeddedWalletStateChange, useGetEncryptedAuthorizationKey, useHeadlessCryptoDeposit, useHeadlessDelegatedActions, useIdentityToken, useImportWallet, 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, useStoredUsers, useSwap, useSwitchUser, useTransfer, useUnlinkEmail, useUnlinkFarcaster, useUnlinkOAuth, useUnlinkPasskey, useUnlinkWallet, useUpdateEmail, useUpdatePhone, useUpdateWallet, useWalletActions };
|
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
|
|
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 _chunk2INMFYSVjs = require('./chunk-2INMFYSV.js');var _chunkAPBCP6B2js = require('./chunk-APBCP6B2.js');var _chunkF7DR7TVRjs = require('./chunk-F7DR7TVR.js');require('./chunk-3HF374LL.js');var _chunkC5WYSLQFjs = require('./chunk-C5WYSLQF.js');var _jssdkcore = require('@privy-io/js-sdk-core'); _createStarExport(_jssdkcore);var _react = require('react'); var _react2 = _interopRequireDefault(_react);var Xt=({loading:t,error:e,unauthenticated:o,children:i})=>{let{isReady:u,error:p}=_chunkAPBCP6B2js.ca.call(void 0, ),U=_chunkAPBCP6B2js.g.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 U?_react2.default.createElement(_react2.default.Fragment,null,i):_react2.default.createElement(_react2.default.Fragment,null,o)};function g(t){return _chunk2INMFYSVjs.a.call(void 0, t)}function F(t){let{state:e,start:o}=_chunk2INMFYSVjs.a.call(void 0, _chunkC5WYSLQFjs.c.call(void 0, _chunkC5WYSLQFjs.b.call(void 0, {},t),{action:"link"}));return{state:e,link:o}}var H=t=>{let{client:e}=_react.useContext.call(void 0, _chunkAPBCP6B2js.pa),o=_react.useRef.call(void 0, t);return _react.useEffect.call(void 0, ()=>{o.current=t},[t]),{unlinkOAuth:_react.useCallback.call(void 0, U=>_chunkC5WYSLQFjs.e.call(void 0, void 0,[U],function*({provider:u,subject:p}){var n,A,s,O;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 c=_chunkAPBCP6B2js.h.call(void 0, h);throw(O=(s=o.current)==null?void 0:s.onError)==null||O.call(s,c),c}}),[e.auth.oauth])}};var D=t=>{let{client:e}=_react.useContext.call(void 0, _chunkAPBCP6B2js.pa),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 = Xt; exports.PrivyContext = _chunkAPBCP6B2js.pa; exports.PrivyProvider = _chunkAPBCP6B2js.ra; exports.SecureStorageAdapter = _chunkF7DR7TVRjs.c; exports.createPrivyClient = _chunkAPBCP6B2js.l; exports.dataSuffix = _jssdkcore.createDataSuffixPlugin; exports.getAccessToken = _chunkAPBCP6B2js.qa; 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 = _chunkAPBCP6B2js.da; exports.useAuthorizationSignature = _chunkAPBCP6B2js.ea; exports.useCreateGuestAccount = _chunkAPBCP6B2js.S; exports.useDepositAddress = _chunkAPBCP6B2js.C; exports.useEarn = _chunkAPBCP6B2js.ja; exports.useEmbeddedBitcoinWallet = _chunkAPBCP6B2js.ba; exports.useEmbeddedEthereumWallet = _chunkAPBCP6B2js.$; exports.useEmbeddedSolanaWallet = _chunkAPBCP6B2js.aa; exports.useEmbeddedWallet = _chunkAPBCP6B2js.P; exports.useEmbeddedWalletStateChange = _chunkAPBCP6B2js.Q; exports.useGetEncryptedAuthorizationKey = _chunkAPBCP6B2js.fa; exports.useHeadlessCryptoDeposit = _chunkAPBCP6B2js.D; exports.useHeadlessDelegatedActions = _chunkAPBCP6B2js.B; exports.useIdentityToken = _chunkAPBCP6B2js.R; exports.useImportWallet = _chunkAPBCP6B2js._; exports.useLinkEmail = _chunkAPBCP6B2js.s; exports.useLinkSMS = _chunkAPBCP6B2js.v; exports.useLinkWithCrossApp = _chunkAPBCP6B2js.J; exports.useLinkWithFarcaster = _chunkAPBCP6B2js.x; exports.useLinkWithOAuth = F; exports.useLinkWithSiwe = _chunkAPBCP6B2js.m; exports.useLinkWithSiws = _chunkAPBCP6B2js.p; exports.useLoginWithCrossApp = _chunkAPBCP6B2js.I; exports.useLoginWithEmail = _chunkAPBCP6B2js.u; exports.useLoginWithFarcaster = _chunkAPBCP6B2js.z; exports.useLoginWithFarcasterV2 = _chunkAPBCP6B2js.A; exports.useLoginWithOAuth = _chunk2INMFYSVjs.b; exports.useLoginWithSMS = _chunkAPBCP6B2js.w; exports.useLoginWithSiwe = _chunkAPBCP6B2js.n; exports.useLoginWithSiws = _chunkAPBCP6B2js.q; exports.useMfa = _chunkAPBCP6B2js.X; exports.useMfaEnrollment = _chunkAPBCP6B2js.Y; exports.useMigrateWallets = _chunkAPBCP6B2js.oa; exports.useOAuthFlow = g; exports.useOAuthTokens = D; exports.useOnNeedsRecovery = _chunkAPBCP6B2js.i; exports.usePrivy = _chunkAPBCP6B2js.ca; exports.usePrivyClient = _chunkAPBCP6B2js.o; exports.useRecoverEmbeddedWallet = _chunkAPBCP6B2js.O; exports.useRegisterMfaListener = _chunkAPBCP6B2js.T; exports.useSendTransactionWithCrossApp = _chunkAPBCP6B2js.M; exports.useSessionSigners = _chunkAPBCP6B2js.E; exports.useSetEmbeddedWalletRecovery = _chunkAPBCP6B2js.N; exports.useSign7702Authorization = _chunkAPBCP6B2js.ga; exports.useSignMessageWithCrossApp = _chunkAPBCP6B2js.K; exports.useSignTypedDataWithCrossApp = _chunkAPBCP6B2js.L; exports.useSigners = _chunkAPBCP6B2js.F; exports.useStoredUsers = _chunkAPBCP6B2js.ma; exports.useSwap = _chunkAPBCP6B2js.ia; exports.useSwitchUser = _chunkAPBCP6B2js.na; exports.useTransfer = _chunkAPBCP6B2js.ha; exports.useUnlinkEmail = _chunkAPBCP6B2js.t; exports.useUnlinkFarcaster = _chunkAPBCP6B2js.y; exports.useUnlinkOAuth = H; exports.useUnlinkPasskey = _chunkAPBCP6B2js.Z; exports.useUnlinkWallet = _chunkAPBCP6B2js.r; exports.useUpdateEmail = _chunkAPBCP6B2js.G; exports.useUpdatePhone = _chunkAPBCP6B2js.H; exports.useUpdateWallet = _chunkAPBCP6B2js.ka; exports.useWalletActions = _chunkAPBCP6B2js.la;
|
package/dist/passkey.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var _chunkAPBCP6B2js = require('./chunk-APBCP6B2.js');require('./chunk-F7DR7TVR.js');require('./chunk-3HF374LL.js');var _chunkC5WYSLQFjs = require('./chunk-C5WYSLQF.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var Y=e=>{let{client:a,passkeyState:d,setPasskeyState:s}=_react.useContext.call(void 0, _chunkAPBCP6B2js.pa),c=_react.useCallback.call(void 0, o=>{var n;let t=_chunkAPBCP6B2js.h.call(void 0, o);return s({status:"error",error:t}),(n=e==null?void 0:e.onError)==null||n.call(e,t),t},[e==null?void 0:e.onError]);return{linkWithPasskey:_react.useCallback.call(void 0, n=>_chunkC5WYSLQFjs.e.call(void 0, void 0,[n],function*({relyingParty:o,extra_options:t}){var u;try{if(!_chunkAPBCP6B2js.d.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:k}=yield a.auth.passkey.generateRegistrationOptions(o);s({status:"awaiting-passkey"});let y=yield _chunkAPBCP6B2js.U.call(void 0, _chunkAPBCP6B2js.W.call(void 0, k),t);s({status:"submitting-response"});let{user:m}=yield a.auth.passkey.linkWithPasskey(y,o);return s({status:"done"}),(u=e==null?void 0:e.onSuccess)==null||u.call(e,m),m}catch(r){throw c(r)}}),[a,c,e==null?void 0:e.onSuccess]),state:d}};var ie=e=>{let{client:a,passkeyState:d,setPasskeyState:s}=_react.useContext.call(void 0, _chunkAPBCP6B2js.pa),c=_react.useCallback.call(void 0, o=>{var n;let t=_chunkAPBCP6B2js.h.call(void 0, o);return s({status:"error",error:t}),(n=e==null?void 0:e.onError)==null||n.call(e,t),t},[e==null?void 0:e.onError]);return{loginWithPasskey:_react.useCallback.call(void 0, n=>_chunkC5WYSLQFjs.e.call(void 0, void 0,[n],function*({relyingParty:o,extra_options:t}){var u,r,k,y;try{if(_chunkAPBCP6B2js.d.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 a.auth.passkey.generateAuthenticationOptions(o);s({status:"awaiting-passkey"});let f=yield _chunkAPBCP6B2js.V.call(void 0, {challenge:i.challenge,rpId:i.rp_id,extensions:{appid:(u=i.extensions)==null?void 0:u.app_id,credProps:(r=i.extensions)==null?void 0:r.cred_props,hmacCreateSecret:(k=i.extensions)==null?void 0:k.hmac_create_secret},timeout:i.timeout,allowCredentials:i.allow_credentials,userVerification:i.user_verification},t);s({status:"submitting-response"});let l=_chunkAPBCP6B2js.a.call(void 0, ),C=yield a.auth.passkey.loginWithPasskey(f,i.challenge,o,{embedded:l==null?void 0:l.embedded});return s({status:"done"}),(y=e==null?void 0:e.onSuccess)==null||y.call(e,C.user,C.is_new_user),C.user}catch(m){throw c(m)}}),[a,c,e==null?void 0:e.onSuccess]),state:d}};var ge=e=>{let{client:a,passkeyState:d,setPasskeyState:s}=_react.useContext.call(void 0, _chunkAPBCP6B2js.pa),c=_react.useRef.call(void 0, e);_react.useEffect.call(void 0, ()=>{c.current=e},[e]);let S=_react.useCallback.call(void 0, t=>{var u,r;let n=_chunkAPBCP6B2js.h.call(void 0, t);return s({status:"error",error:n}),(r=(u=c.current)==null?void 0:u.onError)==null||r.call(u,n),n},[s]);return{signupWithPasskey:_react.useCallback.call(void 0, u=>_chunkC5WYSLQFjs.e.call(void 0, void 0,[u],function*({relyingParty:t,extra_options:n}){var r,k;try{if(_chunkAPBCP6B2js.d.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:m}=yield a.auth.passkey.generateSignupOptions(t);s({status:"awaiting-passkey"});let i=yield _chunkAPBCP6B2js.U.call(void 0, _chunkAPBCP6B2js.W.call(void 0, m),n);s({status:"submitting-response"});let f=_chunkAPBCP6B2js.a.call(void 0, ),l=yield a.auth.passkey.signupWithPasskey(i,t,{embedded:f==null?void 0:f.embedded});return s({status:"done"}),(k=(r=c.current)==null?void 0:r.onSuccess)==null||k.call(r,l.user,l.is_new_user),{user:l.user}}catch(y){throw S(y)}}),[a.auth.passkey,S,s]),state:d}};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 = Y; exports.useLoginWithPasskey = ie; exports.useSignupWithPasskey = ge;
|
package/dist/smart-wallets.js
CHANGED
|
@@ -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
|
|
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 _chunkAPBCP6B2js = require('./chunk-APBCP6B2.js');require('./chunk-F7DR7TVR.js');require('./chunk-3HF374LL.js');var _chunkC5WYSLQFjs = require('./chunk-C5WYSLQF.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 x=w=>_chunkC5WYSLQFjs.e.call(void 0, void 0,[w],function*({chain:t,privyAppId:e,user:a,embeddedWallet:r,smartWalletsConfig:n,client:i,dataSuffix:c}){if(!(n!=null&&n.enabled)||!r||!_chunkQSWCX5XIjs.a.call(void 0, r))return;let s=yield i.embeddedWallet.getEthereumProvider({wallet:r.account,entropyId:r.account.address,entropyIdVerifier:"ethereum-address-verifier",onMfaEnrollmentRequired:y=>_chunkC5WYSLQFjs.e.call(void 0, void 0,null,function*(){return yield _chunkAPBCP6B2js.b.call(void 0, )(y)}),onMfaVerificationRequired:y=>_chunkC5WYSLQFjs.e.call(void 0, void 0,null,function*(){return yield _chunkAPBCP6B2js.c.call(void 0, )(y)})}),o=n==null?void 0:n.configured_networks.find(y=>y.chain_id===`eip155:${t.id}`);if(!o)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 l=_jssdkcore.getUserSmartWallet.call(void 0, a),C=l?l.smart_wallet_type:n.smart_wallet_type,W=l?l.smart_wallet_version:n.smart_wallet_version,V=_jssdkcore.getJsonRpcEndpointFromChain.call(void 0, t,{rpcUrls:[]},e),Y=_viem.createPublicClient.call(void 0, {chain:t,transport:_viem.http.call(void 0, V)}),A=yield _smartwallets.signerToSmartAccountClient.call(void 0, {owner:s,smartWalletType:C,smartWalletVersion:W,chain:t,publicClient:Y,paymasterContext:tt(o.paymaster_url,o.paymaster_context),bundlerUrl:o.bundler_url,paymasterUrl:o.paymaster_url});if(!A)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 K(A,c)});function K(t,e){return e?t.extend(a=>({sendTransaction:r=>a.sendTransaction(_chunkC5WYSLQFjs.c.call(void 0, _chunkC5WYSLQFjs.b.call(void 0, {},r),{dataSuffix:e}))})):t}var z=/paymaster\.biconomy\.io\/api/i;function Q(t){return z.test(t)}var Z={mode:"SPONSORED",calculateGasLimits:!0,expiryDuration:300,sponsorshipInfo:{webhookData:{},smartAccountInfo:{name:"BICONOMY",version:"2.0.0"}}},tt=(t,e)=>{if(t&&Q(t))return Z;if(e&&e.policy_id)return{policyId:e.policy_id}};var R=3,rt=500,nt= exports.SmartWalletsProvider =({children:t})=>_react2.default.createElement(lt,null,_react2.default.createElement(ot,null,_react2.default.createElement(st,null,t))),$=_react.createContext.call(void 0, {config:void 0}),b=()=>{let{config:t}=_react.useContext.call(void 0, $);return{config:t}},G=_react.createContext.call(void 0, {smartWalletClient:void 0}),at=()=>{let{smartWalletClient:t}=_react.useContext.call(void 0, G);return{smartWalletClient:t}},B=_react.createContext.call(void 0, {client:void 0}),it= exports.useSmartWallets =()=>{let{client:t}=_react.useContext.call(void 0, B),e=ct();return{client:t,getClientForChain:e}},lt=({children:t})=>{let[e,a]=_react.useState.call(void 0, void 0),r=_chunkAPBCP6B2js.o.call(void 0, );return _react.useEffect.call(void 0, ()=>{!e&&r&&(()=>_chunkC5WYSLQFjs.e.call(void 0, void 0,null,function*(){try{if(!r){console.warn("No client found");return}let i=yield r.app.getSmartWalletConfig();a(i)}catch(i){console.warn("Error generating smart wallet config: ",i)}}))()},[r,e]),_react2.default.createElement($.Provider,{value:{config:e}},t)},ot=({children:t})=>{let{config:e}=b(),{client:a,wallet:r}=_react.useContext.call(void 0, _chunkAPBCP6B2js.pa),n=_chunkAPBCP6B2js.f.call(void 0, ),[i,c]=_react.useState.call(void 0, );return _react.useEffect.call(void 0, ()=>{(()=>_chunkC5WYSLQFjs.e.call(void 0, void 0,null,function*(){var l;if(!n&&i&&c(void 0),!(e!=null&&e.enabled)||!n||r.status!=="connected"||n&&i&&r.status==="connected")return;let s=a.embeddedWallet.chains.find(C=>e.configured_networks.map(W=>W.chain_id).includes(`eip155:${C.id}`));if(!s)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 o=yield x({chain:s,privyAppId:a.app.appId,user:n,embeddedWallet:r,smartWalletsConfig:e,client:a,dataSuffix:(l=_jssdkcore.getDataSuffixPlugin.call(void 0, a.plugins))==null?void 0:l.suffix});if(!o)throw new (0, _jssdkcore.PrivyClientError)({error:"Could not create smart wallet client",code:"smart_wallet_client_error"});c(o)}))()},[!!(e!=null&&e.enabled),!!a,!!n,r.status]),_react2.default.createElement(G.Provider,{value:{smartWalletClient:i}},t)},st=({children:t})=>{let{client:e,wallet:a}=_react.useContext.call(void 0, _chunkAPBCP6B2js.pa),r=_chunkAPBCP6B2js.f.call(void 0, ),{smartWalletClient:n}=at(),{config:i}=b();return _react.useEffect.call(void 0, ()=>{let c=!1;return(()=>_chunkC5WYSLQFjs.e.call(void 0, void 0,null,function*(){var m;if(!(!n||!r||_jssdkcore.getUserSmartWallet.call(void 0, r)||!(i!=null&&i.enabled)||a.status!=="connected"))for(let s=0;s<R;s++){if(c||_jssdkcore.getUserSmartWallet.call(void 0, (m=_chunkAPBCP6B2js.d.call(void 0, ))!=null?m:r))return;let o=!1;for(let l=0;l<5;l++){if(c)return;if(yield e.embeddedWallet.ping(rt)){o=!0;break}yield _chunkAPBCP6B2js.k.call(void 0, 200*_chunkC5WYSLQFjs.a.call(void 0, 2,l))}if(o)try{let{message:l}=yield e.auth.smartWallet.init({address:n.account.address,chainId:`eip155:${n.chain.id}`}),C=yield n.signMessage({message:l});yield e.auth.smartWallet.link(l,C,i.smart_wallet_type,i.smart_wallet_version);return}catch(l){s===R-1?console.error("Error creating smart wallet:",l):yield _chunkAPBCP6B2js.k.call(void 0, 500*_chunkC5WYSLQFjs.a.call(void 0, 2,s))}}}))(),()=>{c=!0}},[!!n,!!r,!!_jssdkcore.getUserSmartWallet.call(void 0, r),i,a.status]),_react2.default.createElement(B.Provider,{value:{client:_jssdkcore.getUserSmartWallet.call(void 0, r)?n:void 0}},t)},ct=()=>{let{client:t,wallet:e}=_react.useContext.call(void 0, _chunkAPBCP6B2js.pa),{config:a}=b();return _react.useCallback.call(void 0, n=>_chunkC5WYSLQFjs.e.call(void 0, void 0,[n],function*({chainId:r}){var s;let i=_chunkAPBCP6B2js.d.call(void 0, );if(!i)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 w=t.embeddedWallet.chains.find(o=>o.id===r);if(!w)throw new (0, _jssdkcore.PrivyClientError)({error:`Could not find chain with id: ${r}`,code:"chain_not_supported"});let m=yield x({chain:w,privyAppId:t.app.appId,user:i,embeddedWallet:e,smartWalletsConfig:a,client:t,dataSuffix:(s=_jssdkcore.getDataSuffixPlugin.call(void 0, t.plugins))==null?void 0:s.suffix});if(!m)throw new (0, _jssdkcore.PrivyClientError)({error:`Could not create smart wallet client for chain ${r}`,code:"smart_wallet_client_error"});return m}),[a,e,t])};exports.SmartWalletsProvider = nt; exports.useSmartWallets = it;
|
package/dist/ui.d.ts
CHANGED
|
@@ -22,10 +22,10 @@ type PrivyElementsConfig = {
|
|
|
22
22
|
};
|
|
23
23
|
mfa?: {
|
|
24
24
|
/**
|
|
25
|
-
* Enables MFA verification via Privy-managed UIs
|
|
25
|
+
* Enables automatic MFA verification and enrollment prompts via Privy-managed UIs.
|
|
26
|
+
* Enrollment offers the app's configured MFA methods supported by the SDK.
|
|
26
27
|
*
|
|
27
|
-
* Avoid
|
|
28
|
-
* duplicating MFA verification UIs.
|
|
28
|
+
* Avoid registering custom MFA handlers with `useRegisterMfaListener` when this option is enabled.
|
|
29
29
|
*
|
|
30
30
|
* @default false
|
|
31
31
|
*/
|