@privy-io/react-auth 1.13.0-beta.1 → 1.13.0-beta.10
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 +174 -162
- package/dist/index.d.ts +50 -40
- package/dist/index.js +174 -162
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ interface Discord {
|
|
|
78
78
|
/** The email associated with the Discord account. */
|
|
79
79
|
email: string | null;
|
|
80
80
|
}
|
|
81
|
-
/** Object representation of a user's
|
|
81
|
+
/** Object representation of a user's Github account. */
|
|
82
82
|
interface Github {
|
|
83
83
|
/** The `sub` claim from the Github-issued JWT for this account. */
|
|
84
84
|
subject: string;
|
|
@@ -177,8 +177,8 @@ interface AppSettings {
|
|
|
177
177
|
interface AllowlistConfig {
|
|
178
178
|
errorTitle: string | null;
|
|
179
179
|
errorDetail: string | null;
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
errorCtaText: string | null;
|
|
181
|
+
errorCtaLink: string | null;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
declare function getAccessToken(): Promise<string | null>;
|
|
@@ -197,16 +197,6 @@ interface PrivyProviderProps {
|
|
|
197
197
|
*
|
|
198
198
|
*/
|
|
199
199
|
onSuccess?: (user: User, isNewUser: boolean) => void;
|
|
200
|
-
/**
|
|
201
|
-
* @experimental **Experimental**: This feature is {@link https://docs.privy.io/guide/faq/experimental-features subject to change at any time}.
|
|
202
|
-
*
|
|
203
|
-
* An optional callback that will execute if a `login` call fails.
|
|
204
|
-
*
|
|
205
|
-
* Within this callback, you can access:
|
|
206
|
-
* - an `isNotAllowed` boolean flag indicating if the user was prevented from logging in by
|
|
207
|
-
* your app's allowlist, if you have one enabled
|
|
208
|
-
*/
|
|
209
|
-
onError?: (isNotAllowed: boolean) => void;
|
|
210
200
|
/** @ignore */
|
|
211
201
|
children: React.ReactNode;
|
|
212
202
|
}
|
|
@@ -268,37 +258,57 @@ declare class AsExternalProvider extends PrivyProxyProvider implements ExternalP
|
|
|
268
258
|
}, callback: (error: any, response: any) => void) => void;
|
|
269
259
|
}
|
|
270
260
|
|
|
271
|
-
declare class
|
|
272
|
-
|
|
273
|
-
walletType: WalletType
|
|
261
|
+
declare abstract class WalletConnector {
|
|
262
|
+
provider: PrivyProxyProvider;
|
|
263
|
+
walletType: WalletType;
|
|
264
|
+
connected: boolean;
|
|
265
|
+
address: string | null;
|
|
266
|
+
chain: string | null;
|
|
267
|
+
constructor(walletType: WalletType, provider: PrivyProxyProvider, address: string | null);
|
|
268
|
+
fetchAddress(): Promise<string | null>;
|
|
269
|
+
fetchChainId(): Promise<string>;
|
|
270
|
+
getConnectedWallet(): Promise<Wallet | null>;
|
|
271
|
+
abstract connect(options: {
|
|
272
|
+
showPrompt: boolean;
|
|
273
|
+
}): Promise<Wallet | null>;
|
|
274
|
+
abstract isConnected(): Promise<boolean>;
|
|
275
|
+
abstract promptConnection(walletType: WalletType): void;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
declare class ConnectorManager {
|
|
279
|
+
walletConnectors: WalletConnector[];
|
|
280
|
+
activeWalletConnector?: WalletConnector;
|
|
281
|
+
initialized: boolean;
|
|
274
282
|
constructor();
|
|
275
|
-
getEthereumProvider: () => EIP1193Provider;
|
|
276
283
|
initialize(): void;
|
|
277
|
-
|
|
278
|
-
getConnectedWallet(): Promise<Wallet | null>;
|
|
284
|
+
getEthereumProvider: () => EIP1193Provider;
|
|
279
285
|
/**
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
286
|
+
* Load state from the server user object (linked wallets).
|
|
287
|
+
* Currently, we can't load them because we don't know the wallet type.
|
|
288
|
+
* Once we've fixed this, we can load the wallets from the server and
|
|
289
|
+
* initialize their WalletConnector objects accordingly.
|
|
290
|
+
**/
|
|
291
|
+
initializeLinkedWallets(user: User): void;
|
|
292
|
+
load(): void;
|
|
293
|
+
save(): void;
|
|
294
|
+
/**
|
|
295
|
+
* Note that we purposefully don't delete CONNECTORS_STATE_KEY from localStorage
|
|
296
|
+
* This is because we can't recuperate state from the server state along yet (PRI-569).
|
|
284
297
|
*/
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
private isConnected;
|
|
289
|
-
private promptConnection;
|
|
298
|
+
destroy(): void;
|
|
299
|
+
addWalletConnector(walletConnector: WalletConnector): void;
|
|
300
|
+
removeWallet(address: string): void;
|
|
290
301
|
/**
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
* @returns {string} The EIP-155 chain id.
|
|
302
|
+
* Performing personal_sign with the active wallet
|
|
303
|
+
* If the active wallet is not connected, we connect it in just-in-time" fashion.
|
|
294
304
|
*/
|
|
295
|
-
|
|
305
|
+
activeWalletSign(message: string): Promise<string | null>;
|
|
296
306
|
/**
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
307
|
+
* Set a wallet as active, by passing the address.
|
|
308
|
+
* If the address is null or not found, do nothing and return false.
|
|
309
|
+
* If the connector was successfully found and set active, return true.
|
|
300
310
|
*/
|
|
301
|
-
address
|
|
311
|
+
setActiveWallet(address: string | null): boolean;
|
|
302
312
|
}
|
|
303
313
|
|
|
304
314
|
/**
|
|
@@ -393,10 +403,10 @@ interface PrivyInterface {
|
|
|
393
403
|
*/
|
|
394
404
|
getWeb3jsProvider: () => AbstractProvider;
|
|
395
405
|
/**
|
|
396
|
-
* Get the
|
|
406
|
+
* Get the ConnectorManager object
|
|
397
407
|
* This shouldn't need to be used directly unless creating a plugin, like a WAGMI plugin
|
|
398
408
|
*/
|
|
399
|
-
|
|
409
|
+
walletConnectors: ConnectorManager | null;
|
|
400
410
|
/**
|
|
401
411
|
* Unlink an email account from a user, by passing the email address. Note that you can only unlink an email account if the user has at least one other account.
|
|
402
412
|
*/
|
|
@@ -577,7 +587,7 @@ declare class PrivyClient {
|
|
|
577
587
|
private appId;
|
|
578
588
|
private session;
|
|
579
589
|
authFlow?: AuthFlow;
|
|
580
|
-
|
|
590
|
+
connectors: ConnectorManager;
|
|
581
591
|
/**
|
|
582
592
|
* Creates a new Privy client.
|
|
583
593
|
* @param options Initialization options.
|
|
@@ -650,4 +660,4 @@ declare class PrivyClient {
|
|
|
650
660
|
forkSession(): Promise<string>;
|
|
651
661
|
}
|
|
652
662
|
|
|
653
|
-
export { AsExternalProvider, Discord, DiscordOAuthWithMetadata, Email, EmailWithMetadata, GithubOAuthWithMetadata, Google, GoogleOAuthWithMetadata, Phone, PhoneWithMetadata, PrivyClient,
|
|
663
|
+
export { AsExternalProvider, ConnectorManager, Discord, DiscordOAuthWithMetadata, Email, EmailWithMetadata, GithubOAuthWithMetadata, Google, GoogleOAuthWithMetadata, Phone, PhoneWithMetadata, PrivyClient, PrivyInterface, PrivyProvider, PrivyProviderProps, PrivyProxyProvider, Twitter, TwitterOAuthWithMetadata, User, VERSION, Wallet, WalletWithMetadata, getAccessToken, usePrivy };
|