Skip to content

getStarknetIdExtendedUserData

Action for getting extended user data associated with a Starknet ID.

Import

import { getStarknetIdExtendedUserData } from "starkweb/core";

Usage

index.ts
import { getStarknetIdExtendedUserData } from "starkweb/core";
import { config } from "./config";
 
const userData = await getStarknetIdExtendedUserData(config, {
  starknetId: "0x123...", 
  field: "discord", 
  domain: "app", 
});

Parameters

import { type GetStarknetIdExtendedUserDataParameters } from "starkweb/core";

starknetId

Hex

The Starknet ID to get extended user data for.

field

string

The specific field of user data to retrieve.

domain

string

The domain for the extended data.

index.ts
import { getStarknetIdExtendedUserData } from "starkweb/core";
import { config } from "./config";
 
const userData = await getStarknetIdExtendedUserData(config, {
  starknetId: "0x123...", 
  field: "discord", 
  domain: "app", 
});

chainId (optional)

Hex | undefined

The chain ID to query. If not provided, uses the current chain.

index.ts
import { getStarknetIdExtendedUserData } from "starkweb/core";
import { mainnet } from "starkweb/chains"; 
import { config } from "./config";
 
const userData = await getStarknetIdExtendedUserData(config, {
  starknetId: "0x123...",
  field: "discord",
  domain: "app",
  chainId: mainnet.chain_id, 
});

Return Type

import { type GetStarknetIdExtendedUserDataReturnType } from "starkweb/core";

Returns the extended user data value for the specified field and domain.

Example

example.ts
import { getStarknetIdExtendedUserData } from "starkweb/core";
import { mainnet } from "starkweb/chains"; 
import { config } from "./config";
 
// Get extended user data on current chain
const userData = await getStarknetIdExtendedUserData(config, {
  starknetId: "0x123...", 
  field: "discord", 
  domain: "app", 
});
console.log("Extended user data:", userData);
 
// Get extended user data on specific chain
const mainnetData = await getStarknetIdExtendedUserData(config, {
  starknetId: "0x123...",
  field: "discord",
  domain: "app",
  chainId: mainnet.chain_id, 
});

Error

import { type GetStarknetIdExtendedUserDataErrorType } from "starkweb/core";

TanStack Query

import {
  type GetStarknetIdExtendedUserDataData,
  type GetStarknetIdExtendedUserDataOptions,
  type GetStarknetIdExtendedUserDataQueryFnData,
  type GetStarknetIdExtendedUserDataQueryKey,
  getStarknetIdExtendedUserDataQueryKey,
  getStarknetIdExtendedUserDataQueryOptions,
} from "starkweb/query";