Skip to content

Commit b5fd07e

Browse files
pimfeltkampclaude
andcommitted
Fix mistyped ID parameters on Templates.load and Hoppers.position
Templates.load(template_id, hopper_id): hopper_id was annotated as TemplateId, which is structurally identical to HopperId but misleading in IDE hints — readers might assume the second argument should be a template ID. Introduce HopperId in the same module and use it. Hoppers.position(hopper_id, position_id): same flavour of bug — position_id was annotated as HopperId. Add a PositionId alias and use it for the second parameter. Both are docs-only (no runtime change) but matter for static analysis and developer-experience accuracy. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4b8c5e6 commit b5fd07e

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/cryptohopper/resources/hoppers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from .._client import CryptohopperClient
1010

1111
HopperId = int | str
12+
PositionId = int | str
1213

1314

1415
class Hoppers:
@@ -49,7 +50,7 @@ def positions(self, hopper_id: HopperId) -> Sequence[dict[str, Any]]:
4950
"GET", "/hopper/positions", params={"hopper_id": hopper_id}
5051
)
5152

52-
def position(self, hopper_id: HopperId, position_id: HopperId) -> dict[str, Any]:
53+
def position(self, hopper_id: HopperId, position_id: PositionId) -> dict[str, Any]:
5354
"""Fetch a single position. Requires ``read``."""
5455
return self._client._request(
5556
"GET",

src/cryptohopper/resources/template.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from .._client import CryptohopperClient
1010

1111
TemplateId = int | str
12+
HopperId = int | str
1213

1314

1415
class Templates:
@@ -44,7 +45,7 @@ def update(
4445
)
4546

4647
def load(
47-
self, template_id: TemplateId, hopper_id: TemplateId
48+
self, template_id: TemplateId, hopper_id: HopperId
4849
) -> dict[str, Any]:
4950
"""Apply a template to a hopper. Requires ``manage``."""
5051
return self._client._request(

0 commit comments

Comments
 (0)