getStarknetIdAddress
Action for getting an address associated with a Starknet ID.
Import
import { getStarknetIdAddress } from "starkweb/core";
Usage
index.ts
import { getStarknetIdAddress } from "starkweb/core";
import { config } from "./config";
const address = await getStarknetIdAddress(config, {
starknetId: "vitalik.stark",
});
Parameters
import { type GetStarknetIdAddressParameters } from "starkweb/core";
starknetId
string
The Starknet ID to resolve.
index.ts
import { getStarknetIdAddress } from "starkweb/core";
import { config } from "./config";
const address = await getStarknetIdAddress(config, {
starknetId: "vitalik.stark",
});
chainId (optional)
Hex | undefined
The chain ID to query. If not provided, uses the current chain.
index.ts
import { getStarknetIdAddress } from "starkweb/core";
import { mainnet } from "starkweb/chains";
import { config } from "./config";
const address = await getStarknetIdAddress(config, {
starknetId: "vitalik.stark",
chainId: mainnet.chain_id,
});
Return Type
import { type GetStarknetIdAddressReturnType } from "starkweb/core";
Hex
The address associated with the Starknet ID.
Example
example.ts
import { getStarknetIdAddress } from "starkweb/core";
import { mainnet } from "starkweb/chains";
import { config } from "./config";
// Get address on current chain
const address = await getStarknetIdAddress(config, {
starknetId: "vitalik.stark",
});
console.log("Address:", address);
// Get address on specific chain
const mainnetAddress = await getStarknetIdAddress(config, {
starknetId: "vitalik.stark",
chainId: mainnet.chain_id,
});
Error
import { type GetStarknetIdAddressErrorType } from "starkweb/core";
TanStack Query
import {
type GetStarknetIdAddressData,
type GetStarknetIdAddressOptions,
type GetStarknetIdAddressQueryFnData,
type GetStarknetIdAddressQueryKey,
getStarknetIdAddressQueryKey,
getStarknetIdAddressQueryOptions,
} from "starkweb/query";