alexbosworth / ln-service

Node.js interface to LND
MIT License
318 stars 61 forks source link

subscribeToForwards does not output incoming and outgoing amounts #140

Closed krtk6160 closed 3 years ago

krtk6160 commented 3 years ago

Feature request:

The subscribeToForwards subscription would be more useful if it also output the incoming and outgoing token/mtokens amounts. I assume it relies on the subscribeHtlcEvents api from LND which already exposes this information.

alexbosworth commented 3 years ago

it has it but there is a doc issue where it isn't listed

alexbosworth commented 3 years ago

Here is the proper event doc:

  @event 'forward'
  {
    at: <Forward Update At ISO 8601 Date String>
    [external_failure]: <Public Failure Reason String>
    [fee]: <Fee Tokens Charged Number>
    [fee_mtokens]: <Fee Millitokens Charged String>
    [in_channel]: <Inbound Standard Format Channel Id String>
    [in_payment]: <Inbound Channel Payment Id Number>
    [internal_failure]: <Private Failure Reason String>
    is_confirmed: <Forward Is Confirmed Bool>
    is_failed: <Forward Is Failed Bool>
    is_receive: <Is Receive Bool>
    is_send: <Is Send Bool>
    [mtokens]: <Sending Millitokens Number>
    [out_channel]: <Outgoing Standard Format Channel Id String>
    [out_payment]: <Outgoing Channel Payment Id Number>
    [timeout]: <Forward Timeout at Height Number>
    [tokens]: <Sending Tokens Number>
  }
krtk6160 commented 3 years ago

Here is the proper event doc:

  @event 'forward'
  {
    at: <Forward Update At ISO 8601 Date String>
    [external_failure]: <Public Failure Reason String>
    [fee]: <Fee Tokens Charged Number>
    [fee_mtokens]: <Fee Millitokens Charged String>
    [in_channel]: <Inbound Standard Format Channel Id String>
    [in_payment]: <Inbound Channel Payment Id Number>
    [internal_failure]: <Private Failure Reason String>
    is_confirmed: <Forward Is Confirmed Bool>
    is_failed: <Forward Is Failed Bool>
    is_receive: <Is Receive Bool>
    is_send: <Is Send Bool>
    [mtokens]: <Sending Millitokens Number>
    [out_channel]: <Outgoing Standard Format Channel Id String>
    [out_payment]: <Outgoing Channel Payment Id Number>
    [timeout]: <Forward Timeout at Height Number>
    [tokens]: <Sending Tokens Number>
  }

Oh okay. Thanks.

I am assuming the event output is same for the subscribeToForwards method in https://github.com/alexbosworth/lightning as well?

alexbosworth commented 3 years ago

The method itself is imported from the other repo so it is identical - the other repo also has typescript support but the type definitions there also need to be updated for the missing fields, working on that

alexbosworth commented 3 years ago

The doc above is wrong about the mtokens value, this should be a string not a number

krtk6160 commented 3 years ago

Okay thanks.

alexbosworth commented 3 years ago

I'll fix this doc and types in an upcoming release in both places, working on that