0

As when i try to to do api.query.templatemodule.get_something() it shows errors in the console

2
  • please share a screenshot or extract of the errors, and the version of substrate, substrate-template, or substrate-parachain-template, polkadot.js apps, and polkadot.js api that you're are using Feb 16, 2022 at 13:38
  • Please provide a Minimal, Reproducible Example
    – Shawn Tabrizi
    Feb 16, 2022 at 16:18

1 Answer 1

3

Probably the error here is due to Rust doing things with snake_case/UpperCase, and JavaScript doing things with camelCase.

I would never expect that the Polkadot JS API would expose a function which is not camelCase, so probably what you want is:

api.query.templatemodule.getSomething()

This should work fine assuming your storage is named the same thing:

#[pallet::storage]
pub(super) type GetSomething<T: Config> = StorageValue<_, u64, ValueQuery>;

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