Skip to content

Commit

Permalink
entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Vardominator committed Jun 3, 2023
1 parent ef3b933 commit 8032113
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 5 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,38 @@
</p>

# 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

Expand Down
Empty file removed maestro-sdk/handlers/__init__.py
Empty file.
1 change: 1 addition & 0 deletions maestro_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .session import MaestroSession
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
File renamed without changes.
7 changes: 4 additions & 3 deletions maestro-sdk/main.py → maestro_sdk/session.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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()
File renamed without changes.
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
name = "maestro-sdk"
version = "0.1.0"
description = "Python SDK for the Maestro Blockchain Indexer API"
authors = ["Varderes Barsegyan <[email protected]>"]
homepage = "https://www.gomaestro.org/"
documentation = "https://docs.gomaestro.org/"
authors = ["Maestro Blockchain Inc <[email protected]>"]
license = "Apache-2.0"
readme = "README.md"
repository = "https://github.com/maestro-org/python-sdk"
packages = [{include = "maestro_sdk"}]

[tool.poetry.dependencies]
Expand Down

0 comments on commit 8032113

Please sign in to comment.