Skip to content

getStarknetIdProfileData

Action for getting profile data associated with a Starknet ID.

Import

import { getStarknetIdProfileData } from "starkweb/core";

Usage

index.ts
import { getStarknetIdProfileData } from "starkweb/core";
import { config } from "./config";
 
const profileData = await getStarknetIdProfileData(config, {
  starknetId: "0x123...", 
});

Parameters

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

starknetId

Hex

The Starknet ID to get profile data for.

index.ts
import { getStarknetIdProfileData } from "starkweb/core";
import { config } from "./config";
 
const profileData = await getStarknetIdProfileData(config, {
  starknetId: "0x123...", 
});

chainId (optional)

Hex | undefined

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

index.ts
import { getStarknetIdProfileData } from "starkweb/core";
import { mainnet } from "starkweb/chains"; 
import { config } from "./config";
 
const profileData = await getStarknetIdProfileData(config, {
  starknetId: "0x123...",
  chainId: mainnet.chain_id, 
});

Return Type

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

Returns an object containing profile data including:

name

string

The name associated with the Starknet ID.

description

string

The profile description.

profilePicture

string

URL of the profile picture.

Example

example.ts
import { getStarknetIdProfileData } from "starkweb/core";
import { mainnet } from "starkweb/chains"; 
import { config } from "./config";
 
// Get profile data on current chain
const profileData = await getStarknetIdProfileData(config, {
  starknetId: "0x123...", 
});
console.log("Profile:", {
  name: profileData.name,
  description: profileData.description,
});
 
// Get profile data on specific chain
const mainnetProfile = await getStarknetIdProfileData(config, {
  starknetId: "0x123...",
  chainId: mainnet.chain_id, 
});

Error

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

TanStack Query

import {
  type GetStarknetIdProfileDataData,
  type GetStarknetIdProfileDataOptions,
  type GetStarknetIdProfileDataQueryFnData,
  type GetStarknetIdProfileDataQueryKey,
  getStarknetIdProfileDataQueryKey,
  getStarknetIdProfileDataQueryOptions,
} from "starkweb/query";