-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathblocks.py
More file actions
28 lines (20 loc) · 825 Bytes
/
blocks.py
File metadata and controls
28 lines (20 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from typing import Optional
from client.resource import Resource
from client.types.blocks import BlockTransactionsQuery, BlocksQuery
class Blocks(Resource):
def all(self, query: Optional[BlocksQuery] = None):
return self.with_endpoint('api').request_get('blocks', query)
def get(self, block_hash: str):
return self.with_endpoint('api').request_get(f'blocks/{block_hash}')
def first(self):
return self.with_endpoint('api').request_get('blocks/first')
def last(self):
return self.with_endpoint('api').request_get('blocks/last')
def transactions(
self,
block_hash: str,
query: Optional[BlockTransactionsQuery] = None,
):
return self.with_endpoint('api').request_get(
f'blocks/{block_hash}/transactions', query
)