Skip to main content

@privy-io/react-auth

Interfaces

Type Aliases

PrivyClientConfig

Ƭ PrivyClientConfig: Object

Type declaration

NameTypeDescription
appearance?{ accentColor?: HexColor ; logo?: string | ReactElement ; showWalletLoginFirst?: boolean ; theme?: "light" | "dark" | HexColor }All UI and theme related configuration
appearance.accentColor?HexColorAccent color for the privy UI. Used for buttons, active borders, etc. This will generate light and dark variants. This overrides the server setting accent_color.
appearance.logo?string | ReactElementLogo for the main privy modal screen. This can be a string (url) or an img / svg react element. If passing an element, Privy will overwrite the style props, to ensure proper rendering. This overrides the server setting logo_url
appearance.showWalletLoginFirst?booleanDetermines the order of the login options in the privy modal. If true, the wallet login will render above social and email / sms login options. This overrides the server setting show_wallet_login_first
appearance.theme?"light" | "dark" | HexColorPrimary theme for the privy UI. This dictates the foreground and background colors within the UI. 'light' (default): The privy default light UI. 'dark': The privy default dark UI. custom hex code (i.e. '#13152F'): A custom background. This will generate the remainder of the foreground and background colors for the UI by modulating the luminance of the passed color. This value should be either dark or light (<20% or >80% luminance), for accessibility.
legal?{ privacyPolicyUrl?: string | null ; termsAndConditionsUrl?: string | null }All legal configuration
legal.privacyPolicyUrl?string | nullURL to the privacy policy page for your application. Rendered as a link in the privy modal footer. This overrides the server setting privacy_policy_url
legal.termsAndConditionsUrl?string | nullURL to the terms and conditions page for your application. Rendered as a link in the privy modal footer. This overrides the server setting terms_and_conditions_url
loginMethods?("wallet" | "email" | "sms" | "google" | "twitter" | "discord" | "github" | "apple")[]Specified login methods for the privy modal. If this parameter is included, it will override any login method settings specified on the server. Only email OR sms can be specified, not both. If both are specified, email will be used. Social login methods require email OR sms to also be specified. loginMethods cannot be an empty array if specified. The order of this array does not currently dictate order of the login methods in the UI, but may in the future.

Quantity

Ƭ Quantity: string | number | bigint


SendTransactionModalUIOptions

Ƭ SendTransactionModalUIOptions: Object

Type declaration

NameType
buttonText?string
description?string
modalTitle?string
senderInfo?SenderInfo
title?string
transactionInfo?SendTransactionModalTransactionInfo

SignMessageModalUIOptions

Ƭ SignMessageModalUIOptions: Object

Type declaration

NameType
buttonText?string
description?string
title?string

TransactionLog

Ƭ TransactionLog: Object

Type declaration

NameType
addressstring
blockHashstring
blockNumbernumber
datastring
logIndexnumber
removedboolean
topicsstring[]
transactionHashstring
transactionIndexnumber

TransactionReceipt

Ƭ TransactionReceipt: Object

Type declaration

NameType
blockHashstring
blockNumbernumber
byzantiumboolean
confirmationsnumber
contractAddressstring
cumulativeGasUsedstring
effectiveGasPricestring
fromstring
gasUsedstring
logsTransactionLog[]
logsBloomstring
root?string
status?number
tostring
transactionHashstring
transactionIndexnumber
typenumber

UnsignedTransactionRequest

Ƭ UnsignedTransactionRequest: Object

Type declaration

NameType
accessList?{ address: string ; storageKeys: string[] }[] | [string, string[]][] | Record<string, string[]>
chainId?number
data?ArrayLike<number> | string
from?string
gasLimit?Quantity
gasPrice?Quantity
maxFeePerGas?Quantity
maxPriorityFeePerGas?Quantity
nonce?number
to?string
type?number
value?Quantity

Variables

VERSION

Const VERSION: string = version

Functions

PrivyProvider

PrivyProvider(props): Element

Passes the Privy authentication context to your React components.

This should wrap any components that will to use the Privy SDK via the usePrivy hook. As an example:

// At your application root (e.g. `_app.tsx` in NextJS):
import {PrivyProvider} from '@privy-io/react-auth';

<PrivyProvider appId="APP_ID_FROM_CONSOLE" onSuccess={() => console.log('Success!')}>
<Component {...pageProps} />
</PrivyProvider>

Parameters

NameType
propsPrivyProviderProps

Returns

Element


getAccessToken

getAccessToken(): Promise<string | null>

Returns

Promise<string | null>


usePrivy

usePrivy(): PrivyInterface

React Hook that allows you to manage the user's current authentication state and access their linked accounts.

You should use this hook to access the Privy SDK from within your React components and custom hooks.

Returns

PrivyInterface


useWallets

useWallets(): UseWalletsInterface

Returns

UseWalletsInterface