Skip to main content

Import

import { useListAccounts } from '@0xsequence/connect'

Usage

import { useListAccounts } from '@0xsequence/connect'

function AccountsList() {
  const { data, isLoading, error, refetch } = useListAccounts()

  if (isLoading) return <div>Loading accounts...</div>
  if (error) return <div>Error: {error.message}</div>

  return (
    <div>
      <button onClick={() => refetch()}>Refresh Accounts</button>
      <div>Current Account ID: {data?.currentAccountId}</div>
      {data?.accounts.map(account => (
        <div key={account.id} className="account-item">
          <div>ID: {account.id}</div>
          <div>Type: {account.type}</div>
          {account.email && <div>Email: {account.email}</div>}
          {account.issuer && <div>Issuer: {account.issuer}</div>}
        </div>
      ))}
    </div>
  )
}

Return Type

interface UseListAccountsResult {
  data?: IntentResponseAccountList
  isLoading: boolean
  error: Error | null
  refetch: () => Promise<void>
}

enum IdentityType {
    None = "None",
    Guest = "Guest",
    OIDC = "OIDC",
    Email = "Email",
    PlayFab = "PlayFab",
    Stytch = "Stytch"
}

interface Account {
    id: string;
    type: IdentityType;
    issuer?: string;
    email?: string;
}

interface IntentResponseAccountList {
    accounts: Array<Account>;
    currentAccountId: string;
}

Properties

PropertyTypeDescription
dataIntentResponseAccountList | undefinedThe account list, including currentAccountId and an array of account objects.
isLoadingbooleanIndicates whether the query is in progress.
errorError | nullAny error encountered during retrieval.
refetch() => Promise<void>Manually triggers a refresh of the account list.
Data is fetched automatically when the WaaS connection becomes available and is cached for one minute.