@privy-io/react-auth 3.6.1 → 3.7.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.
- package/dist/cjs/{EmbeddedWalletConnectingScreen-DmH8RMAY.js → EmbeddedWalletConnectingScreen-JRafXI8d.js} +9 -9
- package/dist/cjs/{SignRequestScreen-DELDI80-.js → SignRequestScreen-Dy02euV9.js} +1 -1
- package/dist/cjs/abstract-smart-wallets.js +1 -1
- package/dist/cjs/{events-context-CJ1M8bnZ.js → events-context-7-Gs8c_9.js} +1 -1
- package/dist/cjs/extended-chains.js +1 -1
- package/dist/cjs/index.js +6 -7
- package/dist/cjs/internal.js +1 -1
- package/dist/cjs/{smart-wallets-N48ncX_X.js → smart-wallets-DaqaXBrW.js} +1 -1
- package/dist/cjs/smart-wallets.js +1 -1
- package/dist/cjs/solana.js +1 -1
- package/dist/cjs/ui.js +1 -1
- package/dist/cjs/{use-export-wallet-DT6dr7Z0.js → use-export-wallet-Cz8MVlvJ.js} +1 -1
- package/dist/cjs/{useActiveWallet-u2yYoS5O.js → useActiveWallet-C5D3a-je.js} +1 -1
- package/dist/cjs/{usePrivy-BiM8CWww.js → usePrivy-BdYU4BZI.js} +1 -1
- package/dist/dts/index.d.mts +89 -2
- package/dist/dts/index.d.ts +89 -2
- package/dist/esm/{EmbeddedWalletConnectingScreen-DTl397rT.mjs → EmbeddedWalletConnectingScreen-D50stmJi.mjs} +10 -10
- package/dist/esm/{SignRequestScreen-Ca9hEGyq.mjs → SignRequestScreen-D9o7VhNz.mjs} +1 -1
- package/dist/esm/abstract-smart-wallets.mjs +1 -1
- package/dist/esm/{events-context-DGSLy4O3.mjs → events-context-ClaboIDc.mjs} +1 -1
- package/dist/esm/extended-chains.mjs +1 -1
- package/dist/esm/index.mjs +5 -6
- package/dist/esm/internal.mjs +1 -1
- package/dist/esm/{smart-wallets-p7WscfjP.mjs → smart-wallets-BXT3GZwg.mjs} +1 -1
- package/dist/esm/smart-wallets.mjs +1 -1
- package/dist/esm/solana.mjs +1 -1
- package/dist/esm/ui.mjs +2 -2
- package/dist/esm/{use-export-wallet-CwTc9_pt.mjs → use-export-wallet-DTiEdSYz.mjs} +1 -1
- package/dist/esm/{useActiveWallet-D2LLcdLS.mjs → useActiveWallet-B8DSbnuu.mjs} +1 -1
- package/dist/esm/{usePrivy-BDEzTFuZ.mjs → usePrivy-BCcRF869.mjs} +1 -1
- package/package.json +5 -4
package/dist/dts/index.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ import { PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/browser';
|
|
|
17
17
|
import { FetchOptions } from 'ofetch';
|
|
18
18
|
import { P as PrivyEvents } from './events-context-CCElA92Y.js';
|
|
19
19
|
export { C as CallbackError } from './events-context-CCElA92Y.js';
|
|
20
|
+
import { PaymentRequirementsSelector } from 'x402/client';
|
|
21
|
+
import { X402Config } from 'x402/types';
|
|
20
22
|
import * as viem_accounts from 'viem/accounts';
|
|
21
23
|
import '@coinbase/wallet-sdk';
|
|
22
24
|
import '@solana/kit';
|
|
@@ -580,6 +582,10 @@ declare const getPublicClient: (chainId: number, chains: Chain[], rpcConfig: Rpc
|
|
|
580
582
|
Method: "eth_getTransactionByHash";
|
|
581
583
|
Parameters: [hash: viem.Hash];
|
|
582
584
|
ReturnType: viem.RpcTransaction | null;
|
|
585
|
+
}, {
|
|
586
|
+
Method: "eth_getTransactionBySenderAndNonce";
|
|
587
|
+
Parameters: [sender: Address, nonce: viem.Quantity];
|
|
588
|
+
ReturnType: viem.RpcTransaction | null;
|
|
583
589
|
}, {
|
|
584
590
|
Method: "eth_getTransactionCount";
|
|
585
591
|
Parameters: [address: Address, block: viem.RpcBlockNumber | viem.BlockTag | viem.RpcBlockIdentifier];
|
|
@@ -633,6 +639,10 @@ declare const getPublicClient: (chainId: number, chains: Chain[], rpcConfig: Rpc
|
|
|
633
639
|
Method: "eth_sendRawTransaction";
|
|
634
640
|
Parameters: [signedTransaction: viem.Hex];
|
|
635
641
|
ReturnType: viem.Hash;
|
|
642
|
+
}, {
|
|
643
|
+
Method: "eth_sendRawTransactionSync";
|
|
644
|
+
Parameters: [signedTransaction: viem.Hex] | [signedTransaction: viem.Hex, timeout: viem.Hex];
|
|
645
|
+
ReturnType: viem.RpcTransactionReceipt;
|
|
636
646
|
}, {
|
|
637
647
|
Method: "eth_simulateV1";
|
|
638
648
|
Parameters: [{
|
|
@@ -715,6 +725,7 @@ declare const getPublicClient: (chainId: number, chains: Chain[], rpcConfig: Rpc
|
|
|
715
725
|
prepareTransactionRequest: <const request extends viem.PrepareTransactionRequestRequest<Chain, chainOverride>, chainOverride extends viem.Chain | undefined = undefined, accountOverride extends viem.Account | Address | undefined = undefined>(args: viem.PrepareTransactionRequestParameters<Chain, viem.Account | undefined, chainOverride, accountOverride, request>) => Promise<viem.PrepareTransactionRequestReturnType<Chain, viem.Account | undefined, chainOverride, accountOverride, request>>;
|
|
716
726
|
readContract: <const abi extends viem.Abi | readonly unknown[], functionName extends viem.ContractFunctionName<abi, "pure" | "view">, const args extends viem.ContractFunctionArgs<abi, "pure" | "view", functionName>>(args: viem.ReadContractParameters<abi, functionName, args>) => Promise<viem.ReadContractReturnType<abi, functionName, args>>;
|
|
717
727
|
sendRawTransaction: (args: viem.SendRawTransactionParameters) => Promise<viem.SendRawTransactionReturnType>;
|
|
728
|
+
sendRawTransactionSync: (args: viem.SendRawTransactionSyncParameters) => Promise<viem.SendRawTransactionSyncReturnType<Chain>>;
|
|
718
729
|
simulate: <const calls extends readonly unknown[]>(args: viem.SimulateBlocksParameters<calls>) => Promise<viem.SimulateBlocksReturnType<calls>>;
|
|
719
730
|
simulateBlocks: <const calls extends readonly unknown[]>(args: viem.SimulateBlocksParameters<calls>) => Promise<viem.SimulateBlocksReturnType<calls>>;
|
|
720
731
|
simulateCalls: <const calls extends readonly unknown[]>(args: viem.SimulateCallsParameters<calls>) => Promise<viem.SimulateCallsReturnType<calls>>;
|
|
@@ -890,6 +901,10 @@ declare const getPublicClient: (chainId: number, chains: Chain[], rpcConfig: Rpc
|
|
|
890
901
|
Method: "eth_getTransactionByHash";
|
|
891
902
|
Parameters: [hash: viem.Hash];
|
|
892
903
|
ReturnType: viem.RpcTransaction | null;
|
|
904
|
+
}, {
|
|
905
|
+
Method: "eth_getTransactionBySenderAndNonce";
|
|
906
|
+
Parameters: [sender: Address, nonce: viem.Quantity];
|
|
907
|
+
ReturnType: viem.RpcTransaction | null;
|
|
893
908
|
}, {
|
|
894
909
|
Method: "eth_getTransactionCount";
|
|
895
910
|
Parameters: [address: Address, block: viem.RpcBlockNumber | viem.BlockTag | viem.RpcBlockIdentifier];
|
|
@@ -943,6 +958,10 @@ declare const getPublicClient: (chainId: number, chains: Chain[], rpcConfig: Rpc
|
|
|
943
958
|
Method: "eth_sendRawTransaction";
|
|
944
959
|
Parameters: [signedTransaction: viem.Hex];
|
|
945
960
|
ReturnType: viem.Hash;
|
|
961
|
+
}, {
|
|
962
|
+
Method: "eth_sendRawTransactionSync";
|
|
963
|
+
Parameters: [signedTransaction: viem.Hex] | [signedTransaction: viem.Hex, timeout: viem.Hex];
|
|
964
|
+
ReturnType: viem.RpcTransactionReceipt;
|
|
946
965
|
}, {
|
|
947
966
|
Method: "eth_simulateV1";
|
|
948
967
|
Parameters: [{
|
|
@@ -1105,6 +1124,10 @@ declare const getPublicClient: (chainId: number, chains: Chain[], rpcConfig: Rpc
|
|
|
1105
1124
|
Method: "eth_getTransactionByHash";
|
|
1106
1125
|
Parameters: [hash: viem.Hash];
|
|
1107
1126
|
ReturnType: viem.RpcTransaction | null;
|
|
1127
|
+
}, {
|
|
1128
|
+
Method: "eth_getTransactionBySenderAndNonce";
|
|
1129
|
+
Parameters: [sender: Address, nonce: viem.Quantity];
|
|
1130
|
+
ReturnType: viem.RpcTransaction | null;
|
|
1108
1131
|
}, {
|
|
1109
1132
|
Method: "eth_getTransactionCount";
|
|
1110
1133
|
Parameters: [address: Address, block: viem.RpcBlockNumber | viem.BlockTag | viem.RpcBlockIdentifier];
|
|
@@ -1158,6 +1181,10 @@ declare const getPublicClient: (chainId: number, chains: Chain[], rpcConfig: Rpc
|
|
|
1158
1181
|
Method: "eth_sendRawTransaction";
|
|
1159
1182
|
Parameters: [signedTransaction: viem.Hex];
|
|
1160
1183
|
ReturnType: viem.Hash;
|
|
1184
|
+
}, {
|
|
1185
|
+
Method: "eth_sendRawTransactionSync";
|
|
1186
|
+
Parameters: [signedTransaction: viem.Hex] | [signedTransaction: viem.Hex, timeout: viem.Hex];
|
|
1187
|
+
ReturnType: viem.RpcTransactionReceipt;
|
|
1161
1188
|
}, {
|
|
1162
1189
|
Method: "eth_simulateV1";
|
|
1163
1190
|
Parameters: [{
|
|
@@ -1331,6 +1358,7 @@ type MobileWalletConfig = {
|
|
|
1331
1358
|
};
|
|
1332
1359
|
|
|
1333
1360
|
declare function getCustomerAccessToken(): Promise<string | null>;
|
|
1361
|
+
declare function getIdentityToken(): Promise<string | null>;
|
|
1334
1362
|
/**
|
|
1335
1363
|
* Properties to initialize the {@link PrivyProvider}.
|
|
1336
1364
|
*/
|
|
@@ -3858,6 +3886,58 @@ declare function useSignTypedData(callbacks?: PrivyEvents['signTypedData']): {
|
|
|
3858
3886
|
}>;
|
|
3859
3887
|
};
|
|
3860
3888
|
|
|
3889
|
+
/**
|
|
3890
|
+
* Wraps a fetch function to automatically handle x402 payments.
|
|
3891
|
+
*
|
|
3892
|
+
* @param options - Configuration options for the wrapped fetch
|
|
3893
|
+
* @param options.walletAddress - Optional: The address of the Privy wallet to use. Defaults to first connected wallet.
|
|
3894
|
+
* @param options.fetch - The fetch function to wrap (typically globalThis.fetch)
|
|
3895
|
+
* @param options.maxValue - Maximum allowed payment amount in base units (default: 100000 = 0.1 USDC)
|
|
3896
|
+
* @param options.paymentRequirementsSelector - Function to select payment requirements from 402 response
|
|
3897
|
+
* @param options.config - Optional x402 configuration
|
|
3898
|
+
* @returns A wrapped fetch function that handles 402 responses automatically
|
|
3899
|
+
*/
|
|
3900
|
+
type WrapFetchWithPayment = (options: {
|
|
3901
|
+
walletAddress?: string;
|
|
3902
|
+
fetch: typeof globalThis.fetch;
|
|
3903
|
+
maxValue?: bigint;
|
|
3904
|
+
paymentRequirementsSelector?: PaymentRequirementsSelector;
|
|
3905
|
+
config?: X402Config;
|
|
3906
|
+
}) => (input: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
3907
|
+
/**
|
|
3908
|
+
* Return type for the useX402Fetch hook
|
|
3909
|
+
*/
|
|
3910
|
+
type UseX402Fetch = {
|
|
3911
|
+
/**
|
|
3912
|
+
* Wraps a fetch function to automatically handle x402 payments.
|
|
3913
|
+
* See {@link WrapFetchWithPayment} for details.
|
|
3914
|
+
*/
|
|
3915
|
+
wrapFetchWithPayment: WrapFetchWithPayment;
|
|
3916
|
+
};
|
|
3917
|
+
/**
|
|
3918
|
+
* Hook that provides x402 payment functionality for Privy embedded wallets.
|
|
3919
|
+
*
|
|
3920
|
+
* Returns a `wrapFetchWithPayment` function that wraps the native fetch API to automatically
|
|
3921
|
+
* handle 402 Payment Required responses by creating and sending payment headers signed with
|
|
3922
|
+
* Privy embedded wallets.
|
|
3923
|
+
*
|
|
3924
|
+
* @example
|
|
3925
|
+
* ```typescript
|
|
3926
|
+
* const {wallets} = useWallets();
|
|
3927
|
+
* const {wrapFetchWithPayment} = useX402Fetch();
|
|
3928
|
+
*
|
|
3929
|
+
* const fetchWithPayment = wrapFetchWithPayment({
|
|
3930
|
+
* walletAddress: wallets[0].address,
|
|
3931
|
+
* fetch,
|
|
3932
|
+
* });
|
|
3933
|
+
* const response = await fetchWithPayment('https://api.example.com/premium');
|
|
3934
|
+
* ```
|
|
3935
|
+
*
|
|
3936
|
+
* @experimental This API is experimental and may change in future versions
|
|
3937
|
+
* @returns Object containing wrapFetchWithPayment function
|
|
3938
|
+
*/
|
|
3939
|
+
declare const useX402Fetch: () => UseX402Fetch;
|
|
3940
|
+
|
|
3861
3941
|
/**
|
|
3862
3942
|
* Use this hook to check whether or not the Privy modal is currently visible.
|
|
3863
3943
|
*
|
|
@@ -4258,10 +4338,17 @@ declare const useHeadlessDelegatedActions: () => UseHeadlessDelegatedActionsInte
|
|
|
4258
4338
|
*/
|
|
4259
4339
|
declare function getEmbeddedConnectedWallet(wallets: ConnectedWallet[]): ConnectedWallet | null;
|
|
4260
4340
|
|
|
4341
|
+
/**
|
|
4342
|
+
* @deprecated Use `PrivyModal` instead
|
|
4343
|
+
*/
|
|
4261
4344
|
declare const LoginModal: ({ open }: {
|
|
4262
4345
|
open: boolean;
|
|
4263
4346
|
}) => react_jsx_runtime.JSX.Element;
|
|
4264
4347
|
|
|
4348
|
+
declare const PrivyModal: ({ open }: {
|
|
4349
|
+
open: boolean;
|
|
4350
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
4351
|
+
|
|
4265
4352
|
/**
|
|
4266
4353
|
* Helper function to create a viem Account instance given a connected Ethereum wallet.
|
|
4267
4354
|
*
|
|
@@ -4282,7 +4369,7 @@ declare const toViemAccount: ({ wallet }: {
|
|
|
4282
4369
|
}) => Promise<Hex>;
|
|
4283
4370
|
signTransaction: <serializer extends viem.SerializeTransactionFn<viem.TransactionSerializable> = viem.SerializeTransactionFn<viem.TransactionSerializable>, transaction extends Parameters<serializer>[0] = Parameters<serializer>[0]>(transaction: transaction, options?: {
|
|
4284
4371
|
serializer?: serializer | undefined;
|
|
4285
|
-
} | undefined) => Promise<
|
|
4372
|
+
} | undefined) => Promise<Hex>;
|
|
4286
4373
|
signTypedData: <const typedData extends viem.TypedData | Record<string, unknown>, primaryType extends keyof typedData | "EIP712Domain" = keyof typedData>(parameters: viem.TypedDataDefinition<typedData, primaryType>) => Promise<Hex>;
|
|
4287
4374
|
publicKey: Hex;
|
|
4288
4375
|
source: string;
|
|
@@ -4300,4 +4387,4 @@ declare const useMigrateWallets: () => {
|
|
|
4300
4387
|
}>;
|
|
4301
4388
|
};
|
|
4302
4389
|
|
|
4303
|
-
export { BaseConnectedWalletType, Captcha, ConnectWalletModalOptions, ConnectedWallet, ConnectorManager, type CustomAuthFlowState, EIP1193Provider, EthereumWalletConnector, FundWalletConfig, type JwtAuthFlowState, LinkedAccountWithMetadata, LoginModal, LoginModalOptions, LoginWithCode, MfaMethod, OAuthFlowState, OAuthTokens, OtpFlowState, PasskeyFlowState, PrivyClient, PrivyClientConfig, PrivyEvents, type PrivyInterface, PrivyProvider, type PrivyProviderProps, type SendCodeToEmail, type SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, SiweFlowState, TelegramAuthFlowState, UnsignedTransactionRequest, type UseAuthorizationSignatureInterface, type UseBaseAccountSdkInterface, type UseConnectBaseAccountInterface, type UseConnectCoinbaseSmartWalletInterface, type UseCustomAuth, type UseDelegatedActionsInterface, type UseFundWalletInterface, type UseGetAccessTokenForProvider, type UseImportWalletInterface, type UseLinkJwtAccount, type UseLinkWithPasskey, type UseLinkWithSiws, type UseLoginWithEmail, type UseLoginWithPasskey, type UseLoginWithSiws, type UseLoginWithSms, type UseLoginWithTelegram, type UseOAuthTokens, type UseRecoverEmbeddedWalletInterface, type UseSessionSignersInterface, type UseSignupWithPasskey, type UseSubscribeToJwtAuthWithFlagInput, type UseSyncJwtBasedAuthStateInput, type UseSyncJwtBasedAuthStateInterface, type UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getCustomerAccessToken as getAccessToken, getEmbeddedConnectedWallet, toViemAccount, useActiveWallet, useAuthMfa, useAuthMfaEnrollment, useAuthorizationSignature, useBaseAccountSdk, useConnectBaseAccount, useConnectCoinbaseSmartWallet, useConnectOrCreateWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useDelegatedActions, useFarcasterSigner, useFundWallet, useGetAccessTokenForProvider, useGuestAccounts, useHeadlessDelegatedActions, useIdentityToken, useImportWallet, useLinkAccount, useLinkJwtAccount, useLinkWithPasskey, useLinkWithSiwe, useLinkWithSiws, useLogin, useLoginWithEmail, useLoginWithFarcasterV2, useLoginWithOAuth, useLoginWithPasskey, useLoginWithSiwe, useLoginWithSiws, useLoginWithSms, useLoginWithTelegram, useLogout, useMfa, useMfaEnrollment, useMigrateWallets, useModalStatus, useOAuthTokens, usePrivy, useRecoverEmbeddedWallet, useRegisterMfaListener, useSendTransaction, useSessionSigners, useSetWalletRecovery, useSign7702Authorization, useSignMessage, useSignTransaction, useSignTypedData, useSignupWithPasskey, useSubscribeToJwtAuthWithFlag, useSyncJwtBasedAuthState, useToken, useUpdateAccount, useUpdateEmail, useUser, useWallets };
|
|
4390
|
+
export { BaseConnectedWalletType, Captcha, ConnectWalletModalOptions, ConnectedWallet, ConnectorManager, type CustomAuthFlowState, EIP1193Provider, EthereumWalletConnector, FundWalletConfig, type JwtAuthFlowState, LinkedAccountWithMetadata, LoginModal, LoginModalOptions, LoginWithCode, MfaMethod, OAuthFlowState, OAuthTokens, OtpFlowState, PasskeyFlowState, PrivyClient, PrivyClientConfig, PrivyEvents, type PrivyInterface, PrivyModal, PrivyProvider, type PrivyProviderProps, type SendCodeToEmail, type SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, SiweFlowState, TelegramAuthFlowState, UnsignedTransactionRequest, type UseAuthorizationSignatureInterface, type UseBaseAccountSdkInterface, type UseConnectBaseAccountInterface, type UseConnectCoinbaseSmartWalletInterface, type UseCustomAuth, type UseDelegatedActionsInterface, type UseFundWalletInterface, type UseGetAccessTokenForProvider, type UseImportWalletInterface, type UseLinkJwtAccount, type UseLinkWithPasskey, type UseLinkWithSiws, type UseLoginWithEmail, type UseLoginWithPasskey, type UseLoginWithSiws, type UseLoginWithSms, type UseLoginWithTelegram, type UseOAuthTokens, type UseRecoverEmbeddedWalletInterface, type UseSessionSignersInterface, type UseSignupWithPasskey, type UseSubscribeToJwtAuthWithFlagInput, type UseSyncJwtBasedAuthStateInput, type UseSyncJwtBasedAuthStateInterface, type UseWalletsInterface, type UseX402Fetch, User, VERSION, Wallet, WalletConnector, WalletListEntry, type WrapFetchWithPayment, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getCustomerAccessToken as getAccessToken, getEmbeddedConnectedWallet, getIdentityToken, toViemAccount, useActiveWallet, useAuthMfa, useAuthMfaEnrollment, useAuthorizationSignature, useBaseAccountSdk, useConnectBaseAccount, useConnectCoinbaseSmartWallet, useConnectOrCreateWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useDelegatedActions, useFarcasterSigner, useFundWallet, useGetAccessTokenForProvider, useGuestAccounts, useHeadlessDelegatedActions, useIdentityToken, useImportWallet, useLinkAccount, useLinkJwtAccount, useLinkWithPasskey, useLinkWithSiwe, useLinkWithSiws, useLogin, useLoginWithEmail, useLoginWithFarcasterV2, useLoginWithOAuth, useLoginWithPasskey, useLoginWithSiwe, useLoginWithSiws, useLoginWithSms, useLoginWithTelegram, useLogout, useMfa, useMfaEnrollment, useMigrateWallets, useModalStatus, useOAuthTokens, usePrivy, useRecoverEmbeddedWallet, useRegisterMfaListener, useSendTransaction, useSessionSigners, useSetWalletRecovery, useSign7702Authorization, useSignMessage, useSignTransaction, useSignTypedData, useSignupWithPasskey, useSubscribeToJwtAuthWithFlag, useSyncJwtBasedAuthState, useToken, useUpdateAccount, useUpdateEmail, useUser, useWallets, useX402Fetch };
|