@privy-io/react-auth 1.37.2-beta.4 → 1.38.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
@@ -17,7 +17,7 @@ import { FetchOptions } from 'ofetch';
17
17
  */
18
18
 
19
19
  declare const SUPPORTED_JSON_RPC_METHODS: readonly ["eth_sign", "eth_populateTransactionRequest", "eth_signTransaction", "personal_sign", "eth_signTypedData_v4"];
20
- type JsonRpcMethodType = typeof SUPPORTED_JSON_RPC_METHODS[number];
20
+ type JsonRpcMethodType = (typeof SUPPORTED_JSON_RPC_METHODS)[number];
21
21
  type Quantity = string | number | bigint;
22
22
  type UnsignedTransactionRequest = {
23
23
  from?: string;
@@ -175,16 +175,26 @@ declare const DEFAULT_SUPPORTED_CHAINS: readonly [Chain, Chain, Chain, Chain, Ch
175
175
 
176
176
  type WalletCreateRequestDataType = {
177
177
  accessToken: string;
178
+ recoveryPassword?: string;
179
+ /**
180
+ * Will be deprecated in a future release, use `recoveryPassword` instead
181
+ * @deprecated
182
+ */
178
183
  recoveryPin?: string;
179
184
  };
180
- type WalletConnectRequestDataType = {
181
- accessToken: string;
185
+ type WalletRecoverRequestDataType = {
182
186
  address: string;
187
+ accessToken: string;
188
+ recoveryPassword?: string;
189
+ /**
190
+ * Will be deprecated in a future release, use `recoveryPassword` instead
191
+ * @deprecated
192
+ */
193
+ recoveryPin?: string;
183
194
  };
184
- type WalletRecoverRequestDataType = {
195
+ type WalletConnectRequestDataType = {
185
196
  accessToken: string;
186
197
  address: string;
187
- recoveryPin?: string;
188
198
  };
189
199
  type WalletRpcRequestDataType = {
190
200
  accessToken: string;
@@ -235,6 +245,7 @@ declare abstract class PrivyError extends Error {
235
245
  declare enum PrivyErrorCode {
236
246
  MISSING_OR_INVALID_PRIVY_APP_ID = "missing_or_invalid_privy_app_id",
237
247
  MISSING_OR_INVALID_PRIVY_ACCOUNT_ID = "missing_or_invalid_privy_account_id",
248
+ MISSING_OR_INVALID_TOKEN = "missing_or_invalid_token",
238
249
  INVALID_DATA = "invalid_data",
239
250
  LINKED_TO_ANOTHER_USER = "linked_to_another_user",
240
251
  ALLOWLIST_REJECTED = "allowlist_rejected",
@@ -287,8 +298,9 @@ interface EIP1193Provider {
287
298
  removeListener: (eventName: string | symbol, listener: (...args: any[]) => void) => any;
288
299
  }
289
300
  /**
290
- * The PrivyProxyProvider adds a middleware layer on top of the underlying wallet provider.
291
301
  * @hidden
302
+ *
303
+ * The PrivyProxyProvider adds a middleware layer on top of the underlying wallet provider.
292
304
  * */
293
305
  declare class PrivyProxyProvider implements EIP1193Provider {
294
306
  walletProvider?: EIP1193Provider;
@@ -322,8 +334,9 @@ declare class Embedded1193Provider extends EventEmitter implements EIP1193Provid
322
334
  connect(): Promise<string | null>;
323
335
  }
324
336
  /**
325
- * Shim to convert to ethers-compatible ExternalProvider class.
326
337
  * @hidden
338
+ *
339
+ * Shim to convert to ethers-compatible ExternalProvider class.
327
340
  */
328
341
  declare class AsExternalProvider extends PrivyProxyProvider implements ExternalProvider {
329
342
  constructor(provider: EIP1193Provider);
@@ -566,7 +579,6 @@ interface AuthFlow {
566
579
  interface ConnectorManagerEvents {
567
580
  walletsUpdated(): void;
568
581
  }
569
- /** @hidden */
570
582
  declare class ConnectorManager extends EventEmitter<ConnectorManagerEvents> {
571
583
  walletConnectors: WalletConnector[];
572
584
  initialized: boolean;
@@ -585,46 +597,15 @@ declare class ConnectorManager extends EventEmitter<ConnectorManagerEvents> {
585
597
  * 3. Active wallet is moved to front of array (if it exists)
586
598
  */
587
599
  get wallets(): BaseConnectedWallet[];
588
- /**
589
- * Detect and add all valid wallet connectors.
590
- */
591
- initialize(): void;
592
600
  /**
593
601
  * Helper function to find a wallet connector by connector type and wallet client type.
594
602
  */
595
603
  findWalletConnector(connectorType: ConnectorType, walletClientType: WalletClientType): WalletConnector | null;
596
- /**
597
- * Add any connectedAt overrides for newly initialized wallets and pass-through change events.
598
- */
599
- private onInitialized;
600
- /**
601
- * Save connection history and pass-through change events.
602
- */
603
- private onWalletsUpdated;
604
- addEmbeddedWalletConnector(walletProxy: EmbeddedWalletProxy, address: string): void;
605
- /**
606
- * Normally, we do not remove connectors after creation. Privy embedded wallets are an exception
607
- * because they are closely tied with an authenticated state.
608
- */
609
- removeEmbeddedWalletConnector(): void;
610
604
  /**
611
605
  * Creates a new wallet connector for the given connector type and wallet client type.
612
606
  * If a connector already exists, it will be returned instead.
613
607
  */
614
608
  createWalletConnector(connectorType: ConnectorType, walletClientType: WalletClientType): Promise<WalletConnector | null>;
615
- private addWalletConnector;
616
- /**
617
- * Upon initialization, loads previous connections from local storage. If local storage
618
- * is misformatted (e.g. due to previous privy:connectors usage), it returns an empty array that
619
- * will be overwritten later.
620
- *
621
- * @returns StoredConnection[] list of stored connections from previous session
622
- */
623
- private loadConnectionHistory;
624
- /**
625
- * Saves all current connections to local storage overridding any previous connections.
626
- */
627
- private saveConnectionHistory;
628
609
  /**
629
610
  * @deprecated **Deprecated**: This feature will be removed and should be replaced by
630
611
  * interfacing with wallets directly (wallets[0].getEthereumProvider()).
@@ -784,40 +765,14 @@ type MoonpaySignResponse = {
784
765
  };
785
766
 
786
767
  declare const SUPPORTED_OAUTH_PROVIDERS: readonly ["google", "discord", "twitter", "github", "apple"];
787
- type OAuthProviderType = typeof SUPPORTED_OAUTH_PROVIDERS[number];
788
- /** @hidden */
768
+ type OAuthProviderType = (typeof SUPPORTED_OAUTH_PROVIDERS)[number];
789
769
  type EmbeddedWalletClientType = 'privy';
790
- /** @hidden */
791
770
  type InjectedWalletClientType = 'metamask' | 'phantom';
792
- /** @hidden */
793
771
  type CoinbaseWalletClientType = 'coinbase_wallet';
794
- /** @hidden
795
- *
796
- * How this works:
797
- *
798
- * The raw data is pulled from https://registry.walletconnect.com/api/v3/wallets
799
- * Some post-processing is done using the following script.
800
- *
801
- * const axios = require('axios');
802
- * const walletTypes = [];
803
- * axios.get("https://explorer-api.walletconnect.com/v3/wallets?projectId=2f05ae7f1116030fde2d36508f472bfb&entries=400&page=1&version=2&chains=eip155%3A1").then((apiResult) => {
804
- * Object.values(apiResult.data.listings).forEach((walletEntry) => {
805
- * if (!walletEntry.mobile.native || !walletEntry.mobile.universal) return;
806
- * if (!walletEntry.chains.includes('eip155:1')) return;
807
- * if (!walletEntry.metadata.shortName) return;
808
- * // Manually removed for cleanliness
809
- * if (walletEntry.id === 'b2ce31fb31735fa886270806340de999f72342a7c29484badd8d4d013d77c8b8') return;
810
- * if (walletEntry.id) walletTypes.push(`'${walletEntry.id}'`);
811
- * });
812
- * console.log(walletTypes.join("\n | "));
813
- * });
814
- */
815
- 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';
816
- /** @hidden */
817
772
  type UnknownWalletClientType = 'unknown';
818
773
  type WalletClientType = InjectedWalletClientType | CoinbaseWalletClientType | WalletConnectWalletClientType | EmbeddedWalletClientType | UnknownWalletClientType;
819
774
  declare const SUPPORTED_CONNECTOR_TYPES: string[];
820
- type ConnectorType = typeof SUPPORTED_CONNECTOR_TYPES[number];
775
+ type ConnectorType = (typeof SUPPORTED_CONNECTOR_TYPES)[number];
821
776
  /**
822
777
  * Wallet metadata currently for internal use only
823
778
  */
@@ -1277,28 +1232,6 @@ type PrivyClientConfig = {
1277
1232
  */
1278
1233
  useSandbox?: boolean;
1279
1234
  };
1280
- /**
1281
- * Override the default rendering settings, used for displaying in a non-modal setting.
1282
- * For internal use only.
1283
- * @hidden
1284
- */
1285
- _render?: {
1286
- /**
1287
- * If true, the modal renders with a dialog, which centers the modal, blocks scrolling on the body, adds a backdrop,
1288
- * and adds a close button in the top right corner.
1289
- * If false, the modal renders wherever the portal is set to (defaults to the bottom of document.body), without the above features.
1290
- *
1291
- * Defaults to true.
1292
- */
1293
- inDialog?: boolean;
1294
- /**
1295
- * The id of the node to render the modal in, using a React portal.
1296
- * If the element with id specified does not exist, or is set to null, renders to document.body.
1297
- *
1298
- * Defaults to null.
1299
- */
1300
- inParentNodeId?: string | null;
1301
- };
1302
1235
  };
1303
1236
  interface AllowlistConfig {
1304
1237
  errorTitle: string | null;
@@ -1455,12 +1388,6 @@ interface PrivyProviderProps {
1455
1388
  * Values here will override their server-configuration counterparts.
1456
1389
  */
1457
1390
  config?: PrivyClientConfig;
1458
- /**
1459
- * Override the URL of the Privy API, which is 'https://auth.privy.io' by default.
1460
- * For development and testing use only.
1461
- * @hidden
1462
- */
1463
- apiUrl?: string;
1464
1391
  /**
1465
1392
  * @ignore
1466
1393
  * @class