1k-validators-be icon indicating copy to clipboard operation
1k-validators-be copied to clipboard

Get denom from api.registry.getChainProperties()

Open dcolley opened this issue 3 years ago • 0 comments

https://github.com/w3f/1k-validators-be/blob/2886bc7b19131694dbb6c7803a3196c6c885afde/packages/core/src/scorekeeper.ts#L61

We can get the denom from https://polkadot.js.org/docs/substrate/rpc#properties-chainproperties

  const provider = new WsProvider('wss://kusama-rpc.polkadot.io');
  const api = await ApiPromise.create({ provider });
  const chainProps = await api.rpc.system.properties();
  const decimals = chainProps.tokenDecimals.toJSON()[0]
  // console.log(decimals); // 10
  const denom = Math.pow(10, decimals)
  //           1000000000000
  console.log('1000000000000', denom)

Should i make a PR for this?

dcolley avatar Nov 03 '22 10:11 dcolley