@privy-io/react-auth 1.28.0-beta.1 → 1.28.0-beta.11

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
@@ -184,7 +184,7 @@ declare class ProviderRpcError extends PrivyError {
184
184
 
185
185
  declare global {
186
186
  interface Window {
187
- ethereum?: unknown;
187
+ ethereum?: any;
188
188
  }
189
189
  }
190
190
  type ProviderConnectInfo = {
@@ -352,12 +352,12 @@ type CoinbaseWalletClientType = 'coinbase_wallet';
352
352
  *
353
353
  * How this works:
354
354
  *
355
- * The raw data is pulled from https://registry.walletconnect.com/api/v2/wallets
355
+ * The raw data is pulled from https://registry.walletconnect.com/api/v3/wallets
356
356
  * Some post-processing is done using the following script.
357
357
  *
358
358
  * const axios = require('axios');
359
359
  * const walletTypes = [];
360
- * axios.get("https://registry.walletconnect.com/api/v2/wallets").then((apiResult) => {
360
+ * axios.get("https://explorer-api.walletconnect.com/v3/wallets?projectId=2f05ae7f1116030fde2d36508f472bfb&entries=400&page=1&version=2&chains=eip155%3A1").then((apiResult) => {
361
361
  * Object.values(apiResult.data.listings).forEach((walletEntry) => {
362
362
  * if (!walletEntry.mobile.native || !walletEntry.mobile.universal) return;
363
363
  * if (!walletEntry.chains.includes('eip155:1')) return;
@@ -369,7 +369,7 @@ type CoinbaseWalletClientType = 'coinbase_wallet';
369
369
  * console.log(walletTypes.join("\n | "));
370
370
  * });
371
371
  */
372
- type WalletConnectWalletClientType = 'rainbow' | 'trust' | 'uniswap' | 'metamask' | 'argent' | 'spot' | 'zerion' | 'bitkeep' | 'unstoppable' | 'omni' | 'mathwallet' | 'bitpay' | '1inch' | 'eidoo' | 'coin98' | 'unstoppable' | 'alphawallet' | 'rwallet' | 'plasmapay' | 'o3wallet' | 'hashkey_me' | 'defiant' | 'essentials' | 'stasis' | 'julwallet' | 'tangem' | 'secux' | 'linen' | 'ambire' | 'obvious' | 'easypocket' | 'rice_wallet' | 'safemoon' | 'simplehold' | 'bitizen' | 'slavi_wallet' | 'nufinetes' | 'now_wallet' | 'blocto' | 'timeless' | 'arculus_wallet' | 'card' | 'mew_wallet' | 'pltwallet' | 'avacus' | 'bitski' | 'hippowallet' | 'edge' | 'assure' | 'enjin_wallet' | 'slingshot' | 'coinstats' | 'bitcoincom_wallet' | 'defiant' | 'binance';
372
+ type WalletConnectWalletClientType = 'metamask' | 'trust' | 'safe' | 'rainbow' | 'uniswap' | 'zerion' | 'argent' | 'spot' | 'omni' | 'cryptocom' | 'blockchain' | 'safepal' | 'bitkeep' | 'zengo' | '1inch' | 'binance' | 'exodus' | 'mew_wallet' | 'alphawallet' | 'keyring_pro' | 'mathwallet' | 'unstoppable' | 'obvious' | 'ambire' | 'internet_money_wallet' | 'coin98' | 'abc_wallet' | 'arculus_wallet' | 'haha' | 'cling_wallet' | 'broearn' | 'copiosa' | 'burrito_wallet' | 'enjin_wallet' | 'plasma_wallet' | 'avacus' | 'bee' | 'pitaka' | 'pltwallet' | 'minerva' | 'kryptogo' | 'prema' | 'slingshot' | 'kriptonio' | 'timeless' | 'secux' | 'bitizen' | 'blocto' | 'safemoon';
373
373
  /** @hidden */
374
374
  type UnknownWalletClientType = 'unknown';
375
375
  type WalletClientType = InjectedWalletClientType | CoinbaseWalletClientType | WalletConnectWalletClientType | EmbeddedWalletClientType | UnknownWalletClientType;
@@ -396,26 +396,36 @@ interface LinkMetadata {
396
396
  interface Wallet {
397
397
  /** The wallet address. */
398
398
  address: string;
399
- /** Chain type of the wallet address. */
399
+ /**
400
+ * @deprecated Use `chainId` instead.
401
+ *
402
+ * Chain type of the wallet address.
403
+ */
400
404
  chainType: 'ethereum' | 'solana';
401
405
  /**
402
- * @experimental
403
- * DO NOT USE: This feature is under active development.
406
+ * CAIP-2 formatted chain ID during the most recent verification.
404
407
  *
405
- * e.g. testnet, mainnet, goerli */
408
+ * e.g. eip155:1, eip155:5, eip155:137, etc.
409
+ */
406
410
  chainId?: string;
407
411
  /**
408
- * The wallet client used for this wallet. At the moment, there are only two expected values:
409
- *
410
- * 1. privy
411
- * 2. unknown
412
+ * @deprecated Use `walletClientType` instead.
413
+ */
414
+ walletClient: 'privy' | 'unknown';
415
+ /**
416
+ * The wallet client used for this wallet during the most recent verification.
412
417
  *
413
418
  * If the value is `privy`, then this is a privy embedded wallet.
414
419
  *
415
- * In the future, this may contain more information about other wallet clients,
416
- * like metamask, coinbase, etc.
420
+ * Other values include but are not limited to `metamask`, `rainbow`, `coinbase_wallet`, etc.
417
421
  */
418
- walletClient: 'privy' | 'unknown';
422
+ walletClientType?: string;
423
+ /**
424
+ * The connector type used for this wallet during the most recent verification.
425
+ *
426
+ * This includes but is not limited to `injected`, `wallet_connect`, `coinbase_wallet`, `embedded`.
427
+ */
428
+ connectorType?: string;
419
429
  /**
420
430
  * If this is a 'privy' embedded wallet, stores the recovery method:
421
431
  *
@@ -633,6 +643,7 @@ type PrivyServerConfig = {
633
643
  createdAt?: Date;
634
644
  updatedAt?: Date;
635
645
  customApiUrl?: string | null;
646
+ walletConnectCloudProjectId?: string | null;
636
647
  embeddedWalletConfig: EmbeddedWalletsConfig;
637
648
  /** May be deprecated from the server config in a future release */
638
649
  logoUrl?: string;
@@ -683,6 +694,7 @@ type PrivyClientConfig = {
683
694
  * This overrides the server setting `privacy_policy_url` */
684
695
  privacyPolicyUrl?: string | null;
685
696
  };
697
+ walletConnectCloudProjectId?: string;
686
698
  /** All embedded wallets configuration */
687
699
  embeddedWallets?: {
688
700
  /**
@@ -835,7 +847,8 @@ declare class ConnectorManager extends EventEmitter<ConnectorManagerEvents> {
835
847
  initialized: boolean;
836
848
  private storedConnections;
837
849
  private activeWallet?;
838
- constructor();
850
+ private walletConnectCloudProjectId;
851
+ constructor(walletConnectCloudProjectId: string);
839
852
  /**
840
853
  * The core wallets array that is exposed to developers. It builds
841
854
  * the wallets away with the following logic:
@@ -849,10 +862,6 @@ declare class ConnectorManager extends EventEmitter<ConnectorManagerEvents> {
849
862
  * Detect and add all valid wallet connectors.
850
863
  */
851
864
  initialize(): void;
852
- /**
853
- * Restore previous Wallet Connect connections that have been stored in local storage.
854
- */
855
- restoreWalletConnectConnectors(): void;
856
865
  /**
857
866
  * Helper function to find a wallet connector by connector type and wallet client type.
858
867
  */
@@ -875,7 +884,7 @@ declare class ConnectorManager extends EventEmitter<ConnectorManagerEvents> {
875
884
  * Creates a new wallet connector for the given connector type and wallet client type.
876
885
  * If a connector already exists, it will be returned instead.
877
886
  */
878
- createWalletConnector(connectorType: ConnectorType, walletClientType: WalletClientType): WalletConnector | null;
887
+ createWalletConnector(connectorType: ConnectorType, walletClientType: WalletClientType): Promise<WalletConnector | null>;
879
888
  private addWalletConnector;
880
889
  /**
881
890
  * Upon initialization, loads previous connections from local storage. If local storage
@@ -1132,8 +1141,19 @@ interface ResponsePhoneAccount {
1132
1141
  interface ResponseEthereumAccount {
1133
1142
  type: 'wallet';
1134
1143
  address: string;
1144
+ /**
1145
+ * @deprecated This will be removed in favor of the CAIP-2 formatted chain_id field.
1146
+ *
1147
+ * Chain type of the wallet address.
1148
+ */
1135
1149
  chain_type: 'ethereum';
1150
+ chain_id?: string;
1151
+ /**
1152
+ * @deprecated Use `wallet_client_type` instead.
1153
+ */
1136
1154
  wallet_client: 'privy' | 'unknown';
1155
+ wallet_client_type?: string;
1156
+ connector_type?: string;
1137
1157
  recovery_method?: 'privy' | 'user-passcode';
1138
1158
  verified_at: number;
1139
1159
  }
@@ -1260,7 +1280,7 @@ declare class PrivyClient {
1260
1280
  apiUrl: string;
1261
1281
  fallbackApiUrl: string;
1262
1282
  authFlow?: AuthFlow;
1263
- connectors: ConnectorManager;
1283
+ connectors?: ConnectorManager;
1264
1284
  /**
1265
1285
  * Creates a new Privy client.
1266
1286
  * @param options Initialization options.
@@ -1279,6 +1299,12 @@ declare class PrivyClient {
1279
1299
  */
1280
1300
  timeout?: number;
1281
1301
  });
1302
+ /**
1303
+ * ConnectorManager initialization is deferred because the input parameter may be overridden by the server
1304
+ * config. We can set this once and only once. If it is set twice, event listeners will be created
1305
+ * on the first ConnectorManager and are not re-created.
1306
+ */
1307
+ initializeConnectorManager(walletConnectCloudProjectId: string): void;
1282
1308
  generateApi(): Http;
1283
1309
  /**
1284
1310
  * In the case of cookie-based auth, re-initialize the http client with the custom api url.