Skip to content

Commit dfce3ee

Browse files
committed
feat(info): add undocumented agents endpoint
1 parent a1fca2a commit dfce3ee

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

hyperliquid/info.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,27 @@ def user_rate_limit(self, user: str) -> Any:
733733
def query_spot_deploy_auction_status(self, user: str) -> Any:
734734
return self.post("/info", {"type": "spotDeployState", "user": user})
735735

736+
def extra_agents(self, user: str) -> Any:
737+
"""Retrieve extra agents associated with a user.
738+
739+
POST /info
740+
741+
Args:
742+
user (str): Onchain address in 42-character hexadecimal format;
743+
e.g. 0x0000000000000000000000000000000000000000.
744+
745+
Returns:
746+
[
747+
{
748+
"name": str,
749+
"address": str,
750+
"validUntil": int
751+
},
752+
...
753+
]
754+
"""
755+
return self.post("/info", {"type": "extraAgents", "user": user})
756+
736757
def _remap_coin_subscription(self, subscription: Subscription) -> None:
737758
if (
738759
subscription["type"] == "l2Book"

tests/info_test.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,16 @@ def test_delegator_history():
244244
assert "delta" in event, "Each event should have a 'delta' field"
245245
assert "hash" in event, "Each event should have a transaction 'hash'"
246246
assert "time" in event, "Each event should have a 'time' field"
247+
248+
249+
@pytest.mark.vcr()
250+
def test_extra_agents():
251+
info = Info(skip_ws=True, meta=TEST_META, spot_meta=TEST_SPOT_META)
252+
response = info.extra_agents(user="0xd42f2bB0e06455eDB652e27b7374FC2bDa8448ee")
253+
assert isinstance(response, list), "The response should be a list"
254+
# Extra agents should contain agent information
255+
if len(response) > 0:
256+
agent = response[0]
257+
assert "name" in agent, "Each agent should have a 'name' field"
258+
assert "address" in agent, "Each agent should have an 'address' field"
259+
assert "validUntil" in agent, "Each agent should have a 'validUntil' field"

0 commit comments

Comments
 (0)