-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathvalidators.py
More file actions
22 lines (16 loc) · 802 Bytes
/
validators.py
File metadata and controls
22 lines (16 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from client.resource import Resource
class Validators(Resource):
def all(self, page=None, limit=100, **kwargs):
extra_params = {name: kwargs[name] for name in kwargs if kwargs[name] is not None}
params = {
'page': page,
'limit': limit,
**extra_params
}
return self.with_endpoint('api').request_get('validators', params)
def get(self, validator_id):
return self.with_endpoint('api').request_get(f'validators/{validator_id}')
def blocks(self, validator_id, **kwargs):
return self.with_endpoint('api').request_get(f'validators/{validator_id}/blocks', kwargs)
def voters(self, validator_id, **kwargs):
return self.with_endpoint('api').request_get(f'validators/{validator_id}/voters', kwargs)