@privy-io/react-auth 1.43.3 → 1.43.4

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
@@ -157,18 +157,30 @@ type Chain = {
157
157
  testnet?: boolean;
158
158
  };
159
159
  /**
160
- * RPC overrides to support custom RPC URLs. Do not provide an RPC URL
161
- * that can serve multiple networks. You should only provide RPC URLs that
162
- * are specific to the network you'd like to override.
160
+ * RPC configuration for wallets.
163
161
  */
164
162
  type RpcConfig = {
165
163
  /**
166
164
  * Mapping of chainId to RPC URL. Overrides Privy default RPC URLs that are shared across projects. Set your own RPC URLs
167
165
  * to avoid rate limits or other throughput bottlenecks.
166
+ *
167
+ * Do not provide an RPC URL that can serve multiple networks. You should only provide RPC URLs that are speciifc to the
168
+ * chain ID you'd like to override.
168
169
  */
169
- rpcUrls: {
170
+ rpcUrls?: {
170
171
  [key: number]: string;
171
172
  };
173
+ /**
174
+ * Mapping between `walletClientType`s to the length of time after which RPC requests will timeout for that
175
+ * `walletClientType`.
176
+ *
177
+ * By default, all RPC requests through Privy will timeout after 2 mins (120000 ms). Use this object to
178
+ * override the RPC timeout in ms for specific` walletClientType`s, e.g. 'safe', in order to extend or
179
+ * shorten the timeout duration.
180
+ */
181
+ rpcTimeouts?: {
182
+ [key in WalletClientType]?: number;
183
+ };
172
184
  };
173
185
 
174
186
  declare const DEFAULT_SUPPORTED_CHAINS: readonly [Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain];
@@ -256,6 +268,13 @@ declare abstract class PrivyError extends Error {
256
268
  protected constructor(message: string, cause?: unknown, privyErrorCode?: PrivyErrorCode);
257
269
  toString(): string;
258
270
  }
271
+ /**
272
+ * The PrivyConnector instance threw an exception.
273
+ */
274
+ declare class PrivyConnectorError extends PrivyError {
275
+ type: string;
276
+ constructor(message: string, cause?: unknown, privyErrorCode?: PrivyErrorCode);
277
+ }
259
278
  declare enum PrivyErrorCode {
260
279
  MISSING_OR_INVALID_PRIVY_APP_ID = "missing_or_invalid_privy_app_id",
261
280
  MISSING_OR_INVALID_PRIVY_ACCOUNT_ID = "missing_or_invalid_privy_account_id",
@@ -277,6 +296,10 @@ declare enum PrivyErrorCode {
277
296
  UNSUPPORTED_CHAIN_ID = "unsupported_chain_id"
278
297
  }
279
298
 
299
+ declare class WalletTimeoutError extends PrivyConnectorError {
300
+ type: string;
301
+ constructor();
302
+ }
280
303
  /**
281
304
  * A ProviderRpcError combines the necessary bits of the {PrivyError} with the
282
305
  * EIP-compliant ProviderRpcError. This is meant to be a type around errors raised
@@ -308,6 +331,7 @@ type ProviderMessage = {
308
331
  type OnMessageEventHandler = (message: ProviderMessage) => void;
309
332
  type EIP1193OnEventHandler = OnConnectEventHandler | OnDisconnectEventHandler | OnChainChangedEventHandler | OnAccountsChangedEventHandler | OnMessageEventHandler;
310
333
  interface EIP1193Provider {
334
+ rpcTimeoutDuration?: number;
311
335
  request: (request: {
312
336
  method: string;
313
337
  params?: Array<any> | undefined;
@@ -321,15 +345,17 @@ interface EIP1193Provider {
321
345
  * The PrivyProxyProvider adds a middleware layer on top of the underlying wallet provider.
322
346
  * */
323
347
  declare class PrivyProxyProvider implements EIP1193Provider {
348
+ rpcTimeoutDuration: number;
324
349
  walletProvider?: EIP1193Provider;
325
350
  private _subscriptions;
326
- constructor(walletProvider?: EIP1193Provider);
351
+ constructor(walletProvider?: EIP1193Provider, rpcTimeoutDuration?: number);
327
352
  on(eventName: string, listener: (...args: any[]) => void): any;
328
353
  request(request: {
329
354
  method: string;
330
355
  params?: any[] | undefined;
331
356
  }): Promise<any>;
332
357
  removeListener: (eventName: string | symbol, listener: (...args: any[]) => void) => any;
358
+ walletTimeout: (error?: WalletTimeoutError, timeoutMs?: number) => Promise<string[]>;
333
359
  setWalletProvider: (provider: EIP1193Provider) => void;
334
360
  }
335
361
  interface RequestArguments {
@@ -343,6 +369,7 @@ declare class Embedded1193Provider extends EventEmitter implements EIP1193Provid
343
369
  chainId: number;
344
370
  rpcConfig: RpcConfig;
345
371
  chains: Chain[];
372
+ rpcTimeoutDuration: number;
346
373
  constructor(walletProxy: EmbeddedWalletProxy, address: string, rpcConfig: RpcConfig, chains: Chain[], chainId?: number);
347
374
  handleSendTransaction(args: RequestArguments): Promise<string>;
348
375
  private handleSwitchEthereumChain;
@@ -401,9 +428,11 @@ declare abstract class WalletConnector extends EventEmitter<ConnectorEvents> {
401
428
  walletClientType: WalletClientType;
402
429
  chains: Chain[];
403
430
  defaultChain: Chain;
431
+ rpcConfig: RpcConfig;
432
+ rpcTimeoutDuration: number;
404
433
  abstract connectorType: ConnectorType;
405
434
  abstract proxyProvider: PrivyProxyProvider | Embedded1193Provider;
406
- constructor(walletClientType: WalletClientType, chains: Chain[], defaultChain: Chain);
435
+ constructor(walletClientType: WalletClientType, chains: Chain[], defaultChain: Chain, rpcConfig: RpcConfig);
407
436
  /**
408
437
  * Builds a connected wallet object to be exposed to the developer. This object
409
438
  * contains the address, chainId, and a few helper methods.
@@ -1262,12 +1291,6 @@ type PrivyClientConfig = {
1262
1291
  privacyPolicyUrl?: string | null;
1263
1292
  };
1264
1293
  walletConnectCloudProjectId?: string;
1265
- /**
1266
- * RPC overrides to support custom RPC URLs.
1267
- *
1268
- * @experimental
1269
- */
1270
- rpcConfig?: RpcConfig;
1271
1294
  /**
1272
1295
  * @deprecated use `supportedChains` instead.
1273
1296
  *