-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
gen-proto.sh
executable file
·45 lines (37 loc) · 1.01 KB
/
gen-proto.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
rm -r ./proto
wget https://github.com/bufbuild/buf/releases/download/v1.13.1/buf-Linux-x86_64
sudo chmod 777 ./buf-Linux-x86_64
./buf-Linux-x86_64 export buf.build/cosmos/cosmos-sdk:v0.47.0 --output ./proto
rm ./buf-Linux-x86_64
proto_dirs=$(find ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
proto_files=()
for dir in $proto_dirs; do
proto_files=("${proto_files[@]} $(find "${dir}" -maxdepth 1 -name '*.proto')")
done
npx pbjs \
-o ./src/proto.cjs \
-t static-module \
--force-long \
--keep-case \
--no-create \
--path=./proto/ \
--root="@cosmos-client/core" \
${proto_files[@]}
npx pbjs \
-o ./src/proto.js \
-t static-module \
-w es6 \
--es6 \
--force-long \
--keep-case \
--no-create \
--path=./proto/ \
--root="@cosmos-client/core" \
${proto_files[@]}
npx pbts \
-o ./src/proto.d.ts \
./src/proto.js
echo Edit proto.d.ts to resolve the conflict of tendermint namespace.
echo Require to rename cometbft proto
rm -r ./proto