merkleized-metadata
This is a simple TypeScript wrapper around https://github.com/bkchr/merkleized-metadata.
Basic example usage (where capitalized values need providing):
import { init, RuntimeMetadata } from 'merkleized-metadata'
const mm = await init();
console.log("Initialized")
const runtimeMetadata = RuntimeMetadata.fromHex(METADATA);
const digest = mm.generateMetadataDigest(runtimeMetadata, {
base58Prefix: BASE58_PREFIX,
decimals: DECIMALS,
specName: SPEC_NAME,
specVersion: SPEC_VERSION,
tokenSymbol: TOKEN_SYMBOL
});
console.log("Metadata Hash:", digest.hash())
const proof = mm.generateProofForExtrinsic(
TX,
TX_ADDITIONAL_SIGNED,
runtimeMetadata
);
console.log("Extrinsic proof:", proof.encode())