Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion antd-py/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ await aclient.close()

| Method | Returns | Description |
|--------|---------|-------------|
| `health()` | `HealthStatus` | Check daemon health |
| `health()` | `HealthStatus` | Check daemon health — also surfaces antd version, EVM network, uptime, build commit, and payment contract addresses (antd ≥ 0.4.0) |

#### Data

Expand Down
18 changes: 16 additions & 2 deletions antd-py/src/antd/_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@
)


def _health_status_from_resp(resp) -> HealthStatus:
"""Convert a HealthCheckResponse pb message into a HealthStatus."""
return HealthStatus(
ok=resp.status == "ok",
network=resp.network or "unknown",
version=resp.version,
evm_network=resp.evm_network,
uptime_seconds=resp.uptime_seconds,
build_commit=resp.build_commit,
payment_token_address=resp.payment_token_address,
payment_vault_address=resp.payment_vault_address,
)


def _file_upload_result_from_resp(resp) -> FileUploadResult:
return FileUploadResult(
address=resp.address,
Expand Down Expand Up @@ -109,7 +123,7 @@ def __exit__(self, *exc):
def health(self) -> HealthStatus:
try:
resp = self._health.Check(health_pb2.HealthCheckRequest())
return HealthStatus(ok=resp.status == "ok", network=resp.network or "unknown")
return _health_status_from_resp(resp)
except grpc.RpcError as e:
if e.code() == grpc.StatusCode.UNAVAILABLE:
return HealthStatus(ok=False, network="unknown")
Expand Down Expand Up @@ -270,7 +284,7 @@ async def __aexit__(self, *exc):
async def health(self) -> HealthStatus:
try:
resp = await self._health.Check(health_pb2.HealthCheckRequest())
return HealthStatus(ok=resp.status == "ok", network=resp.network or "unknown")
return _health_status_from_resp(resp)
except grpc.RpcError as e:
if e.code() == grpc.StatusCode.UNAVAILABLE:
return HealthStatus(ok=False, network="unknown")
Expand Down
4 changes: 2 additions & 2 deletions antd-py/src/antd/_proto/antd/v1/chunks_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions antd-py/src/antd/_proto/antd/v1/common_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions antd-py/src/antd/_proto/antd/v1/data_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions antd-py/src/antd/_proto/antd/v1/events_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions antd-py/src/antd/_proto/antd/v1/files_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion antd-py/src/antd/_proto/antd/v1/graph_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions antd-py/src/antd/_proto/antd/v1/health_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions antd-py/src/antd/_proto/antd/v1/health_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,21 @@ class HealthCheckRequest(_message.Message):
def __init__(self) -> None: ...

class HealthCheckResponse(_message.Message):
__slots__ = ("status", "network")
__slots__ = ("status", "network", "version", "evm_network", "uptime_seconds", "build_commit", "payment_token_address", "payment_vault_address")
STATUS_FIELD_NUMBER: _ClassVar[int]
NETWORK_FIELD_NUMBER: _ClassVar[int]
VERSION_FIELD_NUMBER: _ClassVar[int]
EVM_NETWORK_FIELD_NUMBER: _ClassVar[int]
UPTIME_SECONDS_FIELD_NUMBER: _ClassVar[int]
BUILD_COMMIT_FIELD_NUMBER: _ClassVar[int]
PAYMENT_TOKEN_ADDRESS_FIELD_NUMBER: _ClassVar[int]
PAYMENT_VAULT_ADDRESS_FIELD_NUMBER: _ClassVar[int]
status: str
network: str
def __init__(self, status: _Optional[str] = ..., network: _Optional[str] = ...) -> None: ...
version: str
evm_network: str
uptime_seconds: int
build_commit: str
payment_token_address: str
payment_vault_address: str
def __init__(self, status: _Optional[str] = ..., network: _Optional[str] = ..., version: _Optional[str] = ..., evm_network: _Optional[str] = ..., uptime_seconds: _Optional[int] = ..., build_commit: _Optional[str] = ..., payment_token_address: _Optional[str] = ..., payment_vault_address: _Optional[str] = ...) -> None: ...
Loading