Skip to content

Arkiv Helpers

Arkiv SDK helpers that smooth over upstream edge cases.

Challenge servers import these helpers to tolerate occasional RPC failures when reading entity metadata. Keep the module dependency-free so it can be safely imported from Docker entrypoints prior to installing extras.

get_entity_metadata_safe(client, entity_key) async

Fetch entity metadata via the Arkiv client with a resilient fallback.

The higher level client.get_entity_metadata call occasionally raises when the WebSocket connection is out of sync. In those cases we fall back to the lower level http_client().eth interface and reconstruct a minimal object that mimics the SDK result. The helper re-raises only when both strategies fail so callers can decide how to handle the error.

Parameters:

Name Type Description Default
client Any

Instance of ArkivClient from the SDK (or a compatible test double).

required
entity_key Any

UInt256 entity identifier returned by Arkiv.

required