Skip to main content

pyCosmicWrap is a Cosmos API/RPC python Wrapper by ChihuahuaChain

Project description

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
  • Add Osmosis specific endpoints
  • Publish on PyPi
  • Integrate Mospy by ctrl-Felix

Installation

You can install this module with python -m pip install pyCosmicWrap

Bank Queries

  • query_balances(address) queries the balance of all coins for a single account
  • query_balances_by_udenom(address, udenom) queries the balance of a single coin for a single account.
  • query_supply() queries the total supply of all coins.
  • query_supply_by_udenom(udenom) 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

Examples

Initialize the module and print basic info

from pyCosmicWrap import CosmicWrap

# create an object with rest api url, rpc url and udenom as arguments
chihuahua = CosmicWrap(lcd='https://api.chihuahua.wtf',
                       rpc='https://rpc.chihuahua.wtf',
                       udenom='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_balance(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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycosmicwrap-0.1.1.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

pycosmicwrap-0.1.1-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file pycosmicwrap-0.1.1.tar.gz.

File metadata

  • Download URL: pycosmicwrap-0.1.1.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for pycosmicwrap-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6393f040f6aef108e224dbc2bff6e533b59e88295eff706be6e4b5fb04b7055e
MD5 6380fe8fb6f0b902d7a95d94c6b7dc26
BLAKE2b-256 7cc2382c4789c817b0401ed75aa168bc5578fc51428b53d1ee3825e66d80f3c2

See more details on using hashes here.

File details

Details for the file pycosmicwrap-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pycosmicwrap-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6d3915c8a73154e25a0d52ca2a90ce0fd58607324f75b5f25003d333f7d716da
MD5 ae2bdfc41bc266767cceee3f92a68947
BLAKE2b-256 7ea8509c33f5c3f6555c512fedf795e135377fae00adcfa643944ba27e2572c1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page