@privy-io/react-auth 1.38.0-beta.4 → 1.38.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/esm/index.js +237 -340
- package/dist/index.d.ts +55 -20
- package/dist/index.js +236 -339
- package/package.json +3 -18
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { FetchOptions } from 'ofetch';
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
declare const SUPPORTED_JSON_RPC_METHODS: readonly ["eth_sign", "eth_populateTransactionRequest", "eth_signTransaction", "personal_sign", "eth_signTypedData_v4"];
|
|
20
|
-
type JsonRpcMethodType =
|
|
20
|
+
type JsonRpcMethodType = typeof SUPPORTED_JSON_RPC_METHODS[number];
|
|
21
21
|
type Quantity = string | number | bigint;
|
|
22
22
|
type UnsignedTransactionRequest = {
|
|
23
23
|
from?: string;
|
|
@@ -175,26 +175,16 @@ declare const DEFAULT_SUPPORTED_CHAINS: readonly [Chain, Chain, Chain, Chain, Ch
|
|
|
175
175
|
|
|
176
176
|
type WalletCreateRequestDataType = {
|
|
177
177
|
accessToken: string;
|
|
178
|
-
recoveryPassword?: string;
|
|
179
|
-
/**
|
|
180
|
-
* Will be deprecated in a future release, use `recoveryPassword` instead
|
|
181
|
-
* @deprecated
|
|
182
|
-
*/
|
|
183
178
|
recoveryPin?: string;
|
|
184
179
|
};
|
|
185
|
-
type
|
|
186
|
-
address: string;
|
|
180
|
+
type WalletConnectRequestDataType = {
|
|
187
181
|
accessToken: string;
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Will be deprecated in a future release, use `recoveryPassword` instead
|
|
191
|
-
* @deprecated
|
|
192
|
-
*/
|
|
193
|
-
recoveryPin?: string;
|
|
182
|
+
address: string;
|
|
194
183
|
};
|
|
195
|
-
type
|
|
184
|
+
type WalletRecoverRequestDataType = {
|
|
196
185
|
accessToken: string;
|
|
197
186
|
address: string;
|
|
187
|
+
recoveryPin?: string;
|
|
198
188
|
};
|
|
199
189
|
type WalletRpcRequestDataType = {
|
|
200
190
|
accessToken: string;
|
|
@@ -256,7 +246,9 @@ declare enum PrivyErrorCode {
|
|
|
256
246
|
UNKNOWN_CONNECT_WALLET_ERROR = "unknown_connect_wallet_error",
|
|
257
247
|
GENERIC_CONNECT_WALLET_ERROR = "generic_connect_wallet_error",
|
|
258
248
|
CLIENT_REQUEST_TIMEOUT = "client_request_timeout",
|
|
259
|
-
INVALID_CREDENTIALS = "invalid_credentials"
|
|
249
|
+
INVALID_CREDENTIALS = "invalid_credentials",
|
|
250
|
+
EMBEDDED_WALLET_ALREADY_EXISTS = "embedded_wallet_already_exists",
|
|
251
|
+
UNKNOWN_EMBEDDED_WALLET_ERROR = "unknown_embedded_wallet_error"
|
|
260
252
|
}
|
|
261
253
|
|
|
262
254
|
/**
|
|
@@ -765,14 +757,14 @@ type MoonpaySignResponse = {
|
|
|
765
757
|
};
|
|
766
758
|
|
|
767
759
|
declare const SUPPORTED_OAUTH_PROVIDERS: readonly ["google", "discord", "twitter", "github", "apple"];
|
|
768
|
-
type OAuthProviderType =
|
|
760
|
+
type OAuthProviderType = typeof SUPPORTED_OAUTH_PROVIDERS[number];
|
|
769
761
|
type EmbeddedWalletClientType = 'privy';
|
|
770
762
|
type InjectedWalletClientType = 'metamask' | 'phantom';
|
|
771
763
|
type CoinbaseWalletClientType = 'coinbase_wallet';
|
|
772
764
|
type UnknownWalletClientType = 'unknown';
|
|
773
765
|
type WalletClientType = InjectedWalletClientType | CoinbaseWalletClientType | WalletConnectWalletClientType | EmbeddedWalletClientType | UnknownWalletClientType;
|
|
774
766
|
declare const SUPPORTED_CONNECTOR_TYPES: string[];
|
|
775
|
-
type ConnectorType =
|
|
767
|
+
type ConnectorType = typeof SUPPORTED_CONNECTOR_TYPES[number];
|
|
776
768
|
/**
|
|
777
769
|
* Wallet metadata currently for internal use only
|
|
778
770
|
*/
|
|
@@ -1605,7 +1597,7 @@ interface PrivyInterface {
|
|
|
1605
1597
|
* This method will error if the user already has an embedded wallet or if they
|
|
1606
1598
|
* exit in the middle of the flow.
|
|
1607
1599
|
*
|
|
1608
|
-
* If the `config.embeddedWallets.
|
|
1600
|
+
* If the `config.embeddedWallets.requireUserPasswordOnCreate` property is set to true,
|
|
1609
1601
|
* this will prompt the user to enter a passcode to secure the recovery share of their
|
|
1610
1602
|
* embedded wallet.
|
|
1611
1603
|
*
|
|
@@ -1725,6 +1717,24 @@ type PrivyEvents = {
|
|
|
1725
1717
|
*/
|
|
1726
1718
|
onError?: CallbackError;
|
|
1727
1719
|
};
|
|
1720
|
+
createWallet: {
|
|
1721
|
+
/**
|
|
1722
|
+
* Callback that will execute once on a successful embedded wallet creation.
|
|
1723
|
+
* This will run when `createWallet` is called manually, or when `config.embeddedWallets.createOnLogin` triggers
|
|
1724
|
+
* an automatic wallet creation.
|
|
1725
|
+
*
|
|
1726
|
+
* @param wallet {BaseConnectedWallet}- the created `wallet` object
|
|
1727
|
+
*
|
|
1728
|
+
*/
|
|
1729
|
+
onSuccess?: (wallet: Wallet) => void;
|
|
1730
|
+
/**
|
|
1731
|
+
* Callback that will execute in the case of a non-successful wallet creation.
|
|
1732
|
+
*
|
|
1733
|
+
* @param error {PrivyErrorCode} - the corresponding error code
|
|
1734
|
+
*
|
|
1735
|
+
*/
|
|
1736
|
+
onError?: CallbackError;
|
|
1737
|
+
};
|
|
1728
1738
|
};
|
|
1729
1739
|
|
|
1730
1740
|
/**
|
|
@@ -1772,4 +1782,29 @@ declare function useConnectWallet(callbacks?: PrivyEvents['connectWallet']): {
|
|
|
1772
1782
|
connectWallet: () => void;
|
|
1773
1783
|
};
|
|
1774
1784
|
|
|
1775
|
-
|
|
1785
|
+
/**
|
|
1786
|
+
* Use this hook to create a privy wallet for a user, and to attach a callback after successful wallet creation.
|
|
1787
|
+
*
|
|
1788
|
+
* @param callbacks.onSuccess {@link PrivyEvents} callback to execute when a user successfully creates a privy wallet
|
|
1789
|
+
* @param callbacks.onError {@link PrivyEvents} callback to execute if there is an error during `cresteWallet`.
|
|
1790
|
+
* @returns createWallet - creates a privy wallet for the user.
|
|
1791
|
+
*/
|
|
1792
|
+
declare function useCreateWallet(callbacks?: PrivyEvents['createWallet']): {
|
|
1793
|
+
/**
|
|
1794
|
+
* Creates an embedded wallet for the current user.
|
|
1795
|
+
*
|
|
1796
|
+
* This method will error if the user already has an embedded wallet
|
|
1797
|
+
*
|
|
1798
|
+
* If the `config.embeddedWallets.requireUserPasswordOnCreate` property is set to true,
|
|
1799
|
+
* this will prompt the user to enter a passcode to secure the recovery share of their
|
|
1800
|
+
* embedded wallet.
|
|
1801
|
+
*
|
|
1802
|
+
* Otherwise (the default), Privy will secure the recovery share, and the embedded wallet
|
|
1803
|
+
* will be created without showing any UIs to the user.
|
|
1804
|
+
*
|
|
1805
|
+
* @returns Promise for the {@link Wallet} object for the newly created embedded wallet
|
|
1806
|
+
*/
|
|
1807
|
+
createWallet: () => Promise<Wallet>;
|
|
1808
|
+
};
|
|
1809
|
+
|
|
1810
|
+
export { Apple, AppleOAuthWithMetadata, AsExternalProvider, CallbackError, ConnectedWallet, ConnectorManager, ContractUIOptions, Discord, DiscordOAuthWithMetadata, EIP1193Provider, Email, EmailWithMetadata, FundWalletConfig, Github, GithubOAuthWithMetadata, Google, GoogleOAuthWithMetadata, MoonpayConfig, MoonpayCurrencyCode, MoonpayPaymentMethod, Phone, PhoneWithMetadata, PrivyClient, PrivyClientConfig, PrivyEvents, PrivyInterface, PrivyProvider, PrivyProviderProps, PrivyProxyProvider, Quantity, DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, SendTransactionModalUIOptions, SignMessageModalUIOptions, TransactionLog, TransactionReceipt, TransactionUIOptions, Twitter, TwitterOAuthWithMetadata, UnsignedTransactionRequest, UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletWithMetadata, getAccessToken, useConnectWallet, useCreateWallet, useLogin, useLogout, usePrivy, useWallets };
|