Skip to content

Commit

Permalink
Fetch validators via post request (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyc60 authored Jul 16, 2024
1 parent 2a84ab5 commit 9db86c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "sw-utils"
version = "0.6.15"
version = "0.6.16"
description = "StakeWise Python utils"
authors = ["StakeWise Labs <[email protected]>"]
license = "GPL-3.0-or-later"
Expand Down
8 changes: 5 additions & 3 deletions sw_utils/consensus.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
logger = logging.getLogger(__name__)


GET_VALIDATORS = '/eth/v1/beacon/states/{0}/validators{1}'
GET_VALIDATORS = '/eth/v1/beacon/states/{0}/validators'
GET_ATTESTATION_REWARDS = 'eth/v1/beacon/rewards/attestations/{0}'
GET_SYNC_COMMITTEE_REWARDS = 'eth/v1/beacon/rewards/sync_committee/{0}'

Expand Down Expand Up @@ -77,8 +77,10 @@ def __init__(
async def get_validators_by_ids(
self, validator_ids: Sequence[str], state_id: str = 'head'
) -> dict:
endpoint = GET_VALIDATORS.format(state_id, f"?id={'&id='.join(validator_ids)}")
return await self._async_make_get_request(endpoint)
endpoint = GET_VALIDATORS.format(state_id)
return await self._async_make_post_request(
endpoint_uri=endpoint, data={'ids': validator_ids}
)

async def submit_voluntary_exit(
self, epoch: int, validator_index: int, signature: HexStr
Expand Down

0 comments on commit 9db86c5

Please sign in to comment.