Metadata-Version: 2.1
Name: pantos-common
Version: 2.1.2
Summary: Common code for Pantos off-chain components.
Home-page: https://pantos.io
License: GPL-3.0-only
Author: Pantos GmbH
Author-email: contact@pantos.io
Requires-Python: >=3.10,<4.0
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: celery (==5.3.1) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: cerberus (==1.3.4) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: flask-restful (==0.3.10) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: json-log-formatter (==0.5.2) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: pyyaml (==6.0.1) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: requests (==2.32.3) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: web3 (==6.5.0) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: pyaml-env (==1.2.1) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: python-dotenv (==1.0.1) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: pycryptodome (==3.20.0) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: hexbytes (==1.2.1) ; python_version >= "3.10" and python_version < "4"
Requires-Dist: semantic-version (==2.10.0) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: eth-account (==0.13.0) ; python_version >= "3.10" and python_version < "4"
Requires-Dist: billiard (==4.2.0) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: click (==8.1.7) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: click-didyoumean (==0.3.1) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: click-plugins (==1.1.1) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: click-repl (==0.3.0) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: kombu (==5.3.7) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: python-dateutil (==2.9.0.post0) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: tzdata (==2024.1) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: vine (==5.1.0) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: setuptools (==70.3.0) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: aniso8601 (==9.0.1) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: flask (==3.0.3) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: pytz (==2024.1) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: six (==1.16.0) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: certifi (==2024.7.4) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: charset-normalizer (==3.3.2) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: idna (==3.7) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: urllib3 (==2.2.2) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: aiohttp (==3.9.5) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: eth-abi (==5.1.0) ; python_version >= "3.10" and python_version < "4"
Requires-Dist: eth-hash (==0.7.0) ; python_version >= "3.10" and python_version < "4"
Requires-Dist: eth-typing (==3.5.2) ; python_version >= "3.10" and python_version < "4"
Requires-Dist: eth-utils (==2.3.1) ; python_version >= "3.10" and python_version < "4"
Requires-Dist: jsonschema (==4.23.0) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: lru-dict (==1.3.0) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: protobuf (==5.27.2) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: pywin32 (==306) ; python_version >= "3.10" and python_version < "4.0" and platform_system == "Windows"
Requires-Dist: websockets (==12.0) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: bitarray (==2.9.2) ; python_version >= "3.10" and python_version < "4"
Requires-Dist: ckzg (==1.0.2) ; python_version >= "3.10" and python_version < "4"
Requires-Dist: eth-keyfile (==0.8.1) ; python_version >= "3.10" and python_version < "4"
Requires-Dist: eth-keys (==0.4.0) ; python_version >= "3.10" and python_version < "4"
Requires-Dist: eth-rlp (==2.1.0) ; python_version >= "3.10" and python_version < "4"
Requires-Dist: pydantic (==2.8.2) ; python_version >= "3.10" and python_version < "4"
Requires-Dist: rlp (==3.0.0) ; python_version >= "3.10" and python_version < "4"
Requires-Dist: colorama (==0.4.6) ; python_version >= "3.10" and python_version < "4.0" and platform_system == "Windows"
Requires-Dist: prompt-toolkit (==3.0.47) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: amqp (==5.2.0) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: blinker (==1.8.2) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: itsdangerous (==2.2.0) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: jinja2 (==3.1.4) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: werkzeug (==3.0.3) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: aiosignal (==1.3.1) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: async-timeout (==4.0.3) ; python_version >= "3.10" and python_version < "3.11"
Requires-Dist: attrs (==23.2.0) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: frozenlist (==1.4.1) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: multidict (==6.0.5) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: yarl (==1.9.4) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: parsimonious (==0.10.0) ; python_version >= "3.10" and python_version < "4"
Requires-Dist: typing-extensions (==4.12.2) ; python_version >= "3.10" and python_version < "4"
Requires-Dist: cytoolz (==0.12.3) ; python_version >= "3.10" and python_version < "4" and implementation_name == "cpython"
Requires-Dist: toolz (==0.12.1) ; python_version >= "3.10" and python_version < "4" and (implementation_name == "pypy" or implementation_name == "cpython")
Requires-Dist: jsonschema-specifications (==2023.12.1) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: referencing (==0.35.1) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: rpds-py (==0.19.0) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: annotated-types (==0.7.0) ; python_version >= "3.10" and python_version < "4"
Requires-Dist: pydantic-core (==2.20.1) ; python_version >= "3.10" and python_version < "4"
Requires-Dist: wcwidth (==0.2.13) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: markupsafe (==2.1.5) ; python_version >= "3.10" and python_version < "4.0"
Requires-Dist: regex (==2024.5.15) ; python_version >= "3.10" and python_version < "4"
Project-URL: Repository, https://github.com/pantos-io/common
Description-Content-Type: text/markdown

<img src="https://raw.githubusercontent.com/pantos-io/common/img/pantos-logo-full.svg" alt="Pantos logo" align="right" width="120" />

[![CI](https://github.com/pantos-io/common/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/pantos-io/common/actions/workflows/ci.yaml) 
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=pantos-io_common&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=pantos-io_common)

# Common code for Pantos off-chain components

## 1. Introduction

### 1.1 Overview

Welcome to the documentation for Pantos Common. This repository is a centralized hub for storing shared code components used across multiple projects within our organization.

The primary purpose of the Common Repository is to promote code reusability, streamline collaboration, and maintain consistency across various projects. Centralizing shared code aims to enhance efficiency and reduce redundancy in our development processes.

### 1.2 Features

The Pantos Common project currently offers the following functionalities:

#### Signing module
The **signer.py** module is used for signing and verifying signatures. The private key must be on the curve Ed25519 or Ed448 and encrypted in a PEM file.

#### Service nodes module
The **servicenodes.py** module is used for communicating with Pantos service nodes. It can be used for querying the bids, sending transfers, and requesting the transfer status.

#### Blockchain utility modules
The blockchain utility modules extract common blockchain functionalities used across projects. Such functionalities include sending transactions or calling the blockchain nodes for read-only data.

The blockchain utility modules can be found in the **blockchains** package. There is a Python module for each Pantos-supported blockchain.

## 2. Installation

### 2.1  Prerequisites

Please make sure that your environment meets the following requirements:

#### Python Version

Pantos Common supports **Python 3.10** or higher. Ensure that you have the correct Python version installed before the installation steps. You can download the latest version of Python from the official [Python website](https://www.python.org/downloads/).

#### Library Versions

The Pantos Common project has been tested with the library versions specified in **poetry.lock**.

#### Poetry

Poetry is our tool of choice for dependency management and packaging.

Installing: 
https://python-poetry.org/docs/#installing-with-the-official-installer
or
https://python-poetry.org/docs/#installing-with-pipx

By default poetry creates the venv directory under under ```{cache-dir}/virtualenvs```. If you opt for creating the virtualenv inside the project’s root directory, execute the following command:
```bash
poetry config virtualenvs.in-project true
```

### 2.2  Installation Steps

#### From Pypi

```bash
$ pip install pantos-common
```

#### From source code

Create the virtual environment and install the dependencies:

```bash
$ poetry install --no-root
```

## 3. Usage

The Pantos Common project should be used as a utility library, for example as a submodule in an upstream project. After those steps, the modules can be imported directly from the Common library.

### 3.1 Configuration

The Pantos Common library allows its configuration to be loaded from multiple predefined folders. This normally involves an environment file and a base YAML configuration file, which can be located in the following predefined paths:

```
    $PWD
    $HOME
    ~/.config
    /etc/pantos
    /etc
```

Each service defines a default file name under which this file is searched. The service then expects the environment file to be present in the same location with the same name but with a different .env extension.

Alternatively one can define the location of such files by using the `PANTOS_CONFIG` and `PANTOS_ENV_FILE` environment variables.

### 3.2 Examples

https://github.com/pantos-io/client-library/blob/main/pantos/client/library/blockchains/base.py

