Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Apolixit committed Jul 30, 2023
1 parent 94de2da commit 1f8b561
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
File renamed without changes.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,42 @@
# Substrate.NET.Metadata

[![Build & Analyse](https://github.com/SubstrateGaming/Substrate.NET.Metadata/actions/workflows/build.yml/badge.svg)](https://github.com/SubstrateGaming/Substrate.NET.Metadata/actions/workflows/build.yml)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=SubstrateGaming_Substrate.NET.Metadata&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=SubstrateGaming_Substrate.NET.Metadata)
[![GitHub issues](https://img.shields.io/github/issues/SubstrateGaming/Substrate.NET.Metadata.svg)](https://github.com/SubstrateGaming/Substrate.NET.Metadata/issues)
[![license](https://img.shields.io/github/license/SubstrateGaming/Substrate.NET.Metadata)](https://github.com/SubstrateGaming/Substrate.NET.Metadata/blob/origin/LICENSE)

Project to manage Substrate based blockchain Metadata from V9 to V14

## How to use ?

### Instanciate metadata classes

Please check the [getMetadataAsync()](https://github.com/SubstrateGaming/Substrate.NET.API/blob/master/Substrate.NetApi/Modules/State.cs#L57) method from the [Substrate.NET.API](https://github.com/SubstrateGaming/Substrate.NET.API) library allows you to get the hexadecimal string representation of the metadata for a given Substrate blockchain.
Once you have the hexadecimal string representation of the metadata, you can instantiate the corresponding Metadata class by instanciating the right Metadata class.

```c#
string hexMetadataFromSubstrateNetApi = "0x...";
var v11 = new MetadataV11(hexMetadataFromSubstrateNetApi);
var v12 = new MetadataV12(hexMetadataFromSubstrateNetApi);
var v13 = new MetadataV13(hexMetadataFromSubstrateNetApi);
var v14 = new MetadataV14(hexMetadataFromSubstrateNetApi);
```

If you are not sure of your metadata version you can call :
```c#
string hexMetadataFromSubstrateNetApi = "0x...";
var metadataInfo = new CheckRuntimeMetadata(hexMetadataFromSubstrateNetApi);

// metadataInfo.MetaDataInfo.Version.Value -> 11 / 12 / 13 / 14
```

### Compare metadata

You can also compare metadata between each other, but it should be the same major version (compare V12 with V12 and V14 with V14)

The package also provides a MetadataService class that can be instantiated directly or used with dependency injection.
Metadata comparison can provide a differential between two versions, including removed or added pallets, as well as more precise information such as function calls that have been renamed. The MetadataService class supports comparison from version 9 to 14.

## Dependencies

- [Substrate .NET API](https://github.com/SubstrateGaming/Substrate.NET.API)
Expand Down

0 comments on commit 1f8b561

Please sign in to comment.