from sanic import response from base58 import b58encode from app.core._secrets import hot_pubkey, service_wallet import subprocess 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): return response.json({ 'id': b58encode(hot_pubkey).decode(), 'ton_address': service_wallet.address.to_string(1, 1, 1) }) 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, })