-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
971f378
commit 210d0a0
Showing
9 changed files
with
358 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from .request import get_request | ||
from dataclasses import dataclass | ||
from dacite import from_dict | ||
|
||
|
||
@dataclass | ||
class ChainTip: | ||
block_hash: str | ||
slot: int | ||
height: int | ||
|
||
class General(): | ||
def chain_tip(self, maestro_session): | ||
resp = get_request(maestro_session, "chain-tip") | ||
return from_dict(data_class=ChainTip, data=resp) | ||
|
||
def era_history(self): | ||
pass | ||
|
||
def protocol_params(self): | ||
pass | ||
|
||
def system_start(self): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import requests | ||
from urllib.parse import urljoin | ||
import json | ||
|
||
def get_request(maestro_session, endpoint, params = {}): | ||
headers = { | ||
"api-key": maestro_session.api_key, | ||
"content-type": "application/json" | ||
} | ||
url = urljoin(maestro_session.base_url, endpoint) | ||
response = requests.get(url, headers=headers, params=params) | ||
response.raise_for_status() | ||
return json.loads(response.text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from handlers.general import General | ||
|
||
class MaestroSession(): | ||
def __init__(self, network: str, api_key: str, version: str = "v0") -> None: | ||
self.network = network | ||
self.api_key = api_key | ||
self.version = version | ||
self.base_url = f"https://{self.network}.gomaestro-api.org/{self.version}" | ||
|
||
self.general = General() | ||
|
||
def accounts(self): | ||
self | ||
|
||
def addresses(self): | ||
pass | ||
|
||
def assets(self): | ||
pass | ||
|
||
def datum(self): | ||
pass | ||
|
||
def epochs(self): | ||
pass | ||
|
||
def pools(self): | ||
pass | ||
|
||
def scripts(self): | ||
pass | ||
|
||
def transactions(self): | ||
pass | ||
|
||
def submit(self): | ||
pass | ||
|
||
def txmanager(self): | ||
pass | ||
|
||
if __name__ == "__main__": | ||
maestro = MaestroSession("mainnet", "") | ||
chain_tip = maestro.general.chain_tip(maestro) | ||
breakpoint() |
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.