Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

getUser

Fetch a user record by index or by name.

Signature

function getUser(
  client: Client,
  parameters: {
    userIndexOrName: UserIndexOrName
    height?: number
  },
): Promise<User>
 
type UserIndexOrName = { index: number } | { name: string }

Example

import { createPublicClient, createTransport, testnet } from "@left-curve/sdk"
 
const client = createPublicClient({ chain: testnet, transport: createTransport() })
 
const byIndex = await client.getUser({ userIndexOrName: { index: 42 } })
const byName = await client.getUser({ userIndexOrName: { name: "alice" } })

Parameters

userIndexOrName{ index: number } | { name: string }. Discriminate by which key is present.

heightnumber, optional. Block height. Default 0 (latest).

Returns

User{ index, name, keys, accounts }. keys maps KeyHash to Key; accounts maps AccountIndex to Address.

See also