The Toolset for cyber protocol and cosmos ecosystem
Project description
cyberutils
PyPI Package · GitHub Repository
usage
execute bash query
get bash query result and error
from cyberutils.bash import execute_bash
execute_bash(
bash_command='cyber status --node https://rpc.bostrom.cybernode.ai:443')
get json from bash query result
from cyberutils.bash import get_json_from_bash_query
get_json_from_bash_query(
bash_command='cyber status --node https://rpc.bostrom.cybernode.ai:443')
execute a cosmwasm contract
from cyber_sdk.client.lcd import LCDClient
from cyber_sdk.key.mnemonic import MnemonicKey
from cyberutils.contract import execute_contract
WALLET_SEED = 'rack canyon puzzle grow afford faint heavy kick furnace economy change loop debate tip acquire render rib truth bachelor monster page range wine measure'
CONTRACT_ADDRESS = 'bostrom1nwm9pjmfgmxgc4euyfps05p9pfde8vd4sm8pavy93eu9xquz27dsgyxtml'
# initiate lcd client and wallet
mk = MnemonicKey(mnemonic=WALLET_SEED)
lcd_client = LCDClient(
url='https://lcd.bostrom.cybernode.ai/',
chain_id='bostrom',
prefix='bostrom'
)
wallet = lcd_client.wallet(mk)
# the execution message in a contract must match its schema
execute_msg = {
"transfer" : {
"recipient": "bostrom1xszmhkfjs3s00z2nvtn7evqxw3dtus6yr8e4pw",
"amount": "1000000"
}
}
# execution of a contract
execute_contract(
execute_msgs=[execute_msg],
wallet=wallet,
contract_address=CONTRACT_ADDRESS,
lcd_client=lcd_client,
gas=500_000,
fee_amount=0,
fee_denom='boot',
memo='the first transfer')
execute a graphql query
import pandas as pd
from cyberutils.graphql import execute_graphql
res = await execute_graphql(
request="""
query AllContracts {
contracts(order_by: {tx: desc_nulls_last}) {
address
admin
code_id
creation_time
creator
fees
gas
height
label
tx
}
}
""",
graphql_url='https://index.bostrom.cybernode.ai/v1/graphql')
pd.DataFrame(res['contracts'])
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
cyberutils-0.0.2.tar.gz
(5.0 kB
view details)
Built Distribution
File details
Details for the file cyberutils-0.0.2.tar.gz
.
File metadata
- Download URL: cyberutils-0.0.2.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 355db15c65620a4c0dbfa4f48ad6ea17395bfed9c05f50bf3050d2e68eaa8d3c |
|
MD5 | cd423bce27c8374f2f8cca4a2281f651 |
|
BLAKE2b-256 | 8a1e5c6dbab1abf5d632b1f92de6a63cfa77d2d8bbedd871963e0c8c440103f5 |
Provenance
File details
Details for the file cyberutils-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: cyberutils-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88ea49c0569f87a78663b9ed4d747159932a693c6a9ff9c881d721293f6182b0 |
|
MD5 | d7e15bdc85473655e009364d5f1ad5ce |
|
BLAKE2b-256 | b27147812e740d9b588426f237ada1d5805fcc88338dcd9e104011da8314f779 |