Socket
Book a DemoInstallSign in
Socket

@polkadot-api/compare-runtimes

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polkadot-api/compare-runtimes

A lightweight yet powerful TypeScript library to **compare runtime metadata between upgrades** of PolkadotSDK-based blockchains. Easily detect **breaking changes, additions, and compatibility levels** across all runtime components.

latest
Source
npmnpm
Version
0.2.8
Version published
Maintainers
2
Created
Source

🧬 @polkadot-api/compare-runtimes

A lightweight yet powerful TypeScript library to compare runtime metadata between upgrades of PolkadotSDK-based blockchains. Easily detect breaking changes, additions, and compatibility levels across all runtime components.

✨ Features

🧩 API Reference

compareRuntimes(prevMetadata: Uint8Array, nextMetadata: Uint8Array): Output

Compares two versions of runtime metadata and returns a detailed diff.

Output Structure

type Output = {
  added: Change[]
  removed: Change[]
  kept: ComparedChange[]
}

Change

Represents a new or removed runtime item.

type Change =
  | {
      kind: "const" | "storage" | "call" | "event" | "error" | "view"
      pallet: string
      name: string
    }
  | { kind: "api"; group: string; name: string }

ComparedChange

Represents a kept runtime item with compatibility information.

type ComparedChange =
  | {
      kind: "call" | "event" | "error" | "const"
      pallet: string
      name: string
      compat: CompatibilityLevel
    }
  | {
      kind: "storage" | "view"
      pallet: string
      name: string
      compat: { args: CompatibilityLevel; values: CompatibilityLevel }
    }
  | {
      kind: "api"
      group: string
      name: string
      compat: { args: CompatibilityLevel; values: CompatibilityLevel }
    }

CompatibilityLevel

Indicates how compatible a change is:

enum CompatibilityLevel {
  Incompatible = 0,
  Partial = 1,
  BackwardsCompatible = 2,
  Identical = 3,
}

📦 Example Use Case

  • Automatically detect breaking changes before pushing an upgrade
  • Generate upgrade reports for audit or governance proposals
  • Integrate into CI/CD to fail builds with breaking changes

📄 License

MIT

FAQs

Package last updated on 15 Sep 2025

Did you know?

Socket

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.

Install

Related posts