-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from coinbase/v0.13.0
Release v0.13.0
- Loading branch information
Showing
46 changed files
with
1,539 additions
and
390 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from cdp.client import AddressReputationMetadata | ||
from cdp.client.models.address_reputation import AddressReputation as AddressReputationModel | ||
|
||
|
||
class AddressReputation: | ||
"""A representation of the reputation of a blockchain address.""" | ||
|
||
def __init__(self, model: AddressReputationModel) -> None: | ||
"""Initialize the AddressReputation class.""" | ||
if not model: | ||
raise ValueError("model is required") | ||
|
||
self._score = model.score | ||
self._metadata = model.metadata | ||
|
||
@property | ||
def metadata(self) -> AddressReputationMetadata: | ||
"""Return the metadata of the address.""" | ||
return self._metadata | ||
|
||
@property | ||
def score(self) -> int: | ||
"""Return the score of the address.""" | ||
return self._score | ||
|
||
@property | ||
def risky(self) -> bool: | ||
"""Return whether the address is risky.""" | ||
return self.score < 0 | ||
|
||
def __str__(self) -> str: | ||
"""Return a string representation of the AddressReputation.""" | ||
metadata = ", ".join(f"{key}={getattr(self.metadata, key)}" for key in vars(self.metadata)) | ||
return f"Address Reputation: (score={self.score}, metadata=({metadata}))" | ||
|
||
def __repr__(self) -> str: | ||
"""Return a string representation of the AddressReputation.""" | ||
return str(self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.