From fe57ab168047ff2de16a37cee5f7c63c477a3cc5 Mon Sep 17 00:00:00 2001 From: Unique Divine <51418232+Unique-Divine@users.noreply.github.com> Date: Sat, 17 Dec 2022 15:52:44 -0600 Subject: [PATCH] feat,docs: docgen in markdown with pdoc (#188) --- HACKING.md | 290 +++++++++++++++++++++++++++ README.md | 305 ++--------------------------- docgen.sh | 4 + docs-md/crypto/index.md | 6 + docs-md/crypto/ripemd160.md | 96 +++++++++ docs-md/event_specs.md | 69 +++++++ docs-md/exceptions.md | 46 +++++ docs-md/grpc_client.md | 85 ++++++++ docs-md/index.md | 19 ++ docs-md/msg/bank.md | 97 +++++++++ docs-md/msg/dex.md | 132 +++++++++++++ docs-md/msg/index.md | 9 + docs-md/msg/perp.md | 155 +++++++++++++++ docs-md/msg/pricefeed.md | 35 ++++ docs-md/network.md | 119 +++++++++++ docs-md/pytypes/common.md | 145 ++++++++++++++ docs-md/pytypes/event.md | 111 +++++++++++ docs-md/pytypes/index.md | 8 + docs-md/pytypes/tx_resp.md | 87 ++++++++ docs-md/query_clients/auth.md | 20 ++ docs-md/query_clients/dex.md | 227 +++++++++++++++++++++ docs-md/query_clients/epoch.md | 21 ++ docs-md/query_clients/index.md | 13 ++ docs-md/query_clients/perp.md | 63 ++++++ docs-md/query_clients/pricefeed.md | 32 +++ docs-md/query_clients/staking.md | 51 +++++ docs-md/query_clients/util.md | 90 +++++++++ docs-md/query_clients/vpool.md | 30 +++ docs-md/sdk.md | 102 ++++++++++ docs-md/transaction.md | 49 +++++ docs-md/tx.md | 39 ++++ docs-md/utils.md | 252 ++++++++++++++++++++++++ docs-md/wallet.md | 164 ++++++++++++++++ docs-md/websocket.md | 25 +++ poetry.lock | 113 ++++++++++- pyproject.toml | 1 + 36 files changed, 2816 insertions(+), 294 deletions(-) create mode 100644 HACKING.md create mode 100644 docgen.sh create mode 100644 docs-md/crypto/index.md create mode 100644 docs-md/crypto/ripemd160.md create mode 100644 docs-md/event_specs.md create mode 100644 docs-md/exceptions.md create mode 100644 docs-md/grpc_client.md create mode 100644 docs-md/index.md create mode 100644 docs-md/msg/bank.md create mode 100644 docs-md/msg/dex.md create mode 100644 docs-md/msg/index.md create mode 100644 docs-md/msg/perp.md create mode 100644 docs-md/msg/pricefeed.md create mode 100644 docs-md/network.md create mode 100644 docs-md/pytypes/common.md create mode 100644 docs-md/pytypes/event.md create mode 100644 docs-md/pytypes/index.md create mode 100644 docs-md/pytypes/tx_resp.md create mode 100644 docs-md/query_clients/auth.md create mode 100644 docs-md/query_clients/dex.md create mode 100644 docs-md/query_clients/epoch.md create mode 100644 docs-md/query_clients/index.md create mode 100644 docs-md/query_clients/perp.md create mode 100644 docs-md/query_clients/pricefeed.md create mode 100644 docs-md/query_clients/staking.md create mode 100644 docs-md/query_clients/util.md create mode 100644 docs-md/query_clients/vpool.md create mode 100644 docs-md/sdk.md create mode 100644 docs-md/transaction.md create mode 100644 docs-md/tx.md create mode 100644 docs-md/utils.md create mode 100644 docs-md/wallet.md create mode 100644 docs-md/websocket.md diff --git a/HACKING.md b/HACKING.md new file mode 100644 index 00000000..5ea3b8d3 --- /dev/null +++ b/HACKING.md @@ -0,0 +1,290 @@ +# HACKING - py-sdk + +Guidelines for developing and contributing to the Nibiru Python SDK. + +- [HACKING - py-sdk](#hacking---py-sdk) + - [Environment Setup](#environment-setup) + - [Pyenv for managing multiple Python interpreters](#pyenv-for-managing-multiple-python-interpreters) + - [Installing `poetry` for dependency resolution and publishing packages](#installing-poetry-for-dependency-resolution-and-publishing-packages) + - [Installing external dependencies](#installing-external-dependencies) + - [Running tests](#running-tests) + - [Publishing on PyPI](#publishing-on-pypi) + - [poetry version subcommands](#poetry-version-subcommands) + - [Makefile and Protocol Buffers](#makefile-and-protocol-buffers) + - [Linting](#linting) + - [Gotchas](#gotchas) + + +## Environment Setup + +Our recommended setup for a professional dev environment is to use `pyenv` in combination with `poetry`. + +- `pyenv` is a tool for installing and managing Python interpreters. This will let you seamlessly switch between Python versions. +- `poetry` is used for managing virtual environments, dependency resolution, package installations, package building, and package publishing. +- We assume you're on a Unix machine such as WSL2 Ubuntu, MacOS, or a common Linux distro. + +Currently, `nibiru` is created with Python 3.9.13. It may be compatible with higher versions, but we only run end-to-end tests in 3.9.13. + +### Pyenv for managing multiple Python interpreters + +If you're on MacOS or a common Linux distro, you can install `pyenv` with brew. + +```bash +brew install pyenv +``` + +You'll then need to add the following snippet to your shell config, e.g. your `.bash_profile`, `.bashrc`, or `.zshrc`. + +```bash +export PYENV_ROOT="$HOME/.pyenv" +export PATH="$PYENV_ROOT/bin:$PATH" +eval "$(pyenv init -)" +eval "$(pyenv init --path)" +``` + +After using `source` on your config or restarting the shell, you should have the `pyenv` root command. + +The command use to install any version of python is `pyenv install`. Display additional info for this command with `pyenv install --help`. + +```bash +pyenv install 3.9.13 # example for nibiru +``` + +Once you have a version installed, you can print out the versions on your machine with: + +```bash +pyenv versions +``` + +``` +# example output + system +* 3.9.13 (set by /home/realu/.python-version) + 3.10.4 +``` + +In this example, I have 2 different interpreters installed on my machine. The one with the `*` is currently set as my **global interpreter**. This is set manually using the `pyenv global` command. + +```bash +pyenv global 3.10.4 # switches the global interpreter to 3.10.4 +``` + +You can verify this works as expected using `python --version`. You may be familiar with using `python3` as the command instead of `python`. With `pyenv`, this is not necessary. + +Additional usage and installation instructions can be found in the [pyenv repo](https://github.com/pyenv/pyenv). + +## Installing `poetry` for dependency resolution and publishing packages + +Reference: [Poetry docs](https://python-poetry.org/docs/) + +Poetry can be installed with both `curl` and `pip`. We recommended using `curl` so that it will be global to your machine. + +NOTE We highly, highly, highly recommend that you DO NOT use `brew` to install `poetry`. +If you use `brew`, it's going to install directly to your system, which prevents you from being able to leverage `pyenv` to seamlessly switch between Python interpreters. + +```bash +# installation with pip: recommended option in tandem with pyenv +pip install poetry +``` + +```bash +# For UNIX systems - installation with curl +curl -sSL https://install.python-poetry.org/ | python - +``` + +After this installation command, add the `poetry` binary to the path in your shell config (if it's not done automatically). + +```bash +export PATH=$PATH:$HOME/.poetry/bin +``` + +### Installing external dependencies + +The `nibiru` project is defined by its `pyproject.toml`. At the root of the repo, simply call: + +```bash +poetry install +``` + +This will resolve dependencies between each of the project's packages and install them into a virtual environment. + +## Running tests + +#### Setting environment variables + +There's currently a "devnet" running in GCP that the CI workflows use. You can find these secrets at [this notion page](https://www.notion.so/nibiru/Resources-and-Repo-Configs-b31aa8074a2b419d80b0c946ed5efab0) if you have access to it or contact one of the `CODEOWNERS` (@Unique-Divine, @matthiasmatt, @nibiruheisenberg). +This is useful so that you can run every part of the package code without needing to visit other repositories. + +You'll need to set up a `.env` configuration file to set environment variables for the tests. + +#### Environment Variables - Local + + +```bash +# Example configuration for the Nibiry Python SDK +HOST="..." +VALIDATOR_MNEMONIC="..." +ORACLE_MNEMONIC="..." +TENDERMINT_RPC_ENDPOINT="http://...:26657" +LCD_ENDPOINT="http://...:1317" +GRPC_ENDPOINT="...:9090" +WEBSOCKET_ENDPOINT="ws://...:26657/websocket" +CHAIN_ID="..." +NETWORK_INSECURE=true +``` + +#### Environment variables in GitHub Actions + +The variables used in the CI build can be found in the `env` section of the [`pytests.yml` workflow](.github/workflows/pytests.yml): + +```yaml +jobs: + tests: + env: + # https://www.notion.so/nibiru/Resources-and-Repo-Configs-b31aa8074a2b419d80b0c946ed5efab0 + CHAIN_ID: ${{ secrets.CHAIN_ID }} + HOST: ${{ secrets.HOST }} + VALIDATOR_MNEMONIC: ${{ secrets.VALIDATOR_MNEMONIC }} + GRPC_PORT: ${{ secrets.GRPC_PORT }} + LCD_PORT: ${{ secrets.LCD_PORT }} +``` + +You'll need an `.env` configuration like this. + +#### Running the tests with `poetry` + `pytest` + +After following the instructions for setting up `poetry`, you can run the tests with `poetry run pytest`: + +```bash +poetry run pytest -p no:warnings # silences warnings + +poetry run pytest --slow -p no:warnings # to include slowly running tests +``` + +#### (option B). Install the `nibiru` package with `pip` + + ```bash + # from local + # build and install + pip install . + + # from local build + pip uninstall nibiru + pip install nibiru --no-index --find-links /path/to/nibiru/py-sdk/dist + + # from pypi + pip uninstall nibiru + pip install nibiru + ``` + +## Docgen + +```bash +poetry run pdoc nibiru -o=docs-md-pdoc -f --skip-errors +``` + +See https://pdoc3.github.io/pdoc/ + + +## Publishing on PyPI + +1. Changing the version number in the `pyproject.toml` changes the package version number. You can either edit it manually or use one of the `poetry version [bump-rule]` commands. +2. After changing the package version, use `poetry build` to add a distribution for this version to the `dist` directory. +3. Set your PyPI username and password as the environment variables `PYPI_USERNAME` and `PYPI_PASSWORD`. +4. Publish in the following manner. + ```bash + poetry publish --build --username $PYPI_USERNAME --password $PYPI_PASSWORD + ``` + +### poetry version subcommands + +For the `poetry version` command, using any bump rule with a valid semver string will change the version inside `pyproject.toml`. For example, + +```bash +poetry version patch # moves from x.y.14 to x.y.15 +poetry version minor # moves from x.5.z to x.6.0 +poetry version major # moves from 3.y.z to 4.0.0 +``` + +The list of bump rules includes: +patch, minor, major, prepatch, preminor, premajor, prerelease. + +You specify updates to publish using the commit (or PR) title with `bump-[version-keyword]`. + +So the list of available keywords you an put in a PR includes +- `bump-patch`: +- `bump-patch`: 0.0.0 → 0.0.1 +- `bump-minor`: 0.0.* → 0.1.0 +- `bump-major`: 0.*.* → 1.0.0 +- `bump-prepatch`: 0.0.0 → 0.0.1-alpha0 +- `bump-prerelease`: equivalent to `bump-prepatch` +- `bump-preminor`: 0.0.* → 0.1.0-alpha0 +- `bump-premajor`: 0.*.* → 1.0.0-alpha0 + +These guidelines are in the release.yml for future reference. + +## Makefile and Protocol Buffers + +Protobuf-generated types from NibiruChain/nibiru are published under `nibiru_proto` package, which is created in the [NibiruChain/sdk-proto-gen repository](https://github.com/NibiruChain/sdk-proto-gen). Visit this repo for more information. + +The entrypoint command is: + +```bash +make proto-gen +``` + +If you get a permissions error such as + +``` +rm: cannot remove 'proto/proto/epochs/query.proto': Permission denied +``` + +call `sudo chown -R [USER-NAME] proto` using the name of user directory. +You can find the value for `[USER-NAME]` quickly by running `whoami`. In other words, this should work: + +```bash +sudo chown -R $(whoami) proto +``` + +You're done generating types once you've successfully called + +```bash +make proto-gen +poetry build +``` + +## Linting + +Enable git hook which will perform linting before each commit: + +```bash +poetry run pre-commit install +``` + +This will help keep your code clean. + +## Gotchas + +The `protobuf` package must be version 3.20.x or lower. Otherwise, the following error appears at runtime. + +``` +nibiru/clients/__init__.py:1: in + from nibiru.clients.dex import Dex # noqa +nibiru/clients/dex.py:8: in + from nibiru.proto.dex.v1 import query_pb2 as dex_type +nibiru/proto/dex/v1/query_pb2.py:16: in + from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 +../../../anaconda3/envs/divine/lib/python3.9/site-packages/google/api/annotations_pb2.py:30: in + from google.api import http_pb2 as google_dot_api_dot_http__pb2 +../../../anaconda3/envs/divine/lib/python3.9/site-packages/google/api/http_pb2.py:48: in + _descriptor.FieldDescriptor( +../../../anaconda3/envs/divine/lib/python3.9/site-packages/google/protobuf/descriptor.py:560: in __new__ + _message.Message._CheckCalledFromGeneratedFile() +E TypeError: Descriptors cannot not be created directly. +E If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0. +E If you cannot immediately regenerate your protos, some other possible workarounds are: +E 1. Downgrade the protobuf package to 3.20.x or lower. +E 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower). +E +E More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates +``` diff --git a/README.md b/README.md index f61b65e0..67a6c070 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Nibiru Python SDK - `nibiru` +# Python SDK - Nibiru Chain > Python-based client for interacting with the Nibiru blockchain. @@ -20,319 +20,44 @@ [stars-url]: https://github.com/NibiruChain [documentation-image]: https://readthedocs.org/projects/nibiru-py/badge/?version=latest [documentation-url]: https://nibiru-py.readthedocs.io/en/latest/?badge=latest -[discord-badge]: https://img.shields.io/badge/Nibiru%20Chain-%237289DA.svg?style=&logo=discord&logoColor=white +[discord-badge]: https://dcbadge.vercel.app/api/server/sgPw8ZYfpQ?style=flat [discord-url]: https://discord.gg/sgPw8ZYfpQ [license-badge]: https://img.shields.io/badge/License-MIT-blue.svg [license-link]: https://github.com/NibiruChain/py-sdk/blob/master/LICENSE [tests-badge]: https://github.com/NibiruChain/py-sdk/actions/workflows/pytests.yml/badge.svg [tests-workflow]: https://github.com/NibiruChain/py-sdk/actions/workflows/pytests.yml -The `nibiru` package allows you to index, query, and send transactions on the Nibiru Blockchain using Python. It provides access to market data for analysis, visualization, indicator development, algorithmic trading, strategy backtesting, bot programming, and related software engineering. +The `nibiru` package allows you to index, query, and send transactions on Nibiru Chain using Python. It provides access to market data for analysis, visualization, indicator development, algorithmic trading, strategy backtesting, bot programming, and related software engineering. The package is intended to be used by coders, developers, technically-skilled traders and data-scientists for building trading algorithms. -## Python SDK Tutorial - -[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)][Colab link] - -[Colab link]: https://colab.research.google.com/github/NibiruChain/py-sdk/blob/master/examples/collab_notebook.ipynb - #### README Contents -- [User Guidelines](#user-guidelines) - - [Documentation Website](#documentation-website) - - [Installation from `PyPI`](#installation-from-pypi) -- [Development Guidelines](#development-guidelines) - - [Setting up a professional dev environment with `pyenv` and `poetry`](#setting-up-a-professional-dev-environment-with-pyenv-and-poetry) - - [Pyenv for managing multiple Python interpreters](#pyenv-for-managing-multiple-python-interpreters) - - [Installing `poetry` for dependency resolution and publishing packages](#installing-poetry-for-dependency-resolution-and-publishing-packages) - - [Installing external dependencies](#installing-external-dependencies) - - [Running tests](#running-tests) - - [Makefile and Protocol Buffers](#makefile-and-protocol-buffers) - - [Linting](#linting) - - [Gotchas](#gotchas) - - [Usage instructions for publishing.](#usage-instructions-for-publishing) - -# User Guidelines +- [Python SDK Tutorial](#python-sdk-tutorial) +- [Installation from `PyPI`](#installation-from-pypi) +- [Documentation Website](#documentation-website) -## Documentation Website +## Python SDK Tutorial -Documentation can be found here: [Nibiru-py documentation](https://nibiru-py.readthedocs.io/en/latest/index.html) +[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)][Colab link] -- Learn more about opening and managing your spot and perp positions [here](https://nibiru-py.readthedocs.io/en/latest/nibiru.sdks.tx.html#nibiru-sdks-tx-package) -- Learn about querying the chain using the Sdk [here](https://nibiru-py.readthedocs.io/en/latest/nibiru.clients.html#nibiru-clients-package) +[Colab link]: https://colab.research.google.com/github/NibiruChain/py-sdk/blob/master/examples/collab_notebook.ipynb ## Installation from `PyPI` -```sh +```bash pip install nibiru # requires Python 3.9 ``` You may need to update `pip` to get this to run: -```sh -python -m pip install --upgrade pip -``` - ---- - -# Development Guidelines - -Our recommended setup is `pyenv` in combination with `poetry`. - -- `pyenv` is a tool for installing and managing Python interpreters. This will let you seamlessly switch between Python versions. -- `poetry` is used for managing virtual environments, dependency resolution, package installations, package building, and package publishing. -- We assume you're on a Unix machine such as WSL2 Ubuntu, MacOS, or a common Linux distro. - -Currently, `nibiru` is created with Python 3.9.13. It may be compatible with higher versions, but we only run end-to-end tests in 3.9.13. - -## Setting up a professional dev environment with `pyenv` and `poetry` - -### Pyenv for managing multiple Python interpreters - -If you're on MacOS or a common Linux distro, you can install `pyenv` with brew. - -```sh -brew install pyenv -``` - -You'll then need to add the following snippet to your shell config, e.g. your `.bash_profile`, `.bashrc`, or `.zshrc`. - -```sh -export PYENV_ROOT="$HOME/.pyenv" -export PATH="$PYENV_ROOT/bin:$PATH" -eval "$(pyenv init -)" -eval "$(pyenv init --path)" -``` - -After using `source` on your config or restarting the shell, you should have the `pyenv` root command. - -The command use to install any version of python is `pyenv install`. Display additional info for this command with `pyenv install --help`. - -```sh -pyenv install 3.9.13 # example for nibiru -``` - -Once you have a version installed, you can print out the versions on your machine with: - -```sh -pyenv versions -``` - -``` -# example output - system -* 3.9.13 (set by /home/realu/.python-version) - 3.10.4 -``` - -In this example, I have 2 different interpreters installed on my machine. The one with the `*` is currently set as my **global interpreter**. This is set manually using the `pyenv global` command. - -```sh -pyenv global 3.10.4 # switches the global interpreter to 3.10.4 -``` - -You can verify this works as expected using `python --version`. You may be familiar with using `python3` as the command instead of `python`. With `pyenv`, this is not necessary. - -Additional usage and installation instructions can be found in the [pyenv repo](https://github.com/pyenv/pyenv). - -## Installing `poetry` for dependency resolution and publishing packages - -Reference: [Poetry docs](https://python-poetry.org/docs/) - -Poetry can be installed with both `curl` and `pip`. We recommended using `curl` so that it will be global to your machine. - -NOTE We highly, highly, highly recommend that you DO NOT use `brew` to install `poetry`. -If you use `brew`, it's going to install directly to your system, which prevents you from being able to leverage `pyenv` to seamlessly switch between Python interpreters. - -```bash -# installation with pip: recommended option in tandem with pyenv -pip install poetry -``` - -```bash -# For UNIX systems - installation with curl -curl -sSL https://install.python-poetry.org/ | python - -``` - -After this installation command, add the `poetry` binary to the path in your shell config (if it's not done automatically). - ```bash -export PATH=$PATH:$HOME/.poetry/bin -``` - -## Installing external dependencies - -The `nibiru` project is defined by its `pyproject.toml`. At the root of the repo, simply call: - -```bash -poetry install -``` - -This will resolve dependencies between each of the project's packages and install them into a virtual environment. - -## Running tests - -#### Setting environment variables - -There's currently a "devnet" running in GCP that the CI workflows use. You can find these secrets at [this notion page](https://www.notion.so/nibiru/Resources-and-Repo-Configs-b31aa8074a2b419d80b0c946ed5efab0) if you have access to it or contact one of the `CODEOWNERS` (@Unique-Divine, @matthiasmatt, @nibiruheisenberg). -This is useful so that you can run every part of the package code without needing to visit other repositories. - -You'll need to set up a `.env` configuration file to set environment variables for the tests. - -#### Environment Variables - Local - - -```bash -# Example configuration for the Nibiry Python SDK -HOST="..." -VALIDATOR_MNEMONIC="..." -ORACLE_MNEMONIC="..." -TENDERMINT_RPC_ENDPOINT="http://...:26657" -LCD_ENDPOINT="http://...:1317" -GRPC_ENDPOINT="...:9090" -WEBSOCKET_ENDPOINT="ws://...:26657/websocket" -CHAIN_ID="..." -NETWORK_INSECURE=true -``` - -#### Environment variables in GitHub Actions - -The variables used in the CI build can be found in the `env` section of the [`pytests.yml` workflow](.github/workflows/pytests.yml): - -```yaml -jobs: - tests: - env: - # https://www.notion.so/nibiru/Resources-and-Repo-Configs-b31aa8074a2b419d80b0c946ed5efab0 - CHAIN_ID: ${{ secrets.CHAIN_ID }} - HOST: ${{ secrets.HOST }} - VALIDATOR_MNEMONIC: ${{ secrets.VALIDATOR_MNEMONIC }} - GRPC_PORT: ${{ secrets.GRPC_PORT }} - LCD_PORT: ${{ secrets.LCD_PORT }} -``` - -You'll need an `.env` configuration like this. - -#### Running the tests with `poetry` + `pytest` - -After following the instructions for setting up `poetry`, you can run the tests with `poetry run pytest`: - -```bash -poetry run pytest -p no:warnings # silences warnings - -poetry run pytest --slow -p no:warnings # to include slowly running tests -``` - -#### (option B). Install the `nibiru` package with `pip` - - ```bash - # from local - # build and install - pip install . - - # from local build - pip uninstall nibiru - pip install nibiru --no-index --find-links /path/to/nibiru/py-sdk/dist - - # from pypi - pip uninstall nibiru - pip install nibiru - ``` - -## Makefile and Protocol Buffers - -See the [NibiruChain/sdk-proto-gen repository](https://github.com/NibiruChain/sdk-proto-gen). - -After cloning `sdk-proto-gen` and the proto files for `nibiru`, you only need to run `make proto-gen`: - -```bash -git clone git@github.com:NibiruChain/sdk-proto-gen.git -git clone git@github.com:NibiruChain/nibiru.git -``` - -```bash -cd sdk-proto-gen -make proto-gen -``` - -If you get a permissions error such as - -``` -rm: cannot remove 'proto/proto/epochs/query.proto': Permission denied -``` - -call `sudo chown -R [USER-NAME] proto` using the name of user directory. -You can find the value for `[USER-NAME]` quickly by running `whoami`. In other words, this should work: - -```sh -sudo chown -R $(whoami) proto -``` - -You're done generating types once you've successfully called - -```sh -make proto-gen -poetry build # equivalently, you can run `python -m build` -``` - -## Linting - -Enable git hook which will perform linting before each commit: - -```shell -poetry run pre-commit install -``` - -This will keep your code clean. - -## Gotchas - -The `protobuf` package must be version 3.20.x or lower. Otherwise, the following error appears at runtime. - -``` -nibiru/clients/__init__.py:1: in - from nibiru.clients.dex import Dex # noqa -nibiru/clients/dex.py:8: in - from nibiru.proto.dex.v1 import query_pb2 as dex_type -nibiru/proto/dex/v1/query_pb2.py:16: in - from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -../../../anaconda3/envs/divine/lib/python3.9/site-packages/google/api/annotations_pb2.py:30: in - from google.api import http_pb2 as google_dot_api_dot_http__pb2 -../../../anaconda3/envs/divine/lib/python3.9/site-packages/google/api/http_pb2.py:48: in - _descriptor.FieldDescriptor( -../../../anaconda3/envs/divine/lib/python3.9/site-packages/google/protobuf/descriptor.py:560: in __new__ - _message.Message._CheckCalledFromGeneratedFile() -E TypeError: Descriptors cannot not be created directly. -E If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0. -E If you cannot immediately regenerate your protos, some other possible workarounds are: -E 1. Downgrade the protobuf package to 3.20.x or lower. -E 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower). -E -E More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates +python -m pip install --upgrade pip ``` -## Usage instructions for publishing. - -You specify updates to publish using the commit (or PR) title with `bump-[version-keyword]`. -For the `poetry version` command, ysing any bump rule with a valid semver string will change the version inside `pyproject.toml`. For example, - -``` -poetry version patch # moves from x.y.14 to x.y.15 -poetry version minor # moves from x.5.z to x.6.0 -poetry version major # moves from 3.y.z to 4.0.0 -``` -The list of bump rules includes: -patch, minor, major, prepatch, preminor, premajor, prerelease. +## Documentation Website -So the list of available keywords you an put in a PR includes -- `bump-patch`: -- `bump-patch`: 0.0.0 → 0.0.1 -- `bump-minor`: 0.0.* → 0.1.0 -- `bump-major`: 0.*.* → 1.0.0 -- `bump-prepatch`: 0.0.0 → 0.0.1-alpha0 -- `bump-prerelease`: equivalent to `bump-prepatch` -- `bump-preminor`: 0.0.* → 0.1.0-alpha0 -- `bump-premajor`: 0.*.* → 1.0.0-alpha0 +Documentation can be found here: [Nibiru-py documentation](https://nibiru-py.readthedocs.io/en/latest/index.html) -These guidelines are in the release.yml for future reference. +- Learn more about opening and managing your spot and perp positions [here](https://nibiru-py.readthedocs.io/en/latest/nibiru.sdks.tx.html#nibiru-sdks-tx-package) +- Learn about querying the chain using the Sdk [here](https://nibiru-py.readthedocs.io/en/latest/nibiru.clients.html#nibiru-clients-package) diff --git a/docgen.sh b/docgen.sh new file mode 100644 index 00000000..08e41d52 --- /dev/null +++ b/docgen.sh @@ -0,0 +1,4 @@ +poetry run pdoc nibiru -o=docs-md -f --skip-errors +mv docs-md/nibiru tmp +rm -rf docs-md +mv tmp docs-md diff --git a/docs-md/crypto/index.md b/docs-md/crypto/index.md new file mode 100644 index 00000000..6c435b84 --- /dev/null +++ b/docs-md/crypto/index.md @@ -0,0 +1,6 @@ +Module nibiru.crypto +==================== + +Sub-modules +----------- +* nibiru.crypto.ripemd160 diff --git a/docs-md/crypto/ripemd160.md b/docs-md/crypto/ripemd160.md new file mode 100644 index 00000000..c2ffe250 --- /dev/null +++ b/docs-md/crypto/ripemd160.md @@ -0,0 +1,96 @@ +Module nibiru.crypto.ripemd160 +============================== +Implementing SHA-256 from scratch was fun, but for RIPEMD160 I am +taking an existing implementation and made some cleanups and api changes. + +ripemd.py - pure Python implementation of the RIPEMD-160 algorithm. +Bjorn Edstrom 16 december 2007. + +Copyrights +========== + +This code is a derived from an implementation by Markus Friedl which is +subject to the following license. This Python implementation is not +subject to any other license. + +/* +* Copyright (c) 2001 Markus Friedl. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* 2. Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE, +* DATA, OR PROFITS OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/* +* Preneel, Bosselaers, Dobbertin, "The Cryptographic Hash Function RIPEMD-160", +* RSA Laboratories, CryptoBytes, Volume 3, Number 2, Autumn 1997, +* ftp://ftp.rsasecurity.com/pub/cryptobytes/crypto3n2.pdf +*/ + +Functions +--------- + + +`F0(x, y, z)` +: + + +`F1(x, y, z)` +: + + +`F2(x, y, z)` +: + + +`F3(x, y, z)` +: + + +`F4(x, y, z)` +: + + +`R(a, b, c, d, e, Fj, Kj, sj, rj, X)` +: + + +`RMD160Final(ctx)` +: + + +`RMD160Transform(state, block)` +: + + +`RMD160Update(ctx, inp, inplen)` +: + + +`ROL(n, x)` +: + + +`ripemd160(b: bytes) ‑> bytes` +: simple wrapper for a simpler API to this hash function, just bytes to bytes + +Classes +------- + +`RMDContext()` +: diff --git a/docs-md/event_specs.md b/docs-md/event_specs.md new file mode 100644 index 00000000..62359c6c --- /dev/null +++ b/docs-md/event_specs.md @@ -0,0 +1,69 @@ +Module nibiru.event_specs +========================= + +Classes +------- + +`EventCaptured(event_type: nibiru.event_specs.EventType, payload: dict)` +: EventCaptured(event_type: nibiru.event_specs.EventType, payload: dict) + + ### Class variables + + `event_type: nibiru.event_specs.EventType` + : + + `payload: dict` + : + +`EventType(value, names=None, *, module=None, qualname=None, type=None, start=1)` +: The events enum type shows the type of events available to parse from the nibiruwebsocket object. + + ### Ancestors (in MRO) + + * enum.Enum + + ### Class variables + + `Delegate` + : + + `FundingRateChangedEvent` + : + + `MarkPriceChanged` + : + + `OracleUpdatePriceEvent` + : + + `PairPriceUpdatedEvent` + : + + `PositionChangedEvent` + : + + `PositionLiquidatedEvent` + : + + `PositionSettledEvent` + : + + `Redelegate` + : + + `ReserveSnapshotSavedEvent` + : + + `SwapOnVpoolEvent` + : + + `Transfer` + : + + `Unbond` + : + + ### Methods + + `get_full_path(self)` + : diff --git a/docs-md/exceptions.md b/docs-md/exceptions.md new file mode 100644 index 00000000..3736f045 --- /dev/null +++ b/docs-md/exceptions.md @@ -0,0 +1,46 @@ +Module nibiru.exceptions +======================== + +Classes +------- + +`NibiruError(*args, **kwargs)` +: Common base class for all non-exit exceptions. + + ### Ancestors (in MRO) + + * builtins.Exception + * builtins.BaseException + + ### Descendants + + * nibiru.exceptions.QueryError + * nibiru.exceptions.SimulationError + * nibiru.exceptions.TxError + +`QueryError(*args, **kwargs)` +: Common base class for all non-exit exceptions. + + ### Ancestors (in MRO) + + * nibiru.exceptions.NibiruError + * builtins.Exception + * builtins.BaseException + +`SimulationError(*args, **kwargs)` +: Common base class for all non-exit exceptions. + + ### Ancestors (in MRO) + + * nibiru.exceptions.NibiruError + * builtins.Exception + * builtins.BaseException + +`TxError(*args, **kwargs)` +: Common base class for all non-exit exceptions. + + ### Ancestors (in MRO) + + * nibiru.exceptions.NibiruError + * builtins.Exception + * builtins.BaseException diff --git a/docs-md/grpc_client.md b/docs-md/grpc_client.md new file mode 100644 index 00000000..1298f794 --- /dev/null +++ b/docs-md/grpc_client.md @@ -0,0 +1,85 @@ +Module nibiru.grpc_client +========================= + +Classes +------- + +`GrpcClient(network: nibiru.network.Network, insecure=False, credentials: grpc.ChannelCredentials = None, bypass_version_check: bool = False)` +: _summary_ + + Args: + network (Network): The network object + insecure (bool, optional): Wether the network should use ssl or not. Defaults to False. + credentials (grpc.ChannelCredentials, optional): Ssl creds. Defaults to None. + bypass_version_check (bool, optional): Wether to bypass the check for correct version of the chain/py-sdk + + ### Methods + + `assert_compatible_versions(self, nibiru_proto_version, chain_nibiru_version)` + : Assert that this version of the python sdk is compatible with the chain. + If you run the chain from a non tagged release, the version query will be returning something like + master-6a315bab3db46f5fa1158199acc166ed2d192c2f. Otherwise, it should be for example `v0.14.0`. + + If the chain is running a custom non tagged release, you are free to use the python sdk at your own risk. + + `close_chain_channel(self)` + : + + `get_account(self, address: str) ‑> Optional[cosmos.auth.v1beta1.auth_pb2.BaseAccount]` + : + + `get_bank_balance(self, address: str, denom: str)` + : + + `get_bank_balances(self, address: str)` + : + + `get_block_by_height(self, height: int) ‑> cosmos.base.tendermint.v1beta1.query_pb2.GetBlockByHeightResponse` + : + + `get_blocks_by_height(self, start_height: int, end_height: int = None) ‑> Generator[cosmos.base.tendermint.v1beta1.query_pb2.GetBlockByHeightResponse, None, None]` + : Iterate through all the blocks in the chain and yield the output of the block one by one. + If no end_height is specified, iterate until the current latest block is reached. + + Args: + start_height (int): The starting block height + end_height (int, optional): The last block height to query. Defaults to None. + + Yields: + Generator[tendermint_query.GetBlockByHeightResponse, None, None] + + `get_chain_id(self) ‑> str` + : + + `get_grants(self, granter: str, grantee: str, **kwargs)` + : + + `get_latest_block(self) ‑> cosmos.base.tendermint.v1beta1.query_pb2.GetLatestBlockResponse` + : + + `get_latest_block_height(self) ‑> int` + : + + `get_request_id_by_tx_hash(self, tx_hash: bytes) ‑> List[int]` + : + + `get_version(self) ‑> cosmos.base.tendermint.v1beta1.query_pb2.GetLatestBlockResponse` + : + + `send_tx_async_mode(self, tx_byte: bytes) ‑> cosmos.base.abci.v1beta1.abci_pb2.TxResponse` + : + + `send_tx_block_mode(self, tx_byte: bytes) ‑> cosmos.base.abci.v1beta1.abci_pb2.TxResponse` + : + + `send_tx_sync_mode(self, tx_byte: bytes) ‑> cosmos.base.abci.v1beta1.abci_pb2.TxResponse` + : + + `simulate_tx(self, tx_byte: bytes) ‑> Tuple[Union[cosmos.base.abci.v1beta1.abci_pb2.SimulationResponse, grpc.RpcError], bool]` + : + + `sync_timeout_height(self)` + : + + `wait_for_next_block(self)` + : Wait for a block to be written diff --git a/docs-md/index.md b/docs-md/index.md new file mode 100644 index 00000000..41dc8b05 --- /dev/null +++ b/docs-md/index.md @@ -0,0 +1,19 @@ +Module nibiru +============= + +Sub-modules +----------- +* nibiru.crypto +* nibiru.event_specs +* nibiru.exceptions +* nibiru.grpc_client +* nibiru.msg +* nibiru.network +* nibiru.pytypes +* nibiru.query_clients +* nibiru.sdk +* nibiru.transaction +* nibiru.tx +* nibiru.utils +* nibiru.wallet +* nibiru.websocket diff --git a/docs-md/msg/bank.md b/docs-md/msg/bank.md new file mode 100644 index 00000000..09118bbc --- /dev/null +++ b/docs-md/msg/bank.md @@ -0,0 +1,97 @@ +Module nibiru.msg.bank +====================== + +Classes +------- + +`MsgDelegate(delegator_address: str, validator_address: str, amount: float)` +: Delegate tokens to a validator + + Attributes: + delegator_address: str + validator_address: str + amount: float + + ### Ancestors (in MRO) + + * nibiru.pytypes.common.PythonMsg + * abc.ABC + + ### Class variables + + `amount: float` + : + + `delegator_address: str` + : + + `validator_address: str` + : + +`MsgSend(from_address: str, to_address: str, coins: Union[nibiru.pytypes.common.Coin, List[nibiru.pytypes.common.Coin]])` +: Send tokens from one account to another + + Attributes: + from_address (str): The address of the sender + to_address (str): The address of the receiver + coins (List[Coin]): The list of coins to send + + ### Ancestors (in MRO) + + * nibiru.pytypes.common.PythonMsg + * abc.ABC + + ### Class variables + + `coins: Union[nibiru.pytypes.common.Coin, List[nibiru.pytypes.common.Coin]]` + : + + `from_address: str` + : + + `to_address: str` + : + +`MsgUndelegate(delegator_address: str, validator_address: str, amount: float)` +: Undelegate tokens from a validator + + Attributes: + delegator_address: str + validator_address: str + amount: float + + ### Ancestors (in MRO) + + * nibiru.pytypes.common.PythonMsg + * abc.ABC + + ### Class variables + + `amount: float` + : + + `delegator_address: str` + : + + `validator_address: str` + : + +`MsgWithdrawDelegatorReward(delegator_address: str, validator_address: str)` +: Withdraw the reward from a validator + + Attributes: + delegator_address: str + validator_address: str + + ### Ancestors (in MRO) + + * nibiru.pytypes.common.PythonMsg + * abc.ABC + + ### Class variables + + `delegator_address: str` + : + + `validator_address: str` + : diff --git a/docs-md/msg/dex.md b/docs-md/msg/dex.md new file mode 100644 index 00000000..9b6142c4 --- /dev/null +++ b/docs-md/msg/dex.md @@ -0,0 +1,132 @@ +Module nibiru.msg.dex +===================== + +Classes +------- + +`MsgCreatePool(creator: str, swap_fee: float, exit_fee: float, a: int, pool_type: , assets: List[nibiru.pytypes.common.PoolAsset])` +: Create a pool using the assets specified + + Attributes: + creator (str): The creator address + swap_fee (float): The swap fee required for the pool + exit_fee (float): The exit fee required for the pool + assets (List[PoolAsset]): The assets to compose the pool + + ### Ancestors (in MRO) + + * nibiru.pytypes.common.PythonMsg + * abc.ABC + + ### Class variables + + `a: int` + : + + `assets: List[nibiru.pytypes.common.PoolAsset]` + : + + `creator: str` + : + + `exit_fee: float` + : + + `pool_type: ` + : + + `swap_fee: float` + : + +`MsgExitPool(sender: str, pool_id: int, pool_shares: nibiru.pytypes.common.Coin)` +: Exit a pool using the specified pool shares + + Attributes: + sender (str): The creator address + pool_id (int): The id of the pool + pool_shares (Coin): The tokens as share of the pool to exit with + + ### Ancestors (in MRO) + + * nibiru.pytypes.common.PythonMsg + * abc.ABC + + ### Class variables + + `pool_id: int` + : + + `pool_shares: nibiru.pytypes.common.Coin` + : + + `sender: str` + : + +`MsgJoinPool(sender: str, pool_id: int, tokens: Union[nibiru.pytypes.common.Coin, List[nibiru.pytypes.common.Coin]])` +: Join a pool using the specified tokens + + Attributes: + sender (str): The creator address + pool_id (int): The id of the pool to join + tokens (List[Coin]): The tokens to be bonded in the pool + + ### Ancestors (in MRO) + + * nibiru.pytypes.common.PythonMsg + * abc.ABC + + ### Class variables + + `pool_id: int` + : + + `sender: str` + : + + `tokens: Union[nibiru.pytypes.common.Coin, List[nibiru.pytypes.common.Coin]]` + : + +`MsgSwapAssets(sender: str, pool_id: int, token_in: nibiru.pytypes.common.Coin, token_out_denom: str)` +: Swap the assets provided for the denom specified + + Attributes: + sender (str): The creator address + pool_id (int): The id of the pool + token_in (Coin): The token in we wish to swap with + token_out_denom (str): The token we expect out of the pool + + ### Ancestors (in MRO) + + * nibiru.pytypes.common.PythonMsg + * abc.ABC + + ### Class variables + + `pool_id: int` + : + + `sender: str` + : + + `token_in: nibiru.pytypes.common.Coin` + : + + `token_out_denom: str` + : + +`dex()` +: The dex class allows to create transactions for the decentralized spot exchange using the queries. + + ### Class variables + + `create_pool: nibiru.msg.dex.MsgCreatePool` + : + + `exit_pool: nibiru.msg.dex.MsgExitPool` + : + + `join_pool: nibiru.msg.dex.MsgJoinPool` + : + + `swap_assets: nibiru.msg.dex.MsgSwapAssets` + : diff --git a/docs-md/msg/index.md b/docs-md/msg/index.md new file mode 100644 index 00000000..ef9f5064 --- /dev/null +++ b/docs-md/msg/index.md @@ -0,0 +1,9 @@ +Module nibiru.msg +================= + +Sub-modules +----------- +* nibiru.msg.bank +* nibiru.msg.dex +* nibiru.msg.perp +* nibiru.msg.pricefeed diff --git a/docs-md/msg/perp.md b/docs-md/msg/perp.md new file mode 100644 index 00000000..8c4b9b99 --- /dev/null +++ b/docs-md/msg/perp.md @@ -0,0 +1,155 @@ +Module nibiru.msg.perp +====================== + +Classes +------- + +`MsgAddMargin(sender: str, token_pair: str, margin: nibiru.pytypes.common.Coin)` +: Add margin for the position (token_pair + trader) + + Attributes: + sender (str): The trader address + token_pair (str): The token pair + margin (Coin): The margin to remove in a coin format + + ### Ancestors (in MRO) + + * nibiru.pytypes.common.PythonMsg + * abc.ABC + + ### Class variables + + `margin: nibiru.pytypes.common.Coin` + : + + `sender: str` + : + + `token_pair: str` + : + +`MsgClosePosition(sender: str, token_pair: str)` +: Close the position. + + Attributes: + sender (str): The sender address + token_pair (str): The token pair + + ### Ancestors (in MRO) + + * nibiru.pytypes.common.PythonMsg + * abc.ABC + + ### Class variables + + `sender: str` + : + + `token_pair: str` + : + +`MsgLiquidate(sender: str, token_pair: str, trader: str)` +: Close the position. + + Attributes: + sender (str): The sender address + token_pair (str): The token pair + + ### Ancestors (in MRO) + + * nibiru.pytypes.common.PythonMsg + * abc.ABC + + ### Class variables + + `sender: str` + : + + `token_pair: str` + : + + `trader: str` + : + +`MsgOpenPosition(sender: str, token_pair: str, side: nibiru.pytypes.common.Side, quote_asset_amount: float, leverage: float, base_asset_amount_limit: float)` +: Open a posiiton using the specified parameters. + + Attributes: + sender (str): The sender address + token_pair (str): The token pair + side (Side): The side, either Side.BUY or Side.SELL + quote_asset_amount (float): The quote amount you want to use to buy base + leverage (float): The leverage you want to use, typically between 1 and 15, depending on the maintenance + margin ratio of the pool. + base_asset_amount_limit (float): The minimum amount of base you are willing to receive for this amount of + quote. + + ### Ancestors (in MRO) + + * nibiru.pytypes.common.PythonMsg + * abc.ABC + + ### Class variables + + `base_asset_amount_limit: float` + : + + `leverage: float` + : + + `quote_asset_amount: float` + : + + `sender: str` + : + + `side: nibiru.pytypes.common.Side` + : + + `token_pair: str` + : + +`MsgRemoveMargin(sender: str, token_pair: str, margin: nibiru.pytypes.common.Coin)` +: Remove margin for the position (token_pair + trader) + + Attributes: + sender (str): The trader address + token_pair (str): The token pair + margin (Coin): The margin to remove in a coin format + + ### Ancestors (in MRO) + + * nibiru.pytypes.common.PythonMsg + * abc.ABC + + ### Class variables + + `margin: nibiru.pytypes.common.Coin` + : + + `sender: str` + : + + `token_pair: str` + : + +`perp()` +: The perp class allows you to generate transaction for the perpetual futures module using the different messages + available. + + ### Class variables + + `add_margin: nibiru.msg.perp.MsgAddMargin` + : + + `close_position: nibiru.msg.perp.MsgClosePosition` + : + + `liquidate: nibiru.msg.perp.MsgLiquidate` + : + + `open_position: nibiru.msg.perp.MsgOpenPosition` + : + + `remove_margin: nibiru.msg.perp.MsgRemoveMargin` + : diff --git a/docs-md/msg/pricefeed.md b/docs-md/msg/pricefeed.md new file mode 100644 index 00000000..47227df4 --- /dev/null +++ b/docs-md/msg/pricefeed.md @@ -0,0 +1,35 @@ +Module nibiru.msg.pricefeed +=========================== + +Classes +------- + +`MsgPostPrice(oracle: str, token0: str, token1: str, price: float, expiry: datetime.datetime)` +: Attributes: + oracle (str): address of the msg sender + token0 (str): base asset denomination, e.g. ATOM + token1 (str): quote asset denomination, e.g. USD + price (float): price in units token1 / token0, e.g. price of ATOM in USD. + expiry (datetime): + + ### Ancestors (in MRO) + + * nibiru.pytypes.common.PythonMsg + * abc.ABC + + ### Class variables + + `expiry: datetime.datetime` + : + + `oracle: str` + : + + `price: float` + : + + `token0: str` + : + + `token1: str` + : diff --git a/docs-md/network.md b/docs-md/network.md new file mode 100644 index 00000000..ce0edadd --- /dev/null +++ b/docs-md/network.md @@ -0,0 +1,119 @@ +Module nibiru.network +===================== +The network class allows the user to defines the network the sdk interface should connect to. + +There are some default values set for devnet, testnet, mainet and localnet, but the user cna also define its own +network by setting the values of the Network data class. + +Classes +------- + +`Network(lcd_endpoint: str, grpc_endpoint: str, tendermint_rpc_endpoint: str, chain_id: str, websocket_endpoint: str, env: str = 'custom', fee_denom: str = 'unibi')` +: A representation of a Nibiru network based on its Tendermint RPC, gRPC, + and LCD (REST) endpoints. A 'Network' instance enables interactions with a + running blockchain. + + Attributes: + lcd_endpoint (str): . + grpc_endpoint (str): . + tendermint_rpc_endpoint (str): . + chain_id (str): . + websocket_endpoint (str): . + env (Optional[str]): TODO docs + fee_denom (Optional[str]): Denom for the coin used to pay gas fees. Defaults to "unibi". + + Methods: + customnet: A custom Nibiru network based on environment variables. + Defaults to localnet. + devnet: A development testnet environment that runs the latest release or + pre-release from the nibiru repo. Defaults to 'nibiru-devnet-1'. + localnet: The default local network created by running 'make localnet' in + the nibiru repo. + testnet: A stable testnet environment with public community members. + Think of this as out practice mainnet. Defaults to 'nibiru-testnet-1'. + mainnet: NotImplemented. + + Examples: + >>> from nibiru import Network + >>> network = Network.devnet(2) + >>> network.is_insecure + True + + ### Class variables + + `chain_id: str` + : + + `env: str` + : + + `fee_denom: str` + : + + `grpc_endpoint: str` + : + + `lcd_endpoint: str` + : + + `tendermint_rpc_endpoint: str` + : + + `websocket_endpoint: str` + : + + ### Static methods + + `customnet() ‑> nibiru.network.Network` + : Custom is the network configured from ENV variables. + Defaults to localnet if no ENV variables are provided. + + Raises: + KeyError: If the values are not set in the testing environment, this will raise an exception. + + Returns: + Network: The updated Network object. + + `devnet(chain_num: int = 2) ‑> nibiru.network.Network` + : Devnet is a network open to invited validators. + + Args: + chain_num (int): Devnet number + + Returns: + Network: The updated Network object. + + `localnet() ‑> nibiru.network.Network` + : Localnet is the network you would expect to connect to if you run `make localnet` from the nibiru repository. + It allows you to update locally the golang codebase to checkout the behavior of the chain with different changes + applied. + + Returns: + Network: The updated Network object. + + `mainnet() ‑> nibiru.network.Network` + : Soon! + + `testnet(chain_num: int = 1) ‑> nibiru.network.Network` + : Testnet is a network open to invited validators. It is more stable than + devnet and provides a faucet to get some funds + + Args: + chain_num (int): Testnet number + + Returns: + Network: The updated Network object. + + ### Instance variables + + `is_insecure: bool` + : + + ### Methods + + `string(self) ‑> str` + : Returns the current environment the network was initialized with. Will return `custom` if a custom network + was created + + Returns: + str: The name of the current environment. diff --git a/docs-md/pytypes/common.md b/docs-md/pytypes/common.md new file mode 100644 index 00000000..5460bbc1 --- /dev/null +++ b/docs-md/pytypes/common.md @@ -0,0 +1,145 @@ +Module nibiru.pytypes.common +============================ + +Classes +------- + +`Coin(amount: float, denom: str)` +: Coin(amount: float, denom: str) + + ### Class variables + + `amount: float` + : + + `denom: str` + : + +`Direction(value, names=None, *, module=None, qualname=None, type=None, start=1)` +: An enumeration. + + ### Ancestors (in MRO) + + * enum.Enum + + ### Class variables + + `ADD` + : + + `REMOVE` + : + +`PoolAsset(token: nibiru.pytypes.common.Coin, weight: float)` +: PoolAsset(token: nibiru.pytypes.common.Coin, weight: float) + + ### Class variables + + `token: nibiru.pytypes.common.Coin` + : + + `weight: float` + : + +`PythonMsg()` +: Helper class that provides a standard way to create an ABC using + inheritance. + + ### Ancestors (in MRO) + + * abc.ABC + + ### Descendants + + * nibiru.msg.bank.MsgDelegate + * nibiru.msg.bank.MsgSend + * nibiru.msg.bank.MsgUndelegate + * nibiru.msg.bank.MsgWithdrawDelegatorReward + * nibiru.msg.dex.MsgCreatePool + * nibiru.msg.dex.MsgExitPool + * nibiru.msg.dex.MsgJoinPool + * nibiru.msg.dex.MsgSwapAssets + * nibiru.msg.perp.MsgAddMargin + * nibiru.msg.perp.MsgClosePosition + * nibiru.msg.perp.MsgLiquidate + * nibiru.msg.perp.MsgOpenPosition + * nibiru.msg.perp.MsgRemoveMargin + * nibiru.msg.pricefeed.MsgPostPrice + + ### Methods + + `to_pb(self) ‑> google.protobuf.message.Message` + : Generate the protobuf message + + Returns: + Any: The protobuff mesage + +`Side(value, names=None, *, module=None, qualname=None, type=None, start=1)` +: An enumeration. + + ### Ancestors (in MRO) + + * enum.Enum + + ### Class variables + + `BUY` + : + + `SELL` + : + +`TxConfig(gas_wanted: int = 0, gas_multiplier: float = 1.25, gas_price: float = 0.25, tx_type: nibiru.pytypes.common.TxType = TxType.ASYNC)` +: The TxConfig object allows to customize the behavior of the Sdk interface when a transaction is sent. + + Args: + gas_wanted (int, optional): Set the absolute gas_wanted to be used. + Defaults to 0. + gas_multiplier (float, optional): Set the gas multiplier that's being + applied to the estimated gas. If gas_wanted is set, this property + is ignored. Defaults to 0. + gas_price (float, optional): Set the gas price used to calculate the fee. + Defaults to 0.25. + tx_type (TxType, optional): Configure how to execute the tx. Defaults to TxType.ASYNC. + + ### Class variables + + `gas_multiplier: float` + : + + `gas_price: float` + : + + `gas_wanted: int` + : + + `tx_type: nibiru.pytypes.common.TxType` + : + +`TxType(value, names=None, *, module=None, qualname=None, type=None, start=1)` +: The TxType allows you to chose what type of synchronization you want to use to send transaction + + ### Ancestors (in MRO) + + * enum.Enum + + ### Class variables + + `ASYNC` + : The CLI returns immediately (transaction might fail silently). + If you send a transaction with this option, it is recommended to query the transaction output using the hash of the + transaction given by the output of the tx call. + + `BLOCK` + : The tx function will wait unitl the tx is be committed in a block. + This have the effect of having the full log of the transaction available with the output of the method. These logs + will include information as to coin sent and received, states changed etc. + + `SYNC` + : The CLI waits for a CheckTx execution response only. + Each full-node that receives a transaction sends a CheckTx to the application layer to check for validity, and + receives an abci.ResponseCheckTx. If the Tx passes the checks, it is held in the nodes' Mempool , an in-memory pool + of transactions unique to each node pending inclusion in a block - honest nodes will discard Tx if it is found to + be invalid. + + Prior to consensus, nodes continuously check incoming transactions and gossip them to their peers. diff --git a/docs-md/pytypes/event.md b/docs-md/pytypes/event.md new file mode 100644 index 00000000..943f0913 --- /dev/null +++ b/docs-md/pytypes/event.md @@ -0,0 +1,111 @@ +Module nibiru.pytypes.event +=========================== + +Classes +------- + +`Event(raw_event: nibiru.pytypes.event.RawEvent)` +: A Tendermint event. An event contains a type and set of attributes. + Events allow application developers to attach additional information to the + 'ResponseBeginBlock', 'ResponseEndBlock', 'ResponseCheckTx', and 'ResponseDeliverTx' + functions in the ABCI (application blockchain interface). + + In the Tendermint protobuf, the hard definition is: + + ```proto + message Event { + string type = 1; + repeated EventAttribute attributes = 2; + } + message EventAttribute { + bytes key = 1; + bytes value = 2; + bool index = 3; + } + ``` + + - Ref: [cosmos-sdk/types/events.go](https://github.com/cosmos/cosmos-sdk/blob/93abfdd21d9892550da315b10308519b43fb1775/types/events.go#L221) + - Ref: [tendermint/tendermint/proto/tendermint/abci/types.proto](https://github.com/tendermint/tendermint/blob/a6dd0d270abc3c01f223eedee44d8b285ae273f6/proto/tendermint/abci/types.proto) + + ### Class variables + + `attrs: Dict[str, str]` + : + + `type: str` + : + + ### Static methods + + `parse_attributes(raw_attributes: List[Dict[str, str]]) ‑> Dict[str, str]` + : + + ### Methods + + `to_dict(self) ‑> Dict[str, Dict[str, str]]` + : + +`RawEvent()` +: Dictionary representing a Tendermint event. In the raw TxOutput of a + successful transaciton, it's the value at + + ```python + tx_output['rawLog'][0]['events'] + ``` + + ### Keys (KeyType): + - attributes (List[Dict[str,str]]) + - type (str) + + ### Example: + ```python + {'attributes': [ + {'key': 'recipient', 'value': 'nibi1uvu52rxwqj5ndmm59y6atvx33mru9xrz6sqekr'}, + {'key': 'sender', 'value': 'nibi1zaavvzxez0elundtn32qnk9lkm8kmcsz44g7xl'}, + {'key': 'amount', 'value': '7unibi,70unusd'}], + 'type': 'transfer'} + ``` + + ### Ancestors (in MRO) + + * collections.abc.MutableMapping + * collections.abc.Mapping + * collections.abc.Collection + * collections.abc.Sized + * collections.abc.Iterable + * collections.abc.Container + +`TxLogEvents(events_raw: List[nibiru.pytypes.event.RawEvent] = [])` +: An element of 'TxResp.rawLog'. This object contains events and messages. + + Keys (KeyType): + type (str) + attributes (List[EventAttribute]) + + Args: + events_raw (List[RawEvent]) + + Attributes: + events (List[Event]) + msgs (List[str]) + events_raw (List[RawEvent]) + event_types (List[str]) + + ### Class variables + + `event_types: List[str]` + : + + `events: List[nibiru.pytypes.event.Event]` + : + + `events_raw: List[nibiru.pytypes.event.RawEvent]` + : + + `msgs: List[str]` + : + + ### Methods + + `get_msg_types(self) ‑> List[str]` + : diff --git a/docs-md/pytypes/index.md b/docs-md/pytypes/index.md new file mode 100644 index 00000000..9ecef528 --- /dev/null +++ b/docs-md/pytypes/index.md @@ -0,0 +1,8 @@ +Module nibiru.pytypes +===================== + +Sub-modules +----------- +* nibiru.pytypes.common +* nibiru.pytypes.event +* nibiru.pytypes.tx_resp diff --git a/docs-md/pytypes/tx_resp.md b/docs-md/pytypes/tx_resp.md new file mode 100644 index 00000000..cea8bac1 --- /dev/null +++ b/docs-md/pytypes/tx_resp.md @@ -0,0 +1,87 @@ +Module nibiru.pytypes.tx_resp +============================= + +Classes +------- + +`RawTxResp(*args, **kwargs)` +: Proxy for a 'TypedDict' representing a transaction response. + - The 'TxResponse' type is defined in + [cosmos-sdk/types/abci.pb.go](https://github.com/cosmos/cosmos-sdk/blob/v0.45.10/types/abci.pb.go) + + ### Keys (ValueType): + + - height (str): block height at which the transaction was committed. + - txhash (str): unique identifier for the transaction + - data (str): Result bytes. + - rawLog (list): Raw output of the SDK application's logger. + Possibly non-deterministic. This output also contains the events emitted + during the processing of the transaction, which is equivalently + - logs (list): Typed output of the SDK application's logger. + Possibly non-deterministic. + - gasWanted (str): Amount of gas units requested for the transaction. + - gasUsed (str): Amount of gas units consumed by the transaction execution. + - events (list): Tendermint events emitted by processing the transaction. + The events in this attribute include those emitted by both from + the ante handler and the processing of all messages, whereas the + 'rawLog' events are only those emitted when processing messages (with + additional metadata). + + ### Ancestors (in MRO) + + * builtins.dict + +`TxResp(height: int, txhash: str, data: str, rawLog: List[nibiru.pytypes.event.TxLogEvents], logs: list, gasWanted: int, gasUsed: int, events: list, _raw: RawTxResp)` +: A 'TxResp' represents the response payload from a successful transaction. + + The 'TxResponse' type is defined in [cosmos-sdk/types/abci.pb.go](https://github.com/cosmos/cosmos-sdk/blob/v0.45.10/types/abci.pb.go) + + ### Args & Attributes: + + - height (int): block height at which the transaction was committed. + - txhash (str): unique identifier for the transaction + - data (str): Result bytes. + - rawLog (List[TxLogEvents]): Raw output of the SDK application's logger. + Possibly non-deterministic. This output also contains the events emitted + during the processing of the transaction, which is equivalently + - logs (list): Typed output of the SDK application's logger. + Possibly non-deterministic. + - gasWanted (str): Amount of gas units requested for the transaction. + - gasUsed (str): Amount of gas units consumed by the transaction execution. + - events (list): Tendermint events emitted by processing the transaction. + The events in this attribute include those emitted by both from + the ante handler and the processing of all messages, whereas the + 'rawLog' events are only those emitted when processing messages (with + additional metadata). + - _raw (RawTxResp): The unprocessed form of the transaction resposnse. + + ### Class variables + + `data: str` + : + + `events: list` + : + + `gasUsed: int` + : + + `gasWanted: int` + : + + `height: int` + : + + `logs: list` + : + + `rawLog: List[nibiru.pytypes.event.TxLogEvents]` + : + + `txhash: str` + : + + ### Static methods + + `from_raw(raw_tx_resp: RawTxResp) ‑> nibiru.pytypes.tx_resp.TxResp` + : diff --git a/docs-md/query_clients/auth.md b/docs-md/query_clients/auth.md new file mode 100644 index 00000000..01e594c6 --- /dev/null +++ b/docs-md/query_clients/auth.md @@ -0,0 +1,20 @@ +Module nibiru.query_clients.auth +================================ + +Classes +------- + +`AuthQueryClient(channel: grpc.Channel)` +: AuthQueryClient allows to query the endpoints made available by the Nibiru Chain's auth module. + + ### Ancestors (in MRO) + + * nibiru.query_clients.util.QueryClient + + ### Methods + + `account(self, address: str) ‑> dict` + : + + `accounts(self) ‑> dict` + : diff --git a/docs-md/query_clients/dex.md b/docs-md/query_clients/dex.md new file mode 100644 index 00000000..43dbb907 --- /dev/null +++ b/docs-md/query_clients/dex.md @@ -0,0 +1,227 @@ +Module nibiru.query_clients.dex +=============================== + +Classes +------- + +`DexQueryClient(channel: grpc.Channel)` +: Dex allows to query the endpoints made available by the Nibiru Chain's DEX module. + + ### Ancestors (in MRO) + + * nibiru.query_clients.util.QueryClient + + ### Methods + + `estimate_exit_exact_amount_in(self, pool_id: int, num_shares: int) ‑> dict` + : Estimate the output of an exit pool transaction with the current level of reserves + + Sample output:: + + { + "tokensOut": [ + { + "denom": "unibi", + "amount": 1000.5 + }, + { + "denom": "unusd", + "amount": 100.2 + } + ] + } + + Args: + pool_id (int): The id of the pool to query + num_shares (int): The number of shares to provide + + Returns: + dict: The output of the query + + `estimate_join_exact_amount_in(self, pool_id: int, tokens_ins: List[nibiru.pytypes.common.Coin]) ‑> dict` + : Estimate the number of share given for a join pool operation + + Sample output:: + + { + "poolSharesOut": 100000000000000.0, + "remCoins": [ + { + "denom": "unibi", + "amount": 0.999 + } + ] + } + + Args: + pool_id (int): The id of the pool to query + tokens_ins (List[Coin]): The amount of tokens provided + + Returns: + dict: The output of the query + + `estimate_swap_exact_amount_in(self, pool_id: int, token_in: nibiru.pytypes.common.Coin, token_out_denom: str) ‑> dict` + : Estimate the output of the swap with the current reserves + + Sample output:: + + { + "tokenOut": { + "denom": "unusd", + "amount": 0.004948999999999999 + } + } + + Args: + pool_id (int): The pool id to query + token_in (Coin): The amount of tokens to provide + token_out_denom (str): The denomination of the token out + + Returns: + dict: The output of the query + + `params(self) ‑> dict` + : Requests the parameters of the dex module. + + Sample output:: + + { + "startingPoolNumber": "1", + "poolCreationFee": [ + { + "denom": "unibi", + "amount": 1000.0 + } + ], + "whitelistedAsset": [ + "unibi", + "uusdc", + "unusd", + "stake" + ] + } + + Returns: + dict: The parameters fo the dex module. + + `pools(self, **kwargs)` + : Return all available pools in the dex module. + + Sample output:: + + [ + { + "id": "1", + "address": "nibi1w00c7pqkr5z7ptewg5z87j2ncvxd88w43ug679", + "poolParams": { + "swapFee": 0.02, + "exitFee": 0.1 + }, + "poolAssets": [ + { + "token": { + "denom": "unibi", + "amount": 0.001 + }, + "weight": "53687091200000000" + }, + { + "token": { + "denom": "unusd", + "amount": 0.01 + }, + "weight": "53687091200000000" + } + ], + "totalWeight": "107374182400000000", + "totalShares": { + "denom": "nibiru/pool/1", + "amount": 100000000000000.0 + } + } + ] + + + Args: + key (bytes): The page key for the next page. Only key or offset should be set + offset (int): The number of entries to skip. Only offset or key should be set + limit (int): The number of max results in the page + count_total (bool): Indicates if the response should contain the total number of results + reverse (bool): Indicates if the results should be returned in descending order + + Returns: + dict: The output of the query + + `spot_price(self, pool_id: int, token_in_denom: str, token_out_denom: str) ‑> dict` + : Returns the spot price of the pool using token in as base and token out as quote + + Args: + pool_id (int): _description_ + token_in_denom (str): _description_ + token_out_denom (str): _description_ + + Returns: + dict: _description_ + + `total_liquidity(self) ‑> dict` + : Returns the total amount of liquidity for the dex module + + Output sample:: + + { + "liquidity": [ + { + "denom": "unibi", + "amount": 0.001 + }, + { + "denom": "unusd", + "amount": 0.01 + } + ] + } + + Returns: + dict: The total liquidity of the protocol + + `total_pool_liquidity(self, pool_id: int) ‑> dict` + : Returns the total liquidity for a specific pool id + + Sample output:: + + { + "liquidity": [ + { + "denom": "unibi", + "amount": 0.001 + }, + { + "denom": "unusd", + "amount": 0.01 + } + ] + } + + Args: + pool_id (int): the id of the pool + + Returns: + dict: The total liquidity for the pool + + `total_shares(self, pool_id: int) ‑> dict` + : Returns the total amount of shares for the pool specified + + Sample output:: + + { + "totalShares": { + "denom": "nibiru/pool/1", + "amount": 100000000000000.0 + } + } + + Args: + pool_id (int): The id of the pool + + Returns: + dict: The amount of shares for the pool diff --git a/docs-md/query_clients/epoch.md b/docs-md/query_clients/epoch.md new file mode 100644 index 00000000..de2bfd7a --- /dev/null +++ b/docs-md/query_clients/epoch.md @@ -0,0 +1,21 @@ +Module nibiru.query_clients.epoch +================================= + +Classes +------- + +`EpochQueryClient(channel: grpc.Channel)` +: EpochQueryClient allows to query the endpoints made available by the Nibiru Chain's epoch module. + This module is used to time out certain events like for example funding rate payments. + + ### Ancestors (in MRO) + + * nibiru.query_clients.util.QueryClient + + ### Methods + + `current_epoch(self, epoch_identifier: str) ‑> dict` + : + + `epoch_infos(self) ‑> dict` + : diff --git a/docs-md/query_clients/index.md b/docs-md/query_clients/index.md new file mode 100644 index 00000000..a41a78dd --- /dev/null +++ b/docs-md/query_clients/index.md @@ -0,0 +1,13 @@ +Module nibiru.query_clients +=========================== + +Sub-modules +----------- +* nibiru.query_clients.auth +* nibiru.query_clients.dex +* nibiru.query_clients.epoch +* nibiru.query_clients.perp +* nibiru.query_clients.pricefeed +* nibiru.query_clients.staking +* nibiru.query_clients.util +* nibiru.query_clients.vpool diff --git a/docs-md/query_clients/perp.md b/docs-md/query_clients/perp.md new file mode 100644 index 00000000..e37edc52 --- /dev/null +++ b/docs-md/query_clients/perp.md @@ -0,0 +1,63 @@ +Module nibiru.query_clients.perp +================================ + +Classes +------- + +`PerpQueryClient(channel: grpc.Channel)` +: Perp allows to query the endpoints made available by the Nibiru Chain's PERP module. + + ### Ancestors (in MRO) + + * nibiru.query_clients.util.QueryClient + + ### Methods + + `params(self)` + : Get the parameters of the perp module. + + Output sample:: + + { + "feePoolFeeRatio": 0.001, + "ecosystemFundFeeRatio": 0.001, + "liquidationFeeRatio": 0.025, + "partialLiquidationRatio": 0.25, + "epochIdentifier": "30 min", + "twapLookbackWindow": "900s" + } + + Returns: + dict: The current parameters for the perpetual module + + `position(self, token_pair: str, trader: str) ‑> dict` + : Get the trader position. Returns information about position notional, margin ratio + unrealized pnl, size of the position etc. + + Args: + token_pair (str): The token pair + trader (str): The trader address + + Sample output:: + + { + "position": { + "traderAddress": "nibi1zaavvzxez0elund", + "pair": { + "token0": "ubtc", + "token1": "unusd" + }, + "size": 11.241446725317692, + "margin": 45999.99999999999, + "openNotional": 230000.0, + "lastUpdateCumulativePremiumFraction": "0", + "blockNumber": "278" + }, + "positionNotional": 230000.0, + "unrealizedPnl": 1.024e-20, + "marginRatioMark": 0.2, + "marginRatioIndex": 0.2 + } + + Returns: + dict: The output of the query diff --git a/docs-md/query_clients/pricefeed.md b/docs-md/query_clients/pricefeed.md new file mode 100644 index 00000000..e98e4109 --- /dev/null +++ b/docs-md/query_clients/pricefeed.md @@ -0,0 +1,32 @@ +Module nibiru.query_clients.pricefeed +===================================== + +Classes +------- + +`PricefeedQueryClient(channel: grpc.Channel)` +: Pricefeed allows to query the endpoints made available by the Nibiru Chain's Pricefeed module. + + ### Ancestors (in MRO) + + * nibiru.query_clients.util.QueryClient + + ### Methods + + `markets(self)` + : + + `oracles(self, pair_id: str)` + : + + `params(self)` + : + + `price(self, pair_id: str)` + : + + `prices(self)` + : + + `raw_prices(self, pair_id: str)` + : diff --git a/docs-md/query_clients/staking.md b/docs-md/query_clients/staking.md new file mode 100644 index 00000000..4097a56e --- /dev/null +++ b/docs-md/query_clients/staking.md @@ -0,0 +1,51 @@ +Module nibiru.query_clients.staking +=================================== + +Classes +------- + +`StakingQueryClient(channel: grpc.Channel)` +: StakingQueryClient allows to query the endpoints made available + by the Nibiru Chain's staking module. + + ### Ancestors (in MRO) + + * nibiru.query_clients.util.QueryClient + + ### Methods + + `delegation(self, delegator_addr: str, validator_addr: str) ‑> dict` + : Query a delegation based on address and validator address + + `delegations(self, delegator_addr: str, **kwargs) ‑> dict` + : Query all delegations made by one delegator + + `delegations_to(self, validator_addr: str, **kwargs) ‑> dict` + : Query all delegations made to one validator + + `historical_info(self, height: int) ‑> dict` + : Query historical info at given height + + `params(self) ‑> dict` + : Query the current staking parameters information + + `pool(self) ‑> dict` + : Query the current staking pool values + + `redelegations(self, delegator_addr: str, dst_validator_addr: str, **kwargs) ‑> dict` + : Query all redelegations records for one delegator + + `unbonding_delegation(self, delegator_addr: str, validator_addr: str) ‑> dict` + : Query an unbonding-delegation record based on delegator and validator address + + `unbonding_delegations(self, delegator_addr: str, **kwargs) ‑> dict` + : Query all unbonding-delegations records for one delegator + + `unbonding_delegations_from(self, validator_addr: str, **kwargs) ‑> dict` + : Query all unbonding delegations from a validator + + `validator(self, validator_addr: str) ‑> dict` + : Query a validator + + `validators(self, **kwargs) ‑> dict` + : Query for all validators diff --git a/docs-md/query_clients/util.md b/docs-md/query_clients/util.md new file mode 100644 index 00000000..693765a3 --- /dev/null +++ b/docs-md/query_clients/util.md @@ -0,0 +1,90 @@ +Module nibiru.query_clients.util +================================ + +Variables +--------- + + +`PROTOBUF_MSG_BASE_ATTRS: List[str]` +: PROTOBUF_MSG_BASE_ATTRS (List[str]): The default attributes and methods of + an instance of the 'protobuf.message.Message' class. + +Functions +--------- + + +`camel_to_snake(camel: str)` +: + + +`deserialize(pb_msg: google.protobuf.message.Message, no_sdk_transformation: bool = False) ‑> dict` +: Deserializes a proto message into a dictionary. + + - sdk.Dec values are converted to floats. + - sdk.Int values are converted to ints. + - Missing fields become blank strings. + + Args: + pb_msg (protobuf.message.Message) + no_sdk_transformation (bool): Wether to bypass the sdk transformation. Default to False + + Returns: + dict: 'pb_msg' as a JSON-able dictionary. + + +`deserialize_exp(proto_message: google.protobuf.message.Message) ‑> dict` +: Take a proto message and convert it into a dictionnary. + sdk.Dec values are converted to be consistent with txs. + + Args: + proto_message (protobuf.message.Message) + + Returns: + dict + + +`dict_keys_from_camel_to_snake(d)` +: Transform all keys from the dictionnary from camelcase to snake case. + + Args: + d (dict): The dictionary to transform + + Returns: + dict: The dictionary transformed + + +`get_block_messages(block: tendermint.types.block_pb2.Block) ‑> List[dict]` +: Rerurns block messages as a list of dicts. + Matches corresponding messages types by type_url. + + +`get_msg_pb_by_type_url(type_url: str) ‑> Optional[google.protobuf.message.Message]` +: Tries loading protobuf class by type url. + Examples type urls: + /cosmos.bank.v1beta1.MsgSend + /nibiru.perp.v1.MsgOpenPosition + + +`get_page_request(kwargs)` +: + +Classes +------- + +`QueryClient()` +: + + ### Descendants + + * nibiru.query_clients.auth.AuthQueryClient + * nibiru.query_clients.dex.DexQueryClient + * nibiru.query_clients.epoch.EpochQueryClient + * nibiru.query_clients.perp.PerpQueryClient + * nibiru.query_clients.pricefeed.PricefeedQueryClient + * nibiru.query_clients.staking.StakingQueryClient + * nibiru.query_clients.vpool.VpoolQueryClient + + ### Methods + + `query(self, api_callable: grpc.UnaryUnaryMultiCallable, req: google.protobuf.message.Message, should_deserialize: bool = True) ‑> Union[dict, google.protobuf.message.Message]` + : diff --git a/docs-md/query_clients/vpool.md b/docs-md/query_clients/vpool.md new file mode 100644 index 00000000..0e4fa59e --- /dev/null +++ b/docs-md/query_clients/vpool.md @@ -0,0 +1,30 @@ +Module nibiru.query_clients.vpool +================================= + +Functions +--------- + + +`cast_str_to_float_safely(number_str: str) ‑> float` +: + +Classes +------- + +`VpoolQueryClient(channel: grpc.Channel)` +: VPool allows to query the endpoints made available by the Nibiru Chain's VPOOL module. + + ### Ancestors (in MRO) + + * nibiru.query_clients.util.QueryClient + + ### Methods + + `all_pools(self)` + : + + `base_asset_price(self, pair: str, direction: nibiru.pytypes.common.Direction, base_asset_amount: str)` + : + + `reserve_assets(self, pair: str)` + : diff --git a/docs-md/sdk.md b/docs-md/sdk.md new file mode 100644 index 00000000..f4ba54dd --- /dev/null +++ b/docs-md/sdk.md @@ -0,0 +1,102 @@ +Module nibiru.sdk +================= +The sdk is the main interface to the chain. Each sdk object needs to be authorized with a wallet, which can be generated +with a new address if needed. + +Once instanciated, the sdk provide the sdk.tx and sdk.query modules to be able to query or send a transaction to the +chain. + +This object depends on the network and transaction configuration the users want. These objects can be set using the +Network and TxConfig classes respectively inside the nibiru/network.py and nibiru/pytypes files. + +Classes +------- + +`Sdk()` +: The Sdk class creates an interface to sign and send transactions or execute + queries from a node. + + It is associated to: + - a wallet, which can be either created or recovered from an existing mnemonic. + - a network, defining the node to connect to + - optionally a configuration defining how to behave and the gas configuration + for each transaction + + Each method starting with `with_` will replace the existing Sdk object with a new version having the defined + behavior. + + Attributes: + priv_key + query + tx + network + tx_config + + + Example :: + + ```python + sdk = ( + Sdk.authorize(val_mnemonic) + .with_config(tx_config) + .with_network(network, network_insecure) + ) + ``` + + Unsupported, please use from_mnemonic to initialize. + + ### Class variables + + `network: nibiru.network.Network` + : + + `query: nibiru.grpc_client.GrpcClient` + : + + `tx: nibiru.tx.BaseTxClient` + : + + `tx_config: nibiru.pytypes.common.TxConfig` + : + + ### Static methods + + `authorize(key: str = None) ‑> nibiru.sdk.Sdk` + : Authorize allows the user to generate or recover a wallet and register it as an Sdk object. + If a key is provided, the wallet will be recovered. Otherwise, a new wallet is created. + + Args: + key (str, optional): The mnemonic if recover needed. Defaults to None. + + Returns: + Sdk: The updated sdk object + + ### Instance variables + + `address: str` + : Returns the public address of the wallet. + + Returns: + str: The public address of the wallet + + ### Methods + + `with_config(self, config: nibiru.pytypes.common.TxConfig) ‑> nibiru.sdk.Sdk` + : Change the configuration for trasnactions for the sdk to the specified config. + + Args: + config (TxConfig): A transaction configuration object + + Returns: + Sdk: The updated sdk object + + `with_network(self, network: nibiru.network.Network, bypass_version_check: bool = False) ‑> nibiru.sdk.Sdk` + : Change the network of the sdk to the specified network. + + Args: + network (Network): A network object + insecure (bool, optional): Wether the connection should be insecure or not. Defaults to False. + bypass_version_check (bool, optional): Wether to bypass the check for correct version of the chain/py-sdk + + Returns: + Sdk: The updated sdk object diff --git a/docs-md/transaction.md b/docs-md/transaction.md new file mode 100644 index 00000000..b04581ea --- /dev/null +++ b/docs-md/transaction.md @@ -0,0 +1,49 @@ +Module nibiru.transaction +========================= + +Classes +------- + +`Transaction(msgs: Tuple[google.protobuf.message.Message, ...] = None, account_num: int = None, priv_key: nibiru.wallet.PrivateKey = None, sequence: int = None, chain_id: str = None, fee: List[cosmos.base.v1beta1.coin_pb2.Coin] = None, gas: int = 0, memo: str = '', timeout_height: int = 0)` +: + + ### Methods + + `get_sign_doc(self, public_key: nibiru.wallet.PublicKey = None) ‑> cosmos.tx.v1beta1.tx_pb2.SignDoc` + : + + `get_signed_tx_data(self) ‑> bytes` + : + + `get_tx_data(self, signature: bytes, public_key: nibiru.wallet.PublicKey = None) ‑> bytes` + : + + `with_account_num(self, account_num: int) ‑> nibiru.transaction.Transaction` + : + + `with_chain_id(self, chain_id: str) ‑> nibiru.transaction.Transaction` + : + + `with_fee(self, fee: List[cosmos.base.v1beta1.coin_pb2.Coin]) ‑> nibiru.transaction.Transaction` + : + + `with_gas(self, gas: numbers.Number) ‑> nibiru.transaction.Transaction` + : + + `with_memo(self, memo: str) ‑> nibiru.transaction.Transaction` + : + + `with_messages(self, msgs: Iterable[google.protobuf.message.Message]) ‑> nibiru.transaction.Transaction` + : + + `with_sender(self, client: nibiru.grpc_client.GrpcClient, sender: str) ‑> nibiru.transaction.Transaction` + : + + `with_sequence(self, sequence: int) ‑> nibiru.transaction.Transaction` + : + + `with_signer(self, priv_key: nibiru.wallet.PrivateKey)` + : + + `with_timeout_height(self, timeout_height: int) ‑> nibiru.transaction.Transaction` + : diff --git a/docs-md/tx.md b/docs-md/tx.md new file mode 100644 index 00000000..b775250f --- /dev/null +++ b/docs-md/tx.md @@ -0,0 +1,39 @@ +Module nibiru.tx +================ + +Classes +------- + +`BaseTxClient(priv_key: nibiru.wallet.PrivateKey, network: nibiru.network.Network, client: nibiru.grpc_client.GrpcClient, config: nibiru.pytypes.common.TxConfig)` +: + + ### Methods + + `execute_msgs(self, msgs: Union[nibiru.pytypes.common.PythonMsg, List[nibiru.pytypes.common.PythonMsg]], get_sequence_from_node: bool = False, **kwargs) ‑> nibiru.pytypes.tx_resp.RawTxResp` + : Execute a message to broadcast a transaction to the node. + Simulate the message to generate the gas estimate and send it to the node. + If the transaction fail because of account sequence mismatch, we try to send it + again once more with the sequence coming from a query to the lcd endpoint. + + Args: + get_sequence_from_node (bool, optional): Specifies whether the sequence + comes from the local value or the lcd endpoint. Defaults to False. + + Raises: + TxError: Raw error log from the blockchain if the response code is nonzero. + + Returns: + Union[RawTxResp, Dict[str, Any]]: The transaction response as a dict + in proto3 JSON format. + + `execute_tx(self, tx: nibiru.transaction.Transaction, gas_estimate: float, **kwargs) ‑> cosmos.base.abci.v1beta1.abci_pb2.TxResponse` + : + + `get_address_info(self)` + : + + `get_config(self, **kwargs)` + : Properties in kwargs overwrite config + + `simulate(self, tx: nibiru.transaction.Transaction)` + : diff --git a/docs-md/utils.md b/docs-md/utils.md new file mode 100644 index 00000000..0dacc7d1 --- /dev/null +++ b/docs-md/utils.md @@ -0,0 +1,252 @@ +Module nibiru.utils +=================== + +Functions +--------- + + +`clean_nested_dict(dictionary: Union[List[~T], Dict[~KT, ~VT], str]) ‑> Dict[~KT, ~VT]` +: Takes a nested dictionnary with some values being string json values and convert it into a proper nested + dictionary. + + Eg :: + + { + "transaction_fee": "{"denom":"unusd","amount":"0"}", + "funding_payment": "0.000000000000000000", + "realized_pnl": "0.000000000000000000", + "bad_debt": "{"denom":"unusd","amount":"0"}", + "trader_address": "nibi1zaavvzxez0elundtn32qnk9lkm8kmcsz44g7xl", + "margin": "{"denom":"unusd","amount":"10"}", + "exchanged_position_size": "0.004999999999999500", + "tx_hash": "12E496C996E39820B0807857CB7C19674BDD12DC8D789647D68C50BBB8C7D9CF" + } + + becomes :: + + { + "transaction_fee": { + "denom": "unusd", + "amount": "0" + }, + "funding_payment": "0.000000000000000000", + "realized_pnl": "0.000000000000000000", + "bad_debt": { + "denom": "unusd", + "amount": "0" + }, + "trader_address": "nibi1zaavvzxez0elundtn32qnk9lkm8kmcsz44g7xl", + "margin": { + "denom": "unusd", + "amount": "10" + }, + "exchanged_position_size": "0.004999999999999500", + "tx_hash": "12E496C996E39820B0807857CB7C19674BDD12DC8D789647D68C50BBB8C7D9CF" + } + + Args: + dictionary (Union[List, Dict, str]): The dictionary to be converted. + + Returns: + Dict: A converted dictionary. + + +`dict_keys_must_match(dict_: dict, keys: List[str])` +: Asserts that two iterables have the same elements, the same number of + times, without regard to order. + Alias for the 'element_counts_are_equal' function. + + dict_keys_must_match(dict_, keys) + + Example: + - [0, 1, 1] and [1, 0, 1] compare equal. + - [0, 0, 1] and [0, 1] compare unequal. + + +`element_counts_are_equal(first: Iterable[Any], second: Iterable[Any]) ‑> Optional[bool]` +: Asserts that two iterables have the same elements, the same number of + times, without regard to order. + + Args: + first (Iterable[Any]) + second (Iterable[Any]) + + Returns: + Optional[bool]: "passed" status. If this is True, first and second share + the same element counts. If they don't the function will raise an + AssertionError and return 'None'. + + +`format_fields_nested(object: Union[list, dict], fn: Callable[[Any], Any], fields: List[str]) ‑> Union[list, dict]` +: Format the fields inside a nested dictionary with the function provided + + Args: + object (Union[list, dict]): The object to format + fn (Callable[[Any], Any]): The function to format objects with + fields (list[str]): The fields to format + + Returns: + Union[list, dict]: The output formatted + + +`from_sdk_dec(dec_str: str) ‑> float` +: + + +`from_sdk_dec_24(dec_str: str) ‑> float` +: + + +`from_sdk_dec_n(dec_str: str, n: int = 6) ‑> float` +: + + +`from_sdk_int(int_str: str) ‑> int` +: + + +`init_logger(name: str) ‑> logging.Logger` +: Simple logger to use throughout the test suite. + + Examples: + ```python + from nibiru.utils import init_logger + LOGGER = init_logger("test-logger") + LOGGER.info("successfully executed tx staking command") + LOGGER.debug("debugging error message") + ``` + + Log levels include: [debug, info, warning, error, critical] + + Args: + name (str): Name of the logger + + Returns: + logging.Logger: The logger object + + +`toPbTimestamp(dt: datetime.datetime)` +: + + +`to_sdk_dec(dec: float) ‑> str` +: create a decimal from an input decimal. + valid must come in the form: + (-) whole integers (.) decimal integers + examples of acceptable input include: + -123.456 + 456.7890 + 345 + -456789 + + NOTE - An error will return if more decimal places + are provided in the string than the constant Precision. + + CONTRACT - This function does not mutate the input str. + + +`to_sdk_int(i: float) ‑> str` +: + +Classes +------- + +`ColoredFormatter(fmt=None, datefmt=None, style='%')` +: Formatter instances are used to convert a LogRecord to text. + + Formatters need to know how a LogRecord is constructed. They are + responsible for converting a LogRecord to (usually) a string which can + be interpreted by either a human or an external system. The base Formatter + allows a formatting string to be specified. If none is supplied, the + the style-dependent default value, "%(message)s", "{message}", or + "${message}", is used. + + The Formatter can be initialized with a format string which makes use of + knowledge of the LogRecord attributes - e.g. the default value mentioned + above makes use of the fact that the user's message and arguments are pre- + formatted into a LogRecord's message attribute. Currently, the useful + attributes in a LogRecord are described by: + + %(name)s Name of the logger (logging channel) + %(levelno)s Numeric logging level for the message (DEBUG, INFO, + WARNING, ERROR, CRITICAL) + %(levelname)s Text logging level for the message ("DEBUG", "INFO", + "WARNING", "ERROR", "CRITICAL") + %(pathname)s Full pathname of the source file where the logging + call was issued (if available) + %(filename)s Filename portion of pathname + %(module)s Module (name portion of filename) + %(lineno)d Source line number where the logging call was issued + (if available) + %(funcName)s Function name + %(created)f Time when the LogRecord was created (time.time() + return value) + %(asctime)s Textual time when the LogRecord was created + %(msecs)d Millisecond portion of the creation time + %(relativeCreated)d Time in milliseconds when the LogRecord was created, + relative to the time the logging module was loaded + (typically at application startup time) + %(thread)d Thread ID (if available) + %(threadName)s Thread name (if available) + %(process)d Process ID (if available) + %(message)s The result of record.getMessage(), computed just as + the record is emitted + + Initialize the formatter with specified format strings. + + Initialize the formatter either with the specified format string, or a + default as described above. Allow for specialized date formatting with + the optional datefmt argument. If datefmt is omitted, you get an + ISO8601-like (or RFC 3339-like) format. + + Use a style parameter of '%', '{' or '$' to specify that you want to + use one of %-formatting, :meth:`str.format` (``{}``) formatting or + :class:`string.Template` formatting in your format string. + + .. versionchanged:: 3.2 + Added the ``style`` parameter. + + ### Ancestors (in MRO) + + * logging.Formatter + + ### Class variables + + `FORMATS` + : + + `bold_red` + : + + `cyan` + : + + `fmt` + : + + `green` + : + + `grey` + : + + `red` + : + + `reset` + : + + `white` + : + + `yellow` + : + + ### Methods + + `format(self, record: logging.LogRecord)` + : Formats a record for the logging handler. + + Args: + record (logging.LogRecord): Represents an instance of an event being + logged. diff --git a/docs-md/wallet.md b/docs-md/wallet.md new file mode 100644 index 00000000..a5a157ae --- /dev/null +++ b/docs-md/wallet.md @@ -0,0 +1,164 @@ +Module nibiru.wallet +==================== + +Classes +------- + +`Address(addr: bytes)` +: + + ### Static methods + + `from_acc_bech32(bech: str) ‑> nibiru.wallet.Address` + : Create an address instance from a bech32-encoded account address + + `from_cons_bech32(bech: str) ‑> nibiru.wallet.Address` + : Create an address instance from a bech32-encoded consensus address + + `from_val_bech32(bech: str) ‑> nibiru.wallet.Address` + : Create an address instance from a bech32-encoded validator address + + ### Methods + + `decrease_sequence(self)` + : If a tx failed the sequence should not increase + + `get_number(self)` + : + + `get_sequence(self, from_node=False, lcd_endpoint: str = None) ‑> int` + : Get the sequence number from the module. If from node is set to true, update our local indice with a query to + the node. + + Args: + from_node (bool, optional): Wether to query or not from the node. Defaults to False. + lcd_endpoint (str, optional): The lcd endoint, needed for when from_node is set to true. Defaults to None. + + Returns: + int: the current sequence number + + `get_subaccount_id(self, index: int) ‑> str` + : Return a hex representation of address + + `init_num_seq(self, lcd_endpoint: str) ‑> nibiru.wallet.Address` + : + + `to_acc_bech32(self) ‑> str` + : Return a bech32-encoded account address + + `to_cons_bech32(self) ‑> str` + : Return a bech32-encoded with consensus address + + `to_hex(self) ‑> str` + : Return a hex representation of address + + `to_val_bech32(self) ‑> str` + : Return a bech32-encoded validator address + +`PrivateKey()` +: Class for wrapping SigningKey that is used for signature creation and public key derivation. + + :ivar signing_key: the ecdsa SigningKey instance + :vartype signing_key: ecdsa.SigningKey + + Unsupported, please use from_mnemonic to initialize. + + ### Static methods + + `from_hex(priv: str) ‑> nibiru.wallet.PrivateKey` + : + + `from_mnemonic(words: str, path="m/44'/118'/0'/0/0") ‑> nibiru.wallet.PrivateKey` + : Create a PrivateKey instance from a given mnemonic phrase and a HD derivation path. + If path is not given, default to Band's HD prefix 494 and all other indexes being zeroes. + + :param words: the mnemonic phrase for recover private key + :param path: the HD path that follows the BIP32 standard + + :return: Initialized PrivateKey object + + `generate(path="m/44'/118'/0'/0/0") ‑> Tuple[str, nibiru.wallet.PrivateKey]` + : Generate new private key with random mnemonic phrase + + :param path: the HD path that follows the BIP32 standard + + :return: A tuple of mnemonic phrase and PrivateKey instance + + ### Methods + + `sign(self, msg: bytes) ‑> bytes` + : Sign the given message using the edcsa sign_deterministic function. + + :param msg: the message that will be hashed and signed + + :return: a signature of this private key over the given message + + `to_hex(self) ‑> str` + : Return a hex representation of signing key. + + `to_public_key(self) ‑> nibiru.wallet.PublicKey` + : Return the PublicKey associated with this private key. + + :return: a PublicKey that can be used to verify the signatures made with this PrivateKey + +`PubKeyProto(*args, **kwargs)` +: A ProtocolMessage + + ### Ancestors (in MRO) + + * google._upb._message.Message + * google.protobuf.message.Message + + ### Class variables + + `DESCRIPTOR` + : + +`PublicKey()` +: Class for wrapping VerifyKey using for signature verification. Adding method to encode/decode + to Bech32 format. + + :ivar verify_key: the ecdsa VerifyingKey instance + :vartype verify_key: ecdsa.VerifyingKey + + Unsupported, please do not construct it directly. + + ### Static methods + + `from_acc_bech32(bech: str) ‑> nibiru.wallet.PublicKey` + : + + `from_cons_bech32(bech: str) ‑> nibiru.wallet.PublicKey` + : + + `from_val_bech32(bech: str) ‑> nibiru.wallet.PublicKey` + : + + ### Methods + + `to_acc_bech32(self) ‑> str` + : Return bech32-encoded with account public key prefix + + `to_address(self) ‑> nibiru.wallet.Address` + : Return address instance from this public key + + `to_cons_bech32(self) ‑> str` + : Return bech32-encoded with validator consensus public key prefix + + `to_hex(self) ‑> str` + : Return a hex representation of verified key. + + `to_public_key_proto(self) ‑> cosmos.crypto.secp256k1.keys_pb2.PubKey` + : + + `to_val_bech32(self) ‑> str` + : Return bech32-encoded with validator public key prefix + + `verify(self, msg: bytes, sig: bytes) ‑> bool` + : Verify a signature made from the given message. + + :param msg: data signed by the `signature`, will be hashed using sha256 function + :param sig: encoding of the signature + + :raises BadSignatureError: if the signature is invalid or malformed + :return: True if the verification was successful diff --git a/docs-md/websocket.md b/docs-md/websocket.md new file mode 100644 index 00000000..6f2f156f --- /dev/null +++ b/docs-md/websocket.md @@ -0,0 +1,25 @@ +Module nibiru.websocket +======================= + +Classes +------- + +`NibiruWebsocket(network: nibiru.network.Network, captured_events_type: List[nibiru.event_specs.EventType] = [], tx_fail_queue: > = None)` +: The nibiru listener provides an interface to easily connect and handle subscription to the events of a nibiru + chain. + + ### Class variables + + `captured_events_type: List[List[str]]` + : + + `queue: >` + : + + `tx_fail_queue: >` + : + + ### Methods + + `start(self)` + : Start the websocket and fill the queue with events. diff --git a/poetry.lock b/poetry.lock index 652952d2..1dccaaf7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -417,7 +417,7 @@ ecdsa = ">=0.14.0" [[package]] name = "identify" -version = "2.5.9" +version = "2.5.10" description = "File identification library for Python" category = "main" optional = false @@ -459,6 +459,45 @@ category = "main" optional = false python-versions = "*" +[[package]] +name = "mako" +version = "1.2.4" +description = "A super-fast templating language that borrows the best ideas from the existing templating languages." +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} +MarkupSafe = ">=0.9.2" + +[package.extras] +babel = ["Babel"] +lingua = ["lingua"] +testing = ["pytest"] + +[[package]] +name = "markdown" +version = "3.4.1" +description = "Python implementation of Markdown." +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +importlib-metadata = {version = ">=4.4", markers = "python_version < \"3.10\""} + +[package.extras] +testing = ["coverage", "pyyaml"] + +[[package]] +name = "markupsafe" +version = "2.1.1" +description = "Safely add untrusted strings to HTML/XML markup." +category = "dev" +optional = false +python-versions = ">=3.7" + [[package]] name = "mnemonic" version = "0.20" @@ -542,6 +581,18 @@ category = "dev" optional = false python-versions = ">=3.7" +[[package]] +name = "pdoc3" +version = "0.10.0" +description = "Auto-generate API documentation for Python projects." +category = "dev" +optional = false +python-versions = ">= 3.6" + +[package.dependencies] +mako = "*" +markdown = ">=3.0" + [[package]] name = "platformdirs" version = "2.6.0" @@ -904,7 +955,7 @@ testing = ["flake8 (<5)", "func-timeout", "jaraco.functools", "jaraco.itertools" [metadata] lock-version = "1.1" python-versions = "^3.7" -content-hash = "f58394138356f39f2415f87eabebb8daa5e97adc78f5c1b86b13aefe18a2bf72" +content-hash = "f4dfda69574bfed032d5e687d82fe5f475cc8ba46c29d5711bfea351817aac7e" [metadata.files] aiocron = [ @@ -1500,8 +1551,8 @@ hdwallets = [ {file = "hdwallets-0.1.2.tar.gz", hash = "sha256:c85d08b59c3fd3bc5b29398583d7d7dc46f95456f69ff15a3ab0353084ee7529"}, ] identify = [ - {file = "identify-2.5.9-py2.py3-none-any.whl", hash = "sha256:a390fb696e164dbddb047a0db26e57972ae52fbd037ae68797e5ae2f4492485d"}, - {file = "identify-2.5.9.tar.gz", hash = "sha256:906036344ca769539610436e40a684e170c3648b552194980bb7b617a8daeb9f"}, + {file = "identify-2.5.10-py2.py3-none-any.whl", hash = "sha256:fb7c2feaeca6976a3ffa31ec3236a6911fbc51aec9acc111de2aed99f244ade2"}, + {file = "identify-2.5.10.tar.gz", hash = "sha256:dce9e31fee7dbc45fea36a9e855c316b8fbf807e65a862f160840bb5a2bf5dfd"}, ] idna = [ {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, @@ -1515,6 +1566,56 @@ iniconfig = [ {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, ] +mako = [ + {file = "Mako-1.2.4-py3-none-any.whl", hash = "sha256:c97c79c018b9165ac9922ae4f32da095ffd3c4e6872b45eded42926deea46818"}, + {file = "Mako-1.2.4.tar.gz", hash = "sha256:d60a3903dc3bb01a18ad6a89cdbe2e4eadc69c0bc8ef1e3773ba53d44c3f7a34"}, +] +markdown = [ + {file = "Markdown-3.4.1-py3-none-any.whl", hash = "sha256:08fb8465cffd03d10b9dd34a5c3fea908e20391a2a90b88d66362cb05beed186"}, + {file = "Markdown-3.4.1.tar.gz", hash = "sha256:3b809086bb6efad416156e00a0da66fe47618a5d6918dd688f53f40c8e4cfeff"}, +] +markupsafe = [ + {file = "MarkupSafe-2.1.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:86b1f75c4e7c2ac2ccdaec2b9022845dbb81880ca318bb7a0a01fbf7813e3812"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:f121a1420d4e173a5d96e47e9a0c0dcff965afdf1626d28de1460815f7c4ee7a"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a49907dd8420c5685cfa064a1335b6754b74541bbb3706c259c02ed65b644b3e"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:10c1bfff05d95783da83491be968e8fe789263689c02724e0c691933c52994f5"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b7bd98b796e2b6553da7225aeb61f447f80a1ca64f41d83612e6139ca5213aa4"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:b09bf97215625a311f669476f44b8b318b075847b49316d3e28c08e41a7a573f"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:694deca8d702d5db21ec83983ce0bb4b26a578e71fbdbd4fdcd387daa90e4d5e"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:efc1913fd2ca4f334418481c7e595c00aad186563bbc1ec76067848c7ca0a933"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-win32.whl", hash = "sha256:4a33dea2b688b3190ee12bd7cfa29d39c9ed176bda40bfa11099a3ce5d3a7ac6"}, + {file = "MarkupSafe-2.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:dda30ba7e87fbbb7eab1ec9f58678558fd9a6b8b853530e176eabd064da81417"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:671cd1187ed5e62818414afe79ed29da836dde67166a9fac6d435873c44fdd02"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3799351e2336dc91ea70b034983ee71cf2f9533cdff7c14c90ea126bfd95d65a"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e72591e9ecd94d7feb70c1cbd7be7b3ebea3f548870aa91e2732960fa4d57a37"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6fbf47b5d3728c6aea2abb0589b5d30459e369baa772e0f37a0320185e87c980"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:d5ee4f386140395a2c818d149221149c54849dfcfcb9f1debfe07a8b8bd63f9a"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:bcb3ed405ed3222f9904899563d6fc492ff75cce56cba05e32eff40e6acbeaa3"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:e1c0b87e09fa55a220f058d1d49d3fb8df88fbfab58558f1198e08c1e1de842a"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-win32.whl", hash = "sha256:8dc1c72a69aa7e082593c4a203dcf94ddb74bb5c8a731e4e1eb68d031e8498ff"}, + {file = "MarkupSafe-2.1.1-cp37-cp37m-win_amd64.whl", hash = "sha256:97a68e6ada378df82bc9f16b800ab77cbf4b2fada0081794318520138c088e4a"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e8c843bbcda3a2f1e3c2ab25913c80a3c5376cd00c6e8c4a86a89a28c8dc5452"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0212a68688482dc52b2d45013df70d169f542b7394fc744c02a57374a4207003"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8e576a51ad59e4bfaac456023a78f6b5e6e7651dcd383bcc3e18d06f9b55d6d1"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4b9fe39a2ccc108a4accc2676e77da025ce383c108593d65cc909add5c3bd601"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:96e37a3dc86e80bf81758c152fe66dbf60ed5eca3d26305edf01892257049925"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:6d0072fea50feec76a4c418096652f2c3238eaa014b2f94aeb1d56a66b41403f"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:089cf3dbf0cd6c100f02945abeb18484bd1ee57a079aefd52cffd17fba910b88"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:6a074d34ee7a5ce3effbc526b7083ec9731bb3cbf921bbe1d3005d4d2bdb3a63"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-win32.whl", hash = "sha256:421be9fbf0ffe9ffd7a378aafebbf6f4602d564d34be190fc19a193232fd12b1"}, + {file = "MarkupSafe-2.1.1-cp38-cp38-win_amd64.whl", hash = "sha256:fc7b548b17d238737688817ab67deebb30e8073c95749d55538ed473130ec0c7"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:e04e26803c9c3851c931eac40c695602c6295b8d432cbe78609649ad9bd2da8a"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b87db4360013327109564f0e591bd2a3b318547bcef31b468a92ee504d07ae4f"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:99a2a507ed3ac881b975a2976d59f38c19386d128e7a9a18b7df6fff1fd4c1d6"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:56442863ed2b06d19c37f94d999035e15ee982988920e12a5b4ba29b62ad1f77"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3ce11ee3f23f79dbd06fb3d63e2f6af7b12db1d46932fe7bd8afa259a5996603"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:33b74d289bd2f5e527beadcaa3f401e0df0a89927c1559c8566c066fa4248ab7"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:43093fb83d8343aac0b1baa75516da6092f58f41200907ef92448ecab8825135"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:8e3dcf21f367459434c18e71b2a9532d96547aef8a871872a5bd69a715c15f96"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-win32.whl", hash = "sha256:d4306c36ca495956b6d568d276ac11fdd9c30a36f1b6eb928070dc5360b22e1c"}, + {file = "MarkupSafe-2.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:46d00d6cfecdde84d40e572d63735ef81423ad31184100411e6e3388d405e247"}, + {file = "MarkupSafe-2.1.1.tar.gz", hash = "sha256:7f91197cc9e48f989d12e4e6fbc46495c446636dfc81b9ccf50bb0ec74b91d4b"}, +] mnemonic = [ {file = "mnemonic-0.20-py3-none-any.whl", hash = "sha256:acd2168872d0379e7a10873bb3e12bf6c91b35de758135c4fbd1015ef18fafc5"}, {file = "mnemonic-0.20.tar.gz", hash = "sha256:7c6fb5639d779388027a77944680aee4870f0fcd09b1e42a5525ee2ce4c625f6"}, @@ -1619,6 +1720,10 @@ pathspec = [ {file = "pathspec-0.10.3-py3-none-any.whl", hash = "sha256:3c95343af8b756205e2aba76e843ba9520a24dd84f68c22b9f93251507509dd6"}, {file = "pathspec-0.10.3.tar.gz", hash = "sha256:56200de4077d9d0791465aa9095a01d421861e405b5096955051deefd697d6f6"}, ] +pdoc3 = [ + {file = "pdoc3-0.10.0-py3-none-any.whl", hash = "sha256:ba45d1ada1bd987427d2bf5cdec30b2631a3ff5fb01f6d0e77648a572ce6028b"}, + {file = "pdoc3-0.10.0.tar.gz", hash = "sha256:5f22e7bcb969006738e1aa4219c75a32f34c2d62d46dc9d2fb2d3e0b0287e4b7"}, +] platformdirs = [ {file = "platformdirs-2.6.0-py3-none-any.whl", hash = "sha256:1a89a12377800c81983db6be069ec068eee989748799b946cce2a6e80dcc54ca"}, {file = "platformdirs-2.6.0.tar.gz", hash = "sha256:b46ffafa316e6b83b47489d240ce17173f123a9b9c83282141c3daf26ad9ac2e"}, diff --git a/pyproject.toml b/pyproject.toml index 8ee2dd67..37e4ade8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,6 +49,7 @@ black = "^22.10.0" [tool.poetry.group.dev.dependencies] pytest-order = "^1.0.1" +pdoc3 = "^0.10.0" [tool.black] line-length = 88