diff --git a/db/db.go b/db/db.go index 1dfac20..316dceb 100644 --- a/db/db.go +++ b/db/db.go @@ -867,7 +867,7 @@ func Wipe_card(card_name string) (*Card_wipe_info, error) { return &card_wipe_info, nil } -func Update_card(card_name string, tx_limit_sats int, day_limit_sats int, lnurlw_enable bool) error { +func Update_card(card_name string, lnurlw_enable bool, tx_limit_sats int, day_limit_sats int) error { lnurlw_enable_yn := "N" if lnurlw_enable { @@ -882,10 +882,10 @@ func Update_card(card_name string, tx_limit_sats int, day_limit_sats int, lnurlw defer db.Close() - sqlStatement := `UPDATE cards SET tx_limit_sats = $2, lnurlw_enable = $3, day_limit_sats = $4 ` + + sqlStatement := `UPDATE cards SET lnurlw_enable = $2, tx_limit_sats = $3, day_limit_sats = $4 ` + `WHERE card_name = $1;` - res, err := db.Exec(sqlStatement, card_name, tx_limit_sats, lnurlw_enable_yn, day_limit_sats) + res, err := db.Exec(sqlStatement, card_name, lnurlw_enable_yn, tx_limit_sats, day_limit_sats) if err != nil { return err diff --git a/docs/DOCKER_INSTALL.md b/docs/DOCKER_INSTALL.md index 8145361..33e8156 100644 --- a/docs/DOCKER_INSTALL.md +++ b/docs/DOCKER_INSTALL.md @@ -56,5 +56,5 @@ Run `$ docker ps` to list containers and get container names/ids #### running internal API commands - `docker exec boltcard_main curl 'localhost:9001/createboltcard?card_name=card_5&enable=false&tx_max=1000&day_max=10000&uid_privacy=true&allow_neg_bal=true'` -- `docker exec boltcard_main curl 'localhost:9001/updateboltcard?card_name=card_5&enable=true&tx_max=100'` +- `docker exec boltcard_main curl 'localhost:9001/updateboltcard?card_name=card_5&enable=true&tx_max=100&day_max=1000'` - `docker exec boltcard_main curl 'localhost:9001/wipeboltcard?card_name=card_5'` diff --git a/docs/FAQ.md b/docs/FAQ.md index 8289c09..ef30e43 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -1,29 +1,27 @@ -# FAQ - -> How do you bech32 encode a string on the card ? +# How do you bech32 encode a string on the card ? The LNURLw that comes from the bolt card is not bech32 encoded. It uses [LUD-17](https://github.com/fiatjaf/lnurl-rfc/blob/luds/17.md). -> How do I generate a random key value ? +# How do I generate a random key value ? This will give you a new 128 bit random key as a 32 character hex value. `$ hexdump -vn16 -e'4/4 "%08x" 1 "\n"' /dev/random` -> Why do I get a payment failure with NO_ROUTE ? +# Why do I get a payment failure with NO_ROUTE ? This is due to your payment lightning node not finding a route to the merchant lightning node. It may help to open well funded channels to other well connected nodes. It may also help to increase your maximum network fee in your service variables, **FEE_LIMIT_SAT** / **FEE_LIMIT_PERCENT** . It can be useful to test paying invoices directly from your lightning node. -> Why do my payments take so long ? +# Why do my payments take so long ? This is due to the time taken for your payment lightning node to find a route. It can be improved by opening channels using clearnet rather than on the tor network. It may also help to improve your lightning node hardware or software setup. It can be useful to test paying invoices directly from your lightning node. -> Can I use the same lightning node for the customer (bolt card) and the merchant (POS) ? +# Can I use the same lightning node for the customer (bolt card) and the merchant (POS) ? When tested with LND in Nov 2022, the paying (customer, bolt card) lightning node must be a separate instance to the invoicing (merchant, POS) lightning node. diff --git a/docs/SETTINGS.md b/docs/SETTINGS.md index 31cc6b4..e42df0b 100644 --- a/docs/SETTINGS.md +++ b/docs/SETTINGS.md @@ -9,7 +9,7 @@ Here are the descriptions of values available to use in the `settings` table: | --- | --- | --- | | LOG_LEVEL | DEBUG | system logs are verbose to enable easier debug | | | PRODUCTION | system logs are minimal | -| AES_DECRYPT_KEY | | hex encoded 128 bit AES key | +| AES_DECRYPT_KEY | | hex encoded 128 bit AES key - see [FAQ](FAQ.md#how-do-i-generate-a-random-key-value-)| | HOST_DOMAIN | yourdomain.com | the domain for hosting lnurlw & lnurlp services | | MIN_WITHDRAW_SATS | 1 | minimum satoshis for lnurlw response | | MAX_WITHDRAW_SATS | 1000000 | maximum satoshis for lnurlw response | @@ -27,3 +27,6 @@ Here are the descriptions of values available to use in the `settings` table: | AWS_SES_SECRET | | Amazon Web Services - Simple Email Service - access secret | | AWS_SES_EMAIL_FROM | | Amazon Web Services - Simple Email Service - email from field | | EMAIL_MAX_TXS | | maximum number of transactions to include in the email body | +| FUNCTION_LNDHUB | DISABLE | system level switch for using LNDHUB in place of LND | +| LNDHUB_URL | | URL for the LNDHUB service | +| FUNCTION_INTERNAL_API | DISABLE | system level switch for activating the internal API | diff --git a/internalapi/updateboltcard.go b/internalapi/updateboltcard.go index 39d83c2..4566681 100644 --- a/internalapi/updateboltcard.go +++ b/internalapi/updateboltcard.go @@ -17,6 +17,15 @@ func Updateboltcard(w http.ResponseWriter, r *http.Request) { return } + enable_flag_str := r.URL.Query().Get("enable") + enable_flag, err := strconv.ParseBool(enable_flag_str) + if err != nil { + msg := "updateboltcard: enable is not a valid boolean" + log.Warn(msg) + resp_err.Write_message(w, msg) + return + } + tx_max_str := r.URL.Query().Get("tx_max") tx_max, err := strconv.Atoi(tx_max_str) if err != nil { @@ -35,15 +44,6 @@ func Updateboltcard(w http.ResponseWriter, r *http.Request) { return } - enable_flag_str := r.URL.Query().Get("enable") - enable_flag, err := strconv.ParseBool(enable_flag_str) - if err != nil { - msg := "updateboltcard: enable is not a valid boolean" - log.Warn(msg) - resp_err.Write_message(w, msg) - return - } - card_name := r.URL.Query().Get("card_name") // check if card_name exists @@ -69,7 +69,7 @@ func Updateboltcard(w http.ResponseWriter, r *http.Request) { // update the card record - err = db.Update_card(card_name, tx_max, day_max, enable_flag) + err = db.Update_card(card_name, enable_flag, tx_max, day_max) if err != nil { log.Warn(err.Error()) return