From 830b10b57f5abac7832a66ec0be487b5688ccef3 Mon Sep 17 00:00:00 2001 From: Miguel Hervas Date: Wed, 21 Jun 2023 07:22:16 -0700 Subject: [PATCH] Add registry readme (#351) --- README.md | 2 ++ registry/REGISTRY.md | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 registry/REGISTRY.md diff --git a/README.md b/README.md index 0fefc7760..6a3a90b42 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,8 @@ This package is feature complete, but it is relatively new and might still conta Please refer to https://godoc.org/github.com/centrifuge/go-substrate-rpc-client +### Usage test examples of Dynamic Parsing of events & extrinsics +[Registry docs](registry/REGISTRY.md) ## Contributing 1. Install dependencies by running `make` diff --git a/registry/REGISTRY.md b/registry/REGISTRY.md new file mode 100644 index 000000000..f21cc7c99 --- /dev/null +++ b/registry/REGISTRY.md @@ -0,0 +1,22 @@ +# GSRPC Registry +The GSRPC Registry can parse target metadata information into an in-memory registry of complex structures. + +By leveraging the on-chain metadata, GSRPC is more robust to changes on types, allowing clients to only keep updated the types that are relevant to their business operation. + +This registry can be used afterwards to decode data read from live chains (events & extrinsics). + +## Usage +Since docs get outdated fairly quick, here are links to tests that will always be up-to-date. +### Populate Call, Error & Events Registries +[Browse me](registry_test.go) + +### Event retriever +[TestLive_EventRetriever_GetEvents](retriever/event_retriever_live_test.go) +### Extrinsic retriever +Since chain runtimes can be customized, modifying core types such as Accounts, Signature payloads or Payment payloads, the code supports a customizable way of passing those custom types to the extrinsic retriever. + +On the other hand, since a great majority of chains do not need to change these types, the tool provides a default for the most common used ones. +#### Using Chain Defaults +[TestExtrinsicRetriever_NewDefault](retriever/extrinsic_retriever_test.go#L179) +#### Using Custom core types +[TestLive_ExtrinsicRetriever_GetExtrinsics](retriever/extrinsic_retriever_live_test.go) \ No newline at end of file