Skip to content

How do you create type registry JSON files?聽#94

Closed

Description

@khssnv

Hi there 馃憢

There are type registry JSON files in a type_registry directory. It seems like very few of them are provided by projects developers. Could you reveal how you create these JSONs? It could help to contribute to the project. Thanks!

Activity

  1. arjanz commented on Dec 12, 2022

    @arjanz
    Contributor

    There is some history for those type registry files. Since Substrate introduced MetadataV14, it contains an embedded type registry with all types used in the calls and storage functions. Before that, types were just mere strings how they were named in the RUST code of the runtime. So back then there was a need to manually administer a type registry to describe the type decomposition in primitives.

    For networks like Kusama those registries were already maintained by PolkadotJS (example), so I could gratefully re-use those.

    But for other networks that don't provide an own registry file, you basically have to analyse the RUST source and create a type registry manually:

    Crust example: https://github.com/crustio/crust/blob/d2de3d018c9367cec98411d56fdb0836cffb75cd/cstrml/benefits/src/lib.rs#L138

    Type registry: https://github.com/polkascan/py-scale-codec/blob/6c897a0f09d3fadcb84eae393d98a831cf403b50/scalecodec/type_registry/crust.json#L28

    But later on they upgrade to MetadataV14, so there was no more need for the manually type registry. (See comment: JAMdotTech/py-polkadot-sdk#251 (comment))

    TL;DR: Probably you don't need to create/maintain a type registry file, unless the Substrate runtime still utilises MetadataV13 or lower (check substrate.get_metadata() and substrate.implements_scaleinfo()).

  2. khssnv commented on Dec 13, 2022

    @khssnv
    Author

    Got it, thank you for sharing 馃憤

  3. locked and limited conversation to collaborators on Jan 3, 2023
  4. converted this issue into a discussion #96 on Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions