Skip to content

Commit

Permalink
checksum eth addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
nibty committed Sep 6, 2024
1 parent bbb7252 commit b3abcee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions json_api/app/leaderboard/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from ..models.cache import Cache
from ..models.miners import Miners
from gpage import get_difficulty
from eth_utils import to_checksum_address


def fetch_cache_data(limit, offset):
Expand Down Expand Up @@ -40,7 +41,7 @@ def get_leaderboard(limit: int, offset: int):
miners = [
{
"rank": r.rank,
"account": r.account.strip(),
"account": to_checksum_address(r.account.strip()),
"blocks": r.total_blocks,
"hashRate": round(r.hashes_per_second, 2),
"superBlocks": r.super_blocks,
Expand All @@ -63,7 +64,7 @@ def get_leaderboard_entry(account: str):
raise ValueError("Account not found")

return {
"account": result.account.strip(),
"account": to_checksum_address(result.account.strip()),
"blocks": result.total_blocks,
"hashRate": round(result.hashes_per_second, 2),
"superBlocks": result.super_blocks,
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ Flask-SQLAlchemy
python-dotenv
gevent
gunicorn
eth_utils

0 comments on commit b3abcee

Please sign in to comment.