Metadata

This is an example of calling the state_getMetadata rpc endpoint.

RPC Request

function get_metadata_request(endpoint) {
let request = new Request(endpoint, {
method: "POST",
body: JSON.stringify({
id: 1,
jsonrpc: "2.0",
method: "state_getMetadata"
}),
headers: { "Content-Type": "application/json" }
});
return request;
}

Raw Metadata


				

Naive Text Decoding

function decode_metadata(metadata) {
return new TextDecoder().decode(util.hexToU8a(metadata));
}

Decoded Metadata