-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: use generics on chain queries #260
Conversation
This commit is a very strict implementation that will not work with mashnet-node v 0.22 and below and will not handle any other codec input
reimplemented support for decoding of tuple return types (0.22 and below)
Timo requested I open this for review and implement type checks on a separate ticket: https://github.com/KILTprotocol/ticket/issues/486 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you already know that some stuff like the RootDelegationRecord
or DelegationNodeRecord
breaks stuff in the tests. Besides that, almost all of my complaints are towards the documentation (and really minor).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One tests needs fixing. Other than that, minor stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixes KILTProtocol/ticket#305
This adds generics to polkadot api calls for chain queries, which communicates the expected return type to our typescript code. It also removes the custom
QueryResult
type as a return type for chain queries which includednull
andundefined
, which was simply not correct - queries will always returnCodec
types.This also implements type checks at runtime for codec types provided to decoder methods, making sure that they are only used in appropriate contexts.
How to test:
Run integration tests with mashnet-node v 0.22 and a develop version
Checklist: