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 { 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 ApiVersion constant
const value = api.consts[stringCamelCase("Contracts")][stringCamelCase("ApiVersion")];
console.log("ApiVersion:", value.toHuman());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
- v393