I defined the ink! method and struct like this:

#[derive(SpreadAllocate, PackedLayout, SpreadLayout, Clone, Decode, Encode)]
#[cfg_attr(feature = "std", derive(Debug, scale_info::TypeInfo, StorageLayout))]
pub struct ShowTest{
    test_id: u8,


pub fn show_test_add(&mut self, v: ShowTest) {

After I deployed the contract to the local contract-test chain, I found the method name show_test_add became showTestAdd and field name test_id became testId.

And it was the same when I used polkadot api in JS, I don't know why.

enter image description here

1 Answer 1


Polkadot.js transforms contract message names to camelCase for consistency across its packages and alignment with JavaScript common practice.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.