getStarknetIdName
Action for getting a name associated with a Starknet ID.
Import
import { getStarknetIdName } from "starkweb/core";
Usage
index.ts
import { getStarknetIdName } from "starkweb/core";
import { config } from "./config";
const name = await getStarknetIdName(config, {
starknetId: "0x123...",
});
Parameters
import { type GetStarknetIdNameParameters } from "starkweb/core";
starknetId
Hex
The Starknet ID to get the name for.
index.ts
import { getStarknetIdName } from "starkweb/core";
import { config } from "./config";
const name = await getStarknetIdName(config, {
starknetId: "0x123...",
});
chainId (optional)
Hex | undefined
The chain ID to query. If not provided, uses the current chain.
index.ts
import { getStarknetIdName } from "starkweb/core";
import { mainnet } from "starkweb/chains";
import { config } from "./config";
const name = await getStarknetIdName(config, {
starknetId: "0x123...",
chainId: mainnet.chain_id,
});
Return Type
import { type GetStarknetIdNameReturnType } from "starkweb/core";
string
The name associated with the Starknet ID.
Example
example.ts
import { getStarknetIdName } from "starkweb/core";
import { mainnet } from "starkweb/chains";
import { config } from "./config";
// Get name on current chain
const name = await getStarknetIdName(config, {
starknetId: "0x123...",
});
console.log("Name:", name);
// Get name on specific chain
const mainnetName = await getStarknetIdName(config, {
starknetId: "0x123...",
chainId: mainnet.chain_id,
});
Error
import { type GetStarknetIdNameErrorType } from "starkweb/core";
TanStack Query
import {
type GetStarknetIdNameData,
type GetStarknetIdNameOptions,
type GetStarknetIdNameQueryFnData,
type GetStarknetIdNameQueryKey,
getStarknetIdNameQueryKey,
getStarknetIdNameQueryOptions,
} from "starkweb/query";