Skip to main content

pyCosmicWrap 🌯

A python3 wrapper around Cosmos API/RPC brought to you by ChihuahuaChain

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 in order to be able to create and broadcast transactions as well.

  • Wrap main default API endpoints
  • Wrap main RPC endpoints
  • Published on PyPi
  • Add Osmosis specific endpoints
  • Integrate Mospy by ctrl-Felix

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

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 and by sharing this project on Twitter

License

ChihuahuaChain/pyCosmicWrap is licensed under the GNU General Public License v3.0

Metadata

Release files for pyCosmicWrap 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyCosmicWrap 0.1.4
File Size Uploaded Provenance Actions
pycosmicwrap-0.1.4.tar.gz 19.1 kB Without provenance Details for pycosmicwrap-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyCosmicWrap 0.1.4
File Interpreter ABI Platform Actions
pycosmicwrap-0.1.4-py3-none-any.whl Python 3 none any Details for pycosmicwrap-0.1.4-py3-none-any.whl

Total release size: 37.1 kB

Release files / pycosmicwrap-0.1.4.tar.gz

Download URL pycosmicwrap-0.1.4.tar.gz
Size 19.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a22ad83f8e1da3c62f3dc690af015b6ebefdaccc14aacefd90273da8572269dd
BLAKE2b-256 checksum
How to use checksums
24cdc105882fbe289a00dfe96dac8a07ddd76f5f4835df66642dd19a5d2d795b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.7

Release files / pycosmicwrap-0.1.4-py3-none-any.whl

Download URL pycosmicwrap-0.1.4-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
43bf95e6d9ac1424178deefac0ff0bfa5f8fab5160035f140ea6833707cb1bd0
BLAKE2b-256 checksum
How to use checksums
310a55eff53b8d32e2761c3e3f713cbc65ab37c4624ee197207934d41c599999
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.7

Security for pyCosmicWrap 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page