@privy-io/react-auth 1.88.4 → 1.89.0-beta-20241008232954

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.
@@ -1100,7 +1100,7 @@ interface PrivyInterface {
1100
1100
  *
1101
1101
  * This method will error if the user is not authenticated or does not have an embedded wallet.
1102
1102
  *
1103
- * If the `config.embeddedWallets.noPromptOnSignature` property is set to true, the signature will
1103
+ * If the `config.embeddedWallets.showWalletUIs` property is set to false, the signature will
1104
1104
  * be computed without prompting the user. Otherwise (the default), Privy will show the user a modal
1105
1105
  * to prompt them for a signature. This can be customized via the {@link SignMessageModalUIOptions}.
1106
1106
  *
@@ -1239,7 +1239,7 @@ interface PrivyInterface {
1239
1239
  * If no `chainId` is specified as part of the {@link UnsignedTransactionRequest}, Privy will default
1240
1240
  * to the embedded wallet's current chain ID.
1241
1241
  *
1242
- * If the `config.embeddedWallets.noPromptOnSignature` property is set to true, the wallet will
1242
+ * If the `config.embeddedWallets.showWalletUIs` property is set to false, the wallet will
1243
1243
  * attempt to send the transaction without prompting the user. Otherwise (the default), Privy
1244
1244
  * will show the user a modal to have them confirm the transaction. This can be customized via
1245
1245
  * the {@link SendTransactionModalUIOptions}.
@@ -1257,7 +1257,7 @@ interface PrivyInterface {
1257
1257
  *
1258
1258
  * This method will error if the user is not authenticated or does not have a solana embedded wallet.
1259
1259
  *
1260
- * If the `config.embeddedWallets.noPromptOnSignature` property is set to true, the wallet will attempt to send
1260
+ * If the `config.embeddedWallets.showWalletUIs` property is set to false, the wallet will attempt to send
1261
1261
  * the transaction without prompting the user. Otherwise (the default), Privy will show the user a modal to have
1262
1262
  * them confirm the transaction. This can be customized via the {@link SendTransactionModalUIOptions}.
1263
1263
  *
@@ -1566,6 +1566,26 @@ interface PrivyEvents {
1566
1566
  linkMethod: LoginMethod;
1567
1567
  }>;
1568
1568
  };
1569
+ update: {
1570
+ /**
1571
+ * Callback that will execute once on a successful updating of an account.
1572
+ * This will run when any of the 'updateAccount' methods are called manually.
1573
+ * @param user {@link User}- the user the account was linked to
1574
+ * @param updateMethod {@link LoginMethod}- the type of updated account
1575
+ * @param updatedAccount - the newly updated account
1576
+ */
1577
+ onSuccess?: (user: User, updateMethod: LoginMethod, updatedAccount: LinkedAccountWithMetadata) => void;
1578
+ /**
1579
+ * Callback that will execute in the case of a non-successful account linking.
1580
+ *
1581
+ * @param error {PrivyErrorCode} - the corresponding error code
1582
+ * @param details.linkMethod {LoginMethod} - the type of (attempted) linked account
1583
+ *
1584
+ */
1585
+ onError?: CallbackError<{
1586
+ linkMethod: LoginMethod;
1587
+ }>;
1588
+ };
1569
1589
  configureMfa: {
1570
1590
  /**
1571
1591
  * Callback that will execute when MFA is required to complete a given action.
@@ -2030,6 +2050,23 @@ declare function useLinkAccount(callbacks?: PrivyEvents['linkAccount']): {
2030
2050
  linkTelegram: () => void;
2031
2051
  };
2032
2052
 
2053
+ /**
2054
+ * Use this hook to update a users account and to attach callbacks
2055
+ * for successful `updateAccount`, and`updateAccount` errors.
2056
+ *
2057
+ * @param callbacks.onSuccess {@link PrivyEvents} callback to execute for after successful account update
2058
+ * @param callbacks.onError {@link PrivyEvents} callback to execute if there is an error during `updatePhone` or `updateEmail`.
2059
+ * @returns updateEmail - opens the Privy modal and prompts the user to update email
2060
+ * @returns updatePhone - opens the Privy modal and prompts the user to update phone number
2061
+ */
2062
+ declare function useUpdateAccount(callbacks?: PrivyEvents['update']): {
2063
+ /**
2064
+ * Opens the Privy modal and prompts the user to update their accont.
2065
+ */
2066
+ updateEmail: () => void;
2067
+ updatePhone: () => void;
2068
+ };
2069
+
2033
2070
  /**
2034
2071
  * Use this hook to connect the user's external wallet, and to attach
2035
2072
  * callbacks after a user successfully connects their wallet, or if there
@@ -2487,4 +2524,4 @@ declare const LoginModal: ({ open }: {
2487
2524
  open: boolean;
2488
2525
  }) => react_jsx_runtime.JSX.Element;
2489
2526
 
2490
- export { type CallbackError, Captcha, ConnectWalletModalOptions, ConnectedWallet, ConnectorManager, CustomAuthFlowState, EIP1193Provider, EthereumWalletConnector, FundWalletConfig, LoginModal, LoginModalOptions, LoginWithCode, MfaMethod, OAuthFlowState, OAuthProviderType, OAuthTokens, OtpFlowState, PasskeyFlowState, PrivyClient, PrivyClientConfig, type PrivyEvents, type PrivyInterface, PrivyProvider, type PrivyProviderProps, PrivyProxyProvider, DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, type SendCodeToEmail, type SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, SiweFlowState, SolanaTransactionReceipt, SupportedSolanaTransaction, TransactionReceipt, UnsignedTransactionRequest, type UseConnectCoinbaseSmartWalletInterface, type UseCustomAuth, type UseFundWalletInterface, type UseLoginWithEmail, type UseLoginWithPasskey, type UseLoginWithSms, type UseOAuthTokens, type UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, addPrivyRpcToChain, addRpcUrlOverrideToChain, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getAccessToken, getEmbeddedConnectedWallet, useConnectCoinbaseSmartWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useExperimentalFarcasterSigner, useFarcasterSigner, useFundWallet, useGuestAccounts, useLinkAccount, useLinkWithSiwe, useLogin, useLoginWithEmail, useLoginWithOAuth, useLoginWithPasskey, useLoginWithSms, useLogout, useMfa, useMfaEnrollment, useModalStatus, useOAuthTokens, usePrivy, useRegisterMfaListener, useSendSolanaTransaction, useSendTransaction, useSetWalletPassword, useSetWalletRecovery, useSignMessage, useSignTypedData, useToken, useWallets };
2527
+ export { type CallbackError, Captcha, ConnectWalletModalOptions, ConnectedWallet, ConnectorManager, CustomAuthFlowState, EIP1193Provider, EthereumWalletConnector, FundWalletConfig, LoginModal, LoginModalOptions, LoginWithCode, MfaMethod, OAuthFlowState, OAuthProviderType, OAuthTokens, OtpFlowState, PasskeyFlowState, PrivyClient, PrivyClientConfig, type PrivyEvents, type PrivyInterface, PrivyProvider, type PrivyProviderProps, PrivyProxyProvider, DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, type SendCodeToEmail, type SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, SiweFlowState, SolanaTransactionReceipt, SupportedSolanaTransaction, TransactionReceipt, UnsignedTransactionRequest, type UseConnectCoinbaseSmartWalletInterface, type UseCustomAuth, type UseFundWalletInterface, type UseLoginWithEmail, type UseLoginWithPasskey, type UseLoginWithSms, type UseOAuthTokens, type UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, addPrivyRpcToChain, addRpcUrlOverrideToChain, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getAccessToken, getEmbeddedConnectedWallet, useConnectCoinbaseSmartWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useExperimentalFarcasterSigner, useFarcasterSigner, useFundWallet, useGuestAccounts, useLinkAccount, useLinkWithSiwe, useLogin, useLoginWithEmail, useLoginWithOAuth, useLoginWithPasskey, useLoginWithSms, useLogout, useMfa, useMfaEnrollment, useModalStatus, useOAuthTokens, usePrivy, useRegisterMfaListener, useSendSolanaTransaction, useSendTransaction, useSetWalletPassword, useSetWalletRecovery, useSignMessage, useSignTypedData, useToken, useUpdateAccount, useWallets };
@@ -191,6 +191,8 @@ declare enum PrivyErrorCode {
191
191
  LINKED_TO_ANOTHER_USER = "linked_to_another_user",
192
192
  CANNOT_LINK_MORE_OF_TYPE = "cannot_link_more_of_type",
193
193
  FAILED_TO_LINK_ACCOUNT = "failed_to_link_account",
194
+ FAILED_TO_UPDATE_ACCOUNT = "failed_to_update_account",
195
+ USER_EXITED_UPDATE_FLOW = "exited_update_flow",
194
196
  ALLOWLIST_REJECTED = "allowlist_rejected",
195
197
  OAUTH_USER_DENIED = "oauth_user_denied",
196
198
  OAUTH_UNEXPECTED = "oauth_unexpected",
@@ -768,7 +770,7 @@ type LoginWithCode = {
768
770
  };
769
771
  declare const EMBEDDED_WALLET_CLIENT_TYPES: readonly ["privy"];
770
772
  type EmbeddedWalletClientType = (typeof EMBEDDED_WALLET_CLIENT_TYPES)[number];
771
- declare const INJECTED_WALLET_CLIENT_TYPES: readonly ["metamask", "phantom", "brave_wallet", "rainbow", "uniswap_wallet_extension", "uniswap_extension", "rabby_wallet", "crypto.com_wallet_extension"];
773
+ declare const INJECTED_WALLET_CLIENT_TYPES: readonly ["metamask", "phantom", "brave_wallet", "rainbow", "uniswap_wallet_extension", "uniswap_extension", "rabby_wallet", "bybit_wallet", "crypto.com_wallet_extension"];
772
774
  type InjectedWalletClientType = (typeof INJECTED_WALLET_CLIENT_TYPES)[number];
773
775
  declare const COINBASE_WALLET_CLIENT_TYPES: readonly ["coinbase_wallet", "coinbase_smart_wallet"];
774
776
  type CoinbaseWalletClientType = (typeof COINBASE_WALLET_CLIENT_TYPES)[number];
@@ -1436,7 +1438,7 @@ type PriceDisplayOptions = {
1436
1438
  };
1437
1439
  type WalletListEntry = 'metamask' | 'coinbase_wallet' | 'rainbow' | 'phantom' | 'zerion' | 'cryptocom' | 'uniswap' | 'okx_wallet' | 'universal_profile'
1438
1440
  /** @deprecated Use `detected_ethereum_wallets` or `detected_solana_wallets` instead */
1439
- | 'detected_wallets' | 'detected_solana_wallets' | 'detected_ethereum_wallets' | 'wallet_connect' | 'rabby_wallet' | 'safe';
1441
+ | 'detected_wallets' | 'detected_solana_wallets' | 'detected_ethereum_wallets' | 'wallet_connect' | 'rabby_wallet' | 'bybit_wallet' | 'safe';
1440
1442
  type NonEmptyArray<T> = [T, ...T[]];
1441
1443
  type LoginMethodOrderOption = 'email' | 'sms' | WalletListEntry | OAuthProviderType | 'farcaster' | 'telegram';
1442
1444
  type ExternalWalletsConfig = {
@@ -1710,18 +1712,28 @@ interface PrivyClientConfig {
1710
1712
  requireUserPasswordOnCreate?: boolean;
1711
1713
  /**
1712
1714
  * @deprecated. Instead, use the server-driven configuration found in the Privy console: https://dashboard.privy.io/apps/YOUR_APP_ID/embedded.
1715
+ * or the client-side 'embeddedWallets.showWalletUIs' configuration.
1713
1716
  * If true, Privy will not prompt or instantiate any UI for embedded wallet signatures and transactions.
1714
1717
  * If false, embedded wallet actions will raise a modal and require user confirmation to proceed.
1715
1718
  *
1716
1719
  * Defaults to false.
1717
1720
  */
1718
1721
  noPromptOnSignature?: boolean;
1722
+ /**
1723
+ * Override any settings for the embedded wallet's UI to show or hide the wallet UIs.
1724
+ *
1725
+ * If true, wallet UIs will always be shown.
1726
+ * If false, wallet UIs will always be hidden.
1727
+ *
1728
+ * If not set, the default behavior will match the server configuration.
1729
+ */
1730
+ showWalletUIs?: boolean;
1719
1731
  /**
1720
1732
  * @experimental
1721
1733
  *
1722
1734
  * **This setting is only honored when using the EIP-1193 Ethereum Provider to interface
1723
1735
  * with the embedded wallet, i.e. using `getEthereumProvider` or `getEthersProvider`.
1724
- * This setting is only honored when used alongside `noPromptOnSignature: true`**
1736
+ * This setting is only honored when used alongside `showWalletUIs: false`**
1725
1737
  *
1726
1738
  * If true, calls to `sendTransaction` will wait for the transaction to be confirmed before resolving.
1727
1739
  * If false, calls to `sendTransaction` will resolve once the transaction has been submitted.
@@ -1732,7 +1744,7 @@ interface PrivyClientConfig {
1732
1744
  * <PrivyProvider
1733
1745
  * config={{
1734
1746
  * embeddedWallets: {
1735
- * noPromptOnSignature: true,
1747
+ * showWalletUIs: false,
1736
1748
  * waitForTransactionConfirmation: false,
1737
1749
  * },
1738
1750
  * }}
@@ -1929,6 +1941,11 @@ type OAuthFlowState = {
1929
1941
  * UI configuration object for the embedded wallet's Sign Message screen
1930
1942
  */
1931
1943
  type SignMessageModalUIOptions = {
1944
+ /**
1945
+ * Whether or not to show wallet UIs for this action. Defaults to the wallet UI setting enabled
1946
+ * for your app in the Privy Dashboard, or `showWalletUIs` in the `embeddedWallets` config.
1947
+ */
1948
+ showWalletUIs?: boolean;
1932
1949
  /**
1933
1950
  * Title for the Sign Message screen. Defaults to 'Sign'.
1934
1951
  */
@@ -2042,6 +2059,11 @@ type ContractUIOptions = {
2042
2059
  * UI customization object for the embedded wallet's Send Transaction screen
2043
2060
  */
2044
2061
  type SendTransactionModalUIOptions = {
2062
+ /**
2063
+ * Whether or not to show wallet UIs for this action. Defaults to the wallet UI setting enabled
2064
+ * for your app in the Privy Dashboard, or `showWalletUIs` in the `embeddedWallets` config.
2065
+ */
2066
+ showWalletUIs?: boolean;
2045
2067
  /**
2046
2068
  * Text to display at top of Send Transaction screen. Defaults to
2047
2069
  * 'Review transaction' or 'Send (insert token symbol)' if transaction
@@ -191,6 +191,8 @@ declare enum PrivyErrorCode {
191
191
  LINKED_TO_ANOTHER_USER = "linked_to_another_user",
192
192
  CANNOT_LINK_MORE_OF_TYPE = "cannot_link_more_of_type",
193
193
  FAILED_TO_LINK_ACCOUNT = "failed_to_link_account",
194
+ FAILED_TO_UPDATE_ACCOUNT = "failed_to_update_account",
195
+ USER_EXITED_UPDATE_FLOW = "exited_update_flow",
194
196
  ALLOWLIST_REJECTED = "allowlist_rejected",
195
197
  OAUTH_USER_DENIED = "oauth_user_denied",
196
198
  OAUTH_UNEXPECTED = "oauth_unexpected",
@@ -768,7 +770,7 @@ type LoginWithCode = {
768
770
  };
769
771
  declare const EMBEDDED_WALLET_CLIENT_TYPES: readonly ["privy"];
770
772
  type EmbeddedWalletClientType = (typeof EMBEDDED_WALLET_CLIENT_TYPES)[number];
771
- declare const INJECTED_WALLET_CLIENT_TYPES: readonly ["metamask", "phantom", "brave_wallet", "rainbow", "uniswap_wallet_extension", "uniswap_extension", "rabby_wallet", "crypto.com_wallet_extension"];
773
+ declare const INJECTED_WALLET_CLIENT_TYPES: readonly ["metamask", "phantom", "brave_wallet", "rainbow", "uniswap_wallet_extension", "uniswap_extension", "rabby_wallet", "bybit_wallet", "crypto.com_wallet_extension"];
772
774
  type InjectedWalletClientType = (typeof INJECTED_WALLET_CLIENT_TYPES)[number];
773
775
  declare const COINBASE_WALLET_CLIENT_TYPES: readonly ["coinbase_wallet", "coinbase_smart_wallet"];
774
776
  type CoinbaseWalletClientType = (typeof COINBASE_WALLET_CLIENT_TYPES)[number];
@@ -1436,7 +1438,7 @@ type PriceDisplayOptions = {
1436
1438
  };
1437
1439
  type WalletListEntry = 'metamask' | 'coinbase_wallet' | 'rainbow' | 'phantom' | 'zerion' | 'cryptocom' | 'uniswap' | 'okx_wallet' | 'universal_profile'
1438
1440
  /** @deprecated Use `detected_ethereum_wallets` or `detected_solana_wallets` instead */
1439
- | 'detected_wallets' | 'detected_solana_wallets' | 'detected_ethereum_wallets' | 'wallet_connect' | 'rabby_wallet' | 'safe';
1441
+ | 'detected_wallets' | 'detected_solana_wallets' | 'detected_ethereum_wallets' | 'wallet_connect' | 'rabby_wallet' | 'bybit_wallet' | 'safe';
1440
1442
  type NonEmptyArray<T> = [T, ...T[]];
1441
1443
  type LoginMethodOrderOption = 'email' | 'sms' | WalletListEntry | OAuthProviderType | 'farcaster' | 'telegram';
1442
1444
  type ExternalWalletsConfig = {
@@ -1710,18 +1712,28 @@ interface PrivyClientConfig {
1710
1712
  requireUserPasswordOnCreate?: boolean;
1711
1713
  /**
1712
1714
  * @deprecated. Instead, use the server-driven configuration found in the Privy console: https://dashboard.privy.io/apps/YOUR_APP_ID/embedded.
1715
+ * or the client-side 'embeddedWallets.showWalletUIs' configuration.
1713
1716
  * If true, Privy will not prompt or instantiate any UI for embedded wallet signatures and transactions.
1714
1717
  * If false, embedded wallet actions will raise a modal and require user confirmation to proceed.
1715
1718
  *
1716
1719
  * Defaults to false.
1717
1720
  */
1718
1721
  noPromptOnSignature?: boolean;
1722
+ /**
1723
+ * Override any settings for the embedded wallet's UI to show or hide the wallet UIs.
1724
+ *
1725
+ * If true, wallet UIs will always be shown.
1726
+ * If false, wallet UIs will always be hidden.
1727
+ *
1728
+ * If not set, the default behavior will match the server configuration.
1729
+ */
1730
+ showWalletUIs?: boolean;
1719
1731
  /**
1720
1732
  * @experimental
1721
1733
  *
1722
1734
  * **This setting is only honored when using the EIP-1193 Ethereum Provider to interface
1723
1735
  * with the embedded wallet, i.e. using `getEthereumProvider` or `getEthersProvider`.
1724
- * This setting is only honored when used alongside `noPromptOnSignature: true`**
1736
+ * This setting is only honored when used alongside `showWalletUIs: false`**
1725
1737
  *
1726
1738
  * If true, calls to `sendTransaction` will wait for the transaction to be confirmed before resolving.
1727
1739
  * If false, calls to `sendTransaction` will resolve once the transaction has been submitted.
@@ -1732,7 +1744,7 @@ interface PrivyClientConfig {
1732
1744
  * <PrivyProvider
1733
1745
  * config={{
1734
1746
  * embeddedWallets: {
1735
- * noPromptOnSignature: true,
1747
+ * showWalletUIs: false,
1736
1748
  * waitForTransactionConfirmation: false,
1737
1749
  * },
1738
1750
  * }}
@@ -1929,6 +1941,11 @@ type OAuthFlowState = {
1929
1941
  * UI configuration object for the embedded wallet's Sign Message screen
1930
1942
  */
1931
1943
  type SignMessageModalUIOptions = {
1944
+ /**
1945
+ * Whether or not to show wallet UIs for this action. Defaults to the wallet UI setting enabled
1946
+ * for your app in the Privy Dashboard, or `showWalletUIs` in the `embeddedWallets` config.
1947
+ */
1948
+ showWalletUIs?: boolean;
1932
1949
  /**
1933
1950
  * Title for the Sign Message screen. Defaults to 'Sign'.
1934
1951
  */
@@ -2042,6 +2059,11 @@ type ContractUIOptions = {
2042
2059
  * UI customization object for the embedded wallet's Send Transaction screen
2043
2060
  */
2044
2061
  type SendTransactionModalUIOptions = {
2062
+ /**
2063
+ * Whether or not to show wallet UIs for this action. Defaults to the wallet UI setting enabled
2064
+ * for your app in the Privy Dashboard, or `showWalletUIs` in the `embeddedWallets` config.
2065
+ */
2066
+ showWalletUIs?: boolean;
2045
2067
  /**
2046
2068
  * Text to display at top of Send Transaction screen. Defaults to
2047
2069
  * 'Review transaction' or 'Send (insert token symbol)' if transaction