capi icon indicating copy to clipboard operation
capi copied to clipboard

misc. example ideas

Open harrysolovay opened this issue 2 years ago • 2 comments

  • faucet service
  • differentiating between tokens on chain with numerous Balances impls

harrysolovay avatar Mar 25 '23 16:03 harrysolovay

I want to call the system_properties rpc method but couldn't find an rpc call example on main.

For Westend it should return:

{
  ss58Format: 42
  tokenDecimals: [
    12
  ]
  tokenSymbol: [
    WND
  ]
}

Also interesting to have an example of querying chain constants like depositBase and depositFactor

statictype avatar Mar 27 '23 20:03 statictype

You can achieve this like so.

import { chain } from "westend_dev/mod.js"

const properties = await chain.connection
  .call("system_properties")
  .run()

You could also access this from the FRAME metadata if I'm not mistaken. Ie.

const ss58Prefix = await chain
  .pallet("System")
  .constant("Ss58Prefix").decoded
  .run()

Asset differentiation is definitely an area in which some nice patterns can make a big difference... adding that to the list.

harrysolovay avatar Mar 27 '23 20:03 harrysolovay