2

The cli tool subwasm can get the metadata from a live node (url) and output JSON that is human readable. However, to troubleshoot various issues, I need a tool that generates human readable JSON from hex encoded SCALE metadata in a file. i.e. it doesn't go to a live node.

e.g. The hex encoded SCALE data in a JSON-RPC result. It doesn't matter if the tool uses the result data or the whole JSON-RPC json result. I just need it to output it in human readable form.

{"jsonrpc":"2.0","result":"0x6d6574610e3904000c1c73705f636f72651863727970746f2c4163636f756e7449643332000004000401205b75383b2033325d0000040000032000000008000800000503000c08306672616d655f73797374656d2c4163636f756e74496e666f0814496e64657801102c4163636f756e74446174610114001401146e6f6e6365100114496e646578000124636f6e73756d657273100120...etc............

Is there a tool that does this?

3
  • Where did you get that "hex encoded metadata" file from? What encoding is it actually? Just Hex UTF-8 or hex SCALE? Commented Jan 26, 2023 at 19:46
  • hex SCALE. I got it from cargo run metadata Commented Jan 26, 2023 at 19:59
  • e.g. it looks like this {"jsonrpc":"2.0","result":"0x6d6574610e3904000c1c73705f636f72651863727970746f2c4163636f756e7449643332000004000401205b75383b2033325d0000040000032000000008000800000503000c08306672616d655f73797374656d2c4163636f756e74496e666f0814496e64657801102c4163636f756e74446174610114001401146e6f6e6365100114496e646578000124636f6e73756d657273100120......... Commented Jan 26, 2023 at 20:00

1 Answer 1

2

Subwasm works on a whole runtime block. It could probably be changed, but I rather created submeta.
You can use it with a stored encoded metadata from an RPC like this:

curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "state_getMetadata"}' https://rpc.polkadot.io:443 |\
jq '.result' -r |\
submeta pallets --with-storage

or from a local file:

cat metadata.json | jq metadata.json '.result' -r | submeta pallets --with-storage

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.