Environment

Constant v334 → current Environment

Provides chain information to contract code.

Current Value

0x
Relevant 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 { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443

const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);

// Query Environment constant
const value = await api.constants.Contracts.Environment();
console.log("Environment:", value);

Type Information

Byte Size
variable bytes
Encoding
composite
Raw Hex
0x

Runtime Info

Pallet
Contracts
First Version
v334
Latest Version
v334
Current Runtime
v411