Skip to main content

@justaname.id/react

Interfaces

Functions

JustaNameProvider

JustaNameProvider(props, context?): ReactNode

Provides JustaName context to child components, allowing them to access and interact with the JustaName service.

Parameters

NameTypeDescription
propsJustaNameProviderThe props for the JustaNameProvider component.
context?any-

Returns

ReactNode

The provider component wrapping children.

Component

Defined in

packages/@justaname.id/react/src/lib/providers/JustaNameProvider.tsx:58

packages/@justaname.id/react/src/lib/providers/JustaNameProvider.tsx:73


SignatureOnMounted

SignatureOnMounted(props, context?): ReactNode

Parameters

NameType
propsObject
context?any

Returns

ReactNode

Defined in

packages/@justaname.id/react/src/lib/components/SignatureOnMounted.tsx:5


buildAccountInvitationsKey

buildAccountInvitationsKey(address, chainId): (undefined | string | ChainId)[]

Parameters

NameType
addressundefined | string
chainIdChainId

Returns

(undefined | string | ChainId)[]

Defined in

packages/@justaname.id/react/src/lib/hooks/useAccountInvitations.ts:11


buildAccountSubnamesKey

buildAccountSubnamesKey(address, chainId, ensDomain?): any[]

Constructs a unique cache key for storing and retrieving subnames data associated with a wallet address.

Parameters

NameTypeDescription
addressundefined | stringThe Ethereum address of the connected wallet.
chainIdChainId
ensDomain?string

Returns

any[]

A unique cache key array for react-query.

Defined in

packages/@justaname.id/react/src/lib/hooks/useAccountSubnames.ts:23


buildAddressSubnamesKey

buildAddressSubnamesKey(address, chainId): any[]

Constructs a unique cache key for storing and retrieving subnames data associated with a wallet address.

Parameters

NameTypeDescription
addressundefined | stringThe Ethereum address of the connected wallet.
chainIdChainId

Returns

any[]

A unique cache key array for react-query.

Defined in

packages/@justaname.id/react/src/lib/hooks/useAddressSubnames.ts:21


buildCommunitiesKey

buildCommunitiesKey(chainId, orderBy, orderDirection): (string | ChainId)[]

Parameters

NameType
chainIdChainId
orderBystring
orderDirectionstring

Returns

(string | ChainId)[]

Defined in

packages/@justaname.id/react/src/lib/hooks/useCommunities.ts:5


buildCommunitySubnamesKey

buildCommunitySubnamesKey(domainName, isClaimed, chainId, page, limit): (undefined | string | number | boolean)[]

Parameters

NameType
domainNameundefined | string
isClaimedboolean
chainIdChainId
pagenumber
limitnumber

Returns

(undefined | string | number | boolean)[]

Defined in

packages/@justaname.id/react/src/lib/hooks/useCommunitySubnames.ts:5


buildIsSubnameAvailableKey

buildIsSubnameAvailableKey(username, ensDomain, chainId): (string | ChainId)[]

Parameters

NameType
usernamestring
ensDomainstring
chainIdChainId

Returns

(string | ChainId)[]

Defined in

packages/@justaname.id/react/src/lib/hooks/useIsSubnameAvailable.ts:7


buildRecordsBySubnameKey

buildRecordsBySubnameKey(subname, chainId, providerUrl): (string | ChainId)[]

Parameters

NameType
subnamestring
chainIdChainId
providerUrlstring

Returns

(string | ChainId)[]

Defined in

packages/@justaname.id/react/src/lib/hooks/useRecords.ts:5


buildSearchSubnamesKey

buildSearchSubnamesKey(subname): (undefined | string)[]

Parameters

NameType
subnameundefined | string

Returns

(undefined | string)[]

Defined in

packages/@justaname.id/react/src/lib/hooks/useSearchSubnames.ts:9


buildSignature

buildSignature(address): string[]

Parameters

NameType
addressstring

Returns

string[]

Defined in

packages/@justaname.id/react/src/lib/hooks/useSubnameSignature.ts:9


buildSubnameBySubnameKey

buildSubnameBySubnameKey(subname, chainId): (string | ChainId)[]

Generates a unique cache key for storing and retrieving subname details.

Parameters

NameTypeDescription
subnamestringThe subname to generate a cache key for.
chainIdChainId-

Returns

(string | ChainId)[]

A unique cache key array for react-query.

Defined in

packages/@justaname.id/react/src/lib/hooks/useSubname.ts:13


getSubnameDetails

getSubnameDetails(fullName, justaname, chainId, providerUrl): Promise<{ records: SubnameRecordsResponse = result; sanitizedRecords: SanitizedRecords = sanitized }>

Parameters

NameType
fullNamestring
justanameJustaName
chainIdChainId
providerUrlstring

Returns

Promise<{ records: SubnameRecordsResponse = result; sanitizedRecords: SanitizedRecords = sanitized }>

Defined in

packages/@justaname.id/react/src/lib/hooks/useRecords.ts:17


useAcceptSubname

useAcceptSubname(): UseAcceptSubname

Custom hook for performing a mutation to accept a subname.

Returns

UseAcceptSubname

An object containing the acceptSubname async function to initiate the subname accept, and a boolean acceptSubnamePending indicating the mutation's pending state.

Defined in

packages/@justaname.id/react/src/lib/hooks/useAcceptSubname.ts:44


useAccountInvitations

useAccountInvitations(props?): UseAccountInvitationsResult

Parameters

NameType
propsUseAccountInvitationsOptions

Returns

UseAccountInvitationsResult

Defined in

packages/@justaname.id/react/src/lib/hooks/useAccountInvitations.ts:41


useAccountSubnames

useAccountSubnames(props?): UseAccountSubnamesResult

Custom hook to fetch subnames associated with the connected wallet's address.

Parameters

NameTypeDescription
propsUseConnectedWalletSubnamesOptionsOptional configurations for subname retrieval.

Returns

UseAccountSubnamesResult

The result object containing subnames data, loading state, and a refetch function.

Defined in

packages/@justaname.id/react/src/lib/hooks/useAccountSubnames.ts:73


useAddSubname

useAddSubname<T>(): UseAddSubname<T>

Custom hook for performing a mutation to add a subname.

Type parameters

NameTypeDescription
TanyThe type of additional parameters that can be passed to the claim subname mutation, extending the base request.

Returns

UseAddSubname<T>

An object containing the addSubname async function to initiate the subname claim, and a boolean claimSubnamePending indicating the mutation's pending state.

Defined in

packages/@justaname.id/react/src/lib/hooks/useAddSubname.ts:35


useAddressSubnames

useAddressSubnames(props): UseAddressSubnamesResult

Custom hook to fetch subnames associated with a wallet's address.

Parameters

NameTypeDescription
propsUseAddressSubnamesOptionsOptional configurations for subname retrieval.

Returns

UseAddressSubnamesResult

The result object containing subnames data, loading state, and a refetch function.

Defined in

packages/@justaname.id/react/src/lib/hooks/useAddressSubnames.ts:71


useCommunities

useCommunities(props): UseInfiniteQueryResult<InfiniteData<SubnameGetAllCommunitiesChainIdResponse, unknown>, Error>

Parameters

NameType
propsUseCommunitiesOptions

Returns

UseInfiniteQueryResult<InfiniteData<SubnameGetAllCommunitiesChainIdResponse, unknown>, Error>

Defined in

packages/@justaname.id/react/src/lib/hooks/useCommunities.ts:21


useCommunitySubnames

useCommunitySubnames(props): UseInfiniteQueryResult<InfiniteData<SubnameGetAllByDomainChainIdResponse, unknown>, Error>

Parameters

NameType
propsUseCommunitySubnamesOptions

Returns

UseInfiniteQueryResult<InfiniteData<SubnameGetAllByDomainChainIdResponse, unknown>, Error>

Defined in

packages/@justaname.id/react/src/lib/hooks/useCommunitySubnames.ts:27


useIsSubnameAvailable

useIsSubnameAvailable(props): UseIsSubnameAvailableResult

Custom hook to check if a subname is available for registration under a given ENS domain.

Parameters

NameTypeDescription
propsUseIsSubnameAvailableOptionsThe options including the username and ENS domain to check.

Returns

UseIsSubnameAvailableResult

An object containing the availability status of the subname (isAvailable) and the loading state of the query (isLoading).

Defined in

packages/@justaname.id/react/src/lib/hooks/useIsSubnameAvailable.ts:39


useJustaName

useJustaName(): JustaNameContextProps

Custom hook for accessing the JustaNameContext.

Returns

JustaNameContextProps

The context value with JustaName service instance and configuration.

Hook

Throws

If the hook is used outside a JustaNameProvider.

Defined in

packages/@justaname.id/react/src/lib/providers/JustaNameProvider.tsx:107


useMounted

useMounted(): boolean

A custom React hook to determine if a component has been mounted.

Returns

boolean

A boolean flag indicating whether the component is currently mounted.

Defined in

packages/@justaname.id/react/src/lib/hooks/useMounted.ts:10


useMountedAccount

useMountedAccount(): { address: undefined ; addresses: undefined ; chain: undefined ; chainId: undefined ; connector: undefined ; isConnected: boolean ; isConnecting: false ; isDisconnected: true ; isReconnecting: false ; status: "disconnected" } | { address: `0x\{string}\` ; `addresses`: readonly [\`0x{string}`, `0x\{string}\`] ; `chain`: `undefined` \| `Chain` ; `chainId`: `number` ; `connector`: `Connector` ; `isConnected`: `boolean` ; `isConnecting`: ``false`` ; `isDisconnected`: ``false`` ; `isReconnecting`: ``false`` ; `status`: ``"connected"`` } \| \{ `address`: `undefined` \| \`0x{string}` ; addresses: undefined | readonly `0x\{string}\`[] ; `chain`: `undefined` \| `Chain` ; `chainId`: `undefined` \| `number` ; `connector`: `undefined` \| `Connector` ; `isConnected`: `boolean` ; `isConnecting`: ``false`` ; `isDisconnected`: ``false`` ; `isReconnecting`: ``true`` ; `status`: ``"reconnecting"`` } \| \{ `address`: `undefined` \| \`0x{string}` ; addresses: undefined | readonly `0x${string}`[] ; chain: undefined | Chain ; chainId: undefined | number ; connector: undefined | Connector ; isConnected: boolean ; isConnecting: true ; isDisconnected: false ; isReconnecting: false ; status: "connecting" }

A custom hook that wraps the useAccount hook from wagmi, incorporating a component mount check.

Returns

{ address: undefined ; addresses: undefined ; chain: undefined ; chainId: undefined ; connector: undefined ; isConnected: boolean ; isConnecting: false ; isDisconnected: true ; isReconnecting: false ; status: "disconnected" } | { address: `0x\{string}\` ; `addresses`: readonly [\`0x{string}`, `0x\{string}\`] ; `chain`: `undefined` \| `Chain` ; `chainId`: `number` ; `connector`: `Connector` ; `isConnected`: `boolean` ; `isConnecting`: ``false`` ; `isDisconnected`: ``false`` ; `isReconnecting`: ``false`` ; `status`: ``"connected"`` } \| \{ `address`: `undefined` \| \`0x{string}` ; addresses: undefined | readonly `0x\{string}\`[] ; `chain`: `undefined` \| `Chain` ; `chainId`: `undefined` \| `number` ; `connector`: `undefined` \| `Connector` ; `isConnected`: `boolean` ; `isConnecting`: ``false`` ; `isDisconnected`: ``false`` ; `isReconnecting`: ``true`` ; `status`: ``"reconnecting"`` } \| \{ `address`: `undefined` \| \`0x{string}` ; addresses: undefined | readonly `0x${string}`[] ; chain: undefined | Chain ; chainId: undefined | number ; connector: undefined | Connector ; isConnected: boolean ; isConnecting: true ; isDisconnected: false ; isReconnecting: false ; status: "connecting" }

An enhanced account object that includes all properties and methods from useAccount, along with an improved isConnected boolean that also takes the component's mount state into consideration.

Defined in

packages/@justaname.id/react/src/lib/hooks/useMountedAccount.ts:12


useRecords

useRecords(props): UseRecordsResult

Parameters

NameType
propsUseRecordsProps

Returns

UseRecordsResult

Defined in

packages/@justaname.id/react/src/lib/hooks/useRecords.ts:71


useRejectSubname

useRejectSubname(): UseRejectSubname

Custom hook for performing a mutation to reject a subname.

Returns

UseRejectSubname

An object containing the rejectSubname async function to initiate the subname reject, and a boolean rejectSubnamePending indicating the mutation's pending state.

Defined in

packages/@justaname.id/react/src/lib/hooks/useRejectSubname.ts:38


useRevokeSubname

useRevokeSubname<T>(): UseRevokeSubname<T>

Custom hook for performing a mutation to revoke a subname.

Type parameters

NameTypeDescription
TanyThe type of additional parameters that can be passed to the revoke subname mutation, extending the base request.

Returns

UseRevokeSubname<T>

An object containing the revokeSubname async function to initiate the subname revoke, and a boolean revokeSubnamePending indicating the mutation's pending state.

Defined in

packages/@justaname.id/react/src/lib/hooks/useRevokeSubname.ts:39


useSearchSubnames

useSearchSubnames(props?): UseSearchSubnamesResult

Parameters

NameType
propsUseSearchSubnamesOptions

Returns

UseSearchSubnamesResult

Defined in

packages/@justaname.id/react/src/lib/hooks/useSearchSubnames.ts:29


useSubname

useSubname(props): UseSubnameResult

Custom hook to query for details about a specific subname using the JustaName service.

Parameters

NameTypeDescription
propsUseSubnameOptionsThe options for fetching the subname.

Returns

UseSubnameResult

An object containing the subname data, loading state, and a refetch function.

Defined in

packages/@justaname.id/react/src/lib/hooks/useSubname.ts:52


useSubnameSignature

useSubnameSignature(): UseSubnameSignatureResult

Custom hook to request a challenge for a subname and obtain a signature proving ownership of an address.

Returns

UseSubnameSignatureResult

An object containing the function to initiate the signing process (subnameSignature) and a boolean indicating if the signature operation is pending (subnameSignaturePending).

Defined in

packages/@justaname.id/react/src/lib/hooks/useSubnameSignature.ts:22


useUpdateSubname

useUpdateSubname(): UseUpdateSubnameResult

Custom hook to handle the subname claim or update process.

Returns

UseUpdateSubnameResult

An object containing methods and properties to handle the mutation state.

Defined in

packages/@justaname.id/react/src/lib/hooks/useUpdateSubname.ts:32