2022-08-12 16:29:27 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# generate grpc definitions
|
|
|
|
cd api/lightning
|
|
|
|
[ -d googleapis ] || git clone https://github.com/googleapis/googleapis.git googleapis
|
2023-04-22 18:54:03 +00:00
|
|
|
|
|
|
|
# LND Lightning proto
|
2022-08-12 16:29:27 +00:00
|
|
|
curl -o lightning.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/lightning.proto
|
|
|
|
python3 -m grpc_tools.protoc --proto_path=googleapis:. --python_out=. --grpc_python_out=. lightning.proto
|
2023-04-22 18:54:03 +00:00
|
|
|
|
|
|
|
# LND Invoices proto
|
2022-08-12 16:29:27 +00:00
|
|
|
curl -o invoices.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/invoicesrpc/invoices.proto
|
|
|
|
python3 -m grpc_tools.protoc --proto_path=googleapis:. --python_out=. --grpc_python_out=. invoices.proto
|
2023-04-22 18:54:03 +00:00
|
|
|
|
|
|
|
# LND Router proto
|
2022-08-12 16:29:27 +00:00
|
|
|
curl -o router.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/routerrpc/router.proto
|
|
|
|
python3 -m grpc_tools.protoc --proto_path=googleapis:. --python_out=. --grpc_python_out=. router.proto
|
|
|
|
|
2023-04-22 18:54:03 +00:00
|
|
|
# LND Versioner proto
|
|
|
|
curl -o verrpc.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/verrpc/verrpc.proto
|
|
|
|
python3 -m grpc_tools.protoc --proto_path=googleapis:. --python_out=. --grpc_python_out=. verrpc.proto
|
|
|
|
|
2023-04-23 21:58:21 +00:00
|
|
|
# delete googleapis
|
|
|
|
rm -r googleapis
|
|
|
|
|
2022-08-12 16:29:27 +00:00
|
|
|
# patch generated files relative imports
|
|
|
|
sed -i 's/^import .*_pb2 as/from . \0/' router_pb2.py
|
|
|
|
sed -i 's/^import .*_pb2 as/from . \0/' invoices_pb2.py
|
2023-04-22 18:54:03 +00:00
|
|
|
sed -i 's/^import .*_pb2 as/from . \0/' verrpc_pb2.py
|
2022-08-12 16:29:27 +00:00
|
|
|
sed -i 's/^import .*_pb2 as/from . \0/' router_pb2_grpc.py
|
|
|
|
sed -i 's/^import .*_pb2 as/from . \0/' lightning_pb2_grpc.py
|
|
|
|
sed -i 's/^import .*_pb2 as/from . \0/' invoices_pb2_grpc.py
|
2023-04-23 21:58:21 +00:00
|
|
|
sed -i 's/^import .*_pb2 as/from . \0/' verrpc_pb2_grpc.py
|