Closed wbobeirne closed 5 years ago
This is the subscribeInvoice type currently provided:
subscribeInvoice
LnRpc.subscribeInvoices(args?: InvoiceSubscription | undefined): Promise<Readable<Invoice>>
However the following code:
node.subscribeInvoices().then(stream => { stream.on('data', chunk => { console.log(chunk); }); });
results in the following error:
UnhandledPromiseRejectionWarning: TypeError: node_1.node.subscribeInvoices(...).then is not a function
Doing a quick log of the call:
const stream = node.subscribeInvoices(); console.log(stream);
Prints this, indicating it returns a readable, no promise wrap:
ClientReadableStream { _readableState: ReadableState { ...
I'm not sure if it's just the type that's wrong, or the non-promise behavior that's wrong, but I currently have to work around this by doing:
import { Invoice, Readable } from '@radar/lnrpc'; const stream = node.subscribeInvoices() as any as Readable<Invoice>; stream.on('data', chunk => { console.log(chunk); });
Ah, you're correct. Our usage of async/await hid the issue. Patching now.
Published in 0.6.0-beta.1
This is the
subscribeInvoice
type currently provided:However the following code:
results in the following error:
Doing a quick log of the call:
Prints this, indicating it returns a readable, no promise wrap:
I'm not sure if it's just the type that's wrong, or the non-promise behavior that's wrong, but I currently have to work around this by doing: