Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to process lnd response? #23

Open
iraszl opened this issue Sep 20, 2022 · 0 comments
Open

How to process lnd response? #23

iraszl opened this issue Sep 20, 2022 · 0 comments

Comments

@iraszl
Copy link
Contributor

iraszl commented Sep 20, 2022

For example, if I open a channel with the following command:
response = lnd.lightning.open_channel({node_pubkey: pubkey, local_funding_amount: amount})

I either get a successful response with an enumerator that gives two messages, one about the act of channel opening and the second about the channel being open later on:

<Lnrpc::OpenStatusUpdate: pending_chan_id: "�M;I�%�JQ��3i{V�p���bf3���˺", chan_pending: <Lnrpc::PendingUpdate: txid: "m�#G��Fn��Dq�D��C/��/Ewt", output_index: 0>>

<Lnrpc::OpenStatusUpdate: pending_chan_id: "�M;I�%�JQ��3i{V�p���bf3���˺", chan_open: <Lnrpc::ChannelOpenUpdate: channel_point: <Lnrpc::ChannelPoint: output_index: 0, funding_txid_bytes: "m�#G��Fn��Dq�D��C/��/Ewt">>>

Otherwise I get an error response something like this:

API ERROR
An error of type GRPC::Unknown happened, message is 2:channel is too small, the minimum channel size is: 20000 SAT. debug_error_string:{"created":"@1662968827.798707000","description":"Error received from peer ipv4:34.211.6.107:10009","file":"src/core/lib/surface/call.cc","file_line":1067,"grpc_message":"channel is too small, the minimum channel size is: 20000 SAT","grpc_status":2}

My questions are:

  1. How do I process the response variable in ruby to determine if the response was successful or an error?
  2. How do I extract grpc_message from the error message, so I can display it to a user?
  3. How do I convert the byte array in the response like �M;I�%�JQ��3i{V�p���bf3���˺ into humanely readable format?

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant