Skip to content
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

Why this type can not be decode? #8591

Closed
AurevoirXavier opened this issue Dec 21, 2022 · 5 comments
Closed

Why this type can not be decode? #8591

AurevoirXavier opened this issue Dec 21, 2022 · 5 comments
Labels
stackoverflow https://substrate.stackexchange.com/ Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance.

Comments

@AurevoirXavier
Copy link
Contributor

AurevoirXavier commented Dec 21, 2022

https://substrate.stackexchange.com/questions/6219/why-this-type-can-not-be-decode

I didn't get any helpful answers from StackExchange.
So, I open an issue here.
Sorry for this.

Is there any way to decode this? Thanks.
I don't know how to make my front end works.

@jacogr
Copy link
Member

jacogr commented Dec 21, 2022

So the “Bytes” part of the input means that is come back in the metadata as Vec<u8>. (The (Vec<DepositId>) is the associated type name.

You didn’t specify a chain or the actual code link, so cannot quite comment further.

The first would indicate (with metadata retrieval) the actual type definition, ie. You can see what is returned and linked (also in the UI). The second will show the actual definition from Rust.

@jacogr jacogr added Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance. stackoverflow https://substrate.stackexchange.com/ labels Dec 21, 2022
@AurevoirXavier
Copy link
Contributor Author

You didn’t specify a chain or the actual code link, so cannot quite comment further.

The original definition: https://github.com/darwinia-network/darwinia-2.0/blob/08b703a75e657a120b6701a5781bdbbd88e6a617/pallet/deposit/src/lib.rs#L59

The associated type: https://github.com/darwinia-network/darwinia-2.0/blob/08b703a75e657a120b6701a5781bdbbd88e6a617/pallet/staking/src/lib.rs#L66

And it was used in this storage item: https://github.com/darwinia-network/darwinia-2.0/blob/08b703a75e657a120b6701a5781bdbbd88e6a617/pallet/staking/src/lib.rs#L128

It's a little bit like NegativeImbalance in Substrate. Maybe you are familiar with that.

@jacogr
Copy link
Member

jacogr commented Dec 21, 2022

Which network is this? (You guys have a couple, hence asking - would like to pull the metadata and look at the type definitions in the metadata alongside)

@jacogr
Copy link
Member

jacogr commented Dec 21, 2022

Ok, all good. Cann see the reason from the first link provided.

pub type DepositId = u8;

So it will treat it as the normal Vec<u8> handling in the apps UI, e.g. as a "normal" input type via the Bytes component, aka no individual specification of the items. (In apps UI land all Vec<u8> are handled that way)

AurevoirXavier added a commit to darwinia-network/darwinia-2.0 that referenced this issue Dec 22, 2022
AurevoirXavier added a commit to darwinia-network/darwinia-2.0 that referenced this issue Dec 22, 2022
* Fix type & code optimization

* Use `u16` to bypass the polkadot-js/apps#8591
@polkadot-js-bot
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Dec 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stackoverflow https://substrate.stackexchange.com/ Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance.
Projects
None yet
Development

No branches or pull requests

3 participants