state_getMetadata
Returns the full SCALE-encoded runtime metadata describing pallets, storage entries, constants, and extrinsics. Decode this blob to understand the precise structure of Manta Atlantic's zk-focused runtime.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
at | string | No | Optional block hash to fetch historical metadata. |
Returns
Field | Type | Description |
---|---|---|
result | string | Hex-encoded SCALE metadata (v15). |
Request Example
{
"jsonrpc": "2.0",
"method": "state_getMetadata",
"params": [],
"id": 1
}
Response (truncated):
{
"jsonrpc": "2.0",
"result": "0x6d6574610f6876616c6964780f73797374656d0f...",
"id": 1
}
Decode with @polkadot/api
import { ApiPromise, WsProvider } from '@polkadot/api';
const provider = new WsProvider('wss://api-manta-atlantic-mainnet.n.dwellir.com/YOUR_API_KEY');
const api = await ApiPromise.create({ provider });
const metadataHex = await api.rpc.state.getMetadata();
const metadata = metadataHex.toHuman();
console.log('Runtime spec', api.runtimeVersion.specName, api.runtimeVersion.specVersion.toNumber());
console.log('Pallet count', metadata.pallets.length);
Usage Notes
- Store periodic snapshots of metadata when building indexers so you can decode historical storage entries accurately.
- Runtime upgrades change pallet indices; fetch metadata immediately before scale-decoding on-chain data.
- Combine with
state_getRuntimeVersion
to detect when metadata should be refreshed.