polkadot-js / apps

Basic Polkadot/Substrate UI for interacting with a Polkadot and Substrate node. This is the main user-facing application, allowing access to all features available on Substrate chains.
https://dotapps.io
Apache License 2.0
1.74k stars 1.53k forks source link

Why this type can not be decode? #8591

Closed AurevoirXavier closed 1 year ago

AurevoirXavier commented 1 year ago

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 commented 1 year ago

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.

AurevoirXavier commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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)

polkadot-js-bot commented 1 year ago

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.