ethereum-identity-kit
Version:
Ethereum Identity Kit - Complete your dapp with the Ethereum identity stack.
1,424 lines (1,373 loc) • 247 kB
TypeScript
import * as react from 'react';
import react__default, { RefObject, ReactNode, Dispatch, SetStateAction, HTMLAttributes, ReactElement } from 'react';
import * as viem from 'viem';
import { Address as Address$1, Abi, Hex as Hex$1 } from 'viem';
import * as _tanstack_react_query from '@tanstack/react-query';
import { FetchNextPageOptions, InfiniteQueryObserverResult, InfiniteData } from '@tanstack/react-query';
import * as abitype from 'abitype';
import * as viem_chains from 'viem/chains';
import * as react_jsx_runtime from 'react/jsx-runtime';
import * as _tanstack_query_core from '@tanstack/query-core';
interface SignInWithEthereumProps {
getNonce: () => Promise<string> | string;
verifySignature: (message: string, nonce: string, signature: string) => Promise<void> | void;
onSignInSuccess: (data: {
address: string;
message: string;
signature: string;
}) => void;
onSignInError: (error: Error) => void;
onDisconnectedClick?: (callback: () => void) => void;
message: string;
darkMode?: boolean;
expirationTime?: number;
autoSignInAfterConnection?: boolean;
}
interface SignInButtonProps extends SignInWithEthereumProps {
onSignedInClick?: () => void;
isSignedIn?: boolean;
isDropdown?: boolean;
isDropdownOpen?: boolean;
hideName?: boolean;
hideAvatar?: boolean;
hideHeader?: boolean;
}
declare const useSiwe: ({ verifySignature, onSignInSuccess, onSignInError, message, getNonce, expirationTime, }: SignInWithEthereumProps) => {
handleSignIn: () => Promise<void>;
isSigningMessage: boolean;
connectedAddress: `0x${string}` | undefined;
};
/**
* useChain hook - keeps track of the current chain id and switching between chains
*
* @returns the current chain id and a function to switch chains
*/
declare const useChain: () => {
getChain: (chainId: number | undefined) => viem.Chain | undefined;
checkChain: ({ chainId, onSuccess, onError }: {
chainId?: number;
onSuccess?: () => void;
onError?: () => void;
}) => Promise<boolean>;
currentChainId: number;
setCurrentChainId: react.Dispatch<react.SetStateAction<number>>;
};
type Address = `0x${string}`;
type Hex = `0x${string}`;
/**
* Profile list identifier type
* Can be a number (list ID), string (ENS name), or null/undefined for no list
*/
type ProfileListType = number | string | null | undefined;
/**
* ENS profile data structure containing all profile information
*/
type ENSProfile = {
/** ENS name (e.g., "vitalik.eth") */
name?: string;
/** Avatar image URL or NFT reference */
avatar?: string;
/** Display name for the profile */
display?: string;
/** Header/banner image URL */
header?: string;
/** IPFS content hash for decentralized content */
contenthash?: string;
/** Key-value pairs of ENS text records */
records?: Record<string, string>;
/** Cross-chain address mappings */
chains?: Record<string, string>;
/** Timestamp of last data refresh */
fresh?: number;
/** ENS resolver contract address */
resolver?: string;
/** Any errors encountered during profile resolution */
errors?: Record<string, string>;
};
type ENSMetadataProfile = {
uri: string;
is_owner: boolean;
full_image: string;
full_svg: string;
svg: string;
host_meta: {
chain_id: string | number;
namespace: string;
contract_address: string;
token_id: string | number;
reference_url: string;
};
name: string;
description: string;
attribute: string;
image: string;
image_url: string;
image_data: string;
background_color: string;
youtube_url: string;
};
type LeaderboardItem = {
address: Address;
name: string | null;
avatar: string | null;
mutuals_rank: string;
followers_rank: string;
following_rank: string;
top8_rank: string;
blocks_rank: string;
top8?: string;
following?: string;
followers: string;
blocks?: string;
mutuals?: string;
};
type StatsResponse = {
followers_count: number;
following_count: number;
};
type ProfileRanks = {
mutuals_rank: number;
followers_rank: number;
following_rank: number;
blocks_rank: number;
top8_rank: number;
};
type ProfileDetailsResponse = {
address: Address;
ens: ENSProfile;
primary_list?: string | null;
ranks: ProfileRanks;
};
type ProfileAccountResponse = {
address: Address;
ens: ENSProfile;
primary_list?: string | null;
};
interface ProfileBadgesResponse {
eventId: string;
participated: boolean;
collection: ProfileBadgeColletionType | null;
}
interface ProfileBadgeColletionType {
event: {
id: number;
fancy_id: string;
name: string;
event_url: string;
image_url: string;
country: string;
city: string;
description: string;
year: number;
start_date: string;
end_date: string;
expiry_date: string;
};
tokenId: string;
owner: string;
}
interface ProfileDetailsWithStats extends ProfileDetailsResponse {
stats: StatsResponse;
}
interface ProfileListsResponse {
primary_list?: string | null;
lists?: string[];
}
type ProfileRoles = {
isOwner: boolean;
isManager: boolean;
isUser: boolean;
listChainId: number;
listRecordsContract: Address;
listSlot: bigint;
};
type AccountResponseType = {
address: Address;
ens?: {
name: string | null;
avatar: string | null;
records: Record<string, string>;
};
primary_list?: string | null;
};
type ProfileStatType = 'followers' | 'following';
type ProfileStatsClickProps = {
addressOrName: Address | string;
stat: ProfileStatType;
};
type RecommendedItemType = {
address: Address;
name?: string;
avatar?: string;
header?: string;
};
type DiscoverResponseType = {
latestFollows: RecommendedItemType[];
recommended: RecommendedItemType[];
};
type FollowerYouKnow = {
address: Address;
name: string | null;
avatar: string | null;
mutuals_rank: string;
header: string | null;
};
interface FollowersYouKnowResponse {
results: FollowerYouKnow[];
length: number;
}
interface ProfileEFPPoapResponse {
eventId: string;
participated: boolean;
collection: ProfileEFPPoapColletionType | null;
}
interface ProfileEFPPoapColletionType {
event: {
id: number;
fancy_id: string;
name: string;
event_url: string;
image_url: string;
country: string;
city: string;
description: string;
year: number;
start_date: string;
end_date: string;
expiry_date: string;
};
tokenId: string;
owner: string;
}
type NotificationItemType = {
address: Address;
name: string | null;
avatar: string | null;
token_id: number;
action: string;
opcode: number;
op: Address;
tag: string;
updated_at: string;
};
type NotificationsResponse = {
summary: {
interval: string;
opcode: string;
total: number;
total_follows: number;
total_unfollows: number;
total_tags: number;
total_untags: number;
};
notifications: NotificationItemType[];
};
type ProfileTabType = 'following' | 'followers';
type BlockedMutedTabType = 'Blocked/Muted' | 'Blocked/Muted By';
type ProfileTableTitleType = ProfileTabType | BlockedMutedTabType;
type FollowSortType = 'latest first' | 'earliest first' | 'follower count';
interface FollowerResponse {
address: Address;
tags: string[];
is_muted: boolean;
is_blocked: boolean;
is_following: boolean;
}
interface FollowingResponse {
version: 1;
record_type: 'address' & string;
address: Address;
tags: string[];
ens?: ENSProfile;
}
type TagCountType = {
tag: string;
count: number;
};
interface InfiniteProfileQueryProps {
addressOrName: string;
list?: number | string;
limit: number;
tags?: string[];
sort?: FollowSortType;
pageParam: number;
allResults?: boolean;
search?: string;
fresh?: boolean;
}
interface FollowingTagsResponse {
token_id: string | number;
tags: string[];
tagCounts: TagCountType[];
taggedAddresses: {
address: Address;
tag: string;
}[];
}
type ProfileEFPSocialType = 'etherscan' | 'com.twitter' | 'com.github' | 'org.telegram' | 'com.discord' | 'etherscan' | 'grails' | 'opensea' | 'vision' | 'website' | 'email' | 'ens';
/**
* Follow state indicating the relationship between two addresses
*/
type FollowState = 'follows' | 'blocks' | 'mutes' | 'none';
/**
* Type of follow state being queried
*/
type FollowStatePropType = 'following' | 'follower';
interface FollowStateProps {
lookupAddressOrName: Address | string;
connectedAddress?: Address;
list?: ProfileListType;
type: FollowStatePropType;
fresh?: boolean;
}
interface BatchFollowStateProps {
lookupAddressesOrNames: (Address | string)[];
list?: ProfileListType;
fresh?: boolean;
}
type BatchFollowStateResponse = {
token_id?: string;
address?: Address;
state: FollowStateResponse;
}[];
type FollowStateResponse = {
follow: boolean;
block: boolean;
mute: boolean;
};
interface FollowStatusResponse {
token_id?: string;
address?: Address;
state: FollowStateResponse;
}
type ForceFollowingState = {
state: FollowStateResponse;
isLoading: boolean;
};
/**
* Following state for UI display and interaction
* Includes both current states and pending/loading states
*/
type FollowingState = 'Block' | 'Blocked' | 'Follow' | 'Pending Following' | 'Following' | 'Unfollow' | 'Mute' | 'Muted' | 'Pending Block' | 'Pending Mute' | 'Unblock' | 'Unmute' | 'Block Back' | 'Mute Back';
/**
* Initial following state when component mounts
*/
type InitialFollowingState = 'Follow' | 'Blocked' | 'Muted' | 'Following';
/**
* Return type for useFollowingState hook
*/
interface UseFollowingStateReturn {
/** Current follow state */
state: FollowState;
/** Whether the follow state is loading */
isLoading: boolean;
}
/**
* Return type for useUserInfo hook
*/
interface UseUserInfoReturn {
/** The list number for the user */
listNum: number | undefined;
/** Array of followers */
followers: FollowerResponse[];
/** Array of following */
following: FollowingResponse[];
/** Follower tag counts */
followerTags: FollowingTagsResponse | undefined;
/** Following tag counts */
followingTags: FollowingTagsResponse | undefined;
/** Whether the user is a list */
userIsList: boolean;
/** Whether followers are loading */
followersIsLoading: boolean;
/** Whether following are loading */
followingIsLoading: boolean;
/** Whether follower tags are loading */
followerTagsLoading: boolean;
/** Whether following tags are loading */
followingTagsLoading: boolean;
/** Function to fetch more followers */
fetchMoreFollowers: (options?: FetchNextPageOptions | undefined) => Promise<InfiniteQueryObserverResult<InfiniteData<{
followers: FollowerResponse[];
nextPageParam: number;
}, unknown>, Error>>;
/** Function to fetch more following */
fetchMoreFollowing: (options?: FetchNextPageOptions | undefined) => Promise<InfiniteQueryObserverResult<InfiniteData<{
following: FollowingResponse[];
nextPageParam: number;
}, unknown>, Error>>;
/** Whether we've reached the end of following */
isEndOfFollowing: boolean;
/** Whether we've reached the end of followers */
isEndOfFollowers: boolean;
/** Whether we're fetching more followers */
isFetchingMoreFollowers: boolean;
/** Whether we're fetching more following */
isFetchingMoreFollowing: boolean;
/** Current following tags filter */
followingTagsFilter: string[];
/** Current followers tags filter */
followersTagsFilter: string[];
/** Current following search term */
followingSearch: string;
/** Current followers search term */
followersSearch: string;
/** Function to set followers search */
setFollowersSearch: (search: string) => void;
/** Function to set following search */
setFollowingSearch: (search: string) => void;
/** Current following sort */
followingSort: FollowSortType;
/** Function to set following sort */
setFollowingSort: (sort: FollowSortType) => void;
/** Current followers sort */
followersSort: FollowSortType;
/** Function to toggle tag filter */
toggleTag: (tab: ProfileTableTitleType, tag: string) => void;
/** Function to set followers sort */
setFollowersSort: (sort: FollowSortType) => void;
/** Function to set followers tags filter */
setFollowersTagsFilter: (filter: string[]) => void;
/** Function to set following tags filter */
setFollowingTagsFilter: (filter: string[]) => void;
}
/**
* Return type for useFollowButton hook
*/
interface UseFollowButtonReturn {
/** Current follow button text */
buttonText: string;
/** Whether the follow button is disabled */
disableHover: boolean;
/** Function to set disable hover */
setDisableHover: (disableHover: boolean) => void;
/** Current follow button state */
buttonState: FollowingState;
/** Pending state of the follow action */
pendingState: false | 'Pending Following' | 'Unfollow' | 'Pending Block' | 'Pending Mute' | 'Unblock' | 'Unmute' | undefined;
/** Whether the follow action is loading */
isLoading: boolean;
/** Function to handle follow/unfollow */
handleAction: () => void;
/** Whether the button should be disabled */
isDisabled: boolean;
/** Current error state */
error: Error | null;
/** Function to clear error state */
clearError: () => void;
/** Accessibility label for screen readers */
ariaLabel: string;
/** Whether the button is in pressed state (for following) */
ariaPressed: boolean;
}
/**
* Return type for useProfileDetails hook
*/
interface UseProfileDetailsReturn {
/** Profile details data */
ens: ENSProfile | undefined;
ranks: ProfileRanks | undefined;
address: Address | undefined;
primaryList: ProfileListType | undefined;
detailsLoading: boolean;
refreshProfileDetails: () => void;
}
type UseUserInfoProps = {
user: string;
showBlocked?: boolean;
showOnlyBlocked?: boolean;
};
declare const useUserInfo: ({ user, showBlocked, showOnlyBlocked, }: UseUserInfoProps) => UseUserInfoReturn;
interface SiweMessageParams {
domain: string;
address: string;
statement?: string;
uri: string;
version: string;
chainId: number;
nonce: string;
issuedAt: string;
expirationTime?: string;
notBefore?: string;
requestId?: string;
resources?: string[];
scheme?: string;
}
type SizeType = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
type EFPActionType = 'CreateEFPList' | 'UpdateEFPList' | 'SetEFPListSettings' | 'UpdateENSProfile';
/**
* Represents a blockchain transaction for EFP operations
*/
type TransactionType = {
/** Human-readable title for the transaction */
title?: string;
/** Detailed description of what the transaction does */
description?: string;
/** Unique identifier for the transaction type */
id: EFPActionType | string;
/** Contract address to interact with */
address: Address$1;
/** Blockchain chain ID (optional, uses default if not provided) */
chainId?: number;
/** Contract ABI for the transaction */
abi: Abi;
/** Name of the contract function to call */
functionName: string;
/** Arguments to pass to the contract function */
args: any[];
/** Transaction hash after execution (populated after submission) */
hash?: Hex$1;
};
type SubmitButtonText = 'switchChain' | 'initiate' | 'pending' | 'reInitiate' | 'indexing' | 'finish' | 'next';
type OpCodeType = 1 | 2 | 3 | 4;
type ListOpType = {
version?: number;
opcode: OpCodeType;
data: Hex$1;
};
type GetListOpsTransactionProps = {
nonce?: bigint;
chainId?: number;
listOps: ListOpType[];
connectedAddress: Address$1;
isMintingNewList?: boolean;
};
type TranslationKey = 'connect' | 'disconnect' | 'follow' | 'unfollow' | 'following' | 'followers' | 'loading' | 'error' | 'success' | 'mute' | 'unmute' | 'block' | 'unblock' | 'save' | 'cancel' | 'confirm' | 'close' | 'viewAll' | 'noData' | 'retry' | 'lists' | 'blocked' | 'muted' | 'block back' | 'mute back' | 'following.title' | 'following.empty' | 'following.empty.connectedUser' | 'followers.title' | 'followers.empty' | 'blocked.title' | 'blocking.title' | 'blocked.empty' | 'blocking.empty' | 'blocking.empty.connectedUser' | 'recommendations.title' | 'recommendations.empty' | 'recommendations.connectedUser' | 'signInWithEthereum' | 'signingMessage' | 'signIn' | 'singingIn' | 'notifications.empty' | 'notifications.error' | 'notifications.follow' | 'notifications.unfollow' | 'notifications.tag' | 'notifications.untag' | 'notifications.block' | 'notifications.unblock' | 'notifications.mute' | 'notifications.unmute' | 'and' | 'others' | 'other' | 'search placeholder' | 'no tags' | 'followersYouKnow.title' | 'followersYouKnow.viewAll' | 'followersYouKnow.noCommon' | 'followersYouKnow.followsThem' | 'followersYouKnow.followThem' | 'followersYouKnow.oneOtherFollows' | 'followersYouKnow.othersFollow' | 'followersYouKnow.and' | 'latest first' | 'earliest first' | 'follower count' | 'transaction.switchChain' | 'transaction.initiate' | 'transaction.pending' | 'transaction.reInitiate' | 'transaction.indexing' | 'transaction.finish' | 'transaction.next' | 'transaction.selectChain' | 'transaction.selectChainDescription' | 'transaction.selectChainLater' | 'transaction.updateListSettings' | 'listSettings.owner' | 'listSettings.manager' | 'listSettings.user' | 'listSettings.listStorageLocation' | 'listSettings.setPrimaryList' | 'listSettings.resetList' | 'transaction.onchainUpdate' | 'transaction.claimPOAPTitle' | 'transaction.claimPOAPDescription' | 'transaction.claimPOAP' | 'transaction.noThanks' | 'followerState.blocksYou' | 'followerState.mutesYou' | 'followerState.followsYou' | 'modal.cancelTransactions.title' | 'modal.cancelTransactions.description' | 'modal.cancelTransactions.confirm' | 'cart.clearCart' | 'cart.clearCart.description' | 'cart.clearCart' | 'goBack' | 'notifications.title' | 'profile.editProfile' | 'profile.noUser' | 'profile.noBio' | 'profile.showMore' | 'profile.showLess' | 'profile.notConfirmedByUser' | 'profile.notConfirmedByUserDescription' | 'recommended.empty' | 'recommended.title' | 'cart.title' | 'cart.changes' | 'cart.clearCart' | 'cart.noItems' | 'cart.action' | 'cart.actions' | 'cart.transaction' | 'cart.transactions' | 'backToTop' | 'summary.title' | 'summary.txn' | 'summary.txns' | 'summary.on' | 'summary.changeChain' | 'summary.insufficientEth' | 'manualAdd.add' | 'manualAdd.alreadyInCart' | 'manualAdd.alreadyFollowing' | 'manualAdd.accountNotFound';
type TranslationFunction = (key: TranslationKey, fallback?: string) => string;
type LanguageCode = string;
type TranslationObject = Partial<Record<TranslationKey, string>>;
type TranslationsMap = Record<LanguageCode, TranslationObject>;
interface TranslationConfig {
translateFn?: TranslationFunction;
translations?: TranslationsMap;
translationsFromJSON?: TranslationsMap;
activeLanguage?: LanguageCode;
fallbackLanguage?: LanguageCode;
}
interface GrailsAPIResponse<T> {
success?: boolean;
data?: T | null;
meta?: {
timestamp?: string;
version?: string;
};
}
type GrailsProfileResponse = GrailsAPIResponse<{
lastSeenAt?: string | null;
lastSeenOnchain?: string | null;
stats?: {
totalNames?: number;
};
ownedNames?: Array<Record<string, unknown>>;
}>;
type ENSNameMetadataValue = string | number | boolean | null | undefined | {
protocol?: string;
value?: string;
} | {
chainName: string;
address: string;
}[];
type ENSNameMetadataResponse = Record<string, ENSNameMetadataValue>;
type GrailsNameMetadataResponse = GrailsAPIResponse<{
metadata: ENSNameMetadataResponse;
}>;
type RolesType = {
name: string;
owner: Address;
manager: Address;
ethAddress: Address;
isWrapped: boolean;
fuses: null | number;
expiryDate: number;
resolver: Address;
};
type GrailsRolesResponse = GrailsAPIResponse<RolesType>;
interface UseEFPPoapsProps {
addressOrName?: Address | string | null;
list?: number | null;
}
declare const useEFPPoaps: ({ addressOrName, list }: UseEFPPoapsProps) => {
ownedBadges: ProfileEFPPoapResponse[];
isLoading: boolean;
};
declare const useIsClient: () => boolean;
declare const useRecommended: (connectedAddress: Address$1, endpoint: "recommended" | "discover", limit: number, list?: string) => {
recommended: {
ens: {
name: string | undefined;
avatar: string | undefined;
records: {
header: string;
} | undefined;
};
tags: never[];
address: Address;
name?: string;
avatar?: string;
header?: string;
}[] | undefined;
isLoading: boolean;
isRefetching: boolean;
fetchMoreRef: (element: HTMLElement | null) => void;
hasNextPage: boolean;
};
declare const useCoolMode: (imageUrl?: string, isLoading?: boolean, disabled?: boolean) => react.RefObject<HTMLButtonElement>;
interface UseFollowerStateProps {
connectedAddress: Address;
lookupAddressOrName: Address | string;
list?: ProfileListType;
}
declare const useFollowerState: ({ connectedAddress, lookupAddressOrName, list }: UseFollowerStateProps) => {
followState: FollowState;
followerTag: {
text: string;
className: string;
} | {
text: string;
className: string;
} | {
text: string;
className: string;
} | {
text: string;
className: string;
};
isFollowerStateLoading: boolean;
};
declare function useWindowSize(): {
width: number | null;
height: number | null;
};
interface UseFollowingStateProps {
lookupAddressOrName: Address | string;
connectedAddress?: Address;
list?: ProfileListType;
initialState?: InitialFollowingState;
forceState?: ForceFollowingState;
}
declare const useFollowingState: ({ lookupAddressOrName, connectedAddress, list, initialState, forceState, }: UseFollowingStateProps) => UseFollowingStateReturn;
type TooltipPlacement = 'auto' | 'top' | 'bottom';
type FlipBehavior = 'flip' | 'shift' | 'hide';
type Boundary = 'viewport' | 'scrollParent' | HTMLElement;
interface Position {
top?: number | string;
bottom?: number | string;
left?: number | string;
right?: number | string;
}
interface UseTooltipPositionOptions {
verticalPlacement?: TooltipPlacement;
horizontalPlacement?: 'left' | 'right';
verticalOffset?: number;
horizontalOffset?: number;
boundary?: Boundary;
flipBehavior?: FlipBehavior;
arrowPadding?: number;
}
interface UseTooltipPositionReturn {
position: Position;
actualPlacement: TooltipPlacement;
arrowPosition: Position;
updatePosition: () => void;
isColliding: boolean;
}
declare const useTooltipPosition: (triggerRef: RefObject<HTMLElement>, tooltipRef: RefObject<HTMLElement>, options?: UseTooltipPositionOptions) => UseTooltipPositionReturn;
declare const useTransactionItem: (id: number, transaction: TransactionType) => {
isActive: boolean;
poapLink: string;
claimPOAP: boolean;
setClaimPOAP: react.Dispatch<react.SetStateAction<boolean>>;
handleClick: () => void;
handleCancel: () => void;
submitButtonText: SubmitButtonText;
transactionDetails: {
hash: `0x${string}` | undefined;
chain: {
id: number | undefined;
name: string;
icon: react.FC<react.SVGProps<SVGSVGElement>> | null;
};
gasEth: string;
gasUsd: string;
};
currentTxIndex: number | undefined;
setCurrentTxIndex: (currentTxIndex: number | undefined) => void;
usesPaymaster: boolean;
};
interface UseProfileStatsProps {
addressOrName: Address | string;
list?: ProfileListType;
prefetchedData?: StatsResponse | null;
refetchPrefetchedData?: () => void;
}
declare const useProfileStats: ({ addressOrName, list, prefetchedData, refetchPrefetchedData, }: UseProfileStatsProps) => {
data: StatsResponse | undefined;
followers: number | undefined;
following: number | undefined;
statsLoading: boolean;
refreshProfileStats: () => void;
};
declare const useOutsideClick: (callbackFn: () => void) => react.RefObject<HTMLElement>;
interface UseProfileDetailsProps {
addressOrName: Address | string;
list?: ProfileListType;
prefetchedData?: ProfileDetailsResponse;
refetchPrefetchedData?: () => void;
}
declare const useProfileDetails: ({ addressOrName, list, prefetchedData, refetchPrefetchedData, }: UseProfileDetailsProps) => UseProfileDetailsReturn;
declare const useFollowersAndFollowing: ({ user, defaultTab, showTagsByDefault, isConnectedUserProfile, showBlocked, showOnlyBlocked, }: {
user: string;
defaultTab: ProfileTabType;
showTagsByDefault?: boolean;
isConnectedUserProfile?: boolean;
showBlocked?: boolean;
showOnlyBlocked?: boolean;
}) => {
activeTab: ProfileTabType;
showTags: boolean;
search: string;
profiles: {
tags: string[];
address: `0x${string}`;
}[];
loadMoreRef: (element: HTMLElement | null) => void;
showFollowsYouBadges: boolean;
profilesEmpty: boolean;
displayHeaders: boolean;
isMobile: boolean;
isFollowingTable: boolean;
toggleTag: (tab: ProfileTableTitleType, tag: string) => void;
setShowTags: react.Dispatch<react.SetStateAction<boolean>>;
setSearch: react.Dispatch<react.SetStateAction<string>>;
setActiveTab: react.Dispatch<react.SetStateAction<ProfileTabType>>;
params: {
profile: FollowingResponse[];
tags: FollowingTagsResponse | undefined;
isLoading: boolean;
results: FollowingResponse[];
tagsLoading: boolean;
selectedTags: string[];
setSelectedTags: (filter: string[]) => void;
sort: FollowSortType;
setSort: (sort: FollowSortType) => void;
tagsFilter: string[];
setTagsFilter: (filter: string[]) => void;
isEndOfResults: boolean;
fetchMore: (options?: _tanstack_query_core.FetchNextPageOptions | undefined) => Promise<_tanstack_query_core.InfiniteQueryObserverResult<_tanstack_query_core.InfiniteData<{
following: FollowingResponse[];
nextPageParam: number;
}, unknown>, Error>>;
search: string;
setSearch: (search: string) => void;
isFetchingMore?: undefined;
} | {
profile: FollowerResponse[];
tags: FollowingTagsResponse | undefined;
isLoading: boolean;
results: FollowerResponse[];
tagsLoading: boolean;
selectedTags: string[];
setSelectedTags: (filter: string[]) => void;
sort: FollowSortType;
setSort: (sort: FollowSortType) => void;
tagsFilter: string[];
setTagsFilter: (filter: string[]) => void;
isEndOfResults: boolean;
isFetchingMore: boolean;
fetchMore: (options?: _tanstack_query_core.FetchNextPageOptions | undefined) => Promise<_tanstack_query_core.InfiniteQueryObserverResult<_tanstack_query_core.InfiniteData<{
followers: FollowerResponse[];
nextPageParam: number;
}, unknown>, Error>>;
search: string;
setSearch: (search: string) => void;
};
};
type ProfileListProps = {
profiles: ProfileItemType[];
connectedAddress?: Address;
selectedList?: ProfileListType;
isLoading?: boolean;
loadingRows?: number;
tags?: string[];
darkMode?: boolean;
showTags?: boolean;
canEditTags?: boolean;
initialFollowState?: InitialFollowingState;
onProfileClick?: (address: Address) => void;
showHeaderImage?: boolean;
rowHeight?: number;
visibleCount?: number;
overscanCount?: number;
listHeight?: string;
showFollowsYouBadges?: boolean;
loadMoreElement?: React.ReactNode;
useVirtualList?: boolean;
showBlockBack?: boolean;
showProfileTooltip?: boolean;
};
type ProfileItemType = {
address: Address;
tags: string[];
ens?: ENSProfile;
followState?: ForceFollowingState;
};
interface FollowersYouKnowModalProps {
connectedAddress: Address;
lookupAddressOrName: Address | string;
}
declare const useFollowersYouKnowModal: ({ connectedAddress, lookupAddressOrName }: FollowersYouKnowModalProps) => {
isEndOfFollowing: boolean;
followersYouKnowProfiles: ProfileItemType[];
fetchMoreFollowersYouKnow: (options?: _tanstack_react_query.FetchNextPageOptions) => Promise<_tanstack_react_query.InfiniteQueryObserverResult<_tanstack_react_query.InfiniteData<{
followersYouKnow: FollowerYouKnow[];
nextPageParam: number;
}, unknown>, Error>>;
followersYouKnowIsLoading: boolean;
followersYouKnowSearch: string;
setFollowersYouKnowSearch: react.Dispatch<react.SetStateAction<string>>;
loadMoreRef: (element: HTMLElement | null) => void;
};
interface UseFollowButtonParams {
lookupAddress: Address$1;
connectedAddress?: Address$1;
selectedList?: ProfileListType;
initialState?: InitialFollowingState;
forceState?: ForceFollowingState;
showBlockBack?: boolean;
showMuteBack?: boolean;
}
declare const useFollowButton: ({ lookupAddress, connectedAddress, selectedList, initialState, forceState, showBlockBack, showMuteBack, }: UseFollowButtonParams) => UseFollowButtonReturn;
declare const useFollowersYouKnow: (connectedAddress: Address, lookupAddressOrName: Address | string) => {
isLoading: boolean;
displayedAvatars: {
avatar: string | null;
address: `0x${string}`;
}[];
displayedNames: string[];
displayedAddresses: `0x${string}`[];
resultLength: number;
};
declare const fetchAccount: (addressOrName: string, list?: ProfileListType) => Promise<AccountResponseType | null>;
declare const isAddress: (address: string) => boolean;
declare const truncateAddress: (address: Address) => string;
declare const fetchNameRoles: (name: string) => Promise<RolesType | null>;
declare const fetchRecommended: (endpoint: "discover" | "recommended", addressOrName?: string | Address, list?: string | null, limit?: number, pageParam?: number) => Promise<RecommendedItemType[]>;
declare const fetchFollowState: ({ lookupAddressOrName, connectedAddress, list, type, fresh, }: FollowStateProps) => Promise<FollowStatusResponse | null>;
declare const fetchNameMetadata: (name: string) => Promise<ENSNameMetadataResponse>;
declare const fetchProfileLists: (addressOrName: string, fresh?: boolean) => Promise<ProfileListsResponse>;
declare const fetchProfileStats: (addressOrName: string, list?: ProfileListType, isLive?: boolean) => Promise<StatsResponse>;
declare const fetchNotifications: (userAddress?: string, interval?: "hour" | "day" | "week" | "month" | "all") => Promise<NotificationsResponse | null>;
declare const fetchProfileDetails: (addressOrName: string, list?: ProfileListType, fresh?: boolean) => Promise<ProfileDetailsResponse | null>;
declare const fetchProfileEFPPoaps: (addressOrName: Address | string | null, list?: number | null, fresh?: boolean) => Promise<ProfileEFPPoapResponse[]>;
declare const fetchFollowersYouKnow: (connectedAddress: Address$1, lookupAddressOrName: string) => Promise<FollowersYouKnowResponse>;
interface FetchAllFollowersYouKnowProps {
connectedAddress: Address;
lookupAddressOrName: Address | string;
limit?: number;
search?: string;
pageParam: number;
}
declare const fetchAllFollowersYouKnow: ({ connectedAddress, lookupAddressOrName, limit, search, pageParam, }: FetchAllFollowersYouKnowProps) => Promise<{
followersYouKnow: FollowerYouKnow[];
nextPageParam: number;
}>;
declare const fetchBatchFollowState: ({ lookupAddressesOrNames, list }: BatchFollowStateProps) => Promise<BatchFollowStateResponse | null>;
declare const createSiweMessageString: (params: SiweMessageParams) => string;
declare const defaultOnStatClick: ({ addressOrName, stat }: ProfileStatsClickProps) => void;
declare const loadTranslationsFromJSON: (filePaths: Record<LanguageCode, string>) => Promise<TranslationsMap>;
declare const isLinkValid: (link?: string) => boolean;
declare const isValidEnsName: (name: string) => boolean;
declare const validateEnsHeader: (headerUrl: string | undefined, name: string | null | undefined) => string | undefined;
declare const listOpAddListRecord: (address: Address) => ListOpType;
declare const listOpRemoveListRecord: (address: Address) => ListOpType;
declare const listOpAddTag: (address: Address, tag: string) => ListOpType;
declare const listOpRemoveTag: (address: Address, tag: string) => ListOpType;
/**
* Formats a number using the user's locale
* @param number - The number to format
* @returns Formatted number string
* @example
* formatNumber(1234567) // Returns: "1,234,567" (en-US locale)
*/
declare const formatNumber: (number: number) => string;
/**
* Formats the text shown in the common followers component next to the avatars
* @param resultLength - Number of common followers
* @param t - Translation function
* @returns Formatted text string
*/
declare const formatFollowersYouKnowText: (resultLength: number, t: TranslationFunction) => string;
/**
* Formats an object into a URL query string
* @param inputs - Object with string keys and various value types
* @returns Formatted query string (without leading '?')
* @example
* formatQueryParams({ name: 'john', age: 30, tags: ['dev', 'web3'] })
* // Returns: "name=john&age=30&tags=dev,web3"
*/
declare const formatQueryParams: (inputs: Record<string, string | number | string[] | null | undefined>) => string;
/**
* Formats a time difference in seconds into a human-readable string
* @param timeDiff - Time difference in seconds
* @returns Formatted time string (e.g., "5m", "2h", "3d")
* @example
* formatTimeDiff(3600) // Returns: "1h"
* formatTimeDiff(86400) // Returns: "1d"
*/
declare const formatTimeDiff: (timeDiff: number) => string;
declare const formatNameMetadata: (metadata: GrailsNameMetadataResponse) => {
label: string;
value: string;
}[];
declare const formatNameMetadataRecord: (metadata: GrailsNameMetadataResponse) => Record<string, string>;
declare const formatListOpsTransaction: ({ nonce, chainId, listOps, connectedAddress, isMintingNewList, }: GetListOpsTransactionProps) => {
id: string;
title: string;
address: `0x${string}`;
abi: readonly [{
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "slot";
readonly type: "uint256";
}, {
readonly internalType: "address";
readonly name: "manager";
readonly type: "address";
}];
readonly name: "SlotAlreadyClaimed";
readonly type: "error";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: true;
readonly internalType: "uint256";
readonly name: "slot";
readonly type: "uint256";
}, {
readonly indexed: false;
readonly internalType: "bytes";
readonly name: "op";
readonly type: "bytes";
}];
readonly name: "ListOp";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: true;
readonly internalType: "address";
readonly name: "previousOwner";
readonly type: "address";
}, {
readonly indexed: true;
readonly internalType: "address";
readonly name: "newOwner";
readonly type: "address";
}];
readonly name: "OwnershipTransferred";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "address";
readonly name: "account";
readonly type: "address";
}];
readonly name: "Paused";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "address";
readonly name: "account";
readonly type: "address";
}];
readonly name: "Unpaused";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: true;
readonly internalType: "uint256";
readonly name: "slot";
readonly type: "uint256";
}, {
readonly indexed: false;
readonly internalType: "string";
readonly name: "key";
readonly type: "string";
}, {
readonly indexed: false;
readonly internalType: "bytes";
readonly name: "value";
readonly type: "bytes";
}];
readonly name: "UpdateListMetadata";
readonly type: "event";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "slot";
readonly type: "uint256";
}, {
readonly internalType: "bytes";
readonly name: "op";
readonly type: "bytes";
}];
readonly name: "applyListOp";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "slot";
readonly type: "uint256";
}, {
readonly internalType: "bytes[]";
readonly name: "ops";
readonly type: "bytes[]";
}];
readonly name: "applyListOps";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "slot";
readonly type: "uint256";
}];
readonly name: "claimListManager";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "slot";
readonly type: "uint256";
}, {
readonly internalType: "address";
readonly name: "manager";
readonly type: "address";
}];
readonly name: "claimListManagerForAddress";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract ENS";
readonly name: "ens";
readonly type: "address";
}, {
readonly internalType: "address";
readonly name: "claimant";
readonly type: "address";
}];
readonly name: "claimReverseENS";
readonly outputs: readonly [{
readonly internalType: "bytes32";
readonly name: "";
readonly type: "bytes32";
}];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "slot";
readonly type: "uint256";
}];
readonly name: "getAllListOps";
readonly outputs: readonly [{
readonly internalType: "bytes[]";
readonly name: "";
readonly type: "bytes[]";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "slot";
readonly type: "uint256";
}];
readonly name: "getListManager";
readonly outputs: readonly [{
readonly internalType: "address";
readonly name: "";
readonly type: "address";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "slot";
readonly type: "uint256";
}, {
readonly internalType: "uint256";
readonly name: "index";
readonly type: "uint256";
}];
readonly name: "getListOp";
readonly outputs: readonly [{
readonly internalType: "bytes";
readonly name: "";
readonly type: "bytes";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "slot";
readonly type: "uint256";
}];
readonly name: "getListOpCount";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "slot";
readonly type: "uint256";
}, {
readonly internalType: "uint256";
readonly name: "start";
readonly type: "uint256";
}, {
readonly internalType: "uint256";
readonly name: "end";
readonly type: "uint256";
}];
readonly name: "getListOpsInRange";
readonly outputs: readonly [{
readonly internalType: "bytes[]";
readonly name: "";
readonly type: "bytes[]";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "slot";
readonly type: "uint256";
}];
readonly name: "getListUser";
readonly outputs: readonly [{
readonly internalType: "address";
readonly name: "";
readonly type: "address";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "tokenId";
readonly type: "uint256";
}, {
readonly internalType: "string";
readonly name: "key";
readonly type: "string";
}];
readonly name: "getMetadataValue";
readonly outputs: readonly [{
readonly internalType: "bytes";
readonly name: "";
readonly type: "bytes";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "tokenId";
readonly type: "uint256";
}, {
readonly internalType: "string[]";
readonly name: "keys";
readonly type: "string[]";
}];
readonly name: "getMetadataValues";
readonly outputs: readonly [{
readonly internalType: "bytes[]";
readonly name: "";
readonly type: "bytes[]";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "";
readonly type: "uint256";
}, {
readonly internalType: "uint256";
readonly name: "";
readonly type: "uint256";
}];
readonly name: "listOps";
readonly outputs: readonly [{
readonly internalType: "bytes";
readonly name: "";
readonly type: "bytes";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "owner";
readonly outputs: readonly [{
readonly internalType: "address";
readonly name: "";
readonly type: "address";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "pause";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "paused";
readonly outputs: readonly [{
readonly internalType: "bool";
readonly name: "";
readonly type: "bool";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "renounceOwnership";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "slot";
readonly type: "uint256";
}, {
readonly internalType: "address";
readonly name: "manager";
readonly type: "address";
}];
readonly name: "setListManager";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "slot";
readonly type: "uint256";
}, {
readonly internalType: "address";
readonly name: "user";
readonly type: "address";
}];
readonly name: "setListUser";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "slot";
readonly type: "uint256";
}, {
readonly internalType: "string";
readonly name: "key";
readonly type: "string";
}, {
readonly internalType: "bytes";
readonly name: "value";
readonly type: "bytes";
}];
readonly name: "setMetadataValue";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "slot";
readonly type: "uint256";
}, {
readonly components: readonly [{
readonly internalType: "string";
readonly name: "key";
readonly type: "string";
}, {
readonly internalType: "bytes";
readonly name: "value";
readonly type: "bytes";
}];
readonly internalType: "struct IEFPListMetadata.KeyValue[]";
readonly name: "records";
readonly type: "tuple[]";
}];
readonly name: "setMetadataValues";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "uint256";
readonly name: "slot";
readonly type: "uint256";
}, {
readonly components: readonly [{
readonly internalType: "string";
readonly name: "key";
readonly type: "string";
}, {
readonly internalType: "bytes";
readonly name: "value";
readonly type: "bytes";
}];
readonly internalType: "struct IEFPListMetadata.KeyValue[]";
readonly name: "records";
readonly type: "tuple[]";
}, {
readonly internalType: "bytes[]";
readonly name: "ops";
readonly type: "bytes[]";
}];
readonly name: "setMetadataValuesAndApplyListOps";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "contract ENS";
readonly name: "ens";
readonly type: "address";
}, {
readonly internalType: "string";
readonly name: "name";
readonly type: "string";
}];
readonly name: "setReverseENS";
readonly outputs: readonly [{
readonly internalType: "bytes32";
readonly name: "";
readonly type: "bytes32";
}];
readonly st