findContractByName
Looks up a contract's numeric index from its name in the registry.
Signature
findContractByName(registry: ContractRegistry, name: string): numberPurpose
Looks up a contract's numeric index from its name. Use this when you have a contract name and need the index for ABI or RPC calls.
import { findContractByName } from "@qubic.org/registry"
import registry from "@qubic.org/registry/registry.json"
import type { ContractRegistry } from "@qubic.org/registry"
const reg = registry as ContractRegistry
const index = findContractByName(reg, "Qearn") // 9Parameters
| Name | Type | Description |
|---|---|---|
registry | ContractRegistry | The imported registry JSON |
name | string | The contract name to look up |
Returns
number — the numeric contract index corresponding to the given name.
Throws
EntryNotFoundError — if the name is not present in the registry.