Provides chain information to contract code.
Current Value
0xRelevant for: developers
The Big Picture
Contracts can query environment values like minimum balance. This constant defines what's available through the chain extension/environment APIs.
From Chain Metadata
Type that bundles together all the runtime configurable interface types. This is not a real config. We just mention the type here as constant so that its type appears in the metadata. Only valid value is `()`.
Use Cases
- Access chain parameters from contracts
- Build chain-aware contract logic
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 Environment constant
const value = api.consts[stringCamelCase("Contracts")][stringCamelCase("Environment")];
console.log("Environment:", value.toHuman());Type Information
- Type
- Environment
- Byte Size
- variable bytes
- Encoding
- composite
- Raw Hex
- 0x
Runtime Info
- Pallet
- Contracts
- First Version
- v334
- Latest Version
- v334
- Current Runtime
- v393