Skip to content

Commit

Permalink
Add registry readme (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikiquantum authored and cdamian committed Jul 4, 2023
1 parent b921ecc commit 830b10b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
22 changes: 22 additions & 0 deletions registry/REGISTRY.md
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 830b10b

Please sign in to comment.