Skip to main content
Version: Next

Namespace: starknetId

Variables

StarknetIdContract

Const StarknetIdContract: Object

Type declaration

NameType
MAINNET"0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678"
TESTNET_SEPOLIA"0x154bc2e1af9260b9e66af0e9c46fc757ff893b3ff6a85718a810baf1474"

Defined in

src/utils/starknetId.ts:127


StarknetIdIdentityContract

Const StarknetIdIdentityContract: Object

Type declaration

NameType
MAINNET"0x05dbdedc203e92749e2e746e2d40a768d966bd243df04a6b712e222bc040a9af"
TESTNET_SEPOLIA"0x3697660a0981d734780731949ecb2b4a38d6a58fc41629ed611e8defda"

Defined in

src/utils/starknetId.ts:157


StarknetIdMulticallContract

Const StarknetIdMulticallContract: "0x034ffb8f4452df7a613a0210824d6414dbadcddce6c6e19bf4ddc9e22ce5f970"

Defined in

src/utils/starknetId.ts:189


StarknetIdVerifierContract

Const StarknetIdVerifierContract: Object

Type declaration

NameType
MAINNET"0x07d14dfd8ee95b41fce179170d88ba1f0d5a512e13aeb232f19cfeec0a88f8bf"
TESTNET_SEPOLIA"0x60B94fEDe525f815AE5E8377A463e121C787cCCf3a36358Aa9B18c12c4D566"

Defined in

src/utils/starknetId.ts:217


StarknetIdPfpContract

Const StarknetIdPfpContract: Object

Type declaration

NameType
MAINNET"0x070aaa20ec4a46da57c932d9fd89ca5e6bb9ca3188d3df361a32306aff7d59c7"
TESTNET_SEPOLIA"0x9e7bdb8dabd02ea8cfc23b1d1c5278e46490f193f87516ed5ff2dfec02"

Defined in

src/utils/starknetId.ts:247


StarknetIdPopContract

Const StarknetIdPopContract: Object

Type declaration

NameType
MAINNET"0x0293eb2ba9862f762bd3036586d5755a782bd22e6f5028320f1d0405fd47bff4"
TESTNET_SEPOLIA"0x15ae88ae054caa74090b89025c1595683f12edf7a4ed2ad0274de3e1d4a"

Defined in

src/utils/starknetId.ts:279

Functions

useDecoded

useDecoded(encoded): string

Decodes an array of BigInts into a string using the given algorithm.

Parameters

NameTypeDescription
encodedbigint[]The encoded array of BigInts.

Returns

string

The decoded string.

Example

const result = starknetId.useDecoded([3015206943634620n]);
// result = "starknetjs.stark"

Defined in

src/utils/starknetId.ts:33


useEncoded

useEncoded(decoded): bigint

Encodes a string into a bigint value.

Parameters

NameTypeDescription
decodedstringThe string to be encoded.

Returns

bigint

The encoded bigint value.

Example

const result = starknetId.useEncoded("starknet.js");
// result = 3015206943634620n

Defined in

src/utils/starknetId.ts:85


getStarknetIdContract

getStarknetIdContract(chainId): string

Returns the Starknet ID contract address based on the provided chain ID.

Parameters

NameTypeDescription
chainId"0x534e5f4d41494e" | "0x534e5f5345504f4c4941"The chain ID of the Starknet network.

Returns

string

The Starknet ID contract address.

Throws

Throws an error if the Starknet ID contract is not deployed on the network.

Example

const result = starknetId.getStarknetIdContract(constants.StarknetChainId.SN_SEPOLIA);
// result = "0x154bc2e1af9260b9e66af0e9c46fc757ff893b3ff6a85718a810baf1474"

Defined in

src/utils/starknetId.ts:144


getStarknetIdIdentityContract

getStarknetIdIdentityContract(chainId): string

Returns the Starknet ID identity contract address for the given chain ID.

Parameters

NameTypeDescription
chainId"0x534e5f4d41494e" | "0x534e5f5345504f4c4941"The chain ID for the specified network.

Returns

string

The Starknet ID identity contract address for the specified network.

Throws

If the Starknet ID verifier contract is not deployed on the network.

Example

const result = starknetId.getStarknetIdIdentityContract(constants.StarknetChainId.SN_SEPOLIA);
// result = "0x3697660a0981d734780731949ecb2b4a38d6a58fc41629ed611e8defda"

Defined in

src/utils/starknetId.ts:176


getStarknetIdMulticallContract

getStarknetIdMulticallContract(chainId): string

Returns the Starknet.id multicall contract address based on the provided chainId.

Parameters

NameTypeDescription
chainId"0x534e5f4d41494e" | "0x534e5f5345504f4c4941"The chainId of the network.

Returns

string

  • The address of the Starknet.id multicall contract.

Throws

  • If the Starknet.id multicall contract is not deployed on the network.

Example

const result = starknetId.getStarknetIdMulticallContract(constants.StarknetChainId.SN_SEPOLIA);
// result = "0x034ffb8f4452df7a613a0210824d6414dbadcddce6c6e19bf4ddc9e22ce5f970"

Defined in

src/utils/starknetId.ts:204


getStarknetIdVerifierContract

getStarknetIdVerifierContract(chainId): string

Returns the address of the Starknet ID Verifier contract based on the specified chain ID.

Parameters

NameTypeDescription
chainId"0x534e5f4d41494e" | "0x534e5f5345504f4c4941"The ID of the Starknet chain.

Returns

string

  • The address of the Starknet ID Verifier contract.

Throws

  • If the Starknet ID Verifier contract is not deployed on the specified network.

Example

const result = starknetId.getStarknetIdVerifierContract(constants.StarknetChainId.SN_SEPOLIA);
// result = "0x60B94fEDe525f815AE5E8377A463e121C787cCCf3a36358Aa9B18c12c4D566"

Defined in

src/utils/starknetId.ts:234


getStarknetIdPfpContract

getStarknetIdPfpContract(chainId): string

Retrieves the contract address of the Starknet.id profile picture verifier contract based on the given chain ID.

Parameters

NameTypeDescription
chainId"0x534e5f4d41494e" | "0x534e5f5345504f4c4941"The chain ID of the network.

Returns

string

  • The contract address of the Starknet.id profile picture verifier contract.

Throws

  • Throws an error if the Starknet.id profile picture verifier contract is not yet deployed on the network.

Example

const result = starknetId.getStarknetIdPfpContract(constants.StarknetChainId.SN_SEPOLIA);
// result = "0x9e7bdb8dabd02ea8cfc23b1d1c5278e46490f193f87516ed5ff2dfec02"

Defined in

src/utils/starknetId.ts:264


getStarknetIdPopContract

getStarknetIdPopContract(chainId): string

Retrieves the Starknet ID Proof of Personhood (IdPop) verifier contract address for the given chain ID.

Parameters

NameTypeDescription
chainId"0x534e5f4d41494e" | "0x534e5f5345504f4c4941"The chain ID of the Starknet network.

Returns

string

  • The Starknet ID Pop contract address.

Throws

  • If the Starknet ID Pop contract is not deployed on the specified network.

Example

const result = starknetId.getStarknetIdPopContract(constants.StarknetChainId.SN_SEPOLIA);
// result = "0x15ae88ae054caa74090b89025c1595683f12edf7a4ed2ad0274de3e1d4a"

Defined in

src/utils/starknetId.ts:296


execution

execution(staticEx?, ifEqual?, ifNotEqual?): CairoCustomEnum

Returns a CairoCustomEnum object.

Functions to build CairoCustomEnum for multiCall contracts

Parameters

NameTypeDefault valueDescription
staticEx?ObjectundefinedAn optional object defining the "Static" value of the CairoCustomEnum.
ifEqual?number[]undefinedAn optional array defining the "IfEqual" value of the CairoCustomEnum.
ifNotEqual?number[]undefinedAn optional array defining the "IfNotEqual" value of the CairoCustomEnum.

Returns

CairoCustomEnum

  • The created CairoCustomEnum object.

Example

const result: CairoCustomEnum = starknetId.execution(undefined, [1, 2, 3], undefined);
// result = CairoCustomEnum {
// variant: {
// Static: undefined,
// IfEqual: { '0': 1, '1': 2, '2': 3 },
// IfNotEqual: undefined
// }
// }

Defined in

src/utils/starknetId.ts:331


dynamicFelt

dynamicFelt(hardcoded?, reference?): CairoCustomEnum

Creates a new instance of CairoCustomEnum.

Parameters

NameTypeDefault valueDescription
hardcoded?BigNumberishundefinedThe hardcoded value for the CairoCustomEnum.
reference?number[]undefinedThe reference array for the CairoCustomEnum.

Returns

CairoCustomEnum

The new instance of CairoCustomEnum.

Example

const result: CairoCustomEnum = starknetId.dynamicFelt(undefined, [1, 2]);
// result = CairoCustomEnum {
// variant: { Hardcoded: undefined, Reference: { '0': 1, '1': 2 } }
// }

Defined in

src/utils/starknetId.ts:357


dynamicCallData

dynamicCallData(hardcoded?, reference?, arrayReference?): CairoCustomEnum

Creates a new instance of CairoCustomEnum with the given parameters.

Parameters

NameTypeDefault valueDescription
hardcoded?BigNumberishundefinedThe hardcoded value.
reference?BigNumberish[]undefinedThe reference value (optional).
arrayReference?BigNumberish[]undefinedThe array reference value (optional).

Returns

CairoCustomEnum

The new instance of CairoCustomEnum.

Example

const result: CairoCustomEnum = starknetId.dynamicCallData(undefined, [1, 2], undefined);
// result = CairoCustomEnum {
// variant: {
// Hardcoded: undefined,
// Reference: { '0': 1, '1': 2 },
// ArrayReference: undefined
// }
// }

Defined in

src/utils/starknetId.ts:385


isStarkDomain

isStarkDomain(domain): boolean

Check if a given string is a valid Starknet.id domain.

Parameters

NameTypeDescription
domainstringThe domain string to validate.

Returns

boolean

  • True if the domain is a valid Starknet.id domain, false otherwise.

Example

const result = starknetId.isStarkDomain("example.stark");
// result = true

const result2 = starknetId.isStarkDomain("invalid-domain");
// result2 = false

Defined in

src/utils/starknetId.ts:411