Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proto files moved to a separate proto module. #42

Merged
merged 33 commits into from
Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b34d393
Proto files moved to a separate proto module.
panasevychol Aug 12, 2021
2f7edce
Imports fixed.
panasevychol Aug 12, 2021
7d90930
Imports fixed with isort.
panasevychol Aug 12, 2021
14873f3
Manifest updated.
panasevychol Aug 12, 2021
5e510f9
Mypy ignored Proto module.
panasevychol Aug 12, 2021
c0925ed
Imports fixed.
panasevychol Aug 12, 2021
1795670
Proto imports fixed.
panasevychol Aug 12, 2021
124b483
Package docstring added.
panasevychol Aug 12, 2021
32de8dc
Makefile updated.
panasevychol Aug 12, 2021
0f91d72
chore: restructure and refactor
5A11 Aug 16, 2021
42565b9
fix: examples, manifest, setup.py
5A11 Aug 16, 2021
f040e98
fix: makefile
5A11 Aug 16, 2021
d919cc7
Makefile fi
MissingNO57 Aug 17, 2021
4a4d17e
tox.ini fix
MissingNO57 Aug 17, 2021
08c101d
fix
MissingNO57 Aug 17, 2021
515d8bd
import fixes
MissingNO57 Aug 17, 2021
348f53b
Import fixes
MissingNO57 Aug 17, 2021
5cac6b9
Fixes
MissingNO57 Aug 17, 2021
a66df5c
changes
MissingNO57 Aug 17, 2021
8a2384c
Copyright check
MissingNO57 Aug 17, 2021
52e49a5
copyright checks
MissingNO57 Aug 17, 2021
9d6682d
changes
MissingNO57 Aug 17, 2021
d35842c
Fixes
MissingNO57 Aug 17, 2021
5653d66
More fixes
MissingNO57 Aug 17, 2021
dd7e5ef
fix
MissingNO57 Aug 17, 2021
7878f3f
pylint fix
MissingNO57 Aug 17, 2021
45d0ab4
Copyright setup.py
MissingNO57 Aug 17, 2021
9af6624
comment
MissingNO57 Aug 17, 2021
fa3db0c
setup.py checks
MissingNO57 Aug 17, 2021
0405aee
setup.cfg
MissingNO57 Aug 17, 2021
9097585
module docstring
MissingNO57 Aug 17, 2021
48a57a9
pack fix
MissingNO57 Aug 17, 2021
c9f1237
Piplock update
MissingNO57 Aug 17, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ build/

# Tox files
.tox

.DS_Store
*/.DS_Store
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ recursive-include contracts *.wasm
recursive-include examples *.py
recursive-include scripts *.py
recursive-include scripts *.sh
recursive-include src *.py
recursive-include pycosm *.py
recursive-include tests *.py
recursive-include tests *.wasm
27 changes: 14 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ WASMD_VERSION := v0.16.0
COSMOS_PROTO_RELATIVE_DIRS := proto third_party/proto
WASMD_PROTO_RELATIVE_DIRS := proto
SOURCES_REGEX_TO_EXCLUDE := third_party/proto/google/.*
OUTPUT_FOLDER := src
PYCOSM_SRC_DIR := src/cosm
OUTPUT_FOLDER := pycosm/protos
PYCOSM_SRC_DIRS := pycosm/auth pycosm/bank pycosm/clients pycosm/common pycosm/crypto pycosm/staking pycosm/tx pycosm/wasm
MissingNO57 marked this conversation as resolved.
Show resolved Hide resolved

PYCOSM_TESTS_DIR := tests
PYCOSM_EXAMPLES_DIR := examples

Expand Down Expand Up @@ -77,27 +78,27 @@ $(WASMD_DIR): Makefile

.PHONY: black-check
black-check:
black --check --verbose $(PYCOSM_SRC_DIR) $(PYCOSM_TESTS_DIR) $(PYCOSM_EXAMPLES_DIR)
black --check --verbose $(PYCOSM_SRC_DIRS) $(PYCOSM_TESTS_DIR) $(PYCOSM_EXAMPLES_DIR)

.PHONY: isort-check
isort-check:
isort --check-only --verbose $(PYCOSM_SRC_DIR) $(PYCOSM_TESTS_DIR) $(PYCOSM_EXAMPLES_DIR)
isort --check-only --verbose $(PYCOSM_SRC_DIRS) $(PYCOSM_TESTS_DIR) $(PYCOSM_EXAMPLES_DIR)

.PHONY: flake
flake:
flake8 $(PYCOSM_SRC_DIR) $(PYCOSM_TESTS_DIR) $(PYCOSM_EXAMPLES_DIR)
flake8 $(PYCOSM_SRC_DIRS) $(PYCOSM_TESTS_DIR) $(PYCOSM_EXAMPLES_DIR)

.PHONY: vulture
vulture:
vulture $(PYCOSM_SRC_DIR) $(PYCOSM_TESTS_DIR) $(PYCOSM_EXAMPLES_DIR) --exclude "*_pb2.py"
vulture $(PYCOSM_SRC_DIRS) $(PYCOSM_TESTS_DIR) $(PYCOSM_EXAMPLES_DIR) --exclude "*_pb2.py"

####################
### Security & Safety
####################

.PHONY: bandit
bandit:
bandit -r $(PYCOSM_SRC_DIR) $(PYCOSM_TESTS_DIR) --skip B101
bandit -r $(PYCOSM_SRC_DIRS) $(PYCOSM_TESTS_DIR) --skip B101
bandit -r $(PYCOSM_EXAMPLES_DIR) --skip B101,B105

.PHONY: safety
Expand All @@ -110,11 +111,11 @@ safety:

.PHONY: mypy
mypy:
mypy $(PYCOSM_SRC_DIR) $(PYCOSM_TESTS_DIR) $(PYCOSM_EXAMPLES_DIR)
mypy $(PYCOSM_SRC_DIRS) $(PYCOSM_TESTS_DIR) $(PYCOSM_EXAMPLES_DIR)

.PHONY: pylint
pylint:
pylint $(PYCOSM_SRC_DIR) $(PYCOSM_TESTS_DIR) $(PYCOSM_EXAMPLES_DIR)
pylint $(PYCOSM_SRC_DIRS) $(PYCOSM_TESTS_DIR) $(PYCOSM_EXAMPLES_DIR)

####################
### Tests
Expand Down Expand Up @@ -142,10 +143,10 @@ copyright-check:

.PHONY: lint
lint:
black $(PYCOSM_SRC_DIR) $(PYCOSM_TESTS_DIR) $(PYCOSM_EXAMPLES_DIR)
isort $(PYCOSM_SRC_DIR) $(PYCOSM_TESTS_DIR) $(PYCOSM_EXAMPLES_DIR)
flake8 $(PYCOSM_SRC_DIR) $(PYCOSM_TESTS_DIR) $(PYCOSM_EXAMPLES_DIR)
vulture $(PYCOSM_SRC_DIR) $(PYCOSM_TESTS_DIR) $(PYCOSM_EXAMPLES_DIR) --exclude "*_pb2.py"
black $(PYCOSM_SRC_DIRS) $(PYCOSM_TESTS_DIR) $(PYCOSM_EXAMPLES_DIR)
isort $(PYCOSM_SRC_DIRS) $(PYCOSM_TESTS_DIR) $(PYCOSM_EXAMPLES_DIR)
flake8 $(PYCOSM_SRC_DIRS) $(PYCOSM_TESTS_DIR) $(PYCOSM_EXAMPLES_DIR)
vulture $(PYCOSM_SRC_DIRS) $(PYCOSM_TESTS_DIR) $(PYCOSM_EXAMPLES_DIR) --exclude "*_pb2.py"

.PHONY: check
check:
Expand Down
4 changes: 2 additions & 2 deletions examples/atomic_swap_contract_grpc_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

from grpc import insecure_channel

from cosm.clients.signing_cosmwasm_client import SigningCosmWasmClient
from cosm.crypto.keypairs import PrivateKey
from pycosm.clients.signing_cosmwasm_client import SigningCosmWasmClient
from pycosm.crypto.keypairs import PrivateKey

# ID and amount of tokens to be minted in contract
TOKEN_ID_1 = "1234"
Expand Down
6 changes: 3 additions & 3 deletions examples/atomic_swap_contract_rest_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import inspect
import os

from cosm.clients.signing_cosmwasm_client import SigningCosmWasmClient
from cosm.common.rest_client import RestClient
from cosm.crypto.keypairs import PrivateKey
from pycosm.clients.signing_cosmwasm_client import SigningCosmWasmClient
from pycosm.common.rest_client import RestClient
from pycosm.crypto.keypairs import PrivateKey

# ID and amount of tokens to be minted in contract
TOKEN_ID_1 = "1234"
Expand Down
4 changes: 2 additions & 2 deletions examples/contract_interaction_grpc_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

from grpc import insecure_channel

from cosm.clients.signing_cosmwasm_client import SigningCosmWasmClient
from cosm.crypto.keypairs import PrivateKey
from pycosm.clients.signing_cosmwasm_client import SigningCosmWasmClient
from pycosm.crypto.keypairs import PrivateKey

# ID and amount of tokens to be minted in contract
TOKEN_ID = "1234"
Expand Down
6 changes: 3 additions & 3 deletions examples/contract_interaction_rest_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import inspect
import os

from cosm.clients.signing_cosmwasm_client import SigningCosmWasmClient
from cosm.common.rest_client import RestClient
from cosm.crypto.keypairs import PrivateKey
from pycosm.clients.signing_cosmwasm_client import SigningCosmWasmClient
from pycosm.common.rest_client import RestClient
from pycosm.crypto.keypairs import PrivateKey

# ID and amount of tokens to be minted in contract
TOKEN_ID = "1234"
Expand Down
4 changes: 2 additions & 2 deletions examples/query_balance_rest_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

"""REST example of query balance."""

from cosm.bank.rest_client import BankRestClient, QueryBalanceRequest
from cosm.common.rest_client import RestClient
from pycosm.bank.rest_client import BankRestClient, QueryBalanceRequest
from pycosm.common.rest_client import RestClient

REST_URL = "http:https://127.0.0.1:1317"
ADDRESS = "fetch1mrf5yyjnnlpy0egvpk2pvjdk9667j2gtu8kpfy"
Expand Down
6 changes: 3 additions & 3 deletions examples/tx_native_tokens_atomic_swap_grpc_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

from grpc import insecure_channel

from cosm.clients.signing_cosmwasm_client import SigningCosmWasmClient
from cosm.crypto.keypairs import PrivateKey
from cosmos.base.v1beta1.coin_pb2 import Coin
from pycosm.clients.signing_cosmwasm_client import SigningCosmWasmClient
from pycosm.crypto.keypairs import PrivateKey
from pycosm.protos.cosmos.base.v1beta1.coin_pb2 import Coin

# Denomination and amount of transferred tokens
DENOM_1 = "stake"
Expand Down
8 changes: 4 additions & 4 deletions examples/tx_native_tokens_atomic_swap_rest_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

""" REST example of native tokens atomic swap """

from cosm.clients.signing_cosmwasm_client import SigningCosmWasmClient
from cosm.common.rest_client import RestClient
from cosm.crypto.keypairs import PrivateKey
from cosmos.base.v1beta1.coin_pb2 import Coin
from pycosm.clients.signing_cosmwasm_client import SigningCosmWasmClient
from pycosm.common.rest_client import RestClient
from pycosm.crypto.keypairs import PrivateKey
from pycosm.protos.cosmos.base.v1beta1.coin_pb2 import Coin

# Denomination and amount of transferred tokens
DENOM_1 = "stake"
Expand Down
6 changes: 3 additions & 3 deletions examples/tx_send_grpc_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

from grpc import insecure_channel

from cosm.clients.signing_cosmwasm_client import SigningCosmWasmClient
from cosm.crypto.keypairs import PrivateKey
from cosmos.base.v1beta1.coin_pb2 import Coin
from pycosm.clients.signing_cosmwasm_client import SigningCosmWasmClient
from pycosm.crypto.keypairs import PrivateKey
from pycosm.protos.cosmos.base.v1beta1.coin_pb2 import Coin

# Denomination and amount of transferred tokens
DENOM = "stake"
Expand Down
8 changes: 4 additions & 4 deletions examples/tx_send_rest_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

""" REST example of sending and querying funds """

from cosm.clients.signing_cosmwasm_client import SigningCosmWasmClient
from cosm.common.rest_client import RestClient
from cosm.crypto.keypairs import PrivateKey
from cosmos.base.v1beta1.coin_pb2 import Coin
from pycosm.clients.signing_cosmwasm_client import SigningCosmWasmClient
from pycosm.common.rest_client import RestClient
from pycosm.crypto.keypairs import PrivateKey
from pycosm.protos.cosmos.base.v1beta1.coin_pb2 import Coin

# Denomination and amount of transferred tokens
DENOM = "stake"
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/cosm/auth/interface.py → pycosm/auth/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from abc import ABC, abstractmethod

from cosmos.auth.v1beta1.query_pb2 import (
from pycosm.protos.cosmos.auth.v1beta1.query_pb2 import (
QueryAccountRequest,
QueryAccountResponse,
QueryParamsRequest,
Expand Down
6 changes: 3 additions & 3 deletions src/cosm/auth/rest_client.py → pycosm/auth/rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

from google.protobuf.json_format import Parse

from cosm.auth.interface import Auth
from cosm.common.rest_client import RestClient
from cosmos.auth.v1beta1.query_pb2 import (
from pycosm.auth.interface import Auth
from pycosm.common.rest_client import RestClient
from pycosm.protos.cosmos.auth.v1beta1.query_pb2 import (
QueryAccountRequest,
QueryAccountResponse,
QueryParamsRequest,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/cosm/bank/interface.py → pycosm/bank/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from abc import ABC, abstractmethod

from cosmos.bank.v1beta1.query_pb2 import (
from pycosm.protos.cosmos.bank.v1beta1.query_pb2 import (
QueryAllBalancesRequest,
QueryAllBalancesResponse,
QueryBalanceRequest,
Expand Down
6 changes: 3 additions & 3 deletions src/cosm/bank/rest_client.py → pycosm/bank/rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

from google.protobuf.json_format import Parse

from cosm.bank.interface import Bank
from cosm.common.rest_client import RestClient
from cosmos.bank.v1beta1.query_pb2 import (
from pycosm.bank.interface import Bank
from pycosm.common.rest_client import RestClient
from pycosm.protos.cosmos.bank.v1beta1.query_pb2 import (
QueryAllBalancesRequest,
QueryAllBalancesResponse,
QueryBalanceRequest,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,24 @@

from grpc._channel import Channel

from cosm.auth.rest_client import AuthRestClient
from cosm.bank.rest_client import BankRestClient
from cosm.common.rest_client import RestClient
from cosm.common.types import JSONLike
from cosm.crypto.address import Address
from cosm.wasm.rest_client import WasmRestClient
from cosmos.auth.v1beta1.auth_pb2 import BaseAccount
from cosmos.auth.v1beta1.query_pb2 import QueryAccountRequest
from cosmos.auth.v1beta1.query_pb2_grpc import QueryStub as AuthGrpcClient
from cosmos.bank.v1beta1.query_pb2 import QueryBalanceRequest, QueryBalanceResponse
from cosmos.bank.v1beta1.query_pb2_grpc import QueryStub as BankGrpcClient
from cosmwasm.wasm.v1beta1.query_pb2 import QuerySmartContractStateRequest
from cosmwasm.wasm.v1beta1.query_pb2_grpc import QueryStub as CosmWasmGrpcClient
from pycosm.auth.rest_client import AuthRestClient
from pycosm.bank.rest_client import BankRestClient
from pycosm.common.rest_client import RestClient
from pycosm.common.types import JSONLike
from pycosm.crypto.address import Address
from pycosm.protos.cosmos.auth.v1beta1.auth_pb2 import BaseAccount
from pycosm.protos.cosmos.auth.v1beta1.query_pb2 import QueryAccountRequest
from pycosm.protos.cosmos.auth.v1beta1.query_pb2_grpc import QueryStub as AuthGrpcClient
from pycosm.protos.cosmos.bank.v1beta1.query_pb2 import (
QueryBalanceRequest,
QueryBalanceResponse,
)
from pycosm.protos.cosmos.bank.v1beta1.query_pb2_grpc import QueryStub as BankGrpcClient
from pycosm.protos.cosmwasm.wasm.v1beta1.query_pb2 import QuerySmartContractStateRequest
from pycosm.protos.cosmwasm.wasm.v1beta1.query_pb2_grpc import (
QueryStub as CosmWasmGrpcClient,
)
from pycosm.wasm.rest_client import WasmRestClient


class CosmWasmClient:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,38 @@
from google.protobuf.any_pb2 import Any
from grpc._channel import Channel

from cosm.clients.cosmwasm_client import CosmWasmClient
from cosm.common.rest_client import RestClient
from cosm.common.types import JSONLike
from cosm.crypto.address import Address
from cosm.crypto.keypairs import PrivateKey
from cosm.tx import sign_transaction
from cosm.tx.rest_client import TxRestClient
from cosmos.auth.v1beta1.auth_pb2 import BaseAccount
from cosmos.bank.v1beta1.tx_pb2 import MsgSend
from cosmos.base.v1beta1.coin_pb2 import Coin
from cosmos.crypto.secp256k1.keys_pb2 import PubKey as ProtoPubKey
from cosmos.tx.signing.v1beta1.signing_pb2 import SignMode
from cosmos.tx.v1beta1.service_pb2 import (
from pycosm.clients.cosmwasm_client import CosmWasmClient
from pycosm.common.rest_client import RestClient
from pycosm.common.types import JSONLike
from pycosm.crypto.address import Address
from pycosm.crypto.keypairs import PrivateKey
from pycosm.protos.cosmos.auth.v1beta1.auth_pb2 import BaseAccount
from pycosm.protos.cosmos.bank.v1beta1.tx_pb2 import MsgSend
from pycosm.protos.cosmos.base.v1beta1.coin_pb2 import Coin
from pycosm.protos.cosmos.crypto.secp256k1.keys_pb2 import PubKey as ProtoPubKey
from pycosm.protos.cosmos.tx.signing.v1beta1.signing_pb2 import SignMode
from pycosm.protos.cosmos.tx.v1beta1.service_pb2 import (
BroadcastMode,
BroadcastTxRequest,
GetTxRequest,
GetTxResponse,
)
from cosmos.tx.v1beta1.service_pb2_grpc import ServiceStub as TxGrpcClient
from cosmos.tx.v1beta1.tx_pb2 import AuthInfo, Fee, ModeInfo, SignerInfo, Tx, TxBody
from cosmwasm.wasm.v1beta1.tx_pb2 import (
from pycosm.protos.cosmos.tx.v1beta1.service_pb2_grpc import ServiceStub as TxGrpcClient
from pycosm.protos.cosmos.tx.v1beta1.tx_pb2 import (
AuthInfo,
Fee,
ModeInfo,
SignerInfo,
Tx,
TxBody,
)
from pycosm.protos.cosmwasm.wasm.v1beta1.tx_pb2 import (
MsgExecuteContract,
MsgInstantiateContract,
MsgStoreCode,
)
from pycosm.tx import sign_transaction
from pycosm.tx.rest_client import TxRestClient


class SigningCosmWasmClient(CosmWasmClient):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/cosm/crypto/address.py → pycosm/crypto/address.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

import bech32

from cosm.crypto.hashfuncs import ripemd160, sha256
from cosm.crypto.keypairs import PublicKey
from pycosm.crypto.hashfuncs import ripemd160, sha256
from pycosm.crypto.keypairs import PublicKey

DEFAULT_PREFIX = "fetch"

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/cosm/crypto/keypairs.py → pycosm/crypto/keypairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from ecdsa.curves import Curve
from ecdsa.util import sigencode_string, sigencode_string_canonize

from cosm.crypto.interface import Signer
from pycosm.crypto.interface import Signer


class PublicKey:
Expand Down
2 changes: 2 additions & 0 deletions src/cosm/wasm/__init__.py → pycosm/protos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@
# limitations under the License.
#
# ------------------------------------------------------------------------------

"""This package includes autogenerated implementation of protocol buffer schema files."""
Empty file.
File renamed without changes.
File renamed without changes.
Empty file.
Empty file.
Empty file.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading