getStarknetIdUserData
Action for getting user data associated with a Starknet ID.
Import
import { getStarknetIdUserData } from "starkweb/core";
Usage
index.ts
import { getStarknetIdUserData } from "starkweb/core";
import { config } from "./config";
const userData = await getStarknetIdUserData(config, {
starknetId: "0x123...",
field: "discord",
});
Parameters
import { type GetStarknetIdUserDataParameters } from "starkweb/core";
starknetId
Hex
The Starknet ID to get user data for.
field
string
The specific field of user data to retrieve (e.g., "discord", "twitter", "github").
index.ts
import { getStarknetIdUserData } from "starkweb/core";
import { config } from "./config";
const userData = await getStarknetIdUserData(config, {
starknetId: "0x123...",
field: "discord",
});
chainId (optional)
Hex | undefined
The chain ID to query. If not provided, uses the current chain.
index.ts
import { getStarknetIdUserData } from "starkweb/core";
import { mainnet } from "starkweb/chains";
import { config } from "./config";
const userData = await getStarknetIdUserData(config, {
starknetId: "0x123...",
field: "discord",
chainId: mainnet.chain_id,
});
Return Type
import { type GetStarknetIdUserDataReturnType } from "starkweb/core";
string
The user data value for the specified field.
Example
example.ts
import { getStarknetIdUserData } from "starkweb/core";
import { mainnet } from "starkweb/chains";
import { config } from "./config";
// Get user data on current chain
const discordHandle = await getStarknetIdUserData(config, {
starknetId: "0x123...",
field: "discord",
});
console.log("Discord handle:", discordHandle);
// Get user data on specific chain
const twitterHandle = await getStarknetIdUserData(config, {
starknetId: "0x123...",
field: "twitter",
chainId: mainnet.chain_id,
});
Error
import { type GetStarknetIdUserDataErrorType } from "starkweb/core";
TanStack Query
import {
type GetStarknetIdUserDataData,
type GetStarknetIdUserDataOptions,
type GetStarknetIdUserDataQueryFnData,
type GetStarknetIdUserDataQueryKey,
getStarknetIdUserDataQueryKey,
getStarknetIdUserDataQueryOptions,
} from "starkweb/query";