I'm using ln-service package and I'm connected to a local instance of lnd node (created with polar). I'm using plain js.
import lnservice from 'ln-service';
let lndz = lnservice.authenticatedLndGrpc({
cert: tls,
macaroon: adminMacaroon,
socket: socket
})
try {
let res = await lnservice.createInvoice({mtokens: "500", description: "new invoice", lnd:lndz})
} catch (error) {
console.log("ERROR",error);
}
Error:
[ 400, 'ExpectedLndToCreateNewInvoice' ]
The only hint I'm getting from IDE is that lndz
should have these fields, but I don't know what I should put in these fields, since it's not mentioned in the docs.
autopilot: any;
chain: any;
default: any;
invoices: any;
router: any;
signer: any;
tower_client: any;
tower_server: any;
wallet: any;
version: any;
What does 400 mean? How can I debug this? I looked at LND logs but no help there. How would I know what to put in those fields, since only 3 of the fields were mentioned
If I run a different method:
lnservice.getHeight(lndz)
I'm getting the correct block height, so it seems that I'm able to make a connection to the LND node.
Have to use object destructuring.
let {lnd} = lnservice.authenticatedLndGrpc({
cert: tls,
macaroon: adminMacaroon,
socket: socket
})