1
1
mirror of https://github.com/bumi/lntip synced 2026-02-13 21:07:48 +00:00

Use JSON POST request for invoice creation

This commit is contained in:
2019-01-07 21:29:08 +01:00
parent 08d0eee00c
commit a070fe35a0
3 changed files with 30 additions and 19 deletions

View File

@@ -36,12 +36,11 @@ type LNDclient struct {
func (c LNDclient) GenerateInvoice(amount int64, memo string) (Invoice, error) {
result := Invoice{}
// Create the request and send it
stdOutLogger.Printf("Creating invoice: memo=%s amount=%v ", memo, amount)
invoice := lnrpc.Invoice{
Memo: memo,
Value: amount,
}
stdOutLogger.Printf("Creating invoice: %s", memo)
res, err := c.lndClient.AddInvoice(c.ctx, &invoice)
if err != nil {
return result, err
@@ -63,7 +62,7 @@ func (c LNDclient) CheckInvoice(id string) (bool, error) {
return false, err
}
stdOutLogger.Printf("Lookup invoice with hash %v\n", id)
stdOutLogger.Printf("Lookup invoice: hash=%s\n", id)
// Get the invoice for that hash
paymentHash := lnrpc.PaymentHash{