Skip to content

Design: PVQ Program Metadata

Jiyuan Zheng edited this page Jun 9, 2025 · 3 revisions

types: type registry, encoded in scale-info registry format.

extension_fns: Check if the program is compatible with the current chain: Chains exposes supported extensions via pvq-extension-core, while front-end codes use the metadata and a prebuilt check program to run checks.

entrypoints: Multiple entrypoints function of a pvq program.

Example metadata

{
    "types": {
        "types": [
            {
                "id": 0,
                "type": {
                    "def": {
                        "primitive": "u32"
                    }
                }
            },
            {
                "id": 1,
                "type": {
                    "def": {
                        "array": {
                            "len": 32,
                            "type": 2
                        }
                    }
                }
            },
            {
                "id": 2,
                "type": {
                    "def": {
                        "primitive": "u8"
                    }
                }
            },
            {
                "id": 3,
                "type": {
                    "def": {
                        "primitive": "u64"
                    }
                }
            },
            {
                "id": 4,
                "type": {
                    "def": {
                        "sequence": {
                            "type": 1
                        }
                    }
                }
            }
        ]
    },
    "extension_fns": [
        [
            4071833530116166512,
            1,
            {
                "name": "balance",
                "inputs": [
                    {
                        "name": "asset",
                        "ty": 0
                    },
                    {
                        "name": "who",
                        "ty": 1
                    }
                ],
                "output": 3
            }
        ]
    ],
    "entrypoint": {
        "name": "sum_balance",
        "inputs": [
            {
                "name": "asset",
                "ty": 0
            },
            {
                "name": "accounts",
                "ty": 4
            }
        ],
        "output": 3
    }
}
Clone this wiki locally