@privy-io/react-auth 1.17.1-beta.1 → 1.18.0-beta.1
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 +306 -316
- package/dist/index.d.ts +46 -11
- package/dist/index.js +306 -316
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,13 @@ declare const SUPPORTED_OAUTH_PROVIDERS: readonly ["google", "discord", "twitter
|
|
|
8
8
|
type OAuthProviderType = typeof SUPPORTED_OAUTH_PROVIDERS[number];
|
|
9
9
|
declare const SUPPORTED_WALLET_TYPES: readonly ["metamask", "coinbase_wallet", "wallet_connect"];
|
|
10
10
|
type WalletType = typeof SUPPORTED_WALLET_TYPES[number];
|
|
11
|
+
/**
|
|
12
|
+
* Wallet metadata currently for internal use only
|
|
13
|
+
*/
|
|
14
|
+
type WalletMeta = {
|
|
15
|
+
name: string;
|
|
16
|
+
icon?: string | EmbeddedSVG;
|
|
17
|
+
};
|
|
11
18
|
type LinkedAccountType = 'wallet' | 'email' | 'phone' | 'google_oauth' | 'twitter_oauth' | 'discord_oauth' | 'github_oauth';
|
|
12
19
|
/** @ignore */
|
|
13
20
|
interface LinkMetadata {
|
|
@@ -252,14 +259,14 @@ interface EIP1193Provider {
|
|
|
252
259
|
declare class PrivyProxyProvider implements EIP1193Provider {
|
|
253
260
|
walletProvider?: EIP1193Provider;
|
|
254
261
|
private _subscriptions;
|
|
255
|
-
constructor(
|
|
262
|
+
constructor(walletProvider?: EIP1193Provider);
|
|
256
263
|
on(eventName: string, listener: (...args: any[]) => void): any;
|
|
257
264
|
request(request: {
|
|
258
265
|
method: string;
|
|
259
266
|
params?: any[] | undefined;
|
|
260
267
|
}): Promise<any>;
|
|
261
268
|
removeListener: (eventName: string | symbol, listener: (...args: any[]) => void) => any;
|
|
262
|
-
|
|
269
|
+
setWalletProvider: (provider: EIP1193Provider) => void;
|
|
263
270
|
}
|
|
264
271
|
declare class AsExternalProvider extends PrivyProxyProvider implements ExternalProvider {
|
|
265
272
|
constructor(provider: EIP1193Provider);
|
|
@@ -278,15 +285,16 @@ declare class AsExternalProvider extends PrivyProxyProvider implements ExternalP
|
|
|
278
285
|
}
|
|
279
286
|
|
|
280
287
|
declare abstract class WalletConnector {
|
|
281
|
-
|
|
288
|
+
proxyProvider: PrivyProxyProvider;
|
|
282
289
|
walletType: WalletType;
|
|
283
290
|
connected: boolean;
|
|
284
291
|
address: string | null;
|
|
285
292
|
chain: string | null;
|
|
286
|
-
constructor(walletType: WalletType,
|
|
293
|
+
constructor(walletType: WalletType, proxyProvider: PrivyProxyProvider, address: string | null);
|
|
287
294
|
fetchAddress(): Promise<string | null>;
|
|
288
295
|
fetchChainId(): Promise<string>;
|
|
289
296
|
getConnectedWallet(): Promise<Wallet | null>;
|
|
297
|
+
abstract get walletMeta(): WalletMeta;
|
|
290
298
|
abstract connect(options: {
|
|
291
299
|
showPrompt: boolean;
|
|
292
300
|
}): Promise<Wallet | null>;
|
|
@@ -299,21 +307,34 @@ declare abstract class WalletConnector {
|
|
|
299
307
|
/**
|
|
300
308
|
* Light wrapper around WCConnectionManager that uses the global connection manager
|
|
301
309
|
* to manage the local storage layer and avoid conflicts.
|
|
310
|
+
* There can be multiple WCWalletConnectors, but should only ever be a single
|
|
311
|
+
* WCConnectionManager, which should be the class referenced - it will in turn find
|
|
312
|
+
* the appropriate WCWalletConnector for use with an action.
|
|
302
313
|
*/
|
|
303
314
|
declare class WCWalletConnector extends WalletConnector {
|
|
304
315
|
private _connectionManager;
|
|
305
|
-
|
|
306
|
-
constructor(connectionManager: WCConnectionManager, provider: PrivyProxyProvider, address: string | null);
|
|
316
|
+
constructor(connectionManager: WCConnectionManager, proxyProvider: PrivyProxyProvider, address: string | null);
|
|
307
317
|
connect(options: {
|
|
308
318
|
showPrompt: boolean;
|
|
309
319
|
}): Promise<Wallet | null>;
|
|
310
320
|
isConnected(): Promise<boolean>;
|
|
321
|
+
/**
|
|
322
|
+
* Metadata about the wallet represented by this connector.
|
|
323
|
+
*/
|
|
324
|
+
get walletMeta(): {
|
|
325
|
+
name: string;
|
|
326
|
+
icon: string | EmbeddedSVG;
|
|
327
|
+
};
|
|
311
328
|
promptConnection(): Promise<void>;
|
|
312
329
|
/**
|
|
313
|
-
* Perform personal_sign with the user's wallet
|
|
330
|
+
* Perform personal_sign with the user's first wallet associated with WalletConnect
|
|
314
331
|
*/
|
|
315
332
|
sign(message: string): Promise<string>;
|
|
316
333
|
disconnect(): void;
|
|
334
|
+
/**
|
|
335
|
+
* Access the underlying WCProvider directly with proper typings
|
|
336
|
+
*/
|
|
337
|
+
private get walletProvider();
|
|
317
338
|
}
|
|
318
339
|
/**
|
|
319
340
|
* An object representation of the Wallet Connect V1 protocol. This is used to initiate and manage connections
|
|
@@ -332,13 +353,27 @@ declare class WCConnectionManager {
|
|
|
332
353
|
*/
|
|
333
354
|
disconnect(): Promise<void>;
|
|
334
355
|
/**
|
|
335
|
-
*
|
|
356
|
+
* Given an address, either fetch (reusing a stored connection) or create a new one if no stored
|
|
357
|
+
* connection is found
|
|
358
|
+
*/
|
|
359
|
+
getOrCreateProviderForAddress(address: string | null): WCProvider;
|
|
360
|
+
/**
|
|
361
|
+
* Create a WC provider and add an entry to the internal provider registry keyed on the internal
|
|
362
|
+
* WC storageId
|
|
363
|
+
*/
|
|
364
|
+
private createProvider;
|
|
365
|
+
/**
|
|
366
|
+
* Replace the given provider, *assuming it's the one with null address*
|
|
367
|
+
*
|
|
368
|
+
* Couldn't find any WC docs, but a reference implementation library had a similar error we were
|
|
369
|
+
* seeing - WC sessions wouldn't open a new modal/etc when doing `provider.enable()` if it had
|
|
370
|
+
* previously been rejected: https://github.com/Uniswap/web3-react/issues/217
|
|
336
371
|
*/
|
|
337
|
-
|
|
372
|
+
replaceProvider(provider: WCProvider): WCProvider;
|
|
338
373
|
/**
|
|
339
|
-
*
|
|
374
|
+
* Enables the provider. Under the hood, this calls connect() and 'eth_RequestAccounts'.
|
|
340
375
|
*/
|
|
341
|
-
|
|
376
|
+
enableProvider(provider: WCProvider): Promise<string[]>;
|
|
342
377
|
}
|
|
343
378
|
|
|
344
379
|
declare class ConnectorManager {
|