Skip to content

Commit

Permalink
Merge pull request #559 from lightninglabs/docs-lnd
Browse files Browse the repository at this point in the history
Update lnd documentation
  • Loading branch information
github-actions[bot] authored Oct 7, 2023
2 parents 195a357 + ab088da commit 649bf5c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions docs/lnd/grpc/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ file in Python before you can use it to communicate with lnd.
3. Install dependencies (googleapis-common-protos is required due to the use of
google/api/annotations.proto)
```shell
lnd $ pip install grpcio grpcio-tools googleapis-common-protos
lnd $ pip install grpcio grpcio-tools googleapis-common-protos mypy-protobuf
```
4. Clone the google api's repository (required due to the use of
google/api/annotations.proto)
Expand All @@ -35,12 +35,11 @@ file in Python before you can use it to communicate with lnd.
```
6. Compile the proto file
```shell
lnd $ python -m grpc_tools.protoc --proto_path=googleapis:. --python_out=. --grpc_python_out=. lightning.proto
lnd $ python -m grpc_tools.protoc --proto_path=googleapis:. --mypy_out=. --python_out=. --grpc_python_out=. lightning.proto
```

After following these steps, two files `lightning_pb2.py` and
`lightning_pb2_grpc.py` will be generated. These files will be imported in your
project anytime you use Python gRPC.
After following these steps, three files `lightning_pb2.py`,
`lightning_pb2_grpc.py` and `lightning_pb2.pyi` will be generated. These files will be imported in your project anytime you use Python gRPC.

### Generating RPC modules for subservers

Expand All @@ -50,11 +49,11 @@ generate the python modules for them.
For example, if you want to generate the RPC modules for the `Router` subserver
(located/defined in `routerrpc/router.proto`), you need to run the following two
extra steps (after completing all 6 step described above) to get the
`router_pb2.py` and `router_pb2_grpc.py`:
`router_pb2.py`, `router_pb2_grpc.py` and `router_pb2.pyi`:
```shell
lnd $ curl -o router.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/routerrpc/router.proto
lnd $ python -m grpc_tools.protoc --proto_path=googleapis:. --python_out=. --grpc_python_out=. router.proto
lnd $ python -m grpc_tools.protoc --proto_path=googleapis:. --mypy_out=. --python_out=. --grpc_python_out=. router.proto
```
### Imports and Client
Expand Down Expand Up @@ -221,4 +220,4 @@ Here is an example of a working format that allows for use of a reserved word `g
```
args = {'global': True, 'base_fee_msat': 1000, 'fee_rate': 0.000001, 'time_lock_delta': 40}
stub.UpdateChannelPolicy(ln.PolicyUpdateRequest(**args))
```
```

0 comments on commit 649bf5c

Please sign in to comment.