@privy-io/react-auth 1.26.0-beta.9 → 1.26.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/index.d.ts CHANGED
@@ -251,8 +251,10 @@ declare abstract class WalletConnector extends EventEmitter<ConnectorEvents> {
251
251
  buildConnectedWallet(address: string, chainId: string): BaseConnectedWallet;
252
252
  /**
253
253
  * Sync all accounts available via the provider if the wallet is connected.
254
+ *
255
+ * @param prefetchedAccounts - pass in an accounts array from eth_accounts if already fetched to avoid a repeated call
254
256
  */
255
- syncAccounts(): Promise<void>;
257
+ syncAccounts(prefetchedAccounts?: string[]): Promise<void>;
256
258
  /**
257
259
  * Get the most recently connected wallet.
258
260
  */
@@ -269,7 +271,7 @@ declare abstract class WalletConnector extends EventEmitter<ConnectorEvents> {
269
271
  * @returns {string} The resulting signature.
270
272
  */
271
273
  sign(message: string): Promise<string>;
272
- protected onAccountsChanged: (_: string[]) => void;
274
+ protected onAccountsChanged: (accounts: string[]) => void;
273
275
  protected onChainChanged: (chainId: string) => void;
274
276
  protected onDisconnect: () => void;
275
277
  protected onConnect: () => void;
@@ -362,7 +364,7 @@ interface Wallet {
362
364
  walletClient: 'privy' | 'unknown';
363
365
  }
364
366
  /**
365
- * Object representation of a connected wallet.
367
+ * Object representation of a base connected wallet from a wallet connector.
366
368
  */
367
369
  interface BaseConnectedWallet {
368
370
  /** The wallet address. */
@@ -371,16 +373,26 @@ interface BaseConnectedWallet {
371
373
  chainId: string;
372
374
  /** The first time this wallet was connected without break. */
373
375
  connectedAt: number;
374
- /** The wallet client where this key-pair is stored. */
376
+ /**
377
+ * @experimental **Experimental**: This property is {@link https://docs.privy.io/guide/guides/experimental-features subject to change at any time}.
378
+ *
379
+ * The wallet client where this key-pair is stored.
380
+ * e.g. metamask, rainbow, coinbase_wallet, etc.
381
+ */
375
382
  walletClientType: WalletClientType;
376
- /** The connector used to initiate the connection with the wallet client. */
383
+ /**
384
+ * @experimental **Experimental**: This property is {@link https://docs.privy.io/guide/guides/experimental-features subject to change at any time}.
385
+ *
386
+ * The connector used to initiate the connection with the wallet client.
387
+ * e.g. injected, wallet_connect, coinbase_wallet, etc.
388
+ */
377
389
  connectorType: ConnectorType;
378
390
  /** Returns true if the wallet is connected, false otherwise */
379
391
  isConnected: () => Promise<boolean>;
380
392
  /** Helper methods to build providers for interfacing with this wallet. */
381
- getEthereumProvider: () => EIP1193Provider;
382
- getEthersProvider: () => Web3Provider;
383
- getWeb3jsProvider: () => AbstractProvider;
393
+ getEthereumProvider: () => Promise<EIP1193Provider>;
394
+ getEthersProvider: () => Promise<Web3Provider>;
395
+ getWeb3jsProvider: () => Promise<AbstractProvider>;
384
396
  /**
385
397
  * Perform personal_sign with the user's wallet.
386
398
  *
@@ -388,10 +400,18 @@ interface BaseConnectedWallet {
388
400
  * @returns {string} The resulting signature.
389
401
  */
390
402
  sign: (message: string) => Promise<string>;
391
- /** Disconnect method does not work on all connector types and will no-op if
392
- * that is the case (metamask does not support programmatic disconnects) */
403
+ /**
404
+ * @experimental **Experimental**: This property is {@link https://docs.privy.io/guide/guides/experimental-features subject to change at any time}.
405
+ *
406
+ * Disconnect method does not work on all connector types and will no-op if
407
+ * an incompatible connector is used (metamask and phantom do not support
408
+ * programmatic disconnects)
409
+ */
393
410
  disconnect: () => void;
394
411
  }
412
+ /**
413
+ * Object representation of a connected wallet.
414
+ */
395
415
  interface ConnectedWallet extends BaseConnectedWallet {
396
416
  /** True if this wallet is linked to the authenticated user. False if it is not yet linked or
397
417
  * the user has not yet authenticated. */
@@ -954,13 +974,13 @@ interface PrivyInterface {
954
974
  */
955
975
  setActiveWallet: (address: string) => Promise<void>;
956
976
  /**
957
- * @experimental **Experimental**: This feature is {@link https://docs.privy.io/guide/faq/experimental-features subject to change at any time}.
977
+ * @experimental **Experimental**: This feature is {@link https://docs.privy.io/guide/guides/experimental-features subject to change at any time}.
958
978
  *
959
979
  * Get a short-lived, one-time-use token to start a new Privy session from the existing authenticated session. Raises an exception if the current session was already forked from a previous session.
960
980
  */
961
981
  forkSession: () => Promise<string>;
962
982
  /**
963
- * @experimental **Experimental**: This feature is {@link https://docs.privy.io/guide/faq/experimental-features subject to change at any time}.
983
+ * @experimental **Experimental**: This feature is {@link https://docs.privy.io/guide/guides/experimental-features subject to change at any time}.
964
984
  *
965
985
  * Prompts a user to create an Ethereum wallet through Privy.
966
986
  *
@@ -972,7 +992,7 @@ interface PrivyInterface {
972
992
  */
973
993
  createWallet: () => Promise<Wallet>;
974
994
  /**
975
- * @experimental **Experimental**: This feature is {@link https://docs.privy.io/guide/faq/experimental-features subject to change at any time}.
995
+ * @experimental **Experimental**: This feature is {@link https://docs.privy.io/guide/guides/experimental-features subject to change at any time}.
976
996
  *
977
997
  * Prompts a user to sign a message using their Privy wallet.
978
998
  *