Skip to main content

Python Suibase Helper

As needed, read first the Helper Overview.


Call ~/suibase/pip-install within any python virtual environment in which you want to use the API.

Example creating a new environment and installing the API:

$ cd ~/myproject
$ python3 -m venv env
$ . env/bin/activate
$ ~/suibase/pip-install

Typical Usage

1. import suibase;
2. Create an instance of suibase.Helper
3. Verify suibase is_installed()
4. select_workdir()
5. ... use the rest of the API ...


For now, there is no python documentation generated (work-in-progress).

The API very closely matches the Rust APIopen in new window.

There is only one class: Helper

Some demo calls for each methods:

$ python3
Python 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> import suibase;
>>> helper=suibase.Helper();

>>> helper.is_installed()

>>> helper.select_workdir("localnet")

>>> helper.workdir()

>>> helper.keystore_pathname();

>>> helper.client_address("active")

>>> helper.client_address("sb-1-ed25519");

>>> helper.rpc_url()

>>> helper.ws_url()

>>> helper.package_id("demo")

>>> helper.published_new_objects("demo::Counter::Counter")

For the package_id and published_new_objects call to succeed, you have to first publish the package 'demo' on localnet:

$ localnet publish --path ~/suibase/rust/demo-app
Last update: