Robonomics wrapper over https://github.com/polkascan/py-substrate-interface created to facilitate programming with Robonomics
Project description
robonomics-interface
This is a simple wrapper over https://github.com/polkascan/py-substrate-interface used to facilitate writing code for applications using Robonomics.
Robonomics project: https://robonomics.network/
Robonomics parachain dapp: https://parachain.robonomics.network/
Installation
pip3 install robonomics-interface
Usage
More info may be found in docstrings in the source code
import robonomicsinterface as RI
Initialization
interface = RI.RobonomicsInterface()
By default, you will only be able to fetch Chainstate info from Frontier parachain. You can specify another node address (e.g. local), seed (more on that later) and custom registry types.
Simple case: fetch Chainstate
Here, no need to pass any arguments, by
interface = RI.RobonomicsInterface()
you will be able to read any Chainstate info from the Frontier parachain:
num_dt = interface.custom_chainstate("DigitalTwin", "Total")
you can also specify an argument for the query. Several arguments should be put in a list.
There is a dedicated function to obtain Datalog:
record = interface.fetch_datalog(<ss58_address>:str)
This will give you the latest datalog record of the specified account with its timestamp. You may pass an index argument to fetch specific record. If you create an interface with a provided seed, you'll be able to fetch self-datalog calling fetch_datalog
with no arguments (or just the index
argument).
Extrinsics
Providing seed (any raw or mnemonic) while initializing will let you create and submit extrinsics:
interface = RI.RobonmicsInterface(seed:str = <seed>)
hash = interface.custom_extrinsic("DigitalTwin", "create")
hash is the transaction hash of the succeeded extrinsic. You can also specify arguments for the extrinsic as a dictionary.
There are dedicated functions for recording datalog and sending launch commands:
interface.record_datalaog("Hello, Robonomics")
interface.send_launch(<ss58_address>:str, True)
Current nonce definition amd manual nonce setting is also possible.
This is an evolving package, it may have errors and lack of functionality, fixes are coming. Feel free to open issues when faced a problem.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for robonomics-interface-0.1.2.post1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39c748edbe44403fed248f8eed6da48250ec9220afb3166927396609f6cf9753 |
|
MD5 | af3db6ad3327d13d7ed54f2e5505934d |
|
BLAKE2b-256 | 7d1ae81fb0d3c15fe42b5bb10854837de92fd2651d09430ff3972302f0c9e4da |
Hashes for robonomics_interface-0.1.2.post1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 447ccc4feac4e28eae35612f5991941fa64f7e344268f851e3a00facb1540657 |
|
MD5 | 07d31fca14824e383073e33ccdaffce5 |
|
BLAKE2b-256 | edeb32ec6e795f30c00f24e4b0a0e235e0df40a8e85ce35956f59151f57e144e |