Search code examples
rustsubstratepolkadot-js

Creation event of simple struct is not emitted


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?


Solution

  • my bad, had to add:

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

    to Settings.Developer