diff --git a/README.md b/README.md index 0abec9f..4186836 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,38 @@

# Getting Started +1. [TODO] Install `maestro-sdk` package +``` +# pip +pip install maestro-sdk + +# poetry +poetry add maestro-sdk +``` + +2. Create a [Maestro API key](https://docs.gomaestro.org/docs/Getting-started/Sign-up-login). +3. [TODO] Import the package +```python +from maestro_sdk import MaestroSession +``` + +## Local Development +1. Get [poetry](https://python-poetry.org/docs/#installation) +2. Install package: `poetry install` +3. Lock dependencies: `poetry lock` +4. Run Python shell: `poetry run python` +```bash +>>> from maestro_sdk import MaestroSession +>>> maestro = MaestroSession("mainnet", "opIqovS7Xdp4o876Ml7c4cbwvm7cETgV") +>>> chain_tip = maestro.general.chain_tip(maestro) +>>> chain_tip +ChainTip(block_hash='7ed2439755445de6c42984de49c15b0a13326da8a5666e8050cf39fbfd295a7c', slot=94249308, height=8857750) +``` # Documentation +* [TODO] [Read the Docs](https://python-sdk.gomaestro.org/) +* [Maestro public docs](https://docs.gomaestro.org/) +* [Maestro API reference](https://reference.gomaestro.org/) # Contributing diff --git a/maestro-sdk/handlers/__init__.py b/maestro-sdk/handlers/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/maestro_sdk/__init__.py b/maestro_sdk/__init__.py new file mode 100644 index 0000000..d98bc17 --- /dev/null +++ b/maestro_sdk/__init__.py @@ -0,0 +1 @@ +from .session import MaestroSession diff --git a/maestro-sdk/__init__.py b/maestro_sdk/handlers/__init__.py similarity index 100% rename from maestro-sdk/__init__.py rename to maestro_sdk/handlers/__init__.py diff --git a/maestro-sdk/handlers/general.py b/maestro_sdk/handlers/general.py similarity index 79% rename from maestro-sdk/handlers/general.py rename to maestro_sdk/handlers/general.py index 56a81e9..0dd9701 100644 --- a/maestro-sdk/handlers/general.py +++ b/maestro_sdk/handlers/general.py @@ -2,13 +2,25 @@ from dataclasses import dataclass from dacite import from_dict - @dataclass class ChainTip: block_hash: str slot: int height: int +@dataclass +class EraHistory: + pass + +@dataclass +class ProtocolParams: + pass + +@dataclass +class SystemStart: + pass + + class General(): def chain_tip(self, maestro_session): resp = get_request(maestro_session, "chain-tip") diff --git a/maestro-sdk/handlers/request.py b/maestro_sdk/handlers/request.py similarity index 100% rename from maestro-sdk/handlers/request.py rename to maestro_sdk/handlers/request.py diff --git a/maestro-sdk/main.py b/maestro_sdk/session.py similarity index 76% rename from maestro-sdk/main.py rename to maestro_sdk/session.py index 5534b60..84da94e 100644 --- a/maestro-sdk/main.py +++ b/maestro_sdk/session.py @@ -1,7 +1,9 @@ -from handlers.general import General +from .handlers.general import General class MaestroSession(): def __init__(self, network: str, api_key: str, version: str = "v0") -> None: + if not network: + raise Exception("Network not specified. Use 'preview', 'preprod, or 'mainnet'.") self.network = network self.api_key = api_key self.version = version @@ -40,6 +42,5 @@ def txmanager(self): pass if __name__ == "__main__": - maestro = MaestroSession("mainnet", "") + maestro = MaestroSession("mainnet", "opIqovS7Xdp4o876Ml7c4cbwvm7cETgV") chain_tip = maestro.general.chain_tip(maestro) - breakpoint() diff --git a/maestro-sdk/utils.py b/maestro_sdk/utils.py similarity index 100% rename from maestro-sdk/utils.py rename to maestro_sdk/utils.py diff --git a/pyproject.toml b/pyproject.toml index 57c2e9a..9a1de3f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,9 +2,12 @@ name = "maestro-sdk" version = "0.1.0" description = "Python SDK for the Maestro Blockchain Indexer API" -authors = ["Varderes Barsegyan "] +homepage = "https://www.gomaestro.org/" +documentation = "https://docs.gomaestro.org/" +authors = ["Maestro Blockchain Inc "] license = "Apache-2.0" readme = "README.md" +repository = "https://github.com/maestro-org/python-sdk" packages = [{include = "maestro_sdk"}] [tool.poetry.dependencies]