
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
merkleized-metadata
Advanced tools
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'
// Initialize the package:
const mm = await init();
console.log("Initialized")
// Build our metadata object from the hex bytes obtained from
// state.getMetadata or the runtime API metadata.metadata_at_version(15):
const runtimeMetadata = RuntimeMetadata.fromHex(METADATA);
// Calculate the metadata digest and then hash it to get the metadata hash
// that we'd add to the signer payload for the CheckMetadataHash extension:
const digest = mm.generateMetadataDigest(runtimeMetadata, {
base58Prefix: BASE58_PREFIX, // Eg 0 for Polkadot, 42 for Substrate
decimals: DECIMALS, // Eg 10 for Polkadot
specName: SPEC_NAME, // Eg "polkadot"
specVersion: SPEC_VERSION, // Eg 1_002_004 for Polkadot 1.2.4
tokenSymbol: TOKEN_SYMBOL // Eg "DOT"
});
console.log("Metadata Hash:", digest.hash())
// We can also build a proof which contains the information needed to
// decode a given extrinsic. This would be sent to devices like ledgers along
// with the above hash so that they could decode and use it to display an extrinsic.
const proof = mm.generateProofForExtrinsic(
TX, // Hex for the transaction bytes
TX_ADDITIONAL_SIGNED, // The bytes that extensions add to the signer payload (optional)
runtimeMetadata
);
console.log("Extrinsic proof:", proof.encode())
FAQs
A TS wrapper around the merkleized-metadata crate
We found that merkleized-metadata demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.