ContractInfoOf
Storage Map v334 → currentInformation about deployed contract instances.
Explore chainQueried by: developersanalytics
The Big Picture
The registry of all deployed contracts. Presence here means the address is a live contract. Contains code_hash (which version it runs), deposit info, and storage meter data.
Use Cases
- Verify an address is a deployed contract
- Get contract metadata (code, deposit)
- Analyze contract storage usage
- Build contract explorers
From Chain Metadata
The code associated with a given account. TWOX-NOTE: SAFE since `AccountId` is a secure hash.
Purpose & Usage
Purpose
Tracks contract state including code reference, storage usage, and deposit info.
Common Query Patterns
- Query by contract address
- Check if address is a contract
- Get contract's current code_hash
Query Keys
| # | Name | Type | Description |
|---|---|---|---|
| 1 | key1 | AccountId | key1 (AccountId) (hex -> SS58) |
Stored Value
value (ContractInfo)
Relationships
Code Examples
import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";
const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });
// Query ContractInfoOf storage
const key1 = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const result = await api.query
[stringCamelCase("Contracts")]
[stringCamelCase("ContractInfoOf")](
key1
);
console.log("ContractInfoOf:", result.toHuman());Runtime Info
- Pallet
- Contracts
- Storage Kind
- Map
- First Version
- v334
- Current Version
- v393