@privy-io/react-auth 1.42.0 → 1.43.0-beta-20231004142809

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
@@ -273,7 +273,8 @@ declare enum PrivyErrorCode {
273
273
  INVALID_CREDENTIALS = "invalid_credentials",
274
274
  EMBEDDED_WALLET_ALREADY_EXISTS = "embedded_wallet_already_exists",
275
275
  UNKNOWN_EMBEDDED_WALLET_ERROR = "unknown_embedded_wallet_error",
276
- EMBEDDED_WALLET_PASSWORD_UNCONFIRMED = "embedded_wallet_password_unconfirmed"
276
+ EMBEDDED_WALLET_PASSWORD_UNCONFIRMED = "embedded_wallet_password_unconfirmed",
277
+ UNSUPPORTED_CHAIN_ID = "unsupported_chain_id"
277
278
  }
278
279
 
279
280
  /**
@@ -399,9 +400,10 @@ declare abstract class WalletConnector extends EventEmitter<ConnectorEvents> {
399
400
  wallets: BaseConnectedWallet[];
400
401
  walletClientType: WalletClientType;
401
402
  chains: Chain[];
403
+ defaultChain: Chain;
402
404
  abstract connectorType: ConnectorType;
403
405
  abstract proxyProvider: PrivyProxyProvider | Embedded1193Provider;
404
- constructor(walletClientType: WalletClientType, chains: Chain[]);
406
+ constructor(walletClientType: WalletClientType, chains: Chain[], defaultChain: Chain);
405
407
  /**
406
408
  * Builds a connected wallet object to be exposed to the developer. This object
407
409
  * contains the address, chainId, and a few helper methods.
@@ -617,7 +619,8 @@ declare class ConnectorManager extends EventEmitter<ConnectorManagerEvents> {
617
619
  private walletConnectCloudProjectId;
618
620
  private rpcConfig;
619
621
  private chains;
620
- constructor(walletConnectCloudProjectId: string, rpcConfig: RpcConfig, chains: Chain[]);
622
+ private defaultChain;
623
+ constructor(walletConnectCloudProjectId: string, rpcConfig: RpcConfig, chains: Chain[], defaultChain: Chain);
621
624
  /**
622
625
  * The core wallets array that is exposed to developers. It builds
623
626
  * the wallets away with the following logic:
@@ -699,7 +702,7 @@ declare class PrivyClient {
699
702
  * config. We can set this once and only once. If it is set twice, event listeners will be created
700
703
  * on the first ConnectorManager and are not re-created.
701
704
  */
702
- initializeConnectorManager(walletConnectCloudProjectId: string, rpcConfig: RpcConfig, chains: Chain[]): void;
705
+ initializeConnectorManager(walletConnectCloudProjectId: string, rpcConfig: RpcConfig, chains: Chain[], defaultChain: Chain): void;
703
706
  generateApi(): Http;
704
707
  /**
705
708
  * In the case of cookie-based auth, re-initialize the http client with the custom api url.
@@ -1247,7 +1250,32 @@ type PrivyClientConfig = {
1247
1250
  * @experimental
1248
1251
  */
1249
1252
  rpcConfig?: RpcConfig;
1253
+ /**
1254
+ * @deprecated use `supportedChains` instead.
1255
+ *
1256
+ */
1250
1257
  additionalChains?: Chain[];
1258
+ /**
1259
+ * A list of supported chains, used to specify which chains should be used throughout the application.
1260
+ *
1261
+ * Calling `sendTransaction` or `switchChain` on an unsupported network will throw an error.
1262
+ *
1263
+ * For external wallets, if the wallet's current chain post-connection (during connect-only or siwe flows)
1264
+ * is not within the supported chains list, the user will be prompted to switch to the `defaultChain` (if set) or first supplied
1265
+ * `supportedChain`. If the chain switching process does not fully succeed, the user will **not** be blocked from the
1266
+ * application (and the wallet's current `chainId` can always be observed and acted upon accordingly.)
1267
+ *
1268
+ * For embedded wallets, the wallet will automatically default to the `defaultChain` (if set) or first supplied `supportedChain`.
1269
+ */
1270
+ supportedChains?: Chain[];
1271
+ /**
1272
+ * When supplied, the `defaultChain` will be the default chain used throughout the application.
1273
+ *
1274
+ * For external wallets, it will be used if the user's wallet it not within the `supportedChains` (or default chains) list.
1275
+ *
1276
+ * For embedded wallets, it will be used upon initialization, when the user hasn't switched to another supported chain.
1277
+ */
1278
+ defaultChain?: Chain;
1251
1279
  captchaEnabled?: boolean;
1252
1280
  /** All embedded wallets configuration */
1253
1281
  embeddedWallets?: {