Skip to content

Commit 27b6931

Browse files
Update UserOperation status to support string comparison (#115)
1 parent ed55c91 commit 27b6931

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

cdp/user_operation.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ def __repr__(self) -> str:
4141
"""Return a string representation of the Status."""
4242
return str(self)
4343

44+
def __eq__(self, other):
45+
"""Check if the status is equal to another object. Supports string comparison."""
46+
if isinstance(other, str):
47+
return self.value == other
48+
return super().__eq__(other)
49+
50+
def __hash__(self):
51+
"""Return a hash value for the enum member to allow use as dictionary keys."""
52+
return hash(self.name)
53+
4454
def __init__(self, model: UserOperationModel, smart_wallet_address: str) -> None:
4555
"""Initialize the UserOperation class.
4656

0 commit comments

Comments
 (0)