-
Notifications
You must be signed in to change notification settings - Fork 22
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
Sometimes types fail to construct #122
Comments
@KaiserKarel Are you using @redspot/known-types. If so then there is a real possibility of a conflict, if not then it should be fine. |
So I managed to track down parts of my error to incorrect configurations, however it seems that sometimes, redspot also fails to create a type for an event:
where bar is defined as Any clues what causes this? |
First you can check if the types have been correctly injected into the api.registry. For example:
This indicates that the configuration is OK. If there is still a problem, then you can post your code and I will check what the problem is. |
Thanks, useful tool to sanity check. This leads me to the following error:
|
Of course you can't do that. there is no problem with this error. The first parameter of createType is the type name and the second parameter is the value. https://polkadot.js.org/docs/api/start/types.create If you want to define a structure, you can do something like this:
Then run:
|
Yes but this is exactly the error message that is happening during a test. :)
Will sometimes fail with So I'm wondering why it is attempting to create that type, and why it only sometimes fails. |
I'm thinking that it is due to an event; based on the fields. Do events need to be registered as well? |
I think the type should already be injected. This error does not say that the type cannot be found. But I'm not quite sure why it fails to decode. https://github.com/polkadot-js/api/blob/121bfc79132283d802299cec4a82c50f2a6ecc8f/packages/types/src/primitive/Text.ts#L14-L38 |
So it seems like replacing String with Vec inside the contract does fix the error, although due to it's flakyness it is difficult to test. |
Are you using the latest redspot, 0.11.6-3? and if you can provide a test case, we'll debug it and find out what's going wrong. |
I'll write a reproducible example this weekend |
Even though we registered types in the configuration, sometimes they'll still fail to be created. I thought that might be due to incorrect order of definitions and usages, but that does not seem to be the case. Are there known bugs here?
The text was updated successfully, but these errors were encountered: