0

I have a simple struct in a custom pallet:

#[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq)]
pub struct Kitty(pub [u8; 16]);

I am able to create a new Kitty from polkadot.js web app and check that the KittyCreated event is emitted looking at the network explorer:

/// A kitty is created. \[owner, kitty_id, kitty\]
KittyCreated(AccountId, u32, Kitty)

However when I modify the Kitty struct to have an additional u32 param the object is created but the event is not emitted:

#[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq)]
pub struct Kitty(pub [u8; 16], pub u32);

If I check in Developer ChainState and query for the account Kitties I get:

kitties.kitties: Option<Kitty>
<unknown>

It looks like there is an issue with the struct, do you know what it is?

mastro
  • 619
  • 1
  • 8
  • 17

1 Answers1

1

my bad, had to add:

  "Kitty": "([u8; 16], u32)",
   ....
   }

to Settings.Developer

mastro
  • 619
  • 1
  • 8
  • 17
  • Yes, it is important to add your custom types for seeing every part interfacing properly. Here https://polkadot.js.org/docs/api/start/types.extend covers more in depth this topic – Alejandro Martínez May 24 '21 at 08:11