diff --git a/docker/card/db/db_select.go b/docker/card/db/db_select.go index 878f8fb..a6c383c 100644 --- a/docker/card/db/db_select.go +++ b/docker/card/db/db_select.go @@ -81,7 +81,7 @@ func Db_select_card_payments(db_conn *sql.DB, card_id int) (result CardPayments) var cardPayments CardPayments sqlStatement := `SELECT card_payment_id,` + - ` amount_sats, paid_flag,` + + ` amount_sats, fee_sats, paid_flag,` + ` timestamp, expire_time` + ` FROM card_payments` + ` WHERE card_payments.card_id = $1` + @@ -96,6 +96,7 @@ func Db_select_card_payments(db_conn *sql.DB, card_id int) (result CardPayments) err := rows.Scan( &cardPayment.CardPaymentId, &cardPayment.AmountSats, + &cardPayment.FeeSats, &cardPayment.IsPaid, &cardPayment.Timestamp, &cardPayment.ExpireTime) diff --git a/docker/card/phoenix/client.go b/docker/card/phoenix/client.go new file mode 100644 index 0000000..e2e7f9e --- /dev/null +++ b/docker/card/phoenix/client.go @@ -0,0 +1,63 @@ +package phoenix + +import ( + "errors" + "fmt" + "io" + "net/http" + "time" + + "github.com/go-ini/ini" + log "github.com/sirupsen/logrus" +) + +const phoenixBaseURL = "http://phoenix:9740" +const defaultTimeout = 5 * time.Second + +// loadPassword reads the http-password from the phoenix config file. +func loadPassword() (string, error) { + cfg, err := ini.Load("/root/.phoenix/phoenix.conf") + if err != nil { + return "", fmt.Errorf("load phoenix config: %w", err) + } + return cfg.Section("").Key("http-password").String(), nil +} + +// doRequest executes an HTTP request against the Phoenix API with basic auth. +// It returns the response body bytes on success, or an error on failure. +func doRequest(req *http.Request, timeout time.Duration, endpointName string) ([]byte, error) { + password, err := loadPassword() + if err != nil { + return nil, err + } + + req.SetBasicAuth("", password) + + client := http.Client{Timeout: timeout} + res, err := client.Do(req) + if err != nil { + return nil, fmt.Errorf("%s request failed: %w", endpointName, err) + } + defer res.Body.Close() + + body, err := io.ReadAll(res.Body) + if err != nil { + return nil, fmt.Errorf("%s read body: %w", endpointName, err) + } + + if res.StatusCode != 200 { + log.Warning(endpointName, " StatusCode ", res.StatusCode) + return nil, errors.New("failed API call to Phoenix " + endpointName) + } + + return body, nil +} + +// doGet is a convenience wrapper for GET requests with the default timeout. +func doGet(path string, endpointName string) ([]byte, error) { + req, err := http.NewRequest(http.MethodGet, phoenixBaseURL+path, http.NoBody) + if err != nil { + return nil, fmt.Errorf("%s create request: %w", endpointName, err) + } + return doRequest(req, defaultTimeout, endpointName) +} diff --git a/docker/card/phoenix/create_invoice.go b/docker/card/phoenix/create_invoice.go index db5a623..1f9fb1a 100644 --- a/docker/card/phoenix/create_invoice.go +++ b/docker/card/phoenix/create_invoice.go @@ -1,17 +1,11 @@ package phoenix import ( - "card/util" - "encoding/json" - "errors" - "io" "net/http" "net/url" "strings" - "time" - "github.com/go-ini/ini" log "github.com/sirupsen/logrus" ) @@ -28,51 +22,33 @@ type CreateInvoiceResponse struct { } func CreateInvoice(createInvoiceRequest CreateInvoiceRequest) (CreateInvoiceResponse, error) { - var createInvoiceResponse CreateInvoiceResponse - cfg, err := ini.Load("/root/.phoenix/phoenix.conf") - util.CheckAndPanic(err) - - hp := cfg.Section("").Key("http-password").String() - - client := http.Client{Timeout: 5 * time.Second} - formBody := url.Values{ "description": []string{createInvoiceRequest.Description}, "amountSat": []string{createInvoiceRequest.AmountSat}, "externalId": []string{createInvoiceRequest.ExternalId}, } - dataReader := formBody.Encode() - reader := strings.NewReader(dataReader) + reader := strings.NewReader(formBody.Encode()) - req, err := http.NewRequest(http.MethodPost, "http://phoenix:9740/createinvoice", reader) + req, err := http.NewRequest(http.MethodPost, phoenixBaseURL+"/createinvoice", reader) if err != nil { - log.Fatal(err) + return createInvoiceResponse, err } req.Header.Add("Content-Type", "application/x-www-form-urlencoded") - req.SetBasicAuth("", hp) - - res, err := client.Do(req) - util.CheckAndPanic(err) - - defer res.Body.Close() - - resBody, err := io.ReadAll(res.Body) - util.CheckAndPanic(err) - - if res.StatusCode != 200 { - log.Warning("CreateInvoice StatusCode ", res.StatusCode) - log.Warning(string(resBody)) - return createInvoiceResponse, errors.New("failed API call to Phoenix CreateInvoice") + body, err := doRequest(req, defaultTimeout, "CreateInvoice") + if err != nil { + return createInvoiceResponse, err } - log.Info(string(resBody)) + log.Info(string(body)) - err = json.Unmarshal(resBody, &createInvoiceResponse) - util.CheckAndPanic(err) + err = json.Unmarshal(body, &createInvoiceResponse) + if err != nil { + return createInvoiceResponse, err + } return createInvoiceResponse, nil } diff --git a/docker/card/phoenix/get_balance.go b/docker/card/phoenix/get_balance.go index bb81cd4..fcfc402 100644 --- a/docker/card/phoenix/get_balance.go +++ b/docker/card/phoenix/get_balance.go @@ -2,13 +2,6 @@ package phoenix import ( "encoding/json" - "errors" - "io" - "net/http" - "time" - - "github.com/go-ini/ini" - log "github.com/sirupsen/logrus" ) type Balance struct { @@ -19,42 +12,12 @@ type Balance struct { func GetBalance() (Balance, error) { var balance Balance - cfg, err := ini.Load("/root/.phoenix/phoenix.conf") - if err != nil { - return balance, err - } - - hp := cfg.Section("").Key("http-password").String() - - client := http.Client{Timeout: 5 * time.Second} - - req, err := http.NewRequest(http.MethodGet, "http://phoenix:9740/getbalance", http.NoBody) - if err != nil { - return balance, err - } - - req.SetBasicAuth("", hp) - - res, err := client.Do(req) - if err != nil { - return balance, err - } - - defer res.Body.Close() - - resBody, err := io.ReadAll(res.Body) + body, err := doGet("/getbalance", "GetBalance") if err != nil { return balance, err } - if res.StatusCode != 200 { - log.Warning("GetBalance StatusCode ", res.StatusCode) - return balance, errors.New("failed API call to Phoenix GetBalance") - } - - //log.Info(string(resBody)) - - err = json.Unmarshal(resBody, &balance) + err = json.Unmarshal(body, &balance) if err != nil { return balance, err } diff --git a/docker/card/phoenix/get_incoming_payment.go b/docker/card/phoenix/get_incoming_payment.go index 90bb366..3161522 100644 --- a/docker/card/phoenix/get_incoming_payment.go +++ b/docker/card/phoenix/get_incoming_payment.go @@ -1,18 +1,9 @@ package phoenix import ( - "card/util" - "encoding/json" - "errors" "fmt" - "io" - "net/http" "net/url" - "time" - - "github.com/go-ini/ini" - log "github.com/sirupsen/logrus" ) type IncomingPayment struct { @@ -29,41 +20,18 @@ type IncomingPayment struct { } func GetIncomingPayment(PaymentHash string) (IncomingPayment, error) { - var incomingPayment IncomingPayment - cfg, err := ini.Load("/root/.phoenix/phoenix.conf") - util.CheckAndPanic(err) - - hp := cfg.Section("").Key("http-password").String() - - client := http.Client{Timeout: 5 * time.Second} - - url := fmt.Sprintf("http://phoenix:9740/payments/incoming/%s", url.QueryEscape(PaymentHash)) - req, err := http.NewRequest(http.MethodGet, url, http.NoBody) + path := fmt.Sprintf("/payments/incoming/%s", url.QueryEscape(PaymentHash)) + body, err := doGet(path, "GetIncomingPayment") if err != nil { - log.Fatal(err) + return incomingPayment, err } - req.SetBasicAuth("", hp) - - res, err := client.Do(req) - util.CheckAndPanic(err) - - defer res.Body.Close() - - resBody, err := io.ReadAll(res.Body) - util.CheckAndPanic(err) - - if res.StatusCode != 200 { - log.Warning("GetIncomingPayment StatusCode ", res.StatusCode) - return incomingPayment, errors.New("failed API call to Phoenix GetIncomingPayment") + err = json.Unmarshal(body, &incomingPayment) + if err != nil { + return incomingPayment, err } - //log.Info(string(resBody)) - - err = json.Unmarshal(resBody, &incomingPayment) - util.CheckAndPanic(err) - return incomingPayment, nil } diff --git a/docker/card/phoenix/get_node_info.go b/docker/card/phoenix/get_node_info.go index 71d1f78..2325d78 100644 --- a/docker/card/phoenix/get_node_info.go +++ b/docker/card/phoenix/get_node_info.go @@ -2,13 +2,6 @@ package phoenix import ( "encoding/json" - "errors" - "io" - "net/http" - "time" - - "github.com/go-ini/ini" - log "github.com/sirupsen/logrus" ) type NodeInfo struct { @@ -27,42 +20,12 @@ type NodeInfo struct { func GetNodeInfo() (NodeInfo, error) { var nodeInfo NodeInfo - cfg, err := ini.Load("/root/.phoenix/phoenix.conf") - if err != nil { - return nodeInfo, err - } - - hp := cfg.Section("").Key("http-password").String() - - client := http.Client{Timeout: 5 * time.Second} - - req, err := http.NewRequest(http.MethodGet, "http://phoenix:9740/getinfo", http.NoBody) - if err != nil { - return nodeInfo, err - } - - req.SetBasicAuth("", hp) - - res, err := client.Do(req) - if err != nil { - return nodeInfo, err - } - - defer res.Body.Close() - - resBody, err := io.ReadAll(res.Body) + body, err := doGet("/getinfo", "GetNodeInfo") if err != nil { return nodeInfo, err } - if res.StatusCode != 200 { - log.Warning("GetNodeInfo StatusCode ", res.StatusCode) - return nodeInfo, errors.New("failed API call to Phoenix GetNodeInfo") - } - - //log.Info(string(resBody)) - - err = json.Unmarshal(resBody, &nodeInfo) + err = json.Unmarshal(body, &nodeInfo) if err != nil { return nodeInfo, err } diff --git a/docker/card/phoenix/get_offer.go b/docker/card/phoenix/get_offer.go index 8d38693..5822f66 100644 --- a/docker/card/phoenix/get_offer.go +++ b/docker/card/phoenix/get_offer.go @@ -1,51 +1,10 @@ package phoenix -import ( - "errors" - "io" - "net/http" - "time" - - "github.com/go-ini/ini" - log "github.com/sirupsen/logrus" -) - func GetOffer() (offer string, err error) { - - cfg, err := ini.Load("/root/.phoenix/phoenix.conf") - if err != nil { - return "", err - } - - hp := cfg.Section("").Key("http-password").String() - - client := http.Client{Timeout: 5 * time.Second} - - req, err := http.NewRequest(http.MethodGet, "http://phoenix:9740/getoffer", http.NoBody) - if err != nil { - return "", err - } - - req.SetBasicAuth("", hp) - - res, err := client.Do(req) + body, err := doGet("/getoffer", "GetOffer") if err != nil { return "", err } - defer res.Body.Close() - - resBody, err := io.ReadAll(res.Body) - if err != nil { - return "", err - } - - if res.StatusCode != 200 { - log.Warning("GetBalance StatusCode ", res.StatusCode) - return "", errors.New("failed API call to Phoenix GetOffer") - } - - offer = string(resBody) - - return offer, nil + return string(body), nil } diff --git a/docker/card/phoenix/get_outgoing_payment.go b/docker/card/phoenix/get_outgoing_payment.go index 8765c64..2aab144 100644 --- a/docker/card/phoenix/get_outgoing_payment.go +++ b/docker/card/phoenix/get_outgoing_payment.go @@ -1,18 +1,9 @@ package phoenix import ( - "card/util" - "encoding/json" - "errors" "fmt" - "io" - "net/http" "net/url" - "time" - - "github.com/go-ini/ini" - log "github.com/sirupsen/logrus" ) type OutgoingPaymentResponse struct { @@ -27,41 +18,18 @@ type OutgoingPaymentResponse struct { } func GetOutgoingPayment(PaymentId string) (OutgoingPaymentResponse, error) { - var outgoingPaymentResponse OutgoingPaymentResponse - cfg, err := ini.Load("/root/.phoenix/phoenix.conf") - util.CheckAndPanic(err) - - hp := cfg.Section("").Key("http-password").String() - - client := http.Client{Timeout: 5 * time.Second} - - url := fmt.Sprintf("http://phoenix:9740/payments/outgoing/%s", url.QueryEscape(PaymentId)) - req, err := http.NewRequest(http.MethodGet, url, http.NoBody) + path := fmt.Sprintf("/payments/outgoing/%s", url.QueryEscape(PaymentId)) + body, err := doGet(path, "GetOutgoingPayment") if err != nil { - log.Fatal(err) + return outgoingPaymentResponse, err } - req.SetBasicAuth("", hp) - - res, err := client.Do(req) - util.CheckAndPanic(err) - - defer res.Body.Close() - - resBody, err := io.ReadAll(res.Body) - util.CheckAndPanic(err) - - if res.StatusCode != 200 { - log.Warning("GetOutgoingPayment StatusCode ", res.StatusCode) - return outgoingPaymentResponse, errors.New("failed API call to Phoenix GetOutgoingPayment") + err = json.Unmarshal(body, &outgoingPaymentResponse) + if err != nil { + return outgoingPaymentResponse, err } - //log.Info(string(resBody)) - - err = json.Unmarshal(resBody, &outgoingPaymentResponse) - util.CheckAndPanic(err) - return outgoingPaymentResponse, nil } diff --git a/docker/card/phoenix/list_channels.go b/docker/card/phoenix/list_channels.go index 3716912..2d7cabe 100644 --- a/docker/card/phoenix/list_channels.go +++ b/docker/card/phoenix/list_channels.go @@ -2,13 +2,6 @@ package phoenix import ( "encoding/json" - "errors" - "io" - "net/http" - "time" - - "github.com/go-ini/ini" - log "github.com/sirupsen/logrus" ) type Channel struct { @@ -92,42 +85,13 @@ func extractChannel(raw listChannelRaw) (Channel, bool) { } func ListChannels() ([]Channel, error) { - - cfg, err := ini.Load("/root/.phoenix/phoenix.conf") - if err != nil { - return nil, err - } - - hp := cfg.Section("").Key("http-password").String() - - client := http.Client{Timeout: 5 * time.Second} - - req, err := http.NewRequest(http.MethodGet, "http://phoenix:9740/listchannels", http.NoBody) - if err != nil { - return nil, err - } - - req.SetBasicAuth("", hp) - - res, err := client.Do(req) - if err != nil { - return nil, err - } - - defer res.Body.Close() - - resBody, err := io.ReadAll(res.Body) + body, err := doGet("/listchannels", "ListChannels") if err != nil { return nil, err } - if res.StatusCode != 200 { - log.Warning("ListChannels StatusCode ", res.StatusCode) - return nil, errors.New("failed API call to Phoenix ListChannels") - } - var rawChannels []listChannelRaw - err = json.Unmarshal(resBody, &rawChannels) + err = json.Unmarshal(body, &rawChannels) if err != nil { return nil, err } diff --git a/docker/card/phoenix/list_incoming_payments.go b/docker/card/phoenix/list_incoming_payments.go index b0693cd..eeed5d5 100644 --- a/docker/card/phoenix/list_incoming_payments.go +++ b/docker/card/phoenix/list_incoming_payments.go @@ -1,17 +1,9 @@ package phoenix import ( - "card/util" - "strconv" - "encoding/json" - "errors" - "io" "net/http" - "time" - - "github.com/go-ini/ini" - log "github.com/sirupsen/logrus" + "strconv" ) type IncomingPayments []struct { @@ -28,19 +20,11 @@ type IncomingPayments []struct { } func ListIncomingPayments(limit int, offset int) (IncomingPayments, error) { - var incomingPayments IncomingPayments - cfg, err := ini.Load("/root/.phoenix/phoenix.conf") - util.CheckAndPanic(err) - - hp := cfg.Section("").Key("http-password").String() - - client := http.Client{Timeout: 5 * time.Second} - - req, err := http.NewRequest(http.MethodGet, "http://phoenix:9740/payments/incoming", http.NoBody) + req, err := http.NewRequest(http.MethodGet, phoenixBaseURL+"/payments/incoming", http.NoBody) if err != nil { - log.Fatal(err) + return incomingPayments, err } q := req.URL.Query() @@ -49,25 +33,15 @@ func ListIncomingPayments(limit int, offset int) (IncomingPayments, error) { q.Add("all", "true") // include unpaid invoices req.URL.RawQuery = q.Encode() - req.SetBasicAuth("", hp) - - res, err := client.Do(req) - util.CheckAndPanic(err) - - defer res.Body.Close() - - resBody, err := io.ReadAll(res.Body) - util.CheckAndPanic(err) - - if res.StatusCode != 200 { - log.Warning("ListIncomingPayments StatusCode ", res.StatusCode) - return incomingPayments, errors.New("failed API call to Phoenix ListIncomingPayments") + body, err := doRequest(req, defaultTimeout, "ListIncomingPayments") + if err != nil { + return incomingPayments, err } - //log.Info(string(resBody)) - - err = json.Unmarshal(resBody, &incomingPayments) - util.CheckAndPanic(err) + err = json.Unmarshal(body, &incomingPayments) + if err != nil { + return incomingPayments, err + } return incomingPayments, nil } diff --git a/docker/card/phoenix/list_outgoing_payments.go b/docker/card/phoenix/list_outgoing_payments.go index 2bbaf72..8706001 100644 --- a/docker/card/phoenix/list_outgoing_payments.go +++ b/docker/card/phoenix/list_outgoing_payments.go @@ -1,17 +1,9 @@ package phoenix import ( - "card/util" - "strconv" - "encoding/json" - "errors" - "io" "net/http" - "time" - - "github.com/go-ini/ini" - log "github.com/sirupsen/logrus" + "strconv" ) type OutgoingPayments []struct { @@ -27,19 +19,11 @@ type OutgoingPayments []struct { } func ListOutgoingPayments(limit int, offset int) (OutgoingPayments, error) { - var outgoingPayments OutgoingPayments - cfg, err := ini.Load("/root/.phoenix/phoenix.conf") - util.CheckAndPanic(err) - - hp := cfg.Section("").Key("http-password").String() - - client := http.Client{Timeout: 5 * time.Second} - - req, err := http.NewRequest(http.MethodGet, "http://phoenix:9740/payments/outgoing", http.NoBody) + req, err := http.NewRequest(http.MethodGet, phoenixBaseURL+"/payments/outgoing", http.NoBody) if err != nil { - log.Fatal(err) + return outgoingPayments, err } q := req.URL.Query() @@ -48,25 +32,15 @@ func ListOutgoingPayments(limit int, offset int) (OutgoingPayments, error) { q.Add("all", "true") // include unpaid invoices req.URL.RawQuery = q.Encode() - req.SetBasicAuth("", hp) - - res, err := client.Do(req) - util.CheckAndPanic(err) - - defer res.Body.Close() - - resBody, err := io.ReadAll(res.Body) - util.CheckAndPanic(err) - - if res.StatusCode != 200 { - log.Warning("ListOutgoingPayments StatusCode ", res.StatusCode) - return outgoingPayments, errors.New("failed API call to Phoenix ListOutgoingPayments") + body, err := doRequest(req, defaultTimeout, "ListOutgoingPayments") + if err != nil { + return outgoingPayments, err } - //log.Info(string(resBody)) - - err = json.Unmarshal(resBody, &outgoingPayments) - util.CheckAndPanic(err) + err = json.Unmarshal(body, &outgoingPayments) + if err != nil { + return outgoingPayments, err + } return outgoingPayments, nil } diff --git a/docker/card/phoenix/send_lightning_payment.go b/docker/card/phoenix/send_lightning_payment.go index b3a2747..432bc94 100644 --- a/docker/card/phoenix/send_lightning_payment.go +++ b/docker/card/phoenix/send_lightning_payment.go @@ -6,11 +6,9 @@ import ( "io" "net/http" "net/url" - "strconv" "strings" "time" - "github.com/go-ini/ini" log "github.com/sirupsen/logrus" ) @@ -40,10 +38,9 @@ func SendLightningPayment( string, error, ) { - var sendLightningPaymentResponse SendLightningPaymentResponse - cfg, err := ini.Load("/root/.phoenix/phoenix.conf") + password, err := loadPassword() if err != nil { log.Warning(err) return sendLightningPaymentResponse, @@ -51,19 +48,13 @@ func SendLightningPayment( errors.New("could not load config for SendLightningPayment") } - hp := cfg.Section("").Key("http-password").String() - - //client := http.Client{Timeout: 10 * time.Millisecond} // HACK: to fail with client timeout - client := http.Client{Timeout: 30 * time.Second} - formBody := url.Values{ "amountSat": []string{sendLightningPaymentRequest.AmountSat}, "invoice": []string{sendLightningPaymentRequest.Invoice}, } - dataReader := formBody.Encode() - reader := strings.NewReader(dataReader) + reader := strings.NewReader(formBody.Encode()) - req, err := http.NewRequest(http.MethodPost, "http://phoenix:9740/payinvoice", reader) + req, err := http.NewRequest(http.MethodPost, phoenixBaseURL+"/payinvoice", reader) if err != nil { log.Warning(err) return sendLightningPaymentResponse, @@ -72,9 +63,9 @@ func SendLightningPayment( } req.Header.Add("Content-Type", "application/x-www-form-urlencoded") + req.SetBasicAuth("", password) - req.SetBasicAuth("", hp) - + client := http.Client{Timeout: 30 * time.Second} res, err := client.Do(req) if err != nil { // we never want this error as the payment may or may not be made @@ -102,7 +93,7 @@ func SendLightningPayment( log.Warning("SendLightningPayment StatusCode ", res.StatusCode, "ResBody", string(resBody)) return sendLightningPaymentResponse, "fail_status_code", - errors.New("fail status code returned for SendLightningPayment " + strconv.Itoa(res.StatusCode)) + errors.New("fail status code returned for SendLightningPayment") } log.Info(string(resBody)) diff --git a/docker/card/web/bcp_batch_create.go b/docker/card/web/bcp_batch_create.go index 9dde8bf..5151a33 100644 --- a/docker/card/web/bcp_batch_create.go +++ b/docker/card/web/bcp_batch_create.go @@ -47,15 +47,13 @@ func (app *App) CreateHandler_BatchCreateCard() http.HandlerFunc { log.Info("Uid : ", t.Uid) - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - // check secret in program_cards exists and is not expired, and get group_tag field programCard := db.Db_select_program_card_for_secret(app.db_conn, secret) currentTime := int(time.Now().Unix()) if currentTime < programCard.CreateTime || currentTime > programCard.ExpireTime { log.Warn("ProgramCard record within expiry time not found") + http.Error(w, "program card expired or not found", http.StatusBadRequest) return } diff --git a/docker/card/web/wallet_api_addinvoice.go b/docker/card/web/wallet_api_addinvoice.go index 79e8f09..65efc79 100644 --- a/docker/card/web/wallet_api_addinvoice.go +++ b/docker/card/web/wallet_api_addinvoice.go @@ -3,12 +3,11 @@ package web import ( "card/db" "card/phoenix" - "encoding/hex" + "card/util" "encoding/json" "net/http" "strconv" - _ "github.com/mattn/go-sqlite3" log "github.com/sirupsen/logrus" ) @@ -82,17 +81,7 @@ func (app *App) CreateHandler_AddInvoice() http.HandlerFunc { var resObj AddInvoiceResponse - rHashByteSlice, err := hex.DecodeString(createInvoiceResponse.PaymentHash) - if err != nil { - log.Error("hex decode error: ", err) - sendError(w, "Error", 999, "failed to decode payment hash") - return - } - - rHashIntSlice := []int{} - for _, rHashByte := range rHashByteSlice { - rHashIntSlice = append(rHashIntSlice, int(rHashByte)) - } + rHashIntSlice := util.ConvertPaymentHash(createInvoiceResponse.PaymentHash) // insert card_receipt record diff --git a/docker/card/web/wallet_api_auth.go b/docker/card/web/wallet_api_auth.go index 37f4fd0..509277e 100644 --- a/docker/card/web/wallet_api_auth.go +++ b/docker/card/web/wallet_api_auth.go @@ -7,7 +7,6 @@ import ( "encoding/json" "net/http" - _ "github.com/mattn/go-sqlite3" log "github.com/sirupsen/logrus" ) diff --git a/docker/card/web/wallet_api_balance.go b/docker/card/web/wallet_api_balance.go index 1e59566..738a9bb 100644 --- a/docker/card/web/wallet_api_balance.go +++ b/docker/card/web/wallet_api_balance.go @@ -5,7 +5,6 @@ import ( "net/http" - _ "github.com/mattn/go-sqlite3" log "github.com/sirupsen/logrus" ) diff --git a/docker/card/web/wallet_api_create.go b/docker/card/web/wallet_api_create.go index aaa90fd..28be72e 100644 --- a/docker/card/web/wallet_api_create.go +++ b/docker/card/web/wallet_api_create.go @@ -7,7 +7,6 @@ import ( "encoding/json" "net/http" - _ "github.com/mattn/go-sqlite3" log "github.com/sirupsen/logrus" ) diff --git a/docker/card/web/wallet_api_getcard.go b/docker/card/web/wallet_api_getcard.go index c23bae8..8ced774 100644 --- a/docker/card/web/wallet_api_getcard.go +++ b/docker/card/web/wallet_api_getcard.go @@ -6,7 +6,6 @@ import ( "net/http" - _ "github.com/mattn/go-sqlite3" log "github.com/sirupsen/logrus" ) diff --git a/docker/card/web/wallet_api_getcardkeys.go b/docker/card/web/wallet_api_getcardkeys.go index 92f4f68..d4f6f4b 100644 --- a/docker/card/web/wallet_api_getcardkeys.go +++ b/docker/card/web/wallet_api_getcardkeys.go @@ -5,7 +5,6 @@ import ( "net/http" - _ "github.com/mattn/go-sqlite3" log "github.com/sirupsen/logrus" ) diff --git a/docker/card/web/wallet_api_gettxs.go b/docker/card/web/wallet_api_gettxs.go index 4fcf2a4..6f3d4b7 100644 --- a/docker/card/web/wallet_api_gettxs.go +++ b/docker/card/web/wallet_api_gettxs.go @@ -6,7 +6,6 @@ import ( "net/http" "strconv" - _ "github.com/mattn/go-sqlite3" log "github.com/sirupsen/logrus" ) diff --git a/docker/card/web/wallet_api_getuserinvoices.go b/docker/card/web/wallet_api_getuserinvoices.go index d6f960e..a5f0285 100644 --- a/docker/card/web/wallet_api_getuserinvoices.go +++ b/docker/card/web/wallet_api_getuserinvoices.go @@ -9,7 +9,6 @@ import ( "net/http" "strconv" - _ "github.com/mattn/go-sqlite3" log "github.com/sirupsen/logrus" ) diff --git a/docker/card/web/wallet_api_payinvoice.go b/docker/card/web/wallet_api_payinvoice.go index 6f7fbe3..139fd68 100644 --- a/docker/card/web/wallet_api_payinvoice.go +++ b/docker/card/web/wallet_api_payinvoice.go @@ -9,7 +9,6 @@ import ( "net/http" "strconv" - _ "github.com/mattn/go-sqlite3" decodepay "github.com/nbd-wtf/ln-decodepay" log "github.com/sirupsen/logrus" ) diff --git a/docker/card/web/wallet_api_wipecard.go b/docker/card/web/wallet_api_wipecard.go index 47f5210..ece7ab6 100644 --- a/docker/card/web/wallet_api_wipecard.go +++ b/docker/card/web/wallet_api_wipecard.go @@ -5,7 +5,6 @@ import ( "net/http" - _ "github.com/mattn/go-sqlite3" log "github.com/sirupsen/logrus" ) diff --git a/docker/card/web/web_test.go b/docker/card/web/web_test.go index 53cf8e5..94a1bfe 100644 --- a/docker/card/web/web_test.go +++ b/docker/card/web/web_test.go @@ -9,8 +9,6 @@ import ( "os" "strings" "testing" - - _ "github.com/mattn/go-sqlite3" ) func openTestDB(t *testing.T) *sql.DB {