Skip to content

Commit

Permalink
feat: make stellar_sdk.Asset hashable. (#576)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinThoma authored Feb 23, 2022
1 parent 00a6638 commit 4034af1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions stellar_sdk/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ def from_xdr_object(
raise ValueError(f"Invalid asset type: {xdr_object.type}")
return cls(code, issuer)

def __hash__(self) -> int:
return hash((self.type, self.code, self.issuer))

def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
Expand Down

0 comments on commit 4034af1

Please sign in to comment.