substrate-docs
substrate-docs copied to clipboard
Update write-up for Kitties tutorial
The Kitties write-up (from the published tutorial) needs updating based on the latest improved solution, also based on this workshop.
Hi @sacha-l - I'm happy to help on ths.
Hi @sacha-l - I'm new to substrate and I want to make sure that I follow this requirement clearly.
Here are the steps, I'm following.
- Running kitties to tutorial from the current article.
- In event of compilation issues, I'm referring to latest code from this link.
- All modified changes need to be updated in article by forking it.
Eg:
In pallet_kitties scaffold, after using the default code and compiling, it is throwing use of undeclared crate or module
sp_io`` as error.
So I referred the updated solution and moved sp-io from [dev-dependencies] to [dependencies]. This fixed the issue.
Please help me out, if my understanding it correct.
Hi @sacha-l - I need a small help with below error. I tried in different ways to resolve this issue.
I'm getting this issue in both published article and your workshop article.
I checked the similar issue was raised in Stack Overflow and I was able to get around this issue with below code.
Add a simple "hint" to the compiler in the form of #[codec(mel_bound())]
.
// Struct for holding Kitty information.
#[derive(Clone, Encode, Decode, PartialEq, RuntimeDebug, TypeInfo, MaxEncodedLen)]
#[scale_info(skip_type_params(T))]
#[codec(mel_bound())] // <---------------- Here
pub struct Kitty<T: Config> {
pub dna: [u8; 16], // Using 16 bytes to represent a kitty DNA
pub price: Option<BalanceOf<T>>,
pub gender: Gender,
pub owner: AccountOf<T>,
}
Hope this helps someone :)