from sanic import response from base58 import b58encode from app.core._secrets import hot_pubkey, service_wallet from app.core._blockchain.ton.platform import platform import subprocess import docker from pprint import pprint def get_git_info(): branch_name = subprocess.check_output(["git", "branch", "--show-current"]).decode('utf-8').strip() commit_hash = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode('utf-8').strip() return branch_name, commit_hash async def s_api_system(request): client = docker.from_env() containers = client.containers.list(all=True) pprint(containers) return response.json({ 'id': b58encode(hot_pubkey).decode(), 'master_address': platform.address.to_string(1, 1, 1), 'node_address': service_wallet.address.to_string(1, 1, 1), 'indexer_height': 0, }) async def s_api_system_version(request): branch_name, commit_hash = get_git_info() return response.json({ "codebase_hash": commit_hash, "codebase_branch": branch_name, })