cosmpy.cosmwasm package — cosmpy documentation

# cosmpy.cosmwasm package

## Submodules

## cosmpy.cosmwasm.interface module

Interface for the Wasm functionality of CosmosSDK.

class cosmpy.cosmwasm.interface.CosmWasm

  Bases: `abc.ABC`

  Wasm abstract class.

  abstract AllContractState(request: cosmwasm.wasm.v1beta1.query_pb2.QueryAllContractStateRequest) → cosmwasm.wasm.v1beta1.query_pb2.QueryAllContractStateResponse

    Gets all raw store data for a single contract

    Parameters

      request – QueryAllContractStateRequest

    Returns

      QueryAllContractStateResponse

  abstract Code(request: cosmwasm.wasm.v1beta1.query_pb2.QueryCodeRequest) → cosmwasm.wasm.v1beta1.query_pb2.QueryCodeResponse

    Gets the binary code and metadata for a singe wasm code

    Parameters

      request – QueryCodeRequest

    Returns

      QueryCodeResponse

  abstract Codes(request: cosmwasm.wasm.v1beta1.query_pb2.QueryCodesRequest) → cosmwasm.wasm.v1beta1.query_pb2.QueryCodesResponse

    Gets the metadata for all stored wasm codes

    Parameters

      request – QueryCodesRequest

    Returns

      QueryCodesResponse

  abstract ContractHistory(request: cosmwasm.wasm.v1beta1.query_pb2.QueryContractHistoryRequest) → cosmwasm.wasm.v1beta1.query_pb2.QueryContractHistoryResponse

    Gets the contract code history

    Parameters

      request – QueryContractHistoryRequest

    Returns

      QueryContractHistoryResponse

  abstract ContractInfo(request: cosmwasm.wasm.v1beta1.query_pb2.QueryContractInfoRequest) → cosmwasm.wasm.v1beta1.query_pb2.QueryContractInfoResponse

    Gets the contract meta data

    Parameters

      request – QueryContractInfoRequest

    Returns

      QueryContractInfoResponse

  abstract ContractsByCode(request: cosmwasm.wasm.v1beta1.query_pb2.QueryContractsByCodeRequest) → cosmwasm.wasm.v1beta1.query_pb2.QueryContractsByCodeResponse

    Lists all smart contracts for a code id

    Parameters

      request – QueryContractsByCodeRequest

    Returns

      QueryContractsByCodeResponse

  abstract RawContractState(request: cosmwasm.wasm.v1beta1.query_pb2.QueryRawContractStateRequest) → cosmwasm.wasm.v1beta1.query_pb2.QueryRawContractStateResponse

    Gets single key from the raw store data of a contract

    Parameters

      request – QueryRawContractStateRequest

    Returns

      QueryRawContractStateResponse

  abstract SmartContractState(request: cosmwasm.wasm.v1beta1.query_pb2.QuerySmartContractStateRequest) → cosmwasm.wasm.v1beta1.query_pb2.QuerySmartContractStateResponse

    Get smart query result from the contract

    Parameters

      request – QuerySmartContractStateRequest

    Returns

      QuerySmartContractStateResponse

## cosmpy.cosmwasm.rest_client module

Implementation of Wasm interface using REST.

class cosmpy.cosmwasm.rest_client.CosmWasmRestClient(rest_api: cosmpy.common.rest_client.RestClient)

  Bases: `cosmpy.cosmwasm.interface.CosmWasm`

  Wasm REST client.

  API_URL = '/wasm/v1beta1'
  AllContractState(request: cosmwasm.wasm.v1beta1.query_pb2.QueryAllContractStateRequest) → cosmwasm.wasm.v1beta1.query_pb2.QueryAllContractStateResponse

    Gets all raw store data for a single contract

    Parameters

      request – QueryAllContractStateRequest

    Returns

      QueryAllContractStateResponse

  Code(request: cosmwasm.wasm.v1beta1.query_pb2.QueryCodeRequest) → cosmwasm.wasm.v1beta1.query_pb2.QueryCodeResponse

    Gets the binary code and metadata for a singe wasm code

    Parameters

      request – QueryCodeRequest

    Returns

      QueryCodeResponse

  Codes(request: cosmwasm.wasm.v1beta1.query_pb2.QueryCodesRequest) → cosmwasm.wasm.v1beta1.query_pb2.QueryCodesResponse

    Gets the metadata for all stored wasm codes

    Parameters

      request – QueryCodesRequest

    Returns

      QueryCodesResponse

  ContractHistory(request: cosmwasm.wasm.v1beta1.query_pb2.QueryContractHistoryRequest) → cosmwasm.wasm.v1beta1.query_pb2.QueryContractHistoryResponse

    Gets the contract code history

    Parameters

      request – QueryContractHistoryRequest

    Returns

      QueryContractHistoryResponse

  ContractInfo(request: cosmwasm.wasm.v1beta1.query_pb2.QueryContractInfoRequest) → cosmwasm.wasm.v1beta1.query_pb2.QueryContractInfoResponse

    Gets the contract meta data

    Parameters

      request – QueryContractInfoRequest

    Returns

      QueryContractInfoResponse

  ContractsByCode(request: cosmwasm.wasm.v1beta1.query_pb2.QueryContractsByCodeRequest) → cosmwasm.wasm.v1beta1.query_pb2.QueryContractsByCodeResponse

    Lists all smart contracts for a code id

    Parameters

      request – QueryContractsByCodeRequest

    Returns

      QueryContractsByCodeResponse

  RawContractState(request: cosmwasm.wasm.v1beta1.query_pb2.QueryRawContractStateRequest) → cosmwasm.wasm.v1beta1.query_pb2.QueryRawContractStateResponse

    Gets single key from the raw store data of a contract

    Parameters

      request – QueryRawContractStateRequest

    Returns

      QueryRawContractStateResponse

  SmartContractState(request: cosmwasm.wasm.v1beta1.query_pb2.QuerySmartContractStateRequest) → cosmwasm.wasm.v1beta1.query_pb2.QuerySmartContractStateResponse

    Get smart query result from the contract

    Parameters

      request – QuerySmartContractStateRequest

    Returns

      QuerySmartContractStateResponse

## Module contents