# pyCosmicWrap 🌯
_A python3 wrapper around Cosmos API/RPC brought to you by [ChihuahuaChain](https://chihuahua.wtf)_
# Info
pyCosmicWrap 🌯 makes it easier to develop python applications on the Cosmos Ecosystem.
It currently has been tested with ChihuahuaChain and the first stable release will have it production-ready for almost every Cosmos Blockchain
# Todo
There's a lot more to add, here's our plan, feel free to contribute with code improvements, testing and feel free to push a PR to help us to improve pyCosmicWrap and to make it the default choice for any Cosmos Ecosystem python developer. The next big step will be adding [Mospy by ctrl-Felix](https://github.com/ctrl-Felix/mospy) in order to be able to create and broadcast transactions as well.
- [x] Wrap main default API endpoints
- [x] Wrap main RPC endpoints
- [x] Published on [PyPi](https://pypi.org/project/pyCosmicWrap/)
- [ ] Add Osmosis specific endpoints
- [ ] Integrate [Mospy by ctrl-Felix](https://github.com/ctrl-Felix/mospy)
## Installation
You can install this module with
`python -m pip install pycosmicwrap`
# API/LCD Queries
## Bank Queries
- `query_balances(address)` _queries the balance of all coins for a single account_
- `query_balances_by_denom(address, denom)` _queries the balance of a single coin for a single account._
- `query_supply()` _queries the total supply of all coins._
- `query_supply_by_denom(denom)` _queries the supply of a single coin._
## Distribution Queries
- `query_community_pool()` _queries the community pool coins_
- `query_distribution_params()` _queries the blockchain distribution parameters_
- `query_rewards(delegator)` _queries the total rewards accrued by a each validator_
- `query_rewards_by_validator(delegator, validator)` _queries the total rewards accrued by a delegation on a given validator_
- `query_delegator_validators(delegator)` _queries the validators of a delegator_
- `query_withdraw_address(delegator)` _queries withdraw address of a delegator_
- `query_commission(validator)` _queries accumulated commission for a validator_
- `query_outstanding_rewards(validator)` _queries rewards of a validator address_
## Governance Queries
- `query_proposals()` _queries all the proposals_
- `query_proposal_by_id(id)` _queries a specific proposal by a given id (accepts both string or integers)_
- `query_tally(id)` _queries tally of a proposal by a given id (accepts both string or integers)_
- `query_votes(id)` _queries votes for a specific proposal by a given id (accepts both string or integers)_
- `query_votes_by_address(id, address)` _queries votes for a specific proposal from a given address (accepts both string or integers)_
## Slashing Queries
- `query_slashing_params()` _queries slashing parameters_
## Staking Queries
- `query_staking_params()` _queries staking parameters_
- `query_staking_pool()` _queries staking pool_
- `query_delegations_by_address(delegator)` _queries all the delegations of a given address_
- `query_redelegations_by_address(delegator)` _queries all the redelegations of a given address_
- `query_unbonding_by_address(delegator)` _queries all the unbondings of a given address_
- `query_delegator_data(delegator)` _queries delegator data of a given address_
- `query_delegator_data_by_validator(delegator, validator)` _queries delegator data of a given address on a given validator_
- `query_all_validators()` _queries all the validators_
- `query_validator_by_address(validator)` _queries data for a given validator_
- `query_delegators(validator)` _queries all the delegators for a given validator_
- `query_delegators_by_address(validator, delegator)` _queries a given delegator's data for a given validator_
- `query_validator_unbonding_by_address)` _queries a given delegator's unbonding data for a given validator_
- `query_unbonding_from(validator)` _queries all the unbonding of a give validator_
## Mint Queries
- `query_mint_params()` _queries mint parameters_
- `query_annual_provisions()` _queries annual provisions_
- `query_mint_params()` _queries current inflation percentage_
## TX Queries
- `query_tx(tx_hash)` _queries a given transaction hash_
# RPC Queries
- `query_abci_info()` _queries abci info_
- `query_block(height)` _queries a given block height_
- `query_block_results(height)` _queries a given block results by its height_
- `query_commit(height)` _queries a given commit by its height_
- `query_consensus_state()` _queries consensus state_
- `query_dump_consensus_state()` _dumps consensus state_
- `query_genesis()` _queries the current genesis_
- `query_net_info()` _queries network info_
- `query_num_unconfirmed_txs()` _queries the amount of unconfirmed txs_
- `query_status()` _queries the node status._
# Examples
#### Initialize the module and print basic info
```python
from pycosmicwrap import CosmicWrap
# create an object with rest api url, rpc url and denom as arguments
chihuahua = CosmicWrap(lcd='https://api.chihuahua.wtf',
rpc='https://rpc.chihuahua.wtf',
denom='uhuahua')
# Once the module is imported and the object is created we can start using
# the object to interact with the blockchain
# Let's define an address
my_address = 'chihuahua1z6rfp8wzsx87pwt3z73gf2a67d6tgmfrrlzy7p'
# Let's create a variable with your balance
my_address_balance = chihuahua.query_balances(my_address)
# or just print it out
print(my_address_balance)
# check all of your delegations
my_delegations = chihuahua.query_delegations_by_address(my_address)
# and print them out
print(my_delegations)
# check all of your staking rewards
print(chihuahua.query_rewards(my_address))
```
# Donate
We don't seek for donations, but you can say Thank You for our work by [delegating to our validators](https://delegate.chihuahua.wtf) and by [sharing this project on Twitter](https://twitter.com/intent/tweet?text=Check%20out%20%23pyCosmicWrap%20%F0%9F%8C%AF%20by%20%40ChihuahuaChain%20-%20A%20%23python%20wrapper%20for%20%40cosmos%20on%20https%3A//github.com/ChihuahuaChain/pyCosmicWrap%20%23HUAHUA%20%23Chihuahua%20%23WOOF%0A)
# License
ChihuahuaChain/pyCosmicWrap is licensed under the [GNU General Public License v3.0](https://choosealicense.com/licenses/gpl-3.0/)
Raw data
{
"_id": null,
"home_page": "",
"name": "pyCosmicWrap",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "chihuahua,chihuahuachain,cosmos,cosmosecosystem,pycosmicwrap,wrapper",
"author": "",
"author_email": "ChihuahuaChain <woof@huahua.wtf>",
"download_url": "https://files.pythonhosted.org/packages/24/cd/c105882fbe289a00dfe96dac8a07ddd76f5f4835df66642dd19a5d2d795b/pycosmicwrap-0.1.4.tar.gz",
"platform": null,
"description": "# pyCosmicWrap \ud83c\udf2f\n_A python3 wrapper around Cosmos API/RPC brought to you by [ChihuahuaChain](https://chihuahua.wtf)_\n\n# Info\npyCosmicWrap \ud83c\udf2f makes it easier to develop python applications on the Cosmos Ecosystem.\nIt currently has been tested with ChihuahuaChain and the first stable release will have it production-ready for almost every Cosmos Blockchain\n\n# Todo\nThere's a lot more to add, here's our plan, feel free to contribute with code improvements, testing and feel free to push a PR to help us to improve pyCosmicWrap and to make it the default choice for any Cosmos Ecosystem python developer. The next big step will be adding [Mospy by ctrl-Felix](https://github.com/ctrl-Felix/mospy) in order to be able to create and broadcast transactions as well.\n\n- [x] Wrap main default API endpoints\n- [x] Wrap main RPC endpoints\n- [x] Published on [PyPi](https://pypi.org/project/pyCosmicWrap/) \n- [ ] Add Osmosis specific endpoints\n- [ ] Integrate [Mospy by ctrl-Felix](https://github.com/ctrl-Felix/mospy)\n\n## Installation\n\nYou can install this module with\n`python -m pip install pycosmicwrap`\n\n# API/LCD Queries\n\n## Bank Queries\n- `query_balances(address)` _queries the balance of all coins for a single account_\n- `query_balances_by_denom(address, denom)` _queries the balance of a single coin for a single account._\n- `query_supply()` _queries the total supply of all coins._\n- `query_supply_by_denom(denom)` _queries the supply of a single coin._\n\n## Distribution Queries\n- `query_community_pool()` _queries the community pool coins_\n- `query_distribution_params()` _queries the blockchain distribution parameters_\n- `query_rewards(delegator)` _queries the total rewards accrued by a each validator_\n- `query_rewards_by_validator(delegator, validator)` _queries the total rewards accrued by a delegation on a given validator_\n- `query_delegator_validators(delegator)` _queries the validators of a delegator_\n- `query_withdraw_address(delegator)` _queries withdraw address of a delegator_\n- `query_commission(validator)` _queries accumulated commission for a validator_\n- `query_outstanding_rewards(validator)` _queries rewards of a validator address_\n\n## Governance Queries\n- `query_proposals()` _queries all the proposals_\n- `query_proposal_by_id(id)` _queries a specific proposal by a given id (accepts both string or integers)_\n- `query_tally(id)` _queries tally of a proposal by a given id (accepts both string or integers)_\n- `query_votes(id)` _queries votes for a specific proposal by a given id (accepts both string or integers)_\n- `query_votes_by_address(id, address)` _queries votes for a specific proposal from a given address (accepts both string or integers)_\n\n## Slashing Queries\n- `query_slashing_params()` _queries slashing parameters_\n\n## Staking Queries\n- `query_staking_params()` _queries staking parameters_\n- `query_staking_pool()` _queries staking pool_\n- `query_delegations_by_address(delegator)` _queries all the delegations of a given address_\n- `query_redelegations_by_address(delegator)` _queries all the redelegations of a given address_\n- `query_unbonding_by_address(delegator)` _queries all the unbondings of a given address_\n- `query_delegator_data(delegator)` _queries delegator data of a given address_\n- `query_delegator_data_by_validator(delegator, validator)` _queries delegator data of a given address on a given validator_\n- `query_all_validators()` _queries all the validators_\n- `query_validator_by_address(validator)` _queries data for a given validator_\n- `query_delegators(validator)` _queries all the delegators for a given validator_\n- `query_delegators_by_address(validator, delegator)` _queries a given delegator's data for a given validator_\n- `query_validator_unbonding_by_address)` _queries a given delegator's unbonding data for a given validator_\n- `query_unbonding_from(validator)` _queries all the unbonding of a give validator_\n\n## Mint Queries\n- `query_mint_params()` _queries mint parameters_\n- `query_annual_provisions()` _queries annual provisions_\n- `query_mint_params()` _queries current inflation percentage_\n\n## TX Queries\n- `query_tx(tx_hash)` _queries a given transaction hash_\n\n# RPC Queries\n\n- `query_abci_info()` _queries abci info_\n- `query_block(height)` _queries a given block height_\n- `query_block_results(height)` _queries a given block results by its height_\n- `query_commit(height)` _queries a given commit by its height_\n- `query_consensus_state()` _queries consensus state_\n- `query_dump_consensus_state()` _dumps consensus state_\n- `query_genesis()` _queries the current genesis_\n- `query_net_info()` _queries network info_\n- `query_num_unconfirmed_txs()` _queries the amount of unconfirmed txs_\n- `query_status()` _queries the node status._\n\n\n\n# Examples\n\n#### Initialize the module and print basic info\n```python\nfrom pycosmicwrap import CosmicWrap\n\n# create an object with rest api url, rpc url and denom as arguments\nchihuahua = CosmicWrap(lcd='https://api.chihuahua.wtf',\n rpc='https://rpc.chihuahua.wtf',\n denom='uhuahua')\n\n# Once the module is imported and the object is created we can start using\n# the object to interact with the blockchain\n\n# Let's define an address\nmy_address = 'chihuahua1z6rfp8wzsx87pwt3z73gf2a67d6tgmfrrlzy7p'\n\n# Let's create a variable with your balance\nmy_address_balance = chihuahua.query_balances(my_address)\n\n# or just print it out\nprint(my_address_balance)\n\n# check all of your delegations\nmy_delegations = chihuahua.query_delegations_by_address(my_address)\n\n# and print them out\nprint(my_delegations)\n\n# check all of your staking rewards\nprint(chihuahua.query_rewards(my_address))\n\n```\n\n\n# Donate\nWe don't seek for donations, but you can say Thank You for our work by [delegating to our validators](https://delegate.chihuahua.wtf) and by [sharing this project on Twitter](https://twitter.com/intent/tweet?text=Check%20out%20%23pyCosmicWrap%20%F0%9F%8C%AF%20by%20%40ChihuahuaChain%20-%20A%20%23python%20wrapper%20for%20%40cosmos%20on%20https%3A//github.com/ChihuahuaChain/pyCosmicWrap%20%23HUAHUA%20%23Chihuahua%20%23WOOF%0A)\n\n# License\nChihuahuaChain/pyCosmicWrap is licensed under the [GNU General Public License v3.0](https://choosealicense.com/licenses/gpl-3.0/)\n",
"bugtrack_url": null,
"license": "GNU General Public License v3.0",
"summary": "pyCosmicWrap is a Cosmos API/RPC python Wrapper by ChihuahuaChain",
"version": "0.1.4",
"split_keywords": [
"chihuahua",
"chihuahuachain",
"cosmos",
"cosmosecosystem",
"pycosmicwrap",
"wrapper"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "310a55eff53b8d32e2761c3e3f713cbc65ab37c4624ee197207934d41c599999",
"md5": "edf71d1a22a6a12588b253d2032fb719",
"sha256": "43bf95e6d9ac1424178deefac0ff0bfa5f8fab5160035f140ea6833707cb1bd0"
},
"downloads": -1,
"filename": "pycosmicwrap-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "edf71d1a22a6a12588b253d2032fb719",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 17947,
"upload_time": "2023-01-25T23:50:50",
"upload_time_iso_8601": "2023-01-25T23:50:50.743262Z",
"url": "https://files.pythonhosted.org/packages/31/0a/55eff53b8d32e2761c3e3f713cbc65ab37c4624ee197207934d41c599999/pycosmicwrap-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "24cdc105882fbe289a00dfe96dac8a07ddd76f5f4835df66642dd19a5d2d795b",
"md5": "bce65d7bb6c125ed2fadcd3a6c9d68cb",
"sha256": "a22ad83f8e1da3c62f3dc690af015b6ebefdaccc14aacefd90273da8572269dd"
},
"downloads": -1,
"filename": "pycosmicwrap-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "bce65d7bb6c125ed2fadcd3a6c9d68cb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 19136,
"upload_time": "2023-01-25T23:50:52",
"upload_time_iso_8601": "2023-01-25T23:50:52.954382Z",
"url": "https://files.pythonhosted.org/packages/24/cd/c105882fbe289a00dfe96dac8a07ddd76f5f4835df66642dd19a5d2d795b/pycosmicwrap-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-25 23:50:52",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "pycosmicwrap"
}