• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ape364 / aioetherscan / 11508304044

24 Oct 2024 10:16PM UTC coverage: 100.0%. Remained the same
11508304044

Pull #33

github

ape364
fix: pragma: no cover
Pull Request #33: feat: add api keys rotating

41 of 41 new or added lines in 4 files covered. (100.0%)

699 of 699 relevant lines covered (100.0%)

4.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/aioetherscan/modules/block.py
1
from datetime import date
4✔
2
from typing import Optional
4✔
3

4
from aioetherscan.common import check_closest_value, get_daily_stats_params
4✔
5
from aioetherscan.modules.base import BaseModule
4✔
6

7

8
class Block(BaseModule):
4✔
9
    """Blocks
10

11
    https://docs.etherscan.io/api-endpoints/blocks
12
    """
13

14
    @property
4✔
15
    def _module(self) -> str:
4✔
16
        return 'block'
4✔
17

18
    async def block_reward(self, blockno: int) -> dict:
4✔
19
        """Get Block And Uncle Rewards by BlockNo"""
20
        return await self._get(action='getblockreward', blockno=blockno)
4✔
21

22
    async def est_block_countdown_time(self, blockno: int) -> dict:
4✔
23
        """Get Estimated Block Countdown Time by BlockNo"""
24
        return await self._get(action='getblockcountdown', blockno=blockno)
4✔
25

26
    async def block_number_by_ts(self, ts: int, closest: str) -> dict:
4✔
27
        """Get Block Number by Timestamp"""
28
        return await self._get(
4✔
29
            action='getblocknobytime', timestamp=ts, closest=check_closest_value(closest)
30
        )
31

32
    async def daily_average_block_size(
4✔
33
        self, start_date: date, end_date: date, sort: Optional[str] = None
34
    ) -> dict:
35
        """Get Daily Average Block Size"""
36
        return await self._get(
4✔
37
            **get_daily_stats_params('dailyavgblocksize', start_date, end_date, sort)
38
        )
39

40
    async def daily_block_count(
4✔
41
        self, start_date: date, end_date: date, sort: Optional[str] = None
42
    ) -> dict:
43
        """Get Daily Block Count and Rewards"""
44
        return await self._get(
4✔
45
            **get_daily_stats_params('dailyblkcount', start_date, end_date, sort)
46
        )
47

48
    async def daily_block_rewards(
4✔
49
        self, start_date: date, end_date: date, sort: Optional[str] = None
50
    ) -> dict:
51
        """Get Daily Block Rewards"""
52
        return await self._get(
4✔
53
            **get_daily_stats_params('dailyblockrewards', start_date, end_date, sort)
54
        )
55

56
    async def daily_average_time_for_a_block(
4✔
57
        self, start_date: date, end_date: date, sort: Optional[str] = None
58
    ) -> dict:
59
        """Get Daily Average Time for A Block to be Included in the Ethereum Blockchain"""
60
        return await self._get(
4✔
61
            **get_daily_stats_params('dailyavgblocktime', start_date, end_date, sort)
62
        )
63

64
    async def daily_uncle_block_count(
4✔
65
        self, start_date: date, end_date: date, sort: Optional[str] = None
66
    ) -> dict:
67
        """Get Daily Uncle Block Count and Rewards"""
68
        return await self._get(
4✔
69
            **get_daily_stats_params('dailyuncleblkcount', start_date, end_date, sort)
70
        )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc