1
1
mirror of https://github.com/bumi/lntip synced 2025-07-18 13:36:44 +00:00

Formatting

This commit is contained in:
bumi 2021-08-27 11:18:49 +02:00
parent 5c8d604a20
commit 518a834066
2 changed files with 67 additions and 66 deletions

View File

@ -1,13 +1,13 @@
package ln package ln
import ( import (
"fmt"
"context" "context"
"crypto/x509"
"encoding/hex" "encoding/hex"
"fmt"
"io/ioutil" "io/ioutil"
"log" "log"
"os" "os"
"crypto/x509"
"github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/macaroons" "github.com/lightningnetwork/lnd/macaroons"
@ -46,7 +46,7 @@ type LNDclient struct {
func (c LNDclient) AddInvoice(value int64, memo string) (Invoice, error) { func (c LNDclient) AddInvoice(value int64, memo string) (Invoice, error) {
result := Invoice{} result := Invoice{}
stdOutLogger.Printf("Adding invoice: memo=%s amount=%v ", memo, value) stdOutLogger.Printf("Adding invoice: memo=%s value=%v ", memo, value)
invoice := lnrpc.Invoice{ invoice := lnrpc.Invoice{
Memo: memo, Memo: memo,
Value: value, Value: value,

17
lnme.go
View File

@ -2,7 +2,12 @@ package main
import ( import (
"flag" "flag"
"github.com/GeertJohan/go.rice" "log"
"net/http"
"os"
"strings"
rice "github.com/GeertJohan/go.rice"
"github.com/bumi/lnme/ln" "github.com/bumi/lnme/ln"
"github.com/didip/tollbooth/v6" "github.com/didip/tollbooth/v6"
"github.com/didip/tollbooth/v6/limiter" "github.com/didip/tollbooth/v6/limiter"
@ -13,10 +18,6 @@ import (
"github.com/knadh/koanf/providers/file" "github.com/knadh/koanf/providers/file"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware" "github.com/labstack/echo/v4/middleware"
"log"
"net/http"
"os"
"strings"
) )
// Middleware for request limited to prevent too many requests // Middleware for request limited to prevent too many requests
@ -124,9 +125,9 @@ func main() {
}) })
// Check invoice status // Check invoice status
e.GET("/v1/invoice/:invoiceId", func(c echo.Context) error { e.GET("/v1/invoice/:paymentHash", func(c echo.Context) error {
invoiceId := c.Param("invoiceId") paymentHash := c.Param("paymentHash")
invoice, err := lnClient.GetInvoice(invoiceId) invoice, err := lnClient.GetInvoice(paymentHash)
if err != nil { if err != nil {
stdOutLogger.Printf("Error looking up invoice: %s", err) stdOutLogger.Printf("Error looking up invoice: %s", err)