ChainInfo class

Convenient facade for accessing metadata, registry, and derived codecs

ChainInfo acts as a one-stop shop for all chain-specific metadata operations, providing easy access to:

  • Type registry for custom codec operations
  • Pre-built derived codecs (events, extrinsics, calls, constants)
  • Metadata information (pallets, storage, etc.)

Example:

final chainInfo = ChainInfo.fromMetadata(metadataBytes);

// Decode events
final events = chainInfo.eventsCodec.decode(eventBytes);

// Decode extrinsics
final extrinsics = chainInfo.extrinsicsCodec.decode(extrinsicBytes);

// Access registry for custom operations
final customCodec = chainInfo.registry.codecFor(typeId);

Constructors

ChainInfo(MetadataTypeRegistry registry)
ChainInfo.fromMetadata(Uint8List metadataBytes)
Create ChainInfo from raw metadata bytes
factory
ChainInfo.fromRuntimeMetadataPrefixed(RuntimeMetadataPrefixed prefixed)
Create ChainInfo from the RuntimeMetadataPrefixed
factory

Properties

callsCodec ↔ RuntimeCallCodec
Derived codec for encoding/decoding runtime calls
latefinal
constantsCodec ↔ ConstantsCodec
Derived codec for accessing constants
latefinal
eventsCodec ↔ EventsRecordCodec
Derived codec for decoding event records
latefinal
extrinsicsCodec ↔ ExtrinsicsCodec
Derived codec for decoding extrinsics
latefinal
hashCode → int
The hash code for this object.
no setterinherited
pallets → List<PalletMetadata>
Get all pallets
no setter
registry → MetadataTypeRegistry
Core metadata type registry
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
version → int
Get metadata version
no setter

Methods

decodeEvents(Uint8List bytes) → List<EventRecord>
Convenience: Decode events from storage
decodeExtrinsics(Uint8List bytes) → List<UncheckedExtrinsic>
Convenience: Decode extrinsics from a block
getConstant(String palletName, String constantName) → dynamic
Convenience: Get constant value
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pallet(String name) → PalletMetadata?
Get pallet by name
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited