@privy-io/react-auth 1.16.1 → 1.17.0-beta.2

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/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { ExternalProvider, Web3Provider } from '@ethersproject/providers';
3
- import WalletConnectProvider from '@walletconnect/web3-provider';
3
+ import WCProvider from '@walletconnect/web3-provider';
4
4
  import { AbstractProvider } from 'web3-core';
5
5
  import { AxiosResponse, AxiosRequestConfig } from 'axios';
6
6
 
@@ -209,6 +209,12 @@ interface PrivyProviderProps {
209
209
  onSuccess?: (user: User, isNewUser: boolean) => void;
210
210
  /** @ignore */
211
211
  children: React.ReactNode;
212
+ /**
213
+ * If true, the user will be prompted to create a Privy wallet
214
+ * after they have successfully logged in if they do not currently
215
+ * have any wallet associated with their user account.
216
+ */
217
+ createPrivyWalletOnLogin?: boolean;
212
218
  }
213
219
  /**
214
220
  * Passes the Privy authentication context to your React components.
@@ -288,32 +294,36 @@ declare abstract class WalletConnector {
288
294
  }
289
295
 
290
296
  /**
291
- * Light wrapper around WalletConnectGlobalWalletConnector that uses the global connector
297
+ * Light wrapper around WCConnectionManager that uses the global connection manager
292
298
  * to manage the local storage layer and avoid conflicts.
293
299
  */
294
- declare class WalletConnectWalletConnector extends WalletConnector {
295
- private _globalConnector;
300
+ declare class WCWalletConnector extends WalletConnector {
301
+ private _connectionManager;
296
302
  private _provider;
297
- constructor(globalConnector: WalletConnectGlobalWalletConnector, provider: PrivyProxyProvider, address: string | null);
303
+ constructor(connectionManager: WCConnectionManager, provider: PrivyProxyProvider, address: string | null);
298
304
  connect(options: {
299
305
  showPrompt: boolean;
300
306
  }): Promise<Wallet | null>;
301
307
  isConnected(): Promise<boolean>;
302
308
  promptConnection(): Promise<void>;
309
+ /**
310
+ * Perform personal_sign with the user's wallet.
311
+ */
312
+ sign(message: string): Promise<string>;
303
313
  disconnect(): void;
304
314
  }
305
315
  /**
306
316
  * An object representation of the Wallet Connect V1 protocol. This is used to initiate and manage connections
307
317
  * with any number of wallets.
308
318
  */
309
- declare class WalletConnectGlobalWalletConnector {
319
+ declare class WCConnectionManager {
310
320
  private _storageIdToProvider;
311
321
  private _addressToStorageId;
312
322
  constructor();
313
323
  /**
314
- * Builds a new WalletConnectWalletConnector instance
324
+ * Builds a new WCWalletConnector instance
315
325
  */
316
- build(provider: PrivyProxyProvider, address: string | null): WalletConnectWalletConnector;
326
+ createConnector(provider: PrivyProxyProvider, address: string | null): WCWalletConnector;
317
327
  /**
318
328
  * Disconnects all active Wallet Connect sessions.
319
329
  */
@@ -321,18 +331,18 @@ declare class WalletConnectGlobalWalletConnector {
321
331
  /**
322
332
  * Handles storage retrieval and assignment for WalletConnectProvider instances
323
333
  */
324
- getProviderForAddress(address: string | null): WalletConnectProvider;
334
+ getProviderForAddress(address: string | null): WCProvider;
325
335
  /**
326
336
  * Updates internal global connector data structures with address mappings as new accounts are added
327
337
  */
328
- indexProvider(provider: WalletConnectProvider): void;
338
+ indexProvider(provider: WCProvider): void;
329
339
  }
330
340
 
331
341
  declare class ConnectorManager {
332
342
  walletConnectors: WalletConnector[];
333
343
  activeWalletConnector?: WalletConnector;
334
344
  initialized: boolean;
335
- walletConnectGlobalWalletConnector: WalletConnectGlobalWalletConnector;
345
+ wcConnectionManager: WCConnectionManager;
336
346
  constructor();
337
347
  initialize(): void;
338
348
  getEthereumProvider: () => EIP1193Provider;
@@ -534,27 +544,6 @@ declare const usePrivy: () => PrivyInterface;
534
544
 
535
545
  declare const VERSION: string;
536
546
 
537
- interface DefaultsType {
538
- baseURL: string;
539
- timeout: number;
540
- }
541
- /**
542
- * A raw http handler for making requests to the Privy API. It requires a Session
543
- * object, which is used for fetching and including any tokens that are required
544
- * for requests.
545
- */
546
- declare class Http {
547
- private appId;
548
- private client;
549
- private defaults;
550
- private sdkVersion;
551
- constructor(appId: string, client: PrivyClient, defaults: DefaultsType);
552
- get<T = any, R = AxiosResponse<T>, D = any>(path: string, config?: AxiosRequestConfig<D>): Promise<R>;
553
- post<T = any, R = AxiosResponse<T>, D = any>(path: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
554
- delete<T = any, R = AxiosResponse<T>, D = any>(path: string, config?: AxiosRequestConfig<D>): Promise<R>;
555
- private buildConfig;
556
- }
557
-
558
547
  interface ResponseEmailAccount {
559
548
  type: 'email';
560
549
  address: string;
@@ -608,6 +597,27 @@ interface GetCurrentUserResponse {
608
597
  linked_accounts: LinkedAccountsResponseType;
609
598
  }
610
599
 
600
+ interface DefaultsType {
601
+ baseURL: string;
602
+ timeout: number;
603
+ }
604
+ /**
605
+ * A raw http handler for making requests to the Privy API. It requires a Session
606
+ * object, which is used for fetching and including any tokens that are required
607
+ * for requests.
608
+ */
609
+ declare class Http {
610
+ private appId;
611
+ private client;
612
+ private defaults;
613
+ private sdkVersion;
614
+ constructor(appId: string, client: PrivyClient, defaults: DefaultsType);
615
+ get<T = any, R = AxiosResponse<T>, D = any>(path: string, config?: AxiosRequestConfig<D>): Promise<R>;
616
+ post<T = any, R = AxiosResponse<T>, D = any>(path: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
617
+ delete<T = any, R = AxiosResponse<T>, D = any>(path: string, config?: AxiosRequestConfig<D>): Promise<R>;
618
+ private buildConfig;
619
+ }
620
+
611
621
  /**
612
622
  * Valid /session and <>/authenticate calls will respond with a token
613
623
  * as well as a valid user object for streamlining.