Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33
Add Support for Cosmos SDK 0.50.1#383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
9b89a90427304b763e108904aa3e41985ec54423f8122162d235007e4da8daf77647ba11d9018cf824c4235230b6682838File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| setuptools | ||
| aiohttp==3.8.1 | ||
| aiosignal==1.2.0 | ||
| apscheduler==3.6.3 | ||
| async-timeout==4.0.2 | ||
| attrs==21.4.0 | ||
| base58==2.1.1 | ||
| bech32==1.2.0 | ||
| bitarray==1.2.2 | ||
| cachetools==4.2.2 | ||
| certifi==2021.10.8 | ||
| charset-normalizer==2.0.12 | ||
| configparser==5.2.0 | ||
| contextlib2==21.6.0 | ||
| cytoolz==0.11.2 | ||
| deprecated==1.2.13 | ||
| eth-abi==2.1.1 | ||
| eth-account==0.5.7 | ||
| eth-hash==0.3.2 | ||
| eth-keyfile==0.5.1 | ||
| eth-keys==0.3.4 | ||
| eth-rlp==0.2.1 | ||
| eth-typing==2.3.0 | ||
| eth-utils==1.10.0 | ||
| frozenlist==1.3.0 | ||
| hexbytes==0.2.2 | ||
| idna==3.3 | ||
| ipfshttpclient==0.8.0a2 | ||
| jsonschema==3.2.0 | ||
| lru-dict==1.1.7 | ||
| multiaddr==0.0.9 | ||
| multidict==6.0.2 | ||
| netaddr==0.8.0 | ||
| opsgenie-sdk==2.1.5 | ||
| packaging==21.3 | ||
| parsimonious==0.8.1 | ||
| pdpyras==4.5.0 | ||
| pika==1.2.0 | ||
| prometheus-client==0.13.1 | ||
| protobuf==3.19.4 | ||
| pycryptodome==3.14.1 | ||
| pyjwt==2.3.0 | ||
| pymongo==3.12.1 | ||
| pyparsing==3.0.7 | ||
| pyrsistent==0.18.1 | ||
| python-dateutil==2.8.2 | ||
| python-telegram-bot==13.11 | ||
| pytz==2021.3 | ||
| pytz-deprecation-shim==0.1.0.post0 | ||
| redis==4.1.4 | ||
| requests==2.27.1 | ||
| rlp==2.0.1 | ||
| schema==0.7.5 | ||
| six==1.16.0 | ||
| slack-bolt==1.11.6 | ||
| slack-sdk==3.15.2 | ||
| tenacity==8.0.1 | ||
| toolz==0.11.2 | ||
| tornado==6.1 | ||
| twilio==7.7.1 | ||
| tzdata==2021.5 | ||
| tzlocal==4.1 | ||
| urllib3==1.26.8 | ||
| varint==1.0.2 | ||
| watchdog==2.1.6 | ||
| web3==5.28.0 | ||
| websockets==9.1 | ||
| wrapt==1.14.0 | ||
| yarl==1.7.2 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -30,11 +30,12 @@ def __init__(self, logger: logging.Logger, verify: bool = False, | ||
| def get_syncing(self, cosmos_rest_url: str) -> Dict: | ||
| """ | ||
| This function retrieves data from the cosmos_rest_url/syncing endpoint, | ||
| and is compatible with both v0.39.2 and v0.42.6 of the Cosmos SDK | ||
| and is *NOT* compatible with both v0.39.2 and v0.42.6, | ||
| but *ONLY* compatible with v0.50.1 of the Cosmos SDK | ||
| :param cosmos_rest_url: The Cosmos REST url of the data source | ||
| :return: Retrieves data from the cosmos_rest_url/syncing endpoint | ||
| """ | ||
| endpoint = cosmos_rest_url + '/syncing' | ||
| endpoint = cosmos_rest_url + '/cosmos/base/tendermint/v1beta1/syncing' | ||
| return get_cosmos_json(endpoint=endpoint, logger=self.logger, | ||
| verify=self.verify, timeout=self.timeout) | ||
Comment on lines
30
to
40
Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We always tried to keep PANIC backwards compatible. I suggest that we follow a similar implementation to | ||
| @@ -87,6 +88,34 @@ def get_staking_validators_v0_42_6( | ||
| return get_cosmos_json(endpoint=endpoint, logger=self.logger, | ||
| params=params, verify=self.verify, | ||
| timeout=self.timeout) | ||
| def get_staking_validators_v0_50_1( | ||
| self, cosmos_rest_url: str, validator_address: str = None, | ||
| params: Dict = None) -> Dict: | ||
| """ | ||
| This function retrieves data from the | ||
| cosmos_rest_url/cosmos/staking/v1beta1/validators and | ||
| cosmos_rest_url/cosmos/staking/v1beta1/validators/{validatorAddr} | ||
| endpoints, depending on the inputted function parameters. Note that this | ||
| function is only compatible with v0.50.1 of the Cosmos SDK, for other | ||
| versions unexpected behaviour might occur. | ||
| :param cosmos_rest_url: The Cosmos REST url of the data source | ||
| :param params: Parameters that need to be added to the endpoint | ||
| :param validator_address: The address of the validator you want to query | ||
| :return: Retrieves data from the | ||
| : cosmos_rest_url/cosmos/staking/v1beta1/validators or | ||
| : cosmos_rest_url/cosmos/staking/v1beta1/validators/{ | ||
| : validatorAddr} endpoints | ||
| """ | ||
| cosmos_fn = ( | ||
| '/cosmos/staking/v1beta1/validators' if validator_address is None | ||
| else '/cosmos/staking/v1beta1/validators/{}'.format( | ||
| validator_address) | ||
| ) | ||
| endpoint = cosmos_rest_url + cosmos_fn | ||
| return get_cosmos_json(endpoint=endpoint, logger=self.logger, | ||
| params=params, verify=self.verify, | ||
| timeout=self.timeout) | ||
| def get_proposals_v0_39_2( | ||
| self, cosmos_rest_url: str, proposal_id: int = None, | ||
| @@ -137,6 +166,34 @@ def get_proposals_v0_42_6( | ||
| return get_cosmos_json(endpoint=endpoint, logger=self.logger, | ||
| params=params, verify=self.verify, | ||
| timeout=self.timeout) | ||
| def get_proposals_v0_50_1( | ||
| self, cosmos_rest_url: str, proposal_id: int = None, | ||
| params: Dict = None) -> Dict: | ||
| """ | ||
| This function retrieves data from the | ||
| cosmos_rest_url/cosmos/gov/v1beta1/proposals and | ||
| cosmos_rest_url/cosmos/gov/v1beta1/proposals/{proposalId} | ||
| endpoints, depending on the inputted function parameters. Note that this | ||
| function is only compatible with v0.50.1 of the Cosmos SDK, for other | ||
| versions unexpected behaviour might occur. | ||
| :param cosmos_rest_url: The Cosmos REST url of the data source | ||
| :param params: Parameters that need to be added to the endpoint | ||
| :param proposal_id: The ID of the proposal you want to query | ||
| :return: Retrieves data from the | ||
| : cosmos_rest_url/cosmos/gov/v1beta1/proposals or | ||
| : cosmos_rest_url/cosmos/gov/v1beta1/proposals/{ | ||
| : proposalId} endpoints | ||
| """ | ||
| cosmos_fn = ( | ||
| '/cosmos/gov/v1/proposals' if proposal_id is None | ||
| else '/cosmos/gov/v1/proposals/{}'.format( | ||
| proposal_id) | ||
| ) | ||
| endpoint = cosmos_rest_url + cosmos_fn | ||
| return get_cosmos_json(endpoint=endpoint, logger=self.logger, | ||
| params=params, verify=self.verify, | ||
| timeout=self.timeout) | ||
| def execute_with_checks(self, function, args: List[Any], | ||
| node_name: str, sdk_version: str) -> Any: | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update inline documentation due to the fact that we are now supporting v50
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly between lines 14 and 24