addSpecVersion method

void addSpecVersion(
  1. SpecVersion specVersion
)

SpecVersion

Processes the SpecVersion Creates VersionDescription from its Metadata and adds it to _versionDescriptionList

final specJson = {'specName': 'polkadot', 'specVersion':......};

final specVersion = SpecVersion.fromJson(specJson);

chainObject.addSpecVersion(specVersion);

Implementation

void addSpecVersion(SpecVersion specVersion) {
  if (_versionDescriptionMap[specVersion.blockNumber] != null) {
    return;
  }

  final ChainInfo chainInfo = getChainInfoFromSpecVersion(specVersion);
  VersionDescription? versionDescription;
  versionDescription = VersionDescription(
    /// local to class params
    chainInfo: chainInfo,

    /// passing params for super-class i.e. SpecVersion
    metadata: specVersion.metadata,
    specName: specVersion.specName,
    specVersion: specVersion.specVersion,
    blockNumber: specVersion.blockNumber,
    blockHash: specVersion.blockHash,
  );

  _versionDescriptionMap[specVersion.blockNumber] = versionDescription;
}