-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
312 changed files
with
20,496 additions
and
120,224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM bufbuild/buf:latest as BUILDER | ||
|
||
RUN apk add --no-cache \ | ||
nodejs \ | ||
npm \ | ||
git \ | ||
make | ||
|
||
RUN npm install -g ts-proto | ||
|
||
COPY --from=BUILDER /usr/local/bin /usr/local/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: v1 | ||
plugins: | ||
- name: ts_proto | ||
out: ../client | ||
strategy: all | ||
opt: esModuleInterop=true,forceLong=string,useOptionals=messages,snakeToCamel=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: v1 | ||
plugins: | ||
- name: ts_proto | ||
out: ../lcd | ||
strategy: all | ||
opt: esModuleInterop=true,forceLong=string,useOptionals=messages,snakeToCamel=false,stringEnums=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
cd proto | ||
buf generate | ||
cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
syntax = "proto3"; | ||
|
||
// Add imports here to generate the types from cosmos-sdk or any other proto files that you need | ||
|
||
import "cosmos/gov/v1/tx.proto"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,48 @@ | ||
#!/bin/bash | ||
rm -rf temp | ||
mkdir temp | ||
|
||
# Variables | ||
KYVE_CHAIN_REPO="[email protected]:KYVENetwork/chain.git" | ||
KYVE_CHAIN_VERSION="v1.3.0" | ||
git -C ./temp clone -b ${KYVE_CHAIN_VERSION} --single-branch ${KYVE_CHAIN_REPO} | ||
rm -rf ./src/client | ||
rm -rf ./src/lcd | ||
mkdir ./src/client | ||
mkdir ./src/lcd | ||
# generate TypeScript proto | ||
PROTO_DIR="../../node_modules/@protobufs" | ||
PROTOC_GEN_TS_PROTO_PATH="./node_modules/.bin/protoc-gen-ts_proto" | ||
OUT_DIR="./src/client" | ||
KYVE_PROTO='./temp/chain/proto' | ||
protoc --plugin="protoc-gen-ts_proto=${PROTOC_GEN_TS_PROTO_PATH}" \ | ||
--ts_proto_out="${OUT_DIR}" \ | ||
--ts_proto_opt="esModuleInterop=true,forceLong=string,useOptionals=messages,snakeToCamel=false" \ | ||
--proto_path="$PROTO_DIR" \ | ||
--proto_path="$KYVE_PROTO" \ | ||
$(find ${PROTO_DIR} -path -prune -o -name '*.proto' -print0 | xargs -0) \ | ||
$(find ${KYVE_PROTO} -path -prune -o -name '*.proto' -print0 | xargs -0) | ||
|
||
OUT_DIR_RES="./src/lcd" | ||
|
||
protoc --plugin="protoc-gen-ts_proto=${PROTOC_GEN_TS_PROTO_PATH}" \ | ||
--ts_proto_out="${OUT_DIR_RES}" \ | ||
--ts_proto_opt="esModuleInterop=true,forceLong=string,useOptionals=messages,snakeToCamel=false,stringEnums=true" \ | ||
--proto_path="$PROTO_DIR" \ | ||
--proto_path="$KYVE_PROTO" \ | ||
$(find ${PROTO_DIR} -path -prune -o -name '*.proto' -print0 | xargs -0) \ | ||
$(find ${KYVE_PROTO} -path -prune -o -name '*.proto' -print0 | xargs -0) | ||
rm -rf temp | ||
|
||
echo "Cloning chain repo version ${KYVE_CHAIN_VERSION}" | ||
mkdir -p ./tmp | ||
git -C ./tmp clone -b ${KYVE_CHAIN_VERSION} --single-branch ${KYVE_CHAIN_REPO} | ||
|
||
# Setup protobuf docker image and build proto files | ||
cd tmp/chain | ||
cp ../../buf/Dockerfile ./proto/Dockerfile | ||
cp ../../buf/generate.sh ./proto/generate.sh | ||
cp ../../buf/proto/import.proto ./proto/kyve/import.proto | ||
make proto-setup | ||
|
||
# Generate lcd proto files | ||
echo "Generating proto files for lcd" | ||
cp ../../buf/buf.gen.lcd.yaml ./proto/buf.gen.yaml | ||
docker run --rm --volume "$(pwd)":/workspace --workdir /workspace kyve-proto sh ./proto/generate.sh | ||
|
||
# Generate client proto files | ||
echo "Generating proto files for client" | ||
cp ../../buf/buf.gen.client.yaml ./proto/buf.gen.yaml | ||
docker run --rm --volume "$(pwd)":/workspace --workdir /workspace kyve-proto sh ./proto/generate.sh | ||
|
||
# Cleanup src folder | ||
cd ../../ | ||
rm -rf ./src/* | ||
|
||
# Copy generated files to src folder | ||
cp -r tmp/chain/lcd ./src | ||
cp -r tmp/chain/client ./src | ||
|
||
# Delete some files that cause problems (we don't need them anyway) | ||
rm -rf ./src/lcd/google/protobuf/descriptor.ts | ||
rm -rf ./src/lcd/kyve/import.ts | ||
rm -rf ./src/client/google/protobuf/descriptor.ts | ||
rm -rf ./src/client/kyve/import.ts | ||
|
||
# Set version | ||
echo "export const version = \"${KYVE_CHAIN_VERSION}\"" > ./src/version.ts | ||
git add ./src | ||
|
||
# Cleanup | ||
rm -rf ./tmp | ||
|
||
git add ./src |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.