alexbosworth / ln-service

Node.js interface to LND
MIT License
319 stars 60 forks source link

CreateInvoice return no response #167

Open Thomas-AnhDao opened 2 years ago

Thomas-AnhDao commented 2 years ago

I'm creating invoice by using ln-service lib, but the createInvoice doesn't return anything. Here is my code:

const lnService = require('ln-service');

async function main() {
  try {
    const { lnd } = lnService.authenticatedLndGrpc({
      cert: 'my_cert',
      macaroon: 'my_macaroon',
      socket: 'host:port',
    });

    const invoice = await lnService.createInvoice({
      lnd,
      tokens: 100,
    });
    console.log("invoice", invoice);
  } catch (err) {
    console.log("err", err);
  }
}

main()
alexbosworth commented 2 years ago

take a look at the test https://github.com/alexbosworth/ln-service/blob/master/test/integration/test_create_invoice.js

you can npm i ln-service and run the test with node test_create_invoice.js if you want to play around with it