Skip to content

Latest commit

 

History

History
102 lines (81 loc) · 2.45 KB

DEVELOPING.md

File metadata and controls

102 lines (81 loc) · 2.45 KB

Generate python types from Cosmos-SDK protobuf schemas

Fetch Cosmos-SDK protobuf schema files

NOTE: When updating to a different version of the Cosmos SDK (see the version currently used under COSMOS_SDK_VERSION in Makefile), you will need to perform this step once to fetch the relevant protobuf schema files:

make fetch_proto_schema_source

NOTE: For this library to be functional, only the python types generated from protobuf schemas are required, not the schema files themselves. The schema files are fetched on-demand only to enable the generation of python types. Therefore, the schema files are intentionally stored as local files and are NOT checked in to this repository to minimise its filesystem footprint.

Generate python types

make generate_proto_types

Setup a local Stargate node

Preliminaries

You require Go version 15.0 or higher for your platform (see here)

Setup a node

  • Setup FetchD

    bash scripts/setup_fetchd.sh

    The script will ask for root permissions while setting up a node.

  • Start the node

    fetchd start

Examples

Preliminaries

  • Install the package from source:

    pipenv install
  • or in development mode:

    pipenv install --dev
  • Launch a virtual environment

    pipenv shell

Run Examples

  • Query balance example using REST api

    python src/examples/query_balance_rest_example.py
  • Send funds transaction example

    • Using gRPC
      python src/examples/tx_send_grpc_example.py
    • Using REST api
      python src/examples/tx_send_rest_example.py
  • Contract deployment and interaction example

    • Using gRPC
      python src/examples/contract_interaction_grpc_example.py
    • Using REST api
      python src/examples/contract_interaction_rest_example.py
  • Native tokens atomic swap example

    • Using gRPC
      python src/examples/tx_native_tokens_atomic_swap_grpc_example.py
    • Using REST api
      python src/examples/tx_native_tokens_atomic_swap_rest_example.py
  • Atomic swap using ERC1155 contract example

    • Using gRPC
      python src/examples/atomic_swap_contract_grpc_example.py
    • Using REST api
      python src/examples/atomic_swap_contract_rest_example.py