Skip to main content

cyberutils

GitHub Python pip

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

import requests

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)

# an execution message in a contract must match its schema
execute_msg = {
    "transfer" :  {
        "recipient": "bostrom1xszmhkfjs3s00z2nvtn7evqxw3dtus6yr8e4pw",
        "amount": "1000000"
    }
}

# load a contract schema for an execute message validation
contract_schema_json = \
    requests.get(
        url='https://raw.githubusercontent.com/Snedashkovsky/cw-plus/main/contracts/cw20-base/schema/cw20-base.json'
    ).json()

# 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',
    contract_execute_schema=contract_schema_json['execute'],
    memo='the first transfer')

query a cosmwasm contract

from cyberutils.contract import query_contract

query_contract(
    query={
        'get_asset': {
            'chain_name': 'osmosis',
            'base': 'ibc/FE2CD1E6828EC0FAB8AF39BAC45BC25B965BA67CCBC50C13A14BD610B0D1E2C4'
        }
    },
    contract_address='bostrom1w33tanvadg6fw04suylew9akcagcwngmkvns476wwu40fpq36pms92re6u',
    node_lcd_url='https://lcd.bostrom.cybernode.ai'
)

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'])

a query with variable values

import pandas as pd

from cyberutils.graphql import execute_graphql

res = await execute_graphql(
    request="""
        query ContractsCodeID($code_id: bigint) {
            contracts(order_by: {tx: desc_nulls_last}, where: {code_id: {_eq: $code_id}}) {
                address
                admin
                creation_time
                creator
                fees
                gas
                height
                label
                tx
                code_id
            }
        }
        """,
    variable_values={"code_id": "3"},
    graphql_url='https://index.bostrom.cybernode.ai/v1/graphql')

pd.DataFrame(res['contracts'])

get messages with a given address and type

import pandas as pd

from cyberutils.graphql import get_messages_by_address_and_type


res = await get_messages_by_address_and_type(
    address='bostrom1xszmhkfjs3s00z2nvtn7evqxw3dtus6yr8e4pw',
    msg_type='cosmos.bank.v1beta1.MsgSend',
    graphql_url='https://index.bostrom.cybernode.ai/v1/graphql')

pd.DataFrame(res)

Metadata

Release files for cyberutils 0.0.6

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

Source distribution (sdist)

Source distribution for cyberutils 0.0.6
File Size Uploaded Provenance
cyberutils-0.0.6.tar.gz 8.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cyberutils 0.0.6
File Interpreter ABI Platform
cyberutils-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 18.9 kB

Release files / cyberutils-0.0.6.tar.gz

Download URL cyberutils-0.0.6.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
71eb369a5f559fb2118c4fb975231c8e9e2e384e21b414d2da59a6bf11a8a960
BLAKE2b-256 checksum
How to use checksums
dd0541d2543cde70ca609dbd4125c2bbbfc3dd8725fd8832a71c63ff763e3f1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.19

Release files / cyberutils-0.0.6-py3-none-any.whl

Download URL cyberutils-0.0.6-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f48c6f0dd2a124e916816578af0f6cfca5e06bc6294d58dae8f8808ba333b9c9
BLAKE2b-256 checksum
How to use checksums
1cc3ec22fe74e5a7f5d6d7d395e9ae5d696f9ce3a6a42f3eab3099f15b148a79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.19

Security for cyberutils 0.0.6

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