We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Is it possible to retrieve data types for events from metadata?
The objective is to extend the types.EventRecords type for the given chain (in my case, Polkadot) to prevent unkown type errors when decoding events.
types.EventRecords
I'm attempting to list out the data types for events, and I'm unsure how si1Lookup works.
si1Lookup
Sample code:
func TestGetEventsFromMeta(t *testing.T) { c, err := NewConnection("http://localhost:9934") assert.NoError(t, err) meta, err := c.getLatestMetadata() assert.NoError(t, err) for _, mod := range meta.AsMetadataV14.Pallets { if !mod.HasEvents { continue } if typ, ok := meta.AsMetadataV14.EfficientLookup[mod.Events.Type.Int64()]; ok { if len(typ.Def.Variant.Variants) > 0 { for _, vars := range typ.Def.Variant.Variants { fmt.Printf("%s\t%s\n", mod.Name, vars.Name) for _, field := range vars.Fields { // How to decode field data here? <--------------------------------------------------- fmt.Printf("%#v\n", meta.AsMetadataV14.Lookup.Types[field.Type.Int64()]) } } } } } }
Related to issue #220
The text was updated successfully, but these errors were encountered:
Hey @csknk,
Please refer to - #251 (comment)
Sorry, something went wrong.
No branches or pull requests
Is it possible to retrieve data types for events from metadata?
The objective is to extend the
types.EventRecords
type for the given chain (in my case, Polkadot) to prevent unkown type errors when decoding events.I'm attempting to list out the data types for events, and I'm unsure how
si1Lookup
works.Sample code:
Related to issue #220
The text was updated successfully, but these errors were encountered: