0

I am trying to call api.query.staking.erasTotalStake in polkadot.js.

Docs: https://polkadot.js.org/docs/substrate/storage/#erastotalstakeu32-u128

Which value can be parameter? Docs says u32. Is it block height?

https://codesandbox.io/s/keen-leakey-6jzrz9?file=/index.js This is my working code sandbox, I am just getting response 0.

How can I get another response beyond 0, and check if this api works correctly?

1 Answer 1

1

The parameter is the era you want to query.
The current value is 3728.

You can check values directly with https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fkusama-rpc.polkadot.io#/chainstate.

Hope it helps.

4
  • Hi. Thanks for your comment. I was able to get response. One more question. How can I get human readable value from response? I am getting <BN: 4f56b6cd0ff56b83>
    – Heindrick
    Commented May 19, 2022 at 10:06
  • 1
    You can use toString(), toHuman() or toBigInt() to get a more friendly value. More info at polkadot.js.org/docs/api/start/types.basics
    – LaurentTrk
    Commented May 19, 2022 at 10:36
  • Hi, I am trying api.query.staking.eraStakers on polkadot.js.org/apps/?rpc=wss%3A%2F%2Fkusama-rpc.polkadot.io#/… which you sent. However, I cannot select any AccountId32, or type. I can type era. How can I select account?
    – Heindrick
    Commented May 19, 2022 at 11:34
  • 1
    Not sure to understand what you are trying to do. From the polkadiot.js.org/apps, you need to enable the include option option, then slect/type an account address. For example, era 3728 and account JCghFN7mD4ETKzMbvSVmMMPwWutJGk6Bm1yKWk8Z9KhPGeZ are valid inputs.
    – LaurentTrk
    Commented May 19, 2022 at 11:42

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.