Indicates which host function APIs are available.
Current Value
0x0400Relevant for: developers
The Big Picture
Different API versions expose different host functions. Check this to ensure your contract is compatible with the chain's contracts pallet version.
From Chain Metadata
The version of the HostFn APIs that are available in the runtime. Only valid value is `()`.
Use Cases
- Check contract compatibility
- Plan upgrades and migrations
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 ApiVersion constant
const value = await api.constants.Contracts.ApiVersion();
console.log("ApiVersion:", value);Type Information
- Type
- ApiVersion
- Byte Size
- variable bytes
- Encoding
- composite
- Raw Hex
- 0x0400
Runtime Info
- Pallet
- Contracts
- First Version
- v334
- Latest Version
- v334
- Current Runtime
- v411