@privy-io/react-auth 1.18.0-beta.1 → 1.18.0-beta.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/esm/index.js +102 -102
- package/dist/index.d.ts +22 -10
- package/dist/index.js +102 -102
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { AxiosResponse, AxiosRequestConfig } from 'axios';
|
|
|
6
6
|
|
|
7
7
|
declare const SUPPORTED_OAUTH_PROVIDERS: readonly ["google", "discord", "twitter", "github"];
|
|
8
8
|
type OAuthProviderType = typeof SUPPORTED_OAUTH_PROVIDERS[number];
|
|
9
|
-
declare const SUPPORTED_WALLET_TYPES: readonly ["metamask", "coinbase_wallet", "wallet_connect"];
|
|
9
|
+
declare const SUPPORTED_WALLET_TYPES: readonly ["metamask", "coinbase_wallet", "wallet_connect", "metamask_wc"];
|
|
10
10
|
type WalletType = typeof SUPPORTED_WALLET_TYPES[number];
|
|
11
11
|
/**
|
|
12
12
|
* Wallet metadata currently for internal use only
|
|
@@ -136,6 +136,9 @@ interface GithubOAuthWithMetadata extends LinkMetadata, Github {
|
|
|
136
136
|
/** Denotes that this is a Github account. */
|
|
137
137
|
type: 'github_oauth';
|
|
138
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Object representation of a user's linked accounts
|
|
141
|
+
*/
|
|
139
142
|
type LinkedAccountWithMetadata = WalletWithMetadata | EmailWithMetadata | PhoneWithMetadata | GoogleOAuthWithMetadata | TwitterOAuthWithMetadata | DiscordOAuthWithMetadata | GithubOAuthWithMetadata;
|
|
140
143
|
interface User {
|
|
141
144
|
/** The Privy-issued DID for the user. If you need to store additional information
|
|
@@ -312,8 +315,9 @@ declare abstract class WalletConnector {
|
|
|
312
315
|
* the appropriate WCWalletConnector for use with an action.
|
|
313
316
|
*/
|
|
314
317
|
declare class WCWalletConnector extends WalletConnector {
|
|
315
|
-
private
|
|
316
|
-
|
|
318
|
+
private connectionManager;
|
|
319
|
+
private targetWalletName?;
|
|
320
|
+
constructor(connectionManager: WCConnectionManager, proxyProvider: PrivyProxyProvider, address: string | null, targetWalletName?: InstantLaunchWallet);
|
|
317
321
|
connect(options: {
|
|
318
322
|
showPrompt: boolean;
|
|
319
323
|
}): Promise<Wallet | null>;
|
|
@@ -346,8 +350,10 @@ declare class WCConnectionManager {
|
|
|
346
350
|
constructor();
|
|
347
351
|
/**
|
|
348
352
|
* Builds a new WCWalletConnector instance
|
|
353
|
+
*
|
|
354
|
+
* If targetWalletName is specified, attempts to launch into that specific flow
|
|
349
355
|
*/
|
|
350
|
-
createConnector(provider: PrivyProxyProvider, address: string | null): WCWalletConnector;
|
|
356
|
+
createConnector(provider: PrivyProxyProvider, address: string | null, targetWalletName?: InstantLaunchWallet): WCWalletConnector;
|
|
351
357
|
/**
|
|
352
358
|
* Disconnects all active Wallet Connect sessions.
|
|
353
359
|
*/
|
|
@@ -356,12 +362,13 @@ declare class WCConnectionManager {
|
|
|
356
362
|
* Given an address, either fetch (reusing a stored connection) or create a new one if no stored
|
|
357
363
|
* connection is found
|
|
358
364
|
*/
|
|
359
|
-
getOrCreateProviderForAddress(address: string | null): WCProvider;
|
|
365
|
+
getOrCreateProviderForAddress(address: string | null, targetWalletName: InstantLaunchWallet | undefined): WCProvider;
|
|
360
366
|
/**
|
|
361
367
|
* Create a WC provider and add an entry to the internal provider registry keyed on the internal
|
|
362
|
-
* WC storageId
|
|
368
|
+
* WC storageId. If targetWalletName is specified, attempts to launch the WC flow for that particular
|
|
369
|
+
* wallet
|
|
363
370
|
*/
|
|
364
|
-
|
|
371
|
+
createProvider(storageId: string, targetWalletName: InstantLaunchWallet | undefined): WCProvider;
|
|
365
372
|
/**
|
|
366
373
|
* Replace the given provider, *assuming it's the one with null address*
|
|
367
374
|
*
|
|
@@ -369,11 +376,14 @@ declare class WCConnectionManager {
|
|
|
369
376
|
* seeing - WC sessions wouldn't open a new modal/etc when doing `provider.enable()` if it had
|
|
370
377
|
* previously been rejected: https://github.com/Uniswap/web3-react/issues/217
|
|
371
378
|
*/
|
|
372
|
-
replaceProvider(provider: WCProvider): WCProvider;
|
|
379
|
+
replaceProvider(provider: WCProvider, targetWalletName: InstantLaunchWallet | undefined): WCProvider;
|
|
373
380
|
/**
|
|
374
381
|
* Enables the provider. Under the hood, this calls connect() and 'eth_RequestAccounts'.
|
|
375
382
|
*/
|
|
376
|
-
enableProvider(provider: WCProvider): Promise<string[]>;
|
|
383
|
+
enableProvider(provider: WCProvider, targetWalletName: InstantLaunchWallet | undefined): Promise<string[]>;
|
|
384
|
+
}
|
|
385
|
+
declare enum InstantLaunchWallet {
|
|
386
|
+
metamask = "metamask"
|
|
377
387
|
}
|
|
378
388
|
|
|
379
389
|
declare class ConnectorManager {
|
|
@@ -516,6 +526,7 @@ interface PrivyInterface {
|
|
|
516
526
|
unlinkPhone: (phoneNumber: string) => Promise<User>;
|
|
517
527
|
/**
|
|
518
528
|
* Unlink a wallet account from a user, by passing the public address. Note that you can only unlink a wallet account if the user has at least one other account.
|
|
529
|
+
* If the unlinked wallet was the active one, and more wallets are linked to the user, then we attempt to make the most recently linked wallet active.
|
|
519
530
|
*/
|
|
520
531
|
unlinkWallet: (address: string) => Promise<User>;
|
|
521
532
|
/**
|
|
@@ -537,11 +548,12 @@ interface PrivyInterface {
|
|
|
537
548
|
/**
|
|
538
549
|
* Set one of the authenticated wallet addresses (part of user.linkedAccounts with type 'wallet'). as the active wallet.
|
|
539
550
|
* If you pass a wallet that's not one of the linkedAccounts, this will throw an error.
|
|
551
|
+
* This will prompt the user to reconnect their wallet if the connection is lost.
|
|
540
552
|
*
|
|
541
553
|
* The active wallet will be the one that getEthersProvider() will use as a signer (used for signing & transactions).
|
|
542
554
|
* It is also the wallet present at `user.wallet`, and that value is updated when this is called.
|
|
543
555
|
*
|
|
544
|
-
* Note that when you link a new wallet, it becomes
|
|
556
|
+
* Note that when you link a new wallet, it becomes active.
|
|
545
557
|
*/
|
|
546
558
|
setActiveWallet: (address: string) => Promise<void>;
|
|
547
559
|
/**
|