Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Make all type information available via the metadata endpoint #7971

Closed
alexspurling opened this issue Jan 25, 2021 · 7 comments
Closed

Make all type information available via the metadata endpoint #7971

alexspurling opened this issue Jan 25, 2021 · 7 comments
Labels
J2-unconfirmed Issue might be valid, but it’s not yet known.

Comments

@alexspurling
Copy link

alexspurling commented Jan 25, 2021

When I request the metadata from my node, I see a description of the Balances transfer call that looks like this:

{
          "name": "Balances",
          "storage": {...}
          "calls": [
            {
              "name": "transfer",
              "args": [
                {
                  "name": "dest",
                  "type": "LookupSource"
                },
                {
                  "name": "value",
                  "type": "Compact<Balance>"
                }
              ], ...
            }
}

However, nowhere in the rest of the metadata is it described the structure of the LookupSource datatype. This means there is no automatic way to determine what datatype is expected by the node when making calls to this API. Authors of the python and javascript API clients must manually maintain a mapping of high to low level types as you can see here:

https://github.com/polkadot-js/api/tree/master/packages/types/src/interfaces/contracts

https://github.com/polkascan/py-scale-codec/tree/master/scalecodec/type_registry

Please make this information available in the existing metadata endpoint or perhaps a new endpoint.

@github-actions github-actions bot added the J2-unconfirmed Issue might be valid, but it’s not yet known. label Jan 25, 2021
@gui1117
Copy link
Contributor

gui1117 commented Jan 25, 2021

Yes this will be solved by using scale-info https://github.com/paritytech/scale-info so that full type description will be available in the metadata.

cc @ascjones

@alexspurling
Copy link
Author

@thiolliere Thanks for that information. Do you have an idea of roughly when this feature will be rolled into substrate? We don't have an urgent need for it now but it would be good to know whether this is an imminent feature or something that still has large challenges to overcome (I don't believe for a second it's a trivial issue).

@ascjones
Copy link
Contributor

I'm actively working on this, but I wouldn't expect it to be in master for a while yet. Not until March at least. I have a proof-of-concept branch https://github.com/paritytech/substrate/compare/aj-metadata-vnext to keep an eye on, but it is not in a working state at the moment.

Also it depends on all pallets being converted to the new pallet attribute syntax #7882 so keep an eye on the progress there.

@xlc
Copy link
Contributor

xlc commented Jan 25, 2021

Duplicates to #917

@gui1117
Copy link
Contributor

gui1117 commented Jan 26, 2021

closed in favor of #917

@gui1117 gui1117 closed this as completed Jan 26, 2021
@emielsebastiaan
Copy link

Almost 2.5 years in the making :)

This feature will (hopefully) lower the maintenance burden on the API-layer teams significantly.
The Polkascan team really looks forward to this feature.

@ascjones
Copy link
Contributor

Hopefully in the next few weeks I can provide a working branch that will produce the new metadata to get some feedback on it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J2-unconfirmed Issue might be valid, but it’s not yet known.
Projects
None yet
Development

No branches or pull requests

5 participants