Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 14 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,45 +1,40 @@
all:
all: gen

gen: gen-client

gen-client: clone-all copy-proto
gen-client:
mkdir -p ./pyinjective/proto
buf generate --template buf.gen.yaml
rm -rf proto
$(call clean_repos)
$(MAKE) fix-generated-proto-imports
$(MAKE) fix-generated-proto-imports-1

PROTO_MODULES := cosmwasm exchange gogoproto cosmos_proto cosmos testpb ibc amino tendermint injective
PROTO_MODULES := cosmwasm gogoproto cosmos_proto cosmos testpb ibc amino tendermint injective

fix-generated-proto-imports:
fix-generated-proto-imports-1:
@touch pyinjective/proto/__init__.py
@for module in $(PROTO_MODULES); do \
find ./pyinjective/proto -type f -name "*.py" -exec sed -i "" -e "s/from $${module}/from pyinjective.proto.$${module}/g" {} \; ; \
find ./pyinjective/proto -type f -name "*.py" -exec sed -i "s/from $${module}/from pyinjective.proto.$${module}/g" {} \; ; \
done
@find ./pyinjective/proto -type f -name "*.py" -exec sed -i "s/from google.api/from pyinjective.proto.google.api/g" {} \;
fix-generated-proto-imports:
@echo "Listing all Python files in pyinjective/proto:"
@find ./pyinjective/proto -type f -name "*.py" -ls
@echo "\nModules that will be processed:"
@for module in $(PROTO_MODULES); do \
echo "$$module"; \
done
@find ./pyinjective/proto -type f -name "*.py" -exec sed -i "" -e "s/from google.api/from pyinjective.proto.google.api/g" {} \;

define clean_repos
rm -Rf cosmos-sdk
rm -Rf ibc-go
rm -Rf cometbft
rm -Rf wasmd
rm -Rf injective-core
rm -Rf injective-indexer
endef

clean-all:
$(call clean_repos)

clone-injective-indexer:
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.13.4 --depth 1 --single-branch

clone-all: clone-injective-indexer

copy-proto:
rm -rf pyinjective/proto
mkdir -p proto/exchange
find ./injective-indexer/api/gen/grpc -type f -name "*.proto" -exec cp {} ./proto/exchange/ \;

tests:
poetry run pytest -v

Expand Down
7 changes: 4 additions & 3 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ inputs:
# - git_repo: https://github.com/InjectiveLabs/wasmd
# branch: v0.51.x-inj
# subdir: proto
- git_repo: https://github.com/InjectiveLabs/injective-core
tag: v1.13.0
- git_repo: https://github.com/enigmarikki/injective-core
#tag: v1.13.2
branch: master
subdir: proto
# - git_repo: https://github.com/InjectiveLabs/injective-core
# branch: master
# subdir: proto
- directory: proto
#- directory: proto
1,515 changes: 900 additions & 615 deletions poetry.lock

Large diffs are not rendered by default.

Loading
Loading