1

Is there a way to the RPC call output of system.properties() using the py-substrate-interface? I want to access the token name and decimals as shown below (based on this link)

{
  ss58Format: 2
  tokenDecimals: [
    12
  ]
  tokenSymbol: [
    KSM
  ]
}

1 Answer 1

1

The python interface provides convenience functions for this:

from substrateinterface import SubstrateInterface

client = SubstrateInterface(
    url="wss://kusama-rpc.polkadot.io/",
    ss58_format=2,
    type_registry_preset='kusama'
)

# Prints: {'ss58Format': 2, 'tokenDecimals': 12, 'tokenSymbol': 'KSM'}
print(client.properties)

If there is a method missing, you can manually use client.rpc_request("system_properties", []).get('result') instead.

2
  • Thanks Oliver! Very grateful for your answer. It would be great to get that second method added to the docs (unless it is already there and I missed it). Commented May 17, 2022 at 12:07
  • It is documented here. Commented May 17, 2022 at 17:29

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.