@privy-io/react-auth 1.22.0 → 1.23.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
@@ -1,9 +1,63 @@
1
- import React from 'react';
1
+ import React, { ReactElement } from 'react';
2
2
  import { ExternalProvider, Web3Provider } from '@ethersproject/providers';
3
3
  import WCProvider from '@walletconnect/web3-provider';
4
4
  import { AbstractProvider } from 'web3-core';
5
5
  import { AxiosResponse, AxiosRequestConfig } from 'axios';
6
6
 
7
+ type Address = string;
8
+ type HexString = string;
9
+ type BytesLike = ArrayLike<number> | string;
10
+ type AccessList = Array<{
11
+ address: string;
12
+ storageKeys: Array<string>;
13
+ }>;
14
+ type AccessListish = AccessList | Array<[string, Array<string>]> | Record<string, Array<string>>;
15
+ type Quantity = HexString | number | bigint;
16
+ type UnsignedTransactionRequest = {
17
+ to?: Address;
18
+ nonce?: number;
19
+ gasLimit?: Quantity;
20
+ gasPrice?: Quantity;
21
+ data?: BytesLike;
22
+ /** Integer of the value sent with this transaction, in Wei. */
23
+ value?: Quantity;
24
+ chainId?: number;
25
+ type?: number;
26
+ accessList?: AccessListish;
27
+ maxPriorityFeePerGas?: Quantity;
28
+ maxFeePerGas?: Quantity;
29
+ };
30
+ type Log = {
31
+ blockNumber: number;
32
+ blockHash: string;
33
+ transactionIndex: number;
34
+ removed: boolean;
35
+ address: string;
36
+ data: string;
37
+ topics: Array<string>;
38
+ transactionHash: string;
39
+ logIndex: number;
40
+ };
41
+ type TransactionReceipt = {
42
+ to: string;
43
+ from: string;
44
+ contractAddress: string;
45
+ transactionIndex: number;
46
+ root?: string;
47
+ logs: Array<Log>;
48
+ logsBloom: string;
49
+ blockHash: string;
50
+ transactionHash: string;
51
+ blockNumber: number;
52
+ confirmations: number;
53
+ byzantium: boolean;
54
+ type: number;
55
+ status?: number;
56
+ gasUsed: string;
57
+ cumulativeGasUsed: string;
58
+ effectiveGasPrice: string;
59
+ };
60
+
7
61
  declare const SUPPORTED_OAUTH_PROVIDERS: readonly ["google", "discord", "twitter", "github", "apple"];
8
62
  type OAuthProviderType = typeof SUPPORTED_OAUTH_PROVIDERS[number];
9
63
  declare const SUPPORTED_WALLET_CONNECTION_TYPES: readonly ["metamask", "phantom", "coinbase_wallet", "wallet_connect"];
@@ -219,9 +273,32 @@ type PrivyClientConfig = {
219
273
  * Used for buttons, active borders, etc. This will generate light and dark variants.
220
274
  * This overrides the server setting `accent_color`. */
221
275
  accentColor?: HexColor;
222
- /** Logo url for the main privy modal screen.
276
+ /** Logo for the main privy modal screen.
277
+ * This can be a string (url) or an img / svg react element.
278
+ * If passing an element, Privy will overwrite the `style` props, to ensure proper rendering.
223
279
  * This overrides the server setting `logo_url` */
224
- logo?: string;
280
+ logo?: string | ReactElement;
281
+ /** Determines the order of the login options in the privy modal. If true, the wallet login will render above
282
+ * social and email / sms login options.
283
+ * This overrides the server setting `show_wallet_login_first` */
284
+ showWalletLoginFirst?: boolean;
285
+ };
286
+ /** Specified login methods for the privy modal.
287
+ * Existence of options in this list overrides the server settings `wallet_auth`, `email_auth`, `sms_auth`, `google_oauth`, `twitter_oauth`,
288
+ * `discord_oauth`, `github_oauth`, `apple_oauth` (respectively).
289
+ * Only `email` OR `sms` can be specified, not both. If both are specified, `email` will be used.
290
+ * The order of this array does not currently dictate order of the social login methods in the UI. */
291
+ loginMethods?: Array<'wallet' | 'email' | 'sms' | 'google' | 'twitter' | 'discord' | 'github' | 'apple'>;
292
+ /** All legal configuration */
293
+ legal?: {
294
+ /** URL to the terms and conditions page for your application.
295
+ * Rendered as a link in the privy modal footer.
296
+ * This overrides the server setting `terms_and_conditions_url` */
297
+ termsAndConditionsUrl?: string | null;
298
+ /** URL to the privacy policy page for your application.
299
+ * Rendered as a link in the privy modal footer.
300
+ * This overrides the server setting `privacy_policy_url` */
301
+ privacyPolicyUrl?: string | null;
225
302
  };
226
303
  };
227
304
  interface AllowlistConfig {
@@ -235,6 +312,11 @@ type SignMessageModalUIOptions = {
235
312
  description?: string;
236
313
  buttonText?: string;
237
314
  };
315
+ type SendTransactionModalUIOptions = {
316
+ title?: string;
317
+ description?: string;
318
+ buttonText?: string;
319
+ };
238
320
 
239
321
  declare function getAccessToken(): Promise<string | null>;
240
322
  /**
@@ -677,7 +759,8 @@ interface PrivyInterface {
677
759
  *
678
760
  * This function currently has a precondition that the user has a Privy wallet. It will fail otherwise.
679
761
  */
680
- signMessage: (message: string, data?: SignMessageModalUIOptions) => Promise<string>;
762
+ signMessage: (message: string, uiOptions?: SignMessageModalUIOptions) => Promise<string>;
763
+ sendTransaction: (data: UnsignedTransactionRequest, uiOptions?: SendTransactionModalUIOptions) => Promise<TransactionReceipt>;
681
764
  exportWallet: () => Promise<void>;
682
765
  }
683
766
  /**